UNPKG

groupby-api

Version:

Client for the GroupBy Searchandiser API.

10 lines 34.1 kB
!function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}r(1).polyfill(),r(6),n(r(7)),n(r(17)),n(r(35)),n(r(16)),n(r(15))},function(t,e,r){var n;(function(t,i,o){/*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) * @license Licensed under MIT license * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE * @version 3.1.2 */ (function(){"use strict";function s(t){return"function"==typeof t||"object"==typeof t&&null!==t}function u(t){return"function"==typeof t}function a(t){z=t}function c(t){Y=t}function f(){return function(){t.nextTick(y)}}function l(){return function(){X(y)}}function p(){var t=0,e=new tt(y),r=document.createTextNode("");return e.observe(r,{characterData:!0}),function(){r.data=t=++t%2}}function h(){var t=new MessageChannel;return t.port1.onmessage=y,function(){t.port2.postMessage(0)}}function d(){return function(){setTimeout(y,1)}}function y(){for(var t=0;J>t;t+=2){var e=nt[t],r=nt[t+1];e(r),nt[t]=void 0,nt[t+1]=void 0}J=0}function g(){try{var t=r(4);return X=t.runOnLoop||t.runOnContext,l()}catch(e){return d()}}function v(t,e){var r=this,n=r._state;if(n===ut&&!t||n===at&&!e)return this;var i=new this.constructor(b),o=r._result;if(n){var s=arguments[n-1];Y(function(){k(n,i,s,o)})}else N(r,i,t,e);return i}function m(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var r=new e(b);return E(r,t),r}function b(){}function w(){return new TypeError("You cannot resolve a promise with itself")}function j(){return new TypeError("A promises callback cannot return that same promise.")}function x(t){try{return t.then}catch(e){return ct.error=e,ct}}function O(t,e,r,n){try{t.call(e,r,n)}catch(i){return i}}function A(t,e,r){Y(function(t){var n=!1,i=O(r,e,function(r){n||(n=!0,e!==r?E(t,r):P(t,r))},function(e){n||(n=!0,R(t,e))},"Settle: "+(t._label||" unknown promise"));!n&&i&&(n=!0,R(t,i))},t)}function _(t,e){e._state===ut?P(t,e._result):e._state===at?R(t,e._result):N(e,void 0,function(e){E(t,e)},function(e){R(t,e)})}function q(t,e,r){e.constructor===t.constructor&&r===it&&constructor.resolve===ot?_(t,e):r===ct?R(t,ct.error):void 0===r?P(t,e):u(r)?A(t,e,r):P(t,e)}function E(t,e){t===e?R(t,w()):s(e)?q(t,e,x(e)):P(t,e)}function S(t){t._onerror&&t._onerror(t._result),C(t)}function P(t,e){t._state===st&&(t._result=e,t._state=ut,0!==t._subscribers.length&&Y(C,t))}function R(t,e){t._state===st&&(t._state=at,t._result=e,Y(S,t))}function N(t,e,r,n){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+ut]=r,i[o+at]=n,0===o&&t._state&&Y(C,t)}function C(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n,i,o=t._result,s=0;s<e.length;s+=3)n=e[s],i=e[s+r],n?k(r,n,i,o):i(o);t._subscribers.length=0}}function T(){this.error=null}function B(t,e){try{return t(e)}catch(r){return ft.error=r,ft}}function k(t,e,r,n){var i,o,s,a,c=u(r);if(c){if(i=B(r,n),i===ft?(a=!0,o=i.error,i=null):s=!0,e===i)return void R(e,j())}else i=n,s=!0;e._state!==st||(c&&s?E(e,i):a?R(e,o):t===ut?P(e,i):t===at&&R(e,i))}function D(t,e){try{e(function(e){E(t,e)},function(e){R(t,e)})}catch(r){R(t,r)}}function U(t){return new gt(this,t).promise}function L(t){function e(t){E(i,t)}function r(t){R(i,t)}var n=this,i=new n(b);if(!$(t))return R(i,new TypeError("You must pass an array to race.")),i;for(var o=t.length,s=0;i._state===st&&o>s;s++)N(n.resolve(t[s]),void 0,e,r);return i}function F(t){var e=this,r=new e(b);return R(r,t),r}function H(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function I(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function M(t){this._id=dt++,this._state=void 0,this._result=void 0,this._subscribers=[],b!==t&&("function"!=typeof t&&H(),this instanceof M?D(this,t):I())}function Q(t,e){this._instanceConstructor=t,this.promise=new t(b),Array.isArray(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?P(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&P(this.promise,this._result))):R(this.promise,this._validationError())}function V(){var t;if("undefined"!=typeof i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=t.Promise;r&&"[object Promise]"===Object.prototype.toString.call(r.resolve())&&!r.cast||(t.Promise=yt)}var K;K=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var X,z,G,$=K,J=0,Y=function(t,e){nt[J]=t,nt[J+1]=e,J+=2,2===J&&(z?z(y):G())},W="undefined"!=typeof window?window:void 0,Z=W||{},tt=Z.MutationObserver||Z.WebKitMutationObserver,et="undefined"!=typeof t&&"[object process]"==={}.toString.call(t),rt="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,nt=new Array(1e3);G=et?f():tt?p():rt?h():void 0===W?g():d();var it=v,ot=m,st=void 0,ut=1,at=2,ct=new T,ft=new T,lt=U,pt=L,ht=F,dt=0,yt=M;M.all=lt,M.race=pt,M.resolve=ot,M.reject=ht,M._setScheduler=a,M._setAsap=c,M._asap=Y,M.prototype={constructor:M,then:it,"catch":function(t){return this.then(null,t)}};var gt=Q;Q.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},Q.prototype._enumerate=function(){for(var t=this.length,e=this._input,r=0;this._state===st&&t>r;r++)this._eachEntry(e[r],r)},Q.prototype._eachEntry=function(t,e){var r=this._instanceConstructor,n=r.resolve;if(n===ot){var i=x(t);if(i===it&&t._state!==st)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(r===yt){var o=new r(b);q(o,t,i),this._willSettleAt(o,e)}else this._willSettleAt(new r(function(e){e(t)}),e)}else this._willSettleAt(n(t),e)},Q.prototype._settledAt=function(t,e,r){var n=this.promise;n._state===st&&(this._remaining--,t===at?R(n,r):this._result[e]=r),0===this._remaining&&P(n,this._result)},Q.prototype._willSettleAt=function(t,e){var r=this;N(t,void 0,function(t){r._settledAt(ut,e,t)},function(t){r._settledAt(at,e,t)})};var vt=V,mt={Promise:yt,polyfill:vt};r(5).amd?(n=function(){return mt}.call(e,r,e,o),!(void 0!==n&&(o.exports=n))):"undefined"!=typeof o&&o.exports?o.exports=mt:"undefined"!=typeof this&&(this.ES6Promise=mt),vt()}).call(this)}).call(e,r(2),function(){return this}(),r(3)(t))},function(t,e){function r(){c&&s&&(c=!1,s.length?a=s.concat(a):f=-1,a.length&&n())}function n(){if(!c){var t=setTimeout(r);c=!0;for(var e=a.length;e;){for(s=a,a=[];++f<e;)s&&s[f].run();f=-1,e=a.length}s=null,c=!1,clearTimeout(t)}}function i(t,e){this.fun=t,this.array=e}function o(){}var s,u=t.exports={},a=[],c=!1,f=-1;u.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];a.push(new i(t,e)),1!==a.length||c||setTimeout(n,0)},i.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=o,u.addListener=o,u.once=o,u.off=o,u.removeListener=o,u.removeAllListeners=o,u.emit=o,u.binding=function(t){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(t){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){},function(t,e){t.exports=function(){throw new Error("define cannot be used indirect")}},function(t,e){!function(){Array.prototype.findIndex||(Array.prototype.findIndex=function(t){if(null===this)throw new TypeError("Array.prototype.findIndex called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,r=Object(this),n=r.length>>>0,i=arguments[1],o=0;n>o;o++)if(e=r[o],t.call(i,e,o,r))return o;return-1}),Array.prototype.fill||(Array.prototype.fill=function(t){if(null==this)throw new TypeError("this is null or not defined");for(var e=Object(this),r=e.length>>>0,n=arguments[1],i=n>>0,o=0>i?Math.max(r+i,0):Math.min(i,r),s=arguments[2],u=void 0===s?r:s>>0,a=0>u?Math.max(r+u,0):Math.min(u,r);a>o;)e[o]=t,o++;return e}),"function"!=typeof Object.assign&&(Object.assign=function(t){"use strict";if(null==t)throw new TypeError("Cannot convert undefined or null to object");t=Object(t);for(var e=1;e<arguments.length;e++){var r=arguments[e];if(null!=r)for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t})}()},function(t,e,r){"use strict";var n=r(8),i=r(12),o=r(15),s=r(16),u=function(){function t(t){void 0===t&&(t=""),this.request={},this.unprocessedNavigations=[],this.queryParams={},this.request.query=t,this.request.sort=[],this.request.fields=[],this.request.orFields=[],this.request.refinements=[],this.request.customUrlParams=[],this.request.includedNavigations=[],this.request.excludedNavigations=[],this.request.wildcardSearchEnabled=!1,this.request.pruneRefinements=!0}return t.prototype.withQuery=function(t){return this.request.query=t,this},t.prototype.withConfiguration=function(t){return Object.assign(this.request,t),this},t.prototype.withSelectedRefinements=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return(r=this.request.refinements).push.apply(r,t),this;var r},t.prototype.withoutSelectedRefinements=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r-0]=arguments[r];return e.forEach(function(e){var r=t.request.refinements.findIndex(function(t){return i(t,e)});r>-1&&t.request.refinements.splice(r,1)}),this},t.prototype.withRefinements=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=function(e){return Object.assign(e,{navigationName:t})};return(i=this.request.refinements).push.apply(i,e.map(n)),this;var i},t.prototype.withNavigations=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return(r=this.unprocessedNavigations).push.apply(r,t),this;var r},t.prototype.withCustomUrlParams=function(t){return"string"==typeof t?(e=this.request.customUrlParams).push.apply(e,this.convertParamString(t)):t instanceof Array&&(r=this.request.customUrlParams).push.apply(r,t),this;var e,r},t.prototype.convertParamString=function(t){var e=n.parse(t);return Object.keys(e).reduce(function(t,r){return t.concat({key:r,value:e[r]})},[])},t.prototype.withFields=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return(r=this.request.fields).push.apply(r,t),this;var r},t.prototype.withOrFields=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return(r=this.request.orFields).push.apply(r,t),this;var r},t.prototype.withSorts=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return(r=this.request.sort).push.apply(r,t),this;var r},t.prototype.withIncludedNavigations=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return(r=this.request.includedNavigations).push.apply(r,t),this;var r},t.prototype.withExcludedNavigations=function(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return(r=this.request.excludedNavigations).push.apply(r,t),this;var r},t.prototype.withQueryParams=function(t){switch(typeof t){case"string":return Object.assign(this,{queryParams:this.convertQueryString(t)});case"object":return Object.assign(this,{queryParams:t})}},t.prototype.convertQueryString=function(t){return n.parse(t)},t.prototype.refineByValue=function(t,e,r){return void 0===r&&(r=!1),this.withSelectedRefinements({navigationName:t,value:e,exclude:r,type:"Value"})},t.prototype.refineByRange=function(t,e,r,n){return void 0===n&&(n=!1),this.withSelectedRefinements({navigationName:t,low:e,high:r,exclude:n,type:"Range"})},t.prototype.restrictNavigation=function(t){return this.request.restrictNavigation=t,this},t.prototype.skip=function(t){return this.request.skip=t,this},t.prototype.withPageSize=function(t){return this.request.pageSize=t,this},t.prototype.withMatchStrategy=function(t){return this.request.matchStrategy=t,this},t.prototype.withBiasing=function(t){return this.request.biasing=t,this},t.prototype.enableWildcardSearch=function(){return this.request.wildcardSearchEnabled=!0,this},t.prototype.disableAutocorrection=function(){return this.request.disableAutocorrection=!0,this},t.prototype.disableBinaryPayload=function(){return this.request.returnBinary=!1,this},t.prototype.allowPrunedRefinements=function(){return this.request.pruneRefinements=!1,this},t.prototype.build=function(){var t=Object.assign(new o.Request,this.request);return(e=t.refinements).push.apply(e,s.NavigationConverter.convert(this.unprocessedNavigations)),this.clearEmptyArrays(t);var e},t.prototype.clearEmptyArrays=function(t){for(var e in t)t[e]instanceof Array&&0===t[e].length&&delete t[e];return t},t}();e.Query=u},function(t,e,r){"use strict";var n=r(9),i=r(11);t.exports={stringify:n,parse:i}},function(t,e,r){"use strict";var n=r(10),i={delimiter:"&",arrayPrefixGenerators:{brackets:function(t){return t+"[]"},indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},strictNullHandling:!1,skipNulls:!1,encode:!0};i.stringify=function(t,e,r,o,s,u,a,c,f){var l=t;if("function"==typeof a)l=a(e,l);else if(n.isBuffer(l))l=String(l);else if(l instanceof Date)l=l.toISOString();else if(null===l){if(o)return u?n.encode(e):e;l=""}if("string"==typeof l||"number"==typeof l||"boolean"==typeof l)return u?[n.encode(e)+"="+n.encode(l)]:[e+"="+l];var p=[];if("undefined"==typeof l)return p;var h;if(Array.isArray(a))h=a;else{var d=Object.keys(l);h=c?d.sort(c):d}for(var y=0;y<h.length;++y){var g=h[y];s&&null===l[g]||(p=Array.isArray(l)?p.concat(i.stringify(l[g],r(e,g),r,o,s,u,a,c,f)):p.concat(i.stringify(l[g],e+(f?"."+g:"["+g+"]"),r,o,s,u,a,c,f)))}return p},t.exports=function(t,e){var r,n,o=t,s=e||{},u="undefined"==typeof s.delimiter?i.delimiter:s.delimiter,a="boolean"==typeof s.strictNullHandling?s.strictNullHandling:i.strictNullHandling,c="boolean"==typeof s.skipNulls?s.skipNulls:i.skipNulls,f="boolean"==typeof s.encode?s.encode:i.encode,l="function"==typeof s.sort?s.sort:null,p="undefined"==typeof s.allowDots?!1:s.allowDots;"function"==typeof s.filter?(n=s.filter,o=n("",o)):Array.isArray(s.filter)&&(r=n=s.filter);var h=[];if("object"!=typeof o||null===o)return"";var d;d=s.arrayFormat in i.arrayPrefixGenerators?s.arrayFormat:"indices"in s?s.indices?"indices":"repeat":"indices";var y=i.arrayPrefixGenerators[d];r||(r=Object.keys(o)),l&&r.sort(l);for(var g=0;g<r.length;++g){var v=r[g];c&&null===o[v]||(h=h.concat(i.stringify(o[v],v,y,a,c,f,n,l,p)))}return h.join(u)}},function(t,e){"use strict";var r=function(){for(var t=new Array(256),e=0;256>e;++e)t[e]="%"+((16>e?"0":"")+e.toString(16)).toUpperCase();return t}();e.arrayToObject=function(t,e){for(var r=e.plainObjects?Object.create(null):{},n=0;n<t.length;++n)"undefined"!=typeof t[n]&&(r[n]=t[n]);return r},e.merge=function(t,r,n){if(!r)return t;if("object"!=typeof r){if(Array.isArray(t))t.push(r);else{if("object"!=typeof t)return[t,r];t[r]=!0}return t}if("object"!=typeof t)return[t].concat(r);var i=t;return Array.isArray(t)&&!Array.isArray(r)&&(i=e.arrayToObject(t,n)),Object.keys(r).reduce(function(t,i){var o=r[i];return Object.prototype.hasOwnProperty.call(t,i)?t[i]=e.merge(t[i],o,n):t[i]=o,t},i)},e.decode=function(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t}},e.encode=function(t){if(0===t.length)return t;for(var e="string"==typeof t?t:String(t),n="",i=0;i<e.length;++i){var o=e.charCodeAt(i);45===o||46===o||95===o||126===o||o>=48&&57>=o||o>=65&&90>=o||o>=97&&122>=o?n+=e.charAt(i):128>o?n+=r[o]:2048>o?n+=r[192|o>>6]+r[128|63&o]:55296>o||o>=57344?n+=r[224|o>>12]+r[128|o>>6&63]+r[128|63&o]:(i+=1,o=65536+((1023&o)<<10|1023&e.charCodeAt(i)),n+=r[240|o>>18]+r[128|o>>12&63]+r[128|o>>6&63]+r[128|63&o])}return n},e.compact=function(t,r){if("object"!=typeof t||null===t)return t;var n=r||[],i=n.indexOf(t);if(-1!==i)return n[i];if(n.push(t),Array.isArray(t)){for(var o=[],s=0;s<t.length;++s)"undefined"!=typeof t[s]&&o.push(t[s]);return o}for(var u=Object.keys(t),a=0;a<u.length;++a){var c=u[a];t[c]=e.compact(t[c],n)}return t},e.isRegExp=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},e.isBuffer=function(t){return null===t||"undefined"==typeof t?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}},function(t,e,r){"use strict";var n=r(10),i={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3,strictNullHandling:!1,plainObjects:!1,allowPrototypes:!1,allowDots:!1};i.parseValues=function(t,e){for(var r={},i=t.split(e.delimiter,e.parameterLimit===1/0?void 0:e.parameterLimit),o=0;o<i.length;++o){var s=i[o],u=-1===s.indexOf("]=")?s.indexOf("="):s.indexOf("]=")+1;if(-1===u)r[n.decode(s)]="",e.strictNullHandling&&(r[n.decode(s)]=null);else{var a=n.decode(s.slice(0,u)),c=n.decode(s.slice(u+1));Object.prototype.hasOwnProperty.call(r,a)?r[a]=[].concat(r[a]).concat(c):r[a]=c}}return r},i.parseObject=function(t,e,r){if(!t.length)return e;var n,o=t.shift();if("[]"===o)n=[],n=n.concat(i.parseObject(t,e,r));else{n=r.plainObjects?Object.create(null):{};var s="["===o[0]&&"]"===o[o.length-1]?o.slice(1,o.length-1):o,u=parseInt(s,10);!isNaN(u)&&o!==s&&String(u)===s&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(n=[],n[u]=i.parseObject(t,e,r)):n[s]=i.parseObject(t,e,r)}return n},i.parseKeys=function(t,e,r){if(t){var n=r.allowDots?t.replace(/\.([^\.\[]+)/g,"[$1]"):t,o=/^([^\[\]]*)/,s=/(\[[^\[\]]*\])/g,u=o.exec(n),a=[];if(u[1]){if(!r.plainObjects&&Object.prototype.hasOwnProperty(u[1])&&!r.allowPrototypes)return;a.push(u[1])}for(var c=0;null!==(u=s.exec(n))&&c<r.depth;)c+=1,(r.plainObjects||!Object.prototype.hasOwnProperty(u[1].replace(/\[|\]/g,""))||r.allowPrototypes)&&a.push(u[1]);return u&&a.push("["+n.slice(u.index)+"]"),i.parseObject(a,e,r)}},t.exports=function(t,e){var r=e||{};if(r.delimiter="string"==typeof r.delimiter||n.isRegExp(r.delimiter)?r.delimiter:i.delimiter,r.depth="number"==typeof r.depth?r.depth:i.depth,r.arrayLimit="number"==typeof r.arrayLimit?r.arrayLimit:i.arrayLimit,r.parseArrays=r.parseArrays!==!1,r.allowDots="boolean"==typeof r.allowDots?r.allowDots:i.allowDots,r.plainObjects="boolean"==typeof r.plainObjects?r.plainObjects:i.plainObjects,r.allowPrototypes="boolean"==typeof r.allowPrototypes?r.allowPrototypes:i.allowPrototypes,r.parameterLimit="number"==typeof r.parameterLimit?r.parameterLimit:i.parameterLimit,r.strictNullHandling="boolean"==typeof r.strictNullHandling?r.strictNullHandling:i.strictNullHandling,""===t||null===t||"undefined"==typeof t)return r.plainObjects?Object.create(null):{};for(var o="string"==typeof t?i.parseValues(t,r):t,s=r.plainObjects?Object.create(null):{},u=Object.keys(o),a=0;a<u.length;++a){var c=u[a],f=i.parseKeys(c,o[c],r);s=n.merge(s,f,r)}return n.compact(s)}},function(t,e,r){function n(t){return null===t||void 0===t}function i(t){return t&&"object"==typeof t&&"number"==typeof t.length?"function"!=typeof t.copy||"function"!=typeof t.slice?!1:!(t.length>0&&"number"!=typeof t[0]):!1}function o(t,e,r){var o,f;if(n(t)||n(e))return!1;if(t.prototype!==e.prototype)return!1;if(a(t))return a(e)?(t=s.call(t),e=s.call(e),c(t,e,r)):!1;if(i(t)){if(!i(e))return!1;if(t.length!==e.length)return!1;for(o=0;o<t.length;o++)if(t[o]!==e[o])return!1;return!0}try{var l=u(t),p=u(e)}catch(h){return!1}if(l.length!=p.length)return!1;for(l.sort(),p.sort(),o=l.length-1;o>=0;o--)if(l[o]!=p[o])return!1;for(o=l.length-1;o>=0;o--)if(f=l[o],!c(t[f],e[f],r))return!1;return typeof t==typeof e}var s=Array.prototype.slice,u=r(13),a=r(14),c=t.exports=function(t,e,r){return r||(r={}),t===e?!0:t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||"object"!=typeof t&&"object"!=typeof e?r.strict?t===e:t==e:o(t,e,r)}},function(t,e){function r(t){var e=[];for(var r in t)e.push(r);return e}e=t.exports="function"==typeof Object.keys?Object.keys:r,e.shim=r},function(t,e){function r(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function n(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}var i="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();e=t.exports=i?r:n,e.supported=r,e.unsupported=n},function(t,e){"use strict";var r=function(){function t(){}return t}();e.Request=r},function(t,e){"use strict";var r=function(){function t(){}return t.convert=function(t){return t.reduce(function(t,e){return e.refinements.forEach(function(r){return t.push(Object.assign(r,{navigationName:e.name}))}),t},[])},t}();e.NavigationConverter=r},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(18),o=r(7),s="/search",u="/refinements",a="/refinement",c="/cluster",f=function(){function t(){}return t.prototype.search=function(t,e){void 0===e&&(e=void 0);var r=this.extractRequest(t),n=r[0],i=r[1];if(null===n)return this.generateError("query was not of a recognised type",e);var o=this.fireRequest(this.bridgeUrl,n,i);return e?void o.then(function(t){return e(void 0,t)})["catch"](function(t){return e(t)}):o},t.prototype.extractRequest=function(t){switch(typeof t){case"string":return[new o.Query(t).build(),{}];case"object":return t instanceof o.Query?[t.build(),t.queryParams]:[t,{}];default:return[null,null]}},t.prototype.generateError=function(t,e){var r=new Error(t);return e?void e(r):Promise.reject(r)},t.prototype.fireRequest=function(t,e,r){var n=this,o={url:this.bridgeUrl,method:"post",params:r,data:this.augmentRequest(e),responseType:"json",timeout:1500};return i(o).then(function(t){return t.data}).then(function(t){return t.records?Object.assign(t,{records:t.records.map(n.convertRecordFields)}):t})},t.prototype.convertRecordFields=function(t){var e=Object.assign(t,{id:t._id,url:t._u,title:t._t});return delete e._id,e._u,e._t,t._snippet&&(e.snippet=t._snippet,delete e._snippet),e},t}();e.AbstractBridge=f;var l=function(t){function e(e,r){t.call(this),this.clientKey=e,this.bridgeRefinementsUrl=null,this.bridgeRefinementsSearchUrl=null,this.bridgeClusterUrl=null;var n="https://"+r+".groupbycloud.com:443/api/v1";this.bridgeUrl=n+s,this.bridgeRefinementsUrl=n+u,this.bridgeRefinementsSearchUrl=n+a,this.bridgeClusterUrl=n+c}return n(e,t),e.prototype.augmentRequest=function(t){return Object.assign(t,{clientKey:this.clientKey})},e}(f);e.CloudBridge=l;var p=function(t){function e(e){t.call(this),this.bridgeUrl="http://ecomm.groupbycloud.com/semanticSearch/"+e}return n(e,t),e.prototype.augmentRequest=function(t){return t},e}(f);e.BrowserBridge=p},function(t,e,r){t.exports=r(19)},function(t,e,r){"use strict";function n(t){this.defaults=o.merge({},t),this.interceptors={request:new u,response:new u}}var i=r(20),o=r(21),s=r(22),u=r(30),a=r(31),c=r(32),f=r(33),l=r(26);n.prototype.request=function(t){"string"==typeof t&&(t=o.merge({url:arguments[0]},arguments[1])),t=o.merge(i,this.defaults,{method:"get"},t),t.baseURL&&!a(t.url)&&(t.url=c(t.baseURL,t.url)),t.withCredentials=t.withCredentials||this.defaults.withCredentials,t.data=l(t.data,t.headers,t.transformRequest),t.headers=o.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]});var e=[s,void 0],r=Promise.resolve(t);for(this.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),this.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)r=r.then(e.shift(),e.shift());return r};var p=new n(i),h=t.exports=f(n.prototype.request,p);h.create=function(t){return new n(t)},h.defaults=p.defaults,h.all=function(t){return Promise.all(t)},h.spread=r(34),h.interceptors=p.interceptors,o.forEach(["delete","get","head"],function(t){n.prototype[t]=function(e,r){return this.request(o.merge(r||{},{method:t,url:e}))},h[t]=f(n.prototype[t],p)}),o.forEach(["post","put","patch"],function(t){n.prototype[t]=function(e,r,n){return this.request(o.merge(n||{},{method:t,url:e,data:r}))},h[t]=f(n.prototype[t],p)})},function(t,e,r){"use strict";var n=r(21),i=/^\)\]\}',?\n/,o={"Content-Type":"application/x-www-form-urlencoded"};t.exports={transformRequest:[function(t,e){return n.isFormData(t)?t:n.isArrayBuffer(t)?t:n.isArrayBufferView(t)?t.buffer:!n.isObject(t)||n.isFile(t)||n.isBlob(t)?t:(n.isUndefined(e)||(n.forEach(e,function(t,r){"content-type"===r.toLowerCase()&&(e["Content-Type"]=t)}),n.isUndefined(e["Content-Type"])&&(e["Content-Type"]="application/json;charset=utf-8")),JSON.stringify(t))}],transformResponse:[function(t){if("string"==typeof t){t=t.replace(i,"");try{t=JSON.parse(t)}catch(e){}}return t}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:n.merge(o),post:n.merge(o),put:n.merge(o)},timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(t,e){"use strict";function r(t){return"[object Array]"===v.call(t)}function n(t){return"[object ArrayBuffer]"===v.call(t)}function i(t){return"[object FormData]"===v.call(t)}function o(t){var e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer}function s(t){return"string"==typeof t}function u(t){return"number"==typeof t}function a(t){return"undefined"==typeof t}function c(t){return null!==t&&"object"==typeof t}function f(t){return"[object Date]"===v.call(t)}function l(t){return"[object File]"===v.call(t)}function p(t){return"[object Blob]"===v.call(t)}function h(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function d(){return"undefined"!=typeof window&&"undefined"!=typeof document&&"function"==typeof document.createElement}function y(t,e){if(null!==t&&"undefined"!=typeof t)if("object"==typeof t||r(t)||(t=[t]),r(t))for(var n=0,i=t.length;i>n;n++)e.call(null,t[n],n,t);else for(var o in t)t.hasOwnProperty(o)&&e.call(null,t[o],o,t)}function g(){function t(t,r){"object"==typeof e[r]&&"object"==typeof t?e[r]=g(e[r],t):e[r]=t}for(var e={},r=0,n=arguments.length;n>r;r++)y(arguments[r],t);return e}var v=Object.prototype.toString;t.exports={isArray:r,isArrayBuffer:n,isFormData:i,isArrayBufferView:o,isString:s,isNumber:u,isObject:c,isUndefined:a,isDate:f,isFile:l,isBlob:p,isStandardBrowserEnv:d,forEach:y,merge:g,trim:h}},function(t,e,r){(function(e){"use strict";t.exports=function(t){return new Promise(function(n,i){try{var o;"function"==typeof t.adapter?o=t.adapter:"undefined"!=typeof XMLHttpRequest?o=r(23):"undefined"!=typeof e&&(o=r(23)),"function"==typeof o&&o(n,i,t)}catch(s){i(s)}})}}).call(e,r(2))},function(t,e,r){"use strict";var n=r(21),i=r(24),o=r(25),s=r(26),u=r(27),a=window.btoa||r(28);t.exports=function(t,e,c){var f=c.data,l=c.headers;n.isFormData(f)&&delete l["Content-Type"];var p=new XMLHttpRequest;if(!window.XDomainRequest||"withCredentials"in p||u(c.url)||(p=new window.XDomainRequest),c.auth){var h=c.auth.username||"",d=c.auth.password||"";l.Authorization="Basic "+a(h+":"+d)}if(p.open(c.method.toUpperCase(),i(c.url,c.params,c.paramsSerializer),!0),p.timeout=c.timeout,p.onload=function(){if(p){var r="getAllResponseHeaders"in p?o(p.getAllResponseHeaders()):null,n=-1!==["text",""].indexOf(c.responseType||"")?p.responseText:p.response,i={data:s(n,r,c.transformResponse),status:1223===p.status?204:p.status,statusText:1223===p.status?"No Content":p.statusText,headers:r,config:c};(i.status>=200&&i.status<300||!("status"in p)&&i.responseText?t:e)(i),p=null}},p.onerror=function(){e(new Error("Network Error")),p=null},n.isStandardBrowserEnv()){var y=r(29),g=c.withCredentials||u(c.url)?y.read(c.xsrfCookieName):void 0;g&&(l[c.xsrfHeaderName]=g)}if("setRequestHeader"in p&&n.forEach(l,function(t,e){"undefined"==typeof f&&"content-type"===e.toLowerCase()?delete l[e]:p.setRequestHeader(e,t)}),c.withCredentials&&(p.withCredentials=!0),c.responseType)try{p.responseType=c.responseType}catch(v){if("json"!==p.responseType)throw v}n.isArrayBuffer(f)&&(f=new DataView(f)),p.send(f)}},function(t,e,r){"use strict";function n(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var i=r(21);t.exports=function(t,e,r){if(!e)return t;var o;if(r)o=r(e);else{var s=[];i.forEach(e,function(t,e){null!==t&&"undefined"!=typeof t&&(i.isArray(t)&&(e+="[]"),i.isArray(t)||(t=[t]),i.forEach(t,function(t){i.isDate(t)?t=t.toISOString():i.isObject(t)&&(t=JSON.stringify(t)),s.push(n(e)+"="+n(t))}))}),o=s.join("&")}return o&&(t+=(-1===t.indexOf("?")?"?":"&")+o),t}},function(t,e,r){"use strict";var n=r(21);t.exports=function(t){var e,r,i,o={};return t?(n.forEach(t.split("\n"),function(t){i=t.indexOf(":"),e=n.trim(t.substr(0,i)).toLowerCase(),r=n.trim(t.substr(i+1)),e&&(o[e]=o[e]?o[e]+", "+r:r)}),o):o}},function(t,e,r){"use strict";var n=r(21);t.exports=function(t,e,r){return n.forEach(r,function(r){t=r(t,e)}),t}},function(t,e,r){"use strict";var n=r(21);t.exports=n.isStandardBrowserEnv()?function(){function t(t){var e=t;return r&&(i.setAttribute("href",e),e=i.href),i.setAttribute("href",e),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:"/"===i.pathname.charAt(0)?i.pathname:"/"+i.pathname}}var e,r=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");return e=t(window.location.href),function(r){var i=n.isString(r)?t(r):r;return i.protocol===e.protocol&&i.host===e.host}}():function(){return function(){return!0}}()},function(t,e){"use strict";function r(t){this.message=t}function n(t){for(var e,n,o=String(t),s="",u=0,a=i;o.charAt(0|u)||(a="=",u%1);s+=a.charAt(63&e>>8-u%1*8)){if(n=o.charCodeAt(u+=.75),n>255)throw new r("INVALID_CHARACTER_ERR: DOM Exception 5");e=e<<8|n}return s}var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.prototype=new Error,r.prototype.code=5,r.prototype.name="InvalidCharacterError",t.exports=n},function(t,e,r){"use strict";var n=r(21);t.exports=n.isStandardBrowserEnv()?function(){return{write:function(t,e,r,i,o,s){var u=[];u.push(t+"="+encodeURIComponent(e)),n.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),n.isString(i)&&u.push("path="+i),n.isString(o)&&u.push("domain="+o),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(t,e,r){"use strict";function n(){this.handlers=[]}var i=r(21);n.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},n.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},n.prototype.forEach=function(t){i.forEach(this.handlers,function(e){null!==e&&t(e)})},t.exports=n},function(t,e){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},function(t,e){"use strict";t.exports=function(t,e){return t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,"")}},function(t,e){"use strict";t.exports=function(t,e){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return t.apply(e,r)}}},function(t,e){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},function(t,e,r){"use strict";var n=r(7),i=r(17),o=r(36),s=function(){function t(t,e){void 0===e&&(e={}),this.originalQuery="",this.bridge=new i.BrowserBridge(t),this.query=(new n.Query).withConfiguration(e)}return t.prototype.nextPage=function(){return new o.Pager(this).next()},t.prototype.lastPage=function(){return new o.Pager(this).last()},t.prototype.search=function(t){var e=this;return void 0===t&&(t=this.originalQuery),this.bridge.search(this.query.withQuery(t)).then(function(r){e.results=r,e.originalQuery=t})},t.prototype.reset=function(){return this.query=new n.Query(this.originalQuery),this.search(); },t.prototype.refine=function(t){return this.query.withSelectedRefinements(t),this.search()},t.prototype.unrefine=function(t){return this.query.withoutSelectedRefinements(t),this.search()},t}();e.FluxCapacitor=s},function(t,e){"use strict";var r=function(){function t(t){this.flux=t}return t.prototype.next=function(){return this.paginate(!0,this.hasNext)},t.prototype.last=function(){return this.paginate(!1,this.hasPrevious)},t.prototype.paginate=function(t,e){var r=this.step(t);return e?(this.flux.query.skip(r),this.flux.search()):Promise.reject(new Error("already on "+(t?"last":"first")+" page"))},Object.defineProperty(t.prototype,"hasNext",{get:function(){return this.step(!0)<this.total},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasPrevious",{get:function(){return 0!==this.lastStep},enumerable:!0,configurable:!0}),t.prototype.step=function(t){var e=this.flux.results.records.length,r=this.lastStep+(t?e:-e);return r>=0?r:0},Object.defineProperty(t.prototype,"lastStep",{get:function(){return this.flux.results.pageInfo.recordStart-1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"total",{get:function(){return this.flux.results.totalRecordCount},enumerable:!0,configurable:!0}),t}();e.Pager=r}]); //# sourceMappingURL=groupby-api-1.0.21.min.js.map