PageSourceSearch

https://nightowl.com/_next/static/chunks/app/layout-cef098773ed9b386.js

js nightowl.com collected 2026-10-07 15:45:13 UTC 17,565 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1112,7177],{5742:(e,t,r)=>{"use strict";r.d(t,{default:()=>l});var a=r(95155),i=r(12115),o=r(75866),n=r(11138);let s="nightowl:splash-shown";function l(){let e=(0,o.useAuthStore)(e=>e.authReady),[t,r]=(0,i.useState)(!1),[l,c]=(0,i.useState)(!1),u=(0,i.useRef)(Date.now());return((0,i.useEffect)(()=>{try{sessionStorage.getItem(s)&&c(!0)}catch(e){}},[]),(0,i.useEffect)(()=>{if(!e||l)return;let t=Math.max(0,1400-(Date.now()-u.current)),a=setTimeout(()=>{r(!0);try{sessionStorage.setItem(s,"1")}catch(e){}},t),i=setTimeout(()=>c(!0),t+500+100);return()=>{clearTimeout(a),clearTimeout(i)}},[e,l]),l)?null:(0,a.jsx)("div",{"data-loading-screen":!0,"aria-hidden":!0,className:"fixed inset-0 z-[900] overflow-hidden bg-[#0a0a0a] transition-opacity ease-out ".concat(t?"pointer-events-none opacity-0":"opacity-100"),style:{transitionDuration:"".concat(500,"ms")},children:(0,a.jsx)("div",{className:"relative flex h-full w-full items-center justify-center px-8",children:(0,a.jsx)("div",{className:"flex w-full max-w-[26rem] justify-center",children:(0,a.jsx)(n.A,{className:"h-8 w-auto overflow-visible md:h-10",autoSweepInitialDelayMs:0,autoSweepDurationMs:1400})})})})}},8649:(e,t,r)=>{"use strict";r.d(t,{Zr:()=>o,eh:()=>a});let a=e=>(t,r,a)=>{let i=a.subscribe;return a.subscribe=(e,t,r)=>{let o=e;if(t){let i=(null==r?void 0:r.equalityFn)||Object.is,n=e(a.getState());o=r=>{let a=e(r);if(!i(n,a)){let e=n;t(n=a,e)}},(null==r?void 0:r.fireImmediately)&&t(n,n)}return i(o)},e(t,r,a)},i=e=>t=>{try{let r=e(t);if(r instanceof Promise)return r;return{then:e=>i(e)(r),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>i(t)(e)}}},o=(e,t)=>(r,a,o)=>{let n,s={storage:function(e,t){let r;try{r=e()}catch(e){return}return{getItem:e=>{var t;let a=e=>null===e?null:JSON.parse(e,void 0),i=null!=(t=r.getItem(e))?t:null;return i instanceof Promise?i.then(a):a(i)},setItem:(e,t)=>r.setItem(e,JSON.stringify(t,void 0)),removeItem:e=>r.removeItem(e)}}(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},l=!1,c=0,u=new Set,d=new Set,h=s.storage;if(!h)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...e)},a,o);let g=()=>{let e=s.partialize({...a()});return h.setItem(s.name,{state:e,version:s.version})},m=o.setState;o.setState=(e,t)=>(m(e,t),g());let f=e((...e)=>(r(...e),g()),a,o);o.getInitialState=()=>f;let y=()=>{var e,t;if(!h)return;let o=++c;l=!1,u.forEach(e=>{var t;return e(null!=(t=a())?t:f)});let m=(null==(t=s.onRehydrateStorage)?void 0:t.call(s,null!=(e=a())?e:f))||void 0;return i(h.getItem.bind(h))(s.name).then(e=>{if(e)if("number"!=typeof e.version||e.version===s.version)return[!1,e.state];else{if(s.migrate){let t=s.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;if(o!==c)return;let[i,l]=e;if(r(n=s.merge(l,null!=(t=a())?t:f),!0),i)return g()}).then(()=>{o===c&&(null==m||m(a(),void 0),n=a(),l=!0,d.forEach(e=>e(n)))}).catch(e=>{o===c&&(null==m||m(void 0,e))})};return o.persist={setOptions:e=>{s={...s,...e},e.storage&&(h=e.storage)},clearStorage:()=>{null==h||h.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>y(),hasHydrated:()=>l,onHydrate:e=>(u.add(e),()=>{u.delete(e)}),onFinishHydration:e=>(d.add(e),()=>{d.delete(e)})},s.skipHydration||y(),n||f}},17479:(e,t,r)=>{"use strict";r.d(t,{default:()=>f});var a=r(95155),i=r(12115),o=r(60354),n=r(97712),s=r(8649);let l={pages:{},initialLoadComplete:!1,currentPage:null},c=(0,n.v)()((0,s.Zr)((e,t)=>({...l,setPageLoading:t=>{e(e=>{let r=e.pages[t];return{pages:{...e.pages,[t]:{status:"loading",retryCount:(null==r?void 0:r.retryCount)||0}}}})},setPageLoaded:t=>{e(e=>({pages:{...e.pages,[t]:{status:"loaded",loadedAt:Date.now()}}}))},setPageError:(t,r)=>{e(e=>{let a=e.pages[t];return{pages:{...e.pages,[t]:{status:"error",error:r,retryCount:((null==a?void 0:a.retryCount)||0)+1}}}})},setInitialLoadComplete:()=>{e({initialLoadComplete:!0})},setCurrentPage:t=>{e({currentPage:t})},isPageReady:e=>{let r=t().pages[e];return(null==r?void 0:r.status)==="loaded"},isPageLoading:e=>{let r=t().pages[e];return(null==r?void 0:r.status)==="loading"},getPageStatus:e=>{let r=t().pages[e];return(null==r?void 0:r.status)||"idle"},getAllLoadedPages:()=>{let e=t().pages;return Object.keys(e).filter(t=>{var r;return(null==(r=e[t])?void 0:r.status)==="loaded"})},getAllLoadingPages:()=>{let e=t().pages;return Object.keys(e).filter(t=>{var r;return(null==(r=e[t])?void 0:r.status)==="loading"})},reset:()=>{e(l)}}),{name:"nightowl-data-load-tracking",storage:{getItem:e=>{let t=sessionStorage.getItem(e);return t?JSON.parse(t):null},setItem:(e,t)=>
1{sessionStorage.setItem(e,JSON.stringify(t))},removeItem:e=>{sessionStorage.removeItem(e)}}})),u={nightowls:{pageName:"nightowls",tables:[{tableName:"nightowls",rowCount:100,storeName:"nightowls-store",storeKey:"nightowls",fetchFn:async()=>{let e=await fetch("/api/nightowls?limit=100");if(!e.ok)throw Error("Failed to fetch nightowls");return(await e.json()).nightowls||[]}}]},parliament:{pageName:"parliament",tables:[{tableName:"nightowl_parliament_listings",rowCount:20,storeName:"parliament-store",storeKey:"listings",fetchFn:async()=>{let e=await fetch("/api/parliament/nightowl-parliament-listings?limit=20");if(!e.ok)throw Error("Failed to fetch parliament listings");let t=await e.json();return t.listings||t}}]},community:{pageName:"community",tables:[{tableName:"community_posts",rowCount:30,storeName:"community-store",storeKey:"posts",fetchFn:async()=>{let e=await fetch("/api/community/posts?limit=30");if(!e.ok)throw Error("Failed to fetch community posts");let t=await e.json();return t.posts||t}},{tableName:"community_forum",rowCount:20,storeName:"community-store",storeKey:"forum",fetchFn:async()=>{let e=await fetch("/api/community/threads?limit=20");if(!e.ok)throw Error("Failed to fetch forum");return(await e.json()).threads||[]}}]},billing:{pageName:"billing",tables:[]},"media-library":{pageName:"media-library",tables:[{tableName:"nightowl_user_media",rowCount:30,storeName:"media-library-store",storeKey:"initialLoad",fetchFn:async()=>{let e=new URLSearchParams({limit:"30",offset:"0"}),t=await fetch("/api/chat/media/jobs?".concat(e.toString()));if(!t.ok)throw Error("Failed to fetch media");let r=await t.json();if(!r.success)throw Error(r.error||"Failed to fetch media");return r.media||[]}}]}};class d{async initialize(){try{if(this.state.initialLoadFired)return;this.state.initialLoadFired=!0,c.getState().reset(),this.initializeNotifications().catch(e=>{console.error("[DataOrchestrator] Notifications initialization failed:",e)});let e=this.getCurrentPageName();try{c.getState().setCurrentPage(e)}catch(e){console.error("[DataOrchestrator] Failed to set current page:",e)}await this.loadPageData(e,"critical").catch(e=>{console.error("[DataOrchestrator] Failed to load current page:",e)}),this.loadBackgroundPages(e).catch(e=>{console.error("[DataOrchestrator] Background page loading failed:",e)}),this.subscribeToNavigation();try{c.getState().setInitialLoadComplete()}catch(e){console.error("[DataOrchestrator] Failed to mark initial load complete:",e)}}catch(e){console.error("[DataOrchestrator] Critical error during initialization:",e)}}async loadPageData(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{let t=c.getState();try{if(t.isPageReady(e)||t.isPageLoading(e))return}catch(t){console.error("[DataOrchestrator] Error checking page status for ".concat(e,":"),t)}let r=u[e];if(!r)return;try{t.setPageLoading(e)}catch(t){console.error("[DataOrchestrator] Failed to mark ".concat(e," as loading:"),t)}try{let a=(await Promise.allSettled(r.tables.map(async e=>{try{let t=await e.fetchFn();await this.updateStore(e.storeName,e.storeKey,t)}catch(t){throw console.error("[DataOrchestrator] Failed to load table ".concat(e.tableName,":"),t),t}}))).filter(e=>"rejected"===e.status);if(a.length>0){let r=a[0].reason;try{t.setPageError(e,"Failed to load ".concat(a.length," table(s): ").concat((null==r?void 0:r.message)||"Unknown error"))}catch(e){console.error("[DataOrchestrator] Failed to set page error:",e)}}else try{t.setPageLoaded(e)}catch(t){console.error("[DataOrchestrator] Failed to mark ".concat(e," as loaded:"),t)}}catch(r){console.error("[DataOrchestrator] Unexpected error loading ".concat(e,":"),r);try{t.setPageError(e,r instanceof Error?r.message:"Unknown error")}catch(e){console.error("[DataOrchestrator] Failed to set page error:",e)}}}catch(t){console.error("[DataOrchestrator] Critical error in loadPageData for ".concat(e,":"),t)}}async loadBackgroundPages(e){try{let t=["nightowls","parliament","community","billing","media-library","user-profile","settings"].filter(t=>t!==e&&!!u[t]);for(let e of(await this.waitForQuietStart(),t)){if(!this.state.initialLoadFired)return;await function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3;return new Promise(t=>{let r=globalThis.requestIdleCallback;r?r(()=>t(),{timeout:e}):setTimeout(t,200)})}(),await this.loadPageData(e,"low").catch(t=>{console.error("[DataOrchestrator] Failed to load background page ".concat(e,":"),t)})}}catch(e){console.error("[DataOrchestrator] Error loading background pages:",e)}}waitForQuietStart(){return new Promise(e=>{let t=!1,a=null,i=()=>
1{if(!t){t=!0,clearTimeout(o);try{null==a||a()}catch(e){}e()}},o=setTimeout(i,6e3);r.e(93145).then(r.bind(r,93145)).then(e=>{let{useInitNightowlStore:t}=e,r=e=>e.isRunActive||!!e.bootError;if(r(t.getState()))return void i();a=t.subscribe(e=>{r(e)&&i()})}).catch(()=>i())})}subscribeToNavigation(){try{let e=null;this.unsubscribeNavigation=o.useNavigationStore.subscribe(t=>{try{let r=t.isMainMenu?t.currentSection:t.currentPage;if(!r||r===e)return;e=r;try{c.getState().setCurrentPage(r)}catch(e){console.error("[DataOrchestrator] Failed to set current page:",e)}try{let e=c.getState();e.isPageReady(r)||e.isPageLoading(r)||this.loadPageData(r,"high").catch(e=>{console.error("[DataOrchestrator] Failed to load page ".concat(r,":"),e)})}catch(e){console.error("[DataOrchestrator] Error checking/loading page status:",e)}}catch(e){console.error("[DataOrchestrator] Error in navigation subscription:",e)}})}catch(e){console.error("[DataOrchestrator] Failed to subscribe to navigation:",e)}}getCurrentPageName(){try{let e=o.useNavigationStore.getState();if(e.isMainMenu)return e.currentSection||"nightowls";return e.currentPage||"nightowls"}catch(e){return console.error("[DataOrchestrator] Failed to get current page name:",e),"nightowls"}}async updateStore(e,t,r){try{if(!this.storeRegistry[e])try{this.storeRegistry[e]=await this.loadStore(e)}catch(t){console.error("[DataOrchestrator] Failed to load store ".concat(e,":"),t);return}let a=this.storeRegistry[e];if(!a)return;try{let e=a.getState();e.setData&&e.setData(t,r)}catch(t){console.error("[DataOrchestrator] Failed to call setData on ".concat(e,":"),t)}}catch(t){console.error("[DataOrchestrator] Failed to update store ".concat(e,":"),t)}}async loadStore(e){try{let t={"nightowls-store":()=>Promise.resolve().then(r.bind(r,74975)).then(e=>e.useNightowlsStore),"parliament-store":()=>r.e(11759).then(r.bind(r,11759)).then(e=>e.useParliamentStore),"community-store":()=>Promise.all([r.e(10821),r.e(57271)]).then(r.bind(r,57271)).then(e=>e.useCommunityStore),"media-library-store":()=>Promise.all([r.e(94722),r.e(54717)]).then(r.bind(r,54717)).then(e=>e.useMediaLibraryStore)}[e];if(!t)return null;return await t()}catch(t){return console.error("[DataOrchestrator] Failed to load store ".concat(e,":"),t),null}}async initializeNotifications(){try{if(this.state.notificationsInitialized)return;try{var e;let{useNotificationsStore:t}=await Promise.all([r.e(91183),r.e(99140)]).then(r.bind(r,99140)),{useAuthStore:a}=await Promise.resolve().then(r.bind(r,75866)),i=null==(e=a.getState().user)?void 0:e.id;if(!i)return;let o=t.getState();await o.initializeNotifications(i),this.state.notificationsInitialized=!0}catch(e){console.error("[DataOrchestrator] Failed to initialize notifications:",e)}}catch(e){console.error("[DataOrchestrator] Critical error in initializeNotifications:",e)}}cleanup(){try{try{this.unsubscribeNavigation&&(this.unsubscribeNavigation(),this.unsubscribeNavigation=null)}catch(e){console.error("[DataOrchestrator] Failed to unsubscribe from navigation:",e)}if(this.state.notificationsInitialized)try{Promise.all([r.e(91183),r.e(99140)]).then(r.bind(r,99140)).then(e=>{let{useNotificationsStore:t}=e;try{t.getState().cleanup()}catch(e){console.error("[DataOrchestrator] Notifications cleanup failed:",e)}}).catch(e=>{console.error("[DataOrchestrator] Failed to import notifications store:",e)})}catch(e){console.error("[DataOrchestrator] Notifications cleanup failed:",e)}try{c.getState().reset()}catch(e){console.error("[DataOrchestrator] Failed to reset tracking store:",e)}this.state={initialLoadFired:!1,notificationsInitialized:!1},this.storeRegistry={}}catch(e){console.error("[DataOrchestrator] Critical error during cleanup:",e)}}constructor(){this.state={initialLoadFired:!1,notificationsInitialized:!1},this.storeRegistry={},this.unsubscribeNavigation=null}}let h=new d;var g=r(75866),m=r(23651);function f(e){let{children:t}=e;return(0,i.useEffect)(()=>{c.getState().reset();let e=!0,t=null,a=!1,i=null,o=()=>{if(!e)return;let{authReady:t,user:r,isAuthenticated:o}=g.useAuthStore.getState();
1!a&&t&&o&&(null==r?void 0:r.id)&&(h.initialize(),a=!0,i=(0,m.W$)())};o();let n=0;return t=g.useAuthStore.subscribe(e=>{n++,!e.isAuthenticated&&a&&(a=!1,h.cleanup(),c.getState().reset(),null==i||i(),i=null,r.e(93145).then(r.bind(r,93145)).then(e=>{let{useInitNightowlStore:t}=e;return t.getState().cleanup()}).catch(()=>{})),o()}),()=>{e=!1,t&&t(),null==i||i(),a&&h.cleanup()}},[]),(0,a.jsx)(a.Fragment,{children:t})}},20063:(e,t,r)=>{"use strict";var a=r(47260);r.o(a,"usePathname")&&r.d(t,{usePathname:function(){return a.usePathname}}),r.o(a,"useRouter")&&r.d(t,{useRouter:function(){return a.useRouter}}),r.o(a,"useSearchParams")&&r.d(t,{useSearchParams:function(){return a.useSearchParams}})},33896:(e,t,r)=>{"use strict";r.d(t,{y:()=>i});let a=e=>{let t,r=new Set,a=(e,a)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=a?a:"object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,o={setState:a,getState:i,getInitialState:()=>n,subscribe:e=>(r.add(e),()=>r.delete(e))},n=t=e(a,i,o);return o},i=e=>e?a(e):a},41290:()=>{},62049:(e,t,r)=>{"use strict";r.d(t,{default:()=>l});var a=r(12115),i=r(20063);let o="viewport-fit=cover",n="width=device-width, initial-scale=1, maximum-scale=5, viewport-fit=cover";function s(){var e;if("undefined"==typeof document)return;let t=Array.from(document.querySelectorAll('meta[name="viewport"]'));if(0===t.length){let e=document.createElement("meta");e.name="viewport",e.content=n,document.head.appendChild(e);return}let r=t[0];if(!r)return;t.slice(1).forEach(e=>e.remove());let a=null!=(e=r.getAttribute("content"))?e:"";if(!a.includes(o)){let e=a.trim().replace(/,\s*$/,"");r.setAttribute("content",e?"".concat(e,", ").concat(o):n)}}function l(){let e=(0,i.usePathname)();return(0,a.useEffect)(()=>{s();let e=window.setTimeout(s,50);return()=>window.clearTimeout(e)},[e]),null}},65144:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,41290,23)),Promise.resolve().then(r.bind(r,5742)),Promise.resolve().then(r.bind(r,17479)),Promise.resolve().then(r.bind(r,89026)),Promise.resolve().then(r.bind(r,62049))},89026:(e,t,r)=>{"use strict";r.d(t,{default:()=>s});var a=r(95155),i=r(12115),o=r(60985),n=r(75866);let s=function(e){let{children:t}=e,{setUser:r,clearAuth:s,clearAuthAndSetReady:l,setAuthReady:c}=(0,n.useAuthStore)(),u=(0,i.useRef)(null),d=(0,i.useRef)(!1);return(0,i.useEffect)(()=>{let e=async e=>{let{data:{user:t},error:a}=await o.z.auth.getUser();t&&!a?(u.current!==t.id&&(r(function(e){var t,r,a,i,o,n,s,l,c;let u=(null==(t=e.user_metadata)?void 0:t.first_name)||(null==(r=e.user_metadata)?void 0:r.firstName)||"",d=(null==(a=e.user_metadata)?void 0:a.last_name)||(null==(i=e.user_metadata)?void 0:i.lastName)||"",h=(null==(o=e.user_metadata)?void 0:o.full_name)||(null==(n=e.user_metadata)?void 0:n.fullName)||"".concat(u," ").concat(d).trim()||(null==(s=e.email)?void 0:s.split("@")[0])||"";return{id:e.id,email:e.email||"",firstName:u,lastName:d,fullName:h,avatarUrl:(null==(l=e.user_metadata)?void 0:l.avatar_url)||(null==(c=e.user_metadata)?void 0:c.avatarUrl)||null,createdAt:e.created_at,updatedAt:e.updated_at||e.created_at,emailVerified:!!e.email_confirmed_at,lastLoginAt:e.last_sign_in_at||void 0}}(t)),u.current=t.id),"initial"!==e||d.current||(d.current=!0,c())):(null!==u.current&&(u.current=null),"initial"!==e||d.current?"listener"===e&&s():(d.current=!0,l()))},{data:{subscription:t}}=o.z.auth.onAuthStateChange(t=>{if("INITIAL_SESSION"===t)return void e("initial");e("listener")});return()=>{t.unsubscribe()}},[r,s,l,c]),(0,a.jsx)(a.Fragment,{children:t})}},97712:(e,t,r)=>{"use strict";r.d(t,{v:()=>n});var a=r(12115),i=r(33896);let o=e=>{let t=(0,i.y)(e),r=e=>(function(e,t=e=>e){let r=a.useSyncExternalStore(e.subscribe,a.useCallback(()=>t(e.getState()),[e,t]),a.useCallback(()=>t(e.getInitialState()),[e,t]));return a.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},n=e=>e?o(e):o}},e=>{e.O(0,[31741,25730,27768,75866,84861,83763,28441,61653,77358],()=>e(e.s=65144)),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.