/* OK ITHAKI V249524 - SINGLE BIL ALERTS / SINGLE COMMUNITY SCREEN / SHARE CHOICE */
(function(){
'use strict';
if(window.__ITHAKI_V249524_OWNER__)return;
window.__ITHAKI_V249524_OWNER__={version:'V249524',singleBil:true,bilBottomLeft:true,bilFirstGreeting:true,bilNotificationSpeech:true,bilWisdomEvery3000Seconds:true,singleCommunityOwner:true,shareChoiceFriendExternal:true,greenSendOwned:true,apkSynced:true,at:Date.now()};
const I=()=>window.ITH||{}; const S=()=>window.state||I().state||{}; const $=id=>document.getElementById(id);
const esc=s=>String(s==null?'':s).replace(/[&<>"']/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]));
const shareState={lastTap:0,busy:false,busyAt:0}; let bilHideTimer=0,bilPollTimer=0,bilWisdomTimer=0,lastCommunityId='';
const wisdom=[
 'Να μιλάς καθαρά και να ακούς με υπομονή.',
 'Οι ανθρώπινες σχέσεις δυναμώνουν όταν υπάρχει σεβασμός.',
 'Μια ειλικρινής κουβέντα μπορεί να μικρύνει μεγάλη απόσταση.',
 'Η εμπιστοσύνη χτίζεται αργά και προστατεύεται καθημερινά.',
 'Πριν απαντήσεις, άφησε λίγο χώρο για να καταλάβεις.',
 'Η καλοσύνη είναι δύναμη όταν συνοδεύεται από όρια.',
 'Δεν χρειάζεται να συμφωνούμε για να φερόμαστε ανθρώπινα.',
 'Η συγγνώμη έχει αξία όταν ακολουθείται από αλλαγή.'
];
function toast(m,ms=5500){try{if(I().toast)return I().toast(String(m),ms)}catch(e){}const t=$('toast');if(t){t.textContent=String(m);t.classList.add('show');clearTimeout(toast._t);toast._t=setTimeout(()=>t.classList.remove('show'),ms)}else console.log(m)}
function device(){return String(S().device||localStorage.getItem('ith_device')||localStorage.getItem('ith_device_id')||'')}
function room(){return String(S().room||localStorage.getItem('ith_room')||'ithaki-phone-test')}
function token(){return String(localStorage.getItem('ith_public_token')||localStorage.getItem('ith_token')||'')}
function apiBase(){try{const b=window.AndroidBridge||window.OKITHAKI_ANDROID;if(b&&typeof b.getServerBase==='function'){const x=String(b.getServerBase()||'').trim();if(x)return x.replace(/\/$/,'')}}catch(e){}return /^https?:/i.test(location.origin)?location.origin:'https://ok-ithaki.gr'}
function fullUrl(u){try{return new URL(String(u||''),apiBase()+'/').toString()}catch(e){return String(u||'')}}
function safeName(n,f='ITHAKI_file'){n=String(n||'').split(/[?#]/)[0].split('/').pop()||f;try{n=decodeURIComponent(n)}catch(e){}return n.replace(/[\\/:*?"<>|]+/g,'_').slice(0,120)||f}
function mimeFor(n,m=''){if(m&&m!=='application/octet-stream')return m;const x=String(n||'').toLowerCase();if(/\.(mp4|m4v|mov)$/.test(x))return'video/mp4';if(/\.webm$/.test(x))return'video/webm';if(/\.(jpg|jpeg)$/.test(x))return'image/jpeg';if(/\.png$/.test(x))return'image/png';if(/\.pdf$/.test(x))return'application/pdf';if(/\.txt$/.test(x))return'text/plain';if(/\.mp3$/.test(x))return'audio/mpeg';return m||'application/octet-stream'}
function bridge(){return window.AndroidBridge||window.OKITHAKI_ANDROID||null}
function clearShareBusy(){shareState.busy=false;shareState.busyAt=0;document.documentElement.removeAttribute('data-ithaki-share-busy-v249524')}
function beginExternal(){const now=Date.now();if(now-shareState.lastTap<700)return false;shareState.lastTap=now;if(shareState.busy&&now-shareState.busyAt<12000){toast('Η κοινοποίηση ετοιμάζεται.');return false}clearShareBusy();shareState.busy=true;shareState.busyAt=now;document.documentElement.setAttribute('data-ithaki-share-busy-v249524','1');setTimeout(clearShareBusy,12000);return true}
function blobData(blob){return new Promise((res,rej)=>{const r=new FileReader();r.onload=()=>res(String(r.result||''));r.onerror=()=>rej(r.error||Error('file_read_failed'));r.readAsDataURL(blob)})}
async function browserExternalBlob(blob,name,mime){const f=new File([blob],name,{type:mime||blob.type||'application/octet-stream'});try{if(navigator.canShare&&navigator.canShare({files:[f]})&&navigator.share){await navigator.share({files:[f],title:'OK ITHAKI'});return true}}catch(e){if(e&&e.name==='AbortError')return false;console.warn(e)}const a=document.createElement('a');a.href=URL.createObjectURL(blob);a.download=name;document.body.appendChild(a);a.click();setTimeout(()=>{URL.revokeObjectURL(a.href);a.remove()},1800);toast('Το αρχείο αποθηκεύτηκε επειδή δεν άνοιξε η κοινοποίηση.');return true}
async function externalBlob(blob,name='ITHAKI_file',mime=''){name=safeName(name);mime=mimeFor(name,mime||blob.type);if(!beginExternal())return false;try{const b=bridge();if(b&&typeof b.shareBase64FileV249524==='function'&&blob.size<=24*1024*1024){const r=String(b.shareBase64FileV249524(name,mime,await blobData(blob))||'');if(/^(ok|queued)/i.test(r))return true;throw Error(r||'native_file_share_failed')}if(b&&typeof b.shareBase64FileV249523==='function'&&blob.size<=24*1024*1024){const r=String(b.shareBase64FileV249523(name,mime,await blobData(blob))||'');if(/^(ok|queued)/i.test(r))return true}return await browserExternalBlob(blob,name,mime)}catch(e){toast('Η εξωτερική κοινοποίηση απέτυχε: '+String(e&&e.message||e),7000);return false}finally{setTimeout(clearShareBusy,900)}}
async function externalRemote(url,name='',mime=''){const u=fullUrl(url);name=safeName(name||u);mime=mimeFor(name,mime);if(!u)return toast('Δεν υπάρχει αρχείο για κοινοποίηση.');if(!beginExternal())return false;try{const b=bridge();const fn=b&&(b.shareRemoteFileV249524||b.shareRemoteFileV249523);if(typeof fn==='function'){const r=String(fn.call(b,u,name,mime,token(),device(),room())||'');if(/^(ok|queued)/i.test(r))return true;console.warn('native share fallback',r)}const h={};if(token())h['X-ITHAKI-TOKEN']=token();if(device())h['X-ITHAKI-DEVICE-ID']=device();const r=await fetch(u,{cache:'no-store',credentials:'include',headers:h});if(!r.ok)throw Error('HTTP '+r.status);return await browserExternalBlob(await r.blob(),name,mime)}catch(e){toast('Η εξωτερική κοινοποίηση απέτυχε: '+String(e&&e.message||e),7000);return false}finally{setTimeout(clearShareBusy,900)}}
async function friends(){try{const f=I().loadServerFriendsV249429||I().loadServerFriends;return typeof f==='function'?(await f.call(I(),true)||[]):[]}catch(e){return[]}}
function closeShareChoice(){const x=$('ith524ShareChoice');if(x)x.remove()}
function dmChannel(peer){return 'dm:'+ [device(),String(peer)].sort().join(':')}
async function sendMediaFriend(peer,media){try{if(!window.sendMessagePayload)throw Error('Η αποστολή μηνύματος δεν είναι διαθέσιμη.');await window.sendMessagePayload(dmChannel(peer),JSON.stringify({body:'',media}));closeShareChoice();toast('Το πραγματικό αρχείο στάλθηκε στον φίλο.');const f=I().startDM||I().openDMWith;if(typeof f==='function')setTimeout(()=>f.call(I(),peer),80);return true}catch(e){toast('Δεν στάλθηκε στον φίλο: '+String(e.message||e),7000);return false}}
async function uploadBlob(blob,name,mime){const file=blob instanceof File?blob:new File([blob],name,{type:mime});if(typeof window.uploadWithProgress!=='function')throw Error('Δεν είναι διαθέσιμη η μεταφόρτωση αρχείου.');const up=await window.uploadWithProgress(file,'file',true);return{url:up.url||up.file_url,filename:up.filename||name,mime_type:up.mime_type||mime,kind:mime.startsWith('video/')?'video':mime.startsWith('image/')?'photo':mime.startsWith('audio/')?'audio':'file',size:up.size_bytes||file.size,meta_id:up.meta_id||'',serverStored:true}}
async function showChoice(media,blob){closeShareChoice();const d=document.createElement('div');d.id='ith524ShareChoice';d.innerHTML=`<section><header><button data-close>‹</button><b>Κοινοποίηση αρχείου</b><button data-close>×</button></header><button class="external" data-external>↗ Εξωτερικά</button><div class="label">Αποστολή σε φίλο ΙΘΑΚΗΣ</div><div class="friends"><div class="card">Φόρτωση φίλων…</div></div></section>`;document.body.appendChild(d);d.addEventListener('click',e=>{if(e.target===d||e.target.closest('[data-close]'))closeShareChoice()});d.querySelector('[data-external]').onclick=()=>{closeShareChoice();blob?externalBlob(blob,media.filename,media.mime_type):externalRemote(media.url,media.filename,media.mime_type)};const list=await friends(),box=d.querySelector('.friends');box.innerHTML=list.length?list.map(p=>{const id=String(p.device_id||p.id||''),nm=String(p.nickname||p.name||'Φίλος'),av=String(p.avatar||p.photo||'');return `<button class="friend" data-peer="${esc(id)}"><span class="avatar">${av?`<img src="${esc(fullUrl(av))}" alt="">`:esc((nm[0]||'Μ').toUpperCase())}</span><span><b>${esc(nm)}</b><small>Αποστολή πραγματικού αρχείου</small></span><i>➤</i></button>`}).join(''):'<div class="card">Δεν υπάρχουν αποδεκτοί φίλοι.</div>';box.onclick=async e=>{const b=e.target.closest('[data-peer]');if(!b)return;b.disabled=true;try{let m=media;if(blob)m=await uploadBlob(blob,media.filename,media.mime_type);await sendMediaFriend(b.dataset.peer,m)}finally{b.disabled=false}}}
function chooseRemote(url,name='',mime=''){const u=fullUrl(url),n=safeName(name||u),m=mimeFor(n,mime);return showChoice({url:u,filename:n,mime_type:m,kind:m.startsWith('video/')?'video':m.startsWith('image/')?'photo':m.startsWith('audio/')?'audio':'file'},null)}
function chooseBlob(blob,name='ITHAKI_file',mime=''){name=safeName(name);mime=mimeFor(name,mime||blob.type);return showChoice({url:'',filename:name,mime_type:mime,kind:mime.startsWith('video/')?'video':mime.startsWith('image/')?'photo':mime.startsWith('audio/')?'audio':'file'},blob)}
function chooseText(text,name='ITHAKI_message.txt'){return chooseBlob(new Blob([String(text||'')],{type:'text/plain;charset=utf-8'}),name,'text/plain')}
function installShare(){if(window.__ITHAKI_V249526R3_OWNER__)return;const o=I();Object.assign(o,{externalActualFileV249524:externalRemote,externalBlobV249524:externalBlob,shareActualFileV249524:chooseRemote,shareActualFileV249523:chooseRemote,shareBlobV249524:chooseBlob,shareBlobV249523:chooseBlob,shareTextFileV249524:chooseText,shareTextFileV249523:chooseText,shareTextFileV249522:chooseText,shareMediaFile:(url,name='',mime='')=>{chooseRemote(url,name,mime);return false}});window.shareMediaFile=o.shareMediaFile;window.shareActualUrlFileV249521=chooseRemote}
function removeOldBil(){['ith523HomeBilCard','ith523BilNotificationCard','ithBilGreenTurtleV249461','ithBilMenuV249461','ithBilPopV249461','ithBilStableV249475','ithBilStableMenuV249475','ithProfileBilCardV249476','ithAdminContactCardV249476','ith477BilNotificationCard','ith509BilNotificationCard'].forEach(id=>$(id)?.remove());document.querySelectorAll('[data-bil-notification-card],.bil473Preview,.bil475Preview,.ithBilHomeCardV249472').forEach(x=>{if(x.closest('#ith524BilDock'))return;const c=x.closest('.card');if(c&&/Bil|Βιλ/i.test(String(c.textContent||'')))c.remove();else x.remove()})}
function bilFace(){return '<span class="ith524Face"><i class="shell"></i><i class="head"><i class="eye l"></i><i class="eye r"></i><i class="mouth"></i></i><i class="foot l"></i><i class="foot r"></i></span>'}
function onBilPage(){const p=String(document.body?.dataset.page||S().page||'home');return p==='home'||/notify|notification/i.test(String(document.querySelector('.page.active,.memberMenu.show')?.textContent||''))}
function ensureBil(){if(window.__ITHAKI_V249525_NOTIFICATION_OWNER__)return null;removeOldBil();let d=$('ith524BilDock');if(!d){d=document.createElement('button');d.id='ith524BilDock';d.type='button';d.setAttribute('aria-label','Bil');d.innerHTML=bilFace()+'<span id="ith524BilSpeech" class="speech"></span>';d.onclick=()=>showBil(wisdom[Math.floor(Math.random()*wisdom.length)]);document.body.appendChild(d)}d.hidden=!onBilPage();return d}
function showBil(text,action){const d=ensureBil(),s=$('ith524BilSpeech');if(!d||!s)return;d.hidden=false;s.textContent=String(text||'');s.classList.add('show');d.onclick=()=>{if(typeof action==='function')action();else showBil(wisdom[Math.floor(Math.random()*wisdom.length)])};clearTimeout(bilHideTimer);bilHideTimer=setTimeout(()=>s.classList.remove('show'),5000)}
function noticeName(x){return String(x.from_name||x.nickname||x.sender_name||x.actor_name||x.name||'κάποιο μέλος')}
function describeNotice(x){const t=String(x.type||x.kind||x.event_type||'').toLowerCase(),n=noticeName(x);if(/message|dm|chat/.test(t))return['Έχεις μήνυμα από '+n+'.',()=>{const f=I().startDM||I().openDMWith;if(typeof f==='function'&&x.from_id)f.call(I(),String(x.from_id));else I().page&&I().page('dm')}];if(/like|reaction/.test(t))return['Έχεις like από '+n+' στη δημοσίευσή σου.',()=>I().notifyCenter&&I().notifyCenter()];if(/follow|follower/.test(t))return['Σε ακολουθεί ο/η '+n+'.',()=>I().notifyCenter&&I().notifyCenter()];if(/profile.*view|view.*profile/.test(t))return['Ο/Η '+n+' είδε το προφίλ σου.',()=>I().notifyCenter&&I().notifyCenter()];if(/post.*view|view.*post/.test(t))return['Ο/Η '+n+' είδε τη δημοσίευσή σου.',()=>I().notifyCenter&&I().notifyCenter()];if(/comment/.test(t))return['Ο/Η '+n+' σχολίασε τη δημοσίευσή σου.',()=>I().notifyCenter&&I().notifyCenter()];if(/reply/.test(t))return['Ο/Η '+n+' απάντησε στη δημοσίευσή σου.',()=>I().notifyCenter&&I().notifyCenter()];if(/friend|contact/.test(t))return['Έχεις αίτημα φιλίας από '+n+'.',()=>I().notifyCenter&&I().notifyCenter()];return null}
function noticeKey(x,p='n'){return p+':'+String(x.id||x.event_id||x.message_id||[x.type,x.from_id,x.created_at].join(':'))}
async function pollBil(){if(!onBilPage()||!device())return;let seen={};try{seen=JSON.parse(localStorage.getItem('ith524BilSeen')||'{}')}catch(e){}const arr=[];try{(JSON.parse(localStorage.getItem('ith_notifications')||'[]')||[]).forEach(x=>arr.push([x,noticeKey(x,'local')]))}catch(e){};for(const [path,pfx] of [[`/api/notifications/social/v249247?room_id=${encodeURIComponent(room())}&device_id=${encodeURIComponent(device())}&limit=40`,'social'],[`/api/notifications/light/v249242?room_id=${encodeURIComponent(room())}&device_id=${encodeURIComponent(device())}&limit=40`,'light']]){try{const r=await fetch(apiBase()+path,{cache:'no-store',credentials:'include'});if(r.ok){const d=await r.json();(d.items||[]).forEach(x=>arr.push([x,noticeKey(x,pfx)]))}}catch(e){}}
 arr.sort((a,b)=>Number(b[0].created_at||b[0].updated_at||0)-Number(a[0].created_at||a[0].updated_at||0));for(const [x,k] of arr){if(seen[k])continue;seen[k]=Date.now();const d=describeNotice(x);if(d){showBil(d[0],d[1]);break}}const keys=Object.keys(seen).sort((a,b)=>seen[b]-seen[a]).slice(0,300),next={};keys.forEach(k=>next[k]=seen[k]);try{localStorage.setItem('ith524BilSeen',JSON.stringify(next))}catch(e){}}
function installBil(){if(window.__ITHAKI_V249525_NOTIFICATION_OWNER__)return;ensureBil();if(!localStorage.getItem('ith524BilIntroduced')){localStorage.setItem('ith524BilIntroduced','1');setTimeout(()=>showBil('Γεια σου, είμαι ο Bil, ο βοηθός σου.'),900)}clearInterval(bilPollTimer);bilPollTimer=setInterval(pollBil,20000);setTimeout(pollBil,2500);clearInterval(bilWisdomTimer);bilWisdomTimer=setInterval(()=>{if(onBilPage())showBil(wisdom[Math.floor(Math.random()*wisdom.length)])},3000000)}
function communityActive(){return document.body?.dataset.page==='spaces'&&!!String(S().currentSpace||'')}
function closeForeign(){['plusSheet','ithShareOverlayV249433','ithFriendPickerV249433'].forEach(id=>$(id)?.classList?.remove('show'));document.querySelectorAll('.legacySpacePanel,.spacesLegacyOverlay,[data-ithaki-legacy-screen-v249429="1"]').forEach(x=>x.remove())}
function stableCommunity(){if(window.__ITHAKI_R10F13_SINGLE_COMMUNITY_RUNTIME__)return false;const o=I();if(!o)return;const activation=o.activateSpacesPageV249516,render=o.renderSpacesV249516,open=o.openSpaceV249516;if(typeof activation==='function'){o.renderSpaces=render;o.activateSpacesPageV249524=activation;window.renderSpaces=render}if(typeof open==='function'){o.openSpace=open;window.openSpace=open}if(document.body?.dataset.page==='spaces'){const sid=String(S().currentSpace||'');if(sid)lastCommunityId=sid;const shell=$('ith516Shell');if(!shell&&typeof activation==='function'){activation();setTimeout(()=>{const id=lastCommunityId||String(S().currentSpace||'');if(id&&typeof open==='function')open(id)},120);return}if(sid&&shell&&!shell.classList.contains('viewChat')){const id=sid;if(typeof open==='function')open(id)}closeForeign()}}
function bindGreenSend(){const input=$('spaceInput');if(!input)return;let b=$('ith524SpaceSend')||input.parentElement?.querySelector('button:last-child');if(!b)return;b.id='ith524SpaceSend';b.removeAttribute('onclick');b.classList.add('ith524Send');if(b.__ith524Bound)return;b.__ith524Bound=true;b.addEventListener('click',async e=>{e.preventDefault();e.stopPropagation();e.stopImmediatePropagation();if(b.disabled)return;const txt=String(input.value||'').trim();if(!txt)return;const fn=I().sendSpaceText||window.sendSpaceText;if(typeof fn!=='function')return toast('Η αποστολή δεν είναι διαθέσιμη.');b.disabled=true;b.classList.add('sending');try{await Promise.resolve(fn.call(I()));setTimeout(stableCommunity,80)}catch(err){toast('Δεν στάλθηκε: '+String(err.message||err),7000)}finally{b.disabled=false;b.classList.remove('sending')}},true)}
function addCss(){if($('ith524Css'))return;const s=document.createElement('style');s.id='ith524Css';s.textContent=`
#ith523HomeBilCard,#ith523BilNotificationCard,#ithBilGreenTurtleV249461,#ithBilMenuV249461,#ithBilPopV249461,#ithBilStableV249475,#ithBilStableMenuV249475,#ithProfileBilCardV249476,#ithAdminContactCardV249476{display:none!important;visibility:hidden!important;pointer-events:none!important}
#ith524BilDock{position:fixed;left:9px;bottom:calc(var(--bar,72px) + 9px);z-index:2147482500;width:58px;height:58px;border:0;background:transparent;padding:0;overflow:visible;filter:drop-shadow(0 8px 13px rgba(0,0,0,.4));touch-action:manipulation}#ith524BilDock[hidden]{display:none!important}.ith524Face{position:relative;display:block;width:58px;height:54px}.ith524Face .shell{position:absolute;left:5px;top:23px;width:43px;height:28px;border-radius:55% 55% 43% 43%;background:radial-gradient(circle at 44% 23%,#ffe49c 0 18%,#62bf89 19% 55%,#246b50 56% 100%);border:1px solid rgba(255,255,255,.5)}.ith524Face .head{position:absolute;left:23px;top:2px;width:27px;height:27px;border-radius:50%;background:#7bdaa0;border:1px solid rgba(255,255,255,.5)}.ith524Face .eye{position:absolute;top:8px;width:4px;height:6px;border-radius:50%;background:#10231e}.ith524Face .eye.l{left:6px}.ith524Face .eye.r{right:6px}.ith524Face .mouth{position:absolute;left:8px;top:17px;width:10px;height:4px;border-bottom:2px solid #17392e;border-radius:0 0 9px 9px}.ith524Face .foot{position:absolute;top:47px;width:11px;height:6px;border-radius:99px;background:#62bf89}.ith524Face .foot.l{left:7px}.ith524Face .foot.r{right:8px}#ith524BilSpeech{position:absolute;left:51px;bottom:32px;width:min(290px,calc(100vw - 82px));padding:9px 11px;border-radius:15px 15px 15px 4px;background:rgba(7,19,31,.96);border:1px solid rgba(126,235,174,.38);color:#fff;font-size:13px;line-height:1.35;text-align:left;opacity:0;visibility:hidden;transform:translateY(5px);transition:.2s;box-shadow:0 12px 30px rgba(0,0,0,.42);pointer-events:none}#ith524BilSpeech.show{opacity:1;visibility:visible;transform:none}
#ith524ShareChoice{position:fixed;inset:0;z-index:2147483400;background:rgba(0,0,0,.78);display:grid;place-items:center;padding:12px;backdrop-filter:blur(8px)}#ith524ShareChoice>section{width:min(450px,96vw);max-height:88dvh;overflow:auto;border-radius:22px;background:#081522;color:#fff;border:1px solid rgba(255,255,255,.16);padding:12px;box-shadow:0 25px 75px rgba(0,0,0,.6)}#ith524ShareChoice header{display:flex;align-items:center;gap:8px;position:sticky;top:-12px;background:#081522;padding:6px 0 10px;z-index:2}#ith524ShareChoice header b{flex:1;text-align:center}#ith524ShareChoice header button{width:40px;height:40px;border-radius:50%;border:1px solid rgba(255,255,255,.16);background:rgba(255,255,255,.08);color:#fff;font-size:22px}#ith524ShareChoice .external{width:100%;min-height:58px;border-radius:17px;border:1px solid rgba(54,240,160,.42);background:rgba(54,240,160,.10);color:#fff;font-weight:900;font-size:16px}#ith524ShareChoice .label{margin:14px 3px 8px;color:#ffe39b;font-weight:900}#ith524ShareChoice .friend{width:100%;display:grid;grid-template-columns:48px 1fr auto;align-items:center;gap:10px;text-align:left;padding:9px;border-radius:15px;border:1px solid rgba(255,255,255,.10);background:rgba(255,255,255,.05);color:#fff;margin:7px 0}#ith524ShareChoice .friend .avatar{width:44px;height:44px;border-radius:50%;overflow:hidden;display:grid;place-items:center;background:rgba(255,255,255,.1);font-weight:900}#ith524ShareChoice .friend img{width:100%;height:100%;object-fit:cover}#ith524ShareChoice .friend small{display:block;opacity:.7;margin-top:3px}
body[data-page="spaces"] #spacesPage{isolation:isolate!important}body[data-page="spaces"] #ith516Shell{position:relative!important;z-index:20!important;pointer-events:auto!important}body[data-page="spaces"] #ith516Shell .composer{position:relative!important;z-index:60!important;pointer-events:auto!important}#ith524SpaceSend{pointer-events:auto!important;opacity:1!important;background:#27d98a!important;color:#03150d!important;border-color:#6dffc3!important}#ith524SpaceSend.sending{opacity:.55!important}
`;document.head.appendChild(s)}
function canonical(){try{const u=new URL(location.href);if(u.searchParams.get('v')!=='249524'){u.searchParams.set('v',(window.ITHAKI_ACTIVE_VERSION||'249526r10f37f1f2'));history.replaceState(null,'',u.pathname+'?'+u.searchParams.toString()+u.hash)}}catch(e){}}
function install(){addCss();canonical();installShare();installBil();stableCommunity();bindGreenSend();window.addEventListener('ithaki:native-share-result',()=>clearShareBusy());['pageshow','focus'].forEach(n=>window.addEventListener(n,()=>{clearShareBusy();setTimeout(()=>{installShare();ensureBil();stableCommunity();bindGreenSend()},80)}));window.addEventListener('ithaki:page-changed',()=>setTimeout(()=>{ensureBil();stableCommunity();bindGreenSend()},70));new MutationObserver(()=>{clearTimeout(install._m);install._m=setTimeout(()=>{ensureBil();stableCommunity();bindGreenSend();installShare()},80)}).observe(document.body,{subtree:true,childList:true});setInterval(()=>{installShare();ensureBil();stableCommunity();bindGreenSend()},1000);try{localStorage.setItem('ith_frontend_build','V249524-bil-alerts-single-community-share-choice-apk-sync');document.documentElement.setAttribute('data-ithaki-v249524','bil-alerts-single-community-share-choice-apk-sync')}catch(e){}}
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',install,{once:true});else install();
})();
