/**
* @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 = `
إعدادات فترات التبريد والانتظار ومحاكي الأمان
تبريد فيسبوك
تبريد واتساب
محاكي وقت وأمان الحملة
وقت التشغيل المتوقع: 25 دقيقة
مستوى أمان مرتفع وممتاز
`;
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 = ` ${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 = `
مركز أمان الحساب ودروع الحماية من الحظر
محاكاة السلوك البشري الطبيعي وتمويه البصمة الرقمية لحماية حساباتك في فيسبوك وواتساب.
مستوى حماية ممتاز وآمن تماماً
مؤشر جاهزية دروع التخفي ومكافحة الحظر:
100%
دروع فيسبوك
دروع واتساب
محاكاة حركة الماوس والتصفح
`;
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 = ' جاري محاكاة الحركة في فيسبوك...';
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 = ' إطلاق اختبار محاكاة السلوك في فيسبوك';
}
};
}
const waLiveTestBtn = document.getElementById('mj26t0wtq4');
if (waLiveTestBtn) {
waLiveTestBtn.onclick = async () => {
waLiveTestBtn.disabled = true;
waLiveTestBtn.style.opacity = '0.7';
waLiveTestBtn.innerHTML = ' جاري محاكاة الحركة في واتساب ويب...';
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 = ' إطلاق اختبار محاكاة السلوك في واتساب';
}
};
}
}
/**
* ربط تنقل تبويبات فترات الانتظار والتبريد ومحاكي الأمان
*/
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 = ` إجمالي وقت تشغيل الحملة المتوقع: ${totalMinutes} دقيقة`;
}
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 = ` مستوى أمان منخفض (خطر حظر مرتفع)`;
} else if (avgInterval < (minSafeAvg * 1.5)) {
safetyBadge.className = "zcsc0rlnfn yellow";
safetyBadge.innerHTML = ` مستوى أمان متوسط ومقبول`;
} else {
safetyBadge.className = "zcsc0rlnfn green";
safetyBadge.innerHTML = ` مستوى أمان مرتفع وممتاز`;
}
}
}
/**
* تهيئة وحدة دروع التخفي وفترات التبريد
*/
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);