LocalCDN-Firefox-Chrome-Brave/resources/angularjs/1.6.10/angular-resource.min.jsm

16 lines
4.4 KiB
JavaScript
Raw Normal View History

2020-05-05 06:32:24 +02:00
/*
AngularJS v1.6.10
(c) 2010-2018 Google, Inc. http://angularjs.org
License: MIT
*/
(function(U,a){'use strict';function L(m,f){f=f||{};a.forEach(f,function(a,d){delete f[d]});for(var d in m)!m.hasOwnProperty(d)||"$"===d.charAt(0)&&"$"===d.charAt(1)||(f[d]=m[d]);return f}var B=a.$$minErr("$resource"),Q=/^(\.[a-zA-Z_$@][0-9a-zA-Z_$@]*)+$/;a.module("ngResource",["ng"]).info({angularVersion:"1.6.10"}).provider("$resource",function(){var m=/^https?:\/\/\[[^\]]*][^/]*/,f=this;this.defaults={stripTrailingSlashes:!0,cancellable:!1,actions:{get:{method:"GET"},save:{method:"POST"},query:{method:"GET",
isArray:!0},remove:{method:"DELETE"},"delete":{method:"DELETE"}}};this.$get=["$http","$log","$q","$timeout",function(d,P,F,M){function C(a,d){this.template=a;this.defaults=n({},f.defaults,d);this.urlParams={}}var D=a.noop,r=a.forEach,n=a.extend,R=a.copy,N=a.isArray,w=a.isDefined,x=a.isFunction,S=a.isNumber,y=a.$$encodeUriQuery,T=a.$$encodeUriSegment;C.prototype={setUrlParams:function(a,d,f){var g=this,c=f||g.template,s,h,n="",b=g.urlParams=Object.create(null);r(c.split(/\W/),function(a){if("hasOwnProperty"===
a)throw B("badname");!/^\d+$/.test(a)&&a&&(new RegExp("(^|[^\\\\]):"+a+"(\\W|$)")).test(c)&&(b[a]={isQueryParamValue:(new RegExp("\\?.*=:"+a+"(?:\\W|$)")).test(c)})});c=c.replace(/\\:/g,":");c=c.replace(m,function(b){n=b;return""});d=d||{};r(g.urlParams,function(b,a){s=d.hasOwnProperty(a)?d[a]:g.defaults[a];w(s)&&null!==s?(h=b.isQueryParamValue?y(s,!0):T(s),c=c.replace(new RegExp(":"+a+"(\\W|$)","g"),function(b,a){return h+a})):c=c.replace(new RegExp("(/?):"+a+"(\\W|$)","g"),function(a,b,e){return"/"===
e.charAt(0)?e:b+e})});g.defaults.stripTrailingSlashes&&(c=c.replace(/\/+$/,"")||"/");c=c.replace(/\/\.(?=\w+($|\?))/,".");a.url=n+c.replace(/\/(\\|%5C)\./,"/.");r(d,function(b,c){g.urlParams[c]||(a.params=a.params||{},a.params[c]=b)})}};return function(m,y,z,g){function c(b,c){var d={};c=n({},y,c);r(c,function(c,f){x(c)&&(c=c(b));var e;if(c&&c.charAt&&"@"===c.charAt(0)){e=b;var k=c.substr(1);if(null==k||""===k||"hasOwnProperty"===k||!Q.test("."+k))throw B("badmember",k);for(var k=k.split("."),h=0,
n=k.length;h<n&&a.isDefined(e);h++){var g=k[h];e=null!==e?e[g]:void 0}}else e=c;d[f]=e});return d}function s(b){return b.resource}function h(b){L(b||{},this)}var O=new C(m,g);z=n({},f.defaults.actions,z);h.prototype.toJSON=function(){var b=n({},this);delete b.$promise;delete b.$resolved;delete b.$cancelRequest;return b};r(z,function(b,a){var f=!0===b.hasBody||!1!==b.hasBody&&/^(POST|PUT|PATCH)$/i.test(b.method),g=b.timeout,m=w(b.cancellable)?b.cancellable:O.defaults.cancellable;g&&!S(g)&&(P.debug("ngResource:\n Only numeric values are allowed as `timeout`.\n Promises are not supported in $resource, because the same value would be used for multiple requests. If you are looking for a way to cancel requests, you should use the `cancellable` option."),
delete b.timeout,g=null);h[a]=function(e,k,G,y){function z(a){p.catch(D);null!==t&&t.resolve(a)}var H={},u,v,A;switch(arguments.length){case 4:A=y,v=G;case 3:case 2:if(x(k)){if(x(e)){v=e;A=k;break}v=k;A=G}else{H=e;u=k;v=G;break}case 1:x(e)?v=e:f?u=e:H=e;break;case 0:break;default:throw B("badargs",arguments.length);}var E=this instanceof h,l=E?u:b.isArray?[]:new h(u),q={},C=b.interceptor&&b.interceptor.response||s,w=b.interceptor&&b.interceptor.responseError||void 0,I=!!A,J=!!w,t,K;r(b,function(a,
b){switch(b){default:q[b]=R(a);case "params":case "isArray":case "interceptor":case "cancellable":}});!E&&m&&(t=F.defer(),q.timeout=t.promise,g&&(K=M(t.resolve,g)));f&&(q.data=u);O.setUrlParams(q,n({},c(u,b.params||{}),H),b.url);var p=d(q).then(function(c){var e=c.data;if(e){if(N(e)!==!!b.isArray)throw B("badcfg",a,b.isArray?"array":"object",N(e)?"array":"object",q.method,q.url);if(b.isArray)l.length=0,r(e,function(a){"object"===typeof a?l.push(new h(a)):l.push(a)});else{var d=l.$promise;L(e,l);l.$promise=
d}}c.resource=l;return c},function(a){a.resource=l;return F.reject(a)}),p=p["finally"](function(){l.$resolved=!0;!E&&m&&(l.$cancelRequest=D,M.cancel(K),t=K=q.timeout=null)}),p=p.then(function(a){var b=C(a);(v||D)(b,a.headers,a.status,a.statusText);return b},I||J?function(a){I&&!J&&p.catch(D);I&&A(a);return J?w(a):F.reject(a)}:void 0);return E?p:(l.$promise=p,l.$resolved=!1,m&&(l.$cancelRequest=z),l)};h.prototype["$"+a]=function(b,c,d){x(b)&&(d=c,c=b,b={});b=h[a].call(this,b,this,c,d);return b.$promise||
b}});return h}}]})})(window,window.angular);
//# sourceMappingURL=angular-resource.min.js.map