PageSourceSearch

https://xquare.net/_nuxt/DxzNNJEJ.js

js xquare.net collected 2026-10-02 01:06:07 UTC 1,666 bytes, 1 lines download raw bytes

1import{C as _,U as l,D as E,y as p,aa as S}from"./aDqk-s0q.js";const a=new Map;let n=0,i=null,o=null,u=null;const $=3e4;function R(){const{isAuthenticated:d,session:y}=_(),r=l("hub2-messages-unread",()=>0),f=l("hub2-messages-session-ids",()=>[]),v=l("hub2-messages-last-event",()=>0);i||(i=E());function h(){const e=y.value?.access_token;return e?{Authorization:`Bearer ${e}`}:{}}async function t(){if(!d.value){r.value=0;return}try{const e=await $fetch("/api/messages/unread",{headers:h()});r.value=e?.count||0,Array.isArray(e?.session_ids)&&(f.value=e.session_ids,n>0&&A())}catch{}}async function b(e){if(!(!d.value||!e)){try{await $fetch(`/api/messages/${encodeURIComponent(e)}/read`,{method:"POST",headers:h()})}catch{}await t()}}function g(){u&&clearTimeout(u),u=setTimeout(()=>{u=null,t()},250)}function A(){if(!i||n===0)return;const e=new Set(f.value);for(const[s,c]of a)if(!e.has(s)){try{i.removeChannel(c)}catch{}a.delete(s)}for(const s of e){if(a.has(s))continue;const c=i.channel(`support-session-${s}`,{config:{private:!0}}).on("broadcast",{event:"new_message"},L=>{(L?.payload||{}).sender!=="customer"&&(v.value=Date.now(),g())}).subscribe();a.set(s,c)}}function m(){typeof document<"u"&&!document.hidden&&t()}function C(){n+=1,!(n>1)&&(t(),o=S(()=>{typeof document<"u"&&document.hidden||t()},$),document.addEventListener("visibilitychange",m))}function w(){if(n!==0&&(n-=1,!(n>0))){o&&(clearInterval(o),o=null),document.removeEventListener("visibilitychange",m);for(const e of a.values())try{i?.removeChannel(e)}catch{}a.clear()}}return{unreadCount:p(()=>r.value),lastEventAt:p(()=>v.value),refresh:t,markRead:b,startLive:C,stopLive:w}}export{R as u};

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.