/* OK ITHAKI V249440 - FEED AUTOPLAY + POSITION RESUME + CURRENT WALL
   Videos autoplay muted only while their card is centered. The Feed keeps the current post and scroll position across navigation and refreshes.
   The Home wall entry always opens the current V411 wall, never the legacy V249378 wall.
   Uses only the current core Feed renderer. Keeps full + menu, preview and Studio. Contacts, messages and notifications use one bounded server-backed path, while DM and calls require server-accepted friendship,
   a server-canonical DM channel and exactly one optional encryption lock shared by the active conversation. */
(function(){
'use strict';
window.FINAL_GUARD_EXACT_NOTIFICATION_CENTER_R10F15=true;
window.PAGE_LIFECYCLE_SECURE_PREVIEW_COMMUNITY_SCOPE_R10F20=true;
window.FEED_FULL_BACKGROUND_STOP_R10F20=true;
window.PLUS_COMMUNITY_SCOPE_R10F20=true;
window.SECURE_PREVIEW_DOUBLE_GATE_R10F20=true;
window.SECURITY_SCAN_ONLY_IN_PREVIEW_R10F21=true;
window.FEED_INITIAL_LOAD_NOT_BLOCKED_R10F21=true;
window.FEED_LOADING_REENTRY_GUARD_R10F21F1=true;
window.FEED_FILE_CHECKS_DISABLED_DURING_LOAD_R10F21F1=true;

if(window.__ITHAKI_V249440_RUNTIME__){try{window.__ITHAKI_V249440_RUNTIME__.installExports()}catch(e){}return}
const VER='V249526R10F21F1-feed-load-preview-only-security';
const $=id=>document.getElementById(id);
const esc=s=>String(s==null?'':s).replace(/[&<>"']/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]));
const mb=n=>{n=Number(n||0);return n>=1048576?(n/1048576).toFixed(1)+' MB':Math.max(1,Math.round(n/1024))+' KB'};
const loadId=Date.now().toString(36)+'_'+Math.random().toString(36).slice(2,8);
const CORE_SEND=window.__ITHAKI_CORE_SEND_PREVIEW__||(window.ITH&&window.ITH.sendPreview)||window.sendPreview;
const COMM_SEND=(window.ITH&&window.ITH.sendPreview)||window.sendPreview||CORE_SEND;
const CORE_STUDIO_OPEN=(window.ITH&&window.ITH.openPreviewStudio)||window.openPreviewStudio;
window.__ITHAKI_V249495_STORY_STUDIO_CORE__={storyUsesCoreStudio:true,editedFileReturnsToPreview:true};
const CORE_PAGE=(window.ITH&&window.ITH.page)||window.page;
const CORE_LOAD_FEED=(window.ITH&&window.ITH.loadFeed)||window.loadFeed;
const CORE_OPEN_DM=window.openDMV249235||(window.ITH&&window.ITH.openDMV249235);
const CORE_START_DM=window.startDM||(window.ITH&&window.ITH.startDM);
const CORE_VOICE_CALL=(window.ITH&&window.ITH.startVoiceCall)||window.startVoiceCall;
const CORE_VIDEO_CALL=(window.ITH&&window.ITH.startVideoCall)||window.startVideoCall;
const CORE_DM_SEND=window.sendDMText||(window.ITH&&window.ITH.sendDMText);
const CORE_RENDER_POST=(window.ITH&&window.ITH.renderPost)||window.renderPost;
const CORE_LOAD_MESSAGES=window.loadMessages||(window.ITH&&window.ITH.loadMessages);
const CORE_LOAD_SPACE_MESSAGES=window.loadSpaceMessages||(window.ITH&&window.ITH.loadSpaceMessages);
const CORE_NOTIFY_CENTER=(window.ITH&&window.ITH.notifyCenter)||window.notifyCenter;
const CORE_REFRESH_NOTIFICATION_BADGE=(window.ITH&&window.ITH.refreshNotificationBadgeV249238)||window.refreshNotificationBadgeV249238;
let previewActive=false, previewObjectUrl='', lastPage='home', installCount=0, sendInFlight=false,routeBusy=false,messageSendBusy=false,spaceTab422='rooms',spaceScreen431='directory',serverFriends422=[],serverFriendsAt422=0,dmRenderCycle422=0,contactsRenderBusy422=false,contactsRenderCount422=0,notificationOpenCount422=0;
let feedVideoObserver440=null,feedVideoObserverRoot440=null,feedScrollRoot440=null,feedScrollTimer440=0,feedRestoreTimer440=0,feedAutoplayActivePost440='',feedRestoreCount440=0,feedCachedOpenCount440=0;
let feedLifecycleGenerationV249545=0,feedSuspendedV249545=false;const feedControllersV249545=new Set();let feedPrefetchTimerV249545=0,feedRefreshTimerV249545=0,feedInitialLoadBusyR10F21F1=false;
const friendGateCache422=new Map();
const securityDirtyChannels426=new Set();
const SCREEN_PAGE_IDS427={home:'homePage',feed:'feedPage',create:'createPage',dm:'dmPage',spaces:'spacesPage',profile:'profilePage'};
let desiredPage427=String((core()&&core().page)||document.body?.getAttribute('data-page')||'home'),routeEpoch427=0,isolationTimer427=0,isolationBusy427=false,isolationObserver427=null,isolationInterval427=0,lastIsolationSignature427='';
function normalizePage427(id){id=String(id||'home').toLowerCase();return({flow:'feed',messages:'dm',rooms:'spaces',community:'spaces'}[id]||id) in SCREEN_PAGE_IDS427?({flow:'feed',messages:'dm',rooms:'spaces',community:'spaces'}[id]||id):'home'}

function feedIsActiveV249545(){return !feedSuspendedV249545&&normalizePage427(desiredPage427)==='feed'&&normalizePage427(document.body?.dataset.page||'')==='feed'}
function stopFeedBackgroundV249545(reason){
 feedSuspendedV249545=true;feedLifecycleGenerationV249545++;
 clearTimeout(feedPrefetchTimerV249545);clearTimeout(feedRefreshTimerV249545);feedPrefetchTimerV249545=0;feedRefreshTimerV249545=0;
 for(const c of [...feedControllersV249545]){try{c.abort(String(reason||'page-exit'))}catch(_e){}}feedControllersV249545.clear();
 feedPrefetchBusy503=false;feedAppendBusy503=false;feedPrefetched503=null;
 try{feedVideoObserver440?.disconnect()}catch(_e){}feedVideoObserver440=null;feedVideoObserverRoot440=null;
 try{const st=core();st?.feedObserver?.disconnect?.();if(st)st.feedObserver=null}catch(_e){}
 document.querySelectorAll('#feedPage video,#feedPage audio').forEach(m=>{try{m.pause();m.muted=true;m.removeAttribute('autoplay')}catch(_e){}});
 try{window.dispatchEvent(new CustomEvent('ithaki:feed-suspended',{detail:{reason:String(reason||''),generation:feedLifecycleGenerationV249545}}))}catch(_e){}
 diag('feed-fully-suspended-r10f20',{reason:String(reason||''),generation:feedLifecycleGenerationV249545});return true
}
function startFeedBackgroundV249545(reason){feedSuspendedV249545=false;feedLifecycleGenerationV249545++;diag('feed-lifecycle-start-r10f20',{reason:String(reason||''),generation:feedLifecycleGenerationV249545});return feedLifecycleGenerationV249545}
function stopPreviousPageBackgroundV249545(previous,next,reason){previous=normalizePage427(previous);next=normalizePage427(next);if(previous==='feed'&&next!=='feed')stopFeedBackgroundV249545(reason||('leave-'+next));try{if(previous==='spaces'&&next!=='spaces')window.ITH?.suspendCommunitiesV249545?.(reason||('leave-'+next))}catch(_e){}return true}

function core(){const s=window.__ITHAKI_CORE_STATE__||window.state||(window.ITH&&window.ITH.state);if(s){window.ITH=window.ITH||{};window.ITH.state=s;window.state=s;return s}return null}
function toast422(msg,ms){try{if(window.ITH&&typeof window.ITH.toast==='function')return window.ITH.toast(msg,ms);if(typeof window.toast==='function')return window.toast(msg,ms)}catch(e){}console.warn(msg)}
function diag(action,extra){try{const s=core(),nav=performance.getEntriesByType&&performance.getEntriesByType('navigation')[0];const row={t:new Date().toISOString(),loadId,v:VER,action:String(action||''),page:(s&&s.page)||document.body?.getAttribute('data-page')||'',url:location.href,navType:nav&&nav.type||'',visibility:document.visibilityState,extra:extra||null};const arr=JSON.parse(localStorage.getItem('ithaki_diag_v249440')||'[]')||[];arr.push(row);while(arr.length>300)arr.shift();localStorage.setItem('ithaki_diag_v249440',JSON.stringify(arr));console.warn('[ITHAKI V249440]',action,extra||'')}catch(e){}}
function css(){if($('ithV249429Css'))return;const st=document.createElement('style');st.id='ithV249429Css';st.textContent=`
#ithakiMemberGate382,.memberGate382,.feedMemberGate382{display:none!important;visibility:hidden!important;pointer-events:none!important;opacity:0!important}
body #homePage,body #feedPage,body #createPage,body #dmPage,body #spacesPage,body #profilePage{display:none!important;visibility:hidden!important;opacity:0!important;pointer-events:none!important}
body[data-page="home"] #homePage,body[data-page="feed"] #feedPage,body[data-page="create"] #createPage,body[data-page="dm"] #dmPage,body[data-page="spaces"] #spacesPage,body[data-page="profile"] #profilePage{display:block!important;visibility:visible!important;opacity:1!important;pointer-events:auto!important}
#homePage[hidden],#feedPage[hidden],#createPage[hidden],#dmPage[hidden],#spacesPage[hidden],#profilePage[hidden],.page[hidden]{display:none!important;visibility:hidden!important;opacity:0!important;pointer-events:none!important}
body:not([data-page="feed"]) #feedPage{position:static!important;inset:auto!important;z-index:auto!important;transform:none!important}
body:not([data-page="profile"]) #profilePage{position:static!important;inset:auto!important;z-index:auto!important}
body[data-ithaki-screen-owner-v249429] [data-ithaki-legacy-screen-v249429="1"]{display:none!important;visibility:hidden!important;pointer-events:none!important;opacity:0!important}

#ithakiRadicalFeed376,[id^="ithakiRadicalFeed"],[class*="radicalFeed"],[class*="RadicalFeed"],[data-radical-feed]{display:none!important;visibility:hidden!important;pointer-events:none!important;opacity:0!important}
body[data-page="feed"] .proFooter{display:none!important}
#feedPage .feedSearchGlassV249189,#feedPage .feedCleanNoticeV249286,#feedPage .feedModeLabelV249232,#feedPage .feedTypeSelectV249287,#feedPage>.feedList,#feedPage .feedDiscoverPanelV249232,#feedPage .feedFallbackV249283{display:none!important;visibility:hidden!important;pointer-events:none!important;opacity:0!important}
body:not([data-page="feed"]) #feedPage{display:none!important;visibility:hidden!important;pointer-events:none!important}
body[data-page="feed"] #feedPage.ithFeedLiveV249429{display:block!important;visibility:visible!important;opacity:1!important;pointer-events:auto!important}

#feedPage.ithProfessionalFeedV249429{position:relative!important;height:calc(100dvh - var(--bar,72px))!important;min-height:520px!important;overflow:hidden!important;background:#02070d!important;padding:0!important;isolation:isolate!important}
#feedPage .ithFeedStageListV249429{position:absolute!important;inset:0!important;overflow-y:auto!important;overflow-x:hidden!important;scroll-snap-type:y mandatory!important;overscroll-behavior-y:contain!important;scrollbar-width:none!important;background:#02070d!important}
#feedPage .ithFeedStageListV249429::-webkit-scrollbar{display:none!important}
#feedPage .ithFeedStageV249429{position:relative!important;width:100%!important;height:calc(100dvh - var(--bar,72px))!important;min-height:520px!important;display:grid!important;place-items:center!important;scroll-snap-align:start!important;scroll-snap-stop:always!important;overflow:hidden!important;background:radial-gradient(circle at 50% 12%,#132337 0,#07111d 46%,#02070d 100%)!important;border:0!important;margin:0!important;padding:0!important}
#feedPage .ithFeedStageV249429[hidden]{display:none!important}
#feedPage .ithFeedMediaV249429{position:absolute!important;inset:0 58px 0 0!important;display:flex!important;align-items:center!important;justify-content:center!important;overflow:hidden!important;background:#000!important}
#feedPage .ithFeedMediaV249429 video,#feedPage .ithFeedMediaV249429 img{display:block!important;width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;object-fit:contain!important;object-position:center center!important;background:#000!important}
#feedPage .ithFeedMediaV249429 audio{width:min(680px,86vw)!important}
#feedPage .ithFeedCardV249429{position:relative!important;width:min(760px,calc(100vw - 84px))!important;max-height:calc(100dvh - var(--bar,72px) - 42px)!important;overflow:auto!important;padding:clamp(24px,5vw,54px)!important;border-radius:30px!important;border:1px solid rgba(255,255,255,.16)!important;background:linear-gradient(145deg,rgba(12,25,39,.96),rgba(5,11,19,.98))!important;box-shadow:0 26px 80px rgba(0,0,0,.55)!important;color:#fff!important;text-align:center!important}
#feedPage .ithFeedCardV249429.ithWisdomV249429{border-color:rgba(255,215,105,.55)!important;background:radial-gradient(circle at 50% 15%,rgba(255,215,105,.22),rgba(42,31,8,.94) 42%,rgba(6,12,20,.98) 100%)!important}
#feedPage .ithFeedCardV249429.ithWisdomV249429 .ithFeedMainTextV249429{color:#ffd96e!important;font-size:clamp(25px,6vw,48px)!important;font-weight:950!important;line-height:1.24!important}
#feedPage .ithFeedMainTextV249429{font-size:clamp(21px,4.8vw,39px)!important;line-height:1.35!important;white-space:pre-wrap!important;overflow-wrap:anywhere!important}
#feedPage .ithFeedFileV249429{font-size:70px!important;margin-bottom:18px!important}
#feedPage .ithFeedPollCoreV249429{width:100%!important}.ithFeedPollCoreV249429>article{margin:0!important;border:0!important;background:transparent!important;box-shadow:none!important;padding:0!important}.ithFeedPollCoreV249429 .postHead,.ithFeedPollCoreV249429 .leftActions,.ithFeedPollCoreV249429 .pollPostActions,.ithFeedPollCoreV249429 .feedAvatarOverlay{display:none!important}
#feedPage .ithFeedMetaV249429{position:absolute!important;left:14px!important;right:74px!important;bottom:18px!important;z-index:120!important;padding:10px 13px!important;border-radius:17px!important;background:linear-gradient(90deg,rgba(0,0,0,.68),rgba(0,0,0,.12))!important;color:#fff!important;text-shadow:0 2px 8px #000!important;pointer-events:none!important}
#feedPage .ithFeedMetaV249429 b{display:block!important;font-size:16px!important}.ithFeedMetaV249429 small{display:block!important;margin-top:4px!important;opacity:.84!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
#feedPage .ithProfessionalBadgeV249429{display:inline-flex!important;align-items:center!important;gap:5px!important;margin-left:7px!important;padding:3px 8px!important;border-radius:999px!important;background:rgba(255,215,105,.20)!important;border:1px solid rgba(255,215,105,.44)!important;color:#ffe39a!important;font-size:11px!important;font-weight:950!important}
#feedPage .ithFeedSideV249429{position:absolute!important;right:7px!important;top:50%!important;transform:translateY(-50%)!important;z-index:180!important;display:flex!important;flex-direction:column!important;align-items:center!important;gap:7px!important;padding:7px 4px!important;border-radius:999px!important;background:rgba(2,8,15,.48)!important;border:1px solid rgba(255,255,255,.13)!important;backdrop-filter:blur(12px)!important;-webkit-backdrop-filter:blur(12px)!important;box-shadow:0 15px 40px rgba(0,0,0,.42)!important}
#feedPage .ithFeedSideV249429 button{position:relative!important;width:43px!important;height:43px!important;min-width:43px!important;min-height:43px!important;border-radius:50%!important;border:1px solid rgba(255,255,255,.15)!important;background:rgba(255,255,255,.10)!important;color:#fff!important;display:grid!important;place-items:center!important;padding:0!important;font-size:20px!important;box-shadow:0 7px 18px rgba(0,0,0,.30)!important}
#feedPage .ithFeedSideV249429 button:active{transform:scale(.92)!important}.ithFeedSideV249429 .ithCountV249429{position:absolute!important;right:-2px!important;bottom:-4px!important;min-width:18px!important;height:18px!important;padding:0 4px!important;border-radius:999px!important;display:grid!important;place-items:center!important;background:#ffd96e!important;color:#291900!important;font-size:9px!important;font-weight:1000!important;border:1px solid #fff!important}
#feedPage .ithFeedFloatTopV249429{position:absolute!important;left:8px!important;right:8px!important;top:7px!important;z-index:240!important;display:flex!important;align-items:center!important;justify-content:space-between!important;pointer-events:none!important}
#feedPage .ithFeedFloatTopV249429>div{display:flex!important;gap:7px!important;pointer-events:auto!important}.ithFeedCircleV249429{width:44px!important;height:44px!important;border-radius:50%!important;border:1px solid rgba(255,255,255,.18)!important;background:rgba(2,8,15,.62)!important;color:#fff!important;display:grid!important;place-items:center!important;font-size:21px!important;backdrop-filter:blur(12px)!important;-webkit-backdrop-filter:blur(12px)!important}.ithFeedTitleV249429{pointer-events:auto!important;align-self:center!important;padding:9px 15px!important;border-radius:999px!important;background:rgba(2,8,15,.50)!important;border:1px solid rgba(255,255,255,.12)!important;color:#fff!important;font-weight:950!important;backdrop-filter:blur(12px)!important}
#feedPage .ithFeedSearchPanelV249429{position:absolute!important;left:50%!important;top:60px!important;transform:translateX(-50%)!important;z-index:260!important;width:min(760px,96vw)!important;max-height:calc(100dvh - var(--bar,72px) - 76px)!important;overflow:auto!important;padding:14px!important;border-radius:24px!important;background:rgba(4,12,21,.96)!important;border:1px solid rgba(255,255,255,.16)!important;box-shadow:0 24px 70px rgba(0,0,0,.62)!important;color:#fff!important;backdrop-filter:blur(18px)!important;-webkit-backdrop-filter:blur(18px)!important}
#feedPage .ithFeedSearchPanelV249429[hidden]{display:none!important}.ithFeedSearchInputRowV249429{display:grid!important;grid-template-columns:1fr auto!important;gap:8px!important}.ithFeedSearchInputRowV249429 input{width:100%!important;border-radius:16px!important;padding:12px 14px!important;border:1px solid rgba(255,255,255,.17)!important;background:rgba(255,255,255,.08)!important;color:#fff!important;outline:none!important}.ithFeedSearchInputRowV249429 button{border-radius:16px!important;padding:0 15px!important}
#feedPage .ithFeedCategoriesV249429,#feedPage .ithFeedKeywordsV249429{display:flex!important;gap:7px!important;flex-wrap:wrap!important;margin-top:11px!important}.ithFeedChipV249429{border-radius:999px!important;padding:8px 11px!important;border:1px solid rgba(255,255,255,.15)!important;background:rgba(255,255,255,.08)!important;color:#fff!important;font-weight:850!important}.ithFeedChipV249429.active{background:rgba(255,215,105,.22)!important;border-color:rgba(255,215,105,.58)!important;color:#ffe39a!important}.ithFeedSectionLabelV249429{display:block!important;margin-top:12px!important;color:#ffe39a!important;font-weight:950!important;font-size:13px!important}
#feedPage .ithFeedEmptyV249429{height:100%!important;display:grid!important;place-items:center!important;text-align:center!important;color:#fff!important;padding:30px!important}
@media(max-width:720px){#feedPage .ithFeedStageV249429{height:calc(100dvh - var(--bar,72px))!important;min-height:500px!important}#feedPage .ithFeedMediaV249429{inset:0 52px 0 0!important}#feedPage .ithFeedSideV249429{right:4px!important;gap:5px!important;padding:5px 3px!important}#feedPage .ithFeedSideV249429 button{width:38px!important;height:38px!important;min-width:38px!important;min-height:38px!important;font-size:18px!important}#feedPage .ithFeedCardV249429{width:calc(100vw - 70px)!important;padding:26px 18px!important;border-radius:22px!important}#feedPage .ithFeedMetaV249429{left:8px!important;right:58px!important;bottom:10px!important}.ithFeedTitleV249429{font-size:13px!important;padding:8px 11px!important}}
@media(max-height:700px){#feedPage .ithFeedSideV249429{gap:3px!important;padding:4px 2px!important}#feedPage .ithFeedSideV249429 button{width:34px!important;height:34px!important;min-width:34px!important;min-height:34px!important;font-size:16px!important}}
.ithFriendGateStateV249429{margin:10px 0;padding:12px;border-radius:16px;border:1px solid rgba(255,215,110,.30);background:rgba(255,215,110,.08);color:#ffe49b}.ithFriendGateStateV249429 small{display:block;color:#d9e0ea;margin-top:5px}.ithFriendGateGridV249429{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.ithFriendGateGridV249429 .tile{min-height:78px}
#plusSheet.ithPlusMenuV249429{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:10px!important;position:fixed!important;left:50%!important;right:auto!important;bottom:calc(var(--bar,72px) + 12px)!important;transform:translateX(-50%)!important;width:min(760px,95vw)!important;max-height:min(76vh,700px)!important;overflow:auto!important;padding:14px!important;border-radius:24px!important;background:rgba(5,12,22,.98)!important;border:1px solid rgba(255,213,111,.36)!important;box-shadow:0 28px 90px rgba(0,0,0,.72)!important;z-index:2147483645!important;visibility:visible!important;opacity:1!important;pointer-events:auto!important}
#plusSheet.ithPlusMenuV249429:not(.show){display:none!important}
#plusSheet.ithPlusMenuV249429 .ithPlusTitleV249429{grid-column:1/-1;text-align:center;color:#ffe49b;font-weight:900;padding:3px 8px 7px}
#plusSheet.ithPlusMenuV249429 .tile{min-height:88px!important;display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;text-align:center!important;gap:6px!important}
#plusSheet.ithPlusMenuV249429 .tile b{font-size:28px!important}
html[data-ithaki-preview-v249429="1"] #previewModal.show{position:fixed!important;inset:0!important;z-index:2147483647!important;display:flex!important;align-items:flex-start!important;justify-content:center!important;overflow:auto!important;background:rgba(1,4,9,.90)!important;padding:18px!important;pointer-events:auto!important}
#previewModal.show .previewSafeV249429{width:min(850px,97vw)!important;margin:auto!important;max-height:none!important;background:rgba(7,12,20,.995)!important;border:1px solid rgba(255,213,111,.40)!important;border-radius:24px!important;box-shadow:0 28px 90px rgba(0,0,0,.75)!important;padding:14px!important;overflow:visible!important}
.v249429MediaStage{min-height:220px!important;display:flex!important;align-items:center!important;justify-content:center!important;border-radius:20px!important;background:#02070d!important;border:1px solid rgba(255,213,111,.18)!important;overflow:hidden!important}
.v249429MediaStage video{display:block!important;width:100%!important;max-height:min(62vh,720px)!important;background:#000!important;object-fit:contain!important}
.v249429MediaStage img{display:block!important;max-width:100%!important;max-height:min(62vh,720px)!important;object-fit:contain!important}
.v249429MediaStage audio{width:min(680px,94%)!important}
.previewLiteV249429{text-align:center;padding:30px 14px}.previewLiteV249429 .bigIcon{font-size:64px;margin-bottom:10px}.previewLiteV249429 b{display:block;color:#ffe49b;overflow-wrap:anywhere}.previewLiteV249429 small{display:block;margin-top:8px;color:#d7dde8}
#ithDiagV249429{position:fixed!important;right:10px!important;top:8px!important;bottom:auto!important;z-index:2147483646!important;background:rgba(5,8,12,.84)!important;border:1px solid rgba(255,213,111,.36)!important;color:#ffe49b!important;border-radius:999px!important;padding:8px 10px!important;font-size:12px!important}
body[data-page="dm"] #ithDiagV249429,body[data-page="spaces"] #ithDiagV249429,body[data-page="feed"] #ithDiagV249429,body[data-page="create"] #ithDiagV249429{display:none!important}
#ithDiagPanelV249429{position:fixed!important;inset:12px!important;z-index:2147483647!important;background:rgba(3,6,10,.98)!important;color:#f5f7fa!important;border:1px solid rgba(255,213,111,.35)!important;border-radius:18px!important;padding:12px!important;overflow:auto!important}#ithDiagPanelV249429 pre{white-space:pre-wrap!important;word-break:break-word!important;background:rgba(255,255,255,.05)!important;padding:10px!important;border-radius:12px!important}
#profilePage.active{overflow-y:auto!important;overflow-x:hidden!important;overscroll-behavior:contain!important;padding-bottom:calc(var(--bar,72px) + 34px)!important}
body[data-page="profile"] #nav{display:flex!important;visibility:visible!important;opacity:1!important;pointer-events:auto!important;z-index:2147483644!important}
#ithProfileExitV249429{position:fixed!important;left:12px!important;top:calc(env(safe-area-inset-top,0px) + 68px)!important;z-index:2147483646!important;display:none!important;align-items:center!important;gap:6px!important;min-height:42px!important;padding:8px 13px!important;border-radius:999px!important;border:1px solid rgba(255,213,111,.50)!important;background:rgba(5,12,22,.96)!important;color:#ffe49b!important;font-weight:900!important;box-shadow:0 12px 32px rgba(0,0,0,.45)!important}
body[data-page="profile"] #ithProfileExitV249429{display:flex!important}
body[data-page="feed"] #feedPage,body[data-page="dm"] #dmPage,body[data-page="spaces"] #spacesPage{display:block!important;visibility:visible!important;opacity:1!important;pointer-events:auto!important}
#dmPage .chatHead button[onclick*="openE2EPanel"]:not(#ithOnlyEncryptionLockV249429),#dmPage .chatHead button[title*="Private lock"]:not(#ithOnlyEncryptionLockV249429),#dmPage .chatHead [data-secure-lock-v249391]:not(#ithOnlyEncryptionLockV249429),#dmPage .chatHead [id*="SecureLock"]:not(#ithOnlyEncryptionLockV249429),#spacesPage .chatHead button[onclick*="openE2EPanel"]:not(#ithOnlyEncryptionLockV249429),#spacesPage .chatHead button[title*="Private lock"]:not(#ithOnlyEncryptionLockV249429),#spacesPage .chatHead [id*="SecureLock"]:not(#ithOnlyEncryptionLockV249429){display:none!important}
#ithOnlyEncryptionLockV249429{display:inline-grid!important;place-items:center!important;flex:0 0 auto!important;border-color:rgba(255,215,110,.40)!important;background:rgba(255,215,110,.10)!important;color:#ffe49b!important}
.ithConversationTypeV249429{display:block!important;color:#ffd978!important;font-size:10px!important;font-weight:900!important;line-height:1.3!important;margin-top:2px!important;white-space:normal!important}
#ithRouteLoadingV249429{margin:16px!important;padding:18px!important;border-radius:20px!important;border:1px solid rgba(255,215,110,.32)!important;background:rgba(255,215,110,.08)!important;color:#ffe49b!important;text-align:center!important}
#spacesPage .ithSimpleSpacesV249429{height:100%!important;min-height:0!important;display:grid!important;grid-template-rows:auto 1fr!important;gap:8px!important}#spacesPage .ithSimpleSpacesBodyV249429{min-height:0!important;display:grid!important;grid-template-columns:minmax(220px,34%) minmax(0,1fr)!important;gap:9px!important}#spacesPage .ithSimpleSpacesBodyV249429>.roomList{min-height:0!important;overflow:auto!important}#spacesPage .ithSimpleSpacesBodyV249429>.chatPane{min-height:0!important;display:flex!important;flex-direction:column!important}#spacesPage .ithSimpleSpacesBodyV249429 .messages{flex:1 1 auto!important;min-height:0!important;overflow:auto!important}@media(max-width:760px){#spacesPage .ithSimpleSpacesBodyV249429{grid-template-columns:1fr!important;grid-template-rows:minmax(150px,38%) minmax(0,1fr)!important}}
#ithSimpleEncryptionPanelV249429{display:grid!important;gap:10px!important}#ithSimpleEncryptionPanelV249429 label{display:grid!important;gap:5px!important}#ithSimpleEncryptionPanelV249429 select,#ithSimpleEncryptionPanelV249429 input{width:100%!important;min-height:44px!important;border-radius:13px!important;padding:8px 10px!important;background:#07111b!important;color:#fff!important;border:1px solid rgba(255,215,110,.28)!important}

@media(max-width:620px){#plusSheet.ithPlusMenuV249429{grid-template-columns:repeat(2,minmax(0,1fr))!important}.v249429MediaStage video{max-height:56vh!important}}


body[data-page="feed"] #feedPage.ithFeedLiveV249429{display:block!important;visibility:visible!important;opacity:1!important;pointer-events:auto!important;position:fixed!important;left:0!important;right:0!important;top:0!important;bottom:var(--bar,72px)!important;z-index:25!important;overflow:hidden!important;background:#000!important;contain:layout paint style!important}
body[data-page="feed"] #feedPage.ithFeedLiveV249429>.feedList{display:block!important;visibility:visible!important;opacity:1!important;width:100%!important;height:100%!important;min-height:calc(100dvh - var(--bar,72px))!important;overflow-y:auto!important;background:#000!important;transform:translateZ(0)!important;backface-visibility:hidden!important}
#ithFeedPaintStatusV249429{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);z-index:80;color:#ffe39a;background:rgba(3,9,16,.94);border:1px solid rgba(255,219,130,.32);border-radius:18px;padding:16px 20px;text-align:center;font-weight:900}
.securePanelV249429{display:grid;gap:10px;max-height:min(84dvh,780px);overflow:auto;overscroll-behavior:contain;padding:2px 2px 92px}.secureSaveBarV249429{position:sticky;bottom:-88px;z-index:12;display:grid;gap:6px;padding:10px 2px 2px;background:linear-gradient(180deg,rgba(7,17,27,0),rgba(7,17,27,.98) 34%)}.secureSaveBarV249429 .btn{min-height:50px;font-weight:950}.secureDirtyV249429{color:#ffd978;font-weight:900}.secureSavedV249429{color:#74efb4;font-weight:900}.securePanelHeadV249429{display:grid;grid-template-columns:auto 1fr auto;gap:8px;align-items:center}.securePanelHeadV249429 b{color:#ffe3a0}.securePanelV249429 label{display:grid;gap:5px;margin:9px 0;font-weight:800}.securePanelV249429 select,.securePanelV249429 input{min-height:44px;border-radius:13px;border:1px solid rgba(255,222,135,.28);background:#07111b;color:#fff;padding:0 10px}.secureToggleV249429{display:flex!important;align-items:center;gap:10px}.secureToggleV249429 input{width:20px;height:20px;min-height:20px}.secureStateV249429{border-radius:15px;padding:12px;display:grid;gap:5px;border:1px solid rgba(88,235,163,.40);background:rgba(20,126,80,.16)}.secureTruthV249429{display:grid;gap:4px;border-radius:13px;background:rgba(255,255,255,.05);padding:10px}.secureTruthV249429 span{font-size:12px;color:rgba(255,255,255,.72);line-height:1.45}.ithConversationTypeV249429{display:block!important;color:#ffd978!important;font-size:11px!important;font-weight:900!important;line-height:1.35!important;margin-top:3px!important;white-space:normal!important}`;document.head.appendChild(st)}
function killGates(){css();try{document.querySelectorAll('#ithakiMemberGate382,.memberGate382,.feedMemberGate382').forEach(x=>x.remove());window.__ITHAKI_DISABLE_MEMBER_FEED_GATE_V249429=true}catch(e){}}

const SAFE_FILE_POLICY_V249545={text:{ext:['txt','md','csv'],max:2*1024*1024},photo:{ext:['jpg','jpeg','png','webp','heic','heif'],max:20*1024*1024},video:{ext:['mp4','m4v','mov','webm','3gp','3gpp'],max:200*1024*1024},audio:{ext:['m4a','mp3','wav','ogg','webm'],max:20*1024*1024}};
const DANGEROUS_EXT_V249545=new Set('exe dll msi msp bat cmd com scr pif ps1 psm1 vbs vbe js jse jar apk sh bash zsh php phtml asp aspx jsp html htm svg xml xhtml zip rar 7z gz bz2 tar iso img lnk url reg cpl sys drv docm xlsm pptm xlam xll'.split(' '));
function fileExtV249545(name){const parts=String(name||'').toLowerCase().split('.').filter(Boolean);return parts.length>1?parts.at(-1):''}
function suspiciousNameV249545(name){const parts=String(name||'').toLowerCase().split('.').filter(Boolean),danger=parts.slice(0,-1).find(x=>DANGEROUS_EXT_V249545.has(x));if(danger)return 'Διπλή ή κρυφή επικίνδυνη κατάληξη .'+danger;const ext=parts.at(-1)||'';if(DANGEROUS_EXT_V249545.has(ext))return 'Η κατάληξη .'+ext+' δεν επιτρέπεται';if(/[\u0000-\u001f<>:"|?*]/.test(String(name||'')))return 'Το όνομα αρχείου περιέχει μη ασφαλείς χαρακτήρες';return''}
function bytesStartV249545(a,seq){return seq.every((v,i)=>a[i]===v)}
function asciiV249545(a,start,len){return String.fromCharCode(...a.slice(start,start+len))}
function signatureKindV249545(a){if(bytesStartV249545(a,[0xff,0xd8,0xff]))return'jpg';if(bytesStartV249545(a,[0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a]))return'png';if(asciiV249545(a,0,4)==='RIFF'&&asciiV249545(a,8,4)==='WEBP')return'webp';if(bytesStartV249545(a,[0x1a,0x45,0xdf,0xa3]))return'webm';if(asciiV249545(a,4,4)==='ftyp'){const b=asciiV249545(a,8,12).toLowerCase();if(/heic|heix|hevc|hevx|mif1|msf1/.test(b))return'heic';if(/3gp|3g2/.test(b))return'3gp';return'mp4'}if(bytesStartV249545(a,[0x49,0x44,0x33])||bytesStartV249545(a,[0xff,0xfb])||bytesStartV249545(a,[0xff,0xf3])||bytesStartV249545(a,[0xff,0xf2]))return'mp3';if(asciiV249545(a,0,4)==='RIFF'&&asciiV249545(a,8,4)==='WAVE')return'wav';if(asciiV249545(a,0,4)==='OggS')return'ogg';return''}
function mostlyTextV249545(a){if(!a.length)return true;let ok=0;for(const b of a){if(b===0)return false;if(b===9||b===10||b===13||(b>=32&&b!==127)||b>=128)ok++}return ok/a.length>.94}
async function secureFilePreflightV249545(file,requested){requested=String(requested||'file').toLowerCase();const name=String(file?.name||'file'),ext=fileExtV249545(name),bad=suspiciousNameV249545(name);if(bad)return{ok:false,reason:bad};let category=requested==='photo'||requested==='image'?'photo':requested==='video'?'video':requested==='audio'?'audio':'text';if(requested==='file'){category=SAFE_FILE_POLICY_V249545.text.ext.includes(ext)?'text':SAFE_FILE_POLICY_V249545.photo.ext.includes(ext)?'photo':SAFE_FILE_POLICY_V249545.video.ext.includes(ext)?'video':'unknown'}const policy=SAFE_FILE_POLICY_V249545[category];if(!policy||!policy.ext.includes(ext))return{ok:false,reason:'Επιτρέπονται μόνο αρχεία κειμένου (.txt, .md, .csv), φωτογραφίες και βίντεο.'};if(Number(file?.size||0)<=0)return{ok:false,reason:'Το αρχείο είναι κενό.'};if(file.size>policy.max)return{ok:false,reason:'Το αρχείο ξεπερνά το επιτρεπόμενο μέγεθος ('+Math.round(policy.max/1048576)+' MB).'};const a=new Uint8Array(await file.slice(0,8192).arrayBuffer()),sig=signatureKindV249545(a),mime=String(file.type||'').toLowerCase();if(category==='text'){if(!mostlyTextV249545(a))return{ok:false,reason:'Το περιεχόμενο δεν είναι καθαρό αρχείο κειμένου.'};const sample=new TextDecoder('utf-8',{fatal:false}).decode(a).toLowerCase();if(/\bmz\x90|<script\b|<\?php|wscript\.shell|powershell\s+(?:-enc|-encodedcommand)|#!/.test(sample))return{ok:false,reason:'Εντοπίστηκε περιεχόμενο script ή εκτελέσιμου αρχείου.'}}else{const compatible=category==='photo'?['jpg','png','webp','heic'].includes(sig):category==='video'?['mp4','3gp','webm'].includes(sig):['mp3','wav','ogg','webm','mp4'].includes(sig);if(!compatible)return{ok:false,reason:'Η πραγματική υπογραφή του αρχείου δεν συμφωνεί με τον δηλωμένο τύπο.'};if(mime&&mime!=='application/octet-stream'&&!mime.startsWith(category==='photo'?'image/':category==='video'?'video/':'audio/'))return{ok:false,reason:'Ο δηλωμένος MIME τύπος δεν συμφωνεί με το αρχείο.'}}return{ok:true,category,ext,signature:sig||'text',size:file.size,clientChecked:true,message:'Έλεγχος προεπισκόπησης: κατάληξη, μέγεθος, MIME και πραγματική υπογραφή αρχείου.'}}
async function secureOpenPreviewV249545(ctx,file,hint,target){window.__ITHAKI_PREVIEW_SECURITY_ACTIVE_R10F21__=true;const result=await secureFilePreflightV249545(file,hint);if(!result.ok){toast422('Δεν ανεβαίνει για λόγους ασφαλείας: '+result.reason,9000);diag('secure-file-blocked-r10f20',{name:file?.name||'',reason:result.reason});return false}const out=openPreview422(ctx,file,result.category==='text'?'file':result.category,target);const st=core();if(st?.preview)st.preview.security=result;const card=document.querySelector('#previewModal .previewFileCard');if(card)card.insertAdjacentHTML('beforeend',`<div class="ithSecurityResultV249545"><b>🛡️ Έλεγχος μέσα στην προεπισκόπηση</b><small>${esc(result.message)}</small><small>Δεν γίνεται έλεγχος κατά τη φόρτωση της Ροής. Ο server επαναλαμβάνει τον έλεγχο μόνο όταν πατήσεις αποστολή.</small></div>`);return out}
function kindOf(file,hint){const t=String(file&&file.type||'').toLowerCase(),n=String(file&&file.name||'').toLowerCase(),h=String(hint||'').toLowerCase();if(t.startsWith('video/')||/\.(mp4|mov|m4v|webm|3gp|3gpp|avi|mkv)$/i.test(n))return'video';if(t.startsWith('image/')||/\.(jpg|jpeg|png|webp|gif|heic)$/i.test(n))return'photo';if(t.startsWith('audio/')||/\.(mp3|m4a|wav|ogg)$/i.test(n))return'audio';if(['video','photo','image','audio'].includes(h))return h==='image'?'photo':h;return'file'}
function inferCtx(){const s=core(),p=String((s&&s.page)||document.body?.getAttribute('data-page')||'');if(p==='dm'||(s&&s.activePeer))return'dm';if(p==='spaces')return'space';return'feed'}
function destination422(){const s=core(),p=normalizePage427((s&&s.page)||document.body?.dataset.page||'');if(p==='dm')return s.activeChannel?{ctx:'dm',target:s.activeChannel,label:'στα Μηνύματα'}:null;if(p==='spaces')return s.currentSpaceChannel?{ctx:'space',target:s.currentSpaceChannel,label:'μόνο στην επιλεγμένη Κοινότητα'}:null;return{ctx:'feed',target:'',label:'στη Ροή'}}
function ownInput(){let i=$('ithFileInputV249429');if(!i){i=document.createElement('input');i.type='file';i.id='ithFileInputV249429';i.setAttribute('data-ithaki-owner','v249429');i.style.cssText='position:fixed;left:-10000px;top:-10000px;width:1px;height:1px;opacity:0;pointer-events:none';document.body.appendChild(i)}return i}
function releasePreviewUrl(){if(previewObjectUrl){try{URL.revokeObjectURL(previewObjectUrl)}catch(e){}previewObjectUrl=''}}
function protect(){previewActive=true;document.documentElement.setAttribute('data-ithaki-preview-v249429','1')}
function unprotect(){previewActive=false;document.documentElement.removeAttribute('data-ithaki-preview-v249429')}
function mediaHtml(file,kind,url){if(kind==='video')return `<video id="previewVideoV249429" src="${esc(url)}" controls playsinline preload="metadata"></video>`;if(kind==='photo')return `<img id="previewImageV249429" src="${esc(url)}" alt="${esc(file.name||'photo')}">`;if(kind==='audio')return `<audio id="previewAudioV249429" src="${esc(url)}" controls preload="metadata"></audio>`;return `<div class="previewLiteV249429"><div class="bigIcon">📎</div><b>${esc(file.name||'file')}</b><small>${esc(file.type||'file')} · ${mb(file.size)}</small></div>`}
function openPreview422(ctx,file,hint,target){css();killGates();const s=core();if(!s||!file){diag('preview-state-missing',{hasState:!!s,hasFile:!!file});return false}releasePreviewUrl();const kind=kindOf(file,hint);previewObjectUrl=URL.createObjectURL(file);lastPage=String(s.page||document.body?.getAttribute('data-page')||'create');s.preview={ctx:ctx||'feed',file,kind,target:target||'',originalFile:file,studio:null,url:previewObjectUrl,ramOnlyV249429:true,preparedFile:null,uploadedRaw:null,uploadedReady:null};s.sending=false;window.__ITHAKI_PREVIEW_FILE_V249429__=file;let m=$('previewModal');if(!m){m=document.createElement('div');m.id='previewModal';document.body.appendChild(m)}const dest=ctx==='dm'?'στα Μηνύματα':ctx==='space'?'στην Κοινότητα / Δωμάτιο':ctx==='story'?'Story 24 ωρών':'στη Ροή';const studio=((ctx==='feed'||ctx==='story')&&(kind==='video'||kind==='photo'))?`<button class="btn gold" type="button" onclick="ITH.openPreviewStudioV249429()">✦ Studio επεξεργασίας</button>`:'';m.classList.remove('callCompactV249218','voiceCallV249218','videoCallV249218');m.innerHTML=`<div class="previewBox previewScrollable previewSafeV249429"><div class="row"><button class="icon" type="button" onclick="ITH.closePreview()">‹</button><b>Προεπισκόπηση ${esc(dest)}</b>${studio}<button class="btn" type="button" onclick="ITH.closePreview()">Άκυρο</button></div><div id="previewStage" class="previewStage v249429MediaStage">${mediaHtml(file,kind,previewObjectUrl)}</div><div class="card previewFileCard"><b id="previewFileName">${esc(file.name||'file')}</b><div id="previewFileMeta" class="date">${esc(file.type||kind)} · ${mb(file.size)}</div></div><div id="previewStudioMount"></div><textarea id="previewCaption" rows="3" style="width:100%;min-height:88px;resize:vertical" placeholder="Λεζάντα..."></textarea><input id="previewKeywords" placeholder="Λέξεις κλειδιά">${ctx==='feed'?'<label class="card row anonymousRow"><input id="previewAnonymous" type="checkbox"><span class="anonBadge">🕶️ Ανώνυμη δημοσίευση</span></label>':''}<div class="progress"><span id="progressBar"></span></div><div id="progressText" class="date">Έτοιμο · ${mb(file.size)}</div><div class="row"><button id="previewSend" class="btn green" type="button" onclick="ITH.sendPreviewV249429()">Αποστολή / Δημοσίευση</button><button class="btn" type="button" onclick="ITH.closePreview()">Άκυρο</button></div></div>`;m.classList.add('show');protect();diag('preview-open',{ctx,kind,name:file.name,size:file.size,lastPage,realMedia:kind!=='file'});return false}
function closePreview422(){const s=core();if(s&&s.sending)return false;releasePreviewUrl();const m=$('previewModal');if(m){m.classList.remove('show');m.innerHTML=''}if(s)s.preview={};window.__ITHAKI_PREVIEW_FILE_V249429__=null;unprotect();diag('preview-close');return false}
function chooseFile422(ctx,hint,target){ctx=ctx||inferCtx();hint=hint||'file';const inp=ownInput();inp.value='';inp.removeAttribute('capture');inp.accept=hint==='video'?'video/mp4,video/webm,video/quicktime,video/3gpp':hint==='photo'?'image/jpeg,image/png,image/webp,image/heic,image/heif':hint==='audio'?'audio/*':'.txt,.md,.csv,image/jpeg,image/png,image/webp,image/heic,image/heif,video/mp4,video/webm,video/quicktime,video/3gpp';inp.onchange=async ev=>{try{ev.stopImmediatePropagation()}catch(e){}const f=inp.files&&inp.files[0];diag('file-change',{ctx,hint,hasFile:!!f,name:f&&f.name});if(f)await secureOpenPreviewV249545(ctx,f,hint,target||'')};setTimeout(()=>inp.click(),0);return false}
function captureMedia422(ctx,hint,target){const inp=ownInput();inp.value='';inp.accept=hint==='video'?'video/*':'image/*';inp.setAttribute('capture','environment');inp.onchange=async ev=>{try{ev.stopImmediatePropagation()}catch(e){}inp.removeAttribute('capture');const f=inp.files&&inp.files[0];if(f)await secureOpenPreviewV249545(ctx||inferCtx(),f,hint,target||'')};setTimeout(()=>inp.click(),0);return false}
function plusOpen422(){const sh=$('plusSheet');return !!(sh&&sh.classList.contains('show')&&sh.classList.contains('ithPlusMenuV249429'))}
function closePlusMenu422(reason){const sh=$('plusSheet');if(!plusOpen422())return false;sh.classList.remove('show','ithPlusMenuV249429');sh.innerHTML='';diag('plus-close-once',{reason:reason||''});return false}
function legacyScreenCount427(){try{return document.querySelectorAll('#ithakiRadicalFeed376,[id^="ithakiRadicalFeed"],[class*="radicalFeed"],[class*="RadicalFeed"],[data-radical-feed],[id^="ithFeedRoot"],.ithFeedOverlay324,.feedBackOnly,#screen-flow,[id^="feedFrameV249"],[id^="ithFeedFrame"]').length}catch(e){return 0}}
function purgeLegacyScreens427(active,clearHome=true){
  active=normalizePage427(active||desiredPage427);
  try{window.ITH&&ITH.closeRadicalFeedV249383&&ITH.closeRadicalFeedV249383()}catch(e){}
  try{
    const selectors='#ithakiRadicalFeed376,[id^="ithakiRadicalFeed"],[class*="radicalFeed"],[class*="RadicalFeed"],[data-radical-feed],[id^="ithFeedRoot"],.ithFeedOverlay324,.feedBackOnly,#screen-flow,[id^="feedFrameV249"],[id^="ithFeedFrame"]';
    document.querySelectorAll(selectors).forEach(x=>{if(x.id==='feedPage')return;if(active==='feed'&&x.closest('#feedPage')&&!/radical|ithFeedRoot|feedFrame|screen-flow|ithFeedOverlay|feedBack/i.test(String(x.id||'')+' '+String(x.className||'')))return;x.remove()});
  }catch(e){}
  try{if(clearHome){const h=$('homePage');if(h)h.querySelectorAll('.feedList,[id^="ithFeedRoot"],.ithFeedOverlay324,.feedBackOnly,.radicalFeedV249383,.radicalFeedV249386,[data-feed-owner],[data-radical-feed],#screen-flow,[id^="feedFrameV249"]').forEach(x=>x.remove())}}catch(e){}
  try{document.documentElement.removeAttribute('data-radical-feed');document.documentElement.setAttribute('data-ithaki-new-feed-owner-v249429','professional-feed-v249430');document.body&&document.body.style.removeProperty('overflow')}catch(e){}
}
function visibleMajorPages427(){const out=[];for(const [k,id] of Object.entries(SCREEN_PAGE_IDS427)){const p=$(id);if(!p)continue;let shown=false;try{const cs=getComputedStyle(p);shown=!p.hidden&&cs.display!=='none'&&cs.visibility!=='hidden'&&Number(cs.opacity||1)!==0}catch(e){shown=!p.hidden}if(shown)out.push(k)}return out}
function visualPage422(id,reason){
  id=normalizePage427(id);const previous=normalizePage427(desiredPage427);stopPreviousPageBackgroundV249545(previous,id,reason||'visual-page');if(id==='feed'&&previous!=='feed')startFeedBackgroundV249545(reason||'visual-feed');
  if(id!==previous)routeEpoch427++;
  desiredPage427=id;const st=core();if(st)st.page=id;
  if(!document.body)return null;
  isolationBusy427=true;
  try{
    document.body.setAttribute('data-page',id);document.body.setAttribute('data-ithaki-screen-owner-v249429',id);
    const pages=new Map();document.querySelectorAll('.page').forEach(p=>pages.set(p.id||('anon_'+pages.size),p));Object.values(SCREEN_PAGE_IDS427).forEach(pid=>{const p=$(pid);if(p)pages.set(pid,p)});
    pages.forEach((p,pid)=>{const active=pid===SCREEN_PAGE_IDS427[id];if(active){p.hidden=false;p.removeAttribute('aria-hidden');try{p.inert=false}catch(e){}p.classList.add('active');p.style.setProperty('display','block','important');p.style.setProperty('visibility','visible','important');p.style.setProperty('opacity','1','important');p.style.setProperty('pointer-events','auto','important')}else{p.classList.remove('active');p.hidden=true;p.setAttribute('aria-hidden','true');try{p.inert=true}catch(e){}p.style.setProperty('display','none','important');p.style.setProperty('visibility','hidden','important');p.style.setProperty('opacity','0','important');p.style.setProperty('pointer-events','none','important')}});
    document.querySelectorAll('#nav button[data-page]').forEach(b=>b.classList.toggle('active',normalizePage427(b.dataset.page||'')===id));
    if(previous!==id){const mm=$('memberMenu');if(mm)mm.classList.remove('show','localPanel','legalPanel','themePanel');closePlusMenu422('screen-'+id)}
    purgeLegacyScreens427(id,true);
    const sig=id+'|'+visibleMajorPages427().join(',')+'|'+legacyScreenCount427();lastIsolationSignature427=sig;
  }finally{isolationBusy427=false}
  return $(SCREEN_PAGE_IDS427[id])
}
function removeRadicalFeed422(clearHome=true){purgeLegacyScreens427(desiredPage427,clearHome)}
function scheduleIsolation427(reason,delay=30){clearTimeout(isolationTimer427);isolationTimer427=setTimeout(()=>{if(!isolationBusy427)visualPage422(desiredPage427,reason||'scheduled')},delay)}
function settleIsolation427(id,epoch,reason){[0,40,140,360,850,1600].forEach(ms=>setTimeout(()=>{if(epoch===routeEpoch427&&normalizePage427(desiredPage427)===normalizePage427(id))visualPage422(id,(reason||'settle')+'-'+ms)},ms))}
function installIsolationObserver427(){if(isolationObserver427||!document.body)return;isolationObserver427=new MutationObserver(list=>{if(isolationBusy427)return;let relevant=false;for(const m of list){if(m.addedNodes&&m.addedNodes.length){relevant=true;break}}if(relevant){scheduleIsolation427('dom-added',35);if(normalizePage427(desiredPage427)==='feed')repairFeedOwner429('body-dom-added')}});isolationObserver427.observe(document.body,{childList:true,subtree:true});if(!isolationInterval427)isolationInterval427=setInterval(()=>{if(document.hidden)return;const active=normalizePage427(desiredPage427),visible=visibleMajorPages427(),bodyPage=normalizePage427(document.body?.dataset.page||'');if(bodyPage!==active||visible.length!==1||visible[0]!==active||legacyScreenCount427()>0)scheduleIsolation427('periodic-mismatch',0)},900)}
async function api422(path,opt={}){const s=core(),headers=Object.assign({},opt.headers||{});if(s&&s.token)headers['X-ITHAKI-TOKEN']=s.token;if(opt.body&&typeof opt.body==='string'&&!headers['Content-Type'])headers['Content-Type']='application/json';const r=await fetch(path,Object.assign({},opt,{headers}));let data=null;try{data=await r.json()}catch(e){}if(!r.ok){let d=data&&data.detail!=null?data.detail:data,reason='',message='';if(typeof d==='string')message=d;else if(d&&typeof d==='object'){reason=String(d.reason||'');message=String(d.message||d.detail||'')}const err=new Error(message||path+' '+r.status);err.status=r.status;err.reason=reason;err.payload=data;throw err}return data||{ok:true}}
function feedList440(){return document.querySelector('#feedPage .ithFeedStageListV249429')}
function feedStageNearCenter440(list){
  list=list||feedList440();if(!list)return null;const rr=list.getBoundingClientRect(),center=rr.top+rr.height/2;let best=null,dist=Infinity;
  list.querySelectorAll('.ithFeedStageV249429:not([hidden])').forEach(stage=>{const r=stage.getBoundingClientRect(),d=Math.abs((r.top+r.bottom)/2-center);if(d<dist){dist=d;best=stage}});return best
}
function saveFeedPosition440(reason){
  try{const list=feedList440();if(!list)return false;const stage=feedStageNearCenter440(list),post=String(stage&&stage.dataset.post||'');const row={post,scrollTop:Number(list.scrollTop||0),savedAt:Date.now(),reason:String(reason||'')};sessionStorage.setItem('ith_feed_resume_v249440',JSON.stringify(row));if(post)feedAutoplayActivePost440=post;diag('feed-position-saved-v249440',row);return row}catch(e){return false}
}
function readFeedPosition440(){try{return JSON.parse(sessionStorage.getItem('ith_feed_resume_v249440')||'{}')||{}}catch(e){return{}}}
function restoreFeedPosition440(reason){
  clearTimeout(feedRestoreTimer440);const run=()=>{try{const list=feedList440();if(!list)return false;const row=readFeedPosition440();let target=null;if(row.post){try{target=list.querySelector('[data-post="'+CSS.escape(String(row.post))+'"]')}catch(e){target=[...list.querySelectorAll('[data-post]')].find(x=>String(x.dataset.post||'')===String(row.post))||null}}
    if(target){list.scrollTop=Math.max(0,target.offsetTop||0);feedAutoplayActivePost440=String(row.post||'')}else if(Number.isFinite(Number(row.scrollTop)))list.scrollTop=Math.max(0,Number(row.scrollTop||0));
    feedRestoreCount440++;activateFeedVideos440('restore-'+String(reason||''));diag('feed-position-restored-v249440',{reason:String(reason||''),post:row.post||'',scrollTop:list.scrollTop,target:!!target,count:feedRestoreCount440});return true}catch(e){diag('feed-position-restore-error-v249440',String(e.message||e));return false}};
  requestAnimationFrame(()=>requestAnimationFrame(run));feedRestoreTimer440=setTimeout(run,140);setTimeout(run,420);return false
}
function pauseOtherFeedVideos440(active){document.querySelectorAll('#feedPage .ithFeedStageV249429 video').forEach(v=>{if(v!==active){try{v.pause()}catch(e){}}})}
function playFeedVideo440(video,stage,reason){if(!video||!stage||stage.hidden||document.body?.dataset.page!=='feed')return false;try{video.autoplay=true;video.muted=true;video.defaultMuted=true;video.playsInline=true;video.setAttribute('playsinline','');video.setAttribute('muted','');video.preload='auto';pauseOtherFeedVideos440(video);const p=video.play();if(p&&p.catch)p.catch(()=>{});feedAutoplayActivePost440=String(stage.dataset.post||'');return true}catch(e){diag('feed-autoplay-error-v249440',{reason:String(reason||''),message:String(e.message||e)});return false}}
function activateFeedVideos440(reason){
  const list=feedList440();if(!list)return false;
  if(feedVideoObserver440&&feedVideoObserverRoot440!==list){try{feedVideoObserver440.disconnect()}catch(e){}feedVideoObserver440=null}
  if(!feedVideoObserver440){feedVideoObserverRoot440=list;feedVideoObserver440=new IntersectionObserver(entries=>{let best=null;for(const entry of entries){if(!entry.isIntersecting||entry.intersectionRatio<.56)continue;if(!best||entry.intersectionRatio>best.intersectionRatio)best=entry}if(best){const stage=best.target,video=stage.querySelector('video');if(video)playFeedVideo440(video,stage,'observer')}},{root:list,threshold:[0,.25,.56,.72,.9,1]})}
  list.querySelectorAll('.ithFeedStageV249429').forEach(stage=>{if(stage.dataset.v249440Observed!=='1'){stage.dataset.v249440Observed='1';feedVideoObserver440.observe(stage)}const v=stage.querySelector('video');if(v){v.autoplay=true;v.muted=true;v.defaultMuted=true;v.playsInline=true;v.setAttribute('playsinline','');v.setAttribute('muted','');v.preload='metadata'}});
  if(feedScrollRoot440!==list){if(feedScrollRoot440&&feedScrollRoot440.__ithakiScroll440)try{feedScrollRoot440.removeEventListener('scroll',feedScrollRoot440.__ithakiScroll440)}catch(e){};const onScroll=()=>{clearTimeout(feedScrollTimer440);feedScrollTimer440=setTimeout(()=>{saveFeedPosition440('scroll');const stage=feedStageNearCenter440(list),video=stage&&stage.querySelector('video');if(video)playFeedVideo440(video,stage,'scroll-settle');if(list.scrollHeight-list.scrollTop-list.clientHeight<list.clientHeight*2.2)appendPrefetchedFeed503()},90)};list.__ithakiScroll440=onScroll;list.addEventListener('scroll',onScroll,{passive:true});feedScrollRoot440=list}
  const stage=feedStageNearCenter440(list),video=stage&&stage.querySelector('video');if(video)playFeedVideo440(video,stage,reason||'activate');return true
}
function forceFeedPaint422(el){if(!el)return false;el.hidden=false;el.removeAttribute('hidden');el.classList.add('ithFeedLiveV249429','active');el.style.setProperty('display','block','important');el.style.setProperty('visibility','visible','important');el.style.setProperty('opacity','1','important');void el.offsetHeight;requestAnimationFrame(()=>requestAnimationFrame(()=>activateFeedVideos440('force-paint')));return true}
function decodeJsonLayers429(value){let v=value;for(let i=0;i<4;i++){if(typeof v!=='string')break;const t=v.trim();if(!t||!(/^[\[{\"]/.test(t)))break;try{const n=JSON.parse(t);if(n===v)break;v=n}catch(e){break}}return v}
function cleanHumanText429(value){let v=decodeJsonLayers429(value),s='';if(v&&typeof v==='object'){s=String(v.body||v.description||v.caption||v.quote||v.title||v.text||'')}else s=String(v==null?'':v);s=s.replace(/\u0000/g,'').replace(/\s+/g,' ').trim();if(!s)return'';if((s[0]==='{'||s[0]==='[')&&/[\"'](?:media|url|filename|mime_type|kind)[\"']\s*:/.test(s))return'';const compact=s.replace(/\s/g,'');const bad=(compact.match(/[βÃÎÏÐÑ�]/g)||[]).length;if(compact.length>12&&bad/compact.length>.34)return'';return s.slice(0,1200)}
function postPayload424(p){const raw=String(p&&p.text||'');let o=decodeJsonLayers429(raw);if(typeof o==='string')o=decodeJsonLayers429(o);if(!o||typeof o!=='object'||Array.isArray(o))o=null;let media=o&&decodeJsonLayers429(o.media);if(typeof media==='string')media=decodeJsonLayers429(media);if(!media||typeof media!=='object'||Array.isArray(media)){media=o&&((o.kind||o.url||o.file_url||o.media_url||o.filename)?o:null)}let candidate=o&&(o.body||o.description||o.caption||o.quote||o.title||o.text)||'';candidate=decodeJsonLayers429(candidate);if(candidate&&typeof candidate==='object'){if(!media&&candidate.media&&typeof candidate.media==='object')media=candidate.media;candidate=candidate.body||candidate.description||candidate.caption||candidate.quote||candidate.title||candidate.text||''}return{raw,o,media,body:cleanHumanText429(candidate||(!o?raw:''))}}
function postKind424(p){const x=postPayload424(p),m=x.media||{},payloadKind=String(x.kind||x.card_kind||x.type||'').toLowerCase(),cardStyle=String(x.card_style||x.cardStyle||'').toLowerCase(),k=String(m.kind||m.media_kind||p&&p.post_kind||p&&p.kind||payloadKind||'').toLowerCase(),mime=String(m.mime_type||m.type||p&&p.mime_type||'').toLowerCase();if(x.gold_card===true||x.goldCard===true||cardStyle==='gold'||['gold_text','gold-card','gold_card','wisdom_card','ithaki_gold'].includes(payloadKind)||['gold_text','ithaki_gold'].includes(k))return'gold_text';if(k.includes('video')||mime.startsWith('video/'))return'video';if(k==='photo'||k==='image'||k.includes('picture')||mime.startsWith('image/'))return'photo';if(k==='audio'||mime.startsWith('audio/'))return'audio';if(k==='poll'||m.poll_id||m.pollId||Array.isArray(m.options))return'poll';if(k==='file'||m.url||m.file_url||m.media_url)return'file';const t=(x.body+' '+String(p&&p.nickname||'')).toLowerCase();if(/σοφ|wisdom|φιλοσοφ|γνωμικ|quote|ιθακη|ithaki/.test(t))return'wisdom';return'text'}
function isProfessional424(p){const x=postPayload424(p),o=x.o||{},m=x.media||{};return !!(p&&p.is_professional||p&&p.professional||String(p&&p.account_type||'').toLowerCase()==='professional'||String(p&&p.profile_type||'').toLowerCase()==='professional'||o.is_professional||o.professional||String(o.account_type||'').toLowerCase()==='professional'||m.professional)}
function mediaUrl424(p){const x=postPayload424(p),m=x.media||{};return String(m.url||m.file_url||m.media_url||m.src||p&&p.media_url||p&&p.file_url||'')}
function postCounts424(p){return{likes:Number(p&&p.likes||p&&p.like_count||p&&p.reactions_count||p&&p.reaction_count||0),comments:Number(p&&p.comments||p&&p.comment_count||p&&p.comments_count||0)}}
function feedDate429(v){const n=Number(v||0),d=new Date(n>0&&n<1e12?n*1000:(n||v));if(!Number.isFinite(d.getTime()))return'';try{return d.toLocaleString('el-GR',{day:'2-digit',month:'2-digit',year:'numeric',hour:'2-digit',minute:'2-digit'})}catch(e){return''}}
function missingMediaCard429(kind,body){const icon=kind==='video'?'🎬':kind==='photo'?'🖼️':kind==='audio'?'🎙️':'📎';return `<div class="ithFeedCardV249429 ithMissingMediaV249429"><div class="ithFeedFileV249429">${icon}</div><div class="ithFeedMainTextV249429">${esc(body||'Παλιά δημοσίευση')}</div><small>Το παλιό αρχείο δεν είναι πλέον διαθέσιμο στον server.</small></div>`}


let feedRawCount428=0,feedUniqueCount428=0,feedDuplicatesHidden428=0,feedDuplicateIds428=[];
let feedLastPosts429=[],legacyFeedPaintRejected429=0,feedOwnerRepairs429=0,feedOwnerRepairTimer429=0,feedOwnerGuard429=null;
/* V249503_FEED_BACKGROUND_PAGING: small first paint, cached return, background next page. */
const FEED_PAGE_SIZE503=20,FEED_CACHE_KEY503='ithaki_feed_cache_v249508';
let feedRawPosts503=[],feedNextBefore503=0,feedHasMore503=false,feedPrefetched503=null,feedPrefetchBusy503=false,feedAppendBusy503=false,feedCacheStamp503=0;
function feedCreated503(p){return Number(p&&p.created_at||0)||0}
function feedUniqueRaw503(arr){const seen=new Set(),out=[];for(const p of (Array.isArray(arr)?arr:[])){const id=String(p&&p.post_id||p&&p.message_id||p&&p.id||'');const key=id||[p&&p.sender_id,feedCreated503(p),String(p&&p.text||'').slice(0,120)].join('|');if(seen.has(key))continue;seen.add(key);out.push(p)}return out.sort((a,b)=>feedCreated503(b)-feedCreated503(a))}
function saveFeedCache503(){try{const payload=JSON.stringify({at:Date.now(),posts:feedRawPosts503.slice(0,60),next:feedNextBefore503,more:feedHasMore503});if(payload.length<2000000)sessionStorage.setItem(FEED_CACHE_KEY503,payload)}catch(e){}}
function readFeedCache503(){try{const x=JSON.parse(sessionStorage.getItem(FEED_CACHE_KEY503)||'null');if(!x||Date.now()-Number(x.at||0)>180000||!Array.isArray(x.posts))return null;return x}catch(e){return null}}
async function requestFeedPage503(st,before=0,after=0,limit=FEED_PAGE_SIZE503,opening=false){if(!opening&&!feedIsActiveV249545())throw Object.assign(new Error('feed_suspended'),{name:'AbortError'});const q=new URLSearchParams({room_id:st.room||'ithaki-phone-test',visibility:'public',limit:String(limit),lite:'1',max_media_chars:'180000',include_missing_media:'0',viewer_id:st.device||''});if(before>0)q.set('before_ts',String(before));if(after>0)q.set('after_ts',String(after));const generation=feedLifecycleGenerationV249545,c=new AbortController();feedControllersV249545.add(c);try{const out=await api422('/api/flow?'+q.toString(),{signal:c.signal,cache:'no-store'});if(generation!==feedLifecycleGenerationV249545||(!opening&&!feedIsActiveV249545())||(opening&&normalizePage427(desiredPage427)!=='feed'))throw Object.assign(new Error('feed_stale'),{name:'AbortError'});return out}finally{feedControllersV249545.delete(c)}}
async function prefetchFeed503(){if(!feedIsActiveV249545()||feedPrefetchBusy503||feedPrefetched503||!feedHasMore503||!feedNextBefore503)return;const st=core(),generation=feedLifecycleGenerationV249545;if(!st)return;feedPrefetchBusy503=true;try{const r=await requestFeedPage503(st,feedNextBefore503,0,FEED_PAGE_SIZE503);if(generation===feedLifecycleGenerationV249545&&feedIsActiveV249545())feedPrefetched503=r}catch(e){if(e?.name!=='AbortError')diag('feed-prefetch-error-v249503',{message:String(e.message||e)})}finally{feedPrefetchBusy503=false}}
async function appendPrefetchedFeed503(){if(!feedIsActiveV249545()||feedAppendBusy503||!feedHasMore503)return;feedAppendBusy503=true;try{if(!feedPrefetched503)await prefetchFeed503();const r=feedPrefetched503;feedPrefetched503=null;if(!r||!Array.isArray(r.posts)||!r.posts.length){feedHasMore503=false;return}saveFeedPosition440('before-append-v249503');feedRawPosts503=feedUniqueRaw503(feedRawPosts503.concat(r.posts));feedNextBefore503=Number(r.next_before_ts||feedCreated503(feedRawPosts503[feedRawPosts503.length-1]))||0;feedHasMore503=!!r.has_more;const d=dedupeProfessionalFeed428(feedRawPosts503),posts=paceIthaki433(d.posts);paintNewFeedOnly429($('feedPage'),posts);visualPage422('feed','feed-append-v249503');restoreFeedPosition440('append-v249503');activateFeedVideos440('append-v249503');saveFeedCache503();clearTimeout(feedPrefetchTimerV249545);feedPrefetchTimerV249545=setTimeout(()=>{if(feedIsActiveV249545())prefetchFeed503()},50)}finally{feedAppendBusy503=false}}
async function refreshFeedBackground503(){if(!feedIsActiveV249545())return;const st=core(),generation=feedLifecycleGenerationV249545;if(!st||!feedRawPosts503.length)return;const latest=Math.max(...feedRawPosts503.map(feedCreated503));if(!latest)return;try{const r=await requestFeedPage503(st,0,latest,20);if(generation!==feedLifecycleGenerationV249545||!feedIsActiveV249545()||!r||!Array.isArray(r.posts)||!r.posts.length)return;feedRawPosts503=feedUniqueRaw503(r.posts.concat(feedRawPosts503));saveFeedCache503();const list=feedList440();if(list&&list.scrollTop<160){const d=dedupeProfessionalFeed428(feedRawPosts503),posts=paceIthaki433(d.posts);paintNewFeedOnly429($('feedPage'),posts);restoreFeedPosition440('background-new-v249503');activateFeedVideos440('background-new-v249503')}}catch(e){if(e?.name!=='AbortError')diag('feed-background-refresh-error-v249503',{message:String(e.message||e)})}}

function normFeedText428(v){return String(v==null?'':v).normalize('NFKC').replace(/\s+/g,' ').trim().toLocaleLowerCase('el-GR')}
function cleanMediaName428(v){let s=String(v||'').split(/[?#]/)[0].replace(/\\/g,'/').split('/').pop()||'';return normFeedText428(s.replace(/^(?:flow|media|upload|file)[_-]?[a-z0-9]{8,}[_-]?/i,'').replace(/[_-]?(?:17|18)\d{8,}$/,''))}
function feedSemanticParts428(p){
 const x=postPayload424(p),o=x.o&&typeof x.o==='object'?x.o:{},m=x.media&&typeof x.media==='object'?x.media:{},kind=postKind424(p);
 const body=normFeedText428(o.body||o.description||o.caption||o.quote||o.text||o.title||x.body||'');
 const hash=normFeedText428(m.sha256||m.checksum||m.file_hash||m.content_hash||m.hash||o.sha256||o.checksum||'');
 const filename=cleanMediaName428(m.filename||m.file_name||m.name||m.original_name||'');
 const size=Number(m.size||m.size_bytes||m.bytes||o.size||0)||0;
 const mime=normFeedText428(m.mime_type||m.type||'');
 const url=String(m.url||m.file_url||m.media_url||m.src||'');
 const urlName=cleanMediaName428(url);
 let options='';try{const a=o.options||m.options||o.poll_options||[];if(Array.isArray(a))options=a.map(z=>normFeedText428(typeof z==='object'?(z.text||z.label||z.title||JSON.stringify(z)):z)).join('¦')}catch(e){}
 const mediaSig=hash?('hash:'+hash):((filename||urlName)&&size?('file:'+(filename||urlName)+'|'+size+'|'+mime):((filename||urlName)?('name:'+(filename||urlName)+'|'+mime):''));
 return{sender:normFeedText428(p&&p.sender_id||''),kind,body,mediaSig,options,created:Number(p&&p.created_at||0)||0,id:String(p&&p.post_id||p&&p.id||'')}
}
function dedupeProfessionalFeed428(arr){
 const byId=new Set(),mediaSeen=new Map(),textSeen=new Map(),posts=[],duplicateIds=[];
 for(const p of (Array.isArray(arr)?arr:[])){
  const q=feedSemanticParts428(p),id=q.id;
  if(id&&byId.has(id)){duplicateIds.push(id);continue}if(id)byId.add(id);
  const base=[q.sender,q.kind,q.body,q.mediaSig,q.options].join('|');
  if(!base.replace(/\|/g,'')){posts.push(p);continue}
  if(q.mediaSig){if(mediaSeen.has(base)){duplicateIds.push(id);continue}mediaSeen.set(base,{id,created:q.created})}
  else{const prev=textSeen.get(base);if(prev&&Math.abs(Number(prev.created||0)-q.created)<=900){duplicateIds.push(id);continue}textSeen.set(base,{id,created:q.created})}
  posts.push(p)
 }
 feedRawCount428=Array.isArray(arr)?arr.length:0;feedUniqueCount428=posts.length;feedDuplicatesHidden428=duplicateIds.length;feedDuplicateIds428=duplicateIds.slice(0,100);
 try{document.documentElement.setAttribute('data-ithaki-feed-dedupe-v249429','semantic-safe');document.documentElement.setAttribute('data-ithaki-feed-duplicates-hidden-v249429',String(feedDuplicatesHidden428))}catch(e){}
 return{posts,duplicateIds,raw:feedRawCount428,unique:feedUniqueCount428,hidden:feedDuplicatesHidden428}
}
function searchText424(p,kind){const x=postPayload424(p),m=x.media||{};return [x.body,p&&p.nickname,p&&p.sender_id,kind,m.title,m.filename,m.name,m.tags,Array.isArray(p&&p.tags)?p.tags.join(' '):''].filter(Boolean).join(' ').toLowerCase()}
function feedPerson424(p){const s=core()||{},id=String(p&&p.sender_id||''),mine=id&&id===String(s.device||''),people=s.people;let q={};try{if(people&&typeof people.get==='function')q=people.get(id)||{};else if(Array.isArray(people))q=people.find(x=>String(x&&x.device_id||x&&x.id||'')===id)||{}}catch(e){}if(!q.avatar&&p&&p.avatar)q.avatar=p.avatar;if(!q.nickname&&p&&p.nickname)q.nickname=p.nickname;if(mine){q=Object.assign({},q,{avatar:s.avatar||q.avatar||localStorage.getItem('ith_avatar')||('animal:'+(s.animal||localStorage.getItem('ith_animal')||'👤')),nickname:s.name||q.nickname||'Εσύ'})}return Object.assign({device_id:id,id:id,nickname:'Μέλος',avatar:''},q)}
function feedAvatar424(p){const q=feedPerson424(p),name=String(q.nickname||'Μέλος'),raw=String(q.avatar||q.photo||''),fallback=esc((name.trim().slice(0,1)||'Μ'));if(raw.startsWith('animal:'))return `<span class="ithFeedAvatarFallbackV249430">${esc(raw.slice(7)||fallback)}</span>`;let src=raw;try{if(typeof window.avatarAssetV249502==='function')src=window.avatarAssetV249502(raw)}catch(e){}if(!src&&/^(data:image|blob:|https?:|file:)/i.test(raw))src=raw;if(src)return `<img src="${esc(src)}" alt="${esc(name)}" loading="lazy" onerror="this.remove();this.parentElement.innerHTML='<span class=&quot;ithFeedAvatarFallbackV249430&quot;>${fallback}</span>'">`;return `<span class="ithFeedAvatarFallbackV249430">${fallback}</span>`}
function feedSide424(p,body){const id=String(p&&p.post_id||p&&p.id||''),sender=String(p&&p.sender_id||p&&p.creator_id||p&&p.device_id||''),mine=isOwnFeedPost430(p,sender),c=postCounts424(p),idj=esc(id),txt=String(body||'').slice(0,1200);return `<aside class="ithFeedSideV249429" aria-label="Λειτουργίες δημοσίευσης">${avatarButton430(p,sender)}<button title="Καρδιά" onclick="ITH.like('${idj}')">❤️<span class="ithCountV249429" id="like_${idj}">${c.likes}</span></button><button title="Σχόλια" onclick="ITH.openFeedCommentsV249430('${idj}')">💬<span class="ithCountV249429" id="comment_count_${idj}">${c.comments}</span></button><button title="Αποθήκευση" onclick="ITH.savePost('${idj}')">🔖</button><button title="Κοινοποίηση σε φίλο ή εξωτερικά" onclick="ITH.openSharePostV249433('${idj}')">📤</button>${txt?`<button title="Μετάφραση" onclick="ITH.translateBlock('post_${idj}','${esc(txt).replace(/'/g,'&#39;')}')">🌐</button>`:''}${mine?`<button title="Διαγραφή" onclick="ITH.deletePost('${idj}')">🗑️</button>`:''}</aside>`}
function feedMeta424(p,body,pro,showCaption){const name=esc(String(p&&p.nickname||'Μέλος')),when=esc(feedDate429(p&&p.created_at)),short=showCaption?esc(cleanHumanText429(body).slice(0,180)):'';return `<div class="ithFeedMetaV249429"><b>${name}${pro?'<span class="ithProfessionalBadgeV249429">💼 Επαγγελματικό</span>':''}</b>${short?`<small>${short}</small>`:''}${when?`<small>${when}</small>`:''}</div>`}
function pollId433(p){const x=postPayload424(p),o=x.o||{},m=x.media||{};return String(p&&p.poll_id||o.poll_id||o.pollId||m.poll_id||m.pollId||p&&p.post_id||p&&p.id||'')}
function pollData433(p){const x=postPayload424(p),o=x.o||{},m=x.media||{},id=pollId433(p),live=pollMap433.get(id)||{};let options=live.options||p&&p.options||o.options||m.options||[];if(typeof options==='string'){try{options=JSON.parse(options)}catch(e){options=[]}}if(!Array.isArray(options))options=[];const total=Number(live.total_votes||p&&p.total_votes||o.total_votes||0);const question=String(live.question||p&&p.question||o.question||m.question||x.body||'Ψηφοφορία μελών');return{id,question,options,total,closed:!!(live.closed||p&&p.closed)}}
function pollCore424(p){const d=pollData433(p),opts=(d.options.length?d.options:['Ναι','Όχι']).slice(0,12);return `<div class="ithFeedPollCoreV249429 ithPollFullV249433"><div class="ithPollBadgeV249433">📊 ΨΗΦΟΦΟΡΙΑ</div><div class="ithPollQuestionV249433">${esc(d.question)}</div><div class="ithPollChoicesV249433">${opts.map((o,i)=>{const label=typeof o==='string'?o:String(o.text||o.label||('Επιλογή '+(i+1))),pct=Math.max(0,Math.min(100,Number(o&&o.percent||0))),count=Number(o&&o.count||0);return `<button type="button" class="ithPollChoiceV249433" onclick="ITH.voteFeedPollV249433('${esc(d.id)}',${i})" ${d.closed?'disabled':''}><i style="width:${pct}%"></i><span>${esc(label)}</span><b>${pct.toFixed(pct%1?1:0)}% · ${count}</b></button>`}).join('')}</div><div class="ithPollTotalV249433">${d.total} ψήφοι${d.closed?' · Η ψηφοφορία έκλεισε':''}</div></div>`}
function feedStage424(p,i){const x=postPayload424(p),kind=postKind424(p),pro=isProfessional424(p),url=mediaUrl424(p),body=cleanHumanText429(x.body||''),missing=!!(p&&p.media_missing),id=esc(String(p&&p.post_id||p&&p.id||('local_'+i))),sender=esc(String(p&&p.sender_id||'')),search=esc(searchText424(p,kind)),professional=pro?'1':'0';let content='';if(missing)content=missingMediaCard429(kind,body);else if(kind==='video'&&url)content=`<div class="ithFeedMediaV249429"><video src="${esc(url)}" controls playsinline autoplay preload="auto" data-v249440-autoplay="1"></video></div>`;else if(kind==='photo'&&url)content=`<div class="ithFeedMediaV249429"><img src="${esc(url)}" loading="lazy" alt="Δημοσίευση φωτογραφίας"></div>`;else if(kind==='audio'&&url)content=`<div class="ithFeedCardV249429"><div class="ithFeedFileV249429">🎙️</div><audio src="${esc(url)}" controls preload="metadata"></audio>${body?`<div class="ithFeedMainTextV249429">${esc(body)}</div>`:''}</div>`;else if(kind==='poll')content=`<div class="ithFeedCardV249429">${pollCore424(p)}</div>`;else if(kind==='wisdom')content=`<div class="ithFeedCardV249429 ithWisdomV249429"><div style="font-size:54px;margin-bottom:18px">⛵</div><div class="ithFeedMainTextV249429">${esc(body||'Σοφό λόγο της ΙΘΑΚΗΣ')}</div></div>`;else if(kind==='file'&&url)content=`<div class="ithFeedCardV249429"><div class="ithFeedFileV249429">📎</div><div class="ithFeedMainTextV249429">${esc(body||'Αρχείο')}</div><p><a class="btn green" href="${esc(url)}" target="_blank" rel="noopener">Άνοιγμα αρχείου</a></p></div>`;else content=`<div class="ithFeedCardV249429"><div class="ithFeedMainTextV249429">${esc(body||'Δημοσίευση')}</div></div>`;return `<article class="ithFeedStageV249429" data-v249429-kind="${kind}" data-v249429-pro="${professional}" data-v249429-sender="${sender}" data-sender="${sender}" data-v249429-search="${search}" data-post="${id}">${content}${feedMeta424(p,body,pro,(kind==='video'||kind==='photo')&&!missing)}${feedSide424(p,body)}</article>`}
const readyKeywords424=['Φιλία','Ελλάδα','Ταξίδι','Μουσική','Φύση','Τεχνολογία','Εργασία','Τέχνη','Υγεία','ΙΘΑΚΗ'];
function manualKeywords424(){try{const a=JSON.parse(localStorage.getItem('ith_feed_manual_keywords_v249429')||'[]');return Array.isArray(a)?a.filter(Boolean).slice(0,30):[]}catch(e){return[]}}
function selectedKeyword424(){try{return String(localStorage.getItem('ith_feed_selected_keyword_v249429')||'')}catch(e){return''}}
function feedCategory424(){try{return String(localStorage.getItem('ith_feed_category_v249429')||'all')}catch(e){return'all'}}
function renderKeywordChips424(){const ready=$('ithFeedReadyKeywordsV249429'),manual=$('ithFeedManualKeywordsV249429'),sel=selectedKeyword424();if(ready)ready.innerHTML=readyKeywords424.map(w=>`<button class="ithFeedChipV249429 ${sel.toLowerCase()===w.toLowerCase()?'active':''}" onclick="ITH.useFeedKeywordV249429('${esc(w)}')">${esc(w)}</button>`).join('');if(manual)manual.innerHTML=manualKeywords424().map(w=>`<button class="ithFeedChipV249429 ${sel.toLowerCase()===String(w).toLowerCase()?'active':''}" onclick="ITH.useFeedKeywordV249429('${esc(String(w))}')">${esc(String(w))} ×</button>`).join('')}
function feedApplyFilter424(){const category=feedCategory424(),q=String($('ithFeedSearchInputV249429')?.value||'').trim().toLowerCase(),kw=selectedKeyword424().trim().toLowerCase(),self=String(core()&&core().device||'');document.querySelectorAll('#feedPage .ithFeedCategoriesV249429 .ithFeedChipV249429').forEach(b=>b.classList.toggle('active',b.dataset.category===category));let visible=0;document.querySelectorAll('#feedPage .ithFeedStageV249429').forEach(a=>{const kind=String(a.dataset.v249429Kind||''),pro=a.dataset.v249429Pro==='1',mine=String(a.dataset.v249429Sender||'')===self,text=String(a.dataset.v249429Search||a.textContent||'').toLowerCase(),catOk=category==='all'||category===kind||(category==='professional'&&pro)||(category==='mine'&&mine),qOk=!q||q.split(/\s+/).filter(Boolean).every(t=>text.includes(t)),kwOk=!kw||text.includes(kw);a.hidden=!(catOk&&qOk&&kwOk);if(!a.hidden)visible++});const empty=$('ithFeedNoResultsV249429');if(empty)empty.hidden=visible>0;return false}
function setFeedCategory424(cat){try{localStorage.setItem('ith_feed_category_v249429',String(cat||'all'))}catch(e){}feedApplyFilter424();return false}
function toggleFeedSearch424(force){const p=$('ithFeedSearchPanelV249429');if(!p)return false;const open=typeof force==='boolean'?force:p.hidden;p.hidden=!open;if(open){renderKeywordChips424();setTimeout(()=>$('ithFeedSearchInputV249429')?.focus(),30)}return false}
function useFeedKeyword424(word){word=String(word||'').trim();try{const old=selectedKeyword424();localStorage.setItem('ith_feed_selected_keyword_v249429',old.toLowerCase()===word.toLowerCase()?'':word)}catch(e){}renderKeywordChips424();feedApplyFilter424();return false}
function addManualKeyword424(){const i=$('ithFeedManualInputV249429'),word=String(i&&i.value||'').trim();if(!word)return false;const a=manualKeywords424();if(!a.some(x=>String(x).toLowerCase()===word.toLowerCase()))a.push(word);try{localStorage.setItem('ith_feed_manual_keywords_v249429',JSON.stringify(a.slice(-30)));localStorage.setItem('ith_feed_selected_keyword_v249429',word)}catch(e){}if(i)i.value='';renderKeywordChips424();feedApplyFilter424();return false}
function searchPanel424(){const cat=feedCategory424(),cats=[['all','Όλα'],['video','Βίντεο'],['photo','Φωτογραφίες'],['poll','Ψηφοφορίες'],['text','Κείμενο'],['wisdom','Σοφά λόγια'],['professional','Επαγγελματικά προφίλ']];return `<section id="ithFeedSearchPanelV249429" class="ithFeedSearchPanelV249429" hidden><div class="ithFeedSearchInputRowV249429"><input id="ithFeedSearchInputV249429" placeholder="Λέξη, όνομα ή θέμα" oninput="ITH.applyFeedSearchV249429()"><button class="btn" onclick="ITH.toggleFeedSearchV249429(false)">Κλείσιμο</button></div><span class="ithFeedSectionLabelV249429">Τύπος περιεχομένου</span><div class="ithFeedCategoriesV249429">${cats.map(([k,l])=>`<button data-category="${k}" class="ithFeedChipV249429 ${cat===k?'active':''}" onclick="ITH.setFeedCategoryV249429('${k}')">${l}</button>`).join('')}</div><span class="ithFeedSectionLabelV249429">Έτοιμες λέξεις-κλειδιά</span><div id="ithFeedReadyKeywordsV249429" class="ithFeedKeywordsV249429"></div><span class="ithFeedSectionLabelV249429">Χειροκίνητες λέξεις-κλειδιά</span><div class="ithFeedSearchInputRowV249429"><input id="ithFeedManualInputV249429" placeholder="Γράψε λέξη-κλειδί" onkeydown="if(event.key==='Enter'){event.preventDefault();ITH.addManualFeedKeywordV249429()}"><button class="btn green" onclick="ITH.addManualFeedKeywordV249429()">Προσθήκη</button></div><div id="ithFeedManualKeywordsV249429" class="ithFeedKeywordsV249429"></div></section>`}
function legacyFeedMarkupCount429(){return document.querySelectorAll('#feedPage .feedSearchGlassV249189,#feedPage .feedCleanNoticeV249286,#feedPage .feedModeLabelV249232,#feedPage .feedTypeSelectV249287,#feedPage>.feedList,#feedPage .feedFallbackV249283').length}
function paintNewFeedOnly429(el,posts){let html=(posts||[]).map(feedStage424).join('');if(!html)html=feedStage424({post_id:'ithaki-empty',nickname:'ΙΘΑΚΗ',text:'Δεν υπάρχουν ακόμη δημοσιεύσεις στη νέα Ροή.'},0);el.dataset.v249429Owner='professional-new-feed';el.className='page active ithFeedLiveV249429 ithProfessionalFeedV249429';feedLastPosts429=(posts||[]).slice();el.innerHTML=feedTop424()+`<div class="ithFeedStageListV249429">${html}<div id="ithFeedNoResultsV249429" class="ithFeedEmptyV249429" hidden><div><b>Δεν βρέθηκαν δημοσιεύσεις.</b></div></div></div>`;renderKeywordChips424();feedApplyFilter424();forceFeedPaint422(el);restoreFeedPosition440('owner-paint');return el}
function repairFeedOwner429(reason){if(window.__ITHAKI_MEMBER_FEED_MODE_V249481__===true)return;clearTimeout(feedOwnerRepairTimer429);feedOwnerRepairTimer429=setTimeout(()=>{if(window.__ITHAKI_MEMBER_FEED_MODE_V249481__===true)return;if(normalizePage427(desiredPage427)!=='feed')return;const el=$('feedPage');if(!el)return;if(routeBusy||feedInitialLoadBusyR10F21F1||el.dataset.r10f21f1Loading==='1'){diag('feed-owner-repair-skipped-loading-r10f21f1',{reason:String(reason||''),routeBusy:!!routeBusy});return}const bad=legacyFeedMarkupCount429()>0||!el.querySelector('.ithFeedStageListV249429');if(!bad)return;legacyFeedPaintRejected429++;if(feedLastPosts429.length){feedOwnerRepairs429++;paintNewFeedOnly429(el,feedLastPosts429);visualPage422('feed','feed-owner-repair');diag('legacy-feed-paint-rejected',{reason:reason||'',repairs:feedOwnerRepairs429,oldMarkup:legacyFeedMarkupCount429()})}else openFeedSimple422('owner-repair')},25)}
function installFeedOwnerGuard429(){if(feedOwnerGuard429||!$('feedPage'))return;feedOwnerGuard429=new MutationObserver(()=>repairFeedOwner429('feed-dom-mutation'));feedOwnerGuard429.observe($('feedPage'),{childList:true,subtree:true});setInterval(()=>{if(normalizePage427(desiredPage427)==='feed')repairFeedOwner429('feed-periodic-owner-check')},700)}
function feedTop424(){return `<div class="ithFeedFloatTopV249429"><div><button class="ithFeedCircleV249429" title="Αρχική" onclick="ITH.stableRouteV249429('home','feed-back')">‹</button></div><div class="ithFeedTitleV249429">Νέα Ροή</div><div><button id="ithFeedSearchButtonV249429" class="ithFeedCircleV249429" title="Αναζήτηση" onclick="ITH.toggleFeedSearchV249429()">🔍</button><button class="ithFeedCircleV249429" title="Ανανέωση" onclick="ITH.openProfessionalFeedV249429('refresh')">↻</button></div></div>${searchPanel424()}`}
async function openFeedSimple422(source){
  if(window.__ITHAKI_MEMBER_FEED_MODE_V249481__===true)return false;
  if(routeBusy||feedInitialLoadBusyR10F21F1){diag('feed-open-busy-before-generation-r10f21f1',{source:String(source||''),routeBusy:!!routeBusy,initialBusy:!!feedInitialLoadBusyR10F21F1});return false}
  startFeedBackgroundV249545('open-feed-'+String(source||''));
  const requestedSource=String(source||'automatic'),force=/refresh|retry|post-send|owner-repair/i.test(requestedSource);
  const existingList=feedList440();if(existingList)saveFeedPosition440('before-open-'+requestedSource);
  if(normalizePage427(desiredPage427)!=='feed'){desiredPage427='feed';routeEpoch427++}
  const epoch=routeEpoch427,st=core();if(!st)return false;
  if(!force&&existingList&&feedLastPosts429.length){feedCachedOpenCount440++;visualPage422('feed','feed-cached-v249503');restoreFeedPosition440('cached-'+requestedSource);activateFeedVideos440('cached-'+requestedSource);clearTimeout(feedRefreshTimerV249545);clearTimeout(feedPrefetchTimerV249545);feedRefreshTimerV249545=setTimeout(()=>{if(feedIsActiveV249545())refreshFeedBackground503()},30);feedPrefetchTimerV249545=setTimeout(()=>{if(feedIsActiveV249545())prefetchFeed503()},80);return false}
  if(!force&&!feedLastPosts429.length){const c=readFeedCache503();if(c&&c.posts.length){feedRawPosts503=feedUniqueRaw503(c.posts);feedNextBefore503=Number(c.next||0);feedHasMore503=!!c.more;const d=dedupeProfessionalFeed428(feedRawPosts503),posts=paceIthaki433(d.posts),el=visualPage422('feed','feed-session-cache-v249503');paintNewFeedOnly429(el,posts);visualPage422('feed','feed-session-ready-v249503');activateFeedVideos440('session-cache-v249503');clearTimeout(feedRefreshTimerV249545);clearTimeout(feedPrefetchTimerV249545);feedRefreshTimerV249545=setTimeout(()=>{if(feedIsActiveV249545())refreshFeedBackground503()},30);feedPrefetchTimerV249545=setTimeout(()=>{if(feedIsActiveV249545())prefetchFeed503()},80);return false}}
  routeBusy=true;feedInitialLoadBusyR10F21F1=true;closePlusMenu422('feed');
  try{
    removeRadicalFeed422(true);const el=visualPage422('feed','feed-start');if(!el)return false;
    el.dataset.v249429Owner='professional-new-feed';el.dataset.r10f21f1Loading='1';el.className='page active ithFeedLiveV249429 ithProfessionalFeedV249429';el.innerHTML=feedTop424()+'<div class="ithFeedEmptyV249429"><div><b>🎬 Φόρτωση Ροής…</b></div></div>';
    const r=await requestFeedPage503(st,0,0,FEED_PAGE_SIZE503,true);
    if(epoch!==routeEpoch427||normalizePage427(desiredPage427)!=='feed')return false;
    feedRawPosts503=feedUniqueRaw503(Array.isArray(r.posts)?r.posts:[]);feedNextBefore503=Number(r.next_before_ts||feedCreated503(feedRawPosts503[feedRawPosts503.length-1]))||0;feedHasMore503=!!r.has_more;feedPrefetched503=null;
    const dedupe428=dedupeProfessionalFeed428(feedRawPosts503);await loadPollMap433(st.room||'ithaki-phone-test');const posts=paceIthaki433(dedupe428.posts);delete el.dataset.r10f21f1Loading;paintNewFeedOnly429(el,posts);
    if(epoch!==routeEpoch427||normalizePage427(desiredPage427)!=='feed')return false;
    visualPage422('feed','feed-ready-v249503');restoreFeedPosition440('network-'+requestedSource);activateFeedVideos440('network-'+requestedSource);saveFeedCache503();clearTimeout(feedPrefetchTimerV249545);feedPrefetchTimerV249545=setTimeout(()=>{if(feedIsActiveV249545())prefetchFeed503()},40);document.documentElement.setAttribute('data-ithaki-feed-v249503','paged-background');settleIsolation427('feed',epoch,'feed-ready-v249503');diag('professional-feed-ready-v249503',{source:requestedSource,posts:posts.length,pageSize:FEED_PAGE_SIZE503,hasMore:feedHasMore503,backgroundPrefetch:true})
  }catch(e){if(epoch===routeEpoch427&&normalizePage427(desiredPage427)==='feed'){const p=visualPage422('feed','feed-error');if(p){delete p.dataset.r10f21f1Loading;p.className='page active ithProfessionalFeedV249429';p.innerHTML=feedTop424()+`<div class="ithFeedEmptyV249429"><div><b>Η Ροή δεν φόρτωσε.</b><br><small>${esc(e.message||e)}</small><div class="row"><button class="btn green" onclick="ITH.openProfessionalFeedV249429('retry')">Επανάληψη</button></div></div></div>`}}diag('professional-feed-error-v249503',{message:String(e.message||e)})
  }finally{const p=$('feedPage');if(p)delete p.dataset.r10f21f1Loading;feedInitialLoadBusyR10F21F1=false;routeBusy=false}
  return false
}
function closeMember422(){const m=$('memberMenu');if(m){m.classList.remove('show','localPanel','legalPanel','themePanel');m.innerHTML='';delete m.dataset.v249429Channel}return false}
async function encryptText422(text,ch){const pass=localStorage.getItem(encryptionKeyName422(ch));if(!pass||!crypto||!crypto.subtle)return null;const iv=crypto.getRandomValues(new Uint8Array(12)),base=await crypto.subtle.digest('SHA-256',new TextEncoder().encode(String(pass))),key=await crypto.subtle.importKey('raw',base,{name:'AES-GCM'},false,['encrypt']),buf=await crypto.subtle.encrypt({name:'AES-GCM',iv},key,new TextEncoder().encode(String(text||''))),b64=x=>btoa(String.fromCharCode(...new Uint8Array(x)));return{iv:b64(iv),cipher_text:b64(buf)}}
async function decryptText422(iv,cipher,ch){const pass=localStorage.getItem(encryptionKeyName422(ch));if(!pass||!crypto||!crypto.subtle)return'🔐 Κρυπτογραφημένο μήνυμα';try{const base=await crypto.subtle.digest('SHA-256',new TextEncoder().encode(String(pass))),key=await crypto.subtle.importKey('raw',base,{name:'AES-GCM'},false,['decrypt']),from=s=>Uint8Array.from(atob(String(s||'')),c=>c.charCodeAt(0)),buf=await crypto.subtle.decrypt({name:'AES-GCM',iv:from(iv)},key,from(cipher));return new TextDecoder().decode(buf)}catch(e){return'🔐 Λάθος ή ανύπαρκτο κοινό κλειδί'}}
async function loadSpaceMessagesSimple422(){const s=core(),box=$('spaceMsgs');if(!s||!s.currentSpaceChannel||!box)return false;box.innerHTML='<div class="card">Φόρτωση μηνυμάτων…</div>';try{const r=await api422(`/api/messages?room_id=${encodeURIComponent(s.room||'ithaki-phone-test')}&channel=${encodeURIComponent(s.currentSpaceChannel)}&since=0&limit=300`),items=Array.isArray(r.messages)?r.messages:[];box.innerHTML='';for(const m of items){let text=String(m.text||'');if(m.is_encrypted)text=await decryptText422(m.iv,m.cipher_text,m.channel||s.currentSpaceChannel);const d=document.createElement('div');d.className='bubble '+(String(m.sender_id||'')===String(s.device||'')?'mine':'');d.innerHTML=`<b>${esc(m.nickname||'Μέλος')}</b><div class="msgBody">${esc(text)}</div><div class="meta">${esc(m.created_at||'')}</div>`;box.appendChild(d)}if(!box.children.length)box.innerHTML='<div class="card">Ξεκίνα τη συνομιλία του χώρου.</div>';box.scrollTop=box.scrollHeight;return true}catch(e){box.innerHTML='<div class="card">Δεν φορτώνουν τα μηνύματα χώρου: '+esc(e.message||e)+'</div>';return false}}
async function loadServerFriends422(force=false){const s=core();if(!s||!s.device)return[];if(!force&&serverFriends422.length&&Date.now()-serverFriendsAt422<15000)return serverFriends422;const r=await api422(`/api/messages/friends_v249430?room_id=${encodeURIComponent(s.room||'ithaki-phone-test')}&device_id=${encodeURIComponent(s.device)}&_v=${Date.now()}`);serverFriends422=Array.isArray(r.friends)?r.friends:[];serverFriendsAt422=Date.now();return serverFriends422}
function peerFromChannel422(ch,self){const a=String(ch||'').split(':').slice(1).filter(Boolean);return a.find(x=>x!==String(self||''))||''}
function canonicalChannel422(self,peer){return'dm:'+[String(self||''),String(peer||'')].filter(Boolean).sort().join(':')}
async function canonicalFriend422(peer,force=false){peer=String(peer||'');const list=await loadServerFriends422(force);return list.find(x=>String(x.device_id||x.id||'')===peer)||null}
function person422(peer){const s=core(),p=(s&&s.people&&typeof s.people.get==='function'&&s.people.get(String(peer||'')))||{};return{id:String(peer||''),nickname:String(p.nickname||p.name||'Μέλος'),avatar:String(p.avatar||p.photo||'')}}
function personAvatar422(p){return p.avatar?`<span class="avatar"><img src="${esc(p.avatar)}" alt=""></span>`:`<span class="avatar">${esc((p.nickname||'Μ').slice(0,1))}</span>`}
async function friendState422(peer,force=false){const s=core();peer=String(peer||'');if(!s||!s.device||!peer)return{state:'profile_required',accepted:false,communication_allowed:false};if(peer===String(s.device))return{state:'self',accepted:false,communication_allowed:false};const cached=friendGateCache422.get(peer);if(!force&&cached&&Date.now()-cached.at<10000)return cached.data;const r=await api422(`/api/social/friend/state_v249430?room_id=${encodeURIComponent(s.room||'ithaki-phone-test')}&device_id=${encodeURIComponent(s.device)}&peer_id=${encodeURIComponent(peer)}&_v=${Date.now()}`);const data=Object.assign({state:'none',accepted:false,communication_allowed:false},r||{});friendGateCache422.set(peer,{at:Date.now(),data});return data}
async function requestFriend422(peer){const s=core(),p=person422(peer);if(!s||!s.device||!peer)return false;try{const r=await api422('/api/social/friend/request_v249430',{method:'POST',body:JSON.stringify({room_id:s.room||'ithaki-phone-test',from_id:s.device,from_name:s.name||'Μέλος',to_id:peer,to_name:p.nickname||'Μέλος'})});friendGateCache422.delete(String(peer));toast422(r&&r.already_friends?'Είστε ήδη φίλοι.':'Στάλθηκε αίτημα φιλίας. Περιμένει αποδοχή.',5000);try{if(typeof CORE_REFRESH_NOTIFICATION_BADGE==='function')CORE_REFRESH_NOTIFICATION_BADGE.call(window.ITH||window)}catch(_){}return openMemberGate422(peer,true)}catch(e){toast422('Δεν στάλθηκε το αίτημα: '+String(e.message||e),7000);return false}}
function friendStateText422(rel){if(rel.state==='accepted')return['✅ Αποδεκτή φιλία','Μήνυμα, φωνητική κλήση και βιντεοκλήση είναι διαθέσιμα.'];if(rel.state==='pending_outgoing')return['⏳ Το αίτημα στάλθηκε','Η επικοινωνία ανοίγει μόνο όταν το άλλο μέλος το αποδεχτεί.'];if(rel.state==='pending_incoming')return['🤝 Υπάρχει εισερχόμενο αίτημα','Άνοιξε τις Ειδοποιήσεις για Αποδοχή ή Απόρριψη.'];if(rel.state==='blocked')return['🚫 Η επικοινωνία είναι αποκλεισμένη','Δεν επιτρέπεται μήνυμα ή κλήση.'];return['🤝 Δεν υπάρχει φιλία','Πρώτα στέλνεις αίτημα φιλίας. Χωρίς αποδοχή δεν ανοίγει μήνυμα ή κλήση.']}
async function openMemberGate422(peer,force=false){const s=core();peer=String(peer||'');if(!peer)return false;if(s&&peer===String(s.device||''))return route422('profile','self-member');const p=person422(peer),m=$('memberMenu');if(!m)return false;m.className='memberMenu show';m.innerHTML=`<div class="postHead">${personAvatar422(p)}<div><b>${esc(p.nickname)}</b><div class="date">Έλεγχος φιλίας στον server…</div></div><button class="icon" style="margin-left:auto" data-v249429-member-action="close" aria-label="Έξοδος">‹</button></div><div class="card">Παρακαλώ περίμενε…</div>`;try{const rel=await friendState422(peer,force),txt=friendStateText422(rel);let actions='';if(rel.accepted){actions=`<button class="tile" data-v249429-member-action="message" data-peer="${esc(peer)}"><b>💬</b>Μήνυμα</button><button class="tile" data-v249429-member-action="video" data-peer="${esc(peer)}"><b>📹</b>Βιντεοκλήση</button><button class="tile" data-v249429-member-action="voice" data-peer="${esc(peer)}"><b>📞</b>Τηλεφωνική κλήση</button>`}else if(rel.state==='pending_incoming'){actions=`<button class="tile" data-v249429-member-action="notifications" data-peer="${esc(peer)}"><b>🔔</b>Άνοιγμα αιτήματος</button>`}else if(rel.state==='pending_outgoing'){actions=`<button class="tile" disabled><b>⏳</b>Περιμένει αποδοχή</button>`}else if(rel.state!=='blocked'){actions=`<button class="tile" data-v249429-member-action="request" data-peer="${esc(peer)}"><b>🤝</b>Αίτημα φιλίας</button>`}actions+=`<button class="tile" data-v249429-member-action="posts" data-peer="${esc(peer)}"><b>🎬</b>Δημοσιεύσεις</button><button class="tile" data-v249429-member-action="block" data-peer="${esc(peer)}"><b>🚫</b>Αποκλεισμός</button><button class="tile" data-v249429-member-action="report" data-peer="${esc(peer)}"><b>🚩</b>Αναφορά</button>`;m.innerHTML=`<div class="postHead">${personAvatar422(p)}<div><b>${esc(p.nickname)}</b><div class="date">${rel.accepted?'Φίλος':'Μη φίλος'}</div></div><button class="icon" style="margin-left:auto" data-v249429-member-action="close" aria-label="Έξοδος">‹</button></div><div class="ithFriendGateStateV249429"><b>${esc(txt[0])}</b><small>${esc(txt[1])}</small></div><div class="ithFriendGateGridV249429">${actions}</div>`;diag('home-friend-gate',{peer,state:rel.state,accepted:!!rel.accepted})}catch(e){m.innerHTML=`<div class="row"><b>Δεν έγινε ο έλεγχος φιλίας</b><button class="icon" style="margin-left:auto" data-v249429-member-action="close" aria-label="Έξοδος">‹</button></div><div class="card">${esc(e.message||e)}</div>`;diag('home-friend-gate-error',{peer,message:String(e.message||e)})}return false}
async function startDMGated422(peer){peer=String(peer||'');const rel=await friendState422(peer,true);if(!rel.accepted){toast422('Πρώτα χρειάζεται αποδεκτή φιλία για μήνυμα.',5000);return openMemberGate422(peer,true)}return startDMSimple422(peer)}
async function startCallGated422(kind,peer){const s=core();peer=String(peer||s&&s.activePeer||'');if(!peer){toast422('Διάλεξε πρώτα μέλος.');return false}const rel=await friendState422(peer,true);if(!rel.accepted){toast422('Πρώτα χρειάζεται αποδεκτή φιλία για κλήση.',5000);return openMemberGate422(peer,true)}if(String(s&&s.activePeer||'')!==peer)await startDMSimple422(peer);const fn=kind==='voice'?CORE_VOICE_CALL:CORE_VIDEO_CALL;if(typeof fn!=='function'){toast422('Ο μηχανισμός κλήσης δεν είναι διαθέσιμος.');return false}return fn.call(window.ITH||window)}
function startVoiceCallGated422(peer){return startCallGated422('voice',peer)}
function startVideoCallGated422(peer){return startCallGated422('video',peer)}
function normalizeNotifications422(){
  const panels=[...document.querySelectorAll('.v249264NotifyPanel,.notificationPanelPro,[id^="notificationPanel"]')];
  panels.forEach((x,i)=>{if(i>0)x.remove()});
  const menu=$('memberMenu');if(menu&&panels.length)menu.classList.add('show','fullAvatarMenuV249231');
  try{if(typeof CORE_REFRESH_NOTIFICATION_BADGE==='function')CORE_REFRESH_NOTIFICATION_BADGE.call(window.ITH||window)}catch(e){}
}
async function openNotifications422(source){
  closePlusMenu422('notifications');
  if(typeof CORE_NOTIFY_CENTER!=='function'){toast422('Το κέντρο ειδοποιήσεων δεν είναι διαθέσιμο.');diag('notifications-missing',{source:source||''});return false}
  try{
    notificationOpenCount422++;
    const out=await Promise.resolve(CORE_NOTIFY_CENTER.call(window.ITH||window));
    setTimeout(normalizeNotifications422,0);setTimeout(normalizeNotifications422,250);
    diag('notifications-open-once',{source:source||'',count:notificationOpenCount422});
    return out;
  }catch(e){toast422('Δεν άνοιξαν οι ειδοποιήσεις: '+String(e.message||e),6500);diag('notifications-error',String(e.message||e));return false}
}
async function memberAction422(el){
  const a=String(el&&el.dataset.v249429MemberAction||''),peer=String(el&&el.dataset.peer||'');
  if(a==='close')return closeMember422();
  closeMember422();
  if(a==='request')return requestFriend422(peer);
  if(a==='message')return startDMGated422(peer);
  if(a==='video')return startVideoCallGated422(peer);
  if(a==='voice')return startVoiceCallGated422(peer);
  if(a==='notifications')return openNotifications422('friend-request');
  if(a==='posts')return window.ITH&&typeof ITH.memberPosts==='function'?ITH.memberPosts(peer):false;
  if(a==='block')return window.ITH&&typeof ITH.block==='function'?ITH.block(peer):false;
  if(a==='report')return window.ITH&&typeof ITH.report==='function'?ITH.report(peer):false;
  return false
}
function friendRow422(p){const id=String(p.device_id||p.id||''),name=String(p.nickname||p.name||'Φίλος'),av=String(p.avatar||p.photo||''),letter=esc((name||'Φ').slice(0,1));const img=av?`<img src="${esc(av)}" alt="" loading="lazy" onerror="this.style.display='none';this.nextElementSibling.style.display='grid'"><span style="display:none">${letter}</span>`:`<span>${letter}</span>`;return `<button class="dmFriendRowV249235" type="button" data-v249429-peer="${esc(id)}"><span class="avatar">${img}</span><span class="who"><b>${esc(name)}</b><small>${p.online?'Ενεργός τώρα':'Αποδεκτός φίλος'}</small></span><span class="go"><span class="msgGo">💬 Μήνυμα</span></span></button>`}
async function renderServerFriends422(force=false){
  const box=document.querySelector('#dmPage .dmFriendListV249235');if(!box||contactsRenderBusy422)return false;
  contactsRenderBusy422=true;
  try{
    if(!box.dataset.v249429Ready)box.innerHTML='<div class="card">Φόρτωση αποδεκτών φίλων…</div>';
    const list=await loadServerFriends422(!!force);
    const stamp=list.map(x=>String(x.device_id||x.id||'')).sort().join('|');
    if(box.dataset.v249429Ready===stamp){diag('server-friends-skip',{count:list.length});return false}
    box.innerHTML=list.length?`<div class="dmFriendSectionTitleV249235">Αποδεκτοί φίλοι (${list.length})</div><div class="dmFriendSectionV249235">${list.map(friendRow422).join('')}</div>`:'<div class="card">Δεν υπάρχουν ακόμη αποδεκτοί φίλοι. Κάνε αίτημα και περίμενε αποδοχή πριν από μήνυμα ή κλήση.</div>';
    box.dataset.v249429Ready=stamp;contactsRenderCount422++;
    diag('server-friends-render-once',{count:list.length,ids:list.map(x=>x.device_id||x.id),renderCount:contactsRenderCount422});
  }catch(e){
    box.innerHTML='<div class="card">Δεν φόρτωσαν οι αποδεκτοί φίλοι: '+esc(e.message||e)+'</div>';
    diag('server-friends-error',{message:String(e.message||e),status:e.status||0,reason:e.reason||''});
  }finally{contactsRenderBusy422=false}
  return false
}
function scheduleServerFriends422(){
  const cycle=++dmRenderCycle422;
  const run=async(step=0)=>{
    const s=core();if(cycle!==dmRenderCycle422||String(s&&s.page||document.body?.dataset.page||'')!=='dm')return;
    const box=document.querySelector('#dmPage .dmFriendListV249235');
    if(!box){if(step<10)setTimeout(()=>run(step+1),120);return}
    cleanLocks422();await renderServerFriends422(step===0);
  };
  setTimeout(()=>run(0),70);return cycle
}
async function sendTextDirect422(channel,text){const s=core();if(!s)throw new Error('Η σύνδεση δεν είναι έτοιμη.');let peer='';if(String(channel||'').startsWith('dm:')){peer=String(s.activePeer||peerFromChannel422(channel,s.device)||'');let fr=await canonicalFriend422(peer,false);if(!fr)fr=await canonicalFriend422(peer,true);if(!fr){const e=new Error('Η επαφή δεν είναι αποδεκτός φίλος στον server. Επίλεξέ την ξανά από τη λίστα Μηνυμάτων.');e.status=403;e.reason='friend_required';throw e}peer=String(fr.device_id||fr.id||'');channel=String(fr.channel||canonicalChannel422(s.device,peer));s.activePeer=peer;s.activeChannel=channel}const cfg=securitySettings422(channel),isDM=String(channel||'').startsWith('dm:');if(isDM&&securityDirtyChannels426.has(channel)){const e=new Error('Άλλαξες την κρυπτογράφηση αλλά δεν την ενεργοποίησες. Πάτησε Αποθήκευση και ενεργοποίηση στην κλειδαριά.');e.reason='security_settings_unsaved';throw e}if(isDM&&cfg.mode==='standard_aes'){const enc=await encryptText422(text,channel);if(!enc)throw new Error('Λείπει το κοινό κλειδί AES. Άνοιξε την κλειδαριά.');return api422('/api/communication/messages/send_v249396',{method:'POST',body:JSON.stringify({room_id:s.room,channel,sender_id:s.device,recipient_id:peer,nickname:s.name,security_mode:'standard_aes',is_encrypted:true,iv:enc.iv,cipher_text:enc.cipher_text,text:'',message_type:'message',auto_delete_seconds:cfg.auto_delete_seconds,storage_mode:cfg.storage_mode,plaintext_ack:false})})}if(isDM&&cfg.mode==='full_e2ee')throw new Error('Το End-to-end Android Keystore χρειάζεται αποστολή από το συμβατό APK.');const enc=!isDM&&cfg.mode==='standard_aes'?await encryptText422(text,channel):null,payload=enc?{room_id:s.room,channel,peer_id:peer,sender_id:s.device,nickname:s.name,language:'el',text:'',is_encrypted:true,iv:enc.iv,cipher_text:enc.cipher_text}:{room_id:s.room,channel,peer_id:peer,sender_id:s.device,nickname:s.name,language:'el',text};const endpoint=isDM?'/api/messages/send_v249430':'/api/messages/send';return api422(endpoint,{method:'POST',body:JSON.stringify(payload)})}
function encryptionChannel422(){const s=core();return String((s&&s.page)==='spaces'?(s.currentSpaceChannel||''):(s.activeChannel||''))}
function encryptionKeyName422(ch){return'ith_e2e_key_'+String(ch||'main')}
function securitySettingsName422(ch){return'ith_security_settings_v249429_'+String(ch||'main')}
function securitySettings422(ch){let x={mode:'simple',auto_delete_seconds:86400,storage_mode:'encrypted_queue',screenshot_block:true,recording_block:true,voice_mask_mode:'light'};try{x=Object.assign(x,JSON.parse(localStorage.getItem(securitySettingsName422(ch))||'{}')||{})}catch(e){}if(!['simple','standard_aes','full_e2ee'].includes(x.mode))x.mode='simple';return x}
function conversationMode422(ch){return securitySettings422(ch).mode||'simple'}
function encrypted422(ch){return conversationMode422(ch)==='standard_aes'&&!!localStorage.getItem(encryptionKeyName422(ch))}
function ttlLabel422(v){v=Number(v||0);return({0:'χωρίς αυτόματη διαγραφή',1:'1 δευτ.',10:'10 δευτ.',30:'30 δευτ.',60:'1 λεπτό',300:'5 λεπτά',3600:'1 ώρα',86400:'24 ώρες',259200:'72 ώρες'})[v]||'24 ώρες'}
function modeLabel422(ch){const x=securitySettings422(ch);if(x.mode==='standard_aes')return'AES-GCM με κοινό κλειδί';if(x.mode==='full_e2ee')return'End-to-end Android Keystore';return'Απλή'}
function conversationText422(kind){const ch=encryptionChannel422(),x=securitySettings422(ch),base=kind==='space'?'Συνομιλία δωματίου':'Προσωπική συνομιλία';return base+' · '+modeLabel422(ch)+(x.mode==='simple'?'':' · Auto-delete '+ttlLabel422(x.auto_delete_seconds))}
function updateConversationType422(){const d=$('ithConversationTypeV249429'),dt=conversationText422('dm');if(d&&d.textContent!==dt)d.textContent=dt;const x=$('ithSpaceConversationTypeV249429'),xt=conversationText422('space');if(x&&x.textContent!==xt)x.textContent=xt}
function findSendButton422(inputId){const input=$(inputId),c=input&&input.closest('.composer');if(!c)return null;return [...c.querySelectorAll('button')].find(b=>String(b.textContent||'').trim()==='➤'||/sendDMText|sendSpaceText/i.test(String(b.getAttribute('onclick')||'')))||null}
function nativeBridge422(){return window.Android||window.ITHAKI_ANDROID||window.AndroidBridge||null}
function nativeE2EAvailable422(){try{const b=nativeBridge422();return!!(b&&typeof b.secureMessagingStatusV249389==='function'&&typeof b.encryptSecureMessageV249389==='function')}catch(e){return false}}
function applySecureScreen422(){const ch=encryptionChannel422(),x=securitySettings422(ch),on=x.mode!=='simple'&&(x.screenshot_block||x.recording_block);try{const b=nativeBridge422();if(b&&typeof b.setSecureScreenV249389==='function')b.setSecureScreenV249389(!!on)}catch(e){}}
function cleanLocks422(){document.querySelectorAll('#dmPage .chatHead button,#spacesPage .chatHead button').forEach(b=>{const t=String(b.textContent||''),o=String(b.getAttribute('onclick')||''),id=String(b.id||'');if((t.includes('🔐')||/openE2EPanel|SecureLock|SimpleLock/i.test(o+' '+id))&&id!=='ithOnlyEncryptionLockV249429')b.remove()});document.querySelectorAll('[id^="ithSimpleLockV249"],[id^="ithSimpleSpaceLockV249"]').forEach(x=>x.remove());let lock=$('ithOnlyEncryptionLockV249429');if(!lock){lock=document.createElement('button');lock.id='ithOnlyEncryptionLockV249429';lock.className='icon chatActionBtn';lock.type='button';lock.textContent='🔐';lock.title='Μενού προστασίας συνομιλίας';lock.onclick=()=>openEncryptionChoice422()}const s=core(),page=String(s&&s.page||document.body?.dataset.page||''),head=page==='spaces'?document.querySelector('#spacesPage .chatHead'):page==='dm'?document.querySelector('#dmPage .chatHead'):null;if(head){const last=head.querySelector('button:last-child');last?head.insertBefore(lock,last):head.appendChild(lock)}else if(lock.isConnected)lock.remove();const dh=document.querySelector('#dmPage .chatHead');if(dh){let title=dh.querySelector('.chatTitle');if(title&&!$('ithConversationTypeV249429')){const x=document.createElement('small');x.id='ithConversationTypeV249429';x.className='ithConversationTypeV249429';title.appendChild(x)}const send=findSendButton422('dmInput');if(send){send.dataset.v249429Send='dm';send.onclick=sendDMText422;send.removeAttribute('onclick');send.disabled=false}}const sh=document.querySelector('#spacesPage .chatHead');if(sh){if(!$('ithSpaceConversationTypeV249429')){const x=document.createElement('small');x.id='ithSpaceConversationTypeV249429';x.className='ithConversationTypeV249429';const title=$('spaceTitle');title?.insertAdjacentElement('afterend',x)}const send=findSendButton422('spaceInput');if(send){send.dataset.v249429Send='space';send.onclick=sendSpaceText422;send.removeAttribute('onclick');send.disabled=false}}updateConversationType422();applySecureScreen422();return false}
function markSecurityDirty426(){const menu=$('memberMenu'),ch=String(menu?.dataset.v249429Channel||encryptionChannel422()||'');if(!ch)return false;securityDirtyChannels426.add(ch);const out=$('ithChatModeResultV249429');if(out){out.className='date secureDirtyV249429';out.textContent='Οι αλλαγές δεν έχουν ενεργοποιηθεί ακόμη.'}const mode=String($('ithChatModeV249429')?.value||'simple');const key=$('ithChatKeyV249429');if(key)key.closest('label').style.display=mode==='standard_aes'?'grid':'none';return false}
function oldSecurityMenuHtml422(ch){const x=securitySettings422(ch),hasKey=!!localStorage.getItem(encryptionKeyName422(ch)),native=nativeE2EAvailable422();return `<div class="securePanelV249429"><div class="securePanelHeadV249429"><button class="icon" onclick="ITH.closeMember()">‹</button><b>🔐 Ασφαλής κλειδαριά μηνυμάτων</b><button class="icon" onclick="ITH.closeMember()">×</button></div><div class="secureStateV249429"><b>Ενεργός τύπος: ${esc(modeLabel422(ch))}</b><small>${x.mode==='standard_aes'?'Πραγματική AES-256-GCM. Το κοινό κλειδί δεν αποστέλλεται στον server.':x.mode==='full_e2ee'?(native?'Το Android Keystore είναι διαθέσιμο.':'Η επιλογή απαιτεί Android APK με Keystore.'):'Κανονική απλή συνομιλία.'}</small></div><div class="card"><label>Τρόπος προστασίας<select id="ithChatModeV249429" onchange="ITH.markSecurityDirtyV249429()"><option value="simple" ${x.mode==='simple'?'selected':''}>Απλή συνομιλία</option><option value="standard_aes" ${x.mode==='standard_aes'?'selected':''}>AES-GCM με κοινό κλειδί</option><option value="full_e2ee" ${x.mode==='full_e2ee'?'selected':''} ${native?'':'disabled'}>End-to-end Android Keystore${native?'':' — απαιτεί APK'}</option></select></label><label style="display:${x.mode==='standard_aes'?'grid':'none'}">Κοινό κλειδί AES<input id="ithChatKeyV249429" type="password" value="${hasKey?'••••••••':''}" placeholder="Το ίδιο κλειδί και στις δύο συσκευές" oninput="ITH.markSecurityDirtyV249429()"></label><label>Auto-Delete<select id="ithChatTtlV249429" onchange="ITH.markSecurityDirtyV249429()"><option value="1" ${x.auto_delete_seconds==1?'selected':''}>1 δευτ. — δοκιμή</option><option value="10" ${x.auto_delete_seconds==10?'selected':''}>10 δευτ.</option><option value="30" ${x.auto_delete_seconds==30?'selected':''}>30 δευτ.</option><option value="60" ${x.auto_delete_seconds==60?'selected':''}>1 λεπτό</option><option value="300" ${x.auto_delete_seconds==300?'selected':''}>5 λεπτά</option><option value="3600" ${x.auto_delete_seconds==3600?'selected':''}>1 ώρα</option><option value="86400" ${x.auto_delete_seconds==86400?'selected':''}>24 ώρες</option><option value="259200" ${x.auto_delete_seconds==259200?'selected':''}>72 ώρες</option><option value="0" ${x.auto_delete_seconds==0?'selected':''}>Απενεργοποιημένο</option></select></label><label>Αποθήκευση server<select id="ithChatStorageV249429" onchange="ITH.markSecurityDirtyV249429()"><option value="encrypted_queue" ${x.storage_mode==='encrypted_queue'?'selected':''}>Προσωρινό κρυπτογραφημένο πακέτο</option><option value="zero_online_only" ${x.storage_mode==='zero_online_only'?'selected':''}>Μηδενική αποθήκευση — μόνο online</option></select></label><label class="secureToggleV249429"><input id="ithChatShotV249429" type="checkbox" ${x.screenshot_block?'checked':''} onchange="ITH.markSecurityDirtyV249429()"> Προστασία στιγμιοτύπου στο Android</label><label class="secureToggleV249429"><input id="ithChatRecordV249429" type="checkbox" ${x.recording_block?'checked':''} onchange="ITH.markSecurityDirtyV249429()"> Προστασία εγγραφής οθόνης στο Android</label><div class="secureTruthV249429"><b>Ασφαλής ενεργοποίηση</b><span>Η αλλαγή δεν εφαρμόζεται σιωπηρά. Μετά την επιλογή AES γράφεις το ίδιο κοινό κλειδί και στις δύο συσκευές και πατάς το πράσινο κουμπί. Μέχρι τότε η αποστολή μπλοκάρεται ώστε να μη φύγει απλό μήνυμα κατά λάθος.</span></div><div class="secureSaveBarV249429"><button class="btn green" onclick="ITH.saveConversationModeV249429()">Αποθήκευση και ενεργοποίηση</button><div id="ithChatModeResultV249429" class="date">Ενεργός τύπος: ${esc(modeLabel422(ch))}</div></div></div></div>`}
function openEncryptionChoice422(channel){const ch=String(channel||encryptionChannel422()||'');if(!ch){toast422('Διάλεξε πρώτα φίλο ή δωμάτιο.');return false}const menu=$('memberMenu');if(!menu)return false;menu.dataset.v249429Channel=ch;menu.innerHTML=oldSecurityMenuHtml422(ch);menu.classList.add('show');diag('classic-security-menu-open',{channel:ch,mode:securitySettings422(ch).mode,dirty:securityDirtyChannels426.has(ch)});return false}
async function saveConversationMode422(){const menu=$('memberMenu'),ch=String(menu?.dataset.v249429Channel||encryptionChannel422()||''),s=core();if(!ch||!s)return false;const mode=String($('ithChatModeV249429')?.value||'simple'),key=String($('ithChatKeyV249429')?.value||''),x={mode,auto_delete_seconds:Number($('ithChatTtlV249429')?.value||86400),storage_mode:String($('ithChatStorageV249429')?.value||'encrypted_queue'),screenshot_block:!!$('ithChatShotV249429')?.checked,recording_block:!!$('ithChatRecordV249429')?.checked,voice_mask_mode:'none'},out=$('ithChatModeResultV249429');if(out){out.className='date';out.textContent='Αποθήκευση…'}if(mode==='standard_aes'){if((!key||key==='••••••••')&&!localStorage.getItem(encryptionKeyName422(ch))){if(out){out.className='date secureDirtyV249429';out.textContent='Γράψε κοινό κλειδί AES.'}return false}if(key&&key!=='••••••••')localStorage.setItem(encryptionKeyName422(ch),key)}else if(mode==='simple'){localStorage.removeItem(encryptionKeyName422(ch))}else if(mode==='full_e2ee'&&!nativeE2EAvailable422()){if(out){out.className='date secureDirtyV249429';out.textContent='Το End-to-end Android Keystore απαιτεί το συμβατό APK.'}return false}try{if(ch.startsWith('dm:'))await api422('/api/communication/security_mode_v249396',{method:'POST',body:JSON.stringify({room_id:s.room,channel:ch,device_id:s.device,mode:mode==='simple'?'no_encryption':mode,plaintext_ack:mode==='simple'})});localStorage.setItem(securitySettingsName422(ch),JSON.stringify(x));securityDirtyChannels426.delete(ch);if(out){out.className='date secureSavedV249429';out.textContent='✅ Ενεργοποιήθηκε: '+modeLabel422(ch)}updateConversationType422();applySecureScreen422();toast422('Ενεργοποιήθηκε ο τρόπος συνομιλίας: '+modeLabel422(ch),4500);diag('classic-security-settings-saved',{channel:ch,mode,ttl:x.auto_delete_seconds,storage:x.storage_mode,encrypted:mode==='standard_aes'});setTimeout(closeMember422,1200)}catch(e){if(out){out.className='date secureDirtyV249429';out.textContent='Δεν ενεργοποιήθηκε: '+String(e.message||e)}diag('classic-security-settings-error',{channel:ch,message:String(e.message||e)})}return false}
async function sendDMText422(){if(messageSendBusy)return false;const input=$('dmInput'),text=String(input&&input.value||'').trim(),s=core();if(!s||!s.activeChannel){toast422('Διάλεξε πρώτα φίλο.');return false}if(!text)return false;messageSendBusy=true;const btn=findSendButton422('dmInput');if(btn)btn.disabled=true;try{await sendTextDirect422(s.activeChannel,text);input.value='';if(typeof CORE_LOAD_MESSAGES==='function')await Promise.resolve(CORE_LOAD_MESSAGES.call(window,true));diag('dm-send-normal',{channel:s.activeChannel,encrypted:encrypted422(s.activeChannel)});setTimeout(cleanLocks422,0)}catch(e){if(e.status===403){serverFriendsAt422=0;renderServerFriends422()}const msg=e.reason==='friend_required'?'Η επαφή δεν είναι πλέον αποδεκτός φίλος. Επίλεξέ την ξανά από τη λίστα.':String(e.message||e);toast422('Δεν στάλθηκε: '+msg,7500);diag('dm-send-error',{message:msg,status:e.status||0,reason:e.reason||''})}finally{messageSendBusy=false;if(btn)btn.disabled=false}return false}
async function sendSpaceText422(){if(window.__ITHAKI_R10F15_SINGLE_COMMUNITY_RUNTIME__){const f=window.__ITHAKI_R10F15_EARLY_SEND__||window.sendΜήνυμαPayload;if(typeof f==='function')return f.call(window);return false}if(messageSendBusy)return false;const input=$('spaceInput'),text=String(input&&input.value||'').trim(),s=core();if(!s||!s.currentSpaceChannel){toast422('Διάλεξε πρώτα δωμάτιο.');return false}if(!text)return false;messageSendBusy=true;const btn=findSendButton422('spaceInput');if(btn)btn.disabled=true;try{await sendTextDirect422(s.currentSpaceChannel,text);input.value='';await loadSpaceMessagesSimple422();diag('space-send-normal',{channel:s.currentSpaceChannel,encrypted:encrypted422(s.currentSpaceChannel)});setTimeout(cleanLocks422,0)}catch(e){toast422('Δεν στάλθηκε: '+String(e.message||e),6500);diag('space-send-error',String(e.message||e))}finally{messageSendBusy=false;if(btn)btn.disabled=false}return false}
async function startDMSimple422(id){id=String(id||'');if(normalizePage427(desiredPage427)!=='dm'){desiredPage427='dm';routeEpoch427++}const dmEpoch427=routeEpoch427;let fr=await canonicalFriend422(id,false);if(!fr)fr=await canonicalFriend422(id,true);if(!fr){toast422('Αυτή η επαφή δεν είναι αποδεκτός φίλος στον server.');diag('dm-contact-rejected',{peer:id});return false}const peer=String(fr.device_id||fr.id||'');if(typeof CORE_START_DM!=='function')return false;try{const out=await Promise.resolve(CORE_START_DM.call(window.ITH||window,peer));const s=core();if(s){s.activePeer=peer;s.activeChannel=String(fr.channel||canonicalChannel422(s.device,peer))}visualPage422('dm','dm-contact-open');settleIsolation427('dm',dmEpoch427,'dm-contact');setTimeout(cleanLocks422,0);diag('dm-contact-open',{peer,channel:core()?.activeChannel||'',serverAccepted:true});return out}catch(e){toast422('Δεν άνοιξε η συνομιλία: '+String(e.message||e));diag('dm-contact-error',String(e.message||e));return false}}

function roomKind431(x){
  const title=String(x&&x.title||x&&x.name||'').toLowerCase();
  const cat=String(x&&x.category||x&&x.kind||x&&x.type||'').toLowerCase();
  if(/sos|γειτον|neighbou?r|emergency/.test(title+' '+cat))return'sos';
  if(String(x&&x.parent_id||''))return'topics';
  if(/professional|business|επαγγελ/.test(cat+' '+title))return'communities';
  if(String(x&&x.owner_id||'')==='system'||/community|κοιν/.test(cat+' '+title))return'communities';
  return'rooms'
}
function roomCountLine431(x){
  const registered=Number(x&&x.member_count||x&&x.registered_count||0);
  const live=Number(x&&x.live_count||x&&x.live_now||x&&x.online_count||0);
  return `👥 ${registered} εγγεγραμμένα · <span class="ithRoomLiveV249431">● ${live} live</span>`
}
function spaceDirectoryTabs431(){
  const tabs=[['rooms','🏠 Δωμάτια'],['communities','🌐 Κοινότητες'],['topics','🧭 Θέματα'],['sos','🆘 SOS Γειτονιά']];
  return tabs.map(([key,label])=>`<button class="ithSpaceTabV249431 ${spaceTab422===key?'active':''}" onclick="ITH.simpleSpaceTabV249429('${key}')">${label}</button>`).join('')
}
function spaceChatHtml431(room){
  return `<div class="ithSpaceChatScreenV249431"><div class="ithSpaceChatTopV249431"><button class="icon" onclick="ITH.backToSpacesDirectoryV249431()">‹</button><div class="ithSpaceChatTitleV249431"><b id="spaceTitle">${esc(room&&room.title||room&&room.name||'Δωμάτιο')}</b><small>${roomCountLine431(room||{})}</small></div><button class="icon" onclick="ITH.openSpaceMedia('file',false)">📎</button></div><small id="ithSpaceConversationTypeV249429" class="ithConversationTypeV249429">Συνομιλία δωματίου · Απλή</small><div id="spaceMsgs" class="messages"><div class="card">Φόρτωση μηνυμάτων…</div></div><div class="composer"><textarea id="spaceInput" placeholder="Μήνυμα στον χώρο..."></textarea><button class="icon" type="button">➤</button></div></div>`
}
function backToSpacesDirectory431(){if(window.__ITHAKI_R10F15_SINGLE_COMMUNITY_RUNTIME__){const o=window.ITH||{},f=o.openCanonicalCommunitiesR10F15||window.openCanonicalCommunitiesR10F15;return typeof f==='function'?f.call(o):false}spaceScreen431='directory';const s=core();if(s){s.currentSpace='';s.currentSpaceChannel=''}return renderSimpleSpaces422()}

function simpleSpacesHtml422(){return `<div class="ithSimpleSpacesV249429 ithSpacesDirectoryV249431"><div class="ithSpacesDirectoryHeadV249431"><button class="icon" onclick="ITH.stableRouteV249429('home','spaces-home')">‹</button><div><b>🏘️ Δωμάτια και Κοινότητες</b><small>Διάλεξε κατηγορία και μετά χώρο συνομιλίας.</small></div><button class="icon ithSpaceCreateButtonV249432" title="Δημιουργία χώρου" onclick="ITH.openCreateSpaceV249432()">＋</button><button class="icon" onclick="ITH.refreshSimpleRoomsV249429()">🔄</button></div><div class="ithSpaceTabsV249431">${spaceDirectoryTabs431()}</div><div class="ithSpaceCreateHintV249432">＋ Δημιουργία: δωμάτιο · κοινότητα · επαγγελματικός χώρος</div><div id="roomList" class="roomList ithRoomDirectoryListV249431"><div class="card">Φόρτωση χώρων…</div></div></div>`}

function renderRoomListSimple422(items){
  const box=$('roomList');
  if(!box)return;
  const list=(items||[]).filter(x=>roomKind431(x)===spaceTab422);
  box.innerHTML=list.length?list.map(x=>{
    const id=String(x.subroom_id||x.id||'');
    const title=String(x.title||x.name||'Δωμάτιο');
    const desc=String(x.description||'Πλήρης συνομιλία χώρου');
    const professional=/professional|business|επαγγελ/i.test(String(x.category||x.kind||'')+' '+title);return `<button class="ithRoomDirectoryCardV249431 ${professional?'professional':''}" type="button" data-v249429-room="${esc(id)}"><span class="ithRoomIconV249431">${professional?'💼':spaceTab422==='sos'?'🆘':spaceTab422==='topics'?'🧭':spaceTab422==='communities'?'🌐':'🏠'}</span><span class="ithRoomDirectoryTextV249431"><b>${esc(title)}</b>${professional?'<em class="ithProfessionalSpaceBadgeV249432">Επαγγελματικός χώρος</em>':''}<small>${esc(desc)}</small><span class="ithRoomCountsV249431">${roomCountLine431(x)}</span></span><span class="ithRoomGoV249431">›</span></button>`
  }).join(''):'<div class="card">Δεν υπάρχουν χώροι σε αυτή την κατηγορία.</div>'
}

async function renderSimpleSpaces422(){
  if(window.__ITHAKI_R10F15_SINGLE_COMMUNITY_RUNTIME__){const o=window.ITH||{},f=o.openCanonicalCommunitiesR10F15||window.openCanonicalCommunitiesR10F15||o.activateSpacesPageV249516||window.activateSpacesPageV249516;if(typeof f==='function')return f.call(o);const p=visualPage422('spaces');if(p&&!p.querySelector('[data-community-owner=\"r10f15\"]'))p.innerHTML='<div class=\"card\"><b>Φόρτωση κοινοτήτων…</b></div>';return false}
  closePlusMenu422('spaces');
  const s=core();
  if(s)s.page='spaces';
  spaceScreen431='directory';
  const p=visualPage422('spaces');
  if(!p)return false;
  p.innerHTML=simpleSpacesHtml422();
  try{
    let r;
    try{r=await api422(`/api/rooms/overview?room_id=${encodeURIComponent(s&&s.room||'ithaki-phone-test')}&device_id=${encodeURIComponent(s&&s.device||'')}&_v=${Date.now()}`)}
    catch(_e){r=await api422(`/api/rooms?room_id=${encodeURIComponent(s&&s.room||'ithaki-phone-test')}&_v=${Date.now()}`)}
    s.spaces=Array.isArray(r.rooms)?r.rooms:[];
    renderRoomListSimple422(s.spaces)
  }catch(e){
    const box=$('roomList');if(box)box.innerHTML='<div class="card">Οι χώροι δεν φόρτωσαν: '+esc(e.message||e)+'</div>'
  }
  cleanLocks422();
  diag('spaces-directory-open-v249431',{tab:spaceTab422,rooms:(s&&s.spaces||[]).length});
  return false
}

function simpleSpaceTab422(tab){
  spaceTab422=['rooms','communities','topics','sos'].includes(String(tab||''))?String(tab):'rooms';
  spaceScreen431='directory';
  const s=core();if(s)s.spaceTab=spaceTab422;
  return renderSimpleSpaces422()
}

async function openSpaceSimple422(id){
  const s=core(),rid=String(id||''),room=(s&&s.spaces||[]).find(x=>String(x.subroom_id||x.id||'')===rid)||{};
  if(!rid||!s)return false;
  try{
    let join_code='';
    if(String(room.access_type||'public')==='private_code')join_code=prompt('Κωδικός μέλους:')||'';
    await api422('/api/rooms/join',{method:'POST',body:JSON.stringify({room_id:s.room,subroom_id:rid,device_id:s.device,nickname:s.name,join_code})});
    s.currentSpace=rid;s.currentSpaceChannel='space:'+rid;spaceScreen431='chat';
    const p=visualPage422('spaces','space-chat-v249431');
    if(!p)return false;
    p.innerHTML=spaceChatHtml431(room);
    const sb=findSendButton422('spaceInput');if(sb){sb.dataset.v249429Send='space';sb.onclick=sendSpaceText422}
    await loadSpaceMessagesSimple422();
    cleanLocks422();
    diag('space-open-chat-v249431',{id:rid,channel:s.currentSpaceChannel,registered:Number(room.member_count||0),live:Number(room.live_count||0)});
    return false
  }catch(e){toast422('Δεν άνοιξε ο χώρος: '+String(e.message||e));diag('space-open-error',String(e.message||e));return false}
}
function route422(id,source){id=normalizePage427(id);const previous=normalizePage427(desiredPage427);stopPreviousPageBackgroundV249545(previous,id,'route-'+id);if(previous==='feed'&&id!=='feed')saveFeedPosition440('route-'+id);desiredPage427=id;routeEpoch427++;const epoch=routeEpoch427;closePlusMenu422('route-'+id);if(id!=='feed')removeRadicalFeed422(true);try{const mm=$('memberMenu');if(mm&&id!=='profile')mm.classList.remove('show','localPanel','legalPanel','themePanel')}catch(e){}visualPage422(id,'route-before-core');if(id==='feed')return openFeedSimple422(source);if(id==='dm'){const out=openDMSimple422(source);settleIsolation427(id,epoch,'route-dm');return out}if(id==='spaces'){const owner=window.ITH&&(ITH.activateSpacesPageV249516||ITH.renderSpacesV249516||ITH.renderSpaces);if(typeof owner==='function'&&owner!==renderSimpleSpaces422){const out=owner.call(window.ITH);settleIsolation427(id,epoch,'route-spaces-v249522-owner');return out}const out=window.__ITHAKI_R10F15_SINGLE_COMMUNITY_RUNTIME__?(typeof window.showCanonicalCommunityLoadingR10F2==='function'?window.showCanonicalCommunityLoadingR10F2():false):(window.__ITHAKI_R10F2_COMMUNITY_EXCLUSIVE__&&typeof window.showCanonicalCommunityLoadingR10F2==='function'?window.showCanonicalCommunityLoadingR10F2():renderSimpleSpaces422());settleIsolation427(id,epoch,'route-spaces-canonical-wait');return out}if(typeof CORE_PAGE!=='function'){diag('route-missing-core',{id,source:source||''});settleIsolation427(id,epoch,'route-no-core');return false}let out=false;try{out=CORE_PAGE.call(window.ITH||window,id)}catch(e){diag('route-core-error',{id,message:String(e.message||e)})}visualPage422(id,'route-after-core');settleIsolation427(id,epoch,'route');setTimeout(()=>{if(epoch!==routeEpoch427)return;ensureProfileExit422();if(id==='profile')cleanLocks422()},0);diag('route-single-owner',{id,source:source||'',previous,corePage:core()&&core().page,epoch});return out}

function ensureProfileExit422(){let b=$('ithProfileExitV249429');if(!b){b=document.createElement('button');b.id='ithProfileExitV249429';b.type='button';b.innerHTML='← <span>Αρχική</span>';b.setAttribute('aria-label','Έξοδος από το Προφίλ');document.body.appendChild(b)}const p=String((core()&&core().page)||document.body?.getAttribute('data-page')||'home');b.style.display=p==='profile'?'flex':'none';if(p==='profile'){const pp=$('profilePage');if(pp){pp.style.overflowY='auto';pp.scrollTop=Math.max(0,pp.scrollTop||0)}}return false}
function openOfflineMesh432(){closePlusMenu422('offline-mesh');const canonical=(window.ITH&&ITH.openCanonicalMeshV249526R10F1)||window.openCanonicalMeshV249526R10F1;if(typeof canonical==='function')return canonical();const f=(window.ITH&&ITH.openEmergencyNeighborhoodV249442)||window.openEmergencyNeighborhoodV249442;if(typeof f==='function'){try{return f.call(window.ITH||window)}catch(e){diag('offline-mesh-open-error',String(e.message||e))}}toast422('Η Γειτονιά & Ραντάρ απαιτεί το Android APK V249531.');return false}
function featureHome434(reason){try{return route422('home',reason||'feature-exit-v249434')}catch(e){try{document.body.dataset.page='home'}catch(_){ }return false}}
function closeLighthouse434(){try{$('lighthouseOverlayV249278')?.remove()}catch(e){}diag('lighthouse-exit-v249434');return featureHome434('lighthouse-exit-v249434')}
function closeBottle434(){try{$('bottleSeaOverlayV249274')?.remove()}catch(e){}diag('bottle-exit-v249434');return featureHome434('bottle-exit-v249434')}
function polishFeature434(kind){setTimeout(()=>{try{if(kind==='lighthouse'){const b=document.querySelector('#lighthouseOverlayV249278 .lighthouseTopBarV249278 button:first-child');if(b){b.textContent='‹';b.setAttribute('aria-label','Έξοδος');b.onclick=closeLighthouse434}}else if(kind==='bottle'){const b=document.querySelector('#bottleSeaOverlayV249274 .bottleSeaTopV249274 button');if(b){b.textContent='‹';b.setAttribute('aria-label','Έξοδος');b.title='Έξοδος';b.onclick=closeBottle434}}else if(kind==='wall'){const b=$('v411Close');if(b){b.textContent='‹';b.setAttribute('aria-label','Έξοδος')}}}catch(e){diag('feature-polish-error-v249434',{kind,message:String(e.message||e)})}},30);return false}
function openDirectWall434(){closePlusMenu422('direct-wall-v249434');const fn=(window.ITH&&ITH.openWallV411)||window.openWallV411||(window.ITH&&ITH.openAnonymousWallV411)||window.openAnonymousWallV411||(window.ITH&&ITH.openWall)||window.openWall;if(typeof fn==='function'){try{const out=fn.call(window.ITH||window);polishFeature434('wall');diag('direct-wall-open-v249434');return out}catch(e){diag('direct-wall-error-v249434',String(e.message||e))}}toast422('Ο Ανώνυμος Τοίχος δεν φόρτωσε.');return false}
function openNamedFeature433(kind){
  closePlusMenu422('feature-'+kind);
  if(kind==='wall')return openDirectWall434();
  const table={message_center:[(window.ITH&&ITH.openCommCenterV249280)||window.openCommCenterV249280,['groups']],lighthouse:[(window.ITH&&ITH.openLighthouseV249278)||window.openLighthouseV249278,[]],bottle:[(window.ITH&&ITH.openBottleSeaV249274)||window.openBottleSeaV249274,['compose']]};
  const item=table[kind]||[];if(typeof item[0]==='function'){try{const out=item[0].apply(window.ITH||window,item[1]||[]);if(kind==='lighthouse'||kind==='bottle')polishFeature434(kind);return out}catch(e){diag('plus-feature-error-v249434',{kind,message:String(e.message||e)})}}
  toast422('Η επιλογή δεν είναι διαθέσιμη σε αυτή τη συσκευή.');return false
}
function closeFriendPicker433(){const x=$('ithFriendPickerV249433');if(x)x.remove();friendPickerMode433='';return false}
async function openFriendPicker433(mode){closeFriendPicker433();friendPickerMode433=String(mode||'profile');const titles={profile:'👤 Διάλεξε φίλο για προφίλ',voice:'📞 Διάλεξε φίλο για φωνητική κλήση',video:'📹 Διάλεξε φίλο για βιντεοκλήση'};const x=document.createElement('div');x.id='ithFriendPickerV249433';x.innerHTML=`<section class="ithFriendPickerCardV249433"><div class="ithOverlayHeadV249433"><b>${esc(titles[friendPickerMode433]||titles.profile)}</b><button type="button" class="icon" onclick="ITH.closeFriendPickerV249433()">‹</button></div><div id="ithFriendPickerListV249433" class="ithFriendPickerListV249433"><div class="card">Φόρτωση φίλων…</div></div></section>`;x.addEventListener('click',e=>{if(e.target===x)closeFriendPicker433()});document.body.appendChild(x);try{const list=await loadServerFriends422(true),box=$('ithFriendPickerListV249433');box.innerHTML=list.length?list.map(p=>{const id=String(p.device_id||p.id||''),name=String(p.nickname||p.name||'Φίλος'),av=String(p.avatar||'');return `<button type="button" class="ithFriendPickRowV249433" data-v249433-friend="${esc(id)}"><span class="avatar">${av?`<img src="${esc(av)}" alt="">`:esc(name.slice(0,1))}</span><span><b>${esc(name)}</b><small>${p.online?'● Ενεργός τώρα':'Αποδεκτός φίλος'}</small></span><span>›</span></button>`}).join(''):'<div class="card">Δεν υπάρχουν ακόμη αποδεκτοί φίλοι.</div>';box.onclick=e=>{const b=e.target.closest('[data-v249433-friend]');if(b)selectFriendAction433(friendPickerMode433,String(b.dataset.v249433Friend||''))}}catch(e){const box=$('ithFriendPickerListV249433');if(box)box.innerHTML='<div class="card">Δεν φόρτωσαν οι φίλοι: '+esc(e.message||e)+'</div>'}return false}
async function selectFriendAction433(mode,peer){closeFriendPicker433();if(mode==='voice')return startCallGated422('voice',peer);if(mode==='video')return startCallGated422('video',peer);return openMemberGate422(peer,true)}
function postFor433(id){return feedLastPosts429.find(p=>String(p&&p.post_id||p&&p.id||'')===String(id||''))||null}
function shareText433(id){const p=postFor433(id),x=p?postPayload424(p):{body:''},body=cleanHumanText429(x.body||'').slice(0,700),name=String(p&&p.nickname||'Μέλος'),kind=p?postKind424(p):'post';return `📤 Κοινοποίηση από τη Ροή ΙΘΑΚΗΣ\n${name} · ${kind}${body?'\n'+body:''}\nhttps://ok-ithaki.gr/?post_id=${encodeURIComponent(String(id||''))}`}
function closeShare433(){const x=$('ithShareOverlayV249433');if(x)x.remove();activeSharePost433='';return false}
async function openSharePost433(postId){closeShare433();activeSharePost433=String(postId||'');const x=document.createElement('div');x.id='ithShareOverlayV249433';x.innerHTML=`<section class="ithShareCardV249433"><div class="ithOverlayHeadV249433"><b>📤 Κοινοποίηση δημοσίευσης</b><button type="button" class="icon" onclick="ITH.closeSharePostV249433()">‹</button></div><p>Στείλε τη δημοσίευση απευθείας σε φίλο μέσα στην ΙΘΑΚΗ ή χρησιμοποίησε εξωτερική κοινοποίηση.</p><button type="button" class="btn green ithExternalShareV249433" onclick="ITH.externalSharePostV249433()">↗ Εξωτερική κοινοποίηση</button><div class="ithShareLabelV249433">Φίλοι στην ΙΘΑΚΗ</div><div id="ithShareFriendsV249433" class="ithFriendPickerListV249433"><div class="card">Φόρτωση φίλων…</div></div></section>`;x.addEventListener('click',e=>{if(e.target===x)closeShare433()});document.body.appendChild(x);try{const list=await loadServerFriends422(true),box=$('ithShareFriendsV249433');box.innerHTML=list.length?list.map(p=>{const id=String(p.device_id||p.id||''),name=String(p.nickname||p.name||'Φίλος');return `<button type="button" class="ithFriendPickRowV249433" data-v249433-share-peer="${esc(id)}"><span class="avatar">${esc(name.slice(0,1))}</span><span><b>${esc(name)}</b><small>Αποστολή μέσα στην εφαρμογή</small></span><span>➤</span></button>`}).join(''):'<div class="card">Δεν υπάρχουν ακόμη αποδεκτοί φίλοι.</div>';box.onclick=e=>{const b=e.target.closest('[data-v249433-share-peer]');if(b)sharePostToFriend433(String(b.dataset.v249433SharePeer||''),b)}}catch(e){const box=$('ithShareFriendsV249433');if(box)box.innerHTML='<div class="card">Δεν φόρτωσαν οι φίλοι: '+esc(e.message||e)+'</div>'}return false}
async function sharePostToFriend433(peer,button){const s=core();if(!s||!peer||!activeSharePost433)return false;const oldPeer=s.activePeer,oldChannel=s.activeChannel;if(button){button.disabled=true;button.lastElementChild.textContent='…'}try{let fr=await canonicalFriend422(peer,true);if(!fr)throw new Error('Η επαφή δεν είναι πλέον αποδεκτός φίλος.');const channel=String(fr.channel||canonicalChannel422(s.device,peer));s.activePeer=peer;s.activeChannel=channel;await sendTextDirect422(channel,shareText433(activeSharePost433));if(button)button.lastElementChild.textContent='✓';toast422('Η δημοσίευση στάλθηκε στον φίλο μέσα στην ΙΘΑΚΗ.');setTimeout(closeShare433,650);return false}catch(e){toast422('Δεν στάλθηκε η κοινοποίηση: '+String(e.message||e),7000);if(button){button.disabled=false;button.lastElementChild.textContent='➤'}return false}finally{s.activePeer=oldPeer;s.activeChannel=oldChannel}}
async function externalSharePost433(){const p=postFor433(activeSharePost433),text=shareText433(activeSharePost433),url=p?mediaUrl424(p):'';try{if(url&&window.ITH&&typeof ITH.shareMediaFile==='function')return ITH.shareMediaFile(url,'','',postKind424(p));if(window.ITH&&typeof ITH.shareTextFileV249522==='function')return ITH.shareTextFileV249522(text,'ITHAKI_post_'+String(activeSharePost433||'share')+'.txt');if(navigator.share){await navigator.share({title:'OK ITHAKI',text});return false}await navigator.clipboard.writeText(text);toast422('Η κοινοποίηση αντιγράφηκε.')}catch(e){toast422('Δεν ολοκληρώθηκε η εξωτερική κοινοποίηση: '+String(e&&e.message||e))}return false}
function handlePlusAction422(a){a=String(a||'');closePlusMenu422(a);if(a==='messages')return route422('dm','plus-messages');if(a==='message_center'){const o=window.ITH||{},f=o.openExactNotificationMessageCenterButtonV249526||window.openExactNotificationMessageCenterButtonV249526||o.openExactNotificationMessageCenterButtonV249525||window.openExactNotificationMessageCenterButtonV249525||o.openExternalMessageCenterV249477;return typeof f==='function'?f.call(o):openNamedFeature433('message_center')}if(a==='friend_profile')return openFriendPicker433('profile');if(a==='friend_voice')return openFriendPicker433('voice');if(a==='friend_video')return openFriendPicker433('video');if(a==='offline')return openOfflineMesh432();if(a==='wall')return openNamedFeature433(a);if(a==='lighthouse'||a==='bottle')return false;if(a==='poll'){const d=destination422();if(d?.ctx==='space')return window.ITH?.openCommunityPollsV249516?.();return window.ITH&&ITH.openPoll&&ITH.openPoll();}if(a==='room')return route422('spaces','plus-room');if(a==='notify')return openNotifications422('plus');if(a==='qr')return window.ITH&&ITH.showQR&&ITH.showQR();if(a==='host')return window.ITH&&ITH.openHostContact&&ITH.openHostContact();if(a==='text'){const d=destination422();if(d?.ctx==='space'){closePlusMenu422('community-text');const input=$('spaceInput');input?.focus();toast422('Το κείμενο θα σταλεί μόνο στην επιλεγμένη Κοινότητα.');return false}return goCreate422('plus-text')}const dest=destination422();if(!dest){toast422('Διάλεξε πρώτα προορισμό.');return false}if(a==='camera_photo')return captureMedia422(dest.ctx,'photo',dest.target);if(a==='camera_video')return captureMedia422(dest.ctx,'video',dest.target);if(a==='audio')return window.ITH&&ITH.startAudioRecording&&ITH.startAudioRecording(dest.ctx,dest.target);if(a==='gallery_photo')return chooseFile422(dest.ctx,'photo',dest.target);if(a==='gallery_video')return chooseFile422(dest.ctx,'video',dest.target);return chooseFile422(dest.ctx,'file',dest.target)}

function openPlusMenu422(source){
  css();if(previewActive)return false;
  let sh=$('plusSheet');if(!sh){sh=document.createElement('div');sh.id='plusSheet';document.body.appendChild(sh)}
  if(sh.classList.contains('show')&&sh.classList.contains('ithPlusMenuV249429'))return closePlusMenu422('toggle');
  const d=destination422(),where=d?d.label:'';
  sh.className='plusSheet ithPlusMenuV249429 ithModernPlusV249433 show';
  sh.innerHTML=`<div class="ithPlusTitleV249429 ithPlusHeroV249433"><div><strong>＋ Κέντρο δημιουργίας & επικοινωνίας</strong><small>ΙΘΑΚΗ ${esc(where)}</small></div><button class="ithPlusCloseV249431" type="button" aria-label="Έξοδος" title="Έξοδος" onclick="ITH.closePlusMenuV249429('arrow')">‹</button></div><div class="ithPlusSectionV249433">Δημιουργία</div><button class="tile" data-v249429-act="camera_photo"><b>📷</b>Λήψη φωτογραφίας</button><button class="tile" data-v249429-act="camera_video"><b>🎥</b>Εγγραφή βίντεο</button><button class="tile" data-v249429-act="audio"><b>🎙️</b>Εγγραφή ήχου</button><button class="tile" data-v249429-act="file"><b>📎</b>Αρχείο</button><button class="tile" data-v249429-act="gallery_photo"><b>🖼️</b>Φωτογραφία</button><button class="tile" data-v249429-act="gallery_video"><b>📼</b>Βίντεο</button><button class="tile emphasis" data-v249429-act="text"><b>📝</b>Χρυσό κείμενο</button><button class="tile emphasis" data-v249429-act="poll"><b>📊</b>Ψηφοφορία</button><div class="ithPlusSectionV249433">Επικοινωνία</div><button class="tile glow" data-v249429-act="messages"><b>💬</b>Μηνύματα</button><button class="tile glow" data-v249429-act="message_center"><b>📡</b>Κέντρο μηνυμάτων</button><button class="tile" data-v249429-act="friend_profile"><b>👤</b>Προφίλ φίλου</button><button class="tile" data-v249429-act="friend_voice"><b>📞</b>Φωνητική κλήση</button><button class="tile" data-v249429-act="friend_video"><b>📹</b>Βιντεοκλήση</button><button class="tile" data-v249429-act="offline"><b>🛜</b>Χωρίς internet<small>Γειτονιά · Mesh</small></button><div class="ithPlusSectionV249433">Χώροι ΙΘΑΚΗΣ</div><button class="tile special" data-v249429-act="wall"><b>🕊️</b>Ανώνυμος Τοίχος</button><button class="tile" data-v249429-act="room"><b>🏘️</b>Δωμάτια / Κοινότητες</button><button class="tile" data-v249429-act="notify"><b>🔔</b>Ειδοποιήσεις</button><button class="tile" data-v249429-act="qr"><b>▦</b>QR</button><button class="tile" data-v249429-act="host"><b>🌊</b>Οικοδεσπότης</button>`;
  sh.onclick=null;diag('plus-open-r10f20',{source:source||'',items:19,modern:true,communityScoped:d?.ctx==='space',messageCenter:true,lighthouse:false,bottle:false,wall:true});return false
}
function openStudio422(){const s=core(),p=s&&s.preview;if(!p||!['feed','story'].includes(String(p.ctx||''))||!['video','photo'].includes(p.kind)){toast422('Το Studio είναι διαθέσιμο για κανονική φωτογραφία, βίντεο και Story.');return false}if(typeof CORE_STUDIO_OPEN!=='function'){toast422('Το Studio δεν είναι διαθέσιμο.');return false}diag('studio-open',{kind:p.kind});return CORE_STUDIO_OPEN.call(window.ITH||window)}
async function sendPreview422(){const s=core(),p=s&&s.preview;if(!p||!p.file){toast422('Δεν υπάρχει επιλεγμένο αρχείο.');return false}if(sendInFlight||s.sending)return false;const fn=p.ctx==='feed'?CORE_SEND:(COMM_SEND||CORE_SEND);if(typeof fn!=='function'){toast422('Δεν βρέθηκε ο μηχανισμός αποστολής.');return false}sendInFlight=true;const b=$('previewSend'),t=$('progressText'),attemptStarted=Date.now();if(b){b.disabled=true;b.textContent='Ξεκινά η αποστολή...'}if(t)t.textContent='Προετοιμασία αποστολής · '+mb(p.file.size);diag('send-start',{ctx:p.ctx,kind:p.kind,name:p.file.name,size:p.file.size});await new Promise(r=>requestAnimationFrame(()=>r()));try{const cap=String($('previewCaption')?.value||'').trim();if(cap){const chk=await api422('/api/safety/text_check_v249545',{method:'POST',body:JSON.stringify({text:cap,context:'publication_caption'})});if(chk&&chk.blocked)throw Error(chk.message||'Το κείμενο χρειάζεται έλεγχο ασφαλείας.')}const out=await Promise.resolve(fn.call(window.ITH||window));const proof=window.__ITHAKI_LAST_PUBLICATION_V249506__||null,confirmed=out===true||!!(p.ctx==='feed'&&proof&&proof.confirmed===true&&Number(proof.at||0)>=attemptStarted);diag('send-return',{previewOpen:!!$('previewModal')?.classList.contains('show'),sending:!!s.sending,confirmed:confirmed,postId:proof&&proof.post_id||'',error:proof&&proof.error||''});if(p.ctx==='feed'&&!confirmed){const exact=String(proof&&proof.error||'Η δημοσίευση δεν επιβεβαιώθηκε από τον server.');if(b){b.disabled=false;b.textContent='Επανάληψη αποστολής'}if(t)t.textContent=exact;toast422(exact,7000);return false}if(p.ctx==='feed'){try{localStorage.setItem('ith_feed_category_v249429','all');localStorage.removeItem('ith_feed_selected_keyword_v249429');const q=$('ithFeedSearchInputV249429');if(q)q.value=''}catch(e){}setTimeout(()=>{desiredPage427='feed';openFeedSimple422('post-send-v249474');try{window.dispatchEvent(new CustomEvent('ithaki:publication-sent',{detail:{ctx:'feed'}}))}catch(e){}},80);}else if(p.ctx==='dm')setTimeout(()=>{visualPage422('dm');cleanLocks422()},40);else if(p.ctx==='space')setTimeout(()=>{visualPage422('spaces');cleanLocks422()},40);return out}catch(e){diag('send-error',String(e&&e.message||e));toast422('Αποτυχία αποστολής: '+String(e&&e.message||e),7000);if(b){b.disabled=false;b.textContent='Επανάληψη αποστολής'}if(t)t.textContent=String(e&&e.message||e);return false}finally{sendInFlight=false;if($('previewModal')?.classList.contains('show')&&!s.sending&&b){b.disabled=false;if(b.textContent==='Ξεκινά η αποστολή...')b.textContent='Αποστολή / Δημοσίευση'}}}
function captureNavigation422(ev){const target=ev.target&&ev.target.closest?ev.target:null;if(!target)return;const memberAction=target.closest('[data-v249429-member-action]');if(memberAction){ev.preventDefault();ev.stopPropagation();ev.stopImmediatePropagation();return memberAction422(memberAction)}const securityLock=target.closest('#ithOnlyEncryptionLockV249429');if(securityLock){ev.preventDefault();ev.stopPropagation();ev.stopImmediatePropagation();return openEncryptionChoice422()}const friend=target.closest('[data-v249429-peer]');if(friend){ev.preventDefault();ev.stopPropagation();ev.stopImmediatePropagation();return startDMGated422(String(friend.dataset.v249429Peer||''))}const room=target.closest('[data-v249429-room]');if(room){ev.preventDefault();ev.stopPropagation();ev.stopImmediatePropagation();return openSpaceSimple422(String(room.dataset.v249429Room||''))}const send=target.closest('[data-v249429-send]');if(send){ev.preventDefault();ev.stopPropagation();ev.stopImmediatePropagation();return send.dataset.v249429Send==='space'?sendSpaceText422():sendDMText422()}const plusAction=target.closest('#plusSheet [data-v249429-act]');if(plusAction){ev.preventDefault();ev.stopPropagation();ev.stopImmediatePropagation();return handlePlusAction422(plusAction.dataset.v249429Act)}const nav=target.closest('#nav button[data-page]');if(nav){ev.preventDefault();ev.stopPropagation();ev.stopImmediatePropagation();const id=String(nav.dataset.page||'home');return id==='plus'?openPlusMenu422('nav'):route422(id,'nav')}const exit=target.closest('#ithProfileExitV249429,#profilePage .cleanBackBtn');if(exit){ev.preventDefault();ev.stopPropagation();ev.stopImmediatePropagation();return route422('home','profile-exit')}const logo=target.closest('.logoText');if(logo){ev.preventDefault();ev.stopPropagation();ev.stopImmediatePropagation();return route422('profile','logo')}const homePub=target.closest('#homePage button.tile');if(homePub&&/Δημοσίευση|Post/i.test(String(homePub.textContent||''))){ev.preventDefault();ev.stopPropagation();ev.stopImmediatePropagation();return route422('create','home-publish')}}
function captureFileClick(ev){const el=ev.target&&ev.target.closest&&ev.target.closest('[data-act],[onclick],[data-ithaki-file-action]');if(!el)return;const act=String(el.dataset&&el.dataset.act||''),on=String(el.getAttribute&&el.getAttribute('onclick')||'');if(!(/chooseFile\s*\(|captureMedia\s*\(/.test(on)||/^(gallery_|camera_|upload_file|upload_photo|upload_video|file_picker)/i.test(act)))return;if(/audio|record|ηχο|🎙/i.test(act+' '+on)&&!/chooseFile\s*\([^)]*audio/i.test(on))return;ev.preventDefault();ev.stopPropagation();ev.stopImmediatePropagation();const hint=/video|βίντεο|🎥|📹/i.test(act+' '+on)?'video':/photo|image|φωτο|📷|🖼/i.test(act+' '+on)?'photo':'file';const ctx=inferCtx();return(/camera_|captureMedia/.test(act+' '+on))?captureMedia422(ctx,hint,''):chooseFile422(ctx,hint,'')}
function captureLegacyChange(ev){const t=ev.target;if(!t||t.tagName!=='INPUT'||String(t.type).toLowerCase()!=='file'||t.id==='ithFileInputV249429')return;if(t.id!=='globalFile')return;const f=t.files&&t.files[0];if(!f)return;ev.preventDefault();ev.stopPropagation();ev.stopImmediatePropagation();openPreview422(inferCtx(),f,kindOf(f,t.accept&&t.accept.includes('video')?'video':t.accept&&t.accept.includes('image')?'photo':'file'),'')}

/* BEGIN V249433_COMMENTS_INTERNAL_SHARE_POLLS_MODERN_PLUS */
let activeMessageTab430='contacts',activeCommentPost430='',activeCommentReply430='',messageTabsRender430=0,goldTextOpen430=0,goldTextSent430=0,commentsLoaded430=0;
let pollMap433=new Map(),ithakiPacedHidden433=0,activeSharePost433='',friendPickerMode433='';
function css430(){if($('ithV249430Css'))return;const st=document.createElement('style');st.id='ithV249430Css';st.textContent=`
#feedPage .ithFeedMediaV249429{inset:0 52px 0 0!important;background:#000!important}
#feedPage .ithFeedMediaV249429 video,#feedPage .ithFeedMediaV249429 img{width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;object-fit:contain!important;object-position:center center!important;background:#000!important}
#feedPage .ithFeedMetaV249429{left:10px!important;right:62px!important;bottom:10px!important;padding:9px 12px!important;border-radius:15px!important;background:linear-gradient(90deg,rgba(0,0,0,.62),rgba(0,0,0,.12))!important;border:1px solid rgba(255,255,255,.10)!important;backdrop-filter:blur(8px)!important;-webkit-backdrop-filter:blur(8px)!important}
#feedPage .ithFeedCaptionV249430{display:-webkit-box!important;-webkit-line-clamp:2!important;-webkit-box-orient:vertical!important;overflow:hidden!important;line-height:1.28!important;font-size:clamp(14px,2.6vw,19px)!important;color:#fff!important;font-weight:720!important;text-align:left!important}
#feedPage .ithFeedDateV249430{display:block!important;margin-top:4px!important;color:rgba(255,255,255,.76)!important;font-size:11px!important;text-align:left!important}
#feedPage .ithFeedSideV249429{right:4px!important;gap:6px!important;padding:6px 3px!important;background:rgba(1,6,12,.42)!important}
#feedPage .ithFeedSideV249429 button{width:42px!important;height:42px!important;min-width:42px!important;min-height:42px!important}
#feedPage .ithFeedAvatarButtonV249430{overflow:hidden!important;border:2px solid rgba(255,215,105,.82)!important;background:transparent!important;filter:none!important;opacity:1!important;visibility:visible!important;padding:0!important}
#feedPage .ithFeedAvatarButtonV249430 img{display:block!important;width:100%!important;height:100%!important;object-fit:cover!important;border-radius:50%!important;background:transparent!important;filter:none!important;opacity:1!important;visibility:visible!important;mix-blend-mode:normal!important}
#feedPage .ithFeedAvatarFallbackV249430{font-size:16px!important;font-weight:1000!important;color:#ffe39a!important}
#feedPage .ithGoldenCardV249430{position:relative!important;width:min(780px,calc(100vw - 76px))!important;max-height:calc(100dvh - var(--bar,72px) - 30px)!important;overflow:auto!important;padding:clamp(28px,5vw,58px)!important;border-radius:31px!important;border:1px solid rgba(255,221,129,.66)!important;background:radial-gradient(circle at 50% 4%,rgba(255,222,128,.31),rgba(77,55,10,.94) 38%,rgba(13,11,6,.98) 100%)!important;box-shadow:0 28px 90px rgba(0,0,0,.58),inset 0 0 44px rgba(255,211,90,.08)!important;color:#ffe7a0!important;text-align:center!important}
#feedPage .ithGoldenCardV249430 .ithFeedMainTextV249429{color:#ffe7a0!important;font-size:clamp(24px,5.6vw,46px)!important;font-weight:900!important;line-height:1.28!important;text-shadow:0 2px 10px rgba(0,0,0,.72)!important}
#feedPage .ithGoldenLogoV249430 img{width:74px!important;height:74px!important;object-fit:contain!important;margin-bottom:15px!important;filter:drop-shadow(0 8px 16px rgba(0,0,0,.44))!important}
#feedPage .ithGoldenDateV249430{display:block!important;margin-top:18px!important;color:rgba(255,235,176,.72)!important;font-size:12px!important}
#feedPage .ithGoldenCardV249430 a{color:#fff1bb!important}
#ithFeedCommentsV249430{position:fixed!important;inset:0!important;z-index:2147482500!important;display:flex!important;align-items:flex-end!important;justify-content:center!important;background:rgba(0,0,0,.38)!important;backdrop-filter:blur(5px)!important;-webkit-backdrop-filter:blur(5px)!important}
#ithFeedCommentsV249430 .ithCommentsSheetV249430{width:min(780px,100%)!important;max-height:min(78dvh,760px)!important;display:flex!important;flex-direction:column!important;border-radius:28px 28px 0 0!important;border:1px solid rgba(255,215,105,.42)!important;background:rgba(5,12,20,.92)!important;box-shadow:0 -24px 80px rgba(0,0,0,.6)!important;overflow:hidden!important}
#ithFeedCommentsV249430 .ithCommentsHeadV249430{display:flex!important;align-items:center!important;gap:8px!important;padding:12px 14px!important;border-bottom:1px solid rgba(255,255,255,.11)!important;color:#ffe49b!important}
#ithFeedCommentsV249430 .ithCommentsListV249430{overflow:auto!important;padding:10px 12px!important;display:flex!important;flex-direction:column!important;gap:8px!important}
#ithFeedCommentsV249430 .ithCommentV249430{padding:10px 12px!important;border-radius:16px!important;background:rgba(255,255,255,.07)!important;border:1px solid rgba(255,255,255,.09)!important;color:#fff!important}
#ithFeedCommentsV249430 .ithCommentV249430.reply{margin-left:28px!important;background:rgba(255,215,105,.08)!important;border-color:rgba(255,215,105,.24)!important}
#ithFeedCommentsV249430 .ithCommentNoV249430{color:#ffd96e!important;font-weight:1000!important;margin-right:7px!important}
#ithFeedCommentsV249430 .ithCommentTextV249430{white-space:pre-wrap!important;overflow-wrap:anywhere!important;margin:7px 0!important}
#ithFeedCommentsV249430 .ithReplyBarV249430{padding:7px 12px!important;color:#ffe49b!important;background:rgba(255,215,105,.08)!important}
#ithFeedCommentsV249430 .ithCommentComposerV249430{display:flex!important;gap:7px!important;padding:10px!important;border-top:1px solid rgba(255,255,255,.11)!important}
#ithFeedCommentsV249430 textarea{flex:1!important;min-height:48px!important;max-height:120px!important;resize:vertical!important}
#ithGoldTextComposerV249430{height:100%!important;overflow:auto!important;padding:14px 14px calc(var(--bar,72px) + 20px)!important;background:radial-gradient(circle at 50% 0,#47370e,#07111d 62%,#02070d)!important}
#ithGoldTextComposerV249430 .ithGoldComposerCardV249430{max-width:820px!important;margin:0 auto!important}
#ithGoldTextComposerV249430 textarea{width:100%!important;min-height:170px!important;resize:vertical!important;font-size:18px!important}
#ithGoldTextPreviewV249430{min-height:210px!important;margin:12px 0!important;display:grid!important;place-items:center!important}
#ithGoldTextPreviewV249430 .ithFeedMainTextV249429{font-size:clamp(24px,5vw,42px)!important}
#dmPage .ithMessageTabsV249430{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:6px!important;padding:8px 0 10px!important;position:sticky!important;top:0!important;z-index:40!important;background:rgba(4,13,22,.90)!important;backdrop-filter:blur(10px)!important}
#dmPage .ithMessageTabV249430{min-height:42px!important;padding:7px 5px!important;border-radius:14px!important;border:1px solid rgba(255,255,255,.12)!important;background:rgba(255,255,255,.06)!important;color:#dcecff!important;font-size:12px!important;font-weight:850!important}
#dmPage .ithMessageTabV249430.active{background:rgba(255,215,105,.20)!important;border-color:rgba(255,215,105,.54)!important;color:#ffe49b!important}
#dmPage .ithGroupRowV249430{width:100%!important;text-align:left!important;display:flex!important;align-items:center!important;gap:10px!important;padding:12px!important;border-radius:18px!important;background:rgba(255,255,255,.06)!important;border:1px solid rgba(255,255,255,.1)!important}
@media(max-width:600px){#feedPage .ithFeedMediaV249429{inset:0 48px 0 0!important}#feedPage .ithFeedMetaV249429{right:56px!important}#dmPage .ithMessageTabV249430{font-size:10px!important;padding:6px 7px!important}}
#ithFeedCommentsV249430{align-items:flex-start!important;padding:max(7px,env(safe-area-inset-top)) 7px calc(var(--bar,72px) + 7px)!important}
#ithFeedCommentsV249430 .ithCommentsSheetV249430{height:calc(100dvh - var(--bar,72px) - max(14px,env(safe-area-inset-top)))!important;max-height:none!important;border-radius:24px!important}
#ithFeedCommentsV249430 .ithCommentsListV249430{flex:1 1 auto!important;min-height:0!important;padding-bottom:18px!important}
#ithFeedCommentsV249430 .ithCommentComposerV249430{flex:0 0 auto!important;background:rgba(4,12,20,.98)!important}
#ithFeedCommentsV249430 .ithCommentV249430 button{min-height:35px!important}
#plusSheet.ithPlusMenuV249429 .ithPlusTitleV249429{display:flex!important;align-items:center!important;justify-content:center!important;position:relative!important;min-height:46px!important;padding-right:54px!important}
#plusSheet .ithPlusCloseV249431{position:absolute!important;right:2px!important;top:0!important;width:46px!important;height:42px!important;border-radius:14px!important;border:1px solid rgba(255,215,105,.42)!important;background:rgba(255,215,105,.10)!important;color:#ffe49b!important;font-size:28px!important;font-weight:1000!important}
#dmPage .ithMessageTabsV249430{display:flex!important;grid-template-columns:none!important;overflow-x:auto!important;overflow-y:hidden!important;scrollbar-width:none!important;gap:7px!important}
#dmPage .ithMessageTabsV249430::-webkit-scrollbar{display:none!important}
#dmPage .ithMessageTabV249430{flex:0 0 auto!important;min-width:126px!important;padding:7px 10px!important}
#dmPage .ithMessageTabV249430.addGroup{border-color:rgba(54,240,160,.50)!important;color:#bfffe0!important}
#ithGroupCreatorV249431{position:fixed!important;inset:0!important;z-index:2147483000!important;display:flex!important;align-items:flex-start!important;justify-content:center!important;padding:max(10px,env(safe-area-inset-top)) 8px calc(var(--bar,72px) + 8px)!important;background:rgba(0,0,0,.62)!important;backdrop-filter:blur(7px)!important}
#ithGroupCreatorV249431 .ithGroupCreatorCardV249431{width:min(720px,100%)!important;max-height:100%!important;overflow:auto!important;border-radius:24px!important;padding:14px!important;background:rgba(5,14,24,.98)!important;border:1px solid rgba(54,240,160,.36)!important;box-shadow:0 28px 90px rgba(0,0,0,.66)!important}
.ithGroupCreatorHeadV249431{display:flex!important;align-items:center!important;justify-content:space-between!important;margin-bottom:10px!important}
.ithGroupCreatorCardV249431 label{display:grid!important;gap:6px!important;margin:9px 0!important}
.ithGroupCreatorCardV249431 input[type="text"],.ithGroupCreatorCardV249431 input:not([type]),.ithGroupCreatorCardV249431 textarea{width:100%!important}
.ithGroupMemberChoicesV249431{display:grid!important;gap:7px!important;max-height:42dvh!important;overflow:auto!important}
.ithGroupMemberChoiceV249431{display:grid!important;grid-template-columns:auto auto 1fr!important;align-items:center!important;gap:9px!important;padding:9px!important;border-radius:15px!important;background:rgba(255,255,255,.055)!important;border:1px solid rgba(255,255,255,.09)!important}
.ithGroupMemberChoiceV249431 .avatar{width:38px!important;height:38px!important;display:grid!important;place-items:center!important;border-radius:50%!important;background:rgba(255,215,105,.13)!important}
.ithGroupMemberChoiceV249431 small{display:block!important;color:rgba(255,255,255,.65)!important}
.ithGroupCreatorActionsV249431{display:flex!important;gap:8px!important;flex-wrap:wrap!important;margin-top:12px!important}
#spacesPage{padding:0 8px calc(var(--bar,72px) + 8px)!important;overflow:hidden!important}
#spacesPage .ithSpacesDirectoryV249431{height:100%!important;display:grid!important;grid-template-rows:auto auto auto 1fr!important;gap:8px!important;min-height:0!important}
.ithSpacesDirectoryHeadV249431{display:grid!important;grid-template-columns:auto 1fr auto auto!important;align-items:center!important;gap:10px!important;padding:10px 4px 4px!important}
.ithSpacesDirectoryHeadV249431 small{display:block!important;color:rgba(255,255,255,.65)!important;margin-top:3px!important}
.ithSpaceTabsV249431{display:flex!important;gap:7px!important;overflow-x:auto!important;scrollbar-width:none!important;padding:2px 0 8px!important}
.ithSpaceTabsV249431::-webkit-scrollbar{display:none!important}
.ithSpaceTabV249431{flex:0 0 auto!important;min-height:43px!important;padding:8px 12px!important;border-radius:14px!important;border:1px solid rgba(255,255,255,.11)!important;background:rgba(255,255,255,.055)!important;color:#dcecff!important;font-weight:850!important}
.ithSpaceTabV249431.active{border-color:rgba(255,215,105,.56)!important;background:rgba(255,215,105,.16)!important;color:#ffe49b!important}
#spacesPage .ithRoomDirectoryListV249431{min-height:0!important;max-height:none!important;overflow:auto!important;display:grid!important;align-content:start!important;gap:8px!important;padding:0 1px 12px!important}
.ithRoomDirectoryCardV249431{width:100%!important;display:grid!important;grid-template-columns:auto 1fr auto!important;align-items:center!important;gap:11px!important;text-align:left!important;padding:13px!important;border-radius:19px!important;border:1px solid rgba(255,255,255,.10)!important;background:linear-gradient(145deg,rgba(16,31,47,.94),rgba(5,12,20,.96))!important;color:#fff!important}
.ithRoomIconV249431{width:46px!important;height:46px!important;display:grid!important;place-items:center!important;border-radius:15px!important;background:rgba(255,215,105,.12)!important;font-size:24px!important}
.ithRoomDirectoryTextV249431{min-width:0!important}.ithRoomDirectoryTextV249431>b{display:block!important;font-size:16px!important}.ithRoomDirectoryTextV249431>small{display:block!important;color:rgba(255,255,255,.66)!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;margin:3px 0 6px!important}
.ithRoomCountsV249431{font-size:12px!important;color:#d8e5f1!important}.ithRoomLiveV249431{color:#63ee9e!important;font-weight:900!important}.ithRoomGoV249431{font-size:30px!important;color:#ffe49b!important}
#spacesPage .ithSpaceChatScreenV249431{height:100%!important;min-height:0!important;display:grid!important;grid-template-rows:auto auto 1fr auto!important;gap:6px!important}
.ithSpaceChatTopV249431{display:grid!important;grid-template-columns:auto 1fr auto!important;align-items:center!important;gap:9px!important;padding:8px 2px!important;border-bottom:1px solid rgba(255,255,255,.09)!important}
.ithSpaceChatTitleV249431{min-width:0!important}.ithSpaceChatTitleV249431>b{display:block!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}.ithSpaceChatTitleV249431 small{display:block!important;color:rgba(255,255,255,.66)!important;margin-top:3px!important}
#spacesPage .ithSpaceChatScreenV249431 #spaceMsgs{min-height:0!important;overflow:auto!important;padding:7px 3px!important}

#memberMenu.memberMenu.show{position:fixed!important;z-index:2147483050!important;pointer-events:auto!important}
.ithCommentComposerVisibleV249432{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;align-items:stretch!important;position:sticky!important;top:53px!important;z-index:30!important;background:rgba(4,12,20,.99)!important;padding:10px 11px!important;box-shadow:0 10px 26px rgba(0,0,0,.36)!important}
.ithCommentComposerVisibleV249432 textarea{display:block!important;visibility:visible!important;opacity:1!important;width:100%!important;min-width:0!important;min-height:58px!important;max-height:130px!important;color:#fff!important;background:#0b1825!important;border:1px solid rgba(255,217,110,.45)!important;border-radius:14px!important;padding:10px 12px!important;font-size:16px!important;line-height:1.35!important}
.ithCommentComposerVisibleV249432 .btn{min-width:105px!important;white-space:nowrap!important}.ithCommentReplyButtonV249432{border-color:rgba(255,217,110,.45)!important;color:#ffe39a!important}
#dmPage #dmGroupCreateBtnV249282,#dmPage #dmGroupsSectionV249282{display:none!important;visibility:hidden!important;pointer-events:none!important}
.ithSpaceCreateHintV249432{padding:7px 10px!important;border-radius:13px!important;background:rgba(255,215,105,.08)!important;color:#ffe39a!important;font-size:12px!important;font-weight:850!important}.ithSpaceCreateButtonV249432{color:#60f0ac!important;border-color:rgba(96,240,172,.35)!important}.ithProfessionalSpaceBadgeV249432{display:inline-flex!important;width:max-content!important;margin:3px 0 2px!important;padding:3px 7px!important;border-radius:999px!important;background:rgba(255,215,105,.13)!important;color:#ffd96e!important;font-size:11px!important;font-style:normal!important;font-weight:950!important}.ithRoomDirectoryCardV249431.professional{border-color:rgba(255,215,105,.34)!important}
#ithCreateSpaceV249432{position:fixed!important;inset:0!important;z-index:2147483100!important;display:flex!important;align-items:flex-start!important;justify-content:center!important;padding:max(10px,env(safe-area-inset-top)) 8px calc(var(--bar,72px) + 8px)!important;background:rgba(0,0,0,.67)!important;backdrop-filter:blur(8px)!important}.ithCreateSpaceCardV249432{width:min(720px,100%)!important;max-height:100%!important;overflow:auto!important;display:grid!important;gap:10px!important;padding:14px!important;border-radius:24px!important;background:rgba(5,14,24,.99)!important;border:1px solid rgba(96,240,172,.38)!important;box-shadow:0 28px 90px rgba(0,0,0,.68)!important}.ithCreateSpaceHeadV249432{display:grid!important;grid-template-columns:auto 1fr!important;gap:9px!important;align-items:center!important}.ithCreateSpaceHeadV249432 small{display:block!important;color:rgba(255,255,255,.65)!important}.ithCreateSpaceCardV249432 label{display:grid!important;gap:6px!important;font-weight:850!important}.ithCreateSpaceCardV249432 input,.ithCreateSpaceCardV249432 textarea,.ithCreateSpaceCardV249432 select{width:100%!important;color:#fff!important;background:#0a1724!important;border:1px solid rgba(255,255,255,.17)!important;border-radius:14px!important;padding:10px 11px!important}.ithCreateSpaceCardV249432 textarea{min-height:96px!important;resize:vertical!important}.ithCreateSpaceActionsV249432{display:flex!important;gap:8px!important;flex-wrap:wrap!important}
#spacesPage .ithSpaceChatScreenV249431 .composer{position:relative!important;left:auto!important;right:auto!important;bottom:auto!important;margin:0!important;padding:7px 0 max(5px,env(safe-area-inset-bottom))!important;background:rgba(4,12,20,.95)!important}

/* V249433: editable comment form, full polls, modern plus, friend/share overlays */
#ithFeedCommentsV249430{pointer-events:auto!important;touch-action:manipulation!important}
#ithFeedCommentsV249430 .ithCommentsSheetV249430{display:grid!important;grid-template-rows:auto minmax(0,1fr) auto auto!important;overflow:hidden!important;position:relative!important;pointer-events:auto!important}
#ithFeedCommentsV249430 .ithCommentComposerVisibleV249432{position:relative!important;top:auto!important;left:auto!important;right:auto!important;z-index:80!important;display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;order:0!important;pointer-events:auto!important;background:#071522!important;border-bottom:1px solid rgba(255,217,110,.28)!important;border-top:0!important;box-shadow:none!important}
#ithFeedCommentsV249430 #ithCommentInputV249430{position:relative!important;display:block!important;pointer-events:auto!important;touch-action:auto!important;user-select:text!important;-webkit-user-select:text!important;caret-color:#ffd96e!important;overflow:auto!important;resize:vertical!important;z-index:81!important}
#ithFeedCommentsV249430 #ithCommentInputV249430:focus{outline:2px solid rgba(255,217,110,.72)!important;outline-offset:1px!important}
#ithFeedCommentsV249430 .ithCommentsListV249430{min-height:0!important;overscroll-behavior:contain!important}
#feedPage .ithPollFullV249433{display:grid!important;gap:13px!important;width:100%!important}
#feedPage .ithPollBadgeV249433{font-size:12px!important;letter-spacing:.14em!important;font-weight:1000!important;color:#2b1900!important;background:#ffd96e!important;width:max-content!important;margin:0 auto!important;padding:6px 11px!important;border-radius:999px!important}
#feedPage .ithPollQuestionV249433{font-size:clamp(22px,4.8vw,39px)!important;line-height:1.25!important;color:#fff0b8!important;font-weight:950!important}
#feedPage .ithPollChoicesV249433{display:grid!important;gap:9px!important;width:100%!important}
#feedPage .ithPollChoiceV249433{position:relative!important;overflow:hidden!important;display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:8px!important;align-items:center!important;width:100%!important;min-height:50px!important;padding:10px 13px!important;border-radius:16px!important;border:1px solid rgba(255,229,155,.38)!important;background:rgba(7,15,24,.72)!important;color:#fff!important;text-align:left!important}
#feedPage .ithPollChoiceV249433 i{position:absolute!important;inset:0 auto 0 0!important;background:linear-gradient(90deg,rgba(255,208,76,.34),rgba(255,229,155,.08))!important;pointer-events:none!important}
#feedPage .ithPollChoiceV249433 span,#feedPage .ithPollChoiceV249433 b{position:relative!important;z-index:2!important}#feedPage .ithPollChoiceV249433 b{color:#ffe59a!important;font-size:12px!important;white-space:nowrap!important}
#feedPage .ithPollTotalV249433{font-size:12px!important;color:rgba(255,239,190,.78)!important}
#plusSheet.ithModernPlusV249433{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:10px!important;width:min(920px,96vw)!important;max-height:min(82dvh,820px)!important;padding:16px!important;border-radius:30px!important;background:radial-gradient(circle at 50% -10%,rgba(255,214,98,.23),transparent 34%),linear-gradient(155deg,rgba(7,22,37,.99),rgba(3,8,16,.995))!important;border:1px solid rgba(255,220,120,.48)!important;box-shadow:0 35px 110px rgba(0,0,0,.82),inset 0 0 38px rgba(78,187,255,.06)!important}
#plusSheet.ithModernPlusV249433 .ithPlusHeroV249433{grid-column:1/-1!important;min-height:64px!important;justify-content:flex-start!important;text-align:left!important;padding:8px 60px 10px 12px!important;border-radius:20px!important;background:linear-gradient(90deg,rgba(255,214,98,.18),rgba(79,180,255,.09))!important}
.ithPlusHeroV249433 strong{display:block!important;color:#fff0b8!important;font-size:18px!important}.ithPlusHeroV249433 small{display:block!important;color:rgba(255,255,255,.64)!important;margin-top:3px!important}
#plusSheet .ithPlusSectionV249433{grid-column:1/-1!important;padding:7px 3px 2px!important;color:#ffe49b!important;font-size:11px!important;font-weight:1000!important;letter-spacing:.13em!important;text-transform:uppercase!important}
#plusSheet.ithModernPlusV249433 .tile{min-height:94px!important;border-radius:19px!important;border:1px solid rgba(255,255,255,.11)!important;background:linear-gradient(145deg,rgba(22,43,63,.92),rgba(6,15,25,.96))!important;box-shadow:0 10px 24px rgba(0,0,0,.28)!important;transition:transform .15s ease,border-color .15s ease!important}
#plusSheet.ithModernPlusV249433 .tile:active{transform:scale(.96)!important}#plusSheet.ithModernPlusV249433 .tile.emphasis{border-color:rgba(255,217,110,.44)!important;background:linear-gradient(145deg,rgba(94,68,13,.82),rgba(20,16,8,.97))!important}#plusSheet.ithModernPlusV249433 .tile.glow{border-color:rgba(87,220,255,.44)!important;background:linear-gradient(145deg,rgba(12,73,96,.76),rgba(4,20,31,.98))!important}#plusSheet.ithModernPlusV249433 .tile.special{border-color:rgba(190,155,255,.38)!important;background:linear-gradient(145deg,rgba(50,35,92,.78),rgba(12,10,28,.98))!important}
#ithFriendPickerV249433,#ithShareOverlayV249433{position:fixed!important;inset:0!important;z-index:2147483400!important;display:flex!important;align-items:flex-start!important;justify-content:center!important;padding:max(12px,env(safe-area-inset-top)) 8px calc(var(--bar,72px) + 10px)!important;background:rgba(0,0,0,.72)!important;backdrop-filter:blur(9px)!important}
.ithFriendPickerCardV249433,.ithShareCardV249433{width:min(680px,100%)!important;max-height:100%!important;overflow:auto!important;padding:14px!important;border-radius:25px!important;background:linear-gradient(155deg,rgba(8,24,39,.995),rgba(3,10,18,.995))!important;border:1px solid rgba(255,217,110,.42)!important;box-shadow:0 28px 90px rgba(0,0,0,.72)!important;color:#fff!important}
.ithOverlayHeadV249433{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:8px!important;padding-bottom:10px!important;color:#ffe49b!important}.ithFriendPickerListV249433{display:grid!important;gap:8px!important;max-height:65dvh!important;overflow:auto!important}.ithFriendPickRowV249433{display:grid!important;grid-template-columns:auto minmax(0,1fr) auto!important;align-items:center!important;gap:10px!important;width:100%!important;padding:11px!important;border-radius:17px!important;border:1px solid rgba(255,255,255,.11)!important;background:rgba(255,255,255,.055)!important;color:#fff!important;text-align:left!important}.ithFriendPickRowV249433 .avatar{width:43px!important;height:43px!important;display:grid!important;place-items:center!important;overflow:hidden!important;border-radius:50%!important;background:rgba(255,217,110,.15)!important;color:#ffe49b!important;font-weight:1000!important}.ithFriendPickRowV249433 .avatar img{width:100%!important;height:100%!important;object-fit:cover!important}.ithFriendPickRowV249433 small{display:block!important;color:rgba(255,255,255,.62)!important;margin-top:3px!important}.ithShareLabelV249433{margin:14px 0 8px!important;color:#ffe49b!important;font-weight:950!important}.ithExternalShareV249433{width:100%!important}
@media(max-width:720px){#plusSheet.ithModernPlusV249433{grid-template-columns:repeat(2,minmax(0,1fr))!important;bottom:calc(var(--bar,72px) + 6px)!important;max-height:84dvh!important;padding:12px!important;border-radius:24px!important}#plusSheet.ithModernPlusV249433 .tile{min-height:84px!important}.ithCommentComposerVisibleV249432{grid-template-columns:minmax(0,1fr)!important}.ithCommentComposerVisibleV249432 .btn{min-height:43px!important;width:100%!important}}
/* V249434 final UI details */
#feedPage .ithFeedStageV249429{display:flex!important;align-items:center!important;justify-content:center!important;padding:0!important}
#feedPage .ithFeedMediaV249429{inset:0!important;width:100%!important;height:100%!important;padding:0!important;display:flex!important;align-items:center!important;justify-content:center!important;background:#000!important}
#feedPage .ithFeedMediaV249429 video,#feedPage .ithFeedMediaV249429 img{width:100%!important;height:100%!important;max-width:100vw!important;max-height:100%!important;object-fit:contain!important;object-position:50% 50%!important;margin:auto!important;background:#000!important}
#feedPage .ithFeedCardV249429{width:min(840px,calc(100vw - 28px))!important;max-width:calc(100vw - 28px)!important;margin:auto!important;left:auto!important;right:auto!important;transform:none!important}
#feedPage .ithFeedSideV249429{right:6px!important;top:50%!important;transform:translateY(-50%)!important;padding:2px!important;gap:8px!important;background:transparent!important;border:0!important;box-shadow:none!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
#feedPage .ithFeedSideV249429 button{background:transparent!important;border:0!important;box-shadow:none!important;text-shadow:0 2px 8px #000,0 0 12px rgba(0,0,0,.85)!important;width:44px!important;height:44px!important}
#feedPage .ithFeedMetaV249429{left:10px!important;right:58px!important;bottom:10px!important}
#ithFeedCommentsV249430 .ithCommentsSheetV249430{grid-template-rows:auto minmax(0,1fr) auto auto!important}
#ithFeedCommentsV249430 .ithCommentsListV249430{order:2!important;min-height:0!important;overflow:auto!important}
#ithFeedCommentsV249430 .ithReplyBarV249430{order:3!important}
#ithFeedCommentsV249430 .ithCommentComposerVisibleV249432{order:4!important;position:relative!important;top:auto!important;display:grid!important;grid-template-columns:1fr!important;gap:8px!important;width:100%!important;padding:10px 11px calc(10px + env(safe-area-inset-bottom,0px))!important;border-top:1px solid rgba(255,217,110,.25)!important;background:rgba(3,10,17,.995)!important;box-shadow:0 -12px 30px rgba(0,0,0,.42)!important}
#ithFeedCommentsV249430 .ithCommentComposerVisibleV249432 textarea{width:100%!important;min-height:76px!important;max-height:150px!important;font-size:17px!important;padding:12px 13px!important;caret-color:#ffd96e!important}
#ithFeedCommentsV249430 .ithCommentComposerVisibleV249432 .btn{width:100%!important;min-height:45px!important;margin:0!important}
#bottleSeaOverlayV249274{overflow:hidden!important}
#bottleSeaOverlayV249274 .bottleSeaPanelV249274{height:min(94dvh,920px)!important;max-height:min(94dvh,920px)!important;display:grid!important;grid-template-rows:auto auto auto minmax(0,1fr)!important;overflow:hidden!important}
#bottleSeaOverlayV249274 #bottleBodyV249274{min-height:0!important;overflow-y:auto!important;overflow-x:hidden!important;-webkit-overflow-scrolling:touch!important;overscroll-behavior:contain!important;padding-bottom:calc(18px + env(safe-area-inset-bottom,0px))!important}
#bottleSeaOverlayV249274 .bottleTabsV249274{flex-wrap:nowrap!important;overflow-x:auto!important;scrollbar-width:none!important}
#bottleSeaOverlayV249274 .bottleTabsV249274::-webkit-scrollbar{display:none!important}
#bottleSeaOverlayV249274 .bottleSeaTopV249274 button,#lighthouseOverlayV249278 .lighthouseTopBarV249278 button:first-child{font-size:29px!important;font-weight:1000!important}
#ithV411Wall .v411ActionBar{grid-template-columns:repeat(3,minmax(0,1fr))!important}
#ithV411Wall .v411Action{min-height:58px!important;display:flex!important;flex-direction:column!important;gap:2px!important;border-radius:16px!important;font-size:12px!important}
#ithV411Wall .v411Action .v411ActionIcon{font-size:22px!important;line-height:1!important}
#ithV411Wall .v411Action.report{width:auto!important}
@media(max-width:760px){#bottleSeaOverlayV249274{padding:0!important;align-items:stretch!important}#bottleSeaOverlayV249274 .bottleSeaPanelV249274{width:100%!important;height:100dvh!important;max-height:100dvh!important;border-radius:0!important}.bottleHeroV249274{min-height:150px!important;padding:12px!important}.seaWhisperHeroV249277 h2{font-size:22px!important}#feedPage .ithFeedCardV249429{width:calc(100vw - 18px)!important;max-width:calc(100vw - 18px)!important}}

`;document.head.appendChild(st)}
function isIthakiOfficial430(p){const x=postPayload424(p),o=x.o||{},s=(String(p&&p.sender_id||'')+' '+String(p&&p.nickname||'')+' '+String(o.brand||'')+' '+String(o.owner||'')).normalize('NFD').replace(/[\u0300-\u036f]/g,'').toLowerCase();return !!(p&&p.ithaki_official||o.ithaki_official||o.ship_logo||/\bithaki\b|ιθακη|ok[- ]?ithaki/.test(s))}
function officialIthaki433(p){const who=[p&&p.nickname,p&&p.sender_id,p&&p.creator_id,p&&p.name].filter(Boolean).join(' ').toLowerCase();return /(^|\s)(ok[ _-]*)?ithaki(\s|$)|ιθ[άα]κη|οικοδεσπότ|host/.test(who)}
function paceIthaki433(input){ithakiPacedHidden433=0;if(!Array.isArray(input))return[];const normal=[],official=[];input.forEach(p=>((isIthakiOfficial430(p)||officialIthaki433(p))?official:normal).push(p));const out=[];let oi=0,videoCount=0;for(const p of normal){out.push(p);if(postKind424(p)==='video'){videoCount++;if(videoCount%7===0&&oi<official.length)out.push(official[oi++])}}ithakiPacedHidden433=Math.max(0,official.length-oi);return out}
async function loadPollMap433(room){try{const r=await api422(`/api/polls?room_id=${encodeURIComponent(room||'ithaki-phone-test')}&limit=300&_v=${Date.now()}`);pollMap433=new Map((Array.isArray(r.polls)?r.polls:[]).map(p=>[String(p.poll_id||''),p]));return true}catch(e){pollMap433=new Map();diag('poll-map-load-error-v249433',String(e.message||e));return false}}
async function voteFeedPoll433(pollId,optionIndex){const s=core();if(!s||!s.device){toast422('Χρειάζεται προφίλ μέλους για ψήφο.');return false}try{const r=await api422('/api/polls/vote',{method:'POST',body:JSON.stringify({room_id:s.room||'ithaki-phone-test',poll_id:String(pollId||''),device_id:s.device,option_index:Number(optionIndex||0)})});if(r&&r.stats)pollMap433.set(String(pollId||''),r.stats);toast422('Η ψήφος καταχωρίστηκε.');return openFeedSimple422('poll-vote-v249433')}catch(e){toast422('Δεν καταχωρίστηκε η ψήφος: '+String(e.message||e),6500);return false}}

function isOwnFeedPost430(p,sender){const st=core()||{},sid=String(sender||p&&p.sender_id||p&&p.creator_id||p&&p.device_id||''),mineId=String(st.device||st.device_id||localStorage.getItem('ith_device')||''),pn=String(p&&p.nickname||p&&p.name||'').trim().toLowerCase(),mn=String(st.name||st.nickname||localStorage.getItem('ith_name')||'').trim().toLowerCase();return !!((sid&&mineId&&sid===mineId)||(pn&&mn&&pn===mn)||(p&&p.mine===true)||(p&&p.is_mine===true))}
function avatarButton430(p,sender){const id=String(p&&p.post_id||p&&p.id||''),sj=esc(String(sender||p&&p.sender_id||'')),idj=esc(id),mine=isOwnFeedPost430(p,sender),open=mine?`ITH.openMemberFeed('${sj}','${idj}')`:`ITH.member('${sj}')`;return `<button class="ithFeedAvatarButtonV249430" data-v249502-avatar="1" data-sender="${sj}" data-post="${idj}" title="${mine?'Οι δημοσιεύσεις μου':'Μέλος'}" onclick="event.stopPropagation();${open}">${feedAvatar424(p)}</button>`}
function feedSide424(p,body){const id=String(p&&p.post_id||p&&p.id||''),sender=String(p&&p.sender_id||p&&p.creator_id||p&&p.device_id||''),mine=isOwnFeedPost430(p,sender),c=postCounts424(p),idj=esc(id),txt=String(body||'').slice(0,1200);return `<aside class="ithFeedSideV249429" aria-label="Λειτουργίες δημοσίευσης">${avatarButton430(p,sender)}<button title="Καρδιά" onclick="ITH.like('${idj}')">❤️<span class="ithCountV249429" id="like_${idj}">${c.likes}</span></button><button title="Σχόλια" onclick="ITH.openFeedCommentsV249430('${idj}')">💬<span class="ithCountV249429" id="comment_count_${idj}">${c.comments}</span></button><button title="Αποθήκευση" onclick="ITH.savePost('${idj}')">🔖</button><button title="Κοινοποίηση σε φίλο ή εξωτερικά" onclick="ITH.openSharePostV249433('${idj}')">📤</button>${txt?`<button title="Μετάφραση" onclick="ITH.translateBlock('post_${idj}','${esc(txt).replace(/'/g,'&#39;')}')">🌐</button>`:''}${mine?`<button title="Διαγραφή" onclick="ITH.deletePost('${idj}')">🗑️</button>`:''}</aside>`}
function feedMeta424(p,body,pro,showCaption){const when=esc(feedDate429(p&&p.created_at)),short=showCaption?esc(cleanHumanText429(body).slice(0,500)):'';if(!short&&!when)return'';return `<div class="ithFeedMetaV249429">${short?`<div class="ithFeedCaptionV249430">${short}</div>`:''}${when?`<time class="ithFeedDateV249430">${when}</time>`:''}</div>`}
function goldenLogo430(p){return isIthakiOfficial430(p)?'<div class="ithGoldenLogoV249430"><img src="ok_ithaki_ship_logo.png" alt="ΙΘΑΚΗ" onerror="this.style.display=\'none\'"></div>':''}
function goldenCard430(p,body,inside,extra=''){const when=esc(feedDate429(p&&p.created_at));return `<div class="ithGoldenCardV249430 ${extra}">${goldenLogo430(p)}${inside||`<div class="ithFeedMainTextV249429">${esc(body||'Δημοσίευση')}</div>`}${when?`<time class="ithGoldenDateV249430">${when}</time>`:''}</div>`}
function missingMediaCard429(kind,body,p){const icon=kind==='video'?'🎬':kind==='photo'?'🖼️':kind==='audio'?'🎙️':'📎';return goldenCard430(p,body,`<div class="ithFeedFileV249429">${icon}</div><div class="ithFeedMainTextV249429">${esc(body||'Παλιά δημοσίευση')}</div><small>Το παλιό αρχείο δεν είναι πλέον διαθέσιμο στον server.</small>`,'ithMissingMediaV249429')}
function feedStage424(p,i){const x=postPayload424(p),kind=postKind424(p),pro=isProfessional424(p),url=mediaUrl424(p),body=cleanHumanText429(x.body||''),missing=!!(p&&p.media_missing),official=!!(isIthakiOfficial430(p)||officialIthaki433(p)),id=esc(String(p&&p.post_id||p&&p.id||('local_'+i))),sender=esc(String(p&&p.sender_id||'')),search=esc(searchText424(p,kind)),professional=pro?'1':'0';let content='';if(official){content=kind==='poll'?goldenCard430(p,body,pollCore424(p),'ithGoldPollV249430 ithOfficialGoldV249505'):goldenCard430(p,body||'Δημοσίευση ΙΘΑΚΗΣ','', 'ithGoldTextV249430 ithOfficialGoldV249505')}else if(missing)content=missingMediaCard429(kind,body,p);else if(kind==='video'&&url)content=`<div class="ithFeedMediaV249429"><video src="${esc(url)}" controls playsinline autoplay preload="metadata" data-v249440-autoplay="1"></video></div>`;else if(kind==='photo'&&url)content=`<div class="ithFeedMediaV249429"><img src="${esc(url)}" loading="lazy" alt="Δημοσίευση φωτογραφίας"></div>`;else if(kind==='audio'&&url)content=goldenCard430(p,body,`<div class="ithFeedFileV249429">🎙️</div><audio src="${esc(url)}" controls preload="metadata"></audio>${body?`<div class="ithFeedMainTextV249429">${esc(body)}</div>`:''}`);else if(kind==='poll')content=goldenCard430(p,body,pollCore424(p),'ithGoldPollV249430');else if(kind==='gold_text')content=goldenCard430(p,body,'','ithGoldTextV249430 ithPersistedGoldV249505');else if(kind==='file'&&url)content=goldenCard430(p,body,`<div class="ithFeedFileV249429">📎</div><div class="ithFeedMainTextV249429">${esc(body||'Αρχείο')}</div><p><a class="btn green" href="${esc(url)}" target="_blank" rel="noopener">Άνοιγμα αρχείου</a></p>`);else content=goldenCard430(p,body,'',kind==='wisdom'?'ithWisdomV249429':'ithGoldTextV249430');return `<article class="ithFeedStageV249429" data-v249505-official-gold="${official?'1':'0'}" data-v249429-kind="${kind}" data-v249429-pro="${professional}" data-v249429-sender="${sender}" data-sender="${sender}" data-v249429-search="${search}" data-post="${id}">${content}${official?'':feedMeta424(p,body,pro,(kind==='video'||kind==='photo')&&!missing)}${feedSide424(p,body)}</article>`}
function closeFeedComments430(){const x=$('ithFeedCommentsV249430');if(x)x.remove();activeCommentPost430='';activeCommentReply430='';return false}
function commentTree430(list){const roots=[],children=new Map();for(const c of list){const parent=String(c.parent_id||'');if(parent){if(!children.has(parent))children.set(parent,[]);children.get(parent).push(c)}else roots.push(c)}let no=0;const one=(c,label,reply=false)=>{no++;const id=String(c.comment_id||''),nick=String(c.nickname||'Μέλος'),when=feedDate429(Number(c.created_at_ms||0));return `<article class="ithCommentV249430 ${reply?'reply':''}"><div><span class="ithCommentNoV249430">#${esc(label)}</span><b>${esc(nick)}</b>${when?`<small> · ${esc(when)}</small>`:''}</div><div class="ithCommentTextV249430">${esc(cleanHumanText429(c.text||''))}</div><button class="btn ithCommentReplyButtonV249432" onclick="ITH.setFeedCommentReplyV249430('${esc(id)}','${esc(nick)}')">↩ Απάντηση</button></article>`};let html='',rootNo=0;for(const r of roots){rootNo++;html+=one(r,String(rootNo),false);let rn=0;for(const c of (children.get(String(r.comment_id||''))||[])){rn++;html+=one(c,rootNo+'.'+rn,true)}}for(const [parent,arr] of children){if(roots.some(r=>String(r.comment_id||'')===parent))continue;for(const c of arr){rootNo++;html+=one(c,String(rootNo),true)}}return html||'<div class="card">Δεν υπάρχουν σχόλια ακόμη.</div>'}
async function loadFeedComments430(){if(!activeCommentPost430)return false;const s=core(),box=$('ithCommentsListV249430');if(box)box.innerHTML='<div class="card">Φόρτωση σχολίων…</div>';try{const r=await api422(`/api/feed/v24863/comments?room_id=${encodeURIComponent(s&&s.room||'ithaki-phone-test')}&post_id=${encodeURIComponent(activeCommentPost430)}&_v=${Date.now()}`),list=Array.isArray(r.comments)?r.comments:[];commentsLoaded430=list.length;if(box)box.innerHTML=commentTree430(list);const count=$('ithCommentsCountV249430');if(count)count.textContent=String(list.length);const side=$('comment_count_'+activeCommentPost430);if(side)side.textContent=String(list.length);diag('feed-comments-loaded-v249430',{post:activeCommentPost430,count:list.length})}catch(e){if(box)box.innerHTML='<div class="card">Δεν φόρτωσαν τα σχόλια: '+esc(e.message||e)+'</div>'}return false}
function openFeedComments430(postId){
  closeFeedComments430();activeCommentPost430=String(postId||'');const x=document.createElement('div');x.id='ithFeedCommentsV249430';
  x.innerHTML=`<section class="ithCommentsSheetV249430" role="dialog" aria-modal="true"><div class="ithCommentsHeadV249430"><b>💬 Σχόλια (<span id="ithCommentsCountV249430">0</span>)</b><button type="button" class="icon" style="margin-left:auto" aria-label="Έξοδος" onclick="ITH.closeFeedCommentsV249430()">‹</button></div><div id="ithCommentsListV249430" class="ithCommentsListV249430"></div><div id="ithCommentReplyBarV249430" class="ithReplyBarV249430" hidden></div><form id="ithCommentFormV249433" class="ithCommentComposerV249430 ithCommentComposerVisibleV249432" autocomplete="off"><textarea id="ithCommentInputV249430" name="comment" rows="3" maxlength="3000" inputmode="text" spellcheck="true" placeholder="Γράψε σχόλιο ή επίλεξε Απάντηση..."></textarea><button type="submit" class="btn green">➤ Αποστολή</button></form></section>`;
  x.addEventListener('click',e=>{if(e.target===x)closeFeedComments430()});document.body.appendChild(x);const form=$('ithCommentFormV249433'),input=$('ithCommentInputV249430');if(form)form.addEventListener('submit',e=>{e.preventDefault();e.stopPropagation();sendFeedComment430()});if(input){input.disabled=false;input.readOnly=false;input.addEventListener('click',e=>e.stopPropagation());input.addEventListener('pointerdown',e=>e.stopPropagation())}loadFeedComments430();setTimeout(()=>{input?.focus({preventScroll:true})},90);diag('feed-comment-composer-bottom-v249434',{post:activeCommentPost430});return false
}
function setFeedCommentReply430(id,nick){activeCommentReply430=String(id||'');const b=$('ithCommentReplyBarV249430'),i=$('ithCommentInputV249430');if(b){b.hidden=false;b.innerHTML='↩ Απάντηση στο σχόλιο του/της <b>'+esc(nick||'Μέλος')+'</b> <button class="btn" onclick="ITH.clearFeedCommentReplyV249430()">Ακύρωση</button>'}if(i)i.placeholder='Γράψε την απάντησή σου...';setTimeout(()=>{i?.focus({preventScroll:true});i?.scrollIntoView({block:'nearest'})},20);return false}
function clearFeedCommentReply430(){activeCommentReply430='';const b=$('ithCommentReplyBarV249430'),i=$('ithCommentInputV249430');if(b){b.hidden=true;b.innerHTML=''}if(i)i.placeholder='Γράψε σχόλιο ή επίλεξε Απάντηση...';return false}
async function sendFeedComment430(){const s=core(),i=$('ithCommentInputV249430'),value=String(i&&i.value||'').trim();if(!value||!activeCommentPost430)return false;try{await api422('/api/feed/v24863/comments',{method:'POST',body:JSON.stringify({room_id:s&&s.room||'ithaki-phone-test',post_id:activeCommentPost430,parent_id:activeCommentReply430,device_id:s&&s.device||'',nickname:s&&s.name||'Μέλος',text:value})});if(i)i.value='';clearFeedCommentReply430();await loadFeedComments430();toast422('Το σχόλιο δημοσιεύτηκε.')}catch(e){toast422('Δεν δημοσιεύτηκε το σχόλιο: '+String(e.message||e),6500)}return false}
function updateGoldTextPreview430(){const i=$('ithGoldTextInputV249430'),p=$('ithGoldTextPreviewBodyV249430'),c=$('ithGoldTextCountV249430'),v=String(i&&i.value||'');if(p)p.textContent=v.trim()||'Το απλό κείμενο θα εμφανιστεί μέσα σε χρυσή κάρτα.';if(c)c.textContent=String(v.length);return false}
function goCreate422(source){desiredPage427='create';routeEpoch427++;const epoch=routeEpoch427,p=visualPage422('create','gold-text-open');if(!p)return false;goldTextOpen430++;p.innerHTML=`<div id="ithGoldTextComposerV249430"><div class="ithGoldComposerCardV249430"><div class="row"><button class="icon" onclick="ITH.stableRouteV249429('home','gold-text-back')">‹</button><b>📝 Κείμενο για τη Ροή</b><span style="margin-left:auto">Χαρακτήρες: <b id="ithGoldTextCountV249430">0</b></span></div><textarea id="ithGoldTextInputV249430" maxlength="5000" placeholder="Γράψε το κείμενο..." oninput="ITH.updateGoldTextPreviewV249430()"></textarea><div id="ithGoldTextPreviewV249430" class="ithGoldenCardV249430"><div id="ithGoldTextPreviewBodyV249430" class="ithFeedMainTextV249429">Το απλό κείμενο θα εμφανιστεί μέσα σε χρυσή κάρτα.</div></div><label class="card row"><input id="ithGoldTextAnonymousV249430" type="checkbox"><span>🕶️ Ανώνυμη δημοσίευση</span></label><div class="row"><button id="ithGoldTextPublishV249430" class="btn green" onclick="ITH.publishGoldTextV249430()">Δημοσίευση χρυσής κάρτας</button><button class="btn" onclick="ITH.stableRouteV249429('home','gold-text-cancel')">Άκυρο</button></div></div></div>`;settleIsolation427('create',epoch,'gold-text-create');setTimeout(()=>$('ithGoldTextInputV249430')?.focus(),30);diag('plus-text-composer-open-v249430',{source:source||'',gold:true});return false}
async function publishGoldText430(){const s=core(),i=$('ithGoldTextInputV249430'),textValue=String(i&&i.value||'').trim(),anon=!!$('ithGoldTextAnonymousV249430')?.checked;if(!textValue){toast422('Γράψε πρώτα το κείμενο.');return false}const b=$('ithGoldTextPublishV249430');if(b){b.disabled=true;b.textContent='Δημοσίευση…'}try{const sig='gold_text|'+textValue.replace(/\s+/g,' ').toLowerCase().slice(0,500),last=localStorage.getItem('ith_last_gold_text_sig_v249430')||'',at=Number(localStorage.getItem('ith_last_gold_text_at_v249430')||0);if(last===sig&&Date.now()-at<45000){toast422('Η ίδια δημοσίευση στάλθηκε ήδη.');return false}const payload=JSON.stringify({body:textValue,kind:'gold_text',card_style:'gold',gold_card:true,created_by:'v249430_plus_text'});await api422('/api/flow/send',{method:'POST',body:JSON.stringify({room_id:s&&s.room||'ithaki-phone-test',sender_id:s&&s.device||'',nickname:anon?'Ανώνυμο μέλος':s&&s.name||'Μέλος',language:document.documentElement.lang||'el',avatar:anon?'':String(s&&s.avatar||localStorage.getItem('ith_avatar')||''),text:payload,post_kind:'gold_text',anonymous:anon,visibility:'public'})});localStorage.setItem('ith_last_gold_text_sig_v249430',sig);localStorage.setItem('ith_last_gold_text_at_v249430',String(Date.now()));goldTextSent430++;toast422('Η χρυσή κάρτα δημοσιεύτηκε.');return route422('feed','gold-text-posted')}catch(e){toast422('Δεν δημοσιεύτηκε: '+String(e.message||e),7000);return false}finally{if(b){b.disabled=false;b.textContent='Δημοσίευση χρυσής κάρτας'}}}
function unreadPeerIds430(){const out=new Set();for(const key of ['ith_notices','ith_notifications','ith_local_notices']){try{const a=JSON.parse(localStorage.getItem(key)||'[]');if(Array.isArray(a))for(const n of a){if(n&&!n.read&&(n.type==='message'||n.kind==='message'))out.add(String(n.from_id||n.sender_id||''))}}catch(e){}}return out}

function closeGroupCreator431(){const x=$('ithGroupCreatorV249431');if(x)x.remove();return false}
async function openGroupCreator431(){
  closeGroupCreator431();
  const overlay=document.createElement('div');overlay.id='ithGroupCreatorV249431';
  overlay.innerHTML=`<section class="ithGroupCreatorCardV249431"><div class="ithGroupCreatorHeadV249431"><b>➕ Προσθήκη ομάδας</b><button class="icon" onclick="ITH.closeCreateMessageGroupV249431()">×</button></div><label>Όνομα ομάδας<input id="ithGroupTitleV249431" maxlength="120" placeholder="π.χ. Η παρέα μας"></label><label>Περιγραφή<textarea id="ithGroupDescriptionV249431" maxlength="1000" placeholder="Προαιρετική περιγραφή"></textarea></label><div class="ithGroupMembersTitleV249431">Επίλεξε αποδεκτές επαφές</div><div id="ithGroupMemberChoicesV249431" class="ithGroupMemberChoicesV249431"><div class="card">Φόρτωση επαφών…</div></div><div class="ithGroupCreatorActionsV249431"><button class="btn green" onclick="ITH.createMessageGroupV249431()">Δημιουργία ομάδας</button><button class="btn" onclick="ITH.closeCreateMessageGroupV249431()">Άκυρο</button></div></section>`;
  overlay.addEventListener('click',e=>{if(e.target===overlay)closeGroupCreator431()});
  document.body.appendChild(overlay);
  try{
    const list=await loadServerFriends422(true),box=$('ithGroupMemberChoicesV249431');
    box.innerHTML=list.length?list.map(p=>{const id=String(p.device_id||p.id||''),name=String(p.nickname||p.name||'Επαφή');return `<label class="ithGroupMemberChoiceV249431"><input type="checkbox" data-v249431-group-peer value="${esc(id)}"><span class="avatar">${esc((name||'Ε').slice(0,1))}</span><span><b>${esc(name)}</b><small>${p.online?'Ενεργός τώρα':'Αποδεκτή επαφή'}</small></span></label>`}).join(''):'<div class="card">Δεν υπάρχουν ακόμη αποδεκτές επαφές. Μπορείς να δημιουργήσεις ομάδα μόνο με εσένα και να προσθέσεις μέλη αργότερα.</div>'
  }catch(e){const box=$('ithGroupMemberChoicesV249431');if(box)box.innerHTML='<div class="card">Δεν φόρτωσαν οι επαφές: '+esc(e.message||e)+'</div>'}
  setTimeout(()=>$('ithGroupTitleV249431')?.focus(),30);return false
}
async function createMessageGroup431(){
  const s=core(),title=String($('ithGroupTitleV249431')?.value||'').trim(),description=String($('ithGroupDescriptionV249431')?.value||'').trim();
  if(!s)return false;if(!title){toast422('Γράψε όνομα ομάδας.');return false}
  const member_ids=[...document.querySelectorAll('[data-v249431-group-peer]:checked')].map(x=>String(x.value||'')).filter(Boolean);
  try{
    const r=await api422('/api/groups/create',{method:'POST',body:JSON.stringify({room_id:s.room,owner_id:s.device,title,description,member_ids})});
    closeGroupCreator431();activeMessageTab430='groups';await renderMessageTab430('groups',true);toast422('Η ομάδα δημιουργήθηκε.');diag('message-group-created-v249431',{group_id:r.group_id||'',members:Number(r.members||member_ids.length+1)});return false
  }catch(e){toast422('Δεν δημιουργήθηκε η ομάδα: '+String(e.message||e),7000);return false}
}


function closeCreateSpace432(){const x=$('ithCreateSpaceV249432');if(x)x.remove();return false}
function openCreateSpace432(type='room'){
  closeCreateSpace432();
  const overlay=document.createElement('div');overlay.id='ithCreateSpaceV249432';
  overlay.innerHTML=`<section class="ithCreateSpaceCardV249432"><div class="ithCreateSpaceHeadV249432"><button class="icon" onclick="ITH.closeCreateSpaceV249432()">‹</button><div><b>＋ Δημιουργία χώρου</b><small>Δωμάτιο · Κοινότητα · Επαγγελματικός χώρος</small></div></div><label>Τύπος χώρου<select id="ithSpaceTypeV249432"><option value="room">🏠 Δωμάτιο</option><option value="community">🌐 Κοινότητα</option><option value="professional">💼 Επαγγελματικός χώρος</option></select></label><label>Τίτλος<input id="ithSpaceTitleV249432" maxlength="140" placeholder="Όνομα χώρου"></label><label>Περιγραφή / κανόνες<textarea id="ithSpaceDescriptionV249432" maxlength="2000" placeholder="Περιγραφή και βασικοί κανόνες"></textarea></label><label>Πρόσβαση<select id="ithSpaceAccessV249432"><option value="public">Ανοιχτό</option><option value="invite">Με έγκριση</option><option value="private_code">Με κωδικό μέλους</option></select></label><label>Κωδικός μέλους<input id="ithSpaceJoinCodeV249432" maxlength="80" placeholder="Μόνο όταν επιλεγεί κωδικός"></label><div class="ithCreateSpaceActionsV249432"><button class="btn green" onclick="ITH.createSpaceV249432()">Δημιουργία</button><button class="btn" onclick="ITH.closeCreateSpaceV249432()">Άκυρο</button></div></section>`;
  overlay.addEventListener('click',e=>{if(e.target===overlay)closeCreateSpace432()});document.body.appendChild(overlay);
  const sel=$('ithSpaceTypeV249432');if(sel)sel.value=['room','community','professional'].includes(String(type))?String(type):'room';setTimeout(()=>$('ithSpaceTitleV249432')?.focus(),40);return false
}
async function createSpace432(){
  const s=core(),type=String($('ithSpaceTypeV249432')?.value||'room'),title=String($('ithSpaceTitleV249432')?.value||'').trim(),description=String($('ithSpaceDescriptionV249432')?.value||'').trim(),access_type=String($('ithSpaceAccessV249432')?.value||'public'),join_code=String($('ithSpaceJoinCodeV249432')?.value||'').trim();
  if(!s)return false;if(!title){toast422('Γράψε τίτλο χώρου.');return false}
  try{const r=await api422('/api/rooms/create',{method:'POST',body:JSON.stringify({room_id:s.room,owner_id:s.device,title,description,category:type,access_type,join_code,owner_secret:'owner-'+String(s.device||'').slice(0,80)})});closeCreateSpace432();spaceTab422=type==='room'?'rooms':'communities';await renderSimpleSpaces422();toast422(type==='professional'?'Ο επαγγελματικός χώρος δημιουργήθηκε.':type==='community'?'Η κοινότητα δημιουργήθηκε.':'Το δωμάτιο δημιουργήθηκε.');diag('space-created-v249432',{type,subroom_id:r.subroom_id||''});return false}catch(e){toast422('Δεν δημιουργήθηκε ο χώρος: '+String(e.message||e),7000);return false}
}
function removeLegacyGroupCreators432(){
  try{
    const dm=$('dmPage');if(!dm)return false;
    dm.querySelectorAll('#dmGroupCreateBtnV249282,#dmGroupsSectionV249282').forEach(x=>x.remove());
    dm.querySelectorAll('button').forEach(b=>{if(b.closest('#ithMessageTabsV249430')||b.closest('#ithGroupCreatorV249431'))return;const t=String(b.textContent||'').trim(),on=String(b.getAttribute('onclick')||'');if(/Νέα ομάδα|Νέα ομαδική συνομιλία|Δημιουργία (?:νέας )?ομάδας|Ομαδική συνομιλία/i.test(t)||/openMessageGroupPickerV249282\(['\"]create|createGroupChatV249280|openCommCenterV249280\(['\"]groups/i.test(on))b.remove()});
    document.querySelectorAll('#commOverlayV249280').forEach(x=>x.remove());
  }catch(e){}
  return false
}
function ensureMessageTabs430(){
  removeLegacyGroupCreators432();
  const screen=$('dmFriendScreen');if(!screen)return false;
  let tabs=$('ithMessageTabsV249430');
  if(!tabs){tabs=document.createElement('div');tabs.id='ithMessageTabsV249430';tabs.className='ithMessageTabsV249430';const hero=screen.querySelector('.dmFriendHeroV249235');if(hero)hero.insertAdjacentElement('afterend',tabs);else screen.prepend(tabs)}
  const labels=[['contacts','👥 Επαφές'],['unread','🔔 Αδιάβαστα'],['groups','🗂️ Ομάδες'],['professional','💼 Επαγγελματικά'],['add_group','➕ Προσθήκη ομάδας']];
  tabs.innerHTML=labels.map(([k,l])=>`<button class="ithMessageTabV249430 ${activeMessageTab430===k?'active':''} ${k==='add_group'?'addGroup':''}" onclick="ITH.setMessageTabV249430('${k}')">${l}</button>`).join('');
  return true
}
async function professionalFriends430(list){const s=core();try{const r=await api422(`/api/people/known?room_id=${encodeURIComponent(s&&s.room||'ithaki-phone-test')}&limit=800&_v=${Date.now()}`),map=new Map((r.people||[]).map(p=>[String(p.device_id||p.id||''),p]));return list.map(p=>Object.assign({},map.get(String(p.device_id||p.id||''))||{},p)).filter(p=>p.is_professional||p.professional||String(p.account_type||p.profile_type||'').toLowerCase()==='professional')}catch(e){return list.filter(p=>p.is_professional||p.professional||String(p.account_type||p.profile_type||'').toLowerCase()==='professional')}}
async function renderMessageTab430(tab=activeMessageTab430,force=false){activeMessageTab430=String(tab||'contacts');ensureMessageTabs430();document.querySelectorAll('#ithMessageTabsV249430 button').forEach(b=>b.classList.toggle('active',String(b.getAttribute('onclick')||'').includes("'"+activeMessageTab430+"'")));const box=document.querySelector('#dmPage .dmFriendListV249235');if(!box)return false;box.innerHTML='<div class="card">Φόρτωση…</div>';try{if(activeMessageTab430==='groups'){const s=core(),r=await api422(`/api/groups/list?room_id=${encodeURIComponent(s&&s.room||'ithaki-phone-test')}&device_id=${encodeURIComponent(s&&s.device||'')}&_v=${Date.now()}`),groups=Array.isArray(r.groups)?r.groups:[];box.innerHTML=groups.length?groups.map(g=>`<button class="ithGroupRowV249430" onclick="ITH.openMessageGroupV249430('${esc(String(g.group_id||''))}','${esc(String(g.title||'Ομάδα'))}')"><span class="avatar">👥</span><span><b>${esc(g.title||'Ομάδα')}</b><small>${Number(g.member_count||0)} μέλη</small></span></button>`).join(''):'<div class="card">Δεν υπάρχει ομάδα ακόμη.</div>';messageTabsRender430++;return false}let list=await loadServerFriends422(!!force);if(activeMessageTab430==='unread'){const ids=unreadPeerIds430();list=list.filter(p=>ids.has(String(p.device_id||p.id||'')))}else if(activeMessageTab430==='professional')list=await professionalFriends430(list);box.innerHTML=list.length?`<div class="dmFriendSectionTitleV249235">${activeMessageTab430==='unread'?'Αδιάβαστα':activeMessageTab430==='professional'?'Επαγγελματικές επαφές':'Αποδεκτοί φίλοι'} (${list.length})</div><div class="dmFriendSectionV249235">${list.map(friendRow422).join('')}</div>`:'<div class="card">Δεν βρέθηκαν εγγραφές σε αυτή την κατηγορία.</div>';box.dataset.v249429Ready='tab:'+activeMessageTab430+':'+list.map(x=>String(x.device_id||x.id||'')).join('|');messageTabsRender430++;diag('message-tab-render-v249430',{tab:activeMessageTab430,count:list.length})}catch(e){box.innerHTML='<div class="card">Δεν φόρτωσε η κατηγορία: '+esc(e.message||e)+'</div>'}return false}

function setMessageTab430(tab){
  tab=String(tab||'contacts');
  if(tab==='add_group')return openGroupCreator431();
  activeMessageTab430=tab;
  return renderMessageTab430(activeMessageTab430,true)
}
async function renderServerFriends422(force=false){return renderMessageTab430(activeMessageTab430,force)}
function openMessageGroup430(id,title){if(window.ITH&&typeof ITH.openGroupInMessagesV249282==='function')return ITH.openGroupInMessagesV249282(String(id||''),String(title||'Ομάδα'));const s=core();if(!s)return false;s.activeChannel='group:'+String(id||'');s.activePeer='';const friend=$('dmFriendScreen'),chat=$('dmChatScreen');if(friend)friend.style.display='none';if(chat)chat.style.display='block';const name=$('chatName');if(name)name.textContent=String(title||'Ομάδα');try{if(typeof CORE_LOAD_MESSAGES==='function')CORE_LOAD_MESSAGES.call(window.ITH||window,true)}catch(e){}return false}
function openDMSimple422(source){closePlusMenu422('dm');visualPage422('dm');removeLegacyGroupCreators432();try{if(typeof CORE_OPEN_DM==='function')CORE_OPEN_DM.call(window);else if(typeof CORE_PAGE==='function')CORE_PAGE.call(window.ITH||window,'dm')}catch(e){diag('dm-open-error',String(e.message||e))}visualPage422('dm');setTimeout(()=>{removeLegacyGroupCreators432();ensureMessageTabs430();renderMessageTab430(activeMessageTab430,true)},20);setTimeout(removeLegacyGroupCreators432,180);setTimeout(removeLegacyGroupCreators432,900);setTimeout(()=>{cleanLocks422();const p=$('dmPage');if(p&&!p.querySelector('#dmShellV249235'))p.innerHTML='<div id="ithRouteLoadingV249429"><b>Τα Μηνύματα δεν εμφανίστηκαν.</b><button class="btn green" onclick="ITH.stableRouteV249429(\'dm\',\'retry\')">Επανάληψη</button></div>'},80);diag('dm-simple-open',{source:source||'',serverFriendsOnly:true,boundedRepairs:true,messageTabsV249430:true});return false}
/* END V249432_FEED_COMMENTS_MESH_ONE_GROUP_SPACE_CREATE */

function showDiag(){css();let p=$('ithDiagPanelV249429');if(p){p.remove();return false}const s=core();p=document.createElement('div');p.id='ithDiagPanelV249429';p.innerHTML='<div class="row"><b>Διαγνωστικό ΙΘΑΚΗ V249432</b><button class="btn" onclick="document.getElementById(\'ithDiagPanelV249429\').remove()">Κλείσιμο</button></div><pre>'+esc(JSON.stringify({loadId,version:VER,core:{page:s&&s.page,preview:s&&s.preview&&{ctx:s.preview.ctx,kind:s.preview.kind,name:s.preview.file&&s.preview.file.name,sending:s.sending}},previewActive,sendInFlight,menuItems:document.querySelectorAll('#plusSheet [data-v249429-act]').length,studioCore:typeof CORE_STUDIO_OPEN,coreSend:typeof CORE_SEND,professionalPreview:typeof window.openProfessionalPreviewV249397,profileExitVisible:!!$('ithProfileExitV249429')&&getComputedStyle($('ithProfileExitV249429')).display!=='none',routeWrapperInstalled:false,visibleLocks:document.querySelectorAll('#ithOnlyEncryptionLockV249429').length,serverFriendCount:serverFriends422.length,activePeer:s&&s.activePeer||'',activeChannel:s&&s.activeChannel||'',secureScriptLoaded:!!window.ITHAKI_SECURE_V249389,communicationFlowLoaded:!!window.__ITHAKI_V249391_UNIFIED_COMMUNICATION__,messageEndpoint:'api/messages/send_v249430 simple DM; AES friend gate; video/session/create friend gate',notificationCenter:'single core notifyCenter',newFeedOwner:document.documentElement.getAttribute('data-ithaki-new-feed-owner-v249429')||'',oldCoreLoaderDisabled:true,friendRequestMenuChecked:true,aesConnection:'canonical DM + AES-GCM v249396; unsaved downgrade blocked',contactsRenderCount:contactsRenderCount422,notificationOpenCount:notificationOpenCount422,fcmPreference:localStorage.getItem('ok_fcm_enabled'),fcmNative:!!(window.OKITHAKI_ANDROID||window.AndroidBridge||window.Android),fcmRequested:document.documentElement.getAttribute('data-ithaki-fcm-v249429')||'',securityDraftDirty:!!(s&&s.activeChannel&&securityDirtyChannels426.has(String(s.activeChannel))),savedSecurityMode:s&&s.activeChannel?securitySettings422(String(s.activeChannel)).mode:'',desiredPage:desiredPage427,visibleMajorPages:visibleMajorPages427(),routeEpoch:routeEpoch427,screenOwner:document.body?.getAttribute('data-ithaki-screen-owner-v249429')||'',legacyScreenCount:legacyScreenCount428(),feedRawCount:feedRawCount428,feedUniqueCount:feedUniqueCount428,feedDuplicatesHidden:feedDuplicatesHidden428,feedDuplicateIds:feedDuplicateIds428,dedupeOwner:'semantic-safe-v249429',legacyFeedMarkupCount:legacyFeedMarkupCount429(),legacyFeedPaintRejected:legacyFeedPaintRejected429,feedOwnerRepairs:feedOwnerRepairs429,activeLegacyFeedLoaders:Number(window.__ITHAKI_ACTIVE_LEGACY_FEED_LOADERS_V249429__||0),staleFeedRejected:(JSON.parse(localStorage.getItem('ithaki_diag_v249440')||'[]')||[]).filter(x=>x.action==='stale-feed-response-rejected'||x.action==='stale-feed-paint-rejected').length,plusTextComposerV249430:typeof goCreate422==='function',goldTextOpenV249430:goldTextOpen430,goldTextSentV249430:goldTextSent430,messageTabsV249431:document.querySelectorAll('#ithMessageTabsV249430 button').length,messageTabActiveV249430:activeMessageTab430,messageTabsRenderV249430:messageTabsRender430,commentsLoadedV249431:commentsLoaded430,commentComposerVisibleV249432:!!$('ithCommentInputV249430'),commentFormInsideSheetV249433:!!$('ithCommentFormV249433'),internalShareV249433:typeof openSharePost433==='function',pollFullCardsV249433:typeof voteFeedPoll433==='function',ithakiEverySevenV249433:true,modernPlusV249433:true,offlineMeshMenuV249432:true,singleGroupCreatorV249432:true,spaceCreatorV249432:true,videoObjectFitV249430:'contain',standaloneTextGoldCardsV249430:true,legacyRadicalFeedNodes:document.querySelectorAll('#ithakiRadicalFeed376,[id^=\"ithakiRadicalFeed\"],[class*=\"radicalFeed\"]').length,diag:localStorage.getItem('ithaki_diag_v249440')},null,2))+'</pre>';document.body.appendChild(p);return false}
function addDiag(){document.querySelectorAll('[id^="ithDiagV2494"]').forEach(x=>x.remove());return false}

function ensureAndroidFcmV249429(){
  try{
    const b=window.OKITHAKI_ANDROID||window.AndroidBridge||window.Android;
    const s=core();
    if(!b||!s||typeof b.requestFcmToken!=='function')return false;
    if(localStorage.getItem('ok_fcm_enabled')===null)localStorage.setItem('ok_fcm_enabled','1');
    if(localStorage.getItem('ok_fcm_enabled')!=='1')return false;
    try{if(typeof b.save==='function')b.save('ok_fcm_enabled','1')}catch(_e){}
    b.requestFcmToken(String(s.room||'ithaki-phone-test'),String(s.device||''),String(s.name||''),String(location.origin||'https://ok-ithaki.gr'));
    document.documentElement.setAttribute('data-ithaki-fcm-v249429','requested');
    diag('fcm-token-requested',{device:!!s.device,android:true});
    return true;
  }catch(e){diag('fcm-token-request-error',String(e&&e.message||e));return false}
}

function openCurrentWall440(){
  try{document.getElementById('ithWall378')?.remove()}catch(e){}
  const fn=(window.ITH&&ITH.openWallV411)||window.openWallV411||(window.ITH&&ITH.openAnonymousWallV411)||window.openAnonymousWallV411;
  if(typeof fn==='function'){diag('current-wall-open-v249440');return fn.call(window.ITH||window)}
  return openDirectWall434()
}
function enforceCurrentHomeWall440(){
  const b=document.getElementById('ithHomeWall378');if(b&&b.dataset.v249440CurrentWall!=='1'){b.dataset.v249440CurrentWall='1';b.onclick=e=>{e&&e.preventDefault&&e.preventDefault();e&&e.stopPropagation&&e.stopPropagation();return openCurrentWall440()}}
  const old=document.getElementById('ithWall378');if(old){old.remove();openCurrentWall440()}
  return !!b
}
function installExports(){installCount++;css();css430();killGates();window.ITH=window.ITH||{};const s=core();if(s)window.ITH.state=s;Object.assign(window.ITH,{openCurrentWallV249440:openCurrentWall440,page:route422,activateFeedVideos:activateFeedVideos440,activateFeedVideosV249440:activateFeedVideos440,saveFeedPositionV249440:saveFeedPosition440,restoreFeedPositionV249440:restoreFeedPosition440,openProfessionalFeedV249429:openFeedSimple422,dedupeProfessionalFeedV249429:dedupeProfessionalFeed428,toggleFeedSearchV249429:toggleFeedSearch424,applyFeedSearchV249429:feedApplyFilter424,setFeedCategoryV249429:setFeedCategory424,useFeedKeywordV249429:useFeedKeyword424,addManualFeedKeywordV249429:addManualKeyword424,openPlusMenuV249429:openPlusMenu422,closePlusMenuV249429:closePlusMenu422,togglePlus:openPlusMenu422,openOfflineMeshV249432:openOfflineMesh432,closeLighthouseV249278:closeLighthouse434,closeBottleSeaV249274:closeBottle434,openDirectWallV249434:openDirectWall434,stableRouteV249429:route422,chooseFile:chooseFile422,captureMedia:captureMedia422,openPreview:openPreview422,openUnifiedPreviewV249429:openPreview422,closePreview:closePreview422,openPreviewStudioV249429:openStudio422,openPreviewStudio:openStudio422,sendPreviewV249429:sendPreview422,sendPreview:sendPreview422,startDM:startDMGated422,member:openMemberGate422,requestFriendV249429:requestFriend422,startVoiceCall:startVoiceCallGated422,startVideoCall:startVideoCallGated422,renderServerFriendsV249429:renderServerFriends422,loadServerFriendsV249429:loadServerFriends422,sendDMText:sendDMText422,sendSpaceText:sendSpaceText422,openE2EPanel:openEncryptionChoice422,openEncryptionChoiceV249429:openEncryptionChoice422,markSecurityDirtyV249429:markSecurityDirty426,saveConversationModeV249429:saveConversationMode422,renderSpaces:function(){const f=window.ITH&&(ITH.activateSpacesPageV249516||ITH.renderSpacesV249516);return typeof f==='function'?f.call(ITH):(window.__ITHAKI_R10F2_COMMUNITY_EXCLUSIVE__&&typeof window.showCanonicalCommunityLoadingR10F2==='function'?window.showCanonicalCommunityLoadingR10F2():renderSimpleSpaces422())},simpleSpaceTabV249429:simpleSpaceTab422,refreshSimpleRoomsV249429:function(){const f=window.ITH&&(ITH.renderSpacesV249516||ITH.activateSpacesPageV249516);return typeof f==='function'?f.call(ITH):(window.__ITHAKI_R10F2_COMMUNITY_EXCLUSIVE__&&typeof window.showCanonicalCommunityLoadingR10F2==='function'?window.showCanonicalCommunityLoadingR10F2():renderSimpleSpaces422())},openSpace:function(id){const f=window.ITH&&ITH.openSpaceV249516;return typeof f==='function'?f.call(ITH,id):openSpaceSimple422(id)},openSpaceSimpleV249429:openSpaceSimple422,notifyCenter:openNotifications422,openNotificationsV249429:openNotifications422,openProfessionalFeedV249430:openFeedSimple422,openFeedCommentsV249430:openFeedComments430,closeFeedCommentsV249430:closeFeedComments430,setFeedCommentReplyV249430:setFeedCommentReply430,clearFeedCommentReplyV249430:clearFeedCommentReply430,sendFeedCommentV249430:sendFeedComment430,updateGoldTextPreviewV249430:updateGoldTextPreview430,publishGoldTextV249430:publishGoldText430,openGoldTextComposerV249430:goCreate422,setMessageTabV249430:setMessageTab430,openMessageGroupV249430:openMessageGroup430,openCreateMessageGroupV249431:openGroupCreator431,closeCreateMessageGroupV249431:closeGroupCreator431,createMessageGroupV249431:createMessageGroup431,backToSpacesDirectoryV249431:backToSpacesDirectory431,openCreateSpaceV249432:openCreateSpace432,closeCreateSpaceV249432:closeCreateSpace432,createSpaceV249432:createSpace432,removeLegacyGroupCreatorsV249432:removeLegacyGroupCreators432,voteFeedPollV249433:voteFeedPoll433,openSharePostV249433:openSharePost433,closeSharePostV249433:closeShare433,sharePostToFriendV249433:sharePostToFriend433,externalSharePostV249433:externalSharePost433,sharePost:openSharePost433,openFriendPickerV249433:openFriendPicker433,closeFriendPickerV249433:closeFriendPicker433,selectFriendActionV249433:selectFriendAction433,showDiagnosticV249434:showDiag,showDiagnosticV249433:showDiag,showDiagnosticV249432:showDiag,showDiagnosticV249431:showDiag,showDiagnosticV249430:showDiag,showDiagnosticV249429:showDiag,enforceOneScreenV249429:visualPage422,reconcileScreenV249429:()=>visualPage422(desiredPage427,'manual'),stopFeedBackgroundV249545:stopFeedBackgroundV249545,startFeedBackgroundV249545:startFeedBackgroundV249545,secureFilePreflightV249545:secureFilePreflightV249545,secureOpenPreviewV249545:secureOpenPreviewV249545});window.closeLighthouseV249278=closeLighthouse434;window.closeBottleSeaV249274=closeBottle434;window.openDirectWallV249434=openDirectWall434;window.page=route422;window.chooseFile=chooseFile422;window.captureMedia=captureMedia422;window.openPreview=openPreview422;window.sendPreview=sendPreview422;window.sendDMText=sendDMText422;window.sendSpaceText=sendSpaceText422;window.startDM=startDMGated422;window.startVoiceCall=startVoiceCallGated422;window.startVideoCall=startVideoCallGated422;window.notifyCenter=openNotifications422;window.sharePost=openSharePost433;window.closeMember=typeof window.closeMember==='function'?window.closeMember:closeMember422;window.ITH.closeMember=window.closeMember;window.__ITHAKI_UNIFIED_PREVIEW_V249429=true;window.__ITHAKI_DISABLE_RADICAL_FEED_V249429=true;window.__ITHAKI_NEW_CORE_FEED_V249429=true;window.__ITHAKI_PROFESSIONAL_FEED_V249429=true;window.__ITHAKI_FEED_MAX_GOLD_TEXT_MESSAGE_TABS_V249430=true;window.__ITHAKI_PRO_COMMENTS_GROUPS_ROOMS_WALL_V249431=true;window.__ITHAKI_FEED_COMMENTS_MESH_ONE_GROUP_SPACE_CREATE_V249432=true;window.__ITHAKI_COMMENTS_INTERNAL_SHARE_POLLS_MODERN_PLUS_V249433=true;window.__ITHAKI_FINAL_UI_POLISH_V249434=true;window.__ITHAKI_FEED_AUTOPLAY_RESUME_CURRENT_WALL_V249440=true;window.loadFeed=openFeedSimple422;window.ITH.loadFeed=openFeedSimple422;try{window.ITH.openRadicalFeedV249383=()=>false;window.ITH.openRadicalFeed=()=>false}catch(e){}document.documentElement.setAttribute('data-ithaki-v249434',VER);document.documentElement.setAttribute('data-ithaki-v249433',VER);document.documentElement.setAttribute('data-ithaki-v249432',VER);document.documentElement.setAttribute('data-ithaki-v249431',VER);document.documentElement.setAttribute('data-ithaki-v249430',VER);document.documentElement.setAttribute('data-ithaki-v249429',VER);document.documentElement.setAttribute('data-ithaki-new-feed-owner-v249429','professional-feed-v249430');document.documentElement.setAttribute('data-ithaki-preview-owner-v249429','single-normal');document.documentElement.setAttribute('data-ithaki-route-wrapper-v249429','none');desiredPage427=normalizePage427((s&&s.page)||document.body?.dataset.page||'home');visualPage422(desiredPage427,'install');installIsolationObserver427();installFeedOwnerGuard429();ensureProfileExit422();if(window.__ITHAKI_PENDING_NEW_FEED_V249429__){window.__ITHAKI_PENDING_NEW_FEED_V249429__=false;if(normalizePage427(desiredPage427)==='feed')setTimeout(()=>openFeedSimple422('pending-core-bridge'),0)}removeLegacyGroupCreators432();setTimeout(removeLegacyGroupCreators432,400);setTimeout(removeLegacyGroupCreators432,1500);addDiag();diag('install',{count:installCount,core:!!s,desiredPage:desiredPage427});setTimeout(ensureAndroidFcmV249429,700);setTimeout(ensureAndroidFcmV249429,5000)}
window.__ITHAKI_V249440_RUNTIME__={installExports,diag,version:VER,loadId,activateFeedVideos440,saveFeedPosition440,restoreFeedPosition440};
window.addEventListener('click',captureNavigation422,true);window.addEventListener('click',captureFileClick,true);window.addEventListener('change',captureLegacyChange,true);window.addEventListener('pagehide',()=>saveFeedPosition440('pagehide'),{passive:true});document.addEventListener('visibilitychange',()=>{if(document.hidden)saveFeedPosition440('hidden');else if(document.body?.dataset.page==='feed'){restoreFeedPosition440('visible');activateFeedVideos440('visible')}},{passive:true});
window.addEventListener('ithaki:preview-closed',()=>{releasePreviewUrl();unprotect();diag('core-preview-closed')});window.addEventListener('error',e=>{if(e&&e.message)diag('window-error',{message:e.message,source:e.filename,line:e.lineno});else if(e&&e.target&&String(e.target.tagName||'').toUpperCase()==='SCRIPT')diag('script-resource-error',{src:e.target.src||''})},true);window.addEventListener('unhandledrejection',e=>diag('unhandled-rejection',String(e.reason&&e.reason.message||e.reason||'')));window.addEventListener('beforeunload',e=>{diag('beforeunload',{previewActive});if(previewActive){e.preventDefault();e.returnValue=''}});window.addEventListener('focus',()=>{killGates();ensureProfileExit422();cleanLocks422();addDiag();diag('focus-simple-messaging')});window.addEventListener('ithaki:page-changed',e=>{const emitted=normalizePage427(e&&e.detail&&e.detail.page||'');closePlusMenu422('page-event');ensureProfileExit422();setTimeout(cleanLocks422,80);if(emitted!==normalizePage427(desiredPage427)){diag('old-page-event-rejected',{emitted,desired:desiredPage427});scheduleIsolation427('old-page-event',0)}else{visualPage422(desiredPage427,'page-event')}diag('page-event-owned',{emitted,desired:desiredPage427})});window.addEventListener('ithaki:page',()=>scheduleIsolation427('legacy-page-event',0));
installExports();enforceCurrentHomeWall440();[120,420,900,1800,3200].forEach(ms=>setTimeout(enforceCurrentHomeWall440,ms));document.addEventListener('click',e=>{const b=e.target&&e.target.closest&&e.target.closest('#ithHomeWall378');if(b){e.preventDefault();e.stopPropagation();e.stopImmediatePropagation();openCurrentWall440()}},true);removeRadicalFeed422(true);setTimeout(()=>{cleanLocks422();if(String(core()?.page||'')==='dm')scheduleServerFriends422();diag('late-single-repair')},1800);diag('runtime-start');
})();

/* V249505 official and user gold cards persist after every reload. */
document.documentElement.setAttribute('data-ithaki-v249505-feed-truth','official-gold-every-7-videos-persisted');

/* V249506 true server confirmation: post_id proof, auth retry, lost-response verification. */
document.documentElement.setAttribute('data-ithaki-v249506-confirmation','post-id-required');
