LocalCDN-Firefox-Chrome-Brave/resources/vue-resource/1.5.3/vue-resource.min.jsm

7 lines
15 KiB
JavaScript
Raw Normal View History

/*!
* vue-resource v1.5.3
* https://github.com/pagekit/vue-resource
* Released under the MIT License.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueResource=e()}(this,function(){"use strict";function s(t){this.state=2,this.value=void 0,this.deferred=[];var e=this;try{t(function(t){e.resolve(t)},function(t){e.reject(t)})}catch(t){e.reject(t)}}s.reject=function(n){return new s(function(t,e){e(n)})},s.resolve=function(n){return new s(function(t,e){t(n)})},s.all=function(i){return new s(function(n,t){var o=0,r=[];0===i.length&&n(r);for(var e=0;e<i.length;e+=1)s.resolve(i[e]).then(function(e){return function(t){r[e]=t,(o+=1)===i.length&&n(r)}}(e),t)})},s.race=function(o){return new s(function(t,e){for(var n=0;n<o.length;n+=1)s.resolve(o[n]).then(t,e)})};var t=s.prototype;function a(t,e){t instanceof Promise?this.promise=t:this.promise=new Promise(t.bind(e)),this.context=e}t.resolve=function(t){var e=this;if(2===e.state){if(t===e)throw new TypeError("Promise settled with itself.");var n=!1;try{var o=t&&t.then;if(null!==t&&"object"==typeof t&&"function"==typeof o)return void o.call(t,function(t){n||e.resolve(t),n=!0},function(t){n||e.reject(t),n=!0})}catch(t){return void(n||e.reject(t))}e.state=0,e.value=t,e.notify()}},t.reject=function(t){var e=this;if(2===e.state){if(t===e)throw new TypeError("Promise settled with itself.");e.state=1,e.value=t,e.notify()}},t.notify=function(){var i=this;o(function(){if(2!==i.state)for(;i.deferred.length;){var t=i.deferred.shift(),e=t[0],n=t[1],o=t[2],r=t[3];try{0===i.state?o("function"==typeof e?e.call(void 0,i.value):i.value):1===i.state&&("function"==typeof n?o(n.call(void 0,i.value)):r(i.value))}catch(t){r(t)}}},void 0)},t.then=function(n,o){var r=this;return new s(function(t,e){r.deferred.push([n,o,t,e]),r.notify()})},t.catch=function(t){return this.then(void 0,t)},"undefined"==typeof Promise&&(window.Promise=s),a.all=function(t,e){return new a(Promise.all(t),e)},a.resolve=function(t,e){return new a(Promise.resolve(t),e)},a.reject=function(t,e){return new a(Promise.reject(t),e)},a.race=function(t,e){return new a(Promise.race(t),e)};t=a.prototype;t.bind=function(t){return this.context=t,this},t.then=function(t,e){return t&&t.bind&&this.context&&(t=t.bind(this.context)),e&&e.bind&&this.context&&(e=e.bind(this.context)),new a(this.promise.then(t,e),this.context)},t.catch=function(t){return t&&t.bind&&this.context&&(t=t.bind(this.context)),new a(this.promise.catch(t),this.context)},t.finally=function(e){return this.then(function(t){return e.call(this),t},function(t){return e.call(this),Promise.reject(t)})};var o,r={}.hasOwnProperty,i=[].slice,u=!1,c="undefined"!=typeof window;function f(t){return t?t.replace(/^\s*|\s*$/g,""):""}function h(t){return t?t.toLowerCase():""}var p=Array.isArray;function d(t){return"string"==typeof t}function l(t){return"function"==typeof t}function m(t){return null!==t&&"object"==typeof t}function v(t){return m(t)&&Object.getPrototypeOf(t)==Object.prototype}function y(t,e,n){t=a.resolve(t);return arguments.length<2?t:t.then(e,n)}function b(t,e,n){return l(n=n||{})&&(n=n.call(e)),T(t.bind({$vm:e,$options:n}),t,{$options:n})}function g(t,e){var n,o;if(p(t))for(n=0;n<t.length;n++)e.call(t[n],t[n],n);else if(m(t))for(o in t)r.call(t,o)&&e.call(t[o],t[o],o);return t}var w=Object.assign||function(e){return i.call(arguments,1).forEach(function(t){j(e,t)}),e};function T(e){return i.call(arguments,1).forEach(function(t){j(e,t,!0)}),e}function j(t,e,n){for(var o in e)n&&(v(e[o])||p(e[o]))?(v(e[o])&&!v(t[o])&&(t[o]={}),p(e[o])&&!p(t[o])&&(t[o]=[]),j(t[o],e[o],n)):void 0!==e[o]&&(t[o]=e[o])}function x(t,e,n){var o,s,u,t=(o=t,s=["+","#",".","/",";","?","&"],{vars:u=[],expand:function(i){return o.replace(/\{([^{}]+)\}|([^{}]+)/g,function(t,e,n){if(e){var o=null,r=[];if(-1!==s.indexOf(e.charAt(0))&&(o=e.charAt(0),e=e.substr(1)),e.split(/,/g).forEach(function(t){t=/([^:*]*)(?::(\d+)|(\*))?/.exec(t);r.push.apply(r,function(t,e,n,o){var r=t[n],i=[];{var s;E(r)&&""!==r?"string"==typeof r||"number"==typeof r||"boolean"==typeof r?(r=r.toString(),o&&"*"!==o&&(r=r.substring(0,parseInt(o,10))),i