LocalCDN-Firefox-Chrome-Brave/resources/search-insights/1.8.0/search-insights.min.jsm

2 lines
11 KiB
JavaScript
Raw Normal View History

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).AlgoliaAnalytics={})}(this,function(e){"use strict";var t=function(){try{return Boolean(navigator.cookieEnabled)}catch(e){return!1}},r=function(){try{return Boolean(navigator.sendBeacon)}catch(e){return!1}},n=function(){try{return Boolean(XMLHttpRequest)}catch(e){return!1}},o=function(e){return void 0===e},i=function(e){return"string"==typeof e},s=function(e){return"number"==typeof e},a=function(e){return"function"==typeof e};var c="insights-js (1.8.0)";var u=["de","us"],h=2592e6;var p,f,l,d,w=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},b="_ALGOLIA",y=function(e,t,r){var n=new Date;n.setTime(n.getTime()+r);var o="expires="+n.toUTCString();document.cookie=e+"="+t+";"+o+";path=/"},v=function(e){for(var t=e+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){for(var o=r[n];" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return""};Object.keys||(Object.keys=(p=Object.prototype.hasOwnProperty,f=!{toString:null}.propertyIsEnumerable("toString"),d=(l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(e){if("function"!=typeof e&&("object"!=typeof e||null===e))throw new TypeError("Object.keys called on non-object");var t,r,n=[];for(t in e)p.call(e,t)&&n.push(t);if(f)for(r=0;r<d;r++)p.call(e,l[r])&&n.push(l[r]);return n})),"function"!=typeof Object.assign&&(Object.assign=function(e,t){var r=arguments;if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),o=1;o<arguments.length;o++){var i=r[o];if(null!=i)for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])}return n});var g=function(e){var r=e.requestFn;this._ua="",this._uaURIEncoded="",this.version="1.8.0",this._hasCredentials=!1,this.sendEvent=function(e){return function(t,r){if(!this._userHasOptedOut){if(!this._hasCredentials)throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters");if(""===r.userToken||""===this._userToken)throw new Error("`userToken` cannot be an empty string.");var n=r.userToken||this._userToken;if(o(n))throw new Error("Before calling any methods on the analytics, you first need to call 'setUserToken' function or include 'userToken' in the event payload.");if(!i(r.index))throw new TypeError("expected required parameter `index` to be a string");if(!i(r.eventName))throw new TypeError("expected required parameter `eventName` to be a string");if(!o(r.userToken)&&!i(r.userToken))throw new TypeError("expected optional parameter `userToken` to be a string");var a={eventType:t,eventName:r.eventName,userToken:n,index:r.index};if(!o(r.timestamp)){if(!s(r.timestamp))throw new TypeError("expected optional parameter `timestamp` to be a number");a.timestamp=r.timestamp}if(!o(r.queryID)){if(!i(r.queryID))throw new TypeError("expected optional parameter `queryID` to be a string");a.queryID=r.queryID}if(!o(r.objectIDs)){if(!Array.isArray(r.objectIDs))throw new TypeError("expected optional parameter `objectIDs` to be an array");a.objectIDs=r.objectIDs}if(!o(r.positions)){if(!Array.isArray(r.positions))throw new TypeError("expected optional parameter `positions` to be an array");if(o(r.objectIDs))throw new Error("cannot use `positions` without providing `objectIDs`");if(r.objectIDs.length!==r.positions.length)throw new Error("objectIDs and positions need to be of the same size");a.positions=r.positions}if(!o(r.filters)){if(!o(r.objectIDs))throw new Error("cannot use `objectIDs` and `filters` for the same event");if(!Array.isArray(r.filters))throw new TypeError("expected optional parameter `filters` to be an array");a.filters=r.filters}if(o(r.objectIDs)&&o(r.filters))throw new Error("expected either `objectIDs` or `filters` to be provided");return function(e,t,r,n,o,i