").addClass("jp-spinner__outer").appendTo(t);n("
").addClass("jp-spinner__inner").appendTo(o),e.after(t)},handleConnectionSuccess:function(e){i.fetchPlanType(),window.addEventListener("message",i.receiveData),o.attr("src",e.authorizeUrl),o.on("load",function(){o.show(),n(".jp-connect-full__button-container").hide()}),o.hide(),n(".jp-connect-full__button-container").after(o);var t=document.createElement("link");t.rel="preload",t.as="script",t.href=jpConnect.preFetchScript,document.head.appendChild(t)},fetchPlanType:function(){n.ajax({url:jpConnect.apiBaseUrl+"/site",type:"GET",data:{_wpnonce:jpConnect.apiSiteDataNonce},success:function(n){var e=JSON.parse(n.data);i.isPaidPlan=!e.plan.is_free}})},receiveData:function(n){n.origin===jpConnect.jetpackApiDomain&&n.source===o.get(0).contentWindow&&"close"===n.data&&(window.removeEventListener("message",this.receiveData),i.handleAuthorizationComplete())},handleAuthorizationComplete:function(){i.isRegistering=!1,i.isPaidPlan?window.location.assign(jpConnect.dashboardUrl):window.location.assign(jpConnect.plansPromptUrl),window.location.hash&&window.location.reload(!0)},handleConnectionError:function(n){i.isRegistering=!1,i.handleOriginalFlow()}};"setup"===location.hash.replace(/#\//,"")&&(a.length&&a.hide(),i.selectAndStartConnectionFlow())});