text: (window.webpackJsonp=window.webpackJsonp||[]).push([[0],{112:function(e,t,a){e.exports=a(207)},119:function(e,t,a){},122:function(e,t,a){},124:function(e,t,a){},202:function(e,t,a){},204:function(e,t,a){},207:function(e,t,a){"use strict";a.r(t);var n,r,i,o,c=a(12),s=a.n(c),l=a(14),u=a(1),d=a.n(u),m=a(7),h=a.n(m),p=(a(119),a(39)),v=a(40),b=a(44),f=a(41),y=a(45),w=a(16),O=a(50),g=a(15),k=a(62),j=a(214),E=a(210),M=a(215),x=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{method:"get"};return"get"===a.method?(e=e+"?"+Object.keys(t).map(function(e){return"".concat(e,"=").concat(t[e])}).join("&"),t=void 0):(t=JSON.stringify(t),a.headers=Object(w.a)({},a.headers||{},{"content-type":"application/json"})),fetch(e,Object.assign(a,{body:t})).then(function(e){return e.json()})},C=a(75),S=a.n(C),L=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,t=arguments.length>1?arguments[1]:void 0;return function(a,n,r){return Object(w.a)({},r,{value:S.a.debounce(a[n],e,t)})}},P=(a(122),a(209)),N=a(212),A=(a(124),function(e){var t=e.title,a=e.teamList,n=void 0===a?[]:a,r=e.handleClearMember,i=e.handleChooseMember,o=e.handleSelectMember,c=e.handleAddMember,s=e.options;return d.a.createElement(P.a,{className:"team-panel",title:t},d.a.createElement(N.a,{type:"primary",ghost:!0,onClick:r},"\u6e05\u7a7a"),n.map(function(e,t){return e?d.a.createElement(P.a,{hoverable:!0,key:t,cover:d.a.createElement("img",{alt:"pm",src:"https://assets.pokemon.com/assets/cms2/img/pokedex/full/".concat(("000"+window.pokedex[e].num).substr(-3)).concat(e.includes("megay")?"_f3":e.includes("mega")||e.includes("alola")?"_f2":"",".png")}),type:"inner",onClick:function(){return i(e)}},window.pokedex[e].species):d.a.createElement(P.a,{key:t,type:"inner"},d.a.createElement(E.a,{autoFocus:!0,showSearch:!0,style:{width:200},placeholder:"Select a pokemon",optionFilterProp:"children",onChange:function(e){return o(t,e)},filterOption:function(e,t){return t.props.children.toLowerCase().includes(e)}},s))}),n.length<6&&d.a.createElement(P.a,{type:"inner",hoverable:!0,onClick:c},"+"))}),T=a(213),D=a(208),I=a(211),F=a(32),_=a.n(F),B=(a(202),function(){var e=Object(l.a)(s.a.mark(function e(){var t;return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,x("/public/status.json");case 2:t=e.sent,window.statusCondition=t;case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()),J=function(e,t){var a=1;switch(e){case"Paralysis":"spe"===t&&(a*=.5)}return a},R=function(e){var t=1;switch(e){case"Burn":t*=.5}return t},W=function(e){function t(){var e,a;Object(p.a)(this,t);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(a=Object(b.a)(this,(e=Object(f.a)(t)).call.apply(e,[this].concat(r)))).state={statusTooltip:""},a.attributeMap={hp:"\u751f\u547d",atk:"\u653b\u51fb",def:"\u9632\u5fa1",spa:"\u7279\u653b",spd:"\u7279\u9632",spe:"\u901f\u5ea6"},a.renderAttributes=function(){var e=a.props,t=e.pokemon,n=t.ability,r=void 0===n?{}:n,i=t.individual,o=void 0===i?{}:i,c=t.abLevel,s=void 0===c?{}:c,l=t.name,u=t.status,m=e.abilityLevelOptions,h=e.handleSelectAbLevel,p=e.handleChangeIndividual;return d.a.createElement(d.a.Fragment,null,d.a.createElement("div",{className:"attr-row"},d.a.createElement("div",null,"\u80fd\u529b\u9879"),d.a.createElement("div",null,"\u79cd\u65cf\u503c"),d.a.createElement("div",null,"\u4e2a\u4f53\u503c"),d.a.createElement("div",null,"\u80fd\u529b\u503c"),d.a.createElement("div",null,"\u9636\u7ea7")),Object.keys(r).map(function(e){return d.a.createElement("div",{key:e,className:"attr-row"},d.a.createElement("div",null,a.attributeMap[e]),d.a.createElement("div",null,window.pokedex[l].baseStats[e]),d.a.createElement(T.a,{value:o[e]||0,max:31,min:0,onChange:function(t){return p(e,t)}}),d.a.createElement("div",null,Math.floor(r[e]*(s[e]||1)*J(u,e))),d.a.createElement(E.a,{showSearch:!0,allowClear:!0,optionFilterProp:"children",defaultValue:1,value:s[e]||1,onChange:function(t){return h(e,t)}},m))}))},a.changeStatus=function(e){a.props.handleSelectStatus(e),a.setState({statusTooltip:window.statusCondition[e].description})},a.renderExtra=function(){var e=a.props,t=e.statusOptions,n=e.charactorOptions,r=e.handleSelectCharactor,i=e.pokemon,o=i.ability,c=i.charactor,s=i.status;return d.a.createElement(d.a.Fragment,null,d.a.createElement(D.a,{dashed:!0},"\u9644\u52a0\u680f"),d.a.createElement("div",{className:"extra-row"},d.a.createElement("div",null,"\u6027\u683c:"),d.a.createElement(E.a,{showSearch:!0,placeholder:"Select a charactor",optionFilterProp:"children",filterOption:function(e,t){return _()(t.props.children[0],{style:_.a.STYLE_NORMAL}).join("").toLowerCase().includes(e)||t.props.children[0].toLowerCase().includes(e)},defaultValue:"Adamant",value:c,onChange:r},n)),d.a.createElement(I.a,{title:a.state.statusTooltip,placement:"bottom"},d.a.createElement("div",{className:"extra-row"},d.a.createElement("div",null,"\u72b6\u6001:"),d.a.createElement(E.a,{showSearch:!0,placeholder:"Select a status",optionFilterProp:"children",filterOption:function(e,t){return _()(t.props.children,{style:_.a.STYLE_NORMAL}).join("").toLowerCase().includes(e)||t.props.children.toLowerCase().includes(e)},onChange:a.changeStatus,value:s},t),s&&d.a.createElement("div",null,"\u6bcf\u56de\u5408\u635f\u5931",Math.ceil((o||{}).hp*window.statusCondition[s])||0))))},a}return Object(y.a)(t,e),Object(v.a)(t,[{key:"render",value:function(){var e=this.props,t=e.pokemon.name,a=e.moves,n=e.handleSelectMove,r=e.calculateDamage,i=e.options;return d.a.createElement(P.a,{className:"ability-panel",title:t&&window.pokedex[t].species||"PM",extra:(t?window.pokedex[t].types:[]).map(function(e){return d.a.createElement("div",{key:e,className:"attr-tag",style:{backgroundColor:window.attribute[e].color}},window.attribute[e].chineseName)})},this.renderAttributes(),this.renderExtra(),d.a.createElement(D.a,{dashed:!0},"\u6280\u80fd\u680f"),d.a.createElement("div",{className:"move-row"},d.a.createElement("div",null,"\u540d\u79f0"),d.a.createElement("div",null,"\u5c5e\u6027"),d.a.createElement("div",null,"\u7c7b\u578b"),d.a.createElement("div",null,"\u5a01\u529b"),d.a.createElement("div",null,"\u547d\u4e2d"),d.a.createElement("div",null,"\u4f24\u5bb3")),a.map(function(e,t){return d.a.createElement("div",{className:"move-row",key:t},d.a.createElement(E.a,{showSearch:!0,style:{width:200},placeholder:"Select a move",optionFilterProp:"children",onChange:function(e){return n(t,e)},filterOption:function(e,t){return _()(t.props.children,{style:_.a.STYLE_NORMAL}).join("").toLowerCase().includes(e)||t.props.children.toLowerCase().includes(e)}},i),d.a.createElement("div",null,e.attribute),d.a.createElement("div",null,e.type),d.a.createElement("div",null,e.power),d.a.createElement("div",null,e.accuracy),d.a.createElement("div",null,e.damage))}),d.a.createElement(N.a,{type:"primary",onClick:r},"\u8ba1\u7b97\u4f24\u5bb3"))}}]),t}(u.Component),Y=j.a.Header,V=j.a.Footer,G=j.a.Content,H=E.a.Option;M.a.config({maxCount:1});var U=(n=L(),r=L(),i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:300,t=arguments.length>1?arguments[1]:void 0;return function(a,n,r){return Object(w.a)({},r,{value:S.a.throttle(a[n],e,Object(w.a)({trailing:!1},t))})}}(1e3),o=function(e){function t(){var e,a;Object(p.a)(this,t);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(a=Object(b.a)(this,(e=Object(f.a)(t)).call.apply(e,[this].concat(r)))).state={minDamage:0,maxDamage:0,myTeamList:["beedrillmega","mukalola","melmetal","snorlax","aerodactyl","lapras"],opTeamList:["mewtwomegay"],myPokemon:{},opPokemon:{},myMoves:new Array(4).fill({}),opMoves:new Array(4).fill({})},a.defaultIndividual={hp:31,atk:31,def:31,spa:31,spd:31,spe:31},a.pokedex=Object.keys(window.pokedex).map(function(e){return window.pokedex[e]}).filter(function(e){var t=e.num;return(t<=153||t>=808)&&t>0}),a.PMOptions=a.pokedex.map(function(e,t){return d.a.createElement(H,{key:t,value:e.species.replace(/-/g,"").toLowerCase()},e.species)}),a.moveOptions=window.moves.map(function(e,t){return d.a.createElement(H,{key:t,value:t},e.chineseName)}),a.abilityLevelOptions=new Array(13).fill(0).map(function(e,t){return d.a.createElement(H,{key:t,value:t>=6?(t-6+2)/2:2/(2-t+6)},t-6)}).reverse(),a.charactorOptions=Object.values(window.charactor).map(function(e,t){return d.a.createElement(H,{key:t,value:e.charactor},e.chinese," ",e.increase,"+/",e.decrease,"-")}),a.statusOptions=Object.keys(window.statusCondition).map(function(e){return d.a.createElement(H,{key:e,value:e},window.statusCondition[e].chineseName)}),a.addTeamMember=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0]?"opTeamList":"myTeamList";a.setState(Object(g.a)({},e,a.state[e].concat("")))},a.clearMember=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0]?"opTeamList":"myTeamList";a.setState(Object(g.a)({},e,[]))},a.selectMember=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=e?"opTeamList":"myTeamList",i=a.state[r];a.setState(Object(g.a)({},r,[].concat(Object(O.a)(i.slice(0,t)),[n],Object(O.a)(i.slice(t+1,i.length)))))},a.chooseMember=Object(l.a)(s.a.mark(function e(){var t,n,r,i,o,c,l=arguments;return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]&&l[0],n=l.length>1?l[1]:void 0,r=t?"opPokemon":"myPokemon",i=a.state[r].charactor,e.next=6,x("/api/damage/ability",{individual:a.defaultIndividual,level:50,pokemon:n,charactor:i},{method:"post"});case 6:o=e.sent,c=o.data.ability,a.setState(Object(g.a)({},r,{name:n,ability:c,abLevel:{},individual:a.defaultIndividual,charactor:i}));case 9:case"end":return e.stop()}},e,this)})),a.selectAbilityLevel=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=e?"opPokemon":"myPokemon",i=a.state[r],o=i.abLevel;a.setState(Object(g.a)({},r,Object(w.a)({},i,{abLevel:Object(w.a)({},o,Object(g.a)({},t,n))})))},a.selectStatus=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0,n=e?"opPokemon":"myPokemon",r=a.state[n];r.ability?a.setState(Object(g.a)({},n,Object(w.a)({},r,{status:t}))):M.a.warn("\u8bf7\u5148\u9009\u62e9\u961f\u4f0d\u4e2d\u7684\u5b9d\u53ef\u68a6\u3002")},a.selectMove=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=e?"opMoves":"myMoves",i=a.state[r];a.setState(Object(g.a)({},r,[].concat(Object(O.a)(i.slice(0,t)),[window.moves[n]],Object(O.a)(i.slice(t+1,i.length)))))},a}return Object(y.a)(t,e),Object(v.a)(t,[{key:"componentDidUpdate",value:function(){}},{key:"changeIndividual",value:function(){var e=Object(l.a)(s.a.mark(function e(t,a,n){var r,i,o,c,l,u,d,m;return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t?"opPokemon":"myPokemon",i=this.state[r],o=i.individual,c=i.name,l=i.charactor,u=Object(w.a)({},o,Object(g.a)({},a,n)),e.next=6,x("/api/damage/ability",{individual:u,pokemon:c,level:50,charactor:l},{method:"post"});case 6:d=e.sent,m=d.data.ability,this.setState(Object(g.a)({},r,Object(w.a)({},i,{ability:m,individual:u})));case 9:case"end":return e.stop()}},e,this)}));return function(t,a,n){return e.apply(this,arguments)}}()},{key:"selectCharactor",value:function(){var e=Object(l.a)(s.a.mark(function e(){var t,a,n,r,i,o,c=arguments;return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=c.length>0&&void 0!==c[0]&&c[0],a=c.length>1?c[1]:void 0,n=t?"opPokemon":"myPokemon",(r=this.state[n]).ability){e.next=7;break}return M.a.warn("\u8bf7\u5148\u9009\u62e9\u961f\u4f0d\u4e2d\u7684\u5b9d\u53ef\u68a6\u3002"),e.abrupt("return");case 7:return e.next=9,x("/api/damage/ability",{individual:r.individual,pokemon:r.name,level:50,charactor:a},{method:"post"});case 9:i=e.sent,o=i.data.ability,this.setState(Object(g.a)({},n,Object(w.a)({},r,{ability:o,charactor:a})));case 12:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"calculateDamage",value:function(){var e=Object(l.a)(s.a.mark(function e(){var t,a,n,r,i,o,c,l,u,d,m,h=arguments;return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=h.length>0&&void 0!==h[0]&&h[0],a=t?"op":"my",n=function(e){return x("/api/damage/min",e,{method:"post"})},r=function(e){return x("/api/damage/max",e,{method:"post"})},i=this.state["".concat(a,"Pokemon")],o=this.state["".concat("my"===a?"op":"my","Pokemon")],c=i.status,l=function(e){var t=e.englishName;return{level:50,attacker:i,defender:o,moveName:t}},i.ability){e.next=13;break}return M.a.warn("\u8bf7\u9009\u62e9\u653b\u51fb\u65b9\u5b9d\u53ef\u68a6\u3002"),e.abrupt("return");case 13:if(o.ability){e.next=18;break}return M.a.warn("\u8bf7\u9009\u62e9\u9632\u5fa1\u65b9\u5b9d\u53ef\u68a6\u3002"),e.abrupt("return");case 18:if(this.state["".concat(a,"Moves")].some(function(e){return e.englishName})){e.next=21;break}return M.a.warn("\u8bf7\u9009\u62e9\u653b\u51fb\u6280\u80fd\u3002"),e.abrupt("return");case 21:return u=this.state["".concat(a,"Moves")].map(function(e){return r(l(e))}),d=this.state["".concat(a,"Moves")].map(function(e){return n(l(e))}),e.next=25,Promise.all([].concat(d,u));case 25:m=(m=e.sent).map(function(e){return e.data.maxDamage||e.data.minDamage||"-"}),this.setState(function(e){return Object(g.a)({},"".concat(a,"Moves"),e["".concat(a,"Moves")].map(function(e,t){return Object(w.a)({},e,{damage:"".concat(Math.floor(m[t]*R(c))||m[t]," ~ ").concat(Math.floor(m[m.length/2+t]*R(c))||m[m.length/2+t])})}))});case 28:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){var e=this.state,t=e.myTeamList,a=e.opTeamList,n=e.myPokemon,r=e.opPokemon,i=e.myMoves,o=e.opMoves;return d.a.createElement(j.a,{className:"calculator-container"},d.a.createElement(Y,null,"Welcome"),d.a.createElement(G,null,d.a.createElement(A,{title:"\u4f60\u7684\u961f\u4f0d",teamList:t,options:this.PMOptions,handleClearMember:this.clearMember.bind(this,!1),handleAddMember:this.addTeamMember.bind(this,!1),handleSelectMember:this.selectMember.bind(this,!1),handleChooseMember:this.chooseMember.bind(this,!1)}),d.a.createElement(A,{title:"\u5bf9\u624b\u7684\u961f\u4f0d",teamList:a,options:this.PMOptions,handleClearMember:this.clearMember.bind(this,!0),handleAddMember:this.addTeamMember.bind(this,!0),handleSelectMember:this.selectMember.bind(this,!0),handleChooseMember:this.chooseMember.bind(this,!0)}),d.a.createElement("div",{className:"ability-area"},d.a.createElement(W,{pokemon:n,moves:i,options:this.moveOptions,abilityLevelOptions:this.abilityLevelOptions,charactorOptions:this.charactorOptions,statusOptions:this.statusOptions,handleChangeIndividual:this.changeIndividual.bind(this,!1),handleSelectAbLevel:this.selectAbilityLevel.bind(this,!1),handleSelectMove:this.selectMove.bind(this,!1),handleSelectCharactor:this.selectCharactor.bind(this,!1),handleSelectStatus:this.selectStatus.bind(this,!1),calculateDamage:this.calculateDamage.bind(this,!1)}),d.a.createElement(W,{pokemon:r,moves:o,options:this.moveOptions,abilityLevelOptions:this.abilityLevelOptions,statusOptions:this.statusOptions,handleChangeIndividual:this.changeIndividual.bind(this,!0),charactorOptions:this.charactorOptions,handleSelectAbLevel:this.selectAbilityLevel.bind(this,!0),handleSelectMove:this.selectMove.bind(this,!0),handleSelectCharactor:this.selectCharactor.bind(this,!0),handleSelectStatus:this.selectStatus.bind(this,!0),calculateDamage:this.calculateDamage.bind(this,!0)}))),d.a.createElement(V,null,"LGPE Calculator"))}}]),t}(u.Component),Object(k.a)(o.prototype,"changeIndividual",[n],Object.getOwnPropertyDescriptor(o.prototype,"changeIndividual"),o.prototype),Object(k.a)(o.prototype,"selectCharactor",[r],Object.getOwnPropertyDescriptor(o.prototype,"selectCharactor"),o.prototype),Object(k.a)(o.prototype,"calculateDamage",[i],Object.getOwnPropertyDescriptor(o.prototype,"calculateDamage"),o.prototype),o),$=(a(204),function(e){function t(){return Object(p.a)(this,t),Object(b.a)(this,Object(f.a)(t).apply(this,arguments))}return Object(y.a)(t,e),Object(v.a)(t,[{key:"render",value:function(){return d.a.createElement("div",{className:"App"},d.a.createElement(U,null))}}]),t}(u.Component)),q=function(){var e=Object(l.a)(s.a.mark(function e(){var t;return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,x("/public/pokeDex.json");case 2:t=e.sent,window.pokedex=t;case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),z=function(){var e=Object(l.a)(s.a.mark(function e(){var t;return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,x("/public/move.json");case 2:t=e.sent,window.moves=t;case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),K=function(){var e=Object(l.a)(s.a.mark(function e(){var t;return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,x("/public/charactor.json");case 2:t=e.sent,window.charactor=t;case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),Q=function(){var e=Object(l.a)(s.a.mark(function e(){var t;return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,x("/public/attribute.json");case 2:t=e.sent,window.attribute=t;case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}();Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));!function(){var e=Object(l.a)(s.a.mark(function e(){return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,q();case 2:return e.next=4,z();case 4:return e.next=6,K();case 6:return e.next=8,Q();case 8:return e.next=10,B();case 10:h.a.render(d.a.createElement($,null),document.getElementById("root"));case 11:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()(),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(function(e){e.unregister()})}},[[112,2,1]]]);
  //# sourceMappingURL=main.14decf9a.chunk.js.map