!function(){"use strict";var t={};function e(t,e,n,r,i,o,a){try{var s=t[o](a),c=s.value}catch(t){return void n(t)}s.done?e(c):Promise.resolve(c).then(r,i)}function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function r(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,r(i.key),i)}}t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,{a:n}),n},t.d=function(e,n){for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},t.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var o=window.regeneratorRuntime,a=t.n(o),s=window.wp.apiFetch,c=t.n(s),u=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.nonce=PatternsKindergartenLocalize.nonce,this.bindEvents()},n=[{key:"bindEvents",value:function(){var t=this;document.addEventListener("click",(function(e){e.target.classList.contains("patterns-kindergarten-install-plugin")&&(e.target.classList.add("patterns-kindergarten-processing"),t.installPlugin(e.target))}))}},{key:"installPlugin",value:(r=a().mark((function t(e){var n,r,i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.dataset.plugin,r=JSON.parse(n),t.prev=2,t.next=5,c()({path:"patterns-kindergarten/v1/install-plugin",method:"POST",data:r,headers:{"X-WP-Nonce":this.nonce}});case 5:(i=t.sent)&&(i.success?(e.innerText=e.dataset.successText,e.disabled=!0,e.classList.remove("patterns-kindergarten-install-plugin")):e.innerText=e.dataset.failText),t.next=13;break;case 9:t.prev=9,t.t0=t.catch(2),console.error(t.t0),e.innerText=e.dataset.failText;case 13:e.classList.remove("patterns-kindergarten-processing");case 14:case"end":return t.stop()}}),t,this,[[2,9]])})),o=function(){var t=this,n=arguments;return new Promise((function(i,o){var a=r.apply(t,n);function s(t){e(a,i,o,s,c,"next",t)}function c(t){e(a,i,o,s,c,"throw",t)}s(void 0)}))},function(_x){return o.apply(this,arguments)})}],n&&i(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r,o}();document.addEventListener("DOMContentLoaded",(function(){new u}))}();