(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-4fee3245"],{"0d29":function(e,t,n){e.exports=n.p+"img/puff.d8f8be86.svg"},"7a6b":function(e,t,n){"use strict";n.r(t),n.d(t,"PollKStoreReadyFlow",(function(){return w}));var o=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{attrs:{id:"loading"}},[o("img",{attrs:{src:n("0d29")}}),o("div",{staticClass:"desc"},[e._v(e._s(e.kstatus))])])},r=[],a=(n("2b45"),n("fc58"),n("b449"),n("5d83")),c=n("3231"),i=n("064d"),s=n("46d7"),l=n("04e2"),u=n("52ce"),f=n("0372"),d=n("6301"),v=n("fb78"),k=n.n(v),m=n("ab66"),p=n("3a0b"),g=n("5f86"),h=n("b2e6");function y(e){var t=b();return function(){var n,o=Object(u["a"])(e);if(t){var r=Object(u["a"])(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return Object(l["a"])(this,n)}}function b(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var P=function(){var e=function(e){Object(s["a"])(n,e);var t=y(n);function n(){var e;return Object(c["a"])(this,n),e=t.apply(this,arguments),e.kstatus="kstore 正在加载...",e}return Object(i["a"])(n,[{key:"mounted",value:function(){var e=new w(this);e.Go()}}]),n}(h["c"]);return e=Object(f["a"])([Object(h["a"])({})],e),e}(),R=P,w=function(){function e(t){Object(c["a"])(this,e),this.vm=t,this.needFakePolling=!1,this.kstoreLife={AllReady:!1,ReadyParts:[],NumParts:0},d["a"].reflect.BindThisMethods(this)}return Object(i["a"])(e,[{key:"Go",value:function(){var e=this;k.a.waterfall([e.polling,e.commitToStore,e.getAboutPeerInfo,e.getConfigs,e.jumpAfterKStoreReady],(function(e,t){"cancel"!==e&&console.log("PollKStoreReadyFlow done. error:",e)}))}},{key:"polling",value:function(e){var t=this,n=new d["a"].util.Once,o={AllReady:!1,ReadyParts:[],NumParts:0},r=setInterval(Object(a["a"])(regeneratorRuntime.mark((function a(){var c,i;return regeneratorRuntime.wrap((function(a){while(1)switch(a.prev=a.next){case 0:if(!o.AllReady){a.next=5;break}return clearInterval(r),n.Do((function(){console.log("wait kstore.AllReady done, ks:",o),e(null)})),a.abrupt("return");case 5:return a.next=7,fetch("/api/life");case 7:return c=a.sent,a.next=10,c.json();case 10:i=a.sent,o=i,console.log("polling:",o),t.vm.kstatus="kstore 正在玩命加载，请稍候... ".concat(o.ReadyParts.length,"/").concat(o.NumParts),o.AllReady&&(t.vm.kstatus="kstore 准备就绪，即将跳转 ".concat(o.ReadyParts.length,"/").concat(o.NumParts),console.log("stop polling"));case 15:case"end":return a.stop()}}),a)}))),200);setTimeout((function(){n.Do((function(){console.log("wait kstore.AllReady timeout, force to redirect, ks:",o),clearInterval(r),e(null)}))}),2e3)}},{key:"fakePolling",value:function(e){if(this.needFakePolling)var t=this,n=1e3/this.kstoreLife.NumParts,o=0,r=setInterval((function(){o++,t.vm.kstatus="kstore 正在玩命加载，请稍候... ".concat(o,"/").concat(t.kstoreLife.NumParts),o===t.kstoreLife.NumParts&&(clearInterval(r),e(null))}),n);else e(null)}},{key:"commitToStore",value:function(e){p["a"].commit("SetKStoreReady"),e(null)}},{key:"getAboutPeerInfo",value:function(e){d["a"].rpc.Client.AboutPeer((function(t){console.log("getAboutPeerInfo: ",t);var n=new m["a"];n.peerId=t.peerId,n.version=t.version,n.isOfficialPeer=t.isOfficialPeer,n.detectNewVersion=t.detectNewVersion,n.newVersion=t.newVersion,p["a"].commit("SetAboutPeerInfo",n),e(null)}),(function(t,n){e("".concat(t," failed: ").concat(n))}))}},{key:"getConfigs",value:function(e){d["a"].rpc.Client.GetConfigExt((function(t){var n=t[1];n?e(n):(p["a"].commit("SetConfigs",t[0]),e(null))}),(function(t,n){e("".concat(t," failed: ").concat(n))}))}},{key:"jumpAfterKStoreReady",value:function(e){var t="/desk";g["c"].has(g["a"])&&(t=g["c"].get(g["a"])),console.log("kstore ready, jump to:",t),this.vm.$router.push(t),e(null)}}]),e}(),j=R,O=(n("fced"),n("4023")),A=Object(O["a"])(j,o,r,!1,null,null,null);t["default"]=A.exports},c7e9:function(e,t,n){},fced:function(e,t,n){"use strict";var o=n("c7e9"),r=n.n(o);r.a}}]);