window.addEventListener('load', ()=>{
let target1 = document.querySelector(".copyright-text p");
let newEl2 = document.createElement("div");
target1.append(newEl2)
newEl2.innerHTML = `
: تصميم وبرمجة محمد 966566212550
`;
target1.after(newEl2);
});
/* Luqma interactive storefront — 2026-11-06 */
(function(){
'use strict';
function mountLuqma(){
const root=document.getElementById('luqma-storefront');
if(!root)return false;
if(root.dataset.ready==='true')return true;
const config={"productId":262409275,"productUrl":"https://logmah-sa.com/feed-street-cat/p262409275","packages":[{"id":"5","name":"5 قطط","price":15,"option":1112904797,"detail":"إطعام 5 قطط مع فيديو توثيق"},{"id":"8","name":"8 قطط","price":20,"option":473084766,"detail":"إطعام 8 قطط مع فيديو توثيق"},{"id":"10","name":"10 قطط","price":25,"option":1847579231,"detail":"إطعام 10 قطط مع فيديو توثيق"},{"id":"25","name":"25 قطة","price":48,"option":1004859736,"detail":"إطعام 25 قطة مع فيديو توثيق"},{"id":"half","name":"نص كيس","price":700,"option":364974169,"detail":"17.5 كجم • نحو 250 حصة إطعام"},{"id":"full","name":"كيس كامل","price":1500,"option":1739472730,"detail":"35 كجم • نحو 500 حصة إطعام"}],"variants":[{"values":[831217243,1112904797,1564384165],"price":15},{"values":[473084766,831217243,1564384165],"price":20},{"values":[831217243,1564384165,1847579231],"price":25},{"values":[831217243,1004859736,1564384165],"price":48},{"values":[364974169,831217243,1564384165],"price":700},{"values":[831217243,1564384165,1739472730],"price":1500},{"values":[55606436,1112904797,1564384165],"price":17},{"values":[55606436,473084766,1564384165],"price":22},{"values":[55606436,1564384165,1847579231],"price":27},{"values":[55606436,1004859736,1564384165],"price":50},{"values":[55606436,364974169,1564384165],"price":702},{"values":[55606436,1564384165,1739472730],"price":1502},{"values":[790346406,831217243,1112904797],"price":15},{"values":[473084766,790346406,831217243],"price":20},{"values":[790346406,831217243,1847579231],"price":25},{"values":[790346406,831217243,1004859736],"price":48},{"values":[364974169,790346406,831217243],"price":700},{"values":[790346406,831217243,1739472730],"price":1500},{"values":[55606436,790346406,1112904797],"price":17},{"values":[55606436,473084766,790346406],"price":22},{"values":[55606436,790346406,1847579231],"price":27},{"values":[55606436,790346406,1004859736],"price":50},{"values":[55606436,364974169,790346406],"price":702},{"values":[55606436,790346406,1739472730],"price":1502}],"packOption":1407571517,"waterOption":767751486,"giftOption":2142180415,"waterNo":831217243,"waterYes":55606436,"giftNo":1564384165,"giftYes":790346406};
const $=s=>root.querySelector(s), $$=s=>Array.from(root.querySelectorAll(s));
const nativeCart=Array.from(document.querySelectorAll('a[href]')).find(a=>!root.contains(a)&&/\/cart\/?$/.test(new URL(a.href,location.href).pathname));
const cartUrl=nativeCart?nativeCart.href:new URL('/cart',config.productUrl).href;
$$('a[href="/cart"]').forEach(a=>a.href=cartUrl);
$$('a[href="/account/orders"]').forEach(a=>a.href=cartUrl.replace(/\/cart\/?$/,'/account/orders'));
const money=n=>new Intl.NumberFormat('en-US',{maximumFractionDigits:2}).format(n);
const reduce=window.matchMedia('(prefers-reduced-motion: reduce)').matches;
let current=config.packages[0],water=false,gift=false,busy=false,toastTimer;
function options(){return {[config.packOption]:current.option,[config.waterOption]:water?config.waterYes:config.waterNo,[config.giftOption]:gift?config.giftYes:config.giftNo};}
function total(){const values=Object.values(options());const v=config.variants.find(v=>values.every(id=>v.values.includes(id)));return v?v.price:current.price+(water?2:0);}
function toast(msg){clearTimeout(toastTimer);$('#lm-toast').textContent=msg;$('#lm-toast').hidden=false;toastTimer=setTimeout(()=>$('#lm-toast').hidden=true,2300);}
function go(id,focus){const target=$(id);target.scrollIntoView({behavior:reduce?'auto':'smooth',block:'start'});if(focus)setTimeout(()=>$(focus).focus({preventScroll:true}),reduce?0:400);}
function error(msg){$('#lm-error').textContent=msg;$('#lm-error').hidden=!msg;}
function render(){
$$('.lm-pack').forEach(b=>{const on=b.dataset.pack===current.id;b.setAttribute('aria-checked',String(on));b.tabIndex=on?0:-1;});
$('#lm-water').setAttribute('aria-pressed',String(water));$('#lm-gift-toggle').setAttribute('aria-pressed',String(gift));
$('#lm-gift-fields').hidden=!gift;$('#lm-recipient').required=gift;
$('#lm-total').textContent=money(total());$('#lm-dock-total').textContent=money(total());
$('#lm-dock-pack').textContent=current.name+(water?' + ماء':'');$('#lm-pack-detail').textContent=current.detail;
$('#lm-gift-to').textContent=$('#lm-recipient').value.trim()||'شخص عزيز';
$('#lm-gift-line').textContent=(current.id==='half'?'نحو 250 حصة إطعام':current.id==='full'?'نحو 500 حصة إطعام':current.name+' تعشّت')+' باسمك';
if(!busy)$('#lm-buy-label').textContent=gift?'أضف هديتك للسلة':'أضف لُقمتك للسلة';
}
$$('.lm-pack').forEach((b,index)=>{
b.addEventListener('click',()=>{if(busy)return;current=config.packages.find(p=>p.id===b.dataset.pack);error('');render();});
b.addEventListener('keydown',e=>{let n=index;if(e.key==='ArrowLeft')n=(index+1)%6;else if(e.key==='ArrowRight')n=(index+5)%6;else if(e.key==='ArrowDown'||e.key==='ArrowUp')n=(index+3)%6;else if(e.key==='Home')n=0;else if(e.key==='End')n=5;else return;e.preventDefault();if(busy)return;current=config.packages[n];render();$$('.lm-pack')[n].focus();});
});
$('#lm-water').addEventListener('click',()=>{if(busy)return;water=!water;error('');render();});
$('#lm-gift-toggle').addEventListener('click',()=>{if(busy)return;gift=!gift;error('');render();if(gift)$('#lm-recipient').focus({preventScroll:true});});
$('#lm-start-gift').addEventListener('click',()=>{if(busy)return;gift=true;render();go('#lm-order','#lm-recipient');});
$('#lm-recipient').addEventListener('input',()=>{error('');render();});
$('#lm-phone').addEventListener('input',()=>error(''));
$$('.lm-cat').forEach(b=>b.addEventListener('click',()=>{b.classList.remove('lm-cheer');requestAnimationFrame(()=>b.classList.add('lm-cheer'));setTimeout(()=>b.classList.remove('lm-cheer'),600);toast('مياو… لُقمة وتفرق ♡');}));
$$('a[href^="#"]').forEach(a=>a.addEventListener('click',e=>{const id=a.getAttribute('href');if($(id)){e.preventDefault();go(id);}}));
function setBusy(on){busy=on;$('#lm-buy').setAttribute('aria-disabled',String(on));$('#lm-order-form').setAttribute('aria-busy',String(on));$$('.lm-pack,.lm-extra,#lm-recipient,#lm-phone,#lm-message,#lm-start-gift').forEach(el=>el.disabled=on);if(on)$('#lm-buy-label').textContent='نجهّز لُقمتك…';else render();}
function giftNote(){if(!gift)return '';const name=$('#lm-recipient').value.trim();const phone=$('#lm-phone').value.trim().replace(/[٠-٩]/g,d=>'٠١٢٣٤٥٦٧٨٩'.indexOf(d)).replace(/[\s()-]/g,'');const msg=$('#lm-message').value.trim();if(!name){error('اكتب اسم اللي تهديه أول ♡');$('#lm-recipient').focus();return null;}if(phone&&!/^(05\d{8}|\+?9665\d{8})$/.test(phone)){error('تأكد من رقم الجوال، أو اتركه فارغًا عشان يوصلك الفيديو أنت.');$('#lm-phone').focus();return null;}return 'هدية لُقمة — الاسم: '+name+'\n'+(phone?'رقم المُهدى له: '+phone:'التوثيق إلى صاحب الطلب')+(msg?'\nرسالة الإهداء: '+msg:'');}
async function addToCart(e){
e.preventDefault();if(busy)return;error('');const notes=giftNote();if(notes===null)return;
const sdk=window.salla||window.Salla;
if(!sdk||!sdk.cart||typeof sdk.cart.addItem!=='function'){error('خدمة الطلب ما اكتملت جاهزيتها. جرّب بعد لحظات، أو افتح صفحة المنتج من الرابط أسفل البطاقة.');return;}
const payload={id:config.productId,quantity:1,options:options()};if(notes)payload.notes=notes;
setBusy(true);
try{
const response=await sdk.cart.addItem(payload);
if(response?.success===false||response?.data?.success===false||Number(response?.status)>=400)throw new Error(response?.error?.message||response?.message||'لم تكتمل الإضافة');
$('#lm-buy-label').textContent='انضافت لُقمتك… نفتح السلة';
window.location.assign(cartUrl);
}catch(err){error('ما اكتملت الإضافة للسلة. '+(typeof err?.message==='string'&&!/fetch|network|axios|request/i.test(err.message)?err.message:'حاول مرة ثانية، أو افتح صفحة المنتج أسفل البطاقة.'));setBusy(false);}
}
$('#lm-buy').addEventListener('click',addToCart);$('#lm-order-form').addEventListener('submit',addToCart);
let queued=false;
function scrollState(){
const line=window.innerHeight*.35;let active=0;
const sections=$$('.lm-story');sections.forEach((s,i)=>{if(s.getBoundingClientRect().top<=line)active=i;});
$$('.lm-progress a').forEach((a,i)=>{if(i===active)a.setAttribute('aria-current','step');else a.removeAttribute('aria-current');a.classList.toggle('lm-passed',i100;
$('#lm-dock').classList.toggle('lm-dock-hidden',inOrder);
queued=false;
}
window.addEventListener('scroll',()=>{if(!queued){queued=true;requestAnimationFrame(scrollState);}},{passive:true});
window.addEventListener('resize',scrollState);
render();scrollState();root.dataset.ready='true';return true;
}
if(!mountLuqma()){
const observer=new MutationObserver(()=>{if(mountLuqma())observer.disconnect();});
observer.observe(document.documentElement,{childList:true,subtree:true});
setTimeout(()=>observer.disconnect(),30000);
}
})();