1((id_server, id_key) => { 2const _save = (x) => { 3 window[id_key] = x; 4 if(_is_legacy) { 5 document.cookie = `${id_key}=${x}; path=/; domain=.kasatria.com; max-age=31536000`; 6 } else { 7 cookieStore.set(id_key, x, { path: '/', domain: '.kasatria.com', maxAge: 31536000 }); 8 } 9}, 10_ack = (x) => { 11 return fetch(`${id_server}ack`, { 12 method: 'POST', 13 headers: { 14 'Content-Type': 'application/json' 15 }, 16 body: JSON.stringify(x) 17 }).then(_handleAck, _handleError); 18}, 19_handleCheck = (x) => { 20 const uid = x && x.value; 21 if (uid) _save(x.value); 22 else _getUid(); 23}, 24_getUid = () => { 25 fetch(id_server, { 26 credentials: 'include' 27 }).then(_handleGet, _handleError); 28}, 29_handleGet = (resp) => { 30 if (resp.ok) { 31 const _recv_time = Date.now(); 32 const uid_header = resp.headers.get('X-Kasatria-UID'); 33 if (uid_header) _save(uid_header); 34 else { 35 resp.json().then(d => { 36 if (d.uid) _save(d.uid); 37 if (d.doAck) { 38 _ack({ 39 uid: d.uid, 40 requestId: d.requestId, 41 clientReceivedEpochMs: _recv_time 42 }).then(_handleAck, _handleError); 43 } 44 }, _handleError); 45 } 46 } 47}, 48_noop = () => {}, 49_handleAck = _noop, 50_handleError = _noop, 51_is_legacy = typeof window.cookieStore === undefined; 52if(_is_legacy) { 53 let t = document.cookie.match(new RegExp(`(?:^|; )${id_key}=([^;]*)`)); 54 if (t) _save(t[1]); 55 else _getUid(); 56} else { 57 cookieStore.get(id_key).then(_handleCheck, _handleError); 58} 59})('https://uid.kasatria.com/', 'kuid');
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.