@r3l/app
Version:
2 lines • 29.1 kB
JavaScript
(window.__LOADABLE_LOADED_CHUNKS__=window.__LOADABLE_LOADED_CHUNKS__||[]).push([[49],{"./public/img/info.png":function(e,t,n){e.exports=n.p+"public/img/info.png"},"./src/modules/activity/activity.actions.js":function(e,t,n){"use strict";n.r(t),n.d(t,"setActivity",(function(){return g})),n.d(t,"resetActivity",(function(){return x})),n.d(t,"clearCount",(function(){return E})),n.d(t,"setCount",(function(){return w})),n.d(t,"getActivity",(function(){return T})),n.d(t,"markRead",(function(){return k})),n.d(t,"createNotification",(function(){return _})),n.d(t,"getNotificationCount",(function(){return P})),n.d(t,"showBannerPrompt",(function(){return S})),n.d(t,"hideBannerPrompt",(function(){return D})),n.d(t,"enableDesktopNotifications",(function(){return C})),n.d(t,"showBetPrompt",(function(){return I})),n.d(t,"showPushNotificationPrompt",(function(){return R}));var r=n("../../node_modules/@babel/runtime/helpers/defineProperty.js"),o=n.n(r),a=n("../../node_modules/@babel/runtime/helpers/asyncToGenerator.js"),s=n.n(a),i=n("../../node_modules/@babel/runtime/regenerator/index.js"),c=n.n(i),u=n("./src/core/actionTypes.js"),l=n("./src/modules/ui/error.actions.js"),p=n("./src/utils/index.ts");function d(){return m.apply(this,arguments)}function m(){return(m=s()(c.a.mark((function e(){var t,n,r;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.serviceWorker.ready;case 3:return t=e.sent,e.next=6,t.pushManager.getSubscription();case 6:if(!(n=e.sent)){e.next=9;break}return e.abrupt("return",n);case 9:return"BJp16DSJF-SdwZ3yxE2cK502FKKI7hxTON6YDoCaTctcq9sr3scJS1iTsa3YSlvOV-p2_P51cNWF5-os4Gc0rq4",r=f("BJp16DSJF-SdwZ3yxE2cK502FKKI7hxTON6YDoCaTctcq9sr3scJS1iTsa3YSlvOV-p2_P51cNWF5-os4Gc0rq4"),e.abrupt("return",t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:r}));case 14:return e.prev=14,e.t0=e.catch(0),console.log(e.t0),e.abrupt("return",null);case 18:case"end":return e.stop()}}),e,null,[[0,14]])})))).apply(this,arguments)}function f(e){for(var t=(e+"=".repeat((4-e.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/"),n=window.atob(t),r=new Uint8Array(n.length),o=0;o<n.length;++o)r[o]=n.charCodeAt(o);return r}(function(){try{"serviceWorker"in navigator&&window.addEventListener("load",(function(){return navigator.serviceWorker.register("/service-worker.js")}))}catch(e){console.log(e)}})();var b=n("./src/modules/auth/auth.actions.js"),h=n("./src/utils/env.js");function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var j="".concat(h.a,"/api/notification"),O=function(e){return{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer ".concat(e)}}};function g(e,t,n){return{type:u.E,payload:{data:e,type:t,index:n}}}function x(e){return{type:"RESET_ACTIVITY",payload:e}}function E(){return{type:"CLEAR_COUNT"}}function w(e){return{type:u.M,payload:e}}function T(e){return function(){var t=s()(c.a.mark((function t(n){var r,o;return c.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,r="personal",t.next=4,n(p.d.request({method:"GET",endpoint:"notification",path:"/",auth:!0,query:{skip:e}}));case 4:o=t.sent,n(g(o,r,e)),n(l.a("activity",!1)),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(0),l.a("activity",!0,t.t0.message);case 12:case"end":return t.stop()}}),t,null,[[0,9]])})));return function(e){return t.apply(this,arguments)}}()}function k(){return function(e){return p.h.getToken().then((function(e){return fetch("".concat(j,"/markread"),y(y({},O(e)),{},{method:"PUT"}))})).then((function(){e({type:"CLEAR_COUNT"})})).catch(null)}}function _(e){return function(){return p.h.getToken().then((function(t){return fetch("".concat(j),y(y({},O(t)),{},{method:"POST",body:JSON.stringify(e)}))})).catch(null)}}function P(){return function(){var e=s()(c.a.mark((function e(t){var n;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t(p.d.request({method:"GET",endpoint:"notification",path:"/unread",auth:!0}));case 3:n=e.sent,t(w(n.unread)),e.next=9;break;case 7:e.prev=7,e.t0=e.catch(0);case 9:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}()}function S(e,t){return{type:u.wb,payload:{promptType:e,promptProps:t}}}function D(e){return{type:u.k,payload:e}}function C(){return function(){var e=s()(c.a.mark((function e(t){var n;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,d();case 3:n=e.sent,t(Object(b.updateNotificationSettings)({desktop:{all:!0}},n.toJSON())),t(D()),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),console.log(e.t0);case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(t){return e.apply(this,arguments)}}()}var I=function(){var e=s()(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p.h.isDismissed("betDismissed",14);case 2:if(e.sent){e.next=5;break}return e.abrupt("return",t(S("bet")));case 5:return e.abrupt("return",!1);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),R=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(){var t=s()(c.a.mark((function t(n){return c.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",N({dispatch:n,promptProps:e}));case 2:return t.abrupt("return",B({dispatch:n,promptProps:e}));case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()};function N(e){return A.apply(this,arguments)}function A(){return(A=s()(c.a.mark((function e(t){var n,r;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.dispatch,r=t.promptProps,"undefined"==typeof Notification||"granted"!==Notification.permission&&"denied"!==Notification.permission){e.next=3;break}return e.abrupt("return",!1);case 3:return e.next=5,p.h.isDismissed("pushDismissed",30);case 5:if(!e.sent){e.next=8;break}return e.abrupt("return",!1);case 8:return e.abrupt("return",n(S("push",r)));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function B(e){return K.apply(this,arguments)}function K(){return(K=s()(c.a.mark((function e(t){var n,r;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.dispatch,r=t.promptProps,e.abrupt("return",!1);case 3:return e.next=5,new Promise((function(e,t){(void 0).checkPermissions((function(n){return n?e(n):t()}))}));case 5:if(!e.sent.alert){e.next=8;break}return e.abrupt("return",!1);case 8:return e.next=10,p.h.isDismissed("pushDismissed",21);case 10:if(!e.sent){e.next=13;break}return e.abrupt("return",!1);case 13:return e.abrupt("return",n(S("push",y(y({},r),{},{isMobile:!0}))));case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},"./src/modules/community/community.selectors.ts":function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return a})),n.d(t,"c",(function(){return i}));var r,o=n("../../node_modules/react-redux/es/index.js");!function(e){e[e.MASTER=4]="MASTER",e[e.OWNER=3]="OWNER",e[e.ADMIN=2]="ADMIN",e[e.USER=1]="USER",e[e.GUEST=0]="GUEST"}(r||(r={}));var a=function(e){return Object(o.d)((function(t){return t.community.communities[e||t.community.active]}))},s=function(){var e,t=Object(o.d)((function(e){var t,n;return"admin"===(null===(t=e.auth)||void 0===t||null===(n=t.user)||void 0===n?void 0:n.role)})),n=(e=Object(o.d)((function(e){return e.community.active})),Object(o.d)((function(e){return e.community.userMemberships})).find((function(t){return t.community===e})));switch(!0){case t:return r.MASTER;case!(null==n||!n.superAdmin):return r.OWNER;case"admin"===(null==n?void 0:n.role):return r.ADMIN;case"user"===(null==n?void 0:n.role):return r.USER;default:return r.GUEST}},i=function(e){return s()>=e}},"./src/modules/post/bet/bet.js":function(e,t,n){"use strict";n.r(t),n.d(t,"BetContainer",(function(){return B}));var r=n("../../node_modules/@babel/runtime/helpers/asyncToGenerator.js"),o=n.n(r),a=n("../../node_modules/@babel/runtime/helpers/slicedToArray.js"),s=n.n(a),i=n("../../node_modules/@babel/runtime/helpers/extends.js"),c=n.n(i),u=n("../../node_modules/@babel/runtime/regenerator/index.js"),l=n.n(u),p=n("../../node_modules/react/index.js"),d=n.n(p),m=n("../../node_modules/prop-types/index.js"),f=n.n(m),b=n("../../node_modules/react-redux/es/index.js"),h=n("./src/modules/styled/index.ts"),v=n("./src/utils/numbers.js"),y=n("../../node_modules/@r3l/common/lib/index.js"),j=n("./src/modules/stats/coinStat.component.js"),O=n("./src/modules/post/invest.actions.js"),g=n("./src/modules/navigation/navigation.actions.js"),x=n("./src/modules/tooltip/tooltip.component.js"),E=n("./src/modules/wallet/price.context.js"),w=n("./src/modules/community/community.selectors.ts"),T=n("./src/utils/post.js"),k=n("./src/styles/index.js");function _(e){var t=e.percent,n=e.color,r=e.text,o=e.strokeWidth,a=e.w,s=e.h,i=15.91549430918954,c=2*i+o;return d.a.createElement("svg",{height:s||"100%",width:a||"100%",viewBox:"0 0 ".concat(c," ").concat(c)},d.a.createElement("circle",{cx:"50%",cy:"50%",r:i,fill:"none",strokeWidth:o,stroke:k.b.lightBorder}),d.a.createElement("circle",{cx:"50%",cy:"50%",r:i,fill:"none",strokeWidth:o,stroke:n,strokeDasharray:"".concat(100-t,", ").concat(t),strokeDashoffset:125-t}),r&&d.a.createElement("text",{fontSize:"10px",x:"50%",y:"60%",fill:k.b.black,textAnchor:"middle",fontFamily:"HelveticaNeue-CondensedBold"},r))}_.propTypes={percent:f.a.number,color:f.a.string,text:f.a.string,strokeWidth:f.a.number,w:f.a.string,h:f.a.string},S.propTypes={post:f.a.object,earning:f.a.object,amount:f.a.number,maxBet:f.a.number};var P=Object(p.memo)(S);function S(e){var t,n,r,o,a,s=e.post,i=e.amount,c=e.earning,u=e.maxBet,l=(null==c?void 0:c.shares)||0,m=(null==c?void 0:c.stakedTokens)||0,f=(null==s||null===(t=s.data)||void 0===t?void 0:t.bets)||(null==s||null===(n=s.data)||void 0===n?void 0:n.upVotes),b=f>1?"users":"user",y=f&&null!=s&&null!==(r=s.data)&&void 0!==r&&r.totalShares?"".concat(f," ").concat(b," bet a total of ").concat(Object(v.abbreviateNumber)((null==s||null===(o=s.data)||void 0===o?void 0:o.totalShares)||0)," coins on this post"):"You are the first to bet on this post. This means you win big if it becomes relevant!",j=Object(T.a)({post:s,stakedTokens:i}),O=100*(f?(j+l)/(s.data.shares+j):(m+i)/(u+m)),g=d.a.createElement(h.D,null," ",d.a.createElement(h.G,{sx:{top:2}},d.a.createElement(_,{w:"12px",h:"12px",percent:100-O,strokeWidth:30,color:k.b.blue}))," ",Object(v.abbreviateNumber)(O),"%");return d.a.createElement(p.Fragment,null,d.a.createElement(h.D,null,y),null!=s&&null!==(a=s.data)&&void 0!==a&&a.totalShares?d.a.createElement(h.B,{sx:{mt:2.001,alignItems:"baseline"}},d.a.createElement(h.D,null,"Your estimated share of post payout:"),d.a.createElement(h.D,null,g)):null)}function D(e){var t=e.children,n=e.onPress;return d.a.createElement(h.t,{sx:{borderWidth:1,borderColor:"blue",width:9,height:9,minWidth:[0,0],borderRadius:32,bg:"white",pb:2.0001},onPress:n},d.a.createElement(h.y,{sx:{color:"blue",fontSize:3,lineHeight:3}},t))}D.propTypes={children:f.a.node,onPress:f.a.func};var C=n("../../node_modules/@babel/runtime/helpers/objectWithoutProperties.js"),I=n.n(C),R=["amount"];function N(e){var t=e.amount,n=I()(e,R);return d.a.createElement(j.a,c()({size:1,fs:1.5,secondary:!0,c:k.b.black,inline:1,amount:t},n))}function A(e){e.setToken,e.reCaptchaRef,e.action;return null}function B(e){var t=c()({},e),n=Object(b.d)((function(e){return e.auth.user}))||{},r=Object(b.d)((function(e){return e.posts.posts[e.navigation.modalData.postId]}));return n&&r?d.a.createElement(K,c()({user:n,post:r},t)):null}function K(e){var t,n,r=e.user,a=e.post,i=e.close,c=Object(b.c)(),u=Object(w.b)(),m=Object(p.useState)(),f=s()(m,2),T=f[0],k=f[1],_=Object(p.useRef)(),S=Object(b.d)((function(e){return u?e.earnings.pending.map((function(t){return e.earnings.entities[t]})).find((function(e){return e.post===a._id&&e.communityId===(null==u?void 0:u._id)})):null})),C=Object(p.useState)(!1),I=s()(C,2),R=I[0],B=I[1],K=S?"Increase Your Bet":"Bet on the Relevance of this Post",W=(null==S?void 0:S.stakedTokens)||0,F=r.balance+r.tokenBalance,U=Math.min(y.MAX_BET-W,F-r.lockedTokens),G=Math.max(U*y.VOTE_COST_RATIO,0),M=Object(p.useState)(G),L=s()(M,2),q=L[0],z=L[1],J=Object(p.useState)(Object(v.timeLeftTick)(null==a||null===(t=a.data)||void 0===t?void 0:t.payoutTime)),H=s()(J,2),V=H[0],Y=H[1];if(Object(p.useEffect)((function(){if(!a.data)return function(){return null};var e=setInterval((function(){var e;return Y(Object(v.timeLeftTick)(null==a||null===(e=a.data)||void 0===e?void 0:e.payoutTime))}),1e3);return function(){return clearInterval(e)}}),[null==a||null===(n=a.data)||void 0===n?void 0:n.payoutTime,V]),!r||!a||!a.data)return null;var Z=function(){var e=o()(l.a.mark((function e(){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,B(!0),e.next=4,c(Object(O.bet)({postId:a._id,stakedTokens:q,recaptcha:T}));case 4:B(!1),i(),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),B(!1);case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}(),X=Object(E.exchangeLink)(),$=100*q/U;return d.a.createElement(h.K,null,d.a.createElement(h.s,{sx:{mr:2}},K," ",d.a.createElement(x.a,{inline:1,name:"betInfo",data:{text:"Posts that get upvoted by lots of users with high Reputation get payouts.\n\nBet more coins and bet early in order to win the biggest portion of the payout."},info:!0})),d.a.createElement(h.B,{sx:{alignItems:"baseline"}},d.a.createElement(h.D,{sx:{mt:1,mr:1}},"Time until payout: ",V)),d.a.createElement(h.B,{sx:{mt:4,justifyContent:"space-between",alignItems:"center"}},d.a.createElement(D,{onPress:function(){return z((function(e){var t=(U-G)/5,n=G/5,r=G/100;return e-n<=0+r?e:e-t>=G-r?e-t:Math.max(0,e-n)}))}},"–"),d.a.createElement(h.K,{sx:{pr:1}},d.a.createElement(j.a,{align:"center",fs:4.5,lh:4.5,size:5,spaceBetween:1,c:"black",amount:q})),d.a.createElement(D,{onPress:function(){return z((function(e){var t=(U-G)/5,n=G/5;return e+n<=G+G/100?e+n:Math.min(e+t,U)}))}},"+")),d.a.createElement(h.K,{sx:{mt:2}},d.a.createElement(h.B,{sx:{height:4.001}},d.a.createElement(h.f,{sx:{width:"".concat($,"%"),bg:"blue"}}),d.a.createElement(h.f,{sx:{width:"".concat(100-$,"%"),bg:"lightBorder"}})),d.a.createElement(h.B,{sx:{justifyContent:"space-between"}},d.a.createElement(h.C,{sx:{mt:4.001}},"Available Coins:"," ",d.a.createElement(N,{amount:F-r.lockedTokens-q})),Object(E.tokenEnabled)()&&d.a.createElement(h.w,{hu:!0,inline:!0,to:X,nativeAction:function(){return c(Object(g.goToUrl)(X))},external:!0,target:"_blank"},d.a.createElement(h.C,{sx:{color:"blue",lineHeight:2}},"Get more coins")))),d.a.createElement(h.K,{sx:{mt:3}},d.a.createElement(P,{maxBet:U,post:a,amount:q,earning:S})),d.a.createElement(h.t,{sx:{mt:3},onPress:Z,disabled:R||!q},"Bet ",Object(v.abbreviateNumber)(q)," Coins"),d.a.createElement(h.D,{sx:{mt:2}},"*All coins will be returned to your wallet 3 days after you place your bet."),d.a.createElement(A,{reCaptchaRef:_,action:"bet",setToken:k}))}N.propTypes={amount:f.a.number},K.propTypes={user:f.a.object,post:f.a.object,close:f.a.func};t.default=Object(p.memo)(B)},"./src/modules/post/invest.actions.js":function(e,t,n){"use strict";n.r(t),n.d(t,"updatePostVote",(function(){return y})),n.d(t,"undoPostVote",(function(){return j})),n.d(t,"setInvestments",(function(){return O})),n.d(t,"loadingInvestments",(function(){return g})),n.d(t,"setPostInvestments",(function(){return x})),n.d(t,"vote",(function(){return E})),n.d(t,"getInvestments",(function(){return w})),n.d(t,"loadingPostInvestments",(function(){return T})),n.d(t,"getPostInvestments",(function(){return k})),n.d(t,"bet",(function(){return _}));var r=n("../../node_modules/@babel/runtime/helpers/asyncToGenerator.js"),o=n.n(r),a=n("../../node_modules/@babel/runtime/regenerator/index.js"),s=n.n(a),i=n("../../node_modules/normalizr/dist/normalizr.es.js"),c=n("./src/core/actionTypes.js"),u=n("./src/utils/index.ts"),l=n("./src/modules/post/post.actions.js"),p=n("./src/modules/activity/activity.actions.js"),d=n("./src/utils/recaptcha/web.js"),m=u.c.Alert(),f=new i.b.Entity("links",{},{idAttribute:"_id"}),b=new i.b.Entity("posts",{metaPost:f},{idAttribute:"_id"}),h=new i.b.Entity("users",{},{idAttribute:"_id"}),v=new i.b.Entity("investments",{post:b,investor:h},{idAttribute:"_id"});function y(e){return{type:c.Ib,payload:e}}function j(e){return{type:c.Bb,payload:e}}function O(e,t,n){return{type:c.U,payload:{investments:e,userId:t,index:n}}}function g(){return{type:c.n}}function x(e,t,n){return{type:c.db,payload:{postId:t,data:e,index:n||0}}}function E(e){var t=e.amount,n=e.post,r=e.userId,a=e.vote,i=e.displayBetPrompt;return function(){var e=o()(s.a.mark((function e(o){var c,l;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,o(a?j(n._id):y({post:n._id,amount:t})),e.next=4,o(u.d.request({method:"POST",endpoint:"invest",path:"/",body:JSON.stringify({investor:r,amount:t,post:(null==n?void 0:n._id)||n})}));case 4:if((c=e.sent).undoInvest?o(j(n._id)):o(y(c.investment)),l=!!n.parentPost,!(t>0)||a){e.next=12;break}return e.next=10,o(Object(p.showPushNotificationPrompt)({type:l?"upvoteComment":"upvotePost"}));case 10:!e.sent&&i&&o(p.showBetPrompt);case 12:return e.abrupt("return",c);case 15:return e.prev=15,e.t0=e.catch(0),o(a?y({post:n._id,amount:t}):j(n._id)),e.abrupt("return",m.alert(e.t0.message));case 19:case"end":return e.stop()}}),e,null,[[0,15]])})));return function(t){return e.apply(this,arguments)}}()}function w(e,t,n){return function(){var r=o()(s.a.mark((function r(o){var a,c;return s.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,o(g()),r.next=4,o(u.d.request({method:"GET",endpoint:"invest",path:"/"+e,query:{skip:t,limit:n}}));case 4:a=r.sent,c=Object(i.a)({investments:a},{investments:[v]}),o(Object(l.setPostsSimple)(c)),o(O(c,e,t)),r.next=12;break;case 10:r.prev=10,r.t0=r.catch(0);case 12:case"end":return r.stop()}}),r,null,[[0,10]])})));return function(e){return r.apply(this,arguments)}}()}function T(e){return{type:c.o,payload:e}}function k(e,t,n){return function(){var r=o()(s.a.mark((function r(o){var a,c;return s.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,o(T(e)),r.next=4,o(u.d.request({method:"GET",endpoint:"invest",query:{skip:n,limit:t},path:"/post/".concat(e)}));case 4:a=r.sent,c=Object(i.a)({investments:a},{investments:[v]}),o(Object(l.setUsers)(c.entities.users)),o(x(c,e,n)),r.next=12;break;case 10:r.prev=10,r.t0=r.catch(0);case 12:case"end":return r.stop()}}),r,null,[[0,10]])})));return function(e){return r.apply(this,arguments)}}()}function _(e){var t=e.postId,n=e.stakedTokens,r=e.recaptcha;return function(){var e=o()(s.a.mark((function e(o){var a,i;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,e.t0=r,e.t0){e.next=6;break}return e.next=5,Object(d.a)("bet");case 5:e.t0=e.sent;case 6:return a=e.t0,e.next=9,o(u.d.request({method:"POST",endpoint:"invest",path:"/bet",body:JSON.stringify({postId:t,stakedTokens:n,recaptcha:a})}));case 9:return i=e.sent,e.abrupt("return",o(y(i)));case 13:throw e.prev=13,e.t1=e.catch(0),m.alert(e.t1.message),e.t1;case 17:case"end":return e.stop()}}),e,null,[[0,13]])})));return function(t){return e.apply(this,arguments)}}()}},"./src/modules/stats/coinStat.component.js":function(e,t,n){"use strict";var r=n("../../node_modules/@babel/runtime/helpers/extends.js"),o=n.n(r),a=n("../../node_modules/@babel/runtime/helpers/objectWithoutProperties.js"),s=n.n(a),i=n("../../node_modules/react/index.js"),c=n.n(i),u=n("../../node_modules/prop-types/index.js"),l=n.n(u),p=n("./src/utils/numbers.js"),d=n("./src/utils/propValidation.js"),m=n("./src/modules/wallet/price.context.js"),f=n("./src/modules/styled/index.ts"),b=(n("./src/web3/hooks/index.ts"),n("./src/web3/utils/index.ts"),["user","isOwner","wallet","size","amount","mr","align","noNumber","secondary","fs","lh","inline","c","spaceBetween","showPrice","noSpace"]),h=n("./public/img/relevantcoin.png");function v(e){var t,n=e.user,r=(e.isOwner,e.wallet,e.size),a=void 0===r?3:r,i=e.amount,u=e.mr,l=e.align,d=e.noNumber,v=e.secondary,y=e.fs,j=e.lh,O=e.inline,g=e.c,x=e.spaceBetween,E=e.showPrice,w=e.noSpace,T=s()(e,b);"number"==typeof i?t=i:n&&(t=n.balance+n.pendingCashout,n.fullTokenBalance&&(t+=n.fullTokenBalance));var k=Object(m.usePrice)(t),_=v?f.C:f.z,P="center"===l?-1:1,S=O?f.G:f.B,D="number"==typeof x?x:a;return c.a.createElement(S,o()({},T,{sx:{alignItems:l||"center",mr:"number"===u?u:O?0:1.5}}),c.a.createElement(f.v,{source:h,sx:{height:a,width:a,transform:[{translateY:P}]},resizeMode:"contain"}),d?null:c.a.createElement(_,{sx:{color:g,fontSize:8.001*y||2,lineHeight:8.001*j||2}},w?"":" ",c.a.createElement(f.B,{sx:{width:D+1e-4,height:0}}),Object(p.abbreviateNumber)(t),E?k:""))}v.propTypes={lh:l.a.number,inline:l.a.oneOfType([l.a.bool,l.a.number]),secondary:l.a.bool,mr:l.a.number,fs:l.a.number,amount:l.a.number,size:l.a.number,user:d.c,isOwner:l.a.bool,wallet:l.a.object,align:l.a.string,lineheight:l.a.string,c:l.a.string,noNumber:l.a.bool,spaceBetween:l.a.number,showPrice:l.a.bool,noSpace:l.a.bool},t.a=Object(i.memo)(v)},"./src/modules/tooltip/tooltip.component.js":function(e,t,n){"use strict";n.d(t,"a",(function(){return T}));var r=n("../../node_modules/@babel/runtime/helpers/extends.js"),o=n.n(r),a=n("../../node_modules/@babel/runtime/helpers/objectWithoutProperties.js"),s=n.n(a),i=n("../../node_modules/react/index.js"),c=n.n(i),u=n("../../node_modules/react-redux/es/index.js"),l=n("../../node_modules/prop-types/index.js"),p=n.n(l),d=n("../../node_modules/@dripsy/core/build/css/styled.js"),m=n("../../node_modules/@babel/runtime/helpers/defineProperty.js"),f=n.n(m),b=n("../../node_modules/react-native-web/dist/exports/Dimensions/index.js"),h=n("./src/modules/tooltip/tooltip.actions.js");function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach((function(t){f()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var j={vertical:"top",horizontal:"right",horizontalOffset:0,verticalOffset:10};var O=n("../../node_modules/react-tooltip/dist/index.es.js"),g=n("./src/modules/styled/index.ts"),x=["children","name","data","info","inline"],E=n("./public/img/info.png"),w=Object(d.a)(g.G)({position:"absolute",top:0,left:0,bottom:0,right:0,overflow:"hidden",zIndex:1e3});function T(e){var t=e.children,n=e.name,r=e.data,a=e.info,l=e.inline,p=s()(e,x);Object(i.useEffect)((function(){O.a.rebuild&&O.a.rebuild()}),[r,n,t]),Object(i.useEffect)((function(){return r.shouldRegister&&T()}),[r.shouldRegister,T]);var d=Object(u.c)(),m=Object(i.useRef)(),f=function(e){var t=e.tooltips,n=e.dispatch,r=function(e){t.forEach((function(t){t.data.desktopOnly||t.el.current&&t.el.current.measureInWindow((function(r,o,a,s){var i={x:r,y:o,w:a,h:s};r+o+a+s!==0&&(o>b.a.get("window").height-50||(n(Object(h.setTooltipData)(y(y({name:t.name,parent:i},j),{},{data:t.data}))),n(Object(h.showTooltip)(e))))}))}))};return{initTooltips:function(){t.forEach((function(e){return e.data.desktopOnly?null:n(Object(h.setTooltipData)({name:e.name,toggle:function(){return r(e.name)}}))}))},toggleTooltip:r}}({tooltips:[{name:n,el:m,data:r}],dispatch:d}),v=f.toggleTooltip,T=f.initTooltip,k=t&&g.K||w;return a?c.a.createElement(g.G,{ref:m,onPress:(r.desktopOnly,null)},c.a.createElement(g.v,o()({dataSet:{tip:JSON.stringify({type:"TEXT",props:r}),for:"mainTooltip",place:r.position,"event-off":"click"},source:E,resizeMode:"contain",sx:{height:2,width:2},inline:l},p))):c.a.createElement(k,{ref:m,dataSet:{tip:JSON.stringify({type:"TEXT",props:r}),for:"mainTooltip",place:r.position,"event-off":"click"},onLongPress:function(){return v(n)},onPress:(r.desktopOnly,null)},t)}T.propTypes={name:p.a.string,data:p.a.object,children:p.a.object,info:p.a.bool,inline:p.a.oneOfType([p.a.bool,p.a.number])}},"./src/modules/wallet/price.context.js":function(e,t,n){"use strict";n.r(t),n.d(t,"PriceContext",(function(){return g})),n.d(t,"exchangeLink",(function(){return x})),n.d(t,"tokenEnabled",(function(){return E})),n.d(t,"usePrice",(function(){return w})),n.d(t,"default",(function(){return T}));var r=n("../../node_modules/@babel/runtime/helpers/defineProperty.js"),o=n.n(r),a=n("../../node_modules/@babel/runtime/helpers/asyncToGenerator.js"),s=n.n(a),i=n("../../node_modules/@babel/runtime/helpers/slicedToArray.js"),c=n.n(i),u=n("../../node_modules/@babel/runtime/regenerator/index.js"),l=n.n(u),p=n("../../node_modules/react/index.js"),d=n.n(p),m=n("../../node_modules/prop-types/index.js"),f=n.n(m),b=n("./src/utils/numbers.js");n("./src/utils/env.js");function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var y=Object({BROWSER:!0,NODE_ENV:"production",WEB:"true",NETWORK_NUMBER:"1",VAPID_PUBLIC_KEY:"BJp16DSJF-SdwZ3yxE2cK502FKKI7hxTON6YDoCaTctcq9sr3scJS1iTsa3YSlvOV-p2_P51cNWF5-os4Gc0rq4",INFURA_PROTOCOL:"ws",INFURA_API_KEY:"7d2819de98bb46108cae44811facb5e0",TOKEN_ADDRESS:"0xb6c4267C4877BB0D6b1685Cfd85b0FBe82F105ec",RECAPTCHA_KEY:"6LeyI8EZAAAAAN4S0f9BaSOf7Hks5xTR7CebrgsG"}),j=y.TOKEN_ADDRESS,O=y.DISABLE_PRICE,g=d.a.createContext(0);function x(){return"https://uniswap.exchange/swap?theme=dark&outputCurrency=".concat(j)}function E(){return!!j}function w(e,t){var n=Object(p.useContext)(g).price;return n?"number"===t?Object(b.abbreviateNumber)(n*e):" ($".concat(Object(b.abbreviateNumber)(n*e,2),")"):""}function T(e){var t=e.children,n=Object(p.useReducer)(k,{loading:!1,error:!1,data:null,refresh:0}),r=c()(n,2),o=r[0],a=r[1];Object(p.useEffect)((function(){return function(){var e=s()(l.a.mark((function e(){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a({type:"FETCH_PRICE_INIT"}),j&&!O){e.next=3;break}return e.abrupt("return");case 3:case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()(),setTimeout((function(){a({type:"REFRESH_PRICE"})}),6e4),function(){!0}}),[o.refresh]);var i=function(e){if(!e)return null;var t=e.ethReserve,n=e.tokenReserve,r=e.ethPrice;if(!t||!n)return null;var o=t.amount.div(n.amount).times(r);return parseFloat(o.toString())}(o.data),u="($".concat(Object(b.abbreviateNumber)(i,2),")");return d.a.createElement(g.Provider,{value:{price:i,priceString:u}},t)}T.propTypes={children:f.a.node};var k=function(e,t){switch(t.type){case"REFRESH_PRICE":return v(v({},e),{},{refresh:e.refresh+1});case"FETCH_PRICE_INIT":return v(v({},e),{},{loading:!0,error:!1});case"FETCH_PRICE_SUCCESS":return v(v({},e),{},{loading:!1,error:!1,data:t.payload});case"FETCH_PRICE_ERROR":return v(v({},e),{},{loading:!1,error:t.payload});default:throw new Error}}},"./src/utils/propValidation.js":function(e,t,n){"use strict";n.d(t,"c",(function(){return s})),n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return c}));var r=n("../../node_modules/prop-types/index.js"),o=n.n(r),a=n("../../node_modules/react-is/index.js"),s=o.a.shape({handle:o.a.string,balance:o.a.number,image:o.a.string,name:o.a.string}),i=(o.a.shape({_id:o.a.string.isRequired,user:o.a.string.isRequired,title:o.a.string,embeddedUser:o.a.object,tags:o.a.array,body:o.a.string,postDate:o.a.instanceOf(Date),data:o.a.object,link:o.a.object,parentPost:o.a.number,type:o.a.string}),o.a.shape({isAuthenticated:o.a.bool,user:s,community:o.a.string}));function c(e,t,n){if(e[t]&&!Object(a.isValidElementType)(e[t]))return new Error("Invalid prop '".concat(t,"' supplied to '").concat(n,"': the prop is not a valid React component"))}}}]);
//# sourceMappingURL=post-bet-bet.bundle.6ffaee31136d786c456e.js.map