[
  {
    "path": ".gitignore",
    "content": "# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n/.pnp\n.pnp.js\n\n# testing\n/coverage\n\n# production\n/build\n\n# misc\n.DS_Store\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n.idea/\ndist/\nbattery-report.html\nbattery-report.xml\noutput.json\nupdate.json\nbattery-debug-reports/\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "<br />\n<p align=\"center\">\n  <a href=\"https://powir.slapbot.me\">\n    <img src=\"public/icon.ico\" alt=\"Logo\" width=\"80\" height=\"80\">\n  </a>\n  <h3 align=\"center\">Powir</h3>\n  <p align=\"center\">\n    Windows 10 based tool to monitor and analyze your system's power and battery usage\n    <br />\n    <a href=\"https://powir.slapbot.me\"><strong>Explore the website »</strong></a>\n    <br />\n    <br />\n    <a href=\"https://join.slack.com/t/slapbotworkspace/shared_invite/zt-f1ywjyyq-6NT2jF23jjw5fS8oY5gAsQ\">Join Slack</a>\n    ·\n    <a href=\"https://github.com/slapbot/powir/issues\">Report Bug</a>\n    ·\n    <a href=\"https://github.com/slapbot/powir/issues\">Request Feature</a>\n    ·\n    <a href=\"https://twitter.com/ugupta41\">Give Feedback</a>\n  </p>\n</p>\n\n<hr>\n\n![](demos/gifs/powir-main.gif)\n\n<!-- TABLE OF CONTENTS -->\n## Table of Contents\n\n* [About the Project](#about-the-project)\n  * [What is it?](#what-is-it)\n  * [Installation](#installation)\n* [Features](#features)\n  * [What it does?](#what-it-does)\n  * [Why build it?](#why-build-it)\n  * [Actions?](#actions)\n* [Gallery](#gallery)\n  * [Battery Information](#battery-information)\n  * [System Information](#system-information)\n  * [Power And Battery Usage](#power-and-battery-usage)\n* [Installation Methods](#installation-methods)\n  * [Desktop App (Main Mode)](#desktop-app-main-mode)\n    * [Browser And Windows Defender Warnings](#browser-and-windows-defender-warnings)\n    * [Solution](#solution)  \n  * [Browser Window (Lite Mode)](#browser-window-lite-mode)\n* [FAQs](#faqs)\n* [Developer](#developer)\n  * [Prerequisites](#prerequisites)\n  * [Setup](#setup)\n  * [Build](#build)\n  * [Usage](#usage)\n* [Contributing](#contributing)\n* [License](#license)\n* [Contact](#contact)\n* [Acknowledgement](#acknowledgement)\n\n<hr>\n\n## About The Project\n\n### What is it?\n\nPowir is a Windows 10 based tool to monitor and analyze your system's power and battery usage.\n\nIt provides you with various information and statistics about the current and overall history of the power and battery usage of your system.\n\n### Installation\n\nThere are two ways to install powir:\n\n- [Desktop App (Main Mode)](#desktop-app-main-mode): Installation is as quick as simply downloading the executable and running it.\nThe App is completely portable meaning you don't have to go through an installation wizard, \nand it can be copied from system to system seamlessly without any dependencies or extra files needed. **Recommended**\n  - Terminal: Simply download the binary and run it:\n  ```bash\n  curl -L https://github.com/SlapBot/powir/releases/download/v1.0.4/powir.1.0.4.exe --output powir.exe\n  ./powir\n  ```\n  - Double Click: Again [download](#desktop-app-main-mode) the binary and run it but please read this [note](#browser-and-windows-defender-warnings)\n\n- [Browser Window (Lite Mode)](#browser-window-lite-mode): Installation requires few pre-requisites (node & npm) and firing a command from the command prompt which opens up a tab in your default browser serving file via a local server. Actions (Export PDF, JSON) are missing in the lite mode.\n\n## Features\n![](demos/processed-screenshots/about.png)\n\n### What it does?\n- Provides you with a simple and clean UI to list your battery and system information.\n- Shows you the change in battery capacity since the OS was installed.\n- Analyzes the current and overall estimated battery life of your system.\n- Computes various statistics to give a better understanding of your power usage.\n- Ability to export all the data via various formats: PDF (app), JSON (processed), HTML (original report).\n- 100% free and completely open-source for an absolute transparency.\n- Completely portable app with no installation required, ready to use out of the box.\n\n\n### Why build it?\n- Complete lack of any such power/battery monitoring analyzing tool available in the market.\n- Obscure documentation over how to find battery statuses on the Internet.\n- Required to use terminal in order to run a command showing information about the system.\n- Devoid of any simple and understandable metrics from the underlying API or report.\n\n\n### Actions\n\n![](demos/processed-screenshots/actions.png)\n\n- Export the current report of your system from Powir in PDF format\n- Export the parsed and processed data of your system from Powir in JSON format\n- Shows original report generated by Windows using the command: `powercfg /batteryreport` in the terminal\n\n\n## Gallery\n\n### Battery Information\n\n![](demos/processed-screenshots/battery-information.png)\n\n\n### System Information\n\n![](demos/processed-screenshots/system-information.png)\n\n\n### Power And Battery Usage\n\n![](demos/processed-screenshots/recent-usage.png)\n\n## Installation Methods\n\n### Desktop App (Main Mode)\n\n- Simply go to [Releases](https://github.com/SlapBot/powir/releases) and pick the latest version to download.\n- Download Current Latest Version (Powir v1): [Github](https://github.com/SlapBot/powir/releases/latest/download/powir.1.0.4.exe) or [GDrive](https://drive.google.com/drive/folders/1ntEjEenEzZXMP8L_nXNoHnIFqNSLpwD9): **Please take a note below before downloading the app**\n\n#### Browser And Windows Defender Warnings\n\n<strong>Note: </strong>\nSince the application isn't code signed yet ([because all of the certificates require annual fee payment regardless of whether you're non-profit or open-source](https://stackoverflow.com/questions/1177552/code-signing-certificate-for-open-source-projects)). Please refer to the issue: [#1](https://github.com/SlapBot/powir/issues/1), Both (Browser & Windows Defender will raise warnings suggesting that app is not protected). \n\nThis doesn't mean that application \nis inherently unsafe <strong>in fact entire source code is open</strong>, and you can build your own distribution following [Build](#build) section but its due to the paperwork and money involved in getting the certificates to sign the applications [which can cost as much as $699 a year or more](https://stackoverflow.com/a/58559506/6303162).\n\nIf you are someone who has an experience around self signing certificates with Windows based builds which result in bypassing these warnings, kindly reply in the given thread [#1](https://github.com/SlapBot/powir/issues/1) :)\n\n#### Solution\n\nFor now the solution is to simply ignore the warnings as shown below and always download the application from this [repository](https://github.com/SlapBot/powir) only: \n\n![](demos/processed-screenshots/browser-warning.png)\n![](demos/gifs/windows-defender-warnings.gif)\n\n---\n\n### Browser Window (Lite Mode)\n\nOpen up the terminal (for non-developers: that is Command Prompt [cmd.exe]) and follow these instructions:\n\n#### Only one time setup\n\nCommands (copy-paste):\n```bash\ngit clone https://github.com/SlapBot/powir.git\ncd powir\nnpm install --production\n```\n\nExplanation:\n- Ensure you have git, node and npm installed using commands: `git --version`, `node -v` and `npm -v` respectively, else install it from here: [Git](https://git-scm.com/downloads) and [NodeJS](https://nodejs.org/en/download/) (installer contains both node and npm)\n- Clone the repository using: `git clone https://github.com/SlapBot/powir.git` and cd into the folder: `cd powir`\n- Run `npm install --production` to install dependencies\n\n#### Anytime\n\nCommand (copy-paste)\n```bash\nnpm run lite-mode\n```\n\nExplanation:\n- Now simply run `npm run lite-mode` whenever you want from the directory, and it will open up the dashboard allowing you to monitor and analyze power states.\n\n## FAQs\n\n![](demos/processed-screenshots/FAQs.png)\n\n<strong>Is it completely free?</strong>\n\nYes, Powir is 100% free to download and use.\n\n<strong>Are the numbers displayed 100% correct?</strong>\n\nDepends, Powir parses the raw reports generated from Windows and does the computations of the various statistics and render the charts.\n\n<strong>What tooling is used to build the app?</strong>\n\nPowir runs as an electron app (chromium web engine embedded) while using React to facilitate the UI and data workflow.\n\n<strong>Does it share my data anywhere?</strong>\n\nNo, Powir will never share your data anywhere outside your local system, the entire source code of the app is online for anyone to check. In fact, it never makes any request to a server since there is none. Its simply a client sided app.\n\n<hr>\n\n## Developer\nIf you're looking to build it from the source or inspect the app, its extremely simply and you only have to follow few instructions as listed below:\n\n### Prerequisites\n- Git\n- Node\n- NPM\n\n### Setup\n\n- Clone the repository: `git clone https://github.com/SlapBot/powir.git`\n- Cd into the directory: `cd powir` and run: `npm install`\n\n### Build\n\n- Run `npm run build` which will package the app at `dist/` folder.\n\n### Usage\n\n#### Electron App\n- Run these two commands in two separate sessions when you are developing in order to use HMR (hot module reloading):\n    - Run react server: `npm run react-start`\n    - Run electron app: `npm run electron-start`\n- All of the server code is located at: `public/server` directory.\n- Entrypoint of the electron app is at`public/electron.js`.\n- Everything related to rendering is done at: `src` directory.\n- Any of the changes you make at src directory will reflect instantly in the app.\n- Any of the changes made for server requires the app to be restarted using: `npm run electron-start`\n\n#### Browser Window App\n- Run `npm run lite-mode` which opens up a tab in your default browser again with HMR enabled.\n- Entrypoint of the browser window app is at`public/browser.js`.\n- Everything related to rendering is done at: `src` directory.\n- Any of the changes you make at src directory will reflect instantly in the app.\n- Any of the changes made for server requires the app to be restarted using: `npm run lite-mode`\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to be learn, inspire, and create. \nAny contributions you make are **greatly appreciated**.\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\nFeel free to join our slack chat group to get more help: [Slack](https://join.slack.com/t/powir/shared_invite/zt-ezy7sf5d-Tt1MmP_bcf_gdGLEJSEfzw)\n\n\n<!-- LICENSE -->\n## License\n\nDistributed under the GPU General Public License. See `LICENSE` for more information.\n\n<!-- CONTACT -->\n## Contact\n\nHey there! I'm [Ujjwal](https://twitter.com/ugupta41) who goes around with the name Slapbot in open source communities, You'd often find me blabbering my completely biased opinions in /r/soccer or busy building new things.\n\nI'm most accessible via Twitter and tend to update about whatever I'm working there, so feel free to follow or send a dm there. :)\n\n\n## Acknowledgement\nMany thanks to these amazing frameworks/libraries/tools/arts without which none of this had been possible! <3\n\n#### Major Libraries\n- [ElectronJS](https://www.electronjs.org/)\n- [NodeJS](https://nodejs.org/en/)\n- [ReactJS](https://reactjs.org/)\n- [Tailwind](https://tailwindcss.com/)\n- [PaperCSS](https://www.getpapercss.com/)\n- [ChartJS](https://www.chartjs.org/)\n\n#### Minor Libraries\n- [Lodash](https://lodash.com/)\n- [JSSoup](https://github.com/chishui/JSSoup)\n- [JSSoup](https://github.com/chishui/JSSoup)\n\n#### Icons\n- [Icons8](https://icons8.com/)\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"powir\",\n  \"version\": \"1.0.4\",\n  \"description\": \"Windows 10 based tool to monitor and analyze your system's power and battery usage\",\n  \"main\": \"public/electron.js\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/SlapBot/powir.git\"\n  },\n  \"author\": {\n    \"name\": \"Ujjwal Gupta\",\n    \"email\": \"ugupta41@gmail.com\",\n    \"url\": \"https://http://slapbot.me/\"\n  },\n  \"keywords\": [\n    \"electron\",\n    \"battery\",\n    \"windows-battery\",\n    \"react\",\n    \"battery-monitoring\",\n    \"battery-analyzer\"\n  ],\n  \"build\": {\n    \"productName\": \"powir\",\n    \"appId\": \"powir.slapbot.me\",\n    \"win\": {\n      \"icon\": \"build/icon.ico\",\n      \"target\": \"portable\"\n    }\n  },\n  \"homepage\": \"./\",\n  \"private\": true,\n  \"dependencies\": {\n    \"@testing-library/jest-dom\": \"^4.2.4\",\n    \"@testing-library/react\": \"^9.3.2\",\n    \"@testing-library/user-event\": \"^7.1.2\",\n    \"axios\": \"^0.19.2\",\n    \"chart.js\": \"^2.9.3\",\n    \"electron-is-dev\": \"^1.2.0\",\n    \"electron-log\": \"^4.2.0\",\n    \"jssoup\": \"0.0.11\",\n    \"lodash\": \"^4.17.15\",\n    \"react\": \"^16.13.1\",\n    \"react-chartjs-2\": \"^2.9.0\",\n    \"react-dom\": \"^16.13.1\",\n    \"react-scripts\": \"3.4.1\"\n  },\n  \"scripts\": {\n    \"browser-react-start\": \"node public/browser.js&&set REACT_APP_LITE_MODE=1&&react-scripts start\",\n    \"react-start\": \"set BROWSER=none&&set REACT_APP_LITE_MODE=0&&react-scripts start\",\n    \"react-build\": \"react-scripts build\",\n    \"react-test\": \"react-scripts test\",\n    \"react-eject\": \"react-scripts eject\",\n    \"electron-start\": \"set ELECTRON_START_URL=http://localhost:3000 && electron .\",\n    \"electron-build\": \"electron-builder\",\n    \"build\": \"npm run react-build && npm run electron-build\",\n    \"lite-mode\": \"npm run browser-react-start\"\n  },\n  \"eslintConfig\": {\n    \"extends\": \"react-app\"\n  },\n  \"browserslist\": {\n    \"production\": [\n      \">0.2%\",\n      \"not dead\",\n      \"not op_mini all\"\n    ],\n    \"development\": [\n      \"last 1 chrome version\",\n      \"last 1 firefox version\",\n      \"last 1 safari version\"\n    ]\n  },\n  \"devDependencies\": {\n    \"electron\": \"^9.0.0\",\n    \"electron-builder\": \"^22.6.1\"\n  }\n}\n"
  },
  {
    "path": "public/app/menu.js",
    "content": "function getMenuTemplate(server) {\n    return [\n        // { role: 'fileMenu' }\n        {\n            label: 'File',\n            submenu: [\n                {\n                    label: 'Main Website',\n                    click: async () => {\n                        await server.openLink('https://powir.slapbot.me')\n                    }\n                },{\n                    label: 'Author',\n                    click: async () => {\n                        server.showAuthorPage()\n                    }\n                },\n                { type: 'separator' },\n                { role: 'quit' }\n            ]\n        },\n        // { role: 'editMenu' }\n        {\n            label: 'Actions',\n            submenu: [\n                {\n                    label: 'Export JSON',\n                    click: async () => {\n                        server.exportJSONData()\n                    }\n                },\n                {\n                    label: 'Export PDF',\n                    click: async () => {\n                        server.exportPDFReport()\n                    }\n                },\n                { type: 'separator' },\n                {\n                    label: 'Display Original Report',\n                    click: async () => {\n                        server.showOriginalReport()\n                    }\n                },\n            ]\n        },\n        {\n            label: 'View',\n            submenu: [\n                { role: 'resetzoom' },\n                { role: 'zoomin' },\n                { role: 'zoomout' },\n                { type: 'separator' },\n                { role: 'togglefullscreen' }\n            ]\n        },\n        {\n            label: 'Tools',\n            submenu: [\n                { role: 'reload' },\n                { role: 'forcereload' },\n                { role: 'toggledevtools' },\n            ]\n        },\n        {\n            role: 'help',\n            submenu: [\n                {\n                    label: 'Issues/Bugs',\n                    click: async () => {\n                        await server.openLink('https://github.com/slapbot/powir/issues')\n                    }\n                },{\n                    label: 'Chat/Updates',\n                    click: async () => {\n                        await server.openLink('https://twitter.com/ugupta41')\n                    }\n                },{\n                    label: 'Feedback/Enquiry',\n                    click: async () => {\n                        await server.openLink('https://slapbot.me')\n                    }\n                }\n            ]\n        }\n    ]\n}\n\nmodule.exports = {\n    getMenuTemplate\n}\n"
  },
  {
    "path": "public/app/parse.js",
    "content": "function parseUsageInfo(data, colElements, cleanerFn) {\n    return colElements.map((colElement, colIndex) => {\n        let formattedElement = cleanerFn(colElement.text)\n        switch (colIndex) {\n            // Start-time: date time/time\n            case 0:\n                if (formattedElement.split(\" \").length === 1) {\n                    return data[data.length-1][colIndex].split(\" \")[0] + \" \" + formattedElement\n                }\n                break\n            case 2:\n                // Source: AC/Battery\n                if (formattedElement === \"\") {\n                    return data[data.length-1][colIndex] + formattedElement\n                }\n                break\n            case 3:\n                // Energy Drained: Percentage / -\n                if (formattedElement === '-') {\n                    return \"0 %\"\n                }\n                break\n            case 4:\n                // Energy Drained: mWh / -\n                if (formattedElement === '-') {\n                    return \"0 mWh\"\n                }\n                break\n            default:\n                break\n        }\n        return formattedElement\n    })\n}\n\nfunction parseHistoryInfo(data, colElements, cleanerFn) {\n    function addDays(date, days) {\n        date.setDate(date.getDate() + days);\n        return date;\n    }\n\n    return colElements.map((colElement, colIndex) => {\n        let formattedElement = cleanerFn(colElement.text)\n        switch (colIndex) {\n            // Period: date / date - date\n            case 0:\n                if (formattedElement.split(\" - \").length === 1) {\n                    return formattedElement + \" - \" + addDays(new Date(formattedElement), 1)\n                        .toISOString().split(\"T\")[0]\n                }\n                if (data.length > 0) {\n                    let lastDate = new Date(data[data.length - 1][colIndex].split(\" - \")[1])\n                    let currentDate = new Date(formattedElement.split(\" - \")[0])\n                    if (lastDate > currentDate) {\n                        return addDays(currentDate, 1).toISOString().split(\"T\")[0]\n                            + \" - \" +\n                            formattedElement.split(\" - \")[1]\n                    }\n                }\n                break\n            default:\n                if (formattedElement === \"-\") {\n                    return \"0:00:00\"\n                }\n                break\n        }\n        return formattedElement\n    })\n}\n\nmodule.exports = {\n    parseUsageInfo,\n    parseHistoryInfo\n}"
  },
  {
    "path": "public/app/scrape.js",
    "content": "const { exec } = require('child_process')\nconst { readFile, writeFile } = require('fs')\nconst parser = require('./parse')\nconst JSSoup = require('jssoup').default\n\n\nfunction generateBatteryReport(cmd) {\n    return new Promise((resolve, reject) => {\n        exec(cmd, (err, stdout, stderr) => {\n            if (stdout) {\n                resolve(stdout)\n            }\n            if (stderr) {\n                reject(stderr)\n            }\n            reject(err)\n        })\n    })\n}\n\nfunction getHtmlFromFile(path) {\n    return new Promise((resolve, reject) => {\n        readFile(path, 'utf-8', (err, data) => {\n            if (data) {\n                resolve(data)\n            }\n            reject(err)\n        })\n    })\n}\n\nfunction readDataFromFile(path) {\n    return new Promise((resolve, reject) => {\n        readFile(path, 'utf-8', (err, data) => {\n            if (data) {\n                resolve(JSON.parse(data))\n            }\n            reject(err)\n        })\n    })\n}\n\nfunction writeDataToFile(data, path) {\n    return new Promise((resolve, reject) => {\n        writeFile(path, data, (err) => {\n            if (err) {\n                reject(err)\n            }\n            resolve(true)\n        });\n    })\n}\n\n\nfunction getSoupInstance(html) {\n    return new JSSoup(html);\n}\n\nfunction getTables(soup) {\n    // noinspection JSUnresolvedFunction\n    return soup.findAll('table')\n}\n\nfunction cleanNewlineText(text) {\n    return text.replace(/\\r?\\n|\\r/g, \"\").replace(/\\s+/g, ' ').trim()\n}\n\nfunction getNote(soup, index) {\n    switch (index) {\n        // Don't want to scrape this part in case Windows changes the DOM and hence increasing stability\n        case 0:\n            return \"Information about your system\"\n        case 1:\n            return \"Information about each currently installed battery\"\n        case 2:\n            return \"Power states over the last few days\"\n        case 3:\n            return \"Battery drains over the last few days\"\n        case 4:\n            return \"History of system usage on AC and battery\"\n        case 5:\n            return \"Charge capacity history of the system's batteries\"\n        case 6:\n            return \"Battery life estimates based on observed drains\"\n        case 7:\n            return \"Current estimate of battery life based on all observed drains since OS install\"\n        default:\n            return cleanNewlineText(soup[index].previousSibling.text)\n    }\n}\n\nfunction getKeyValueInfo(data, rInfo) {\n    // noinspection JSUnresolvedFunction\n    let colElements = rInfo.findAll('td')\n    if (colElements.length > 1 && cleanNewlineText(colElements[0].text)) {\n        data[0].push(cleanNewlineText(colElements[0].text))\n        data[1].push(cleanNewlineText(colElements[1].text))\n    }\n    return data\n}\n\nfunction getTabulatedKeys(data, rawInfo, index) {\n    // noinspection JSUnresolvedFunction\n    let colElements = rawInfo[index].findAll(\"td\").reduce((data, element) => {\n        let formattedElement = cleanNewlineText(element.text)\n        if (formattedElement) {\n            data.push(formattedElement)\n        }\n        return data\n    }, [])\n    if (colElements.length === 0) {\n        return colElements\n    }\n    switch (data.name) {\n        case 'powerUsageInfo':\n        case 'batteryUsageInfo':\n            return colElements.splice(0, colElements.length - 1).concat([\n                colElements[colElements.length - 1] + \" (PERCENTAGE)\",\n                colElements[colElements.length - 1] + \" (VALUE)\"\n            ])\n        case 'powerUsageHistoryInfo':\n        case 'batteryLifeHistory':\n            // noinspection JSUnresolvedFunction\n            let colSubElements = rawInfo[0].findAll(\"td\").reduce((data, element) => {\n                let formattedElement = cleanNewlineText(element.text)\n                if (formattedElement) {\n                    data.push(formattedElement)\n                }\n                return data\n            }, [])\n            if (colSubElements.length < 2) {\n                return colElements\n            }\n            return colElements.map((colElement, index) => {\n                    if (index > 0 && index < 3) {\n                        return colElement + ' (' + colSubElements[0] + ')'\n                    }\n                    if (index > 2 && index < 5) {\n                        return colElement + ' (' + colSubElements[1] + ')'\n                    }\n                    return colElement\n                })\n        default:\n            return colElements\n    }\n}\n\nfunction getTabulatedData(data, rInfo) {\n    // noinspection JSUnresolvedFunction\n    let colElements = rInfo.findAll(\"td\")\n    let result = {}\n    if (colElements.length > 2) {\n        switch (data.name) {\n            case 'powerUsageInfo':\n            case 'batteryUsageInfo':\n                result = parser.parseUsageInfo(\n                    data.data,\n                    colElements.filter(colElement => colElement.text),\n                    cleanNewlineText\n                )\n                break\n            case 'powerUsageHistoryInfo':\n            case 'batteryCapacityHistory':\n            case 'batteryLifeHistory':\n                result = parser.parseHistoryInfo(\n                    data.data,\n                    colElements.filter(colElement => colElement.text),\n                    cleanNewlineText\n                )\n                break\n            case 'batteryLifeOverallHistory':\n                result = colElements\n                    .map(colElement => {\n                        let resultElement = cleanNewlineText(colElement.text)\n                        if (resultElement === \"-\") {\n                            return \"0:00:00\"\n                        }\n                        return resultElement\n                    }).filter(colElement => colElement)\n                break\n            default:\n                result = colElements\n                    .filter(colElement => colElement)\n                    .map(colElement => cleanNewlineText(colElement.text))\n                break\n        }\n        data.data.push(result)\n    }\n    return data\n}\n\nfunction computeInfo(soup, infoName, index, filterType) {\n    let info = {\n        'name': infoName,\n        'note': \"\",\n        'keys': [],\n        'data': []\n    }\n    info.note = getNote(soup, index)\n    let rawInfo = soup[index].findAll('tr')\n    switch (filterType) {\n        case 'KEY_VALUE':\n            [info.keys, info.data] = rawInfo.reduce(getKeyValueInfo, [[], []]);\n            break\n        case 'TABULATED_SIMPLE':\n            info.keys = getTabulatedKeys({name: infoName}, rawInfo, 0)\n            info.data = rawInfo.slice(1).reduce(getTabulatedData, {name: infoName, data: []}).data\n            break\n        case 'TABULATED_COMPLEX':\n            info.keys = getTabulatedKeys({name: infoName}, rawInfo, 1)\n            info.data = rawInfo.slice(2).reduce(getTabulatedData, {name: infoName, data: []}).data\n            break\n        case 'TABULATED_OVERALL':\n            // hardcoded keys to ensure no dependency over each table scrape to ensure concurrency.\n            info.keys = [\"PERIOD\",  \"ACTIVE (AT FULL CHARGE)\",  \"CONNECTED STANDBY (AT FULL CHARGE)\",\n                \"ACTIVE (AT DESIGN CAPACITY)\",  \"CONNECTED STANDBY (AT DESIGN CAPACITY)\"\n            ]\n            info.data = rawInfo.reduce(getTabulatedData, {name: infoName, data: []}).data\n            break\n        default:\n            return info\n    }\n    return info\n}\n\nfunction getInfo(soup, infoName, index, filterType) {\n    return new Promise((resolve, reject) => {\n        // noinspection JSUnresolvedFunction\n        try {\n            let info = computeInfo(soup, infoName, index, filterType)\n            resolve(info)\n        } catch (e) {\n            resolve({\n                'name': infoName,\n                'note': getNote(soup, index),\n                'keys': [],\n                'data': []\n            })\n        }\n    })\n}\n\n\nasync function scrape(html) {\n    let soup = getSoupInstance(html)\n    let tables = getTables(soup)\n    let values = [\n        {tables: tables, name: 'systemInfo', index: 0, filterType: 'KEY_VALUE'},\n        {tables: tables, name: 'batteryInfo', index: 1, filterType: 'KEY_VALUE'},\n        {tables: tables, name: 'powerUsageInfo', index: 2, filterType: 'TABULATED_SIMPLE'},\n        {tables: tables, name: 'batteryUsageInfo', index: 3, filterType: 'TABULATED_SIMPLE'},\n        {tables: tables, name: 'powerUsageHistoryInfo', index: 4, filterType: 'TABULATED_COMPLEX'},\n        {tables: tables, name: 'batteryCapacityHistory', index: 5, filterType: 'TABULATED_SIMPLE'},\n        {tables: tables, name: 'batteryLifeHistory', index: 6, filterType: 'TABULATED_COMPLEX'},\n        {tables: tables, name: 'batteryLifeOverallHistory', index: 7, filterType: 'TABULATED_OVERALL'},\n    ]\n    return Promise.all(\n        values.map(info => getInfo(info.tables, info.name, info.index, info.filterType))\n    )\n}\n\nmodule.exports = {\n    generateBatteryReport,\n    getHtmlFromFile,\n    scrape,\n    readDataFromFile,\n    writeDataToFile\n}\n"
  },
  {
    "path": "public/app/server.js",
    "content": "const { BrowserWindow, dialog, shell } = require('electron')\nconst path = require('path')\nconst isDev  = require('electron-is-dev')\nconst scraper = require('./scrape')\nconst axios = require('axios');\nconst logger = require('electron-log')\n\n\nfunction getBatteryReport() {\n    return scraper.generateBatteryReport(\n        'powercfg batteryreport output \"battery-report.html\" duration 5'\n    )\n        .catch(error => log('error', error))\n        .then(_ => scraper.getHtmlFromFile('battery-report.html'))\n        .catch(error => log(error))\n        .then(html => scraper.scrape(html))\n        .catch(error => log(error))\n\n    // return scraper.getHtmlFromFile('battery-report.html')\n    //     .catch(error => log(error))\n    //     .then(html => scraper.scrape(html))\n}\n\nlet batteryReport = getBatteryReport()\n\nfunction sendBatteryReport(event, _) {\n    batteryReport.then(data => {\n        event.reply('battery-report', data)\n    }).catch(error => log('error', error))\n}\n\nfunction showOriginalReport() {\n    const win = new BrowserWindow({\n        width: 800,\n        height: 600,\n    })\n    win.loadURL(\n        isDev ? `file://${path.join(__dirname, '../../battery-report.html')}`\n            : `file://${path.join(__dirname, '../../../../battery-report.html')}`\n    ).catch(error => log('error', error))\n}\n\nfunction showAuthorPage() {\n    const win = new BrowserWindow({\n        width: 800,\n        height: 600,\n        show: false,\n    })\n    win.maximize()\n    win.show()\n    win.loadURL(`https://slapbot.me`).catch(error => log('error', error))\n}\n\nfunction exportJSONData() {\n    let options = {\n        title: \"Export Data: JSON format\",\n        defaultPath : __dirname + '/powir-data.json',\n        buttonLabel : \"Save JSON\",\n        filters :[\n            {name: 'JSON', extensions: ['json']},\n            {name: 'All Files', extensions: ['*']}\n        ]\n    }\n    dialog.showSaveDialog(null, options).then(result => {\n        batteryReport.then(data => scraper.writeDataToFile(JSON.stringify(data, null, 4), result.filePath))\n            .catch(error => log('error', error))\n            .then(_ => log('JSON saved!'))\n            .catch(error => log('error', error))\n    }).catch(error => log('error', error))\n}\n\nfunction exportPDFReport() {\n    function pdfSettings() {\n        return {\n            landscape: false,\n            marginsType: 0,\n            printBackground: false,\n            printSelectionOnly: false,\n            pageSize: 'A4',\n            scaleFactor: 100\n        };\n    }\n\n    let currentWindow = BrowserWindow.getAllWindows().filter(window => window.isVisible())[0]\n    let options = {\n        title: \"Export Report: PDF format\",\n        defaultPath : __dirname + '/powir-report.pdf',\n        buttonLabel : \"Save PDF\",\n        filters :[\n            {name: 'PDF', extensions: ['pdf']},\n            {name: 'All Files', extensions: ['*']}\n        ]\n    }\n    currentWindow.webContents.printToPDF(pdfSettings()).then(data => {\n        dialog.showSaveDialog(null, options).then(result => {\n            scraper.writeDataToFile(data, result.filePath).then(_ => log('PDF saved!'))\n                .catch(error => log('error', error))\n        }).catch(err => log(err))\n    }).catch(err => log(err))\n}\n\nfunction openLink(url) {\n    return shell.openExternal(url)\n}\n\nfunction makeGetRequest(url) {\n    return axios.get(url)\n}\n\nfunction getUpdates(event, data) {\n    makeGetRequest(data.url).then(response => {\n        event.reply('receive-updates', response.data)\n    }).catch(error => log('error', error))\n}\n\nfunction log(type, message) {\n    console.log(type, message)\n    logger.log(message)\n}\n\nmodule.exports = {\n    sendBatteryReport,\n    showOriginalReport,\n    exportJSONData,\n    exportPDFReport,\n    openLink,\n    showAuthorPage,\n    getUpdates,\n    log\n}\n"
  },
  {
    "path": "public/assets/css/fonts.css",
    "content": "@font-face {\n  font-family: 'Neucha';\n  font-style: normal;\n  font-weight: 400;\n  src: local('Neucha'), url(https://fonts.gstatic.com/s/neucha/v11/q5uGsou0JOdh94bfvQlo.ttf) format('truetype');\n}\n@font-face {\n  font-family: 'Patrick Hand SC';\n  font-style: normal;\n  font-weight: 400;\n  src: local('Patrick Hand SC'), local('PatrickHandSC-Regular'), url(https://fonts.gstatic.com/s/patrickhandsc/v7/0nkwC9f7MfsBiWcLtY65AWDK873ljiK-.ttf) format('truetype');\n}\n"
  },
  {
    "path": "public/assets/images/download.txt",
    "content": "https://img.icons8.com/doodle/20/000000/delete-sign.png\nhttps://img.icons8.com/doodle/48/000000/picture.png\nhttps://img.icons8.com/doodle/48/000000/hourglass--v1.png\nhttps://img.icons8.com/doodle/48/000000/statistics--v1.png\nhttps://img.icons8.com/doodle/48/000000/rescan-document.png\nhttps://img.icons8.com/doodle/48/000000/console--v2.png\nhttps://img.icons8.com/doodle/48/000000/audio-cable.png\nhttps://img.icons8.com/doodle/48/000000/error.png\nhttps://img.icons8.com/doodle/48/000000/delete-sign.png\nhttps://img.icons8.com/doodle/48/000000/iphone-spinner.png\nhttps://img.icons8.com/doodle/48/000000/api.png\nhttps://img.icons8.com/doodle/48/000000/windows-client.png\nhttps://img.icons8.com/doodle/48/000000/so-so.png\nhttps://img.icons8.com/doodle/48/000000/used-product.png\nhttps://img.icons8.com/doodle/48/000000/hammer--v1.png\nhttps://img.icons8.com/doodle/48/000000/help.png\nhttps://img.icons8.com/doodle/48/000000/pdf.png\nhttps://img.icons8.com/doodle/48/000000/code-file.png\nhttps://img.icons8.com/doodle/48/000000/select-all.png\nhttps://img.icons8.com/cotton/24/000000/copyright.png\nhttps://img.icons8.com/doodle/48/000000/high-battery.png\nhttps://img.icons8.com/doodle/48/000000/windows8.png\nhttps://img.icons8.com/doodle/48/000000/lightning-arrow.png\nhttps://img.icons8.com/doodle/48/000000/link.png\nhttps://img.icons8.com/doodle/48/000000/twitter-circled.png\nhttps://img.icons8.com/doodle/48/000000/facebook.png\nhttps://img.icons8.com/doodle/48/000000/email-sign.png\nhttps://img.icons8.com/doodle/48/000000/linkedin-circled.png\nhttps://img.icons8.com/doodle/48/000000/reddit.png\nhttps://img.icons8.com/doodle/48/000000/repository.png\nhttps://img.icons8.com/doodle/48/000000/comments.png\nhttps://img.icons8.com/doodle/48/000000/mail-contact.png\nhttps://img.icons8.com/doodle/48/000000/share--v1.png\nhttps://img.icons8.com/doodle/48/000000/github--v1.png\nhttps://img.icons8.com/doodle/48/000000/twitter--v1.png\nhttps://img.icons8.com/cotton/64/000000/like--v1.png\nhttps://img.icons8.com/ios/24/000000/help.png\n"
  },
  {
    "path": "public/browser.js",
    "content": "const scraper = require('./app/scrape')\nconst axios = require('axios');\nconst broadcastUrl = 'https://gist.github.com/SlapBot/4b093f88d97522e22205ae9c9d0dea02/raw/'\n\n\nfunction getBatteryReport() {\n    return scraper.generateBatteryReport(\n        'powercfg batteryreport output \"public/battery-report.html\" duration 5'\n    )\n        .catch(error => console.log('error', error))\n        .then(_ => scraper.getHtmlFromFile('public/battery-report.html'))\n        .catch(error => console.log(error))\n        .then(html => scraper.scrape(html))\n        .catch(error => console.log(error))\n}\n\nfunction getUpdates(url) {\n    return axios.get(url)\n}\n\ngetBatteryReport()\n    .then(data => scraper.writeDataToFile(JSON.stringify(data, null, 4), 'public/output.json'))\n    .catch(error => console.log(error))\n    .then(_ => console.log('Done!'))\n\ngetUpdates(broadcastUrl)\n    .then(response => scraper.writeDataToFile(JSON.stringify(response.data, null, 4), 'public/update.json'))\n    .catch(error => console.log(error))\n    .then(_ => console.log('Done!'))\n"
  },
  {
    "path": "public/electron.js",
    "content": "const { app, BrowserWindow, ipcMain, Menu } = require('electron')\nconst path = require('path')\nconst isDev  = require('electron-is-dev')\nconst server = require('./app/server')\nconst { getMenuTemplate } = require('./app/menu')\n\n\nfunction createWindow () {\n  const win = new BrowserWindow({\n    width: 800,\n    height: 600,\n    webPreferences: {\n      nodeIntegration: true,\n      enableRemoteModule: true,\n    },\n    show: false\n  })\n\n  win.maximize()\n  win.show()\n  // and load the index.html of the app.\n  win.loadURL(\n      isDev ? \"http://localhost:3000\" : `file://${path.join(__dirname, '../build/index.html')}`\n  ).catch(error => server.log('error', error))\n\n  // Open the DevTools.\n  isDev ? win.webContents.openDevTools() : null\n}\n\nconst menuTemplate = getMenuTemplate(server)\nconst menu = Menu.buildFromTemplate(menuTemplate)\nMenu.setApplicationMenu(menu)\n\n\n// This method will be called when Electron has finished\n// initialization and is ready to create browser windows.\n// Some APIs can only be used after this event occurs.\napp.whenReady().then(createWindow)\n\n// Quit when all windows are closed.\napp.on('window-all-closed', () => {\n  // On macOS it is common for applications and their menu bar\n  // to stay active until the user quits explicitly with Cmd + Q\n  if (process.platform !== 'darwin') {\n    app.quit()\n  }\n})\n\napp.on('activate', () => {\n  // On macOS it's common to re-create a window in the app when the\n  // dock icon is clicked and there are no other windows open.\n  if (BrowserWindow.getAllWindows().length === 0) {\n    createWindow()\n  }\n})\n\n// In this file you can include the rest of your app's specific main process\n// code. You can also put them in separate files and require them here.\nipcMain.on('battery-report-ready', (event, data) => {\n  server.sendBatteryReport(event, data)\n})\n\nipcMain.on('show-original-report', (event, data) => {\n  server.showOriginalReport()\n})\n\nipcMain.on('export-JSON-data', (event, data) => {\n  server.exportJSONData()\n})\n\nipcMain.on('export-PDF-report', (event, data) => {\n  server.exportPDFReport()\n})\n\nipcMain.on('get-updates', (event, data) => {\n  server.getUpdates(event, data)\n})\n\nipcMain.on('open-link', async (event, data) => {\n  server.openLink(data.url).catch(error => server.log(error))\n})\n"
  },
  {
    "path": "public/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <meta http-equiv=\"Content-Security-Policy\" content=\"script-src 'self' 'unsafe-inline';\" />\n    <link rel=\"icon\" href=\"%PUBLIC_URL%/favicon.ico\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <meta name=\"theme-color\" content=\"#000000\" />\n    <meta\n      name=\"description\"\n      content=\"Windows 10 based tool to monitor and analyze your system's power and battery usage.\"\n    />\n    <!--\n      manifest.json provides metadata used when your web app is installed on a\n      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/\n    -->\n    <link rel=\"manifest\" href=\"%PUBLIC_URL%/manifest.json\" />\n    <!--\n      Notice the use of %PUBLIC_URL% in the tags above.\n      It will be replaced with the URL of the `public` folder during the build.\n      Only files inside the `public` folder can be referenced from the HTML.\n\n      Unlike \"/favicon.ico\" or \"favicon.ico\", \"%PUBLIC_URL%/favicon.ico\" will\n      work correctly both with client-side routing and a non-root public URL.\n      Learn how to configure a non-root public URL by running `npm run build`.\n    -->\n    <title>Powir</title>\n<!--    <link href=\"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css\" rel=\"stylesheet\">-->\n<!--    <link rel=\"stylesheet\" href=\"https://unpkg.com/papercss@1.6.1/dist/paper.css\">-->\n<!--    <link href=\"https://fonts.googleapis.com/css?family=Neucha|Patrick+Hand+SC\" rel=\"stylesheet\">-->\n    <link rel=\"stylesheet\" href=\"assets/css/tailwind.min.css\">\n    <link rel=\"stylesheet\" href=\"assets/css/paper.min.css\">\n    <link rel=\"stylesheet\" href=\"assets/css/fonts.css\">\n  </head>\n  <body>\n    <noscript>You need to enable JavaScript to run this app.</noscript>\n    <div id=\"root\">\n      <div class=\"flex justify-center\">\n        <h1>Loading...</h1>\n      </div>\n    </div>\n    <!--\n      This HTML file is a template.\n      If you open it directly in the browser, you will see an empty page.\n\n      You can add webfonts, meta tags, or analytics to this file.\n      The build step will place the bundled scripts into the <body> tag.\n\n      To begin the development, run `npm start` or `yarn start`.\n      To create a production bundle, use `npm run build` or `yarn build`.\n    -->\n  </body>\n</html>\n"
  },
  {
    "path": "public/manifest.json",
    "content": "{\n  \"short_name\": \"React App\",\n  \"name\": \"Create React App Sample\",\n  \"icons\": [\n    {\n      \"src\": \"favicon.ico\",\n      \"sizes\": \"64x64 32x32 24x24 16x16\",\n      \"type\": \"image/x-icon\"\n    }\n  ],\n  \"start_url\": \".\",\n  \"display\": \"standalone\",\n  \"theme_color\": \"#000000\",\n  \"background_color\": \"#ffffff\"\n}\n"
  },
  {
    "path": "src/App.js",
    "content": "import React from 'react';\nimport { defaults }  from 'react-chartjs-2';\nimport Navbar from \"./components/Navbar\";\nimport Body from \"./components/Body\";\nimport Footer from \"./components/Footer\";\nimport Broadcast from \"./components/Broadcast\";\n\ndefaults.global.defaultFontFamily = 'Neucha'\n\n\nfunction App() {\n    return (\n        <div>\n            <Broadcast />\n            <Navbar />\n            <Body />\n            <Footer />\n        </div>\n    );\n}\n\nexport default App;\n"
  },
  {
    "path": "src/components/AboutWindow.js",
    "content": "import React from \"react\";\nimport openExternalLink from \"./utils/openExternalLink\";\n\nfunction AboutWindow() {\n    let features = [\n        {\n            'id': 0,\n            'text': 'Provides you with a simple and clean UI to list your battery and system information.',\n            'icon': 'assets/images/picture.png'\n        },{\n            'id': 1,\n            'text': 'Shows you the change in battery capacity since the OS was installed.',\n            'icon': 'assets/images/high-battery.png'\n        },{\n            'id': 2,\n            'text': 'Analyzes the current and overall estimated battery life of your system.',\n            'icon': 'assets/images/hourglass--v1.png'\n        },{\n            'id': 3,\n            'text': 'Computes various statistics to give a better understanding of your power usage.',\n            'icon': 'assets/images/statistics--v1.png'\n        },{\n            'id': 4,\n            'text': 'Ability to export all of the data via various formats: PDF (app), JSON (processed), HTML (original report).',\n            'icon': 'assets/images/rescan-document.png'\n        },{\n            'id': 5,\n            'text': '100% free and completely open-source for absolute transparency.',\n            'icon': 'assets/images/console--v2.png'\n        },{\n            'id': 6,\n            'text': 'Completely portable app with no installation required, ready to use out of the box.',\n            'icon': 'assets/images/audio-cable.png'\n        }\n    ]\n    let reasons = [\n        {\n            'id': 0,\n            'text': 'Complete lack of any such power/battery monitoring analyzing tool available in the market.',\n            'icon': 'assets/images/error.png'\n        },{\n            'id': 1,\n            'text': 'Obscure documentation over how to find battery statuses on the Internet.',\n            'icon': 'assets/images/delete-sign.png'\n        },{\n            'id': 2,\n            'text': 'Required to use terminal in order to run a command showing information about the system.',\n            'icon': 'assets/images/iphone-spinner.png'\n        },{\n            'id': 3,\n            'text': 'Devoid of any simple and understandable metrics from the underlying API or report.',\n            'icon': 'assets/images/api.png'\n        },\n    ]\n    return (\n        <div>\n            <div className=\"flex flex-wrap border-bottom mt-3 pb-3\">\n                <div className=\"w-full\">\n                    <div className=\"flex flex-wrap pb-2 border-bottom\">\n                        <div className=\"w-full lg:w-1/2\">\n                            <div>\n                                <div className=\"flex\">\n                                    <img className=\"no-border mr-2\" src=\"assets/images/windows-client.png\" alt='windows-client'/>\n                                    <h3>What is Powir?</h3>\n                                </div>\n                                <div className=\"p-3\">\n                                    <p>Powir is a Windows 10 based tool to monitor and analyze your system's power and battery usage.</p>\n                                    <p className='mt-1'>It provides you with various information and statistics about the current and\n                                        overall history of the power and battery usage of your system.</p>\n                                </div>\n                            </div>\n                        </div>\n                        <div className=\"w-full lg:w-1/2\">\n                            <div>\n                                <div className=\"flex\">\n                                    <img className=\"no-border mr-2\" src=\"assets/images/so-so.png\" alt='so-so'/>\n                                    <h3>Who built it?</h3>\n                                </div>\n                                <div className=\"p-3\">\n                                    <p>Hey there! I'm\n                                        <button\n                                            className='clean-button ml-1 underline mb-0'\n                                            onClick={() => openExternalLink('https://slapbot.me/')}>\n                                            Ujjwal</button> who goes around with the name Slapbot in open source communities,\n                                        You'd often find me blabbering my completely biased opinions in /r/soccer\n                                        or busy building new things.</p>\n                                    <p className='mt-1'>I'm most accessible via <button\n                                        className='clean-button ml-1 underline mb-0'\n                                        onClick={() => openExternalLink('https://twitter.com/ugupta41')}>\n                                        Twitter</button> and tend to update about whatever\n                                        I'm working there, so feel free to follow or send a dm there. :) </p>\n                                </div>\n\n                            </div>\n                        </div>\n                    </div>\n                    <div className=\"flex flex-wrap pt-2 border-bottom\">\n                        <div className=\"w-full lg:w-1/2\">\n                            <div className=\"\">\n                                <div className=\"flex flex-wrap\">\n                                    <img className=\"no-border mr-2\" src=\"assets/images/used-product.png\" alt='used-product'/>\n                                    <h3>What it does?</h3>\n                                </div>\n                                <div className=\"p-1 mt-2\">\n                                    <ol>\n                                        {features.map(item => {\n                                            return <li key={item.id} className=\"mb-1 flex\">\n                                                <div className='content-center'>\n                                                    <img className=\"no-border mr-1\" src={item.icon} alt={item.icon}/>\n                                                    <p>{item.text}</p>\n                                                </div>\n                                            </li>\n                                        })}\n                                    </ol>\n                                </div>\n                            </div>\n                        </div>\n                        <div className=\"w-full lg:w-1/2\">\n                            <div className=\"\">\n                                <div className=\"flex\">\n                                    <img className=\"no-border mr-2\" src=\"assets/images/hammer--v1.png\" alt='hammer--v1'/>\n                                    <h3>Why build it?</h3>\n                                </div>\n                                <div className=\"p-1 mt-2\">\n                                    <ol>\n                                        {reasons.map(item => {\n                                            return <li key={item.id} className=\"mb-1 flex\">\n                                                <div className='content-center'>\n                                                    <img className=\"no-border mr-1\" src={item.icon} alt={item.icon}/>\n                                                    <p>{item.text}</p>\n                                                </div>\n                                            </li>\n                                        })}\n                                    </ol>\n                                </div>\n                            </div>\n                        </div>\n                    </div>\n                </div>\n                <div className=\"w-full\">\n                    <div className='mt-2'>\n                        <div className='flex mb-4'>\n                            <img className=\"no-border mr-2\" src=\"assets/images/help.png\" alt='help'/>\n                            <h3>FAQs</h3>\n                        </div>\n                        <div className='mt-3'>\n                            <h4>Is it completely free?</h4>\n                            <p className='mt-1'>Yes, Powir is 100% free to download and use.</p>\n                        </div>\n                        <div className='mt-3'>\n                            <h4>Are the numbers displayed 100% correct?</h4>\n                            <p className='mt-1'>Depends, Powir parses the raw reports generated from Windows and\n                            does the computations of the various statistics and render the charts.</p>\n                        </div>\n                        <div className='mt-3'>\n                            <h4>What tooling was used to build the app?</h4>\n                            <p className='mt-1'>Powir runs as an electron app (chromium web engine embedded) while using\n                            React to facilitate the UI and data workflow.</p>\n                        </div>\n                        <div className='mt-3'>\n                            <h4>Does it share my data anywhere?</h4>\n                            <p className='mt-1'>No, Powir will never share your data anywhere outside your local system,\n                            the entire source code of the app is online for anyone to check. Infact, it never makes any\n                            request to a server since there is none. Its simply a client sided app.</p>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        </div>\n    )\n}\n\nexport default AboutWindow\n"
  },
  {
    "path": "src/components/ActionsWindow.js",
    "content": "import React from \"react\";\nimport { sendEvent } from './utils/fetcher'\nimport config from './utils/config'\n\nfunction AboutWindow(props) {\n    function actionsNote() {\n        return config.liteMode ? 'border-bottom pb-4' : 'hidden'\n    }\n    function showOriginalReport() {\n        sendEvent(\"show-original-report\", {status: true})\n    }\n    function exportJSON() {\n        sendEvent(\"export-JSON-data\", {status: true})\n    }\n    function exportPDF() {\n        props.toggleInformationWindow()\n    }\n    return (\n        <div>\n            <div className=\"flex flex-wrap border-bottom mt-3 pb-3\">\n                <div className=\"w-full\">\n                    <h3 className={actionsNote()}>Note: Actions are only available via electron app: <a href=\"https://github.com/SlapBot/powir\">Powir</a></h3>\n                    <div className='pt-4 pb-6 border-bottom'>\n                        <div className=\"flex\">\n                            <img className='no-border mr-2' src=\"assets/images/pdf.png\" alt='pdf'/>\n                            <h3>Export Report (PDF)</h3>\n                        </div>\n                        <p className='mt-2'>\n                            Export the current report of your system from Powir in PDF format:\n                        </p>\n                        <button className=\"mt-4 btn-success\" onClick={exportPDF} disabled={config.liteMode}>Export PDF</button>\n                    </div>\n                    <div className='pt-4 pb-6 border-bottom'>\n                        <div className=\"flex\">\n                            <img className='no-border mr-2' src=\"assets/images/code-file.png\" alt='code-file'/>\n                            <h3>Export Data (JSON)</h3>\n                        </div>\n                        <p className='mt-2'>\n                            Export the parsed and processed data of your system from Powir in JSON format:\n                        </p>\n                        <button className=\"mt-4 btn-secondary\" onClick={exportJSON} disabled={config.liteMode}>Export JSON</button>\n                    </div>\n                    <div className='pt-4 pb-6'>\n                        <div className=\"flex\">\n                            <img className='no-border mr-2' src=\"assets/images/select-all.png\" alt='select-all'/>\n                            <h3>Original Report</h3>\n                        </div>\n                        <p className='mt-2'>\n                            Shows original report generated by Windows using the command:\n                            <kbd className='ml-1'>powercfg /batteryreport</kbd> in the terminal.\n                        </p>\n                        <button className=\"mt-4 btn-warning\" onClick={showOriginalReport} disabled={config.liteMode}>Display Report</button>\n                    </div>\n                </div>\n            </div>\n        </div>\n    )\n}\n\nexport default AboutWindow\n"
  },
  {
    "path": "src/components/Body.js",
    "content": "import React, {useState} from \"react\";\nimport ContentWindow from \"./ContentWindow\";\nimport Sidebar from \"./Sidebar\";\nimport { sendEvent } from './utils/fetcher'\n\n\nfunction Body() {\n    const [currentSection, setCurrentSection] = useState(0)\n    function notifyContentWindow(index) {\n        setCurrentSection(index)\n    }\n    function setInformationWindow() {\n        setCurrentSection(0)\n        sendEvent(\"export-PDF-report\", {status: true})\n    }\n    return (\n        <div className=\"flex\">\n            <div className=\"w-full md:w-2/12 lg:w-2/12 xl:w-1/12 hidden md:block custom-border border-right mt-2 ml-2 mr-2\">\n                <Sidebar notifyContentWindow={notifyContentWindow}/>\n            </div>\n            <div className=\"w-full md:w-10/12 lg:w-10/12 xl:w-11/12\">\n                <ContentWindow index={currentSection} setInformationWindow={setInformationWindow}/>\n            </div>\n        </div>\n    )\n}\n\nexport default Body"
  },
  {
    "path": "src/components/Broadcast.js",
    "content": "import React, {useEffect, useState} from \"react\";\nimport openExternalLink from './utils/openExternalLink'\nimport config from './utils/config'\nimport { getUpdates } from './utils/fetcher'\n\nfunction Broadcast() {\n    const [broadcastData, setBroadcastData] = useState({\n        \"personal\": {\n            \"status\": false,\n            \"text\": \"\"\n        },\n        \"update\": {\n            \"status\": false,\n            \"version\": config.version,\n            \"text\": \"\"\n        },\n    })\n    const [shouldRenderPersonal, setShouldRenderPersonal] = useState(false)\n    const [shouldRenderUpdate, setShouldRenderUpdate] = useState(false)\n\n    function setValues(data) {\n        setBroadcastData(data)\n        if (data.personal.status) {\n            setShouldRenderPersonal(true)\n        }\n        if (data.update.status && data.update.version !== config.version) {\n            setShouldRenderUpdate(true)\n        }\n    }\n    useEffect(() => {\n        console.log(\"Current Version Running: \" + config.version)\n        getUpdates(setValues)\n    }, [])\n\n    function closePersonalAlert() {\n        setShouldRenderPersonal(false)\n    }\n\n    function closeUpdateAlert() {\n        setShouldRenderUpdate(false)\n    }\n\n    function renderMessage(rawText) {\n        if (rawText.split(\"[\").length < 2) {\n            return (\n                <p className='text-black'>{rawText}</p>\n            )\n        }\n        let first_part = rawText.split(\"[\")[0]\n        let last_part = rawText.split(\"[\")[1].split(\"]\")[1]\n        let link = rawText.split(\"[\")[1].split(\"]\")[0]\n\n        return (\n            <p className='text-black'>\n                {first_part}[\n                <button className='clean-button' onClick={() => openExternalLink(link)}>\n                    {link}\n                </button>\n                ]{last_part}\n            </p>\n        )\n    }\n\n    function render(broadcast, closeCallback, alertClass) {\n        return (\n            <div>\n                <div className={alertClass}>\n                    <div className='flex justify-between'>\n                        {renderMessage(broadcast.text)}\n                        <img className='cursor-pointer image-24'\n                             onClick={closeCallback}\n                             src=\"assets/images/delete-sign.png\"\n                             alt='delete-sign'\n                        />\n                    </div>\n                </div>\n            </div>\n        )\n    }\n    return (\n        <div>\n            {\n                shouldRenderPersonal\n                    ? render(broadcastData.personal, closePersonalAlert, 'alert alert-secondary')\n                    : null\n            }\n            {\n                shouldRenderUpdate\n                    ? render(broadcastData.update, closeUpdateAlert, 'alert alert-warning')\n                    : null\n            }\n        </div>\n    )\n}\n\nexport default Broadcast"
  },
  {
    "path": "src/components/ContentWindow.js",
    "content": "import React from \"react\";\nimport InformationWindow from \"./InformationWIndow\";\nimport AboutWindow from \"./AboutWindow\";\nimport ActionsWindow from \"./ActionsWindow\";\nimport LinksWindow from \"./LinksWindow\";\n\n\nfunction ContentWindow(props) {\n    function getToggleStatus(index) {\n        return index === props.index ? \"\" : \"hidden\"\n    }\n    return (\n        <div>\n            <div className={getToggleStatus(0)}>\n                <InformationWindow />\n            </div>\n            <div className={getToggleStatus(1)}>\n                <AboutWindow />\n            </div>\n            <div className={getToggleStatus(2)}>\n                <ActionsWindow toggleInformationWindow={props.setInformationWindow}/>\n            </div>\n            <div className={getToggleStatus(3)}>\n                <LinksWindow />\n            </div>\n        </div>\n    )\n}\n\nexport default ContentWindow"
  },
  {
    "path": "src/components/Footer.js",
    "content": "import React from \"react\";\nimport openExternalLink from \"./utils/openExternalLink\";\n\nfunction Footer() {\n    return (\n        <div className=\"custom-border border-top\">\n            <div className='mt-2 flex justify-between'>\n                <div>\n                    <div className=\"flex\">\n                        <img className='no-border mr-2' src=\"assets/images/copyright.png\" alt=\"heart\"/>\n                        <button\n                            className=\"clean-button\"\n                            onClick={() => openExternalLink(\"https://slapbot.me\")}>\n                            Ujjwal Gupta (Slapbot)\n                        </button>\n                    </div>\n                </div>\n                <div>\n                    <button\n                        className='clean-button' onClick={() => openExternalLink(\"https://icons8.com/\")}>\n                        Many thanks to Icons8 for all of the lovely icons\n                    </button>\n                </div>\n            </div>\n        </div>\n    )\n}\n\nexport default Footer\n"
  },
  {
    "path": "src/components/InformationWIndow.js",
    "content": "import React, { useState, useEffect } from \"react\";\nimport KeyValueInformationTable from \"./sub-components/KeyValueInformationTable\";\nimport Chart from \"./sub-components/Chart\";\nimport CurrentBatteryEstimate from \"./sub-components/CurrentBatteryEstimate\";\nimport RecentBatteryEstimate from \"./sub-components/RecentBatteryEstimate\";\nimport { getReport } from './utils/fetcher'\n\nfunction InformationWindow() {\n    function shouldRenderComponent(component) {\n        return dataFetchStatus ? component : \"Loading...\"\n    }\n\n    const [dataFetchStatus, setDataFetchStatus] = useState(false)\n    const [systemInfo, setSystemInfo] = useState({})\n    const [batteryInfo, setBatteryInfo] = useState({})\n    const [powerUsageInfo, setPowerUsageInfo] = useState({})\n    const [batteryUsageInfoData, setBatteryUsageInfoData] = useState({})\n    const [batteryCapacityHistory, setBatteryCapacityHistory] = useState({})\n    const [batteryLifeHistory, setBatteryLifeHistory] = useState({})\n    const [batteryLifeOverallHistory, setBatteryLifeOverallHistory] = useState({})\n\n    function setValues(data) {\n        setSystemInfo(data[0])\n        setBatteryInfo(data[1])\n        setPowerUsageInfo(data[2])\n        setBatteryUsageInfoData(data[3])\n        setBatteryCapacityHistory(data[5])\n        setBatteryLifeHistory(data[6])\n        setBatteryLifeOverallHistory(data[7])\n        setDataFetchStatus(true)\n    }\n\n    useEffect(() => {\n        getReport(setValues)\n    }, [])\n\n    return (\n        <div>\n            <div className=\"flex flex-wrap border-bottom mt-3 pb-3\">\n                <div className=\"w-full lg:w-1/2\">\n                    { shouldRenderComponent(\n                        <KeyValueInformationTable\n                            info={batteryInfo}\n                            heading={\"Battery Information\"}\n                            iconUrl={\"assets/images/high-battery.png\"}\n                            iconAlt={\"high-battery\"}\n                        />\n                    )}\n                </div>\n                <div className=\"w-full lg:w-1/2\">\n                    <div className=\"border border-primary\">\n                        { shouldRenderComponent(\n                            <Chart\n                                info={batteryCapacityHistory}\n                                heading={\"Battery Capacity History\"}\n                                metaData={{\n                                    xLabel: \"Date\",\n                                    yLabel: \"Battery Capacity ( Mwh )\"\n                                }}\n                            />\n                        ) }\n                    </div>\n                </div>\n            </div>\n            <div className=\"flex flex-wrap border-bottom mt-3 pb-3\">\n                <div className=\"w-full lg:w-1/2\">\n                    { shouldRenderComponent(\n                        <KeyValueInformationTable\n                            info={systemInfo}\n                            heading={\"System Information\"}\n                            iconUrl={\"assets/images/windows8.png\"}\n                        />\n                    )}\n                </div>\n                <div className=\"w-full lg:w-1/2\">\n                    <div className=\"flex flex-wrap\">\n                        <div className=\"w-full mb-3\">\n                            { shouldRenderComponent(\n                                <CurrentBatteryEstimate info={batteryLifeOverallHistory}/>\n                            )}\n                        </div>\n                        <div className=\"w-full\">\n                            <div className=\"border border-primary\">\n                                { shouldRenderComponent(\n                                    <Chart\n                                        info={batteryLifeHistory}\n                                        heading={\"Battery Life Estimates\"}\n                                        metaData={{\n                                            xLabel: \"Date\",\n                                            yLabel: \"Battery Life ( minutes )\"\n                                        }}\n                                    />\n                                )}\n                            </div>\n                        </div>\n                    </div>\n                </div>\n            </div>\n            <div className=\"flex flex-wrap mt-3 pb-3\">\n                <div className=\"w-full flex flex-wrap pb-2\">\n                    <div className=\"w-full lg:w-1/2\">\n                        <div className=\"w-full\">\n                            <div className=\"flex\">\n                                <img className='no-border mr-1' src=\"assets/images/lightning-arrow.png\" alt={'lightning-arrow'}/>\n                                <h3>Recent Power & Battery Usage</h3>\n                            </div>\n                            <span className='text-xs'>Observed power and battery states of the system in the recent time period.</span>\n                        </div>\n                        <div className=\"flex flex-wrap\">\n                            <div className=\"w-full mt-4 mr-2\">\n                                { shouldRenderComponent(\n                                    <Chart\n                                        info={powerUsageInfo}\n                                        heading={\"\"}\n                                        metaData={{\n                                            xLabel: \"Date\",\n                                            yLabel: \"Usage ( hours )\",\n                                            type:'dailyBar'\n                                        }}\n                                    />\n                                )}\n                            </div>\n                            <div className=\"w-full\">\n                                <div className=\"w-full flex flex-wrap\">\n                                    <div className=\"w-1/2 mt-4\">\n                                        { shouldRenderComponent(\n                                            <Chart\n                                                info={powerUsageInfo}\n                                                heading={\"\"}\n                                                metaData={{\n                                                    type:'cumulativePie'\n                                                }}\n                                            />\n                                        )}\n                                    </div>\n                                    <div className=\"w-1/2 mt-4\">\n                                        { shouldRenderComponent(\n                                            <Chart\n                                                info={powerUsageInfo}\n                                                heading={\"\"}\n                                                metaData={{\n                                                    type:'cumulativeActiveSuspended'\n                                                }}\n                                            />\n                                        )}\n                                    </div>\n                                </div>\n                            </div>\n                        </div>\n                    </div>\n                    <div className=\"w-full lg:w-1/2\">\n                        <div className=\"flex flex-wrap\">\n                            <div className=\"w-full mb-3\">\n                                { shouldRenderComponent(\n                                    <RecentBatteryEstimate info={batteryUsageInfoData}/>\n                                )}\n                            </div>\n\n                            <div className=\"w-full mt-4 border border-primary\">\n                                { shouldRenderComponent(\n                                    <Chart\n                                        info={powerUsageInfo}\n                                        heading={\"Recent Usage\"}\n                                        metaData={{\n                                            xLabel: \"Time\",\n                                            yLabel: \"Battery Percentage\",\n                                            type:'dailyLine'\n                                        }}\n                                    />\n                                )}\n                            </div>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        </div>\n    )\n}\n\nexport default InformationWindow"
  },
  {
    "path": "src/components/LinksWindow.js",
    "content": "import React from \"react\";\nimport openExternalLink from './utils/openExternalLink'\n\nfunction LinksWindow() {\n    let shareLinks = [\n        {\n            'id': 0,\n            'text': 'Copy Link!',\n            'iconUrl': 'assets/images/link.png',\n            'url': 'https://powir.slapbot.me'\n        },{\n            'id': 1,\n            'text': 'Tweet about it!',\n            'iconUrl': 'assets/images/twitter-circled.png',\n            'url': 'https://twitter.com/intent/tweet?url=powir.slapbot.me&text=Check%20out%20this%20open%20source%20windows%20battery%20monitoring%20app:&hashtags=powir'\n        },{\n            'id': 2,\n            'text': 'Share on Facebook!',\n            'iconUrl': 'assets/images/facebook.png',\n            'url': 'http://www.facebook.com/sharer.php?s=100&p[title]=Powir&p[url]=powir.slapbot.me'\n        },{\n            'id': 3,\n            'text': 'Mail to someone!',\n            'iconUrl': 'assets/images/email-sign.png',\n            'url': 'mailto:?subject=Powir: open source windows based battery monitoring app&amp;body=Check out app at: https://www.powir.slapbot.me'\n        },{\n            'id': 4,\n            'text': 'Share on Linkedin!',\n            'iconUrl': 'assets/images/linkedin-circled.png',\n            'url': 'https://www.linkedin.com/sharing/share-offsite/?url=powir.slapbot.me'\n        },{\n            'id': 5,\n            'text': 'Share on Reddit!',\n            'iconUrl': 'assets/images/reddit.png',\n            'url': 'https://www.reddit.com/submit?url=https://powir.slapbot.me&title=Powir:%20Open%20Source%20Windows%20Based%20Battery%20Monitoring%20App'\n        },\n    ]\n    let helpLinks = [\n        {\n            'id': 0,\n            'heading': 'Issues/Bugs',\n            'iconUrl': 'assets/images/repository.png',\n            'url': 'https://github.com/slapbot/powir/issues',\n            'message': 'Looking for any help related to the product or want to report a bug? Feel free to raise an issue on Github'\n        },{\n            'id': 1,\n            'heading': 'Chat/Updates',\n            'iconUrl': 'assets/images/comments.png',\n            'url': 'https://twitter.com/ugupta41',\n            'message': 'Want to share some insight without signing up on Github or looking for updates? Follow me @ugupta41 on Twitter'\n        },{\n            'id': 2,\n            'heading': 'Feedback/Enquiry',\n            'iconUrl': 'assets/images/mail-contact.png',\n            'url': 'mailto:ugupta41@gmail.com',\n            'message': 'Old school? Write me a mail at: ugupta41@gmail.com'\n        },\n    ]\n\n    return (\n        <div>\n            <div className=\"flex flex-wrap border-bottom mt-3 pb-3\">\n                <div className=\"w-full\">\n                    <div className='border-bottom pb-2'>\n                        <div className='mt-2 mb-4'>\n                            <div className=\"flex\">\n                                <img className='no-border mr-2' src=\"assets/images/help.png\" alt='help'/>\n                                <h3>Help</h3>\n                            </div>\n                            <div>\n                                <span>Looking for any kind of help?</span>\n                            </div>\n                        </div>\n                        {helpLinks.map(helpLink => {\n                            return <div key={helpLink.id}>\n                                <div className='flex mt-2'>\n                                    <div className='content-center'>\n                                        <img className='no-border mr-2' src={helpLink.iconUrl} alt={helpLink.iconUrl}/>\n                                        <h4><button\n                                            className='clean-button'\n                                            onClick={() => openExternalLink(helpLink.url)}>{helpLink.heading}\n                                        </button></h4>\n                                    </div>\n                                </div>\n                                <span className='mt-1'>{helpLink.message}</span>\n                            </div>\n                        })}\n\n                    </div>\n                    <div className='pb-2'>\n                        <div>\n                            <div className='mt-2 mb-4'>\n                                <div className=\"flex\">\n                                    <img className='no-border mr-2' src=\"assets/images/share--v1.png\" alt='share--v1'/>\n                                    <h3>Share</h3>\n                                </div>\n                                <div>\n                                    <span>Liked the product? Share the good word among your friends :)</span>\n                                </div>\n                            </div>\n                        </div>\n                        {shareLinks.map(shareLink => {\n                            return <div key={shareLink.id} className='flex mt-2'>\n                                <div className='content-center'>\n                                    <img className='no-border mr-2' src={shareLink.iconUrl} alt={shareLink.iconUrl}/>\n                                    <h4><button className='clean-button' onClick={() => openExternalLink(shareLink.url)}>\n                                        {shareLink.text}\n                                    </button></h4>\n                                </div>\n                            </div>\n                        })}\n                    </div>\n                </div>\n            </div>\n        </div>\n    )\n}\n\nexport default LinksWindow\n"
  },
  {
    "path": "src/components/Navbar.js",
    "content": "import React from \"react\";\nimport openExternalLink from \"./utils/openExternalLink\";\nimport config from \"./utils/config\";\n\nfunction Navbar() {\n    function formatVersion(version) {\n        return  version.split(\".\").splice(0, 2).join(\".\")\n    }\n    return (\n        <div className=\"custom-border border-bottom\">\n            <div className=\"mb-2\">\n                <div className='flex justify-between'>\n                    <div className=\"content-center\">\n                        <div\n                            className=\"content-center pr-2 custom-border border-right cursor-pointer\"\n                            onClick={() => openExternalLink('https://powir.slapbot.me')}\n                        >\n                            <h4>\n                                Powir\n                            </h4>\n                            <span className=\"badge ml-1 mt-0-3 text-sm\">v{formatVersion(config.version)}</span>\n                        </div>\n                        <h5 className=\"content-center ml-2\">Monitoring & Analyzing Your Battery!</h5>\n                    </div>\n                    <div className=\"content-center\">\n                        <div className=\"content-center mr-1\">\n                            <img className=\"no-border cursor-pointer\"\n                                 src=\"assets/images/github--v1.png\"\n                                 alt=\"Github\"\n                                 onClick={() => openExternalLink('https://github.com/slapbot/powir')}\n                            />\n                        </div>\n                        <div className=\"content-center\">\n                            <img className=\"no-border cursor-pointer\"\n                                 src=\"assets/images/twitter--v1.png\"\n                                 alt=\"Twitter\"\n                                 onClick={() => openExternalLink('https://twitter.com/ugupta41')}\n                            />\n                        </div>\n                    </div>\n                </div>\n            </div>\n        </div>\n    )\n}\n\nexport default Navbar"
  },
  {
    "path": "src/components/Sidebar.js",
    "content": "import React, {useState} from \"react\";\nimport SidebarRow from \"./sub-components/SidebarRow\";\nimport openExternalLink from \"./utils/openExternalLink\";\n\nfunction Sidebar(props) {\n    const [sidebarRows, setSideBarRows] = useState([\n        {\n            'index': 0,\n            'name': 'Information',\n            'rootClass': 'mt-6',\n            'liClass': 'mb-3',\n            'spanClass': 'border border-primary p-1'\n        },{\n            'index': 1,\n            'name': 'About',\n            'rootClass': '',\n            'liClass': '',\n            'spanClass': ''\n        },{\n            'index': 2,\n            'name': 'Actions',\n            'rootClass': '',\n            'liClass': '',\n            'spanClass': ''\n        },{\n            'index': 3,\n            'name': 'Links',\n            'rootClass': '',\n            'liClass': '',\n            'spanClass': ''\n        }\n    ])\n    function notifyBody(sidebarIndex) {\n        setSideBarRows(sidebarRows.map((item, index) => {\n            if (index === sidebarIndex) {\n                return {...item, liClass: 'mt-3 mb-3', spanClass: 'border border-primary p-1'}\n            }\n            return {...item, liClass: '', spanClass: ''}\n        }))\n        props.notifyContentWindow(sidebarIndex)\n    }\n\n    return (\n        <div className=\"fixed\">\n            <ul>\n                {sidebarRows.map(\n                    item => <SidebarRow key={item.index} value={item} notifyBody={notifyBody}/>\n                )}\n            </ul>\n            <div className=\"border-top mt-8 pt-8\">\n                <p>Made With</p>\n                <img className='no-border' src=\"assets/images/like--v1.png\" alt=\"heart\" />\n                <p>By <button className='clean-button underline' onClick={() => openExternalLink(\"https://slapbot.me\")}>\n                    Slapbot\n                </button></p>\n                <p className=\"text-xs sidebar-footnote\">100 % open source</p>\n            </div>\n        </div>\n    )\n}\n\nexport default Sidebar\n"
  },
  {
    "path": "src/components/sub-components/Chart.js",
    "content": "import {Bar, Line, Pie} from \"react-chartjs-2\";\nimport React from \"react\";\nimport { createData } from \"./ChartData\";\n\nfunction Chart(props) {\n    function renderChart(info, type, metaData) {\n        try {\n            return getChart(info, type, metaData)\n        } catch (e) {\n            console.log(e)\n        }\n    }\n    function getChart(info, type, metaData) {\n        let data = createData(info, type, metaData)\n        let options = {\n            scales: {\n                xAxes: [{\n                    display: true,\n                    scaleLabel: {\n                        display: true,\n                        labelString: metaData.xLabel\n                    }\n                }],\n                yAxes: [{\n                    display: true,\n                    scaleLabel: {\n                        display: true,\n                        labelString: metaData.yLabel\n                    }\n                }]\n            }\n        }\n        switch (type) {\n            case 'batteryCapacityHistory':\n            case 'batteryLifeHistory':\n                return <Line data={data} options={options}/>\n            case 'powerUsageInfo':\n                if (metaData.type === 'cumulativePie') {\n                    return <Pie data={data} />\n                }\n                else if(metaData.type === 'cumulativeActiveSuspended') {\n                    return <Pie data={data}/>\n                }\n                else if (metaData.type === 'dailyBar') {\n                    return <Bar data={data} options={options}/>\n                }\n                else if (metaData.type === 'dailyLine') {\n                    return <Line data={data} options={options} />\n                }\n                return <Pie data={data} />\n            default:\n                return <Line data={data} options={options}/>\n        }\n    }\n\n    return (\n        <div>\n            <div className=\"content-center\">\n                <div>\n                    <h3>{props.heading}</h3>\n                    <span className=\"text-xs content-center\">{props.info.note}</span>\n                </div>\n            </div>\n            {renderChart(props.info, props.info.name, props.metaData)}\n        </div>\n    )\n}\n\nexport default Chart\n"
  },
  {
    "path": "src/components/sub-components/ChartData.js",
    "content": "import {groupBy, sortBy} from 'lodash'\n\nfunction createData(info, type, metaData) {\n    switch (type) {\n        case 'batteryCapacityHistory':\n            return createBatteryCapacityData(info)\n        case 'batteryLifeHistory':\n            return createBatteryLifeHistoryData(info)\n        case 'powerUsageInfo':\n            if (metaData.type === 'cumulativePie') {\n                return createCumulativePiePowerUsageInfoData(info)\n            }\n            else if (metaData.type === 'dailyBar') {\n                return createBarPowerUsageInfoData(info)\n            }\n            else if (metaData.type === 'dailyLine') {\n                return createLinePowerUsageInfoData(info)\n            }\n            return createActiveSuspendedPiePowerUsageInfoData(info)\n        default:\n            return {\n                labels: [0, 1],\n                datasets: [{\n                    label: 'Default',\n                    backgroundColor: 'red',\n                    borderColor: 'red',\n                    data: [0, 100],\n                    fill: false,\n                }]\n            }\n    }\n}\n\nfunction createBatteryCapacityData(info) {\n    return info.data.reduce((data, item, index) => {\n        if (index > 0) {\n            if (item[1] === info.data[index-1][1]) {\n                return data\n            }\n        }\n        data.labels.push(item[0].split(\" - \")[1])\n        data.datasets[0].data.push(item[1].split(\" \")[0].split(\",\").join(\"\"))\n        data.datasets[1].data.push(item[2].split(\" \")[0].split(\",\").join(\"\"))\n        return data\n    }, {\n        labels: [],\n        datasets: [{\n            label: info.keys[1],\n            backgroundColor: 'red',\n            borderColor: 'red',\n            data: [],\n            fill: false,\n        }, {\n            label: info.keys[2],\n            backgroundColor: 'blue',\n            borderColor: 'blue',\n            data: [],\n            fill: false,\n        }]\n    })\n}\n\nfunction createBatteryLifeHistoryData(info) {\n    function getDaysInMonth(date) {\n        return new Date(date.getFullYear(), date.getMonth()+1, 0).getDate()\n    }\n\n    function chooseDate(date) {\n        let [start_date, end_date] = date.split(\" - \")\n        if (getDaysInMonth(new Date(start_date)) - new Date(start_date).getDate() > new Date(end_date).getDate()) {\n            return start_date.split(\"-\").slice(0, 2).join(\"\")\n        }\n        return end_date.split(\"-\").slice(0, 2).join(\"\")\n    }\n\n    function filterOutliers(array) {\n        /*\n        * Reference: https://www.mathworks.com/matlabcentral/cody/problems/42485-eliminate-outliers-using-interquartile-range\n        * Following this approach except we aren't repeating the IQR and elimination process after every step.\n        * */\n        // Then sort\n        // noinspection JSValidateTypes\n        if (array.length < 4) {\n            return {\n                data: array,\n                indexes: []\n            }\n        }\n        // noinspection JSValidateTypes\n        let values = sortBy(array)\n\n        /* Then find a generous IQR. This is generous because if (values.length / 4)\n         * is not an int, then really you should average the two elements on either\n         * side to find q1.\n         */\n        let q1 = values[Math.floor((values.length / 4))]\n        // Likewise for q3.\n        let q3 = values[Math.ceil((values.length * (3 / 4)))]\n        let iqr = q3 - q1;\n\n        // Then find min and max values\n        let maxValue = q3 + iqr*1.5;\n\n        // Then reduce anything beyond or beneath these values.\n        return array.reduce((data, item, index) => {\n            if (item <= maxValue) {\n                data.indexes.push(index)\n                data.data.push(item)\n                return data\n            }\n            return data\n        }, {\n            data: [],\n            indexes: []\n        })\n    }\n\n    function averageDatasetByMonth(value, index) {\n        return value.reduce((data, element) => {\n            data += element[index]\n            return data\n        }, 0) / value.length\n    }\n\n    let formattedInfo = groupBy(info.data.reduce((data, item) => {\n        if (item[1] === \"0:00:00\" || item[3] === \"0:00:00\") {\n            return data\n        }\n        data.push([\n            chooseDate(item[0]),\n            Number(item[1].split(\":\")[0])*60 + Number(item[1].split(\":\")[1]),\n            Number(item[3].split(\":\")[0])*60 + Number(item[3].split(\":\")[1]),\n        ])\n        return data\n    }, []), 0)\n\n    let activeDataset = []\n    let designDataset = []\n\n    for (let [, value] of Object.entries(formattedInfo)) {\n        activeDataset.push(averageDatasetByMonth(value, 1))\n        designDataset.push(averageDatasetByMonth(value, 2))\n    }\n    let filteredDataset = filterOutliers(activeDataset)\n    let filteredActiveDataset = filterOutliers(activeDataset).data\n    let filteredDesignDataset = designDataset.filter((item, index) => filteredDataset.indexes.includes(index))\n    let labelsDataset = Object.keys(formattedInfo).reduce((data, item, index) => {\n        if (filteredDataset.indexes.includes(index)) {\n            data.push(item.slice(0, 4) + \"/\" + item.slice(4, 6))\n            return data\n        }\n        return data\n    }, [])\n\n    return {\n        labels: labelsDataset,\n        datasets: [{\n            label: info.keys[1],\n            backgroundColor: 'red',\n            borderColor: 'red',\n            data: filteredActiveDataset,\n            fill: false,\n        }, {\n            label: info.keys[3],\n            backgroundColor: 'blue',\n            borderColor: 'blue',\n            data: filteredDesignDataset,\n            fill: false,\n        }]\n    }\n}\n\nfunction getGroupedPowerUsageInfoData(info) {\n    let formattedData = info.data.reduce((data, item, index) => {\n        function getDuration(pastItem, currentItem, futureItem) {\n            function getDateObject(dateString) {\n                return new Date(dateString)\n            }\n            function getMidnightDateTime(date) {\n                return new Date(date.toUTCString()).setHours(0, 0, 0, 0)\n            }\n            function getReturnItem(item, duration) {\n                return [\n                    item[0].split(\" \")[0],\n                    item[0].split(\" \")[1],\n                    duration / 1000 / 60,\n                    item[1],\n                    item[2]\n                ]\n            }\n            let past = getDateObject(pastItem[0])\n            let current = getDateObject(currentItem[0])\n            let future = getDateObject(futureItem[0])\n            if (past.getDate() === current.getDate()) {\n                if (future.getDate() === current.getDate()) {\n                    return [getReturnItem(currentItem, (future - current))]\n                }\n                return [getReturnItem(currentItem, (getMidnightDateTime(future) - current))]\n            }\n            else {\n                if (future.getDate() === current.getDate()) {\n                    return [[\n                        currentItem[0].split(\" \")[0],\n                        \"0:00:00\",\n                        (current - getMidnightDateTime(current)) / 1000 / 60,\n                        'suspended',\n                        null\n                    ],\n                        getReturnItem(currentItem, (future - current))\n                    ]\n                }\n                return [[\n                    currentItem[0].split(\" \")[0],\n                    \"0:00:00\",\n                    (current - getMidnightDateTime(current)) / 1000 / 60,\n                    'suspended',\n                    null\n                ],\n                    getReturnItem(currentItem, (getMidnightDateTime(future) - current))\n                ]\n            }\n        }\n        switch (index) {\n            case info.data.length-1:\n                return data\n            case 0:\n                return data\n            default:\n                let durations = getDuration(\n                    info.data[index-1],\n                    item,\n                    info.data[index+1]\n                )\n                durations.map(duration => data.push(duration))\n                return data\n        }\n    }, [])\n    return groupBy(formattedData, 0)\n}\n\nfunction getDailySumGroupedPowerUsageInfoData(groupData, filterConditional, segregationConditional) {\n    let powerUsageDataset = []\n    for (let [, value] of Object.entries(groupData)) {\n        powerUsageDataset.push(value.reduce((data, item) => {\n            if (filterConditional(item)) {\n                return data\n            }\n            if (segregationConditional(item)) {\n                data[0] += item[2]\n            }\n            else {\n                data[1] += item[2]\n            }\n            return data\n        }, [0, 0]))\n    }\n    return powerUsageDataset\n}\n\nfunction formatPowerUsageInfoTime(minutes) {\n    if (minutes > 59) {\n        return Math.floor(minutes / 60) + ' Hr ' + Math.floor(minutes % 60) + ' Minutes'\n    }\n    return Math.floor(minutes) + ' Minutes'\n}\n\nfunction createCumulativePiePowerUsageInfoData(info) {\n    let groupData = getGroupedPowerUsageInfoData(info)\n    let powerUsageDataset = getDailySumGroupedPowerUsageInfoData(\n        groupData,\n        (item) => item[3].toLowerCase() === 'suspended',\n        (item) => item[4].toUpperCase() === 'AC'\n    )\n    let cumulativePowerUsageDataset = powerUsageDataset.reduce((data, item) => {\n        data[0] += Math.floor(item[0])\n        data[1] += Math.floor(item[1])\n        return data\n    }, [0, 0])\n\n    return {\n        labels: [\n            'AC: ' + formatPowerUsageInfoTime(cumulativePowerUsageDataset[0]),\n            'Battery: ' + formatPowerUsageInfoTime(cumulativePowerUsageDataset[1])\n        ],\n        datasets: [{\n            labelString: 'AC vs Battery',\n            backgroundColor: ['green', 'orange'],\n            data: cumulativePowerUsageDataset,\n            fill: false,\n        }]\n    }\n}\n\nfunction createBarPowerUsageInfoData(info) {\n    let groupData = getGroupedPowerUsageInfoData(info)\n    let powerUsageDataset = getDailySumGroupedPowerUsageInfoData(\n        groupData,\n        (item) => item[3].toLowerCase() === 'suspended',\n        (item) => item[4].toUpperCase() === 'AC'\n    )\n    let powerUsageActiveSuspendedDataset = getDailySumGroupedPowerUsageInfoData(\n        groupData,\n        (_) => false,\n        (item) => item[3].toLowerCase() === 'active'\n    )\n\n    return {\n        labels: Object.keys(groupData),\n        datasets: [{\n            label: 'AC',\n            backgroundColor: 'green',\n            borderColor: 'green',\n            borderWidth: 1,\n            data: powerUsageDataset.map(item => Math.round((item[0] / 60) * 10) / 10),\n        },{\n            label: 'Battery',\n            backgroundColor: 'orange',\n            borderColor: 'orange',\n            borderWidth: 1,\n            data: powerUsageDataset.map(item => Math.round((item[1] / 60) * 10) / 10),\n        },{\n            label: 'ON',\n            backgroundColor: 'blue',\n            borderColor: 'blue',\n            borderWidth: 1,\n            data: powerUsageActiveSuspendedDataset.map(item => Math.round((item[0] / 60) * 10) / 10),\n        },{\n            label: 'OFF',\n            backgroundColor: 'red',\n            borderColor: 'red',\n            borderWidth: 1,\n            data: powerUsageActiveSuspendedDataset.map(item => Math.round((item[1] / 60) * 10) / 10),\n        }]\n    }\n}\n\nfunction createActiveSuspendedPiePowerUsageInfoData(info) {\n    let groupData = getGroupedPowerUsageInfoData(info)\n    let powerUsageActiveSuspendedDataset = getDailySumGroupedPowerUsageInfoData(\n        groupData,\n        (_) => false,\n        (item) => item[3].toLowerCase() === 'active'\n    )\n    let cumulativePowerUsageActiveSuspendedDataset = powerUsageActiveSuspendedDataset.reduce((data, item) => {\n        data[0] += Math.floor(item[0])\n        data[1] += Math.floor(item[1])\n        return data\n    }, [0, 0])\n\n    return {\n        labels: [\n            'ON ' + formatPowerUsageInfoTime(cumulativePowerUsageActiveSuspendedDataset[0]),\n            'OFF ' + formatPowerUsageInfoTime(cumulativePowerUsageActiveSuspendedDataset[1])\n        ],\n        datasets: [{\n            label: 'AC vs Battery',\n            backgroundColor: ['blue', 'red'],\n            data: cumulativePowerUsageActiveSuspendedDataset,\n            fill: false,\n        }]\n    }\n}\n\nfunction createLinePowerUsageInfoData(info) {\n    let percentageDataset = info.data.reduce((data, item, index) => {\n        let dateString = (date) => date.getMonth()+1 + \"/\" + date.getDate() + \" \" + date.getHours() + \":\" + date.getMinutes()\n        if (index > 1) {\n            let currentPercentage = item[item.length-2]\n            let lastPercentage = info.data[index-1][info.data[index-1].length-2]\n            if (currentPercentage === lastPercentage) {\n                return data\n            }\n        }\n        data.push({\n            x: dateString(new Date(item[0])),\n            y: item[item.length-2].split(\" \")[0]\n        })\n        return data\n    }, [])\n    return {\n        labels: percentageDataset.map(item => item.x),\n        datasets: [{\n            label: 'Battery Percentage',\n            backgroundColor: 'red',\n            borderColor: 'red',\n            data: percentageDataset,\n            fill: false\n        }]\n    }\n}\nexport {\n    createData\n}\n"
  },
  {
    "path": "src/components/sub-components/CurrentBatteryEstimate.js",
    "content": "import React from \"react\";\n\nfunction CurrentBatteryEstimate(props) {\n    function renderLabel(key) {\n        return key.split(\"(\")[1].split(\")\")[0].toLowerCase().split(\" \").map(element => {\n            return element[0].toUpperCase() + element.slice(1)\n        }).join(\" \")\n    }\n    return (\n        <div className=\"pb-4 border-bottom\">\n            <div className=\"pb-2\">\n                <h4>{props.info.data[0][0]}</h4>\n                <span className=\"text-xs\">\n                    {props.info.note}\n                </span>\n            </div>\n            <div className=\"flex\">\n                <div className=\"mr-1 flex\">\n                    <h5 className=\"mr-1\">{renderLabel(props.info.keys[1])}:</h5>\n                    <span className=\"badge bg-red\">{props.info.data[0][1]}</span>\n                </div>\n                <div className=\"flex\">\n                    <h5 className=\"mr-1\">{renderLabel(props.info.keys[3])}:</h5>\n                    <span className=\"badge bg-blue\">{props.info.data[0][3]}</span>\n                </div>\n            </div>\n        </div>\n    )\n}\n\nexport default CurrentBatteryEstimate\n"
  },
  {
    "path": "src/components/sub-components/KeyValueInformationTable.js",
    "content": "import React from \"react\";\n\nfunction KeyValueInformationTable(props) {\n    function renderInfo(element, index, type) {\n        const extraHelp = [\n            {\n                'popoverHelp': \"Amount of charge battery was designed to hold.\",\n                'spanClass': 'badge bg-blue text-lg'\n            },{\n                'popoverHelp': \"Amount of charge battery can currently hold.\",\n                'spanClass': 'badge bg-red text-lg'\n            },\n        ]\n        switch (type) {\n            case \"batteryInfo\":\n                switch (index) {\n                    case 4:\n                    case 5:\n                        return <div className=\"flex\">\n                            <div>\n                                <span className={index === 4 ? extraHelp[0].spanClass : extraHelp[1].spanClass}>\n                                    {element}\n                                </span>\n                            </div>\n                            <div className=\"content-center ml-1\">\n                                <div className='m-0-important'\n                                     popover-right={index === 4 ? extraHelp[0].popoverHelp : extraHelp[1].popoverHelp}\n                                >\n                                    <img className=\"no-border\"\n                                         src=\"assets/images/ios-help.png\"\n                                         alt=\"help\"\n                                    />\n                                </div>\n                            </div>\n                        </div>\n                    default:\n                        return <p>{element}</p>\n                }\n            case \"systemInfo\":\n                switch (index) {\n                    case 6:\n                        return <span className=\"badge success text-lg\">{element}</span>\n                    default:\n                        return <p>{element}</p>\n                }\n            default:\n                return <p>{element}</p>\n        }\n    }\n\n    return (\n        <div>\n            <div className='flex'>\n                <img className='no-border mr-1' src={props.iconUrl} alt={props.iconAlt}/>\n                <h3>{props.heading}</h3>\n            </div>\n            <span className=\"text-xs\">{props.info.note}</span>\n            <table>\n                <thead>\n                <tr>\n                    <th>Key</th>\n                    <th>Value</th>\n                </tr>\n                </thead>\n                <tbody>\n                {props.info.keys.map((keyInfo, index) => {\n                    return <tr key={keyInfo}>\n                        <td>{keyInfo}</td>\n                        <td>{renderInfo(props.info.data[index], index, props.info.name)}</td>\n                    </tr>\n                })}\n                </tbody>\n            </table>\n        </div>\n    )\n}\n\nexport default KeyValueInformationTable\n"
  },
  {
    "path": "src/components/sub-components/RecentBatteryEstimate.js",
    "content": "import React from \"react\";\n\n\nfunction RecentBatteryEstimate(props) {\n    function renderValue(formattedData, type) {\n        switch (type) {\n            case 'MINIMUM':\n                if (formattedData.minimum === Infinity) {\n                    return 'NONE'\n                }\n                return formatTime(formattedData.minimum)\n            case 'MAXIMUM':\n                if (formattedData.maximum === 0) {\n                    return 'NONE'\n                }\n                return formatTime(formattedData.maximum)\n            case 'AVERAGE':\n                if (formattedData.maximum === 0 || formattedData.minimum === Infinity) {\n                    return 'NONE'\n                }\n                return formatTime(formattedData.sum/formattedData.count)\n            default:\n                return 'NONE'\n        }\n    }\n\n    function formatTime(value) {\n        let hours = Math.floor(value / 60)\n        let minutes = Math.floor(value % 60)\n        let seconds = Math.floor((value - Math.floor(value)) * 100)\n        return hours + \":\" + (minutes > 9 ? minutes : \"0\" + minutes) + \":\" + seconds\n    }\n\n    let formattedData = props.info.data.reduce((data, item) => {\n        let percent = Number(item[3].split(\"%\")[0])\n        let durationMinutes = Number(item[2].split(\":\")[0])*60 + Number(item[2].split(\":\")[1])\n        if (percent === 0 || durationMinutes === 0) {\n            return data\n        }\n        let estimateLife = (durationMinutes * 100) / percent\n        if (estimateLife < data.minimum) {\n            data.minimum = estimateLife\n        }\n        if (estimateLife > data.maximum) {\n            data.maximum = estimateLife\n        }\n        data.sum += estimateLife\n        data.count += 1\n        return data\n    }, {\n        minimum: Infinity,\n        maximum: 0,\n        sum: 0,\n        count: 0\n    })\n\n    return (\n        <div className=\"pb-4 border-bottom\">\n            <div className=\"pb-2\">\n                <h4>Recent Battery Life Estimate</h4>\n                <span className=\"text-xs\">\n                    {props.info.note}\n                </span>\n            </div>\n            <div className=\"flex\">\n                <div className=\"mr-1 flex\">\n                    <h5 className=\"mr-1\">Minimum: </h5>\n                    <span className=\"badge bg-red\">{renderValue(formattedData, 'MINIMUM')}</span>\n                </div>\n                <div className=\"mr-1 flex\">\n                    <h5 className=\"mr-1\">Maximum: </h5>\n                    <span className=\"badge bg-blue\">{renderValue(formattedData, 'MAXIMUM')}</span>\n                </div>\n                <div className=\"flex\">\n                    <h5 className=\"mr-1\">Average: </h5>\n                    <span className=\"badge success\">{renderValue(formattedData, 'AVERAGE')}</span>\n                </div>\n            </div>\n        </div>\n    )\n}\n\nexport default RecentBatteryEstimate\n"
  },
  {
    "path": "src/components/sub-components/SidebarRow.js",
    "content": "import React from \"react\";\n\nfunction SidebarRow(props) {\n    function notifySidebar() {\n        props.notifyBody(props.value.index)\n    }\n\n    return (\n        <div className={props.value.rootClass}>\n            <div className='mb-1'>\n                <li className={props.value.liClass}>\n                    <span className={props.value.spanClass} onClick={notifySidebar}>\n                        <button className='clean-button'>{props.value.name}</button>\n                    </span>\n                </li>\n            </div>\n        </div>\n    )\n}\n\nexport default SidebarRow"
  },
  {
    "path": "src/components/utils/config.js",
    "content": "export default {\n    version: '1.0.4',\n    liteMode: process.env.REACT_APP_LITE_MODE === '1'\n}\n"
  },
  {
    "path": "src/components/utils/fetcher.js",
    "content": "import config from \"./config\";\n\nexport function getReport(callbackFunction) {\n    if (config.liteMode) {\n        return import('./liteMode').then(module => module.getResource('output.json', callbackFunction))\n    }\n    return import('./mainMode').then(module => {\n        module.sendElectronEvent('battery-report-ready', {status: true})\n        module.getElectronEvent('battery-report', callbackFunction)\n    })\n}\n\nexport function getUpdates(callbackFunction) {\n    const broadcastUrl = config.liteMode ? 'update.json' : 'https://gist.github.com/SlapBot/4b093f88d97522e22205ae9c9d0dea02/raw/'\n    if (config.liteMode) {\n        return import('./liteMode').then(module => module.getResource(broadcastUrl, callbackFunction))\n    }\n    return import('./mainMode').then(module => {\n        module.sendElectronEvent('get-updates', {url: broadcastUrl})\n        module.getElectronEvent('receive-updates', callbackFunction)\n    })\n}\n\nexport function sendEvent(channel, data) {\n    if (config.liteMode) {\n        return\n    }\n    return import('./mainMode').then(module => module.sendElectronEvent(channel, data))\n}\n"
  },
  {
    "path": "src/components/utils/liteMode.js",
    "content": "export function openWindowLink(url) {\n    window.open(url, \"_blank\")\n}\n\nexport function getResource(url, callbackFunction) {\n    return fetch(url).then(response => response.json()).then(data => callbackFunction(data))\n}\n"
  },
  {
    "path": "src/components/utils/mainMode.js",
    "content": "const { ipcRenderer } = window.require('electron')\n\nexport function openElectronLink(url) {\n    ipcRenderer.send('open-link', {url: url})\n}\n\n// Remove async?\nexport function getElectronEvent(channel, callbackFunction) {\n    ipcRenderer.on(channel, async (event, data) => {\n        callbackFunction(data)\n    })\n}\n\nexport function sendElectronEvent(channel, data) {\n    ipcRenderer.send(channel, data);\n}\n"
  },
  {
    "path": "src/components/utils/openExternalLink.js",
    "content": "import config from \"./config\";\n\nexport default function openExternalLink(url) {\n    if (config.liteMode) {\n        import('./liteMode').then(module => module.openWindowLink(url))\n    }\n    else {\n        import('./mainMode').then(module => module.openElectronLink(url))\n    }\n}\n"
  },
  {
    "path": "src/index.css",
    "content": "body {\n  margin: 0;\n}\n\ncode {\n  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',\n    monospace;\n}\nhtml {\n  margin: 1em;\n  background-color: #F5F5F7;\n}\nh1, h2, h3, h4, h5, h6 {\n  margin: 0;\n}\n\n.content-center {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n}\n\n.border-right {\n  border-right: 2px solid #41403e;\n}\n\n.border-bottom {\n  border-bottom: 1px solid rgba(65, 64, 62, 0.20);\n}\n\n.border-top {\n  border-top: 1px solid rgba(65, 64, 62, 0.20);\n}\n\n/*noinspection CssReplaceWithShorthandSafely*/\n.custom-border {\n  border-bottom-left-radius: 225px 100px;\n  border-bottom-right-radius: 15px 225px;\n  border-top-left-radius: 255px 25px;\n  border-top-right-radius: 25px 225px;\n}\n\n.bg-blue {\n  background-color: blue;\n}\n\n.bg-red {\n  background-color: red;\n}\n\n.no-border {\n  border: none;\n}\n\n.clean-link {\n  background: none;\n}\n\n.clean-button {\n  border: none;\n  padding: 0;\n  box-shadow: none;\n}\n\n.clean-button:hover {\n  transform: translate3d(0, 2px, 0);\n  box-shadow: none;\n}\n\n.clean-button:focus {\n  transform: translate3d(0, 2px, 0);\n  box-shadow: none;\n  outline: none;\n  border: none;\n}\n\n.m-0-important {\n  margin: 0\n}\n\n.mt-0-3 {\n  margin-top: 0.3em;\n}\n\n.sidebar-footnote {\n  margin-left: 0.2em;\n  font-size: 0.5em;\n  margin-top: 10em;\n}\n\n.image-24 {\n  width: 24px\n}"
  },
  {
    "path": "src/index.js",
    "content": "import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport * as serviceWorker from './serviceWorker';\n\n\nReactDOM.render(\n  <React.StrictMode>\n    <App />\n  </React.StrictMode>,\n  document.getElementById('root')\n);\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"
  },
  {
    "path": "src/serviceWorker.js",
    "content": "// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n  window.location.hostname === 'localhost' ||\n    // [::1] is the IPv6 localhost address.\n    window.location.hostname === '[::1]' ||\n    // 127.0.0.0/8 are considered localhost for IPv4.\n    window.location.hostname.match(\n      /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n    )\n);\n\nexport function register(config) {\n  if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n    // The URL constructor is available in all browsers that support SW.\n    const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\n    if (publicUrl.origin !== window.location.origin) {\n      // Our service worker won't work if PUBLIC_URL is on a different origin\n      // from what our page is served on. This might happen if a CDN is used to\n      // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n      return;\n    }\n\n    window.addEventListener('load', () => {\n      const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n      if (isLocalhost) {\n        // This is running on localhost. Let's check if a service worker still exists or not.\n        checkValidServiceWorker(swUrl, config);\n\n        // Add some additional logging to localhost, pointing developers to the\n        // service worker/PWA documentation.\n        navigator.serviceWorker.ready.then(() => {\n          console.log(\n            'This web app is being served cache-first by a service ' +\n              'worker. To learn more, visit https://bit.ly/CRA-PWA'\n          );\n        });\n      } else {\n        // Is not localhost. Just register service worker\n        registerValidSW(swUrl, config);\n      }\n    });\n  }\n}\n\nfunction registerValidSW(swUrl, config) {\n  navigator.serviceWorker\n    .register(swUrl)\n    .then(registration => {\n      registration.onupdatefound = () => {\n        const installingWorker = registration.installing;\n        if (installingWorker == null) {\n          return;\n        }\n        installingWorker.onstatechange = () => {\n          if (installingWorker.state === 'installed') {\n            if (navigator.serviceWorker.controller) {\n              // At this point, the updated precached content has been fetched,\n              // but the previous service worker will still serve the older\n              // content until all client tabs are closed.\n              console.log(\n                'New content is available and will be used when all ' +\n                  'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\n              );\n\n              // Execute callback\n              if (config && config.onUpdate) {\n                config.onUpdate(registration);\n              }\n            } else {\n              // At this point, everything has been precached.\n              // It's the perfect time to display a\n              // \"Content is cached for offline use.\" message.\n              console.log('Content is cached for offline use.');\n\n              // Execute callback\n              if (config && config.onSuccess) {\n                config.onSuccess(registration);\n              }\n            }\n          }\n        };\n      };\n    })\n    .catch(error => {\n      console.error('Error during service worker registration:', error);\n    });\n}\n\nfunction checkValidServiceWorker(swUrl, config) {\n  // Check if the service worker can be found. If it can't reload the page.\n  fetch(swUrl, {\n    headers: { 'Service-Worker': 'script' },\n  })\n    .then(response => {\n      // Ensure service worker exists, and that we really are getting a JS file.\n      const contentType = response.headers.get('content-type');\n      if (\n        response.status === 404 ||\n        (contentType != null && contentType.indexOf('javascript') === -1)\n      ) {\n        // No service worker found. Probably a different app. Reload the page.\n        navigator.serviceWorker.ready.then(registration => {\n          registration.unregister().then(() => {\n            window.location.reload();\n          });\n        });\n      } else {\n        // Service worker found. Proceed as normal.\n        registerValidSW(swUrl, config);\n      }\n    })\n    .catch(() => {\n      console.log(\n        'No internet connection found. App is running in offline mode.'\n      );\n    });\n}\n\nexport function unregister() {\n  if ('serviceWorker' in navigator) {\n    navigator.serviceWorker.ready\n      .then(registration => {\n        registration.unregister();\n      })\n      .catch(error => {\n        console.error(error.message);\n      });\n  }\n}\n"
  }
]