1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-03-11 17:10:09 +01:00

2 lines
8.7 KiB
JavaScript
Raw Normal View History

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).AlgoliaAnalytics={})}(this,function(e){"use strict";var n="2.8.2";function o(e){return e.reduce(function(e,n){var t=e.events,e=e.additionalParams;return"index"in n?{additionalParams:e,events:t.concat([n])}:{events:t,additionalParams:n}},{events:[],additionalParams:void 0})}function t(){try{return Boolean(navigator.cookieEnabled)}catch(e){return}}function l(e){return void 0===e}function r(e){return"number"==typeof e}function s(e){return"function"==typeof e}function i(e){var t,i,n=e.AlgoliaAnalyticsObject;n&&(i=this,t=function(e){for(var n=[],t=arguments.length-1;0<t--;)n[t]=arguments[t+1];e&&s(i[e])?i[e].apply(i,n):console.warn("The method `"+e+"` doesn't exist.")},(e=e[n]).queue=e.queue||[],(n=e.queue).forEach(function(e){var e=[].slice.call(e),n=e[0],e=e.slice(1);t.apply(void 0,[n].concat(e))}),n.push=function(e){var e=[].slice.call(e),n=e[0],e=e.slice(1);t.apply(void 0,[n].concat(e))})}var a=["insights-js ("+n+")","insights-js-browser-umd ("+n+")"];function f(e,n){var t={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,o=Object.getOwnPropertySymbols(e);i<o.length;i++)n.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(t[o[i]]=e[o[i]]);return t}function u(h){return function(e,n){var i=this;if(!this._userHasOptedOut){if(!(!l(this._apiKey)&&!l(this._appId)||(null==(d=null==n?void 0:n.headers)?void 0:d["X-Algolia-Application-Id"])&&(null==(d=null==n?void 0:n.headers)?void 0:d["X-Algolia-API-Key"])))throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters or provide custom credentials in additional parameters.");!this._userToken&&this._anonymousUserToken&&this.setAnonymousUserToken(!0);var t,o,s,r,a,u,c,d=e.map(function(e){var n=e.filters,t=f(e,["filters"]),e=Object.assign(Object.assign({},t),{userToken:null!=(t=null==e?void 0:e.userToken)?t:i._userToken});return l(n)||(e.filters=n.map(encodeURIComponent)),e});return e=h,t=this._ua,o=this._endpointOrigin,d=d,s=this._appId,r=this._apiKey,n=null==n?void 0:n.headers,a=(n=void 0===n?{}:n)["X-Algolia-Application-Id"],u=n["X-Algolia-API-Key"],n=f(n,["X-Algolia-Application-Id","X-Algolia-API-Key"]),c=Object.assign({"X-Algolia-Application-Id":null!=a?a:s,"X-Algolia-API-Key":null!=u?u:r,"X-Algolia-Agent":encodeURIComponent(t.join("; "))},n),a=Object.keys(c).map(function(e){return e+"="+c[e]}).join("&"),e(o+"/1/events?"+a,{events:d})}}}function c(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)})}function d(e,n,t){var i=new Date,t=(i.setTime(i.getTime()+t),"expires="+i.toUTCString());document.cookie=e+"="+n+";"+t+";path=/"}function h(e){for(var n=e+"=",t=document.cookie.split(";"),i=0;i<t.length;i++){for(var o=t[i];" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(n))return o.substring(n.length,o.length)}return""}var v="_ALGOLIA",p=2592e6;function g(n,e){return e.map(function(e){return Object.assign({eventType:n},e)})}function b(n,t,e){return e.map(function(e){return Object.assign({eventType:n,eventSubtype:t},e)})}var k=["de","us"];function y(e){if(!l((e=void 0===e?{}:e).region)&&-1===k.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+k.join(", ")+".");if(!(l(e.cookieDuration)||r(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");var n=this,t=e,i={_userHasOptedOut:Boolean(e.userHasOptedOut),_region:e.region,_host:e.host,_anonymousUserToken:null==(i=e.anonymousUserToken)||i,_useCookie:null!=(i=e.useCookie)&&i,_cookieDuration:e.cookieDuration||6*p},o=t.partial,s=f(t,["partial"]);o||Object.assign(n,i),Object.assign(n,Object.keys(s).r