_N_E=(window.webpackJsonp_N_E=window.webpackJsonp_N_E||[]).push([[62],{BsWD:function(t,e,r){"use strict";r.d(e,"a",(function(){return c}));var n=r("a3WO");function c(t,e){if(t){if("string"===typeof t)return Object(n.a)(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Object(n.a)(t,e):void 0}}},KQm4:function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r("a3WO");var c=r("BsWD");function o(t){return function(t){if(Array.isArray(t))return Object(n.a)(t)}(t)||function(t){if("undefined"!==typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Object(c.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,r){"use strict";r.r(e);var n=r("rePB"),c=r("nKUr"),o=r("Ff2n"),a=(r("q1tI"),r("20a2")),u=r("eHHv"),i=r("yE/o"),s=r("gaPq"),b=r("wx14"),p=r("KQm4"),f=r("h4VS"),O=r("UYTu"),j=r("JznV"),l=r("hePV"),d=r.n(l),y=r("gmoh"),m=r.n(y),v=r("fjVX"),w=r.n(v),P=r("oB+O"),h=r.n(P),g=r("7zkD"),S=r("PaXs");function _(){var t=Object(f.a)(["\n    mutation create($product: CreateProductInput!) {\n      createProduct(product: $product) {\n        _id\n      }\n    }\n  "]);return _=function(){return t},t}function x(){var t=Object(f.a)(['\n    query getProductTypes {\n      uniforms: __type(name: "Product") {\n        options: possibleTypes {\n          value: name\n          label: description\n        }\n      }\n    }\n  ']);return x=function(){return t},t}function D(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function E(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?D(Object(r),!0).forEach((function(e){Object(n.a)(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):D(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var A=Object(u.a)(Object(j.a)(Object(O.a)(x())),Object(j.a)(Object(O.a)(_())),Object(g.a)((function(t){var e=t.data,r=(e=void 0===e?{}:e).uniforms,n=void 0===r?{options:[]}:r;return{title:{type:String,optional:!1,label:"Name"},type:{type:String,optional:!1,label:"Type",uniforms:{options:[{label:"Choose Type",value:null}].concat(Object(p.a)(n.options))}}}})),Object(u.f)({onSubmitSuccess:function(t){var e=t.onSuccess;return function(t){var r=t.data.createProduct;e(r._id)}},onSubmit:function(t){var e=t.mutate,r=t.schema;return function(t){var n=Object(b.a)({},t);return e({variables:{product:r.clean(n)}})}}}),S.a,Object(u.d)((function(t){t.onSuccess,t.mutate;return E({},Object(o.a)(t,["onSuccess","mutate"]))})),u.e)((function(t){return Object(c.jsxs)(h.a,E(E({},t),{},{children:[Object(c.jsx)(d.a,{name:"title"}),Object(c.jsx)(d.a,{name:"type"}),Object(c.jsx)(w.a,{}),Object(c.jsx)(m.a,{value:"Add product",className:"primary"})]}))})),N=r("PZVx");function T(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function I(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?T(Object(r),!0).forEach((function(e){Object(n.a)(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}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,r=Object(o.a)(t,["onSuccess"]);return Object(c.jsx)(s.a,I(I({},r),{},{children:Object(c.jsxs)(i.a,{children:[Object(c.jsx)("p",{children:"New product"}),Object(c.jsx)(A,{onSuccess:e})]})}))})))},Zofu:function(t,e,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/products/new",function(){return r("VIoQ")}])},a3WO:function(t,e,r){"use strict";function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}r.d(e,"a",(function(){return n}))}},[["Zofu",0,2,3,1,4,5,6,7]]]);