@thumbmarkjs/thumbmarkjs
Version:
   • 28.6 kB
JavaScript
;const e=2592e5,t="thumbmark",n="https://api.thumbmarkjs.com",r={exclude:[],include:[],stabilize:["private","iframe"],logging:!0,timeout:5e3,cache_api_call:!0,cache_lifetime_in_ms:0,performance:!1,experimental:!1,property_name_factory:e=>`${t}_${e}`};let o={...r};const i={private:[{exclude:["canvas"],browsers:["firefox","safari>=17","brave"]},{exclude:["audio"],browsers:["samsungbrowser","safari"]},{exclude:["fonts"],browsers:["firefox"]},{exclude:["audio.sampleHash","hardware.deviceMemory","header.acceptLanguage.q","system.hardwareConcurrency","plugins"],browsers:["brave"]},{exclude:["tls.extensions"],browsers:["firefox","chrome","safari"]},{exclude:["header.acceptLanguage"],browsers:["edge","chrome"]}],iframe:[{exclude:["system.applePayVersion","system.cookieEnabled"],browsers:["safari"]},{exclude:["permissions"]}],vpn:[{exclude:["ip"]}]};function a(e){let t=0;for(let n=0;n<e.length;++n)t+=Math.abs(e[n]);return t}function s(e,t,n){let r=[];for(let t=0;t<e[0].data.length;t++){let n=[];for(let r=0;r<e.length;r++)n.push(e[r].data[t]);r.push(c(n))}const o=new Uint8ClampedArray(r);return new ImageData(o,t,n)}function c(e){if(0===e.length)return 0;const t={};for(const n of e)t[n]=(t[n]||0)+1;let n=e[0];for(const e in t)t[e]>t[n]&&(n=parseInt(e,10));return n}function l(e){return e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),(e^=e>>>16)>>>0}const u=new Uint32Array([597399067,2869860233,951274213,2716044179]);function m(e,t){return e<<t|e>>>32-t}function d(e,t=0){var n;if(t=t?0|t:0,"string"==typeof e&&(n=e,e=(new TextEncoder).encode(n).buffer),!(e instanceof ArrayBuffer))throw new TypeError("Expected key to be ArrayBuffer or string");const r=new Uint32Array([t,t,t,t]);!function(e,t){const n=e.byteLength/16|0,r=new Uint32Array(e,0,4*n);for(let e=0;e<n;e++){const n=r.subarray(4*e,4*(e+1));n[0]=Math.imul(n[0],u[0]),n[0]=m(n[0],15),n[0]=Math.imul(n[0],u[1]),t[0]=t[0]^n[0],t[0]=m(t[0],19),t[0]=t[0]+t[1],t[0]=Math.imul(t[0],5)+1444728091,n[1]=Math.imul(n[1],u[1]),n[1]=m(n[1],16),n[1]=Math.imul(n[1],u[2]),t[1]=t[1]^n[1],t[1]=m(t[1],17),t[1]=t[1]+t[2],t[1]=Math.imul(t[1],5)+197830471,n[2]=Math.imul(n[2],u[2]),n[2]=m(n[2],17),n[2]=Math.imul(n[2],u[3]),t[2]=t[2]^n[2],t[2]=m(t[2],15),t[2]=t[2]+t[3],t[2]=Math.imul(t[2],5)+2530024501,n[3]=Math.imul(n[3],u[3]),n[3]=m(n[3],18),n[3]=Math.imul(n[3],u[0]),t[3]=t[3]^n[3],t[3]=m(t[3],13),t[3]=t[3]+t[0],t[3]=Math.imul(t[3],5)+850148119}}(e,r),function(e,t){const n=e.byteLength/16|0,r=e.byteLength%16,o=new Uint32Array(4),i=new Uint8Array(e,16*n,r);switch(r){case 15:o[3]=o[3]^i[14]<<16;case 14:o[3]=o[3]^i[13]<<8;case 13:o[3]=o[3]^i[12],o[3]=Math.imul(o[3],u[3]),o[3]=m(o[3],18),o[3]=Math.imul(o[3],u[0]),t[3]=t[3]^o[3];case 12:o[2]=o[2]^i[11]<<24;case 11:o[2]=o[2]^i[10]<<16;case 10:o[2]=o[2]^i[9]<<8;case 9:o[2]=o[2]^i[8],o[2]=Math.imul(o[2],u[2]),o[2]=m(o[2],17),o[2]=Math.imul(o[2],u[3]),t[2]=t[2]^o[2];case 8:o[1]=o[1]^i[7]<<24;case 7:o[1]=o[1]^i[6]<<16;case 6:o[1]=o[1]^i[5]<<8;case 5:o[1]=o[1]^i[4],o[1]=Math.imul(o[1],u[1]),o[1]=m(o[1],16),o[1]=Math.imul(o[1],u[2]),t[1]=t[1]^o[1];case 4:o[0]=o[0]^i[3]<<24;case 3:o[0]=o[0]^i[2]<<16;case 2:o[0]=o[0]^i[1]<<8;case 1:o[0]=o[0]^i[0],o[0]=Math.imul(o[0],u[0]),o[0]=m(o[0],15),o[0]=Math.imul(o[0],u[1]),t[0]=t[0]^o[0]}}(e,r),function(e,t){t[0]=t[0]^e.byteLength,t[1]=t[1]^e.byteLength,t[2]=t[2]^e.byteLength,t[3]=t[3]^e.byteLength,t[0]=t[0]+t[1]|0,t[0]=t[0]+t[2]|0,t[0]=t[0]+t[3]|0,t[1]=t[1]+t[0]|0,t[2]=t[2]+t[0]|0,t[3]=t[3]+t[0]|0,t[0]=l(t[0]),t[1]=l(t[1]),t[2]=l(t[2]),t[3]=l(t[3]),t[0]=t[0]+t[1]|0,t[0]=t[0]+t[2]|0,t[0]=t[0]+t[3]|0,t[1]=t[1]+t[0]|0,t[2]=t[2]+t[0]|0,t[3]=t[3]+t[0]|0}(e,r);const o=new Uint8Array(r.buffer);return Array.from(o).map((e=>e.toString(16).padStart(2,"0"))).join("")}const p=280;async function h(e){for(var t;!document.body;)await f(50);const n=document.createElement("iframe");n.setAttribute("frameBorder","0");const r=n.style;r.setProperty("position","fixed"),r.setProperty("display","block","important"),r.setProperty("visibility","visible"),r.setProperty("border","0"),r.setProperty("opacity","0"),n.src="about:blank",document.body.appendChild(n);const o=n.contentDocument||(null===(t=n.contentWindow)||void 0===t?void 0:t.document);if(!o)throw new Error("Iframe document is not accessible");e({iframe:o}),setTimeout((()=>{document.body.removeChild(n)}),0)}function f(e,t){return new Promise((n=>setTimeout(n,e,t)))}const g=["Arial","Arial Black","Arial Narrow","Arial Rounded MT","Arimo","Archivo","Barlow","Bebas Neue","Bitter","Bookman","Calibri","Cabin","Candara","Century","Century Gothic","Comic Sans MS","Constantia","Courier","Courier New","Crimson Text","DM Mono","DM Sans","DM Serif Display","DM Serif Text","Dosis","Droid Sans","Exo","Fira Code","Fira Sans","Franklin Gothic Medium","Garamond","Geneva","Georgia","Gill Sans","Helvetica","Impact","Inconsolata","Indie Flower","Inter","Josefin Sans","Karla","Lato","Lexend","Lucida Bright","Lucida Console","Lucida Sans Unicode","Manrope","Merriweather","Merriweather Sans","Montserrat","Myriad","Noto Sans","Nunito","Nunito Sans","Open Sans","Optima","Orbitron","Oswald","Pacifico","Palatino","Perpetua","PT Sans","PT Serif","Poppins","Prompt","Public Sans","Quicksand","Rajdhani","Recursive","Roboto","Roboto Condensed","Rockwell","Rubik","Segoe Print","Segoe Script","Segoe UI","Sora","Source Sans Pro","Space Mono","Tahoma","Taviraj","Times","Times New Roman","Titillium Web","Trebuchet MS","Ubuntu","Varela Round","Verdana","Work Sans"],w=["monospace","sans-serif","serif"];function v(e,t){if(!e)throw new Error("Canvas context not supported");return e.font=`72px ${t}`,e.measureText("WwMmLli0Oo").width}function y(){var e;const t=document.createElement("canvas"),n=null!==(e=t.getContext("webgl"))&&void 0!==e?e:t.getContext("experimental-webgl");if(n&&"getParameter"in n)try{const e=(n.getParameter(n.VENDOR)||"").toString(),t=(n.getParameter(n.RENDERER)||"").toString();let r={vendor:e,renderer:t,version:(n.getParameter(n.VERSION)||"").toString(),shadingLanguageVersion:(n.getParameter(n.SHADING_LANGUAGE_VERSION)||"").toString()};if(!t.length||!e.length){const e=n.getExtension("WEBGL_debug_renderer_info");if(e){const t=(n.getParameter(e.UNMASKED_VENDOR_WEBGL)||"").toString(),o=(n.getParameter(e.UNMASKED_RENDERER_WEBGL)||"").toString();t&&(r.vendorUnmasked=t),o&&(r.rendererUnmasked=o)}}return r}catch(e){}return"undefined"}function S(){const e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}const b=(e,t,n,r)=>{const o=(n-t)/r;let i=0;for(let n=0;n<r;n++){i+=e(t+(n+.5)*o)}return i*o};function x(e,t){const n={};return t.forEach((t=>{const r=function(e){if(0===e.length)return null;const t={};e.forEach((e=>{const n=String(e);t[n]=(t[n]||0)+1}));let n=e[0],r=1;return Object.keys(t).forEach((e=>{t[e]>r&&(n=e,r=t[e])})),n}(e.map((e=>t in e?e[t]:void 0)).filter((e=>void 0!==e)));r&&(n[t]=r)})),n}const E=["accelerometer","accessibility","accessibility-events","ambient-light-sensor","background-fetch","background-sync","bluetooth","camera","clipboard-read","clipboard-write","device-info","display-capture","gyroscope","geolocation","local-fonts","magnetometer","microphone","midi","nfc","notifications","payment-handler","persistent-storage","push","speaker","storage-access","top-level-storage-access","window-management","query"];function P(){var e,t,n,r,o,i;if("undefined"==typeof navigator)return{name:"unknown",version:"unknown"};const a=navigator.userAgent,s=[/(?<name>SamsungBrowser)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>EdgA|EdgiOS|Edg)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>OPR|OPX)\/(?<version>\d+(?:\.\d+)+)/,/Opera[\s\/](?<version>\d+(?:\.\d+)+)/,/Opera Mini\/(?<version>\d+(?:\.\d+)+)/,/Opera Mobi\/(?<version>\d+(?:\.\d+)+)/,/(?<name>Vivaldi)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>Brave)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>CriOS)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>FxiOS)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>Chrome|Chromium)\/(?<version>\d+(?:\.\d+)+)/,/(?<name>Firefox|Waterfox|Iceweasel|IceCat)\/(?<version>\d+(?:\.\d+)+)/,/Version\/(?<version1>[\d.]+).*Safari\/[\d.]+|(?<name>Safari)\/(?<version2>[\d.]+)/,/(?<name>MSIE|Trident|IEMobile).+?(?<version>\d+(?:\.\d+)+)/,/(?<name>[A-Za-z]+)\/(?<version>\d+(?:\.\d+)+)/],c={edg:"Edge",edga:"Edge",edgios:"Edge",opr:"Opera",opx:"Opera",crios:"Chrome",fxios:"Firefox",samsung:"SamsungBrowser",vivaldi:"Vivaldi",brave:"Brave"};for(const l of s){const s=a.match(l);if(s){let a=null===(e=s.groups)||void 0===e?void 0:e.name,u=(null===(t=s.groups)||void 0===t?void 0:t.version)||(null===(n=s.groups)||void 0===n?void 0:n.version1)||(null===(r=s.groups)||void 0===r?void 0:r.version2);if(a||!(null===(o=s.groups)||void 0===o?void 0:o.version1)&&!(null===(i=s.groups)||void 0===i?void 0:i.version2)||(a="Safari"),!a&&l.source.includes("Opera Mini")&&(a="Opera Mini"),!a&&l.source.includes("Opera Mobi")&&(a="Opera Mobi"),!a&&l.source.includes("Opera")&&(a="Opera"),!a&&s[1]&&(a=s[1]),!u&&s[2]&&(u=s[2]),a){return{name:c[a.toLowerCase()]||a,version:u||"unknown"}}}}return{name:"unknown",version:"unknown"}}function M(){if("undefined"==typeof navigator||!navigator.userAgent)return!1;const e=navigator.userAgent;return/Mobi|Android|iPhone|iPod|IEMobile|Opera Mini|Opera Mobi|webOS|BlackBerry|Windows Phone/i.test(e)&&!/iPad/i.test(e)}function C(){let e=[];const t={"prefers-contrast":["high","more","low","less","forced","no-preference"],"any-hover":["hover","none"],"any-pointer":["none","coarse","fine"],pointer:["none","coarse","fine"],hover:["hover","none"],update:["fast","slow"],"inverted-colors":["inverted","none"],"prefers-reduced-motion":["reduce","no-preference"],"prefers-reduced-transparency":["reduce","no-preference"],scripting:["none","initial-only","enabled"],"forced-colors":["active","none"]};return Object.keys(t).forEach((n=>{t[n].forEach((t=>{matchMedia(`(${n}: ${t})`).matches&&e.push(`${n}: ${t}`)}))})),e}function A(){if("https:"===window.location.protocol&&"function"==typeof window.ApplePaySession)try{const e=window.ApplePaySession.supportsVersion;for(let t=15;t>0;t--)if(e(t))return t}catch(e){return 0}return 0}const _="SamsungBrowser"!==P().name?1:3;let T,I=null;function k(e){const t=[];return function e(n){if(n&&n.toJSON&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0===n)return;if("number"==typeof n)return isFinite(n)?""+n:"null";if("object"!=typeof n)return JSON.stringify(n);let r,o;if(Array.isArray(n)){for(o="[",r=0;r<n.length;r++)r&&(o+=","),o+=e(n[r])||"null";return o+"]"}if(null===n)return"null";if(-1!==t.indexOf(n))throw new TypeError("Converting circular structure to JSON");const i=t.push(n)-1,a=Object.keys(n).sort();for(o="",r=0;r<a.length;r++){const t=a[r],i=e(n[t]);i&&(o&&(o+=","),o+=JSON.stringify(t)+":"+i)}return t.splice(i,1),"{"+o+"}"}(e)||""}const R=["𝔄","𝔅","ℭ","𝔇","𝔈","𝔉","𝔸","𝔹","ℂ","𝔻","𝔼","𝔽"],O=["β","ψ","λ","ε","ζ","α","ξ","μ","ρ","φ","κ","τ","η","σ","ι","ω","γ","ν","χ","δ","θ","π","υ","ο"];function L(e,t){return`<math><mrow>${t}</mrow></math>`}function D(){let e="<mo>∏</mo>";return R.forEach(((t,n)=>{const r=2*n,o=O.slice(r,r+2);2===o.length&&(e+=`<mmultiscripts><mi>${t}</mi><none/><mi>${o[1]}</mi><mprescripts></mprescripts><mi>${o[0]}</mi><none/></mmultiscripts>`)})),L(0,`<munderover><mmultiscripts>${e}</mmultiscripts></munderover>`)}function N(){const e=[];return R.forEach(((t,n)=>{const r=2*n,o=O.slice(r,r+2);2===o.length&&e.push(L(0,`<mmultiscripts><mi>${t}</mi><none/><mi>${o[1]}</mi><mprescripts></mprescripts><mi>${o[0]}</mi><none/></mmultiscripts>`))})),e}const B={audio:async function(){return async function(){return new Promise(((e,t)=>{try{const t=44100,n=5e3,r=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,n,t),o=r.createBufferSource(),i=r.createOscillator();i.frequency.value=1e3;const s=r.createDynamicsCompressor();let c;s.threshold.value=-50,s.knee.value=40,s.ratio.value=12,s.attack.value=0,s.release.value=.2,i.connect(s),s.connect(r.destination),i.start(),r.oncomplete=t=>{c=t.renderedBuffer.getChannelData(0),e({sampleHash:a(c),maxChannels:r.destination.maxChannelCount,channelCountMode:o.channelCountMode})},r.startRendering()}catch(e){console.error("Error creating audio fingerprint:",e),t(e)}}))}()},canvas:async function(){return new Promise((e=>{const t=Array.from({length:3},(()=>function(){const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return new ImageData(1,1);e.width=p,e.height=20;const n=t.createLinearGradient(0,0,e.width,e.height);n.addColorStop(0,"red"),n.addColorStop(1/6,"orange"),n.addColorStop(2/6,"yellow"),n.addColorStop(.5,"green"),n.addColorStop(4/6,"blue"),n.addColorStop(5/6,"indigo"),n.addColorStop(1,"violet"),t.fillStyle=n,t.fillRect(0,0,e.width,e.height);const r="Random Text WMwmil10Oo";t.font="23.123px Arial",t.fillStyle="black",t.fillText(r,-5,15),t.fillStyle="rgba(0, 0, 255, 0.5)",t.fillText(r,-3.3,17.7),t.beginPath(),t.moveTo(0,0),t.lineTo(2*e.width/7,e.height),t.strokeStyle="white",t.lineWidth=2,t.stroke();const o=t.getImageData(0,0,e.width,e.height);return o}()));e({commonPixelsHash:d(s(t,p,20).data.toString()).toString()})}))},fonts:async function(e){return new Promise(((e,t)=>{try{h((async({iframe:t})=>{const n=t.createElement("canvas").getContext("2d"),r=w.map((e=>v(n,e)));let o={};g.forEach((e=>{const t=v(n,e);r.includes(t)||(o[e]=t)})),e(o)}))}catch(e){t({error:"unsupported"})}}))},hardware:function(){return new Promise(((e,t)=>{const n=void 0!==navigator.deviceMemory?navigator.deviceMemory:0,r=window.performance&&window.performance.memory?window.performance.memory:0;e({videocard:y(),architecture:S(),deviceMemory:n.toString()||"undefined",jsHeapSizeLimit:r.jsHeapSizeLimit||0})}))},locales:function(){return new Promise((e=>{e({languages:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone})}))},math:function(){return new Promise((e=>{e({acos:Math.acos(.5),asin:b(Math.asin,-1,1,97),cos:b(Math.cos,0,Math.PI,97),largeCos:Math.cos(1e20),largeSin:Math.sin(1e20),largeTan:Math.tan(1e20),sin:b(Math.sin,-Math.PI,Math.PI,97),tan:b(Math.tan,0,2*Math.PI,97)})}))},permissions:async function(e){const t=(null==e?void 0:e.permissions_to_check)||E;return x(await Promise.all(Array.from({length:3},(()=>async function(e){const t={};for(const n of e)try{const e=await navigator.permissions.query({name:n});t[n]=e.state.toString()}catch(e){}return t}(t)))),t)},plugins:async function(){const e=[];if(navigator.plugins)for(let t=0;t<navigator.plugins.length;t++){const n=navigator.plugins[t];e.push([n.name,n.filename,n.description].join("|"))}return new Promise((t=>{t({plugins:e})}))},screen:function(){return new Promise((e=>{const t={is_touchscreen:navigator.maxTouchPoints>0,maxTouchPoints:navigator.maxTouchPoints,colorDepth:screen.colorDepth,mediaMatches:C()};M()&&navigator.maxTouchPoints>0&&(t.resolution=function(){const e=window.screen.width,t=window.screen.height,n=Math.max(e,t).toString(),r=Math.min(e,t).toString();return`${n}x${r}`}()),e(t)}))},system:function(){return new Promise((e=>{const t=P();e({platform:window.navigator.platform,productSub:navigator.productSub,product:navigator.product,useragent:navigator.userAgent,hardwareConcurrency:navigator.hardwareConcurrency,browser:{name:t.name,version:t.version},mobile:M(),applePayVersion:A(),cookieEnabled:window.navigator.cookieEnabled})}))},webgl:async function(){"undefined"!=typeof document&&(T=document.createElement("canvas"),T.width=200,T.height=100,I=T.getContext("webgl"));try{if(!I)throw new Error("WebGL not supported");const e=Array.from({length:_},(()=>function(){try{if(!I)throw new Error("WebGL not supported");const e="\n attribute vec2 position;\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n }\n ",t="\n precision mediump float;\n void main() {\n gl_FragColor = vec4(0.812, 0.195, 0.553, 0.921); // Set line color\n }\n ",n=I.createShader(I.VERTEX_SHADER),r=I.createShader(I.FRAGMENT_SHADER);if(!n||!r)throw new Error("Failed to create shaders");if(I.shaderSource(n,e),I.shaderSource(r,t),I.compileShader(n),!I.getShaderParameter(n,I.COMPILE_STATUS))throw new Error("Vertex shader compilation failed: "+I.getShaderInfoLog(n));if(I.compileShader(r),!I.getShaderParameter(r,I.COMPILE_STATUS))throw new Error("Fragment shader compilation failed: "+I.getShaderInfoLog(r));const o=I.createProgram();if(!o)throw new Error("Failed to create shader program");if(I.attachShader(o,n),I.attachShader(o,r),I.linkProgram(o),!I.getProgramParameter(o,I.LINK_STATUS))throw new Error("Shader program linking failed: "+I.getProgramInfoLog(o));I.useProgram(o);const i=137,a=new Float32Array(4*i),s=2*Math.PI/i;for(let e=0;e<i;e++){const t=e*s;a[4*e]=0,a[4*e+1]=0,a[4*e+2]=Math.cos(t)*(T.width/2),a[4*e+3]=Math.sin(t)*(T.height/2)}const c=I.createBuffer();I.bindBuffer(I.ARRAY_BUFFER,c),I.bufferData(I.ARRAY_BUFFER,a,I.STATIC_DRAW);const l=I.getAttribLocation(o,"position");I.enableVertexAttribArray(l),I.vertexAttribPointer(l,2,I.FLOAT,!1,0,0),I.viewport(0,0,T.width,T.height),I.clearColor(0,0,0,1),I.clear(I.COLOR_BUFFER_BIT),I.drawArrays(I.LINES,0,2*i);const u=new Uint8ClampedArray(T.width*T.height*4);I.readPixels(0,0,T.width,T.height,I.RGBA,I.UNSIGNED_BYTE,u);return new ImageData(u,T.width,T.height)}catch(e){return new ImageData(1,1)}finally{I&&(I.bindBuffer(I.ARRAY_BUFFER,null),I.useProgram(null),I.viewport(0,0,I.drawingBufferWidth,I.drawingBufferHeight),I.clearColor(0,0,0,0))}}()));return{commonPixelsHash:d(s(e,T.width,T.height).data.toString()).toString()}}catch(e){return{webgl:"unsupported"}}}},$={webrtc:async function(){return new Promise((e=>{try{const t=window.RTCPeerConnection||window.webkitRTCPeerConnection||window.mozRTCPeerConnection;if(!t)return void e({supported:!1,error:"WebRTC not supported"});const n=new t({iceCandidatePoolSize:1,iceServers:[]});n.createDataChannel("");(async()=>{try{const t={offerToReceiveAudio:!0,offerToReceiveVideo:!0},r=await n.createOffer(t);await n.setLocalDescription(r);const o=r.sdp||"",i=[...new Set((o.match(/extmap:\d+ [^\n\r]+/g)||[]).map((e=>e.replace(/extmap:\d+ /,""))))].sort(),a=e=>{const t=o.match(new RegExp(`m=${e} [^\\s]+ [^\\s]+ ([^\\n\\r]+)`));return t?t[1].split(" "):[]},s=(e,t)=>t.map((t=>{const n=new RegExp(`(rtpmap|fmtp|rtcp-fb):${t} (.+)`,"g"),r=[...o.matchAll(n)];if(!r.length)return null;const i={};return r.forEach((t=>{const[n,r,o]=t,a=o.split("/");"rtpmap"===r?(i.mimeType=`${e}/${a[0]}`,i.clockRate=+a[1],"audio"===e&&(i.channels=+a[2]||1)):"rtcp-fb"===r?(i.feedbackSupport=i.feedbackSupport||[],i.feedbackSupport.push(o)):"fmtp"===r&&(i.sdpFmtpLine=o)})),i})).filter(Boolean),c=s("audio",a("audio")),l=s("video",a("video")),u={audio:{count:c.length,hash:d(k(c))},video:{count:l.length,hash:d(k(l))},extensionsHash:d(k(i))},m=await new Promise((e=>{const t=setTimeout((()=>{n.removeEventListener("icecandidate",r),n.close(),e({supported:!0,...u,timeout:!0})}),3e3),r=o=>{const i=o.candidate;i&&i.candidate&&(clearTimeout(t),n.removeEventListener("icecandidate",r),n.close(),e({supported:!0,...u,candidateType:i.type||""}))};n.addEventListener("icecandidate",r)}));e({details:m,hash:d(k(m))})}catch(t){n.close(),e({supported:!0,error:`WebRTC offer failed: ${t.message}`})}})()}catch(t){e({supported:!1,error:`WebRTC error: ${t.message}`})}}))},mathml:async function(){return new Promise((e=>{try{h((async({iframe:t})=>{try{if(!function(e){try{const t=e.createElement("math");t.innerHTML="<mrow><mi>x</mi></mrow>",t.style.position="absolute",t.style.visibility="hidden",e.body.appendChild(t);const n=t.getBoundingClientRect();return e.body.removeChild(t),n.width>0&&n.height>0}catch(e){return!1}}(t))return void e({supported:!1,error:"MathML not supported"});const n=[L("integral","<msubsup><mo>∫</mo><mi>a</mi><mi>b</mi></msubsup><mfrac><mrow><mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow><mrow><mi>g</mi><mo>(</mo><mi>x</mi><mo>)</mo></mrow></mfrac><mi>dx</mi>"),L("fraction","<mfrac><mrow><mi>π</mi><mo>×</mo><msup><mi>r</mi><mn>2</mn></msup></mrow><mrow><mn>2</mn><mi>σ</mi></mrow></mfrac>"),L("matrix","<mo>[</mo><mtable><mtr><mtd><mi>α</mi></mtd><mtd><mi>β</mi></mtd></mtr><mtr><mtd><mi>γ</mi></mtd><mtd><mi>δ</mi></mtd></mtr></mtable><mo>]</mo>"),D(),...N()],r=[];let o="";n.forEach(((e,n)=>{const i=function(e,t){try{const n=t.createElement("math");n.innerHTML=e.replace(/<\/?math>/g,""),n.style.whiteSpace="nowrap",n.style.position="absolute",n.style.visibility="hidden",n.style.top="-9999px",t.body.appendChild(n);const r=n.getBoundingClientRect(),o=(t.defaultView||window).getComputedStyle(n),i={dimensions:{width:r.width,height:r.height},fontInfo:{fontFamily:o.fontFamily,fontSize:o.fontSize,fontWeight:o.fontWeight,fontStyle:o.fontStyle,lineHeight:o.lineHeight,fontVariant:o.fontVariant||"normal",fontStretch:o.fontStretch||"normal",fontSizeAdjust:o.fontSizeAdjust||"none",textRendering:o.textRendering||"auto",fontFeatureSettings:o.fontFeatureSettings||"normal",fontVariantNumeric:o.fontVariantNumeric||"normal",fontKerning:o.fontKerning||"auto"}};return t.body.removeChild(n),i}catch(e){return{error:e.message}}}(e,t);r.push({width:i.dimensions.width,height:i.dimensions.height}),0===n&&i.fontInfo&&(o=d(k(i.fontInfo)))}));const i={fontStyleHash:o,dimensions:r};e({details:i,hash:d(k(i))})}catch(t){e({supported:!1,error:`MathML error: ${t.message}`})}}))}catch(t){e({supported:!1,error:`MathML error: ${t.message}`})}}))},speech:async function(){return new Promise((e=>{try{if("undefined"==typeof window||!window.speechSynthesis||"function"!=typeof window.speechSynthesis.getVoices)return void e({supported:!1,error:"Speech Synthesis API not supported"});let t=!1,n=null;const r=r=>{if(!t){t=!0,n&&clearTimeout(n);try{const t=r.map((e=>{const t=e=>e.replace(/\\/g,"\\\\").replace(/,/g,"\\,");return[t(e.voiceURI||""),t(e.name||""),t(e.lang||""),e.localService?"1":"0",e.default?"1":"0"].join(",")}));t.sort();const n={voiceCount:r.length,voicesHash:d(k(t))};e({details:n,hash:d(k(n))})}catch(t){e({supported:!0,error:`Voice processing failed: ${t.message}`})}}},o=window.speechSynthesis.getVoices();if(o.length>0)return void r(o);n=setTimeout((()=>{const e=window.speechSynthesis.getVoices();r(e)}),800);const i=()=>{window.speechSynthesis.removeEventListener("voiceschanged",i);const e=window.speechSynthesis.getVoices();r(e)};window.speechSynthesis.addEventListener("voiceschanged",i)}catch(t){e({supported:!1,error:`Speech Synthesis error: ${t.message}`})}}))}},F={},V={timeout:"true"},j=(e,t,n)=>{F[e]=t};function U(){return"1.6.1"}function W(e,t){var n;let r=P();if("unknown"===r.name&&e.system&&"object"==typeof e.system&&!Array.isArray(e.system)){const t=e.system.browser;if(t&&"object"==typeof t&&!Array.isArray(t)){const e=t;r={name:e.name||"unknown",version:e.version||"unknown"}}}const o=r.name.toLowerCase(),a=r.version.split(".")[0]||"0",s=parseInt(a,10),c=[...(null==t?void 0:t.exclude)||[]],l=(null==t?void 0:t.stabilize)||[],u=(null==t?void 0:t.include)||[];for(const e of l){const t=i[e];if(t)for(const e of t){const t=!("browsers"in e),r=!t&&(null===(n=e.browsers)||void 0===n?void 0:n.some((e=>{const t=e.match(/(.+?)(>=)(\d+)/);if(t){const[,e,,n]=t,r=parseInt(n,10);return o===e&&s>=r}return o===e})));(t||r)&&c.push(...e.exclude)}}return function e(t,n=""){const r={};for(const[o,i]of Object.entries(t)){const t=n?`${n}.${o}`:o;if("object"!=typeof i||Array.isArray(i)||null===i){const e=c.some((e=>t.startsWith(e))),n=u.some((e=>t.startsWith(e)));e&&!n||(r[o]=i)}else{const n=e(i,t);Object.keys(n).length>0&&(r[o]=n)}}return r}(e)}const H="visitor_id";function G(e){return e.storage_property_name?e.storage_property_name:e.property_name_factory(H)}const z=`${t}_${H}`;function J(e,t){try{localStorage.setItem(G(t),e)}catch(e){}}const K="cache";function Y(e){try{const t=localStorage.getItem(e.property_name_factory(K)),n=JSON.parse(t);return n||{}}catch(e){}return{}}function q(t){return t.cache_lifetime_in_ms>e?Date.now()+e:Date.now()+t.cache_lifetime_in_ms}let X=null,Z=null;const Q=(e,t)=>{if(e.cache_api_call){if(Z)return Promise.resolve(Z);const t=function(e){const t=Y(e);if(t&&t.apiResponse&&t.apiResponseExpiry&&Date.now()<=t.apiResponseExpiry)return t.apiResponse;return}(e);if(t)return Promise.resolve(t)}if(X)return X;const r=`${e.api_endpoint||n}/thumbmark`,o=function(e){try{const t=G(e);let n=localStorage.getItem(t);return n||t===z||(n=localStorage.getItem(z),n&&J(n,e)),n}catch(e){return null}}(e),i={components:t,options:e,clientHash:d(k(t)),version:"1.6.1"};o&&(i.visitorId=o);const a=fetch(r,{method:"POST",headers:{"x-api-key":e.api_key,Authorization:"custom-authorized","Content-Type":"application/json"},body:JSON.stringify(i)}).then((e=>{if(!e.ok){if(403===e.status)throw new Error("INVALID_API_KEY");throw new Error(`HTTP error! status: ${e.status}`)}return e.json()})).then((t=>(t.visitorId&&t.visitorId!==o&&J(t.visitorId,e),Z=t,function(e,t){if(!e.cache_api_call||!e.cache_lifetime_in_ms)return;!function(e,t){const n={...Y(e),...t};try{localStorage.setItem(e.property_name_factory(K),JSON.stringify(n))}catch(e){}}(e,{apiResponseExpiry:q(e),apiResponse:t})}(e,t),X=null,t))).catch((e=>{if(console.error("Error fetching pro data",e),X=null,"INVALID_API_KEY"===e.message)throw e;return null})),s=e.timeout||5e3,c=new Promise((e=>{setTimeout((()=>{e({info:{timed_out:!0},version:"1.6.1"})}),s)}));return X=Promise.race([a,c]),X};async function ee(e){var t;const o={...r,...e},i=o.logging&&!sessionStorage.getItem("_tmjs_l")&&Math.random()<1e-4,a={...B,...F},{elapsed:s,resolvedComponents:c}=await te(a,o);let l={},u={};if(i||o.experimental){const{elapsed:e,resolvedComponents:t}=await te($,o);l=t,u=e}const m=o.api_key?Q(o,c):null;let p=null;if(m)try{p=await m}catch(e){if(e instanceof Error&&"INVALID_API_KEY"===e.message)return{error:"Invalid API key or quota exceeded",components:{},info:{},version:"1.6.1",thumbmark:""};throw e}const h={...s,...u},f=o.performance?{elapsed:h}:{},g=W((null==p?void 0:p.components)||{},o),w={...c,...g},v=(null==p?void 0:p.info)||{uniqueness:{score:"api only"}},y=null!==(t=null==p?void 0:p.thumbmark)&&void 0!==t?t:d(k(w));i&&async function(e,t,r,o={}){var i;const a=`${n}/log`,s={thumbmark:e,components:t,experimental:o,version:"1.6.1",options:r,path:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.pathname};sessionStorage.setItem("_tmjs_l","1");try{await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})}catch(e){}}(y,w,o,l).catch((()=>{}));return{...(null==p?void 0:p.visitorId)&&{visitorId:p.visitorId},thumbmark:y,components:w,info:v,version:"1.6.1",...f,...Object.keys(l).length>0&&o.experimental&&{experimental:l}}}async function te(e,t){const n={...r,...t},o=Object.entries(e).filter((([e])=>{var t;return!(null===(t=null==n?void 0:n.exclude)||void 0===t?void 0:t.includes(e))})).filter((([e])=>{var t,r,o,i;return(null===(t=null==n?void 0:n.include)||void 0===t?void 0:t.some((e=>e.includes("."))))?null===(r=null==n?void 0:n.include)||void 0===r?void 0:r.some((t=>t.startsWith(e))):0===(null===(o=null==n?void 0:n.include)||void 0===o?void 0:o.length)||(null===(i=null==n?void 0:n.include)||void 0===i?void 0:i.includes(e))})),i=o.map((([e])=>e)),a=o.map((([e,n])=>n(t))),s=await function(e,t,n){return Promise.all(e.map((e=>{const r=performance.now();return Promise.race([e.then((e=>({value:e,elapsed:performance.now()-r}))),(o=t,i=n,new Promise((e=>{setTimeout((()=>e(i)),o)}))).then((e=>({value:e,elapsed:performance.now()-r})))]);var o,i})))}(a,(null==n?void 0:n.timeout)||5e3,V),c={},l={};s.forEach(((e,t)=>{var n;null!=e.value&&(l[i[t]]=e.value,c[i[t]]=null!==(n=e.elapsed)&&void 0!==n?n:0)}));const u=W(l,n);return{elapsed:c,resolvedComponents:u}}exports.Thumbmark=class{constructor(e){this.options={...r,...e}}async get(e){return ee({...this.options,...e})}getVersion(){return"1.6.1"}includeComponent(e,t){j(e,t)}},exports.filterThumbmarkData=W,exports.getFingerprint=async function(e){try{const t=await ee(o);return e?{hash:t.thumbmark.toString(),data:t.components}:t.thumbmark.toString()}catch(e){throw e}},exports.getFingerprintData=async function(){return(await ee(o)).components},exports.getFingerprintPerformance=async function(){try{const{elapsed:e,resolvedComponents:t}=await te(B,o);return{...t,elapsed:e}}catch(e){throw e}},exports.getThumbmark=ee,exports.getVersion=U,exports.includeComponent=j,exports.setOption=function(e,t){o[e]=t},exports.stabilizationExclusionRules=i,exports.stableStringify=k;
//# sourceMappingURL=thumbmark.cjs.js.map