!function(){"use strict";var t={};function n(t,n,e,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?n(u):Promise.resolve(u).then(r,o)}function e(t){return e="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},e(t)}function r(t){var n=function(t){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(n)?n:n+""}function o(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,r(o.key),o)}}t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,{a:e}),e},t.d=function(n,e){for(var r in e)t.o(e,r)&&!t.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:e[r]})},t.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)};var i=window.wp.apiFetch,a=t.n(i);function c(){var t,n,e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,r,o,i){var c=r&&r.prototype instanceof s?r:s,f=Object.create(c.prototype);return u(f,"_invoke",function(e,r,o){var i,c,u,s=0,f=o||[],l=!1,p={p:0,n:0,v:t,a:v,f:v.bind(t,4),d:function(n,e){return i=n,c=0,u=t,p.n=e,a}};function v(e,r){for(c=e,u=r,n=0;!l&&s&&!o&&n<f.length;n++){var o,i=f[n],v=p.p,y=i[2];e>3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=t):i[0]<=v&&((o=e<2&&v<i[1])?(c=0,p.v=r,p.n=i[1]):v<y&&(o=e<3||i[0]>r||r>y)&&(i[4]=e,i[5]=r,p.n=y,c=0))}if(o||e>1)return a;throw l=!0,r}return function(o,f,y){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&v(f,y),c=f,u=y;(n=c<2?t:u)||!l;){i||(c?c<3?(c>1&&(p.n=-1),v(c,u)):p.n=u:p.v=u);try{if(s=2,i){if(c||(o="next"),n=i[o]){if(!(n=n.call(i,u)))throw TypeError("iterator result is not an object");if(!n.done)return n;u=n.value,c<2&&(c=0)}else 1===c&&(n=i.return)&&n.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=t}else if((n=(l=p.n<0)?u:e.call(r,p))!==a)break}catch(n){i=t,c=1,u=n}finally{s=1}}return{value:n,done:l}}}(e,o,i),!0),f}var a={};function s(){}function f(){}function l(){}n=Object.getPrototypeOf;var p=[][r]?n(n([][r]())):(u(n={},r,function(){return this}),n),v=l.prototype=s.prototype=Object.create(p);function y(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,u(t,o,"GeneratorFunction")),t.prototype=Object.create(v),t}return f.prototype=l,u(v,"constructor",l),u(l,"constructor",f),f.displayName="GeneratorFunction",u(l,o,"GeneratorFunction"),u(v),u(v,o,"Generator"),u(v,r,function(){return this}),u(v,"toString",function(){return"[object Generator]"}),(c=function(){return{w:i,m:y}})()}function u(t,n,e,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}u=function(t,n,e,r){if(n)o?o(t,n,{value:e,enumerable:!r,configurable:!r,writable:!r}):t[n]=e;else{var i=function(n,e){u(t,n,function(t){return this._invoke(n,e,t)})};i("next",0),i("throw",1),i("return",2)}},u(t,n,e,r)}var s=function(){return t=function t(){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.nonce=PatternsFitnessLocalize.nonce,this.bindEvents()},e=[{key:"bindEvents",value:function(){var t=this;document.addEventListener("click",function(n){n.target.classList.contains("patterns-fitness-install-plugin")&&(n.target.classList.add("patterns-fitness-processing"),t.installPlugin(n.target))})}},{key:"installPlugin",value:(r=c().m(function t(n){var e,r,o,i;return c().w(function(t){for(;;)switch(t.n){case 0:return e=n.dataset.plugin,r=JSON.parse(e),t.p=1,t.n=2,a()({path:"patterns-fitness/v1/install-plugin",method:"POST",data:r,headers:{"X-WP-Nonce":this.nonce}});case 2:(o=t.v)&&(o.success?(n.innerText=n.dataset.successText,n.disabled=!0,n.classList.remove("patterns-fitness-install-plugin")):n.innerText=n.dataset.failText),t.n=4;break;case 3:t.p=3,i=t.v,console.error(i),n.innerText=n.dataset.failText;case 4:n.classList.remove("patterns-fitness-processing");case 5:return t.a(2)}},t,this,[[1,3]])}),i=function(){var t=this,e=arguments;return new Promise(function(o,i){var a=r.apply(t,e);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)})},function(_x){return i.apply(this,arguments)})}],e&&o(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,i}();document.addEventListener("DOMContentLoaded",function(){new s})}();