1 2const emdReadUserKeyCookie = () => { 3 const cookie = document.cookie.match(/(?:^|; )user_key=([^;]*)/); 4 return cookie ? decodeURIComponent(cookie[1]) : ""; 5}; 6 7const userKeyGenerator = () => { 8 let user_key = localStorage.getItem("user-key"); 9 if (!user_key) { 10 user_key = 11 localStorage.getItem("e-track-key") || 12 emdReadUserKeyCookie() || 13 Date.now() + Math.random().toString(36).substring(2, 22); 14 localStorage.setItem("user-key", user_key); 15 } 16 return user_key; 17}; 18userKeyGenerator(); 19 20/* @deprecated â kept so site-specific frontend scripts that still call 21 * getETrackKey() keep working after merging. Use userKeyGenerator(). */ 22const getETrackKey = () => userKeyGenerator(); 23 24 25const emdGenerateReqKey = () => { 26 return Date.now() + Math.random().toString(36).substring(2, 22); 27}; 28 29/* 30 * Mirror the user_key into a plain cookie so server-side access logs can store 31 * it per request â EmdAccessLogHeaderMiddleware reads the cookie and stamps the 32 * user_key response header. localStorage stays the source of truth. 33 */ 34const emdSyncUserKeyCookie = () => { 35 const user_key = userKeyGenerator(); 36 if (emdReadUserKeyCookie() === user_key) { 37 return user_key; 38 } 39 document.cookie = 40 "user_key=" + 41 encodeURIComponent(user_key) + 42 "; path=/; max-age=" + 43 60 * 60 * 24 * 365 + 44 "; SameSite=Lax" + 45 (location.protocol === "https:" ? "; Secure" : ""); 46 47 return user_key; 48}; 49emdSyncUserKeyCookie();
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.