{"size": 9354, "ext": "js", "max_stars_repo_path": "docs/static/js/main.3eefd69f.chunk.js", "max_stars_repo_name": "snpnz/snpnz.github.io", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "docs/static/js/main.3eefd69f.chunk.js", "max_issues_repo_name": "snpnz/snpnz.github.io", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "docs/static/js/main.3eefd69f.chunk.js", "max_forks_repo_name": "snpnz/snpnz.github.io", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 4677.0, "max_line_length": 9306, "alphanum_fraction": 0.6860166774}
(this.webpackJsonpsnpnz=this.webpackJsonpsnpnz||[]).push([[0],{12:function(e,t,n){e.exports={qrScanner:"style_qrScanner__3EnCA",header:"style_header__3T4Oc",cameraSwitchBtn:"style_cameraSwitchBtn__1-pio"}},18:function(e,t,n){},20:function(e,t,n){},30:function(e,t,n){"use strict";n.r(t);var r=n(1),c=n.n(r),a=n(9),i=n.n(a),o=(n(18),n(3)),s=n.n(o),l=n(4),u=n(2),h=(n(20),n(13),"73436");function d(){return(d=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=3,fetch("https://www.strava.com/oauth/deauthorize?".concat(new URLSearchParams({access_token:""}).toString()),{method:"POST"}).then((function(e){return e.json()}));case 3:return localStorage.clear(),e.abrupt("return",Promise.resolve({success:!0}));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var f=n(8),j=n.n(f);function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function b(e,t){if(null==e)return{};var n,r,c=function(e,t){if(null==e)return{};var n,r,c={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(c[n]=e[n]);return c}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}var v=r.createElement("rect",{fill:"none",height:24,width:24}),O=r.createElement("path",{d:"M9.5,6.5v3h-3v-3H9.5 M11,5H5v6h6V5L11,5z M9.5,14.5v3h-3v-3H9.5 M11,13H5v6h6V13L11,13z M17.5,6.5v3h-3v-3H17.5 M19,5h-6v6 h6V5L19,5z M13,13h1.5v1.5H13V13z M14.5,14.5H16V16h-1.5V14.5z M16,13h1.5v1.5H16V13z M13,16h1.5v1.5H13V16z M14.5,17.5H16V19h-1.5 V17.5z M16,16h1.5v1.5H16V16z M17.5,14.5H19V16h-1.5V14.5z M17.5,17.5H19V19h-1.5V17.5z M22,7h-2V4h-3V2h5V7z M22,22v-5h-2v3h-3v2 H22z M2,22h5v-2H4v-3H2V22z M2,2v5h2V4h3V2H2z"});function m(e,t){var n=e.title,c=e.titleId,a=b(e,["title","titleId"]);return r.createElement("svg",p({xmlns:"http://www.w3.org/2000/svg",enableBackground:"new 0 0 24 24",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#000000",ref:t,"aria-labelledby":c},a),n?r.createElement("title",{id:c},n):null,v,O)}var g=r.forwardRef(m),x=(n.p,n(10)),w=n.n(x),y=n(6),S=n.n(y);function M(){return(M=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function _(e,t){if(null==e)return{};var n,r,c=function(e,t){if(null==e)return{};var n,r,c={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(c[n]=e[n]);return c}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}var V=r.createElement("g",null,r.createElement("rect",{fill:"none",height:24,width:24})),H=r.createElement("g",null,r.createElement("g",null,r.createElement("path",{d:"M9,12c0,1.66,1.34,3,3,3s3-1.34,3-3s-1.34-3-3-3S9,10.34,9,12z"}),r.createElement("path",{d:"M8,10V8H5.09C6.47,5.61,9.05,4,12,4c3.72,0,6.85,2.56,7.74,6h2.06c-0.93-4.56-4.96-8-9.8-8C8.73,2,5.82,3.58,4,6.01V4H2v6 H8z"}),r.createElement("path",{d:"M16,14v2h2.91c-1.38,2.39-3.96,4-6.91,4c-3.72,0-6.85-2.56-7.74-6H2.2c0.93,4.56,4.96,8,9.8,8c3.27,0,6.18-1.58,8-4.01V20 h2v-6H16z"})));function E(e,t){var n=e.title,c=e.titleId,a=_(e,["title","titleId"]);return r.createElement("svg",M({xmlns:"http://www.w3.org/2000/svg",enableBackground:"new 0 0 24 24",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#000000",ref:t,"aria-labelledby":c},a),n?r.createElement("title",{id:c},n):null,V,H)}var z=r.forwardRef(E),k=(n.p,n(0)),C=function(e){var t=e.onChange,n=c.a.useState("environment"),r=Object(u.a)(n,2),a=r[0],i=r[1],o=c.a.useState(null),s=Object(u.a)(o,2),l=s[0],h=s[1];return Object(k.jsxs)("div",{className:S.a.qrScanner,children:[Object(k.jsx)("button",{className:S.a.cameraSwitchBtn,onClick:function(){return i((function(e){return"user"===a?"environment":"user"}))},children:Object(k.jsx)(z,{})}),Object(k.jsx)("h3",{className:S.a.header,onDoubleClick:function(){return t("CECUt8XuFLHqLDJt")},children:"\u041d\u0430\u0432\u0435\u0434\u0438\u0442\u0435 \u043a\u0430\u043c\u0435\u0440\u0443 \u043d\u0430 QR-\u043a\u043e\u0434"}),Object(k.jsx)(w.a,{delay:600,onError:function(e){console.log(e)},onScan:function(e){e!==l&&(e&&t(e),h(e))},style:{width:"100%",height:"100%"},facingMode:a})]})},P=n(12),B=n.n(P);function q(e,t){var n=Object(u.a)(e,2),r=n[0],c=n[1],a=Object(u.a)(t,2),i=a[0],o=a[1],s=r*Math.PI/180,l=i*Math.PI/180,h=(i-r)*Math.PI/180,d=(o-c)*Math.PI/180,f=Math.sin(h/2)*Math.sin(h/2)+Math.cos(s)*Math.cos(l)*Math.sin(d/2)*Math.sin(d/2);return 6371e3*(2*Math.atan2(Math.sqrt(f),Math.sqrt(1-f)))}var I=function(e){var t=e.code,n=e.points,r=c.a.useState(null),a=Object(u.a)(r,2),i=a[0],o=a[1],s=c.a.useState(null),l=Object(u.a)(s,2),h=l[0],d=l[1],f=c.a.useState(null),j=Object(u.a)(f,2),p=j[0],b=j[1],v=function(){navigator.geolocation?(b("Locating..."),navigator.geolocation.getCurrentPosition((function(e){b(null),o(e.coords.latitude),d(e.coords.longitude)}),(function(){b("Unable to retrieve your location")}))):b("Geolocation is not supported by your browser")};if(c.a.useEffect((function(){v()}),[]),!i||!h)return Object(k.jsx)(k.Fragment,{children:Object(k.jsx)("button",{onClick:v,children:"Get Location"})});var O,m=n.find((function(e){return e.code===t})),g=q([m.point[0],m.point[1]],[i,h]);return Object(k.jsxs)("div",{className:B.a.qrScanner,children:[Object(k.jsx)("p",{children:p}),Object(k.jsxs)("b",{children:["\u0414\u043e \u0442\u043e\u0447\u043a\u0438: ",(O=g,O>0?O>1e3?"".concat((O/1e3).toFixed(2),"\u202f\u043a\u043c"):"".concat(O.toFixed(),"\u2009\u043c"):"-")]}),Object(k.jsx)("h3",{children:Object(k.jsx)("a",{href:"geo:".concat(i,",").concat(h),children:m.name})}),Object(k.jsx)("em",{children:m.description})]})},L=function(e){return{code:e.code,description:e.description,id:+e.id,name:e.name,point:e.point.split(",").map(Number)}},N=function(){var e=c.a.useState(!1),t=Object(u.a)(e,2),n=t[0],r=t[1],a=c.a.useState(null),i=Object(u.a)(a,2),o=i[0],s=i[1],l=c.a.useState(null),h=Object(u.a)(l,2),d=h[0],f=h[1];return c.a.useEffect((function(){fetch("/api/points/",{credentials:"include"}).then((function(e){return e.json()})).then((function(e){f(e.data.map(L))}))}),[]),Object(k.jsxs)("div",{className:j.a.qrScanner,children:[!o&&Object(k.jsxs)("div",{children:[!n&&Object(k.jsxs)("button",{className:j.a.ololo,onClick:function(){return r((function(e){return!e}))},children:["\u0421\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c QR-\u043a\u043e\u0434 ",Object(k.jsx)(g,{})]}),n&&Object(k.jsx)(C,{onChange:function(e){s(e)}})]}),d&&o&&Object(k.jsx)(I,{code:o,points:d})]})};var F=function(){var e=Object(r.useState)(null),t=Object(u.a)(e,2),n=t[0],c=t[1],a=Object(r.useState)(!0),i=Object(u.a)(a,2),o=(i[0],i[1],Object(r.useState)("")),f=Object(u.a)(o,2),j=f[0],p=f[1];return Object(r.useEffect)((function(){(function(){var e=Object(l.a)(s.a.mark((function e(){var t,n;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch("/api/user/",{credentials:"include"});case 3:return t=e.sent,e.next=6,t.json();case 6:!1===(n=e.sent).success?c(void 0):c(n.data),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),p(e.t0.message);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(){return e.apply(this,arguments)}})()().then()}),[]),null===n?Object(k.jsx)("div",{children:"Loading..."}):void 0===n?Object(k.jsx)("div",{className:"App",children:Object(k.jsx)("button",{className:"bigButton",onClick:function(){return window.location.href=function(){var e={client_id:h,redirect_uri:"http://localhost/oauth/?redir="+window.location.origin,response_type:"code",approval_prompt:"auto",scope:"activity:read"},t=new URLSearchParams;return Object.entries(e).forEach((function(e){var n=Object(u.a)(e,2),r=n[0],c=n[1];return t.append(r,c)})),"https://www.strava.com/oauth/authorize?".concat(t.toString())}()},children:"\u0412\u043e\u0439\u0442\u0438 \u0432 Strava"})}):Object(k.jsxs)("div",{className:"App",children:[j&&Object(k.jsx)("p",{children:j}),Object(k.jsxs)("div",{style:{textAlign:"left",lineHeight:"15px",padding:"8px"},children:[Object(k.jsx)("button",{style:{float:"right"},onClick:function(){return function(){return d.apply(this,arguments)}()},children:"\u0412\u044b\u0439\u0442\u0438"}),Object(k.jsx)("img",{src:n.photo,style:{float:"left"},width:40}),Object(k.jsxs)("div",{children:[n.name,Object(k.jsx)("br",{}),n.surname]})]}),Object(k.jsx)(N,{})]})},R=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,31)).then((function(t){var n=t.getCLS,r=t.getFID,c=t.getFCP,a=t.getLCP,i=t.getTTFB;n(e),r(e),c(e),a(e),i(e)}))};i.a.render(Object(k.jsx)(c.a.StrictMode,{children:Object(k.jsx)(F,{})}),document.getElementById("root")),R()},6:function(e,t,n){e.exports={qrScanner:"style_qrScanner__2lYw-",header:"style_header__1iR7_",cameraSwitchBtn:"style_cameraSwitchBtn__2J7TV"}},8:function(e,t,n){e.exports={qrScanner:"style_qrScanner__kZ0Oc",header:"style_header__2qZXV",cameraSwitchBtn:"style_cameraSwitchBtn__20Wt6"}}},[[30,1,2]]]);
//# sourceMappingURL=main.3eefd69f.chunk.js.map