(window.webpackJsonp=window.webpackJsonp||[]).push([[50],{BsWD:function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n("a3WO");function o(t,e){if(t){if("string"===typeof t)return Object(r.a)(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Object(r.a)(t,e):void 0}}},KQm4:function(t,e,n){"use strict";n.d(e,"a",(function(){return c}));var r=n("a3WO");var o=n("BsWD");function c(t){return function(t){if(Array.isArray(t))return Object(r.a)(t)}(t)||function(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||Object(o.a)(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},VIoQ:function(t,e,n){"use strict";n.r(e);var r=n("Ff2n"),o=n("q1tI"),c=n.n(o),a=n("nOHt"),u=n("eHHv"),i=n("yE/o"),s=n("gaPq"),f=n("rePB"),p=n("wx14"),b=n("KQm4"),l=n("h4VS"),O=n("lTCR"),d=n.n(O),m=n("0dmp"),y=n("hePV"),j=n.n(y),v=n("gmoh"),w=n.n(v),P=n("fjVX"),S=n.n(P),h=n("oB+O"),g=n.n(h),_=n("7zkD"),A=n("PaXs"),E=c.a.createElement;function T(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function D(){var t=Object(l.a)(["\n    mutation create($product: CreateProductInput!) {\n      createProduct(product: $product) {\n        _id\n      }\n    }\n  "]);return D=function(){return t},t}function I(){var t=Object(l.a)(['\n    query getProductTypes {\n      uniforms: __type(name: "Product") {\n        options: possibleTypes {\n          value: name\n          label: description\n        }\n      }\n    }\n  ']);return I=function(){return t},t}var V=Object(u.a)(Object(m.a)(d()(I())),Object(m.a)(d()(D())),Object(_.a)((function(t){var e=t.data,n=(e=void 0===e?{}:e).uniforms,r=void 0===n?{options:[]}:n;return{title:{type:String,optional:!1,label:"Name"},type:{type:String,optional:!1,label:"Type",uniforms:{options:[{label:"Choose Type",value:null}].concat(Object(b.a)(r.options))}}}})),Object(u.f)({onSubmitSuccess:function(t){var e=t.onSuccess;return function(t){var n=t.data.createProduct;e(n._id)}},onSubmit:function(t){var e=t.mutate,n=t.schema;return function(t){var r=Object(p.a)({},t);return e({variables:{product:n.clean(r)}})}}}),A.a,Object(u.d)((function(t){t.onSuccess,t.mutate;return function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?T(Object(n),!0).forEach((function(e){Object(f.a)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},Object(r.a)(t,["onSuccess","mutate"]))})),u.e)((function(t){return E(g.a,t,E(j.a,{name:"title"}),E(j.a,{name:"type"}),E(S.a,null),E(w.a,{value:"Add product",className:"primary"}))})),N=n("PZVx"),W=c.a.createElement;e.default=Object(N.a)(Object(u.a)(a.withRouter,Object(u.f)({onSuccess:function(t){var e=t.router;return function(t){e.push({pathname:"/products/edit",query:{_id:t}})}}}))((function(t){var e=t.onSuccess,n=Object(r.a)(t,["onSuccess"]);return W(s.a,n,W(i.a,null,W("p",null,"New product"),W(V,{onSuccess:e})))})))},Zofu:function(t,e,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/products/new",function(){return n("VIoQ")}])},a3WO:function(t,e,n){"use strict";function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}n.d(e,"a",(function(){return r}))}},[["Zofu",0,2,5,1,3,4,6]]]);