UNPKG

contensis-delivery-api

Version:

Client for retrieving content using the read-only Contensis Delivery API

1 lines 6.19 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){return"function"==typeof t}function e(){var t=setTimeout;return function(){return t(n,1)}}function n(){for(var t=0;t<m;t+=2)(0,M[t])(M[t+1]),M[t]=void 0,M[t+1]=void 0;m=0}function r(t,e){var n=this,r=new this.constructor(i);void 0===r[x]&&v(r);var o=n._state;if(o){var s=arguments[o-1];g(function(){return p(o,r,s,n._result)})}else l(n,r,t,e);return r}function o(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(i);return u(e,t),e}function i(){}function s(e,n,i){n.constructor===e.constructor&&i===r&&n.constructor.resolve===o?function(t,e){e._state===O?a(t,e._result):e._state===F?f(t,e._result):l(e,void 0,function(e){return u(t,e)},function(e){return f(t,e)})}(e,n):void 0===i?a(e,n):t(i)?function(t,e,n){g(function(t){var r=!1,o=function(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}(n,e,function(n){r||(r=!0,e!==n?u(t,n):a(t,n))},function(e){r||(r=!0,f(t,e))},t._label);!r&&o&&(r=!0,f(t,o))},t)}(e,n,i):a(e,n)}function u(t,e){if(t===e)f(t,new TypeError("You cannot resolve a promise with itself"));else if(function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}(e)){var n=void 0;try{n=e.then}catch(e){return void f(t,e)}s(t,e,n)}else a(t,e)}function c(t){t._onerror&&t._onerror(t._result),h(t)}function a(t,e){t._state===C&&(t._result=e,t._state=O,0!==t._subscribers.length&&g(h,t))}function f(t,e){t._state===C&&(t._state=F,t._result=e,g(c,t))}function l(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+O]=n,o[i+F]=r,0===i&&t._state&&g(h,t)}function h(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?p(n,r,o,i):o(i);t._subscribers.length=0}}function p(e,n,r,o){var i=t(r),s=void 0,c=void 0,l=!0;if(i){try{s=r(o)}catch(t){l=!1,c=t}if(n===s)return void f(n,new TypeError("A promises callback cannot return that same promise."))}else s=o;n._state!==C||(i&&l?u(n,s):!1===l?f(n,c):e===O?a(n,s):e===F&&f(n,s))}function v(t){t[x]=Y++,t._state=void 0,t._result=void 0,t._subscribers=[]}var d;d=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var _,y=d,m=0,b=void 0,w=void 0,g=function(t,e){M[m]=t,M[m+1]=e,2===(m+=2)&&(w?w(n):P())},A="undefined"!=typeof window?window:void 0,j=A||{},S=j.MutationObserver||j.WebKitMutationObserver,E="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),T="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,M=new Array(1e3),P=void 0;P=E?function(){return process.nextTick(n)}:S?function(){var t=0,e=new S(n),r=document.createTextNode("");return e.observe(r,{characterData:!0}),function(){r.data=t=++t%2}}():T?((_=new MessageChannel).port1.onmessage=n,function(){return _.port2.postMessage(0)}):void 0===A&&"function"==typeof require?function(){try{var t=Function("return this")().require("vertx");return void 0!==(b=t.runOnLoop||t.runOnContext)?function(){b(n)}:e()}catch(t){return e()}}():e();var x=Math.random().toString(36).substring(2),C=void 0,O=1,F=2,Y=0,k=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(i),this.promise[x]||v(this.promise),y(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?a(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&a(this.promise,this._result))):f(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===C&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,u=n.resolve;if(u===o){var c=void 0,a=void 0,l=!1;try{c=t.then}catch(t){l=!0,a=t}if(c===r&&t._state!==C)this._settledAt(t._state,e,t._result);else if("function"!=typeof c)this._remaining--,this._result[e]=t;else if(n===q){var h=new n(i);l?f(h,a):s(h,t,c),this._willSettleAt(h,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(u(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===C&&(this._remaining--,t===F?f(r,n):this._result[e]=n),0===this._remaining&&a(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;l(t,void 0,function(t){return n._settledAt(O,e,t)},function(t){return n._settledAt(F,e,t)})},t}(),q=function(){function e(t){this[x]=Y++,this._result=this._state=void 0,this._subscribers=[],i!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(t,e){try{e(function(e){u(t,e)},function(e){f(t,e)})}catch(e){f(t,e)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var n=this,r=n.constructor;return t(e)?n.then(function(t){return r.resolve(e()).then(function(){return t})},function(t){return r.resolve(e()).then(function(){throw t})}):n.then(e,e)},e}();return q.prototype.then=r,q.all=function(t){return new k(this,t).promise},q.race=function(t){var e=this;return new e(y(t)?function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})},q.resolve=o,q.reject=function(t){var e=new this(i);return f(e,t),e},q._setScheduler=function(t){w=t},q._setAsap=function(t){g=t},q._asap=g,q.polyfill=function(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=q},q.Promise=q,q.polyfill(),q});