"use strict";(self.webpackChunkgravityforms=self.webpackChunkgravityforms||[]).push([[954],{2954:function(t,n,e){e.d(n,{Z:function(){return P}});var r=e(7169),o=e(8950),a=e(2975),c=e.n(a),s=e(4203),i=e(4017),u=e(1583),f=e(6655);function l(t,n,e){var r=new window.FormData;return function t(n,o){if(!function(t){return Array.isArray(e)&&e.some((function(n){return n===t}))}(o))if(o=o||"",n instanceof window.File)r.append(o,n);else if(Array.isArray(n))for(var a=0;a<n.length;a++)t(n[a],o+"["+a+"]");else if("object"===(0,f.Z)(n)&&n)for(var c in n)n.hasOwnProperty(c)&&t(n[c],""===o?c:o+"."+c);else null!=n&&r.append(o,n)}(t,n),r}var p=e(2124),d=e(4506),h=e.n(d),y=e(7293),w=e.n(y),b=e(5212),v=e.n(b),O=e(2577),g=function t(n){return Object.entries(n).map((function(n){var e=(0,O.Z)(n,2),r=e[0],o=e[1];return[r,o&&"object"===(0,f.Z)(o)?t(o):o]})).reduce((function(t,n){var e=(0,O.Z)(n,2),r=e[0],o=e[1];return null==o||(t[r]=o),t}),{})};function j(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}function m(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?j(Object(e),!0).forEach((function(n){(0,r.Z)(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):j(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}function P(t){return x.apply(this,arguments)}function x(){return x=(0,o.Z)(c().mark((function t(n){var e,r,o,a,f,d,y,b,O,j,P,x,D=arguments;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=D.length>1&&void 0!==D[1]?D[1]:{},r=D.length>2&&void 0!==D[2]?D[2]:{},o=m({method:"GET"},r),a=(0,s.Z)(["body"],o),f="GET"!==a.method&&"HEAD"!==a.method,d=a.baseUrl,f&&(y=r.body?r.body:{},e[n].nonce&&(y._ajax_nonce=e[n].nonce),e[n].action&&(y.action=e[n].action),a.body=l(y)),a.json&&(a.body=JSON.stringify(a.json)),b=a.params||{},!f&&e[n].nonce&&(b._ajax_nonce=e[n].nonce),!f&&e[n].action&&(b.action=e[n].action),b&&!(0,i.Z)(b)&&(O=g(b),j=(0,p.stringify)(O,{arrayFormat:"bracket"}),d="".concat(d,"?").concat(j)),P=a.headers?m({},a.headers):{},console.info("Fetching url: ".concat(d)),console.info("with options",m(m({},a),{},{body:a.body})),console.info("and headers: ",P),x=Date.now(),t.abrupt("return",window.fetch(d,m(m({},a),{},{headers:P})).then((function(t){return t.ok?t.text().then((function(e){try{var r=JSON.parse(e),o=Date.now()-x;return console.info("Data for ".concat(n," in ").concat(o,"ms:"),r),{data:r,status:t.status,totalPages:t.headers.get("x-wp-totalpages"),totalPosts:t.headers.get("x-wp-total")}}catch(n){var a=w()(h()(v()(e))),c=new Error("Invalid server response. ".concat(a));throw c.detail={url:d,data:a,status:t.status,error:n,text:e},c}})):(0,u.Z)(t.headers.get("Content-Type"),"application/json")?t.text().then((function(e){try{var r=JSON.parse(e);return console.info("Data for ".concat(n,":"),r),{data:r,status:t.status}}catch(n){var o=w()(h()(v()(e))),a=new Error("Invalid server response. ".concat(o));throw a.detail={url:d,data:o,status:t.status,error:n,text:e},a}})):t.text().then((function(n){var e=w()(h()(v()(n))),r=new Error("Unknown server response. ".concat(e));throw r.detail={url:d,data:e,status:t.status},r}))})).catch((function(t){return console.info(JSON.stringify(t)),console.info(t.detail),{error:t}})));case 18:case"end":return t.stop()}}),t)}))),x.apply(this,arguments)}}}]);
//# sourceMappingURL=954.9b69eab2b016af6f59c3.js.map