[
  {
    "path": ".dockerignore",
    "content": "node_modules\n.next\n.vscode\n.git"
  },
  {
    "path": ".eslintrc.json",
    "content": "{\n  \"extends\": \"next/core-web-vitals\",\n  \"rules\": {\n    \"react/no-unescaped-entities\": \"off\"\n  }\n}\n"
  },
  {
    "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# next.js\n/.next/\n/out/\n\n# production\n/build\n\n# misc\n.DS_Store\n*.pem\n\n# debug\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n# local env files\n.env*.local\n\n# vercel\n.vercel\n\n# typescript\n*.tsbuildinfo\nnext-env.d.ts\n"
  },
  {
    "path": ".prettierignore",
    "content": ".next\npublic/fonts/fonts.css"
  },
  {
    "path": "Dockerfile",
    "content": "FROM node:18-alpine as builder\nWORKDIR /app\nCOPY . .\nRUN npm install --include=dev\nRUN npm run build\n\nFROM node:18-alpine AS runner\nWORKDIR /app\nCOPY --from=builder /app/.next/standalone .\nCOPY --from=builder /app/public ./public\nCOPY --from=builder /app/.next/static ./.next/static\n\nEXPOSE 3000\nCMD [\"node\", \"server.js\"]"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 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 Affero General Public License is a free, copyleft license for\nsoftware and other kinds of works, specifically designed to ensure\ncooperation with the community in the case of network server software.\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,\nour General Public Licenses are 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.\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  Developers that use our General Public Licenses protect your rights\nwith two steps: (1) assert copyright on the software, and (2) offer\nyou this License which gives you legal permission to copy, distribute\nand/or modify the software.\n\n  A secondary benefit of defending all users' freedom is that\nimprovements made in alternate versions of the program, if they\nreceive widespread use, become available for other developers to\nincorporate.  Many developers of free software are heartened and\nencouraged by the resulting cooperation.  However, in the case of\nsoftware used on network servers, this result may fail to come about.\nThe GNU General Public License permits making a modified version and\nletting the public access it on a server without ever releasing its\nsource code to the public.\n\n  The GNU Affero General Public License is designed specifically to\nensure that, in such cases, the modified source code becomes available\nto the community.  It requires the operator of a network server to\nprovide the source code of the modified version running there to the\nusers of that server.  Therefore, public use of a modified version, on\na publicly accessible server, gives the public access to the source\ncode of the modified version.\n\n  An older license, called the Affero General Public License and\npublished by Affero, was designed to accomplish similar goals.  This is\na different license, not a version of the Affero GPL, but Affero has\nreleased a new version of the Affero GPL which permits relicensing under\nthis license.\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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.\n\n  Notwithstanding any other provision of this License, if you modify the\nProgram, your modified version must prominently offer all users\ninteracting with it remotely through a computer network (if your version\nsupports such interaction) an opportunity to receive the Corresponding\nSource of your version by providing access to the Corresponding Source\nfrom a network server at no charge, through some standard or customary\nmeans of facilitating copying of software.  This Corresponding Source\nshall include the Corresponding Source for any work covered by version 3\nof the GNU General Public License that is incorporated pursuant to the\nfollowing paragraph.\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 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 work with which it is combined will remain governed by version\n3 of the GNU General Public License.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU Affero General Public License from time to time.  Such new versions\nwill be 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 Affero 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 Affero 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 Affero 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 Affero General Public License as published\n    by 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 Affero General Public License for more details.\n\n    You should have received a copy of the GNU Affero 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 your software can interact with users remotely through a computer\nnetwork, you should also make sure that it provides a way for users to\nget its source.  For example, if your program is a web application, its\ninterface could display a \"Source\" link that leads users to an archive\nof the code.  There are many ways you could offer source, and different\nsolutions will be better for different programs; see section 13 for the\nspecific requirements.\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 AGPL, see\n<https://www.gnu.org/licenses/>."
  },
  {
    "path": "README.md",
    "content": "# OpenResume\n\nOpenResume is a powerful open-source resume builder and resume parser.\n\nThe goal of OpenResume is to provide everyone with free access to a modern professional resume design and enable anyone to apply for jobs with confidence.\n\nOfficial site: [https://open-resume.com](https://open-resume.com)\n\n## ⚒️ Resume Builder\n\nOpenResume's resume builder allows user to create a modern professional resume easily.\n\n![Resume Builder Demo](https://i.ibb.co/jzcrrt8/resume-builder-demo-optimize.gif)\n\nIt has 5 Core Features:\n| <div style=\"width:285px\">**Feature**</div> | **Description** |\n|---|---|\n| **1. Real Time UI Update** | The resume PDF is updated in real time as you enter your resume information, so you can easily see the final output. |\n| **2. Modern Professional Resume Design** | The resume PDF is a modern professional design that adheres to U.S. best practices and is ATS friendly to top ATS platforms such as Greenhouse and Lever. It automatically formats fonts, sizes, margins, bullet points to ensure consistency and avoid human errors. |\n| **3. Privacy Focus** | The app only runs locally on your browser, meaning no sign up is required and no data ever leaves your browser, so it gives you peace of mind on your personal data. (Fun fact: Running only locally means the app still works even if you disconnect the internet.) |\n| **4. Import From Existing Resume PDF** | If you already have an existing resume PDF, you have the option to import it directly, so you can update your resume design to a modern professional design in literally a few seconds. |\n| **5. Successful Track Record** | OpenResume users have landed interviews and offers from top companies, such as Dropbox, Google, Meta to name a few. It has been proven to work and liken by recruiters and hiring managers. |\n\n## 🔍 Resume Parser\n\nOpenResume’s second component is the resume parser. For those who have an existing resume, the resume parser can help test and confirm its ATS readability.\n\n![Resume Parser Demo](https://i.ibb.co/JvSVwNk/resume-parser-demo-optimize.gif)\n\nYou can learn more about the resume parser algorithm in the [\"Resume Parser Algorithm Deep Dive\" section](https://open-resume.com/resume-parser).\n\n## 📚 Tech Stack\n\n| <div style=\"width:140px\">**Category**</div> | <div style=\"width:100px\">**Choice**</div> | **Descriptions** |\n|---|---|---|\n| **Language** | [TypeScript](https://github.com/microsoft/TypeScript) | TypeScript is JavaScript with static type checking and helps catch many silly bugs at code time. |\n| **UI Library** | [React](https://github.com/facebook/react) | React’s declarative syntax and component-based architecture make it simple to develop reactive reusable components. |\n| **State Management** | [Redux Toolkit](https://github.com/reduxjs/redux-toolkit) | Redux toolkit reduces the boilerplate to set up and update a central redux store, which is used in managing the complex resume state. |\n| **CSS Framework** | [Tailwind CSS](https://github.com/tailwindlabs/tailwindcss) | Tailwind speeds up development by providing helpful css utilities and removing the need to context switch between tsx and css files. |\n| **Web Framework** | [NextJS 13](https://github.com/vercel/next.js) | Next.js supports static site generation and helps build efficient React webpages that support SEO. |\n| **PDF Reader** | [PDF.js](https://github.com/mozilla/pdf.js) | PDF.js reads content from PDF files and is used by the resume parser at its first step to read a resume PDF’s content. |\n| **PDF Renderer** | [React-pdf](https://github.com/diegomura/react-pdf) | React-pdf creates PDF files and is used by the resume builder to create a downloadable PDF file. |\n\n## 📁 Project Structure\n\nOpenResume is created with the NextJS web framework and follows its project structure. The source code can be found in `src/app`. There are a total of 4 page routes as shown in the table below. (Code path is relative to `src/app`)\n\n| <div style=\"width:115px\">**Page Route**</div> | **Code Path** | **Description** |\n|---|---|---|\n| / | /page.tsx | Home page that contains hero, auto typing resume, steps, testimonials, logo cloud, etc |\n| /resume-import | /resume-import/page.tsx | Resume import page, where you can choose to import data from an existing resume PDF. The main component used is `ResumeDropzone` (`/components/ResumeDropzone.tsx`) |\n| /resume-builder | /resume-builder/page.tsx | Resume builder page to build and download a resume PDF. The main components used are `ResumeForm` (`/components/ResumeForm`) and `Resume` (`/components/Resume`) |\n| /resume-parser | /resume-parser/page.tsx | Resume parser page to test a resume’s AST readability. The main library util used is `parseResumeFromPdf` (`/lib/parse-resume-from-pdf`) |\n\n## 💻 Local Development\n\n### Method 1: npm\n\n1. Download the repo `git clone https://github.com/xitanggg/open-resume.git`\n2. Change the directory `cd open-resume`\n3. Install the dependency `npm install`\n4. Start a development server `npm run dev`\n5. Open your browser and visit [http://localhost:3000](http://localhost:3000) to see OpenResume live\n\n### Method 2: Docker\n\n1. Download the repo `git clone https://github.com/xitanggg/open-resume.git`\n2. Change the directory `cd open-resume`\n3. Build the container `docker build -t open-resume .`\n4. Start the container `docker run -p 3000:3000 open-resume`\n5. Open your browser and visit [http://localhost:3000](http://localhost:3000) to see OpenResume live\n"
  },
  {
    "path": "jest.config.mjs",
    "content": "import nextJest from \"next/jest.js\";\n\nconst createJestConfig = nextJest({\n  // Provide the path to your Next.js app to load next.config.js and .env files in your test environment\n  dir: \"./\",\n});\n\n// Add any custom config to be passed to Jest\n/** @type {import('jest').Config} */\nconst config = {\n  // Add more setup options before each test is run\n  // setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],\n\n  testEnvironment: \"jest-environment-jsdom\",\n};\n\n// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async\nexport default createJestConfig(config);\n"
  },
  {
    "path": "next.config.js",
    "content": "/** @type {import('next').NextConfig} */\nconst nextConfig = {\n  // Nextjs has an issue with pdfjs-dist which optionally uses the canvas package\n  // for Node.js compatibility. This causes a \"Module parse failed\" error when\n  // building the app. Since pdfjs-dist is only used on client side, we disable\n  // the canvas package for webpack\n  // https://github.com/mozilla/pdf.js/issues/16214\n  output: 'standalone',\n  webpack: (config) => {\n    // Setting resolve.alias to false tells webpack to ignore a module\n    // https://webpack.js.org/configuration/resolve/#resolvealias\n    config.resolve.alias.canvas = false;\n    config.resolve.alias.encoding = false;\n    return config;\n  },\n};\n\nmodule.exports = nextConfig;\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"open-resume\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"dev\": \"next dev\",\n    \"build\": \"next build\",\n    \"start\": \"next start\",\n    \"lint\": \"next lint\",\n    \"test\": \"jest --watch\",\n    \"test:ci\": \"jest --ci\"\n  },\n  \"dependencies\": {\n    \"@heroicons/react\": \"^2.0.18\",\n    \"@react-pdf/renderer\": \"^3.1.10\",\n    \"@reduxjs/toolkit\": \"^1.9.5\",\n    \"@types/node\": \"20.2.5\",\n    \"@types/react\": \"18.2.7\",\n    \"@types/react-dom\": \"18.2.4\",\n    \"@vercel/analytics\": \"^1.0.1\",\n    \"autoprefixer\": \"10.4.14\",\n    \"eslint\": \"8.41.0\",\n    \"eslint-config-next\": \"13.4.4\",\n    \"next\": \"13.4.4\",\n    \"pdfjs\": \"^2.5.0\",\n    \"pdfjs-dist\": \"^3.7.107\",\n    \"postcss\": \"8.4.24\",\n    \"react\": \"18.2.0\",\n    \"react-contenteditable\": \"^3.3.7\",\n    \"react-dom\": \"18.2.0\",\n    \"react-frame-component\": \"^5.2.6\",\n    \"react-redux\": \"^8.0.7\",\n    \"tailwind-scrollbar\": \"^3.0.4\",\n    \"tailwindcss\": \"3.3.2\",\n    \"typescript\": \"5.0.4\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/aspect-ratio\": \"^0.4.2\",\n    \"@testing-library/jest-dom\": \"^5.16.5\",\n    \"@testing-library/react\": \"^14.0.0\",\n    \"jest\": \"^29.5.0\",\n    \"jest-environment-jsdom\": \"^29.5.0\",\n    \"prettier-plugin-tailwindcss\": \"^0.2.1\"\n  }\n}\n"
  },
  {
    "path": "postcss.config.js",
    "content": "module.exports = {\n  plugins: {\n    tailwindcss: {},\n    autoprefixer: {},\n  },\n}\n"
  },
  {
    "path": "prettier.config.js",
    "content": "module.exports = {\n  // Repo: https://github.com/tailwindlabs/prettier-plugin-tailwindcss\n  plugins: [require(\"prettier-plugin-tailwindcss\")],\n};\n"
  },
  {
    "path": "prettierignore",
    "content": "public/fonts/*.css"
  },
  {
    "path": "public/fonts/OFL.txt",
    "content": "Copyright (c), Christian Robertson (https://fonts.google.com/specimen/Roboto/about?query=Roboto),\nwith Reserved Font Name Roboto.\n\nCopyright (c), Łukasz Dziedzic (https://fonts.google.com/specimen/Lato?query=lato),\nwith Reserved Font Name Lato.\n\nCopyright (c), Julieta Ulanovsky, Sol Matas, Juan Pablo del Peral, Jacques Le Bailly (https://fonts.google.com/specimen/Montserrat?query=Montserrat),\nwith Reserved Font Name Montserrat.\n\nCopyright (c), Steve Matteson (https://fonts.google.com/specimen/Open+Sans?query=Open+Sans),\nwith Reserved Font Name Open Sans.\n\nCopyright (c), Matt McInerney, Pablo Impallari, Rodrigo Fuenzalida (https://fonts.google.com/specimen/Raleway?query=Raleway),\nwith Reserved Font Name Raleway.\n\nCopyright (c), Andrés Torresi, Carolina Giovanolli (https://fonts.google.com/specimen/Caladea?query=Caladea),\nwith Reserved Font Name Caladea.\n\nCopyright (c), Cyreal (https://fonts.google.com/specimen/Lora?query=Lora),\nwith Reserved Font Name Lora.\n\nCopyright (c), Christian Robertson (https://fonts.google.com/specimen/Roboto+Slab/about?query=Roboto+Slab),\nwith Reserved Font Name Roboto Slab.\n\nCopyright (c), Claus Eggers Sørensen (https://fonts.google.com/specimen/Playfair+Display?query=Playfair+Display),\nwith Reserved Font Name Playfair Display.\n\nCopyright (c), Sorkin Type (https://fonts.google.com/specimen/Merriweather/about?query=Merriweather),\nwith Reserved Font Name Merriweather.\n\nCopyright (c), (https://fonts.google.com/noto/specimen/Noto+Sans+SC?query=Noto+Sans+SC&noto.query=Noto+Sans+SC),\nwith Reserved Font Name Noto Sans Simplified Chinese.\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 26 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that any reserved\nnames are not used by derivative works. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "public/fonts/fonts-zh.css",
    "content": "@font-face {font-family: \"NotoSansSC\"; src: url(\"/fonts/NotoSansSC-Regular.ttf\");}\n@font-face {font-family: \"NotoSansSC\"; src: url(\"/fonts/NotoSansSC-Bold.ttf\"); font-weight: bold;}"
  },
  {
    "path": "public/fonts/fonts.css",
    "content": "/* Adding a new English font family needs to keep \"public\\fonts\\fonts.ts\" in sync */\n/* Sans Serif Fonts */\n@font-face {font-family: \"Roboto\"; src: url(\"/fonts/Roboto-Regular.ttf\");}\n@font-face {font-family: \"Roboto\"; src: url(\"/fonts/Roboto-Bold.ttf\"); font-weight: bold;}\n@font-face {font-family: \"Lato\"; src: url(\"/fonts/Lato-Regular.ttf\");}\n@font-face {font-family: \"Lato\"; src: url(\"/fonts/Lato-Bold.ttf\"); font-weight: bold;}\n@font-face {font-family: \"Montserrat\"; src: url(\"/fonts/Montserrat-Regular.ttf\");}\n@font-face {font-family: \"Montserrat\"; src: url(\"/fonts/Montserrat-Bold.ttf\"); font-weight: bold;}\n@font-face {font-family: \"OpenSans\"; src: url(\"/fonts/OpenSans-Regular.ttf\");}\n@font-face {font-family: \"OpenSans\"; src: url(\"/fonts/OpenSans-Bold.ttf\"); font-weight: bold;}\n@font-face {font-family: \"Raleway\"; src: url(\"/fonts/Raleway-Regular.ttf\");}\n@font-face {font-family: \"Raleway\"; src: url(\"/fonts/Raleway-Bold.ttf\"); font-weight: bold;}\n\n/* Serif Fonts */\n@font-face {font-family: \"Caladea\"; src: url(\"/fonts/Caladea-Regular.ttf\");}\n@font-face {font-family: \"Caladea\"; src: url(\"/fonts/Caladea-Bold.ttf\"); font-weight: bold;}\n@font-face {font-family: \"Lora\"; src: url(\"/fonts/Lora-Regular.ttf\");}\n@font-face {font-family: \"Lora\"; src: url(\"/fonts/Lora-Bold.ttf\"); font-weight: bold;}\n@font-face {font-family: \"RobotoSlab\"; src: url(\"/fonts/RobotoSlab-Regular.ttf\");}\n@font-face {font-family: \"RobotoSlab\"; src: url(\"/fonts/RobotoSlab-Bold.ttf\"); font-weight: bold;}\n@font-face {font-family: \"PlayfairDisplay\"; src: url(\"/fonts/PlayfairDisplay-Regular.ttf\");}\n@font-face {font-family: \"PlayfairDisplay\"; src: url(\"/fonts/PlayfairDisplay-Bold.ttf\"); font-weight: bold;}\n@font-face {font-family: \"Merriweather\"; src: url(\"/fonts/Merriweather-Regular.ttf\");}\n@font-face {font-family: \"Merriweather\"; src: url(\"/fonts/Merriweather-Bold.ttf\"); font-weight: bold;}\n"
  },
  {
    "path": "src/app/components/Button.tsx",
    "content": "import { cx } from \"lib/cx\";\nimport { Tooltip } from \"components/Tooltip\";\n\ntype ReactButtonProps = React.ComponentProps<\"button\">;\ntype ReactAnchorProps = React.ComponentProps<\"a\">;\ntype ButtonProps = ReactButtonProps | ReactAnchorProps;\n\nconst isAnchor = (props: ButtonProps): props is ReactAnchorProps => {\n  return \"href\" in props;\n};\n\nexport const Button = (props: ButtonProps) => {\n  if (isAnchor(props)) {\n    return <a {...props} />;\n  } else {\n    return <button type=\"button\" {...props} />;\n  }\n};\n\nexport const PrimaryButton = ({ className, ...props }: ButtonProps) => (\n  <Button className={cx(\"btn-primary\", className)} {...props} />\n);\n\ntype IconButtonProps = ButtonProps & {\n  size?: \"small\" | \"medium\";\n  tooltipText: string;\n};\n\nexport const IconButton = ({\n  className,\n  size = \"medium\",\n  tooltipText,\n  ...props\n}: IconButtonProps) => (\n  <Tooltip text={tooltipText}>\n    <Button\n      type=\"button\"\n      className={cx(\n        \"rounded-full outline-none hover:bg-gray-100 focus-visible:bg-gray-100\",\n        size === \"medium\" ? \"p-1.5\" : \"p-1\",\n        className\n      )}\n      {...props}\n    />\n  </Tooltip>\n);\n"
  },
  {
    "path": "src/app/components/ExpanderWithHeightTransition.tsx",
    "content": "/**\n * ExpanderWithHeightTransition is a div wrapper with built-in transition animation based on height.\n * If expanded is true, it slowly expands its content and vice versa.\n *\n * Note: There is no easy way to animate height transition in CSS: https://github.com/w3c/csswg-drafts/issues/626.\n * This is a clever solution based on css grid and is borrowed from https://css-tricks.com/css-grid-can-do-auto-height-transitions/\n *\n */\nexport const ExpanderWithHeightTransition = ({\n  expanded,\n  children,\n}: {\n  expanded: boolean;\n  children: React.ReactNode;\n}) => {\n  return (\n    <div\n      className={`grid overflow-hidden transition-all duration-300 ${\n        expanded ? \"visible\" : \"invisible\"\n      }`}\n      style={{ gridTemplateRows: expanded ? \"1fr\" : \"0fr\" }}\n    >\n      <div className=\"min-h-0\">{children}</div>\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/app/components/FlexboxSpacer.tsx",
    "content": "/**\n * FlexboxSpacer can be used to create empty space in flex.\n * It is a div that grows to fill the available space specified by maxWidth.\n * You can also set a minimum width with minWidth.\n */\nexport const FlexboxSpacer = ({\n  maxWidth,\n  minWidth = 0,\n  className = \"\",\n}: {\n  maxWidth: number;\n  minWidth?: number;\n  className?: string;\n}) => (\n  <div\n    className={`invisible shrink-[10000] grow ${className}`}\n    style={{ maxWidth: `${maxWidth}px`, minWidth: `${minWidth}px` }}\n  />\n);\n"
  },
  {
    "path": "src/app/components/Resume/ResumeControlBar.tsx",
    "content": "\"use client\";\nimport { useEffect } from \"react\";\nimport { useSetDefaultScale } from \"components/Resume/hooks\";\nimport {\n  MagnifyingGlassIcon,\n  ArrowDownTrayIcon,\n} from \"@heroicons/react/24/outline\";\nimport { usePDF } from \"@react-pdf/renderer\";\nimport dynamic from \"next/dynamic\";\n\nconst ResumeControlBar = ({\n  scale,\n  setScale,\n  documentSize,\n  document,\n  fileName,\n}: {\n  scale: number;\n  setScale: (scale: number) => void;\n  documentSize: string;\n  document: JSX.Element;\n  fileName: string;\n}) => {\n  const { scaleOnResize, setScaleOnResize } = useSetDefaultScale({\n    setScale,\n    documentSize,\n  });\n\n  const [instance, update] = usePDF({ document });\n\n  // Hook to update pdf when document changes\n  useEffect(() => {\n    update();\n  }, [update, document]);\n\n  return (\n    <div className=\"sticky bottom-0 left-0 right-0 flex h-[var(--resume-control-bar-height)] items-center justify-center px-[var(--resume-padding)] text-gray-600 lg:justify-between\">\n      <div className=\"flex items-center gap-2\">\n        <MagnifyingGlassIcon className=\"h-5 w-5\" aria-hidden=\"true\" />\n        <input\n          type=\"range\"\n          min={0.5}\n          max={1.5}\n          step={0.01}\n          value={scale}\n          onChange={(e) => {\n            setScaleOnResize(false);\n            setScale(Number(e.target.value));\n          }}\n        />\n        <div className=\"w-10\">{`${Math.round(scale * 100)}%`}</div>\n        <label className=\"hidden items-center gap-1 lg:flex\">\n          <input\n            type=\"checkbox\"\n            className=\"mt-0.5 h-4 w-4\"\n            checked={scaleOnResize}\n            onChange={() => setScaleOnResize((prev) => !prev)}\n          />\n          <span className=\"select-none\">Autoscale</span>\n        </label>\n      </div>\n      <a\n        className=\"ml-1 flex items-center gap-1 rounded-md border border-gray-300 px-3 py-0.5 hover:bg-gray-100 lg:ml-8\"\n        href={instance.url!}\n        download={fileName}\n      >\n        <ArrowDownTrayIcon className=\"h-4 w-4\" />\n        <span className=\"whitespace-nowrap\">Download Resume</span>\n      </a>\n    </div>\n  );\n};\n\n/**\n * Load ResumeControlBar client side since it uses usePDF, which is a web specific API\n */\nexport const ResumeControlBarCSR = dynamic(\n  () => Promise.resolve(ResumeControlBar),\n  {\n    ssr: false,\n  }\n);\n\nexport const ResumeControlBarBorder = () => (\n  <div className=\"absolute bottom-[var(--resume-control-bar-height)] w-full border-t-2 bg-gray-50\" />\n);\n"
  },
  {
    "path": "src/app/components/Resume/ResumeIFrame.tsx",
    "content": "\"use client\";\nimport { useMemo } from \"react\";\nimport Frame from \"react-frame-component\";\nimport {\n  A4_HEIGHT_PX,\n  A4_WIDTH_PX,\n  A4_WIDTH_PT,\n  LETTER_HEIGHT_PX,\n  LETTER_WIDTH_PX,\n  LETTER_WIDTH_PT,\n} from \"lib/constants\";\nimport dynamic from \"next/dynamic\";\nimport { getAllFontFamiliesToLoad } from \"components/fonts/lib\";\n\nconst getIframeInitialContent = (isA4: boolean) => {\n  const width = isA4 ? A4_WIDTH_PT : LETTER_WIDTH_PT;\n  const allFontFamilies = getAllFontFamiliesToLoad();\n\n  const allFontFamiliesPreloadLinks = allFontFamilies\n    .map(\n      (\n        font\n      ) => `<link rel=\"preload\" as=\"font\" href=\"/fonts/${font}-Regular.ttf\" type=\"font/ttf\" crossorigin=\"anonymous\">\n<link rel=\"preload\" as=\"font\" href=\"/fonts/${font}-Bold.ttf\" type=\"font/ttf\" crossorigin=\"anonymous\">`\n    )\n    .join(\"\");\n\n  const allFontFamiliesFontFaces = allFontFamilies\n    .map(\n      (\n        font\n      ) => `@font-face {font-family: \"${font}\"; src: url(\"/fonts/${font}-Regular.ttf\");}\n@font-face {font-family: \"${font}\"; src: url(\"/fonts/${font}-Bold.ttf\"); font-weight: bold;}`\n    )\n    .join(\"\");\n\n  return `<!DOCTYPE html>\n<html>\n  <head>\n    ${allFontFamiliesPreloadLinks}\n    <style>\n      ${allFontFamiliesFontFaces}\n    </style>\n  </head>\n  <body style='overflow: hidden; width: ${width}pt; margin: 0; padding: 0; -webkit-text-size-adjust:none;'>\n    <div></div>\n  </body>\n</html>`;\n};\n\n/**\n * Iframe is used here for style isolation, since react pdf uses pt unit.\n * It creates a sandbox document body that uses letter/A4 pt size as width.\n */\nconst ResumeIframe = ({\n  documentSize,\n  scale,\n  children,\n  enablePDFViewer = false,\n}: {\n  documentSize: string;\n  scale: number;\n  children: React.ReactNode;\n  enablePDFViewer?: boolean;\n}) => {\n  const isA4 = documentSize === \"A4\";\n  const iframeInitialContent = useMemo(\n    () => getIframeInitialContent(isA4),\n    [isA4]\n  );\n\n  if (enablePDFViewer) {\n    return (\n      <DynamicPDFViewer className=\"h-full w-full\">\n        {children as any}\n      </DynamicPDFViewer>\n    );\n  }\n  const width = isA4 ? A4_WIDTH_PX : LETTER_WIDTH_PX;\n  const height = isA4 ? A4_HEIGHT_PX : LETTER_HEIGHT_PX;\n\n  return (\n    <div\n      style={{\n        maxWidth: `${width * scale}px`,\n        maxHeight: `${height * scale}px`,\n      }}\n    >\n      {/* There is an outer div and an inner div here. The inner div sets the iframe width and uses transform scale to zoom in/out the resume iframe.\n        While zooming out or scaling down via transform, the element appears smaller but still occupies the same width/height. Therefore, we use the \n        outer div to restrict the max width & height proportionally */}\n      <div\n        style={{\n          width: `${width}px`,\n          height: `${height}px`,\n          transform: `scale(${scale})`,\n        }}\n        className={`origin-top-left bg-white shadow-lg`}\n      >\n        <Frame\n          style={{ width: \"100%\", height: \"100%\" }}\n          initialContent={iframeInitialContent}\n          // key is used to force component to re-mount when document size changes\n          key={isA4 ? \"A4\" : \"LETTER\"}\n        >\n          {children}\n        </Frame>\n      </div>\n    </div>\n  );\n};\n\n/**\n * Load iframe client side since iframe can't be SSR\n */\nexport const ResumeIframeCSR = dynamic(() => Promise.resolve(ResumeIframe), {\n  ssr: false,\n});\n\n// PDFViewer is only used for debugging. Its size is quite large, so we make it dynamic import\nconst DynamicPDFViewer = dynamic(\n  () => import(\"@react-pdf/renderer\").then((module) => module.PDFViewer),\n  {\n    ssr: false,\n  }\n);\n"
  },
  {
    "path": "src/app/components/Resume/ResumePDF/ResumePDFCustom.tsx",
    "content": "import { View } from \"@react-pdf/renderer\";\nimport {\n  ResumePDFSection,\n  ResumePDFBulletList,\n} from \"components/Resume/ResumePDF/common\";\nimport { styles } from \"components/Resume/ResumePDF/styles\";\nimport type { ResumeCustom } from \"lib/redux/types\";\n\nexport const ResumePDFCustom = ({\n  heading,\n  custom,\n  themeColor,\n  showBulletPoints,\n}: {\n  heading: string;\n  custom: ResumeCustom;\n  themeColor: string;\n  showBulletPoints: boolean;\n}) => {\n  const { descriptions } = custom;\n\n  return (\n    <ResumePDFSection themeColor={themeColor} heading={heading}>\n      <View style={{ ...styles.flexCol }}>\n        <ResumePDFBulletList\n          items={descriptions}\n          showBulletPoints={showBulletPoints}\n        />\n      </View>\n    </ResumePDFSection>\n  );\n};\n"
  },
  {
    "path": "src/app/components/Resume/ResumePDF/ResumePDFEducation.tsx",
    "content": "import { View } from \"@react-pdf/renderer\";\nimport {\n  ResumePDFBulletList,\n  ResumePDFSection,\n  ResumePDFText,\n} from \"components/Resume/ResumePDF/common\";\nimport { styles, spacing } from \"components/Resume/ResumePDF/styles\";\nimport type { ResumeEducation } from \"lib/redux/types\";\n\nexport const ResumePDFEducation = ({\n  heading,\n  educations,\n  themeColor,\n  showBulletPoints,\n}: {\n  heading: string;\n  educations: ResumeEducation[];\n  themeColor: string;\n  showBulletPoints: boolean;\n}) => {\n  return (\n    <ResumePDFSection themeColor={themeColor} heading={heading}>\n      {educations.map(\n        ({ school, degree, date, gpa, descriptions = [] }, idx) => {\n          // Hide school name if it is the same as the previous school\n          const hideSchoolName =\n            idx > 0 && school === educations[idx - 1].school;\n          const showDescriptions = descriptions.join() !== \"\";\n\n          return (\n            <View key={idx}>\n              {!hideSchoolName && (\n                <ResumePDFText bold={true}>{school}</ResumePDFText>\n              )}\n              <View\n                style={{\n                  ...styles.flexRowBetween,\n                  marginTop: hideSchoolName\n                    ? \"-\" + spacing[\"1\"]\n                    : spacing[\"1.5\"],\n                }}\n              >\n                <ResumePDFText>{`${\n                  gpa\n                    ? `${degree} - ${Number(gpa) ? gpa + \" GPA\" : gpa}`\n                    : degree\n                }`}</ResumePDFText>\n                <ResumePDFText>{date}</ResumePDFText>\n              </View>\n              {showDescriptions && (\n                <View style={{ ...styles.flexCol, marginTop: spacing[\"1.5\"] }}>\n                  <ResumePDFBulletList\n                    items={descriptions}\n                    showBulletPoints={showBulletPoints}\n                  />\n                </View>\n              )}\n            </View>\n          );\n        }\n      )}\n    </ResumePDFSection>\n  );\n};\n"
  },
  {
    "path": "src/app/components/Resume/ResumePDF/ResumePDFProfile.tsx",
    "content": "import { View } from \"@react-pdf/renderer\";\nimport {\n  ResumePDFIcon,\n  type IconType,\n} from \"components/Resume/ResumePDF/common/ResumePDFIcon\";\nimport { styles, spacing } from \"components/Resume/ResumePDF/styles\";\nimport {\n  ResumePDFLink,\n  ResumePDFSection,\n  ResumePDFText,\n} from \"components/Resume/ResumePDF/common\";\nimport type { ResumeProfile } from \"lib/redux/types\";\n\nexport const ResumePDFProfile = ({\n  profile,\n  themeColor,\n  isPDF,\n}: {\n  profile: ResumeProfile;\n  themeColor: string;\n  isPDF: boolean;\n}) => {\n  const { name, email, phone, url, summary, location } = profile;\n  const iconProps = { email, phone, location, url };\n\n  return (\n    <ResumePDFSection style={{ marginTop: spacing[\"4\"] }}>\n      <ResumePDFText\n        bold={true}\n        themeColor={themeColor}\n        style={{ fontSize: \"20pt\" }}\n      >\n        {name}\n      </ResumePDFText>\n      {summary && <ResumePDFText>{summary}</ResumePDFText>}\n      <View\n        style={{\n          ...styles.flexRowBetween,\n          flexWrap: \"wrap\",\n          marginTop: spacing[\"0.5\"],\n        }}\n      >\n        {Object.entries(iconProps).map(([key, value]) => {\n          if (!value) return null;\n\n          let iconType = key as IconType;\n          if (key === \"url\") {\n            if (value.includes(\"github\")) {\n              iconType = \"url_github\";\n            } else if (value.includes(\"linkedin\")) {\n              iconType = \"url_linkedin\";\n            }\n          }\n\n          const shouldUseLinkWrapper = [\"email\", \"url\", \"phone\"].includes(key);\n          const Wrapper = ({ children }: { children: React.ReactNode }) => {\n            if (!shouldUseLinkWrapper) return <>{children}</>;\n\n            let src = \"\";\n            switch (key) {\n              case \"email\": {\n                src = `mailto:${value}`;\n                break;\n              }\n              case \"phone\": {\n                src = `tel:${value.replace(/[^\\d+]/g, \"\")}`; // Keep only + and digits\n                break;\n              }\n              default: {\n                src = value.startsWith(\"http\") ? value : `https://${value}`;\n              }\n            }\n\n            return (\n              <ResumePDFLink src={src} isPDF={isPDF}>\n                {children}\n              </ResumePDFLink>\n            );\n          };\n\n          return (\n            <View\n              key={key}\n              style={{\n                ...styles.flexRow,\n                alignItems: \"center\",\n                gap: spacing[\"1\"],\n              }}\n            >\n              <ResumePDFIcon type={iconType} isPDF={isPDF} />\n              <Wrapper>\n                <ResumePDFText>{value}</ResumePDFText>\n              </Wrapper>\n            </View>\n          );\n        })}\n      </View>\n    </ResumePDFSection>\n  );\n};\n"
  },
  {
    "path": "src/app/components/Resume/ResumePDF/ResumePDFProject.tsx",
    "content": "import { View } from \"@react-pdf/renderer\";\nimport {\n  ResumePDFSection,\n  ResumePDFBulletList,\n  ResumePDFText,\n} from \"components/Resume/ResumePDF/common\";\nimport { styles, spacing } from \"components/Resume/ResumePDF/styles\";\nimport type { ResumeProject } from \"lib/redux/types\";\n\nexport const ResumePDFProject = ({\n  heading,\n  projects,\n  themeColor,\n}: {\n  heading: string;\n  projects: ResumeProject[];\n  themeColor: string;\n}) => {\n  return (\n    <ResumePDFSection themeColor={themeColor} heading={heading}>\n      {projects.map(({ project, date, descriptions }, idx) => (\n        <View key={idx}>\n          <View\n            style={{\n              ...styles.flexRowBetween,\n              marginTop: spacing[\"0.5\"],\n            }}\n          >\n            <ResumePDFText bold={true}>{project}</ResumePDFText>\n            <ResumePDFText>{date}</ResumePDFText>\n          </View>\n          <View style={{ ...styles.flexCol, marginTop: spacing[\"0.5\"] }}>\n            <ResumePDFBulletList items={descriptions} />\n          </View>\n        </View>\n      ))}\n    </ResumePDFSection>\n  );\n};\n"
  },
  {
    "path": "src/app/components/Resume/ResumePDF/ResumePDFSkills.tsx",
    "content": "import { View } from \"@react-pdf/renderer\";\nimport {\n  ResumePDFSection,\n  ResumePDFBulletList,\n  ResumeFeaturedSkill,\n} from \"components/Resume/ResumePDF/common\";\nimport { styles, spacing } from \"components/Resume/ResumePDF/styles\";\nimport type { ResumeSkills } from \"lib/redux/types\";\n\nexport const ResumePDFSkills = ({\n  heading,\n  skills,\n  themeColor,\n  showBulletPoints,\n}: {\n  heading: string;\n  skills: ResumeSkills;\n  themeColor: string;\n  showBulletPoints: boolean;\n}) => {\n  const { descriptions, featuredSkills } = skills;\n  const featuredSkillsWithText = featuredSkills.filter((item) => item.skill);\n  const featuredSkillsPair = [\n    [featuredSkillsWithText[0], featuredSkillsWithText[3]],\n    [featuredSkillsWithText[1], featuredSkillsWithText[4]],\n    [featuredSkillsWithText[2], featuredSkillsWithText[5]],\n  ];\n\n  return (\n    <ResumePDFSection themeColor={themeColor} heading={heading}>\n      {featuredSkillsWithText.length > 0 && (\n        <View style={{ ...styles.flexRowBetween, marginTop: spacing[\"0.5\"] }}>\n          {featuredSkillsPair.map((pair, idx) => (\n            <View\n              key={idx}\n              style={{\n                ...styles.flexCol,\n              }}\n            >\n              {pair.map((featuredSkill, idx) => {\n                if (!featuredSkill) return null;\n                return (\n                  <ResumeFeaturedSkill\n                    key={idx}\n                    skill={featuredSkill.skill}\n                    rating={featuredSkill.rating}\n                    themeColor={themeColor}\n                    style={{\n                      justifyContent: \"flex-end\",\n                    }}\n                  />\n                );\n              })}\n            </View>\n          ))}\n        </View>\n      )}\n      <View style={{ ...styles.flexCol }}>\n        <ResumePDFBulletList\n          items={descriptions}\n          showBulletPoints={showBulletPoints}\n        />\n      </View>\n    </ResumePDFSection>\n  );\n};\n"
  },
  {
    "path": "src/app/components/Resume/ResumePDF/ResumePDFWorkExperience.tsx",
    "content": "import { View } from \"@react-pdf/renderer\";\nimport {\n  ResumePDFSection,\n  ResumePDFBulletList,\n  ResumePDFText,\n} from \"components/Resume/ResumePDF/common\";\nimport { styles, spacing } from \"components/Resume/ResumePDF/styles\";\nimport type { ResumeWorkExperience } from \"lib/redux/types\";\n\nexport const ResumePDFWorkExperience = ({\n  heading,\n  workExperiences,\n  themeColor,\n}: {\n  heading: string;\n  workExperiences: ResumeWorkExperience[];\n  themeColor: string;\n}) => {\n  return (\n    <ResumePDFSection themeColor={themeColor} heading={heading}>\n      {workExperiences.map(({ company, jobTitle, date, descriptions }, idx) => {\n        // Hide company name if it is the same as the previous company\n        const hideCompanyName =\n          idx > 0 && company === workExperiences[idx - 1].company;\n\n        return (\n          <View key={idx} style={idx !== 0 ? { marginTop: spacing[\"2\"] } : {}}>\n            {!hideCompanyName && (\n              <ResumePDFText bold={true}>{company}</ResumePDFText>\n            )}\n            <View\n              style={{\n                ...styles.flexRowBetween,\n                marginTop: hideCompanyName\n                  ? \"-\" + spacing[\"1\"]\n                  : spacing[\"1.5\"],\n              }}\n            >\n              <ResumePDFText>{jobTitle}</ResumePDFText>\n              <ResumePDFText>{date}</ResumePDFText>\n            </View>\n            <View style={{ ...styles.flexCol, marginTop: spacing[\"1.5\"] }}>\n              <ResumePDFBulletList items={descriptions} />\n            </View>\n          </View>\n        );\n      })}\n    </ResumePDFSection>\n  );\n};\n"
  },
  {
    "path": "src/app/components/Resume/ResumePDF/common/ResumePDFIcon.tsx",
    "content": "import { Svg, Path } from \"@react-pdf/renderer\";\nimport { styles } from \"components/Resume/ResumePDF/styles\";\n\n/**\n * Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License\n * - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc.\n */\nconst EMAIL_PATH_D =\n  \"M64 112c-8.8 0-16 7.2-16 16v22.1L220.5 291.7c20.7 17 50.4 17 71.1 0L464 150.1V128c0-8.8-7.2-16-16-16H64zM48 212.2V384c0 8.8 7.2 16 16 16H448c8.8 0 16-7.2 16-16V212.2L322 328.8c-38.4 31.5-93.7 31.5-132 0L48 212.2zM0 128C0 92.7 28.7 64 64 64H448c35.3 0 64 28.7 64 64V384c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V128z\";\nconst PHONE_PATH_D =\n  \"M164.9 24.6c-7.7-18.6-28-28.5-47.4-23.2l-88 24C12.1 30.2 0 46 0 64C0 311.4 200.6 512 448 512c18 0 33.8-12.1 38.6-29.5l24-88c5.3-19.4-4.6-39.7-23.2-47.4l-96-40c-16.3-6.8-35.2-2.1-46.3 11.6L304.7 368C234.3 334.7 177.3 277.7 144 207.3L193.3 167c13.7-11.2 18.4-30 11.6-46.3l-40-96z\";\nconst LOCATION_PATH_D =\n  \"M215.7 499.2C267 435 384 279.4 384 192C384 86 298 0 192 0S0 86 0 192c0 87.4 117 243 168.3 307.2c12.3 15.3 35.1 15.3 47.4 0zM192 128a64 64 0 1 1 0 128 64 64 0 1 1 0-128z\";\nconst URL_PATH_D =\n  \"M256 64C256 46.33 270.3 32 288 32H415.1C415.1 32 415.1 32 415.1 32C420.3 32 424.5 32.86 428.2 34.43C431.1 35.98 435.5 38.27 438.6 41.3C438.6 41.35 438.6 41.4 438.7 41.44C444.9 47.66 447.1 55.78 448 63.9C448 63.94 448 63.97 448 64V192C448 209.7 433.7 224 416 224C398.3 224 384 209.7 384 192V141.3L214.6 310.6C202.1 323.1 181.9 323.1 169.4 310.6C156.9 298.1 156.9 277.9 169.4 265.4L338.7 96H288C270.3 96 256 81.67 256 64V64zM0 128C0 92.65 28.65 64 64 64H160C177.7 64 192 78.33 192 96C192 113.7 177.7 128 160 128H64V416H352V320C352 302.3 366.3 288 384 288C401.7 288 416 302.3 416 320V416C416 451.3 387.3 480 352 480H64C28.65 480 0 451.3 0 416V128z\";\nconst GITHUB_PATH_D =\n  \"M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z\";\nconst LINKEDIN_PATH_D =\n  \"M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z\";\nconst TYPE_TO_PATH_D = {\n  email: EMAIL_PATH_D,\n  phone: PHONE_PATH_D,\n  location: LOCATION_PATH_D,\n  url: URL_PATH_D,\n  url_github: GITHUB_PATH_D,\n  url_linkedin: LINKEDIN_PATH_D,\n} as const;\n\nexport type IconType =\n  | \"email\"\n  | \"phone\"\n  | \"location\"\n  | \"url\"\n  | \"url_github\"\n  | \"url_linkedin\";\n\nexport const ResumePDFIcon = ({\n  type,\n  isPDF,\n}: {\n  type: IconType;\n  isPDF: boolean;\n}) => {\n  const pathD = TYPE_TO_PATH_D[type];\n  if (isPDF) {\n    return <PDFIcon pathD={pathD} />;\n  }\n  return <SVGIcon pathD={pathD} />;\n};\n\nconst { width, height, fill } = styles.icon;\n\nconst PDFIcon = ({ pathD }: { pathD: string }) => (\n  <Svg viewBox=\"0 0 512 512\" style={{ width, height }}>\n    <Path d={pathD} fill={fill} />\n  </Svg>\n);\n\nconst SVGIcon = ({ pathD }: { pathD: string }) => (\n  <svg\n    xmlns=\"http://www.w3.org/2000/svg\"\n    viewBox=\"0 0 512 512\"\n    style={{ width, height, fill }}\n  >\n    <path d={pathD} />\n  </svg>\n);\n"
  },
  {
    "path": "src/app/components/Resume/ResumePDF/common/SuppressResumePDFErrorMessage.tsx",
    "content": "\"use client\";\n\n/**\n * Suppress ResumePDF development errors.\n * See ResumePDF doc string for context.\n */\nif (typeof window !== \"undefined\" && window.location.hostname === \"localhost\") {\n  const consoleError = console.error;\n  const SUPPRESSED_WARNINGS = [\"DOCUMENT\", \"PAGE\", \"TEXT\", \"VIEW\"];\n  console.error = function filterWarnings(msg, ...args) {\n    if (!SUPPRESSED_WARNINGS.some((entry) => args[0]?.includes(entry))) {\n      consoleError(msg, ...args);\n    }\n  };\n}\n\nexport const SuppressResumePDFErrorMessage = () => {\n  return <></>;\n};\n"
  },
  {
    "path": "src/app/components/Resume/ResumePDF/common/index.tsx",
    "content": "import { Text, View, Link } from \"@react-pdf/renderer\";\nimport type { Style } from \"@react-pdf/types\";\nimport { styles, spacing } from \"components/Resume/ResumePDF/styles\";\nimport { DEBUG_RESUME_PDF_FLAG } from \"lib/constants\";\nimport { DEFAULT_FONT_COLOR } from \"lib/redux/settingsSlice\";\n\nexport const ResumePDFSection = ({\n  themeColor,\n  heading,\n  style = {},\n  children,\n}: {\n  themeColor?: string;\n  heading?: string;\n  style?: Style;\n  children: React.ReactNode;\n}) => (\n  <View\n    style={{\n      ...styles.flexCol,\n      gap: spacing[\"2\"],\n      marginTop: spacing[\"5\"],\n      ...style,\n    }}\n  >\n    {heading && (\n      <View style={{ ...styles.flexRow, alignItems: \"center\" }}>\n        {themeColor && (\n          <View\n            style={{\n              height: \"3.75pt\",\n              width: \"30pt\",\n              backgroundColor: themeColor,\n              marginRight: spacing[\"3.5\"],\n            }}\n            debug={DEBUG_RESUME_PDF_FLAG}\n          />\n        )}\n        <Text\n          style={{\n            fontWeight: \"bold\",\n            letterSpacing: \"0.3pt\", // tracking-wide -> 0.025em * 12 pt = 0.3pt\n          }}\n          debug={DEBUG_RESUME_PDF_FLAG}\n        >\n          {heading}\n        </Text>\n      </View>\n    )}\n    {children}\n  </View>\n);\n\nexport const ResumePDFText = ({\n  bold = false,\n  themeColor,\n  style = {},\n  children,\n}: {\n  bold?: boolean;\n  themeColor?: string;\n  style?: Style;\n  children: React.ReactNode;\n}) => {\n  return (\n    <Text\n      style={{\n        color: themeColor || DEFAULT_FONT_COLOR,\n        fontWeight: bold ? \"bold\" : \"normal\",\n        ...style,\n      }}\n      debug={DEBUG_RESUME_PDF_FLAG}\n    >\n      {children}\n    </Text>\n  );\n};\n\nexport const ResumePDFBulletList = ({\n  items,\n  showBulletPoints = true,\n}: {\n  items: string[];\n  showBulletPoints?: boolean;\n}) => {\n  return (\n    <>\n      {items.map((item, idx) => (\n        <View style={{ ...styles.flexRow }} key={idx}>\n          {showBulletPoints && (\n            <ResumePDFText\n              style={{\n                paddingLeft: spacing[\"2\"],\n                paddingRight: spacing[\"2\"],\n                lineHeight: \"1.3\",\n              }}\n              bold={true}\n            >\n              {\"•\"}\n            </ResumePDFText>\n          )}\n          {/* A breaking change was introduced causing text layout to be wider than node's width\n              https://github.com/diegomura/react-pdf/issues/2182. flexGrow & flexBasis fixes it */}\n          <ResumePDFText\n            style={{ lineHeight: \"1.3\", flexGrow: 1, flexBasis: 0 }}\n          >\n            {item}\n          </ResumePDFText>\n        </View>\n      ))}\n    </>\n  );\n};\n\nexport const ResumePDFLink = ({\n  src,\n  isPDF,\n  children,\n}: {\n  src: string;\n  isPDF: boolean;\n  children: React.ReactNode;\n}) => {\n  if (isPDF) {\n    return (\n      <Link src={src} style={{ textDecoration: \"none\" }}>\n        {children}\n      </Link>\n    );\n  }\n  return (\n    <a\n      href={src}\n      style={{ textDecoration: \"none\" }}\n      target=\"_blank\"\n      rel=\"noreferrer\"\n    >\n      {children}\n    </a>\n  );\n};\n\nexport const ResumeFeaturedSkill = ({\n  skill,\n  rating,\n  themeColor,\n  style = {},\n}: {\n  skill: string;\n  rating: number;\n  themeColor: string;\n  style?: Style;\n}) => {\n  const numCircles = 5;\n\n  return (\n    <View style={{ ...styles.flexRow, alignItems: \"center\", ...style }}>\n      <ResumePDFText style={{ marginRight: spacing[0.5] }}>\n        {skill}\n      </ResumePDFText>\n      {[...Array(numCircles)].map((_, idx) => (\n        <View\n          key={idx}\n          style={{\n            height: \"9pt\",\n            width: \"9pt\",\n            marginLeft: \"2.25pt\",\n            backgroundColor: rating >= idx ? themeColor : \"#d9d9d9\",\n            borderRadius: \"100%\",\n          }}\n        />\n      ))}\n    </View>\n  );\n};\n"
  },
  {
    "path": "src/app/components/Resume/ResumePDF/index.tsx",
    "content": "import { Page, View, Document } from \"@react-pdf/renderer\";\nimport { styles, spacing } from \"components/Resume/ResumePDF/styles\";\nimport { ResumePDFProfile } from \"components/Resume/ResumePDF/ResumePDFProfile\";\nimport { ResumePDFWorkExperience } from \"components/Resume/ResumePDF/ResumePDFWorkExperience\";\nimport { ResumePDFEducation } from \"components/Resume/ResumePDF/ResumePDFEducation\";\nimport { ResumePDFProject } from \"components/Resume/ResumePDF/ResumePDFProject\";\nimport { ResumePDFSkills } from \"components/Resume/ResumePDF/ResumePDFSkills\";\nimport { ResumePDFCustom } from \"components/Resume/ResumePDF/ResumePDFCustom\";\nimport { DEFAULT_FONT_COLOR } from \"lib/redux/settingsSlice\";\nimport type { Settings, ShowForm } from \"lib/redux/settingsSlice\";\nimport type { Resume } from \"lib/redux/types\";\nimport { SuppressResumePDFErrorMessage } from \"components/Resume/ResumePDF/common/SuppressResumePDFErrorMessage\";\n\n/**\n * Note: ResumePDF is supposed to be rendered inside PDFViewer. However,\n * PDFViewer is rendered too slow and has noticeable delay as you enter\n * the resume form, so we render it without PDFViewer to make it render\n * instantly. There are 2 drawbacks with this approach:\n * 1. Not everything works out of box if not rendered inside PDFViewer,\n *    e.g. svg doesn't work, so it takes in a isPDF flag that maps react\n *    pdf element to the correct dom element.\n * 2. It throws a lot of errors in console log, e.g. \"<VIEW /> is using incorrect\n *    casing. Use PascalCase for React components, or lowercase for HTML elements.\"\n *    in development, causing a lot of noises. We can possibly workaround this by\n *    mapping every react pdf element to a dom element, but for now, we simply\n *    suppress these messages in <SuppressResumePDFErrorMessage />.\n *    https://github.com/diegomura/react-pdf/issues/239#issuecomment-487255027\n */\nexport const ResumePDF = ({\n  resume,\n  settings,\n  isPDF = false,\n}: {\n  resume: Resume;\n  settings: Settings;\n  isPDF?: boolean;\n}) => {\n  const { profile, workExperiences, educations, projects, skills, custom } =\n    resume;\n  const { name } = profile;\n  const {\n    fontFamily,\n    fontSize,\n    documentSize,\n    formToHeading,\n    formToShow,\n    formsOrder,\n    showBulletPoints,\n  } = settings;\n  const themeColor = settings.themeColor || DEFAULT_FONT_COLOR;\n\n  const showFormsOrder = formsOrder.filter((form) => formToShow[form]);\n\n  const formTypeToComponent: { [type in ShowForm]: () => JSX.Element } = {\n    workExperiences: () => (\n      <ResumePDFWorkExperience\n        heading={formToHeading[\"workExperiences\"]}\n        workExperiences={workExperiences}\n        themeColor={themeColor}\n      />\n    ),\n    educations: () => (\n      <ResumePDFEducation\n        heading={formToHeading[\"educations\"]}\n        educations={educations}\n        themeColor={themeColor}\n        showBulletPoints={showBulletPoints[\"educations\"]}\n      />\n    ),\n    projects: () => (\n      <ResumePDFProject\n        heading={formToHeading[\"projects\"]}\n        projects={projects}\n        themeColor={themeColor}\n      />\n    ),\n    skills: () => (\n      <ResumePDFSkills\n        heading={formToHeading[\"skills\"]}\n        skills={skills}\n        themeColor={themeColor}\n        showBulletPoints={showBulletPoints[\"skills\"]}\n      />\n    ),\n    custom: () => (\n      <ResumePDFCustom\n        heading={formToHeading[\"custom\"]}\n        custom={custom}\n        themeColor={themeColor}\n        showBulletPoints={showBulletPoints[\"custom\"]}\n      />\n    ),\n  };\n\n  return (\n    <>\n      <Document title={`${name} Resume`} author={name} producer={\"OpenResume\"}>\n        <Page\n          size={documentSize === \"A4\" ? \"A4\" : \"LETTER\"}\n          style={{\n            ...styles.flexCol,\n            color: DEFAULT_FONT_COLOR,\n            fontFamily,\n            fontSize: fontSize + \"pt\",\n          }}\n        >\n          {Boolean(settings.themeColor) && (\n            <View\n              style={{\n                width: spacing[\"full\"],\n                height: spacing[3.5],\n                backgroundColor: themeColor,\n              }}\n            />\n          )}\n          <View\n            style={{\n              ...styles.flexCol,\n              padding: `${spacing[0]} ${spacing[20]}`,\n            }}\n          >\n            <ResumePDFProfile\n              profile={profile}\n              themeColor={themeColor}\n              isPDF={isPDF}\n            />\n            {showFormsOrder.map((form) => {\n              const Component = formTypeToComponent[form];\n              return <Component key={form} />;\n            })}\n          </View>\n        </Page>\n      </Document>\n      <SuppressResumePDFErrorMessage />\n    </>\n  );\n};\n"
  },
  {
    "path": "src/app/components/Resume/ResumePDF/styles.ts",
    "content": "import { StyleSheet } from \"@react-pdf/renderer\";\n\n// Tailwindcss Spacing Design System: https://tailwindcss.com/docs/theme#spacing\n// It is converted from rem to pt (1rem = 12pt) since https://react-pdf.org/styling only accepts pt unit\nexport const spacing = {\n  0: \"0\",\n  0.5: \"1.5pt\",\n  1: \"3pt\",\n  1.5: \"4.5pt\",\n  2: \"6pt\",\n  2.5: \"7.5pt\",\n  3: \"9pt\",\n  3.5: \"10.5pt\",\n  4: \"12pt\",\n  5: \"15pt\",\n  6: \"18pt\",\n  7: \"21pt\",\n  8: \"24pt\",\n  9: \"27pt\",\n  10: \"30pt\",\n  11: \"33pt\",\n  12: \"36pt\",\n  14: \"42pt\",\n  16: \"48pt\",\n  20: \"60pt\",\n  24: \"72pt\",\n  28: \"84pt\",\n  32: \"96pt\",\n  36: \"108pt\",\n  40: \"120pt\",\n  44: \"132pt\",\n  48: \"144pt\",\n  52: \"156pt\",\n  56: \"168pt\",\n  60: \"180pt\",\n  64: \"192pt\",\n  72: \"216pt\",\n  80: \"240pt\",\n  96: \"288pt\",\n  full: \"100%\",\n} as const;\n\nexport const styles = StyleSheet.create({\n  flexRow: {\n    display: \"flex\",\n    flexDirection: \"row\",\n  },\n  flexRowBetween: {\n    display: \"flex\",\n    flexDirection: \"row\",\n    justifyContent: \"space-between\",\n  },\n  flexCol: {\n    display: \"flex\",\n    flexDirection: \"column\",\n  },\n  icon: {\n    width: \"13pt\",\n    height: \"13pt\",\n    fill: \"#525252\", // text-neutral-600\n  },\n});\n"
  },
  {
    "path": "src/app/components/Resume/hooks.tsx",
    "content": "import { useEffect, useState } from \"react\";\nimport { A4_HEIGHT_PX, LETTER_HEIGHT_PX } from \"lib/constants\";\nimport { getPxPerRem } from \"lib/get-px-per-rem\";\nimport { CSS_VARIABLES } from \"globals-css\";\n\n/**\n * useSetDefaultScale sets the default scale of the resume on load.\n *\n * It computes the scale based on current screen height and derives the default\n * resume height by subtracting the screen height from the total heights of top\n * nav bar, resume control bar, and resume top & bottom padding.\n */\nexport const useSetDefaultScale = ({\n  setScale,\n  documentSize,\n}: {\n  setScale: (scale: number) => void;\n  documentSize: string;\n}) => {\n  const [scaleOnResize, setScaleOnResize] = useState(true);\n\n  useEffect(() => {\n    const getDefaultScale = () => {\n      const screenHeightPx = window.innerHeight;\n      const PX_PER_REM = getPxPerRem();\n      const screenHeightRem = screenHeightPx / PX_PER_REM;\n      const topNavBarHeightRem = parseFloat(\n        CSS_VARIABLES[\"--top-nav-bar-height\"]\n      );\n      const resumeControlBarHeight = parseFloat(\n        CSS_VARIABLES[\"--resume-control-bar-height\"]\n      );\n      const resumePadding = parseFloat(CSS_VARIABLES[\"--resume-padding\"]);\n      const topAndBottomResumePadding = resumePadding * 2;\n      const defaultResumeHeightRem =\n        screenHeightRem -\n        topNavBarHeightRem -\n        resumeControlBarHeight -\n        topAndBottomResumePadding;\n      const resumeHeightPx = defaultResumeHeightRem * PX_PER_REM;\n      const height = documentSize === \"A4\" ? A4_HEIGHT_PX : LETTER_HEIGHT_PX;\n      const defaultScale = Math.round((resumeHeightPx / height) * 100) / 100;\n      return defaultScale;\n    };\n\n    const setDefaultScale = () => {\n      const defaultScale = getDefaultScale();\n      setScale(defaultScale);\n    };\n\n    if (scaleOnResize) {\n      setDefaultScale();\n      window.addEventListener(\"resize\", setDefaultScale);\n    }\n\n    return () => {\n      window.removeEventListener(\"resize\", setDefaultScale);\n    };\n  }, [setScale, scaleOnResize, documentSize]);\n\n  return { scaleOnResize, setScaleOnResize };\n};\n"
  },
  {
    "path": "src/app/components/Resume/index.tsx",
    "content": "\"use client\";\nimport { useState, useMemo } from \"react\";\nimport { ResumeIframeCSR } from \"components/Resume/ResumeIFrame\";\nimport { ResumePDF } from \"components/Resume/ResumePDF\";\nimport {\n  ResumeControlBarCSR,\n  ResumeControlBarBorder,\n} from \"components/Resume/ResumeControlBar\";\nimport { FlexboxSpacer } from \"components/FlexboxSpacer\";\nimport { useAppSelector } from \"lib/redux/hooks\";\nimport { selectResume } from \"lib/redux/resumeSlice\";\nimport { selectSettings } from \"lib/redux/settingsSlice\";\nimport { DEBUG_RESUME_PDF_FLAG } from \"lib/constants\";\nimport {\n  useRegisterReactPDFFont,\n  useRegisterReactPDFHyphenationCallback,\n} from \"components/fonts/hooks\";\nimport { NonEnglishFontsCSSLazyLoader } from \"components/fonts/NonEnglishFontsCSSLoader\";\n\nexport const Resume = () => {\n  const [scale, setScale] = useState(0.8);\n  const resume = useAppSelector(selectResume);\n  const settings = useAppSelector(selectSettings);\n  const document = useMemo(\n    () => <ResumePDF resume={resume} settings={settings} isPDF={true} />,\n    [resume, settings]\n  );\n\n  useRegisterReactPDFFont();\n  useRegisterReactPDFHyphenationCallback(settings.fontFamily);\n\n  return (\n    <>\n      <NonEnglishFontsCSSLazyLoader />\n      <div className=\"relative flex justify-center md:justify-start\">\n        <FlexboxSpacer maxWidth={50} className=\"hidden md:block\" />\n        <div className=\"relative\">\n          <section className=\"h-[calc(100vh-var(--top-nav-bar-height)-var(--resume-control-bar-height))] overflow-hidden md:p-[var(--resume-padding)]\">\n            <ResumeIframeCSR\n              documentSize={settings.documentSize}\n              scale={scale}\n              enablePDFViewer={DEBUG_RESUME_PDF_FLAG}\n            >\n              <ResumePDF\n                resume={resume}\n                settings={settings}\n                isPDF={DEBUG_RESUME_PDF_FLAG}\n              />\n            </ResumeIframeCSR>\n          </section>\n          <ResumeControlBarCSR\n            scale={scale}\n            setScale={setScale}\n            documentSize={settings.documentSize}\n            document={document}\n            fileName={resume.profile.name + \" - Resume\"}\n          />\n        </div>\n        <ResumeControlBarBorder />\n      </div>\n    </>\n  );\n};\n"
  },
  {
    "path": "src/app/components/ResumeDropzone.tsx",
    "content": "import { useState } from \"react\";\nimport { LockClosedIcon } from \"@heroicons/react/24/solid\";\nimport { XMarkIcon } from \"@heroicons/react/24/outline\";\nimport { parseResumeFromPdf } from \"lib/parse-resume-from-pdf\";\nimport {\n  getHasUsedAppBefore,\n  saveStateToLocalStorage,\n} from \"lib/redux/local-storage\";\nimport { type ShowForm, initialSettings } from \"lib/redux/settingsSlice\";\nimport { useRouter } from \"next/navigation\";\nimport addPdfSrc from \"public/assets/add-pdf.svg\";\nimport Image from \"next/image\";\nimport { cx } from \"lib/cx\";\nimport { deepClone } from \"lib/deep-clone\";\n\nconst defaultFileState = {\n  name: \"\",\n  size: 0,\n  fileUrl: \"\",\n};\n\nexport const ResumeDropzone = ({\n  onFileUrlChange,\n  className,\n  playgroundView = false,\n}: {\n  onFileUrlChange: (fileUrl: string) => void;\n  className?: string;\n  playgroundView?: boolean;\n}) => {\n  const [file, setFile] = useState(defaultFileState);\n  const [isHoveredOnDropzone, setIsHoveredOnDropzone] = useState(false);\n  const [hasNonPdfFile, setHasNonPdfFile] = useState(false);\n  const router = useRouter();\n\n  const hasFile = Boolean(file.name);\n\n  const setNewFile = (newFile: File) => {\n    if (file.fileUrl) {\n      URL.revokeObjectURL(file.fileUrl);\n    }\n\n    const { name, size } = newFile;\n    const fileUrl = URL.createObjectURL(newFile);\n    setFile({ name, size, fileUrl });\n    onFileUrlChange(fileUrl);\n  };\n\n  const onDrop = (event: React.DragEvent<HTMLDivElement>) => {\n    event.preventDefault();\n    const newFile = event.dataTransfer.files[0];\n    if (newFile.name.endsWith(\".pdf\")) {\n      setHasNonPdfFile(false);\n      setNewFile(newFile);\n    } else {\n      setHasNonPdfFile(true);\n    }\n    setIsHoveredOnDropzone(false);\n  };\n\n  const onInputChange = async (event: React.ChangeEvent<HTMLInputElement>) => {\n    const files = event.target.files;\n    if (!files) return;\n\n    const newFile = files[0];\n    setNewFile(newFile);\n  };\n\n  const onRemove = () => {\n    setFile(defaultFileState);\n    onFileUrlChange(\"\");\n  };\n\n  const onImportClick = async () => {\n    const resume = await parseResumeFromPdf(file.fileUrl);\n    const settings = deepClone(initialSettings);\n\n    // Set formToShow settings based on uploaded resume if users have used the app before\n    if (getHasUsedAppBefore()) {\n      const sections = Object.keys(settings.formToShow) as ShowForm[];\n      const sectionToFormToShow: Record<ShowForm, boolean> = {\n        workExperiences: resume.workExperiences.length > 0,\n        educations: resume.educations.length > 0,\n        projects: resume.projects.length > 0,\n        skills: resume.skills.descriptions.length > 0,\n        custom: resume.custom.descriptions.length > 0,\n      };\n      for (const section of sections) {\n        settings.formToShow[section] = sectionToFormToShow[section];\n      }\n    }\n\n    saveStateToLocalStorage({ resume, settings });\n    router.push(\"/resume-builder\");\n  };\n\n  return (\n    <div\n      className={cx(\n        \"flex justify-center rounded-md border-2 border-dashed border-gray-300 px-6 \",\n        isHoveredOnDropzone && \"border-sky-400\",\n        playgroundView ? \"pb-6 pt-4\" : \"py-12\",\n        className\n      )}\n      onDragOver={(event) => {\n        event.preventDefault();\n        setIsHoveredOnDropzone(true);\n      }}\n      onDragLeave={() => setIsHoveredOnDropzone(false)}\n      onDrop={onDrop}\n    >\n      <div\n        className={cx(\n          \"text-center\",\n          playgroundView ? \"space-y-2\" : \"space-y-3\"\n        )}\n      >\n        {!playgroundView && (\n          <Image\n            src={addPdfSrc}\n            className=\"mx-auto h-14 w-14\"\n            alt=\"Add pdf\"\n            aria-hidden=\"true\"\n            priority\n          />\n        )}\n        {!hasFile ? (\n          <>\n            <p\n              className={cx(\n                \"pt-3 text-gray-700\",\n                !playgroundView && \"text-lg font-semibold\"\n              )}\n            >\n              Browse a pdf file or drop it here\n            </p>\n            <p className=\"flex text-sm text-gray-500\">\n              <LockClosedIcon className=\"mr-1 mt-1 h-3 w-3 text-gray-400\" />\n              File data is used locally and never leaves your browser\n            </p>\n          </>\n        ) : (\n          <div className=\"flex items-center justify-center gap-3 pt-3\">\n            <div className=\"pl-7 font-semibold text-gray-900\">\n              {file.name} - {getFileSizeString(file.size)}\n            </div>\n            <button\n              type=\"button\"\n              className=\"outline-theme-blue rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-500\"\n              title=\"Remove file\"\n              onClick={onRemove}\n            >\n              <XMarkIcon className=\"h-6 w-6\" />\n            </button>\n          </div>\n        )}\n        <div className=\"pt-4\">\n          {!hasFile ? (\n            <>\n              <label\n                className={cx(\n                  \"within-outline-theme-purple cursor-pointer rounded-full px-6 pb-2.5 pt-2 font-semibold shadow-sm\",\n                  playgroundView ? \"border\" : \"bg-primary\"\n                )}\n              >\n                Browse file\n                <input\n                  type=\"file\"\n                  className=\"sr-only\"\n                  accept=\".pdf\"\n                  onChange={onInputChange}\n                />\n              </label>\n              {hasNonPdfFile && (\n                <p className=\"mt-6 text-red-400\">Only pdf file is supported</p>\n              )}\n            </>\n          ) : (\n            <>\n              {!playgroundView && (\n                <button\n                  type=\"button\"\n                  className=\"btn-primary\"\n                  onClick={onImportClick}\n                >\n                  Import and Continue <span aria-hidden=\"true\">→</span>\n                </button>\n              )}\n              <p className={cx(\" text-gray-500\", !playgroundView && \"mt-6\")}>\n                Note: {!playgroundView ? \"Import\" : \"Parser\"} works best on\n                single column resume\n              </p>\n            </>\n          )}\n        </div>\n      </div>\n    </div>\n  );\n};\n\nconst getFileSizeString = (fileSizeB: number) => {\n  const fileSizeKB = fileSizeB / 1024;\n  const fileSizeMB = fileSizeKB / 1024;\n  if (fileSizeKB < 1000) {\n    return fileSizeKB.toPrecision(3) + \" KB\";\n  } else {\n    return fileSizeMB.toPrecision(3) + \" MB\";\n  }\n};\n"
  },
  {
    "path": "src/app/components/ResumeForm/CustomForm.tsx",
    "content": "import { Form } from \"components/ResumeForm/Form\";\nimport { BulletListIconButton } from \"components/ResumeForm/Form/IconButton\";\nimport { BulletListTextarea } from \"components/ResumeForm/Form/InputGroup\";\nimport { useAppDispatch, useAppSelector } from \"lib/redux/hooks\";\nimport { changeCustom, selectCustom } from \"lib/redux/resumeSlice\";\nimport {\n  selectShowBulletPoints,\n  changeShowBulletPoints,\n} from \"lib/redux/settingsSlice\";\n\nexport const CustomForm = () => {\n  const custom = useAppSelector(selectCustom);\n  const dispatch = useAppDispatch();\n  const { descriptions } = custom;\n  const form = \"custom\";\n  const showBulletPoints = useAppSelector(selectShowBulletPoints(form));\n\n  const handleCustomChange = (field: \"descriptions\", value: string[]) => {\n    dispatch(changeCustom({ field, value }));\n  };\n\n  const handleShowBulletPoints = (value: boolean) => {\n    dispatch(changeShowBulletPoints({ field: form, value }));\n  };\n\n  return (\n    <Form form={form}>\n      <div className=\"col-span-full grid grid-cols-6 gap-3\">\n        <div className=\"relative col-span-full\">\n          <BulletListTextarea\n            label=\"Custom Textbox\"\n            labelClassName=\"col-span-full\"\n            name=\"descriptions\"\n            placeholder=\"Bullet points\"\n            value={descriptions}\n            onChange={handleCustomChange}\n            showBulletPoints={showBulletPoints}\n          />\n          <div className=\"absolute left-[7.7rem] top-[0.07rem]\">\n            <BulletListIconButton\n              showBulletPoints={showBulletPoints}\n              onClick={handleShowBulletPoints}\n            />\n          </div>\n        </div>\n      </div>\n    </Form>\n  );\n};\n"
  },
  {
    "path": "src/app/components/ResumeForm/EducationsForm.tsx",
    "content": "import { Form, FormSection } from \"components/ResumeForm/Form\";\nimport {\n  BulletListTextarea,\n  Input,\n} from \"components/ResumeForm/Form/InputGroup\";\nimport { BulletListIconButton } from \"components/ResumeForm/Form/IconButton\";\nimport type { CreateHandleChangeArgsWithDescriptions } from \"components/ResumeForm/types\";\nimport { useAppDispatch, useAppSelector } from \"lib/redux/hooks\";\nimport { changeEducations, selectEducations } from \"lib/redux/resumeSlice\";\nimport type { ResumeEducation } from \"lib/redux/types\";\nimport {\n  changeShowBulletPoints,\n  selectShowBulletPoints,\n} from \"lib/redux/settingsSlice\";\n\nexport const EducationsForm = () => {\n  const educations = useAppSelector(selectEducations);\n  const dispatch = useAppDispatch();\n  const showDelete = educations.length > 1;\n  const form = \"educations\";\n  const showBulletPoints = useAppSelector(selectShowBulletPoints(form));\n\n  return (\n    <Form form={form} addButtonText=\"Add School\">\n      {educations.map(({ school, degree, gpa, date, descriptions }, idx) => {\n        const handleEducationChange = (\n          ...[\n            field,\n            value,\n          ]: CreateHandleChangeArgsWithDescriptions<ResumeEducation>\n        ) => {\n          dispatch(changeEducations({ idx, field, value } as any));\n        };\n\n        const handleShowBulletPoints = (value: boolean) => {\n          dispatch(changeShowBulletPoints({ field: form, value }));\n        };\n\n        const showMoveUp = idx !== 0;\n        const showMoveDown = idx !== educations.length - 1;\n\n        return (\n          <FormSection\n            key={idx}\n            form=\"educations\"\n            idx={idx}\n            showMoveUp={showMoveUp}\n            showMoveDown={showMoveDown}\n            showDelete={showDelete}\n            deleteButtonTooltipText=\"Delete school\"\n          >\n            <Input\n              label=\"School\"\n              labelClassName=\"col-span-4\"\n              name=\"school\"\n              placeholder=\"Cornell University\"\n              value={school}\n              onChange={handleEducationChange}\n            />\n            <Input\n              label=\"Date\"\n              labelClassName=\"col-span-2\"\n              name=\"date\"\n              placeholder=\"May 2018\"\n              value={date}\n              onChange={handleEducationChange}\n            />\n            <Input\n              label=\"Degree & Major\"\n              labelClassName=\"col-span-4\"\n              name=\"degree\"\n              placeholder=\"Bachelor of Science in Computer Engineering\"\n              value={degree}\n              onChange={handleEducationChange}\n            />\n            <Input\n              label=\"GPA\"\n              labelClassName=\"col-span-2\"\n              name=\"gpa\"\n              placeholder=\"3.81\"\n              value={gpa}\n              onChange={handleEducationChange}\n            />\n            <div className=\"relative col-span-full\">\n              <BulletListTextarea\n                label=\"Additional Information (Optional)\"\n                labelClassName=\"col-span-full\"\n                name=\"descriptions\"\n                placeholder=\"Free paragraph space to list out additional activities, courses, awards etc\"\n                value={descriptions}\n                onChange={handleEducationChange}\n                showBulletPoints={showBulletPoints}\n              />\n              <div className=\"absolute left-[15.6rem] top-[0.07rem]\">\n                <BulletListIconButton\n                  showBulletPoints={showBulletPoints}\n                  onClick={handleShowBulletPoints}\n                />\n              </div>\n            </div>\n          </FormSection>\n        );\n      })}\n    </Form>\n  );\n};\n"
  },
  {
    "path": "src/app/components/ResumeForm/Form/FeaturedSkillInput.tsx",
    "content": "import React, { useState } from \"react\";\nimport { INPUT_CLASS_NAME } from \"components/ResumeForm/Form/InputGroup\";\n\nexport const FeaturedSkillInput = ({\n  skill,\n  rating,\n  setSkillRating,\n  placeholder,\n  className,\n  circleColor,\n}: {\n  skill: string;\n  rating: number;\n  setSkillRating: (skill: string, rating: number) => void;\n  placeholder: string;\n  className?: string;\n  circleColor?: string;\n}) => {\n  return (\n    <div className={`flex ${className}`}>\n      <input\n        type=\"text\"\n        value={skill}\n        placeholder={placeholder}\n        onChange={(e) => setSkillRating(e.target.value, rating)}\n        className={INPUT_CLASS_NAME}\n      />\n      <CircleRating\n        rating={rating}\n        setRating={(newRating) => setSkillRating(skill, newRating)}\n        circleColor={circleColor}\n      />\n    </div>\n  );\n};\n\nconst CircleRating = ({\n  rating,\n  setRating,\n  circleColor = \"#38bdf8\",\n}: {\n  rating: number;\n  setRating: (rating: number) => void;\n  circleColor?: string;\n}) => {\n  const numCircles = 5;\n  const [hoverRating, setHoverRating] = useState<number | null>(null);\n\n  return (\n    <div className=\"flex items-center p-2\">\n      {[...Array(numCircles)].map((_, idx) => (\n        <div\n          className={`cursor-pointer p-0.5`}\n          key={idx}\n          onClick={() => setRating(idx)}\n          onMouseEnter={() => setHoverRating(idx)}\n          onMouseLeave={() => setHoverRating(null)}\n        >\n          <div\n            className=\"h-5 w-5 rounded-full transition-transform duration-200 hover:scale-[120%] \"\n            style={{\n              backgroundColor:\n                (hoverRating !== null && hoverRating >= idx) ||\n                (hoverRating === null && rating >= idx)\n                  ? circleColor\n                  : \"#d1d5db\", //gray-300\n            }}\n          />\n        </div>\n      ))}\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/app/components/ResumeForm/Form/IconButton.tsx",
    "content": "import { IconButton } from \"components/Button\";\nimport {\n  EyeIcon,\n  EyeSlashIcon,\n  ArrowSmallUpIcon,\n  ArrowSmallDownIcon,\n  TrashIcon,\n  ListBulletIcon,\n} from \"@heroicons/react/24/outline\";\n\nexport const ShowIconButton = ({\n  show,\n  setShow,\n}: {\n  show: boolean;\n  setShow: (show: boolean) => void;\n}) => {\n  const tooltipText = show ? \"Hide section\" : \"Show section\";\n  const onClick = () => {\n    setShow(!show);\n  };\n  const Icon = show ? EyeIcon : EyeSlashIcon;\n\n  return (\n    <IconButton onClick={onClick} tooltipText={tooltipText}>\n      <Icon className=\"h-6 w-6 text-gray-400\" aria-hidden=\"true\" />\n      <span className=\"sr-only\">{tooltipText}</span>\n    </IconButton>\n  );\n};\n\ntype MoveIconButtonType = \"up\" | \"down\";\nexport const MoveIconButton = ({\n  type,\n  size = \"medium\",\n  onClick,\n}: {\n  type: MoveIconButtonType;\n  size?: \"small\" | \"medium\";\n  onClick: (type: MoveIconButtonType) => void;\n}) => {\n  const tooltipText = type === \"up\" ? \"Move up\" : \"Move down\";\n  const sizeClassName = size === \"medium\" ? \"h-6 w-6\" : \"h-4 w-4\";\n  const Icon = type === \"up\" ? ArrowSmallUpIcon : ArrowSmallDownIcon;\n\n  return (\n    <IconButton\n      onClick={() => onClick(type)}\n      tooltipText={tooltipText}\n      size={size}\n    >\n      <Icon className={`${sizeClassName} text-gray-400`} aria-hidden=\"true\" />\n      <span className=\"sr-only\">{tooltipText}</span>\n    </IconButton>\n  );\n};\n\nexport const DeleteIconButton = ({\n  onClick,\n  tooltipText,\n}: {\n  onClick: () => void;\n  tooltipText: string;\n}) => {\n  return (\n    <IconButton onClick={onClick} tooltipText={tooltipText} size=\"small\">\n      <TrashIcon className=\"h-4 w-4 text-gray-400\" aria-hidden=\"true\" />\n      <span className=\"sr-only\">{tooltipText}</span>\n    </IconButton>\n  );\n};\n\nexport const BulletListIconButton = ({\n  onClick,\n  showBulletPoints,\n}: {\n  onClick: (newShowBulletPoints: boolean) => void;\n  showBulletPoints: boolean;\n}) => {\n  const tooltipText = showBulletPoints\n    ? \"Hide bullet points\"\n    : \"Show bullet points\";\n\n  return (\n    <IconButton\n      onClick={() => onClick(!showBulletPoints)}\n      tooltipText={tooltipText}\n      size=\"small\"\n      className={showBulletPoints ? \"!bg-sky-100\" : \"\"}\n    >\n      <ListBulletIcon\n        className={`h-4 w-4 ${\n          showBulletPoints ? \"text-gray-700\" : \"text-gray-400\"\n        }`}\n        aria-hidden=\"true\"\n      />\n      <span className=\"sr-only\">{tooltipText}</span>\n    </IconButton>\n  );\n};\n"
  },
  {
    "path": "src/app/components/ResumeForm/Form/InputGroup.tsx",
    "content": "import { useState, useEffect } from \"react\";\nimport ContentEditable from \"react-contenteditable\";\nimport { useAutosizeTextareaHeight } from \"lib/hooks/useAutosizeTextareaHeight\";\n\ninterface InputProps<K extends string, V extends string | string[]> {\n  label: string;\n  labelClassName?: string;\n  // name is passed in as a const string. Therefore, we make it a generic type so its type can\n  // be more restricted as a const for the first argument in onChange\n  name: K;\n  value?: V;\n  placeholder: string;\n  onChange: (name: K, value: V) => void;\n}\n\n/**\n * InputGroupWrapper wraps a label element around a input children. This is preferable\n * than having input as a sibling since it makes clicking label auto focus input children\n */\nexport const InputGroupWrapper = ({\n  label,\n  className,\n  children,\n}: {\n  label: string;\n  className?: string;\n  children?: React.ReactNode;\n}) => (\n  <label className={`text-base font-medium text-gray-700 ${className}`}>\n    {label}\n    {children}\n  </label>\n);\n\nexport const INPUT_CLASS_NAME =\n  \"mt-1 px-3 py-2 block w-full rounded-md border border-gray-300 text-gray-900 shadow-sm outline-none font-normal text-base\";\n\nexport const Input = <K extends string>({\n  name,\n  value = \"\",\n  placeholder,\n  onChange,\n  label,\n  labelClassName,\n}: InputProps<K, string>) => {\n  return (\n    <InputGroupWrapper label={label} className={labelClassName}>\n      <input\n        type=\"text\"\n        name={name}\n        value={value}\n        placeholder={placeholder}\n        onChange={(e) => onChange(name, e.target.value)}\n        className={INPUT_CLASS_NAME}\n      />\n    </InputGroupWrapper>\n  );\n};\n\nexport const Textarea = <T extends string>({\n  label,\n  labelClassName: wrapperClassName,\n  name,\n  value = \"\",\n  placeholder,\n  onChange,\n}: InputProps<T, string>) => {\n  const textareaRef = useAutosizeTextareaHeight({ value });\n\n  return (\n    <InputGroupWrapper label={label} className={wrapperClassName}>\n      <textarea\n        ref={textareaRef}\n        name={name}\n        className={`${INPUT_CLASS_NAME} resize-none overflow-hidden`}\n        placeholder={placeholder}\n        value={value}\n        onChange={(e) => onChange(name, e.target.value)}\n      />\n    </InputGroupWrapper>\n  );\n};\n\nexport const BulletListTextarea = <T extends string>(\n  props: InputProps<T, string[]> & { showBulletPoints?: boolean }\n) => {\n  const [showFallback, setShowFallback] = useState(false);\n\n  useEffect(() => {\n    const isFirefox = navigator.userAgent.includes(\"Firefox\");\n    const isSafari =\n      navigator.userAgent.includes(\"Safari\") &&\n      !navigator.userAgent.includes(\"Chrome\"); // Note that Chrome also includes Safari in its userAgent\n    if (isFirefox || isSafari) {\n      setShowFallback(true);\n    }\n  }, []);\n\n  if (showFallback) {\n    return <BulletListTextareaFallback {...props} />;\n  }\n  return <BulletListTextareaGeneral {...props} />;\n};\n\n/**\n * BulletListTextareaGeneral is a textarea where each new line starts with a bullet point.\n *\n * In its core, it uses a div with contentEditable set to True. However, when\n * contentEditable is True, user can paste in any arbitrary html and it would\n * render. So to make it behaves like a textarea, it strips down all html while\n * keeping only the text part.\n *\n * Reference: https://stackoverflow.com/a/74998090/7699841\n */\nconst BulletListTextareaGeneral = <T extends string>({\n  label,\n  labelClassName: wrapperClassName,\n  name,\n  value: bulletListStrings = [],\n  placeholder,\n  onChange,\n  showBulletPoints = true,\n}: InputProps<T, string[]> & { showBulletPoints?: boolean }) => {\n  const html = getHTMLFromBulletListStrings(bulletListStrings);\n  return (\n    <InputGroupWrapper label={label} className={wrapperClassName}>\n      <ContentEditable\n        contentEditable={true}\n        className={`${INPUT_CLASS_NAME} cursor-text [&>div]:list-item ${\n          showBulletPoints ? \"pl-7\" : \"[&>div]:list-['']\"\n        }`}\n        // Note: placeholder currently doesn't work\n        placeholder={placeholder}\n        onChange={(e) => {\n          if (e.type === \"input\") {\n            const { innerText } = e.currentTarget as HTMLDivElement;\n            const newBulletListStrings =\n              getBulletListStringsFromInnerText(innerText);\n            onChange(name, newBulletListStrings);\n          }\n        }}\n        html={html}\n      />\n    </InputGroupWrapper>\n  );\n};\n\nconst NORMALIZED_LINE_BREAK = \"\\n\";\n/**\n * Normalize line breaks to be \\n since different OS uses different line break\n *    Windows -> \\r\\n (CRLF)\n *    Unix    -> \\n (LF)\n *    Mac     -> \\n (LF), or \\r (CR) for earlier versions\n */\nconst normalizeLineBreak = (str: string) =>\n  str.replace(/\\r?\\n/g, NORMALIZED_LINE_BREAK);\nconst dedupeLineBreak = (str: string) =>\n  str.replace(/\\n\\n/g, NORMALIZED_LINE_BREAK);\nconst getStringsByLineBreak = (str: string) => str.split(NORMALIZED_LINE_BREAK);\n\nconst getBulletListStringsFromInnerText = (innerText: string) => {\n  const innerTextWithNormalizedLineBreak = normalizeLineBreak(innerText);\n\n  // In Windows Chrome, pressing enter creates 2 line breaks \"\\n\\n\"\n  // This dedupes it into 1 line break \"\\n\"\n  let newInnerText = dedupeLineBreak(innerTextWithNormalizedLineBreak);\n\n  // Handle the special case when content is empty\n  if (newInnerText === NORMALIZED_LINE_BREAK) {\n    newInnerText = \"\";\n  }\n\n  return getStringsByLineBreak(newInnerText);\n};\n\nconst getHTMLFromBulletListStrings = (bulletListStrings: string[]) => {\n  // If bulletListStrings is an empty array, make it an empty div\n  if (bulletListStrings.length === 0) {\n    return \"<div></div>\";\n  }\n\n  return bulletListStrings.map((text) => `<div>${text}</div>`).join(\"\");\n};\n\n/**\n * BulletListTextareaFallback is a fallback for BulletListTextareaGeneral to work around\n * content editable div issue in some browsers. For example, in Firefox, if user enters\n * space in the content editable div at the end of line, Firefox returns it as a new\n * line character \\n instead of space in innerText.\n */\nconst BulletListTextareaFallback = <T extends string>({\n  label,\n  labelClassName,\n  name,\n  value: bulletListStrings = [],\n  placeholder,\n  onChange,\n  showBulletPoints = true,\n}: InputProps<T, string[]> & { showBulletPoints?: boolean }) => {\n  const textareaValue = getTextareaValueFromBulletListStrings(\n    bulletListStrings,\n    showBulletPoints\n  );\n\n  return (\n    <Textarea\n      label={label}\n      labelClassName={labelClassName}\n      name={name}\n      value={textareaValue}\n      placeholder={placeholder}\n      onChange={(name, value) => {\n        onChange(\n          name,\n          getBulletListStringsFromTextareaValue(value, showBulletPoints)\n        );\n      }}\n    />\n  );\n};\n\nconst getTextareaValueFromBulletListStrings = (\n  bulletListStrings: string[],\n  showBulletPoints: boolean\n) => {\n  const prefix = showBulletPoints ? \"• \" : \"\";\n\n  if (bulletListStrings.length === 0) {\n    return prefix;\n  }\n\n  let value = \"\";\n  for (let i = 0; i < bulletListStrings.length; i++) {\n    const string = bulletListStrings[i];\n    const isLastItem = i === bulletListStrings.length - 1;\n    value += `${prefix}${string}${isLastItem ? \"\" : \"\\r\\n\"}`;\n  }\n  return value;\n};\n\nconst getBulletListStringsFromTextareaValue = (\n  textareaValue: string,\n  showBulletPoints: boolean\n) => {\n  const textareaValueWithNormalizedLineBreak =\n    normalizeLineBreak(textareaValue);\n\n  const strings = getStringsByLineBreak(textareaValueWithNormalizedLineBreak);\n\n  if (showBulletPoints) {\n    // Filter out empty strings\n    const nonEmptyStrings = strings.filter((s) => s !== \"•\");\n\n    let newStrings: string[] = [];\n    for (let string of nonEmptyStrings) {\n      if (string.startsWith(\"• \")) {\n        newStrings.push(string.slice(2));\n      } else if (string.startsWith(\"•\")) {\n        // Handle the special case when user wants to delete the bullet point, in which case\n        // we combine it with the previous line if previous line exists\n        const lastItemIdx = newStrings.length - 1;\n        if (lastItemIdx >= 0) {\n          const lastItem = newStrings[lastItemIdx];\n          newStrings[lastItemIdx] = `${lastItem}${string.slice(1)}`;\n        } else {\n          newStrings.push(string.slice(1));\n        }\n      } else {\n        newStrings.push(string);\n      }\n    }\n    return newStrings;\n  }\n\n  return strings;\n};\n"
  },
  {
    "path": "src/app/components/ResumeForm/Form/index.tsx",
    "content": "import { ExpanderWithHeightTransition } from \"components/ExpanderWithHeightTransition\";\nimport {\n  DeleteIconButton,\n  MoveIconButton,\n  ShowIconButton,\n} from \"components/ResumeForm/Form/IconButton\";\nimport { useAppDispatch, useAppSelector } from \"lib/redux/hooks\";\nimport {\n  changeFormHeading,\n  changeFormOrder,\n  changeShowForm,\n  selectHeadingByForm,\n  selectIsFirstForm,\n  selectIsLastForm,\n  selectShowByForm,\n  ShowForm,\n} from \"lib/redux/settingsSlice\";\nimport {\n  BuildingOfficeIcon,\n  AcademicCapIcon,\n  LightBulbIcon,\n  WrenchIcon,\n  PlusSmallIcon,\n} from \"@heroicons/react/24/outline\";\nimport {\n  addSectionInForm,\n  deleteSectionInFormByIdx,\n  moveSectionInForm,\n} from \"lib/redux/resumeSlice\";\n\n/**\n * BaseForm is the bare bone form, i.e. just the outline with no title and no control buttons.\n * ProfileForm uses this to compose its outline.\n */\nexport const BaseForm = ({\n  children,\n  className,\n}: {\n  children: React.ReactNode;\n  className?: string;\n}) => (\n  <section\n    className={`flex flex-col gap-3 rounded-md bg-white p-6 pt-4 shadow transition-opacity duration-200 ${className}`}\n  >\n    {children}\n  </section>\n);\n\nconst FORM_TO_ICON: { [section in ShowForm]: typeof BuildingOfficeIcon } = {\n  workExperiences: BuildingOfficeIcon,\n  educations: AcademicCapIcon,\n  projects: LightBulbIcon,\n  skills: WrenchIcon,\n  custom: WrenchIcon,\n};\n\nexport const Form = ({\n  form,\n  addButtonText,\n  children,\n}: {\n  form: ShowForm;\n  addButtonText?: string;\n  children: React.ReactNode;\n}) => {\n  const showForm = useAppSelector(selectShowByForm(form));\n  const heading = useAppSelector(selectHeadingByForm(form));\n\n  const dispatch = useAppDispatch();\n  const setShowForm = (showForm: boolean) => {\n    dispatch(changeShowForm({ field: form, value: showForm }));\n  };\n  const setHeading = (heading: string) => {\n    dispatch(changeFormHeading({ field: form, value: heading }));\n  };\n\n  const isFirstForm = useAppSelector(selectIsFirstForm(form));\n  const isLastForm = useAppSelector(selectIsLastForm(form));\n\n  const handleMoveClick = (type: \"up\" | \"down\") => {\n    dispatch(changeFormOrder({ form, type }));\n  };\n\n  const Icon = FORM_TO_ICON[form];\n\n  return (\n    <BaseForm\n      className={`transition-opacity duration-200 ${\n        showForm ? \"pb-6\" : \"pb-2 opacity-60\"\n      }`}\n    >\n      <div className=\"flex items-center justify-between gap-4\">\n        <div className=\"flex grow items-center gap-2\">\n          <Icon className=\"h-6 w-6 text-gray-600\" aria-hidden=\"true\" />\n          <input\n            type=\"text\"\n            className=\"block w-full border-b border-transparent text-lg font-semibold tracking-wide text-gray-900 outline-none hover:border-gray-300 hover:shadow-sm focus:border-gray-300 focus:shadow-sm\"\n            value={heading}\n            onChange={(e) => setHeading(e.target.value)}\n          />\n        </div>\n        <div className=\"flex items-center gap-0.5\">\n          {!isFirstForm && (\n            <MoveIconButton type=\"up\" onClick={handleMoveClick} />\n          )}\n          {!isLastForm && (\n            <MoveIconButton type=\"down\" onClick={handleMoveClick} />\n          )}\n          <ShowIconButton show={showForm} setShow={setShowForm} />\n        </div>\n      </div>\n      <ExpanderWithHeightTransition expanded={showForm}>\n        {children}\n      </ExpanderWithHeightTransition>\n      {showForm && addButtonText && (\n        <div className=\"mt-2 flex justify-end\">\n          <button\n            type=\"button\"\n            onClick={() => {\n              dispatch(addSectionInForm({ form }));\n            }}\n            className=\"flex items-center rounded-md bg-white py-2 pl-3 pr-4 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n          >\n            <PlusSmallIcon\n              className=\"-ml-0.5 mr-1.5 h-5 w-5 text-gray-400\"\n              aria-hidden=\"true\"\n            />\n            {addButtonText}\n          </button>\n        </div>\n      )}\n    </BaseForm>\n  );\n};\n\nexport const FormSection = ({\n  form,\n  idx,\n  showMoveUp,\n  showMoveDown,\n  showDelete,\n  deleteButtonTooltipText,\n  children,\n}: {\n  form: ShowForm;\n  idx: number;\n  showMoveUp: boolean;\n  showMoveDown: boolean;\n  showDelete: boolean;\n  deleteButtonTooltipText: string;\n  children: React.ReactNode;\n}) => {\n  const dispatch = useAppDispatch();\n  const handleDeleteClick = () => {\n    dispatch(deleteSectionInFormByIdx({ form, idx }));\n  };\n  const handleMoveClick = (direction: \"up\" | \"down\") => {\n    dispatch(moveSectionInForm({ form, direction, idx }));\n  };\n\n  return (\n    <>\n      {idx !== 0 && (\n        <div className=\"mb-4 mt-6 border-t-2 border-dotted border-gray-200\" />\n      )}\n      <div className=\"relative grid grid-cols-6 gap-3\">\n        {children}\n        <div className={`absolute right-0 top-0 flex gap-0.5 `}>\n          <div\n            className={`transition-all duration-300 ${\n              showMoveUp ? \"\" : \"invisible opacity-0\"\n            } ${showMoveDown ? \"\" : \"-mr-6\"}`}\n          >\n            <MoveIconButton\n              type=\"up\"\n              size=\"small\"\n              onClick={() => handleMoveClick(\"up\")}\n            />\n          </div>\n          <div\n            className={`transition-all duration-300 ${\n              showMoveDown ? \"\" : \"invisible opacity-0\"\n            }`}\n          >\n            <MoveIconButton\n              type=\"down\"\n              size=\"small\"\n              onClick={() => handleMoveClick(\"down\")}\n            />\n          </div>\n          <div\n            className={`transition-all duration-300 ${\n              showDelete ? \"\" : \"invisible opacity-0\"\n            }`}\n          >\n            <DeleteIconButton\n              onClick={handleDeleteClick}\n              tooltipText={deleteButtonTooltipText}\n            />\n          </div>\n        </div>\n      </div>\n    </>\n  );\n};\n"
  },
  {
    "path": "src/app/components/ResumeForm/ProfileForm.tsx",
    "content": "import { BaseForm } from \"components/ResumeForm/Form\";\nimport { Input, Textarea } from \"components/ResumeForm/Form/InputGroup\";\nimport { useAppDispatch, useAppSelector } from \"lib/redux/hooks\";\nimport { changeProfile, selectProfile } from \"lib/redux/resumeSlice\";\nimport { ResumeProfile } from \"lib/redux/types\";\n\nexport const ProfileForm = () => {\n  const profile = useAppSelector(selectProfile);\n  const dispatch = useAppDispatch();\n  const { name, email, phone, url, summary, location } = profile;\n\n  const handleProfileChange = (field: keyof ResumeProfile, value: string) => {\n    dispatch(changeProfile({ field, value }));\n  };\n\n  return (\n    <BaseForm>\n      <div className=\"grid grid-cols-6 gap-3\">\n        <Input\n          label=\"Name\"\n          labelClassName=\"col-span-full\"\n          name=\"name\"\n          placeholder=\"Sal Khan\"\n          value={name}\n          onChange={handleProfileChange}\n        />\n        <Textarea\n          label=\"Objective\"\n          labelClassName=\"col-span-full\"\n          name=\"summary\"\n          placeholder=\"Entrepreneur and educator obsessed with making education free for anyone\"\n          value={summary}\n          onChange={handleProfileChange}\n        />\n        <Input\n          label=\"Email\"\n          labelClassName=\"col-span-4\"\n          name=\"email\"\n          placeholder=\"hello@khanacademy.org\"\n          value={email}\n          onChange={handleProfileChange}\n        />\n        <Input\n          label=\"Phone\"\n          labelClassName=\"col-span-2\"\n          name=\"phone\"\n          placeholder=\"(123)456-7890\"\n          value={phone}\n          onChange={handleProfileChange}\n        />\n        <Input\n          label=\"Website\"\n          labelClassName=\"col-span-4\"\n          name=\"url\"\n          placeholder=\"linkedin.com/in/khanacademy\"\n          value={url}\n          onChange={handleProfileChange}\n        />\n        <Input\n          label=\"Location\"\n          labelClassName=\"col-span-2\"\n          name=\"location\"\n          placeholder=\"NYC, NY\"\n          value={location}\n          onChange={handleProfileChange}\n        />\n      </div>\n    </BaseForm>\n  );\n};\n"
  },
  {
    "path": "src/app/components/ResumeForm/ProjectsForm.tsx",
    "content": "import { Form, FormSection } from \"components/ResumeForm/Form\";\nimport {\n  Input,\n  BulletListTextarea,\n} from \"components/ResumeForm/Form/InputGroup\";\nimport type { CreateHandleChangeArgsWithDescriptions } from \"components/ResumeForm/types\";\nimport { useAppDispatch, useAppSelector } from \"lib/redux/hooks\";\nimport { selectProjects, changeProjects } from \"lib/redux/resumeSlice\";\nimport type { ResumeProject } from \"lib/redux/types\";\n\nexport const ProjectsForm = () => {\n  const projects = useAppSelector(selectProjects);\n  const dispatch = useAppDispatch();\n  const showDelete = projects.length > 1;\n\n  return (\n    <Form form=\"projects\" addButtonText=\"Add Project\">\n      {projects.map(({ project, date, descriptions }, idx) => {\n        const handleProjectChange = (\n          ...[\n            field,\n            value,\n          ]: CreateHandleChangeArgsWithDescriptions<ResumeProject>\n        ) => {\n          dispatch(changeProjects({ idx, field, value } as any));\n        };\n        const showMoveUp = idx !== 0;\n        const showMoveDown = idx !== projects.length - 1;\n\n        return (\n          <FormSection\n            key={idx}\n            form=\"projects\"\n            idx={idx}\n            showMoveUp={showMoveUp}\n            showMoveDown={showMoveDown}\n            showDelete={showDelete}\n            deleteButtonTooltipText={\"Delete project\"}\n          >\n            <Input\n              name=\"project\"\n              label=\"Project Name\"\n              placeholder=\"OpenResume\"\n              value={project}\n              onChange={handleProjectChange}\n              labelClassName=\"col-span-4\"\n            />\n            <Input\n              name=\"date\"\n              label=\"Date\"\n              placeholder=\"Winter 2022\"\n              value={date}\n              onChange={handleProjectChange}\n              labelClassName=\"col-span-2\"\n            />\n            <BulletListTextarea\n              name=\"descriptions\"\n              label=\"Description\"\n              placeholder=\"Bullet points\"\n              value={descriptions}\n              onChange={handleProjectChange}\n              labelClassName=\"col-span-full\"\n            />\n          </FormSection>\n        );\n      })}\n    </Form>\n  );\n};\n"
  },
  {
    "path": "src/app/components/ResumeForm/SkillsForm.tsx",
    "content": "import { Form } from \"components/ResumeForm/Form\";\nimport {\n  BulletListTextarea,\n  InputGroupWrapper,\n} from \"components/ResumeForm/Form/InputGroup\";\nimport { FeaturedSkillInput } from \"components/ResumeForm/Form/FeaturedSkillInput\";\nimport { BulletListIconButton } from \"components/ResumeForm/Form/IconButton\";\nimport { useAppDispatch, useAppSelector } from \"lib/redux/hooks\";\nimport { selectSkills, changeSkills } from \"lib/redux/resumeSlice\";\nimport {\n  selectShowBulletPoints,\n  changeShowBulletPoints,\n  selectThemeColor,\n} from \"lib/redux/settingsSlice\";\n\nexport const SkillsForm = () => {\n  const skills = useAppSelector(selectSkills);\n  const dispatch = useAppDispatch();\n  const { featuredSkills, descriptions } = skills;\n  const form = \"skills\";\n  const showBulletPoints = useAppSelector(selectShowBulletPoints(form));\n  const themeColor = useAppSelector(selectThemeColor) || \"#38bdf8\";\n\n  const handleSkillsChange = (field: \"descriptions\", value: string[]) => {\n    dispatch(changeSkills({ field, value }));\n  };\n  const handleFeaturedSkillsChange = (\n    idx: number,\n    skill: string,\n    rating: number\n  ) => {\n    dispatch(changeSkills({ field: \"featuredSkills\", idx, skill, rating }));\n  };\n  const handleShowBulletPoints = (value: boolean) => {\n    dispatch(changeShowBulletPoints({ field: form, value }));\n  };\n\n  return (\n    <Form form={form}>\n      <div className=\"col-span-full grid grid-cols-6 gap-3\">\n        <div className=\"relative col-span-full\">\n          <BulletListTextarea\n            label=\"Skills List\"\n            labelClassName=\"col-span-full\"\n            name=\"descriptions\"\n            placeholder=\"Bullet points\"\n            value={descriptions}\n            onChange={handleSkillsChange}\n            showBulletPoints={showBulletPoints}\n          />\n          <div className=\"absolute left-[4.5rem] top-[0.07rem]\">\n            <BulletListIconButton\n              showBulletPoints={showBulletPoints}\n              onClick={handleShowBulletPoints}\n            />\n          </div>\n        </div>\n        <div className=\"col-span-full mb-4 mt-6 border-t-2 border-dotted border-gray-200\" />\n        <InputGroupWrapper\n          label=\"Featured Skills (Optional)\"\n          className=\"col-span-full\"\n        >\n          <p className=\"mt-2 text-sm font-normal text-gray-600\">\n            Featured skills is optional to highlight top skills, with more\n            circles mean higher proficiency.\n          </p>\n        </InputGroupWrapper>\n\n        {featuredSkills.map(({ skill, rating }, idx) => (\n          <FeaturedSkillInput\n            key={idx}\n            className=\"col-span-3\"\n            skill={skill}\n            rating={rating}\n            setSkillRating={(newSkill, newRating) => {\n              handleFeaturedSkillsChange(idx, newSkill, newRating);\n            }}\n            placeholder={`Featured Skill ${idx + 1}`}\n            circleColor={themeColor}\n          />\n        ))}\n      </div>\n    </Form>\n  );\n};\n"
  },
  {
    "path": "src/app/components/ResumeForm/ThemeForm/InlineInput.tsx",
    "content": "interface InputProps<K extends string, V extends string> {\n  label: string;\n  labelClassName?: string;\n  name: K;\n  value?: V;\n  placeholder: string;\n  inputStyle?: React.CSSProperties;\n  onChange: (name: K, value: V) => void;\n}\n\nexport const InlineInput = <K extends string>({\n  label,\n  labelClassName,\n  name,\n  value = \"\",\n  placeholder,\n  inputStyle = {},\n  onChange,\n}: InputProps<K, string>) => {\n  return (\n    <label\n      className={`flex gap-2 text-base font-medium text-gray-700 ${labelClassName}`}\n    >\n      <span className=\"w-28\">{label}</span>\n      <input\n        type=\"text\"\n        name={name}\n        value={value}\n        placeholder={placeholder}\n        onChange={(e) => onChange(name, e.target.value)}\n        className=\"w-[5rem] border-b border-gray-300 text-center font-semibold leading-3 outline-none\"\n        style={inputStyle}\n      />\n    </label>\n  );\n};\n"
  },
  {
    "path": "src/app/components/ResumeForm/ThemeForm/Selection.tsx",
    "content": "import type { GeneralSetting } from \"lib/redux/settingsSlice\";\nimport { PX_PER_PT } from \"lib/constants\";\nimport {\n  FONT_FAMILY_TO_STANDARD_SIZE_IN_PT,\n  FONT_FAMILY_TO_DISPLAY_NAME,\n  type FontFamily,\n} from \"components/fonts/constants\";\nimport { getAllFontFamiliesToLoad } from \"components/fonts/lib\";\nimport dynamic from \"next/dynamic\";\n\nconst Selection = ({\n  selectedColor,\n  isSelected,\n  style = {},\n  onClick,\n  children,\n}: {\n  selectedColor: string;\n  isSelected: boolean;\n  style?: React.CSSProperties;\n  onClick: () => void;\n  children: React.ReactNode;\n}) => {\n  const selectedStyle = {\n    color: \"white\",\n    backgroundColor: selectedColor,\n    borderColor: selectedColor,\n    ...style,\n  };\n\n  return (\n    <div\n      className=\"flex w-[105px] cursor-pointer items-center justify-center rounded-md border border-gray-300 py-1.5 shadow-sm hover:border-gray-400 hover:bg-gray-100\"\n      onClick={onClick}\n      style={isSelected ? selectedStyle : style}\n      onKeyDown={(e) => {\n        if ([\"Enter\", \" \"].includes(e.key)) onClick();\n      }}\n      tabIndex={0}\n    >\n      {children}\n    </div>\n  );\n};\n\nconst SelectionsWrapper = ({ children }: { children: React.ReactNode }) => {\n  return <div className=\"mt-2 flex flex-wrap gap-3\">{children}</div>;\n};\n\nconst FontFamilySelections = ({\n  selectedFontFamily,\n  themeColor,\n  handleSettingsChange,\n}: {\n  selectedFontFamily: string;\n  themeColor: string;\n  handleSettingsChange: (field: GeneralSetting, value: string) => void;\n}) => {\n  const allFontFamilies = getAllFontFamiliesToLoad();\n  return (\n    <SelectionsWrapper>\n      {allFontFamilies.map((fontFamily, idx) => {\n        const isSelected = selectedFontFamily === fontFamily;\n        const standardSizePt = FONT_FAMILY_TO_STANDARD_SIZE_IN_PT[fontFamily];\n        return (\n          <Selection\n            key={idx}\n            selectedColor={themeColor}\n            isSelected={isSelected}\n            style={{\n              fontFamily,\n              fontSize: `${standardSizePt * PX_PER_PT}px`,\n            }}\n            onClick={() => handleSettingsChange(\"fontFamily\", fontFamily)}\n          >\n            {FONT_FAMILY_TO_DISPLAY_NAME[fontFamily]}\n          </Selection>\n        );\n      })}\n    </SelectionsWrapper>\n  );\n};\n\n/**\n * Load FontFamilySelections client side since it calls getAllFontFamiliesToLoad,\n * which uses navigator object that is only available on client side\n */\nexport const FontFamilySelectionsCSR = dynamic(\n  () => Promise.resolve(FontFamilySelections),\n  {\n    ssr: false,\n  }\n);\n\nexport const FontSizeSelections = ({\n  selectedFontSize,\n  fontFamily,\n  themeColor,\n  handleSettingsChange,\n}: {\n  fontFamily: FontFamily;\n  themeColor: string;\n  selectedFontSize: string;\n  handleSettingsChange: (field: GeneralSetting, value: string) => void;\n}) => {\n  const standardSizePt = FONT_FAMILY_TO_STANDARD_SIZE_IN_PT[fontFamily];\n  const compactSizePt = standardSizePt - 1;\n\n  return (\n    <SelectionsWrapper>\n      {[\"Compact\", \"Standard\", \"Large\"].map((type, idx) => {\n        const fontSizePt = String(compactSizePt + idx);\n        const isSelected = fontSizePt === selectedFontSize;\n        return (\n          <Selection\n            key={idx}\n            selectedColor={themeColor}\n            isSelected={isSelected}\n            style={{\n              fontFamily,\n              fontSize: `${Number(fontSizePt) * PX_PER_PT}px`,\n            }}\n            onClick={() => handleSettingsChange(\"fontSize\", fontSizePt)}\n          >\n            {type}\n          </Selection>\n        );\n      })}\n    </SelectionsWrapper>\n  );\n};\n\nexport const DocumentSizeSelections = ({\n  selectedDocumentSize,\n  themeColor,\n  handleSettingsChange,\n}: {\n  themeColor: string;\n  selectedDocumentSize: string;\n  handleSettingsChange: (field: GeneralSetting, value: string) => void;\n}) => {\n  return (\n    <SelectionsWrapper>\n      {[\"Letter\", \"A4\"].map((type, idx) => {\n        return (\n          <Selection\n            key={idx}\n            selectedColor={themeColor}\n            isSelected={type === selectedDocumentSize}\n            onClick={() => handleSettingsChange(\"documentSize\", type)}\n          >\n            <div className=\"flex flex-col items-center\">\n              <div>{type}</div>\n              <div className=\"text-xs\">\n                {type === \"Letter\" ? \"(US, Canada)\" : \"(other countries)\"}\n              </div>\n            </div>\n          </Selection>\n        );\n      })}\n    </SelectionsWrapper>\n  );\n};\n"
  },
  {
    "path": "src/app/components/ResumeForm/ThemeForm/constants.ts",
    "content": "export const THEME_COLORS = [\n  \"#f87171\", // Red-400\n  \"#ef4444\", // Red-500\n  \"#fb923c\", // Orange-400\n  \"#f97316\", // Orange-500\n  \"#fbbf24\", // Amber-400\n  \"#f59e0b\", // Amber-500\n  \"#22c55e\", // Green-500\n  \"#15803d\", // Green-700\n  \"#38bdf8\", // Sky-400\n  \"#0ea5e9\", // Sky-500\n  \"#818cf8\", // Indigo-400\n  \"#6366f1\", // Indigo-500\n];\n"
  },
  {
    "path": "src/app/components/ResumeForm/ThemeForm/index.tsx",
    "content": "import { BaseForm } from \"components/ResumeForm/Form\";\nimport { InputGroupWrapper } from \"components/ResumeForm/Form/InputGroup\";\nimport { THEME_COLORS } from \"components/ResumeForm/ThemeForm/constants\";\nimport { InlineInput } from \"components/ResumeForm/ThemeForm/InlineInput\";\nimport {\n  DocumentSizeSelections,\n  FontFamilySelectionsCSR,\n  FontSizeSelections,\n} from \"components/ResumeForm/ThemeForm/Selection\";\nimport {\n  changeSettings,\n  DEFAULT_THEME_COLOR,\n  selectSettings,\n  type GeneralSetting,\n} from \"lib/redux/settingsSlice\";\nimport { useAppDispatch, useAppSelector } from \"lib/redux/hooks\";\nimport type { FontFamily } from \"components/fonts/constants\";\nimport { Cog6ToothIcon } from \"@heroicons/react/24/outline\";\n\nexport const ThemeForm = () => {\n  const settings = useAppSelector(selectSettings);\n  const { fontSize, fontFamily, documentSize } = settings;\n  const themeColor = settings.themeColor || DEFAULT_THEME_COLOR;\n  const dispatch = useAppDispatch();\n\n  const handleSettingsChange = (field: GeneralSetting, value: string) => {\n    dispatch(changeSettings({ field, value }));\n  };\n\n  return (\n    <BaseForm>\n      <div className=\"flex flex-col gap-6\">\n        <div className=\"flex items-center gap-2\">\n          <Cog6ToothIcon className=\"h-6 w-6 text-gray-600\" aria-hidden=\"true\" />\n          <h1 className=\"text-lg font-semibold tracking-wide text-gray-900 \">\n            Resume Setting\n          </h1>\n        </div>\n        <div>\n          <InlineInput\n            label=\"Theme Color\"\n            name=\"themeColor\"\n            value={settings.themeColor}\n            placeholder={DEFAULT_THEME_COLOR}\n            onChange={handleSettingsChange}\n            inputStyle={{ color: themeColor }}\n          />\n          <div className=\"mt-2 flex flex-wrap gap-2\">\n            {THEME_COLORS.map((color, idx) => (\n              <div\n                className=\"flex h-10 w-10 cursor-pointer items-center justify-center rounded-md text-sm text-white\"\n                style={{ backgroundColor: color }}\n                key={idx}\n                onClick={() => handleSettingsChange(\"themeColor\", color)}\n                onKeyDown={(e) => {\n                  if ([\"Enter\", \" \"].includes(e.key))\n                    handleSettingsChange(\"themeColor\", color);\n                }}\n                tabIndex={0}\n              >\n                {settings.themeColor === color ? \"✓\" : \"\"}\n              </div>\n            ))}\n          </div>\n        </div>\n        <div>\n          <InputGroupWrapper label=\"Font Family\" />\n          <FontFamilySelectionsCSR\n            selectedFontFamily={fontFamily}\n            themeColor={themeColor}\n            handleSettingsChange={handleSettingsChange}\n          />\n        </div>\n        <div>\n          <InlineInput\n            label=\"Font Size (pt)\"\n            name=\"fontSize\"\n            value={fontSize}\n            placeholder=\"11\"\n            onChange={handleSettingsChange}\n          />\n          <FontSizeSelections\n            fontFamily={fontFamily as FontFamily}\n            themeColor={themeColor}\n            selectedFontSize={fontSize}\n            handleSettingsChange={handleSettingsChange}\n          />\n        </div>\n        <div>\n          <InputGroupWrapper label=\"Document Size\" />\n          <DocumentSizeSelections\n            themeColor={themeColor}\n            selectedDocumentSize={documentSize}\n            handleSettingsChange={handleSettingsChange}\n          />\n        </div>\n      </div>\n    </BaseForm>\n  );\n};\n"
  },
  {
    "path": "src/app/components/ResumeForm/WorkExperiencesForm.tsx",
    "content": "import { Form, FormSection } from \"components/ResumeForm/Form\";\nimport {\n  Input,\n  BulletListTextarea,\n} from \"components/ResumeForm/Form/InputGroup\";\nimport type { CreateHandleChangeArgsWithDescriptions } from \"components/ResumeForm/types\";\nimport { useAppDispatch, useAppSelector } from \"lib/redux/hooks\";\nimport {\n  changeWorkExperiences,\n  selectWorkExperiences,\n} from \"lib/redux/resumeSlice\";\nimport type { ResumeWorkExperience } from \"lib/redux/types\";\n\nexport const WorkExperiencesForm = () => {\n  const workExperiences = useAppSelector(selectWorkExperiences);\n  const dispatch = useAppDispatch();\n\n  const showDelete = workExperiences.length > 1;\n\n  return (\n    <Form form=\"workExperiences\" addButtonText=\"Add Job\">\n      {workExperiences.map(({ company, jobTitle, date, descriptions }, idx) => {\n        const handleWorkExperienceChange = (\n          ...[\n            field,\n            value,\n          ]: CreateHandleChangeArgsWithDescriptions<ResumeWorkExperience>\n        ) => {\n          // TS doesn't support passing union type to single call signature\n          // https://github.com/microsoft/TypeScript/issues/54027\n          // any is used here as a workaround\n          dispatch(changeWorkExperiences({ idx, field, value } as any));\n        };\n        const showMoveUp = idx !== 0;\n        const showMoveDown = idx !== workExperiences.length - 1;\n\n        return (\n          <FormSection\n            key={idx}\n            form=\"workExperiences\"\n            idx={idx}\n            showMoveUp={showMoveUp}\n            showMoveDown={showMoveDown}\n            showDelete={showDelete}\n            deleteButtonTooltipText=\"Delete job\"\n          >\n            <Input\n              label=\"Company\"\n              labelClassName=\"col-span-full\"\n              name=\"company\"\n              placeholder=\"Khan Academy\"\n              value={company}\n              onChange={handleWorkExperienceChange}\n            />\n            <Input\n              label=\"Job Title\"\n              labelClassName=\"col-span-4\"\n              name=\"jobTitle\"\n              placeholder=\"Software Engineer\"\n              value={jobTitle}\n              onChange={handleWorkExperienceChange}\n            />\n            <Input\n              label=\"Date\"\n              labelClassName=\"col-span-2\"\n              name=\"date\"\n              placeholder=\"Jun 2022 - Present\"\n              value={date}\n              onChange={handleWorkExperienceChange}\n            />\n            <BulletListTextarea\n              label=\"Description\"\n              labelClassName=\"col-span-full\"\n              name=\"descriptions\"\n              placeholder=\"Bullet points\"\n              value={descriptions}\n              onChange={handleWorkExperienceChange}\n            />\n          </FormSection>\n        );\n      })}\n    </Form>\n  );\n};\n"
  },
  {
    "path": "src/app/components/ResumeForm/index.tsx",
    "content": "\"use client\";\nimport { useState } from \"react\";\nimport {\n  useAppSelector,\n  useSaveStateToLocalStorageOnChange,\n  useSetInitialStore,\n} from \"lib/redux/hooks\";\nimport { ShowForm, selectFormsOrder } from \"lib/redux/settingsSlice\";\nimport { ProfileForm } from \"components/ResumeForm/ProfileForm\";\nimport { WorkExperiencesForm } from \"components/ResumeForm/WorkExperiencesForm\";\nimport { EducationsForm } from \"components/ResumeForm/EducationsForm\";\nimport { ProjectsForm } from \"components/ResumeForm/ProjectsForm\";\nimport { SkillsForm } from \"components/ResumeForm/SkillsForm\";\nimport { ThemeForm } from \"components/ResumeForm/ThemeForm\";\nimport { CustomForm } from \"components/ResumeForm/CustomForm\";\nimport { FlexboxSpacer } from \"components/FlexboxSpacer\";\nimport { cx } from \"lib/cx\";\n\nconst formTypeToComponent: { [type in ShowForm]: () => JSX.Element } = {\n  workExperiences: WorkExperiencesForm,\n  educations: EducationsForm,\n  projects: ProjectsForm,\n  skills: SkillsForm,\n  custom: CustomForm,\n};\n\nexport const ResumeForm = () => {\n  useSetInitialStore();\n  useSaveStateToLocalStorageOnChange();\n\n  const formsOrder = useAppSelector(selectFormsOrder);\n  const [isHover, setIsHover] = useState(false);\n\n  return (\n    <div\n      className={cx(\n        \"flex justify-center scrollbar-thin scrollbar-track-gray-100 md:h-[calc(100vh-var(--top-nav-bar-height))] md:justify-end md:overflow-y-scroll\",\n        isHover ? \"scrollbar-thumb-gray-200\" : \"scrollbar-thumb-gray-100\"\n      )}\n      onMouseOver={() => setIsHover(true)}\n      onMouseLeave={() => setIsHover(false)}\n    >\n      <section className=\"flex max-w-2xl flex-col gap-8 p-[var(--resume-padding)]\">\n        <ProfileForm />\n        {formsOrder.map((form) => {\n          const Component = formTypeToComponent[form];\n          return <Component key={form} />;\n        })}\n        <ThemeForm />\n        <br />\n      </section>\n      <FlexboxSpacer maxWidth={50} className=\"hidden md:block\" />\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/app/components/ResumeForm/types.ts",
    "content": "export type CreateHandleChangeArgsWithDescriptions<T> =\n  | [field: Exclude<keyof T, \"descriptions\">, value: string]\n  | [field: \"descriptions\", value: string[]];\n"
  },
  {
    "path": "src/app/components/Tooltip.tsx",
    "content": "\"use client\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\n\n/**\n * A simple Tooltip component that shows tooltip text center below children on hover and on focus\n *\n * @example\n * <Tooltip text=\"Tooltip Text\">\n *   <div>Hello</div>\n * </Tooltip>\n */\nexport const Tooltip = ({\n  text,\n  children,\n}: {\n  text: string;\n  children: React.ReactNode;\n}) => {\n  const spanRef = useRef<HTMLSpanElement>(null);\n  const tooltipRef = useRef<HTMLDivElement>(null);\n\n  const [tooltipPos, setTooltipPos] = useState({ top: 0, left: 0 });\n\n  const [show, setShow] = useState(false);\n  const showTooltip = () => setShow(true);\n  const hideTooltip = () => setShow(false);\n\n  // Hook to set tooltip position to be right below children and centered\n  useEffect(() => {\n    const span = spanRef.current;\n    const tooltip = tooltipRef.current;\n    if (span && tooltip) {\n      const rect = span.getBoundingClientRect();\n      const TOP_OFFSET = 6;\n      const newTop = rect.top + rect.height + TOP_OFFSET;\n      const newLeft = rect.left - tooltip.offsetWidth / 2 + rect.width / 2;\n      setTooltipPos({\n        top: newTop,\n        left: newLeft,\n      });\n    }\n  }, [show]);\n\n  return (\n    <span\n      ref={spanRef}\n      onMouseEnter={showTooltip}\n      onMouseLeave={hideTooltip}\n      onFocus={showTooltip}\n      onBlur={hideTooltip}\n      // hide tooltip onClick to handle the edge case where the element position is changed after lick\n      onClick={hideTooltip}\n    >\n      {children}\n      {show &&\n        createPortal(\n          <div\n            ref={tooltipRef}\n            role=\"tooltip\"\n            className=\"absolute left-0 top-0 z-10 w-max rounded-md bg-gray-600 px-2 py-0.5 text-sm text-white\"\n            style={{\n              left: `${tooltipPos.left}px`,\n              top: `${tooltipPos.top}px`,\n            }}\n          >\n            {text}\n          </div>,\n          document.body\n        )}\n    </span>\n  );\n};\n"
  },
  {
    "path": "src/app/components/TopNavBar.tsx",
    "content": "\"use client\";\nimport { usePathname } from \"next/navigation\";\nimport Link from \"next/link\";\nimport Image from \"next/image\";\nimport logoSrc from \"public/logo.svg\";\nimport { cx } from \"lib/cx\";\n\nexport const TopNavBar = () => {\n  const pathName = usePathname();\n  const isHomePage = pathName === \"/\";\n\n  return (\n    <header\n      aria-label=\"Site Header\"\n      className={cx(\n        \"flex h-[var(--top-nav-bar-height)] items-center border-b-2 border-gray-100 px-3 lg:px-12\",\n        isHomePage && \"bg-dot\"\n      )}\n    >\n      <div className=\"flex h-10 w-full items-center justify-between\">\n        <Link href=\"/\">\n          <span className=\"sr-only\">OpenResume</span>\n          <Image\n            src={logoSrc}\n            alt=\"OpenResume Logo\"\n            className=\"h-8 w-full\"\n            priority\n          />\n        </Link>\n        <nav\n          aria-label=\"Site Nav Bar\"\n          className=\"flex items-center gap-2 text-sm font-medium\"\n        >\n          {[\n            [\"/resume-builder\", \"Builder\"],\n            [\"/resume-parser\", \"Parser\"],\n          ].map(([href, text]) => (\n            <Link\n              key={text}\n              className=\"rounded-md px-1.5 py-2 text-gray-500 hover:bg-gray-100 focus-visible:bg-gray-100 lg:px-4\"\n              href={href}\n            >\n              {text}\n            </Link>\n          ))}\n          <div className=\"ml-1 mt-1\">\n            <iframe\n              src=\"https://ghbtns.com/github-btn.html?user=xitanggg&repo=open-resume&type=star&count=true\"\n              width=\"100\"\n              height=\"20\"\n              className=\"overflow-hidden border-none\"\n              title=\"GitHub\"\n            />\n          </div>\n        </nav>\n      </div>\n    </header>\n  );\n};\n"
  },
  {
    "path": "src/app/components/documentation/Badge.tsx",
    "content": "export const Badge = ({ children }: { children: React.ReactNode }) => (\n  <span className=\"inline-flex rounded-md bg-blue-50 px-2 pb-0.5 align-text-bottom text-xs font-semibold text-blue-700 ring-1 ring-inset ring-blue-700/10\">\n    {children}\n  </span>\n);\n"
  },
  {
    "path": "src/app/components/documentation/Heading.tsx",
    "content": "import { cx } from \"lib/cx\";\n\nconst HEADING_CLASSNAMES = {\n  1: \"text-2xl font-bold\",\n  2: \"text-xl font-bold\",\n  3: \"text-lg font-semibold\",\n};\n\nexport const Heading = ({\n  level = 1,\n  children,\n  className = \"\",\n}: {\n  level?: 1 | 2 | 3;\n  smallMarginTop?: boolean;\n  children: React.ReactNode;\n  className?: string;\n}) => {\n  const Component = `h${level}` as const;\n  return (\n    <Component\n      className={cx(\n        \"mt-[2em] text-gray-900\",\n        HEADING_CLASSNAMES[level],\n        className\n      )}\n    >\n      {children}\n    </Component>\n  );\n};\n"
  },
  {
    "path": "src/app/components/documentation/Link.tsx",
    "content": "import { cx } from \"lib/cx\";\n\nexport const Link = ({\n  href,\n  children,\n  className = \"\",\n}: {\n  href: string;\n  children: React.ReactNode;\n  className?: string;\n}) => {\n  return (\n    <a\n      href={href}\n      target=\"_blank\"\n      className={cx(\n        \"underline underline-offset-2 hover:decoration-2\",\n        className\n      )}\n    >\n      {children}\n    </a>\n  );\n};\n"
  },
  {
    "path": "src/app/components/documentation/Paragraph.tsx",
    "content": "import { cx } from \"lib/cx\";\n\nexport const Paragraph = ({\n  smallMarginTop = false,\n  children,\n  className = \"\",\n}: {\n  smallMarginTop?: boolean;\n  children: React.ReactNode;\n  className?: string;\n}) => {\n  return (\n    <p\n      className={cx(\n        smallMarginTop ? \"mt-[0.8em]\" : \"mt-[1.5em]\",\n        \"text-lg text-gray-700\",\n        className\n      )}\n    >\n      {children}\n    </p>\n  );\n};\n"
  },
  {
    "path": "src/app/components/documentation/Table.tsx",
    "content": "import { cx } from \"lib/cx\";\n\nexport const Table = ({\n  table,\n  title,\n  className,\n  trClassNames = [],\n  tdClassNames = [],\n}: {\n  table: React.ReactNode[][];\n  title?: string;\n  className?: string;\n  trClassNames?: string[];\n  tdClassNames?: string[];\n}) => {\n  const tableHeader = table[0];\n  const tableBody = table.slice(1);\n  return (\n    <table\n      className={cx(\"w-full divide-y border text-sm text-gray-900\", className)}\n    >\n      <thead className=\"divide-y bg-gray-50 text-left align-top\">\n        {title && (\n          <tr className=\"divide-x bg-gray-50\">\n            <th\n              className=\"px-2 py-1.5 font-bold\"\n              scope=\"colSpan\"\n              colSpan={tableHeader.length}\n            >\n              {title}\n            </th>\n          </tr>\n        )}\n        <tr className=\"divide-x bg-gray-50\">\n          {tableHeader.map((item, idx) => (\n            <th className=\"px-2 py-1.5 font-semibold\" scope=\"col\" key={idx}>\n              {item}\n            </th>\n          ))}\n        </tr>\n      </thead>\n      <tbody className=\"divide-y text-left align-top\">\n        {tableBody.map((row, rowIdx) => (\n          <tr className={cx(\"divide-x\", trClassNames[rowIdx])} key={rowIdx}>\n            {row.map((item, colIdx) => (\n              <td\n                className={cx(\"px-2 py-1.5\", tdClassNames[colIdx])}\n                key={colIdx}\n              >\n                {item}\n              </td>\n            ))}\n          </tr>\n        ))}\n      </tbody>\n    </table>\n  );\n};\n"
  },
  {
    "path": "src/app/components/documentation/index.tsx",
    "content": "import { Heading } from \"components/documentation/Heading\";\nimport { Paragraph } from \"components/documentation/Paragraph\";\nimport { Link } from \"components/documentation/Link\";\nimport { Badge } from \"components/documentation/Badge\";\nimport { Table } from \"components/documentation/Table\";\n\nexport { Heading, Paragraph, Link, Badge, Table };\n"
  },
  {
    "path": "src/app/components/fonts/FontsZh.tsx",
    "content": "import \"public/fonts/fonts-zh.css\";\n\n/**\n * Empty component. Main purpose is to load fonts-zh.css\n */\nconst FontsZh = () => <></>;\nexport default FontsZh;\n"
  },
  {
    "path": "src/app/components/fonts/NonEnglishFontsCSSLoader.tsx",
    "content": "import { useState, useEffect } from \"react\";\nimport dynamic from \"next/dynamic\";\nimport { getAllFontFamiliesToLoad } from \"components/fonts/lib\";\n\nconst FontsZhCSR = dynamic(() => import(\"components/fonts/FontsZh\"), {\n  ssr: false,\n});\n\n/**\n * Empty component to lazy load non-english fonts CSS conditionally\n *\n * Reference: https://prawira.medium.com/react-conditional-import-conditional-css-import-110cc58e0da6\n */\nexport const NonEnglishFontsCSSLazyLoader = () => {\n  const [shouldLoadFontsZh, setShouldLoadFontsZh] = useState(false);\n\n  useEffect(() => {\n    if (getAllFontFamiliesToLoad().includes(\"NotoSansSC\")) {\n      setShouldLoadFontsZh(true);\n    }\n  }, []);\n\n  return <>{shouldLoadFontsZh && <FontsZhCSR />}</>;\n};\n"
  },
  {
    "path": "src/app/components/fonts/constants.ts",
    "content": "/**\n * Adding a new font family involves 4 steps:\n * Step 1. Add it to one of the below FONT_FAMILIES variable array:\n *         English fonts -> SANS_SERIF_ENGLISH_FONT_FAMILIES or SERIF_ENGLISH_FONT_FAMILIES\n *         Non-English fonts -> NON_ENGLISH_FONT_FAMILIES\n *         Once the font is added, it would take care of\n *         a. Registering font family for React PDF at \"components/fonts/hooks.tsx\"\n *         b. Loading font family for React PDF iframe at \"components/Resume/ResumeIFrame.tsx\"\n *         c. Adding font family selection to Resume Settings at \"components/ResumeForm/ThemeForm/Selection.tsx\"\n * Step 2. To load css correctly for the Resume Form:\n *         English fonts -> add it to the \"public\\fonts\\fonts.css\" file\n *         Non-English fonts -> create/update \"public\\fonts\\fonts-<language>.css\" and update \"components/fonts/NonEnglishFontsCSSLazyLoader.tsx\"\n * Step 3. Update FONT_FAMILY_TO_STANDARD_SIZE_IN_PT and FONT_FAMILY_TO_DISPLAY_NAME accordingly\n * Step 4. Update \"public/fonts/OFL.txt\" to include the new font family and credit the font creator\n *\n * IMPORTANT NOTE:\n * One major problem with adding a new font family is that most font family doesn't work with\n * React PDF out of box. The texts would appear fine in the PDF, but copying and pasting them\n * would result in different texts. See issues: https://github.com/diegomura/react-pdf/issues/915\n * and https://github.com/diegomura/react-pdf/issues/629\n *\n * A solution to this problem is to import and re-export the font with a font editor, e.g. fontforge or birdfont.\n *\n * If using fontforge, the following command can be used to export the font:\n * ./fontforge -lang=ff -c 'Open($1); Generate($2); Close();' old_font.ttf new_font.ttf\n * Note that fontforge doesn't work on non-english fonts: https://github.com/fontforge/fontforge/issues/1534\n * Also, some fonts might still not work after re-export.\n */\n\nconst SANS_SERIF_ENGLISH_FONT_FAMILIES = [\n  \"Roboto\",\n  \"Lato\",\n  \"Montserrat\",\n  \"OpenSans\",\n  \"Raleway\",\n] as const;\n\nconst SERIF_ENGLISH_FONT_FAMILIES = [\n  \"Caladea\",\n  \"Lora\",\n  \"RobotoSlab\",\n  \"PlayfairDisplay\",\n  \"Merriweather\",\n] as const;\n\nexport const ENGLISH_FONT_FAMILIES = [\n  ...SANS_SERIF_ENGLISH_FONT_FAMILIES,\n  ...SERIF_ENGLISH_FONT_FAMILIES,\n];\ntype EnglishFontFamily = (typeof ENGLISH_FONT_FAMILIES)[number];\n\nexport const NON_ENGLISH_FONT_FAMILIES = [\"NotoSansSC\"] as const;\ntype NonEnglishFontFamily = (typeof NON_ENGLISH_FONT_FAMILIES)[number];\n\nexport const NON_ENGLISH_FONT_FAMILY_TO_LANGUAGE: Record<\n  NonEnglishFontFamily,\n  string[]\n> = {\n  NotoSansSC: [\"zh\", \"zh-CN\", \"zh-TW\"],\n};\n\nexport type FontFamily = EnglishFontFamily | NonEnglishFontFamily;\nexport const FONT_FAMILY_TO_STANDARD_SIZE_IN_PT: Record<FontFamily, number> = {\n  // Sans Serif Fonts\n  Roboto: 11,\n  Lato: 11,\n  Montserrat: 10,\n  OpenSans: 10,\n  Raleway: 10,\n  // Serif Fonts\n  Caladea: 11,\n  Lora: 11,\n  RobotoSlab: 10,\n  PlayfairDisplay: 10,\n  Merriweather: 10,\n  // Non-English Fonts\n  NotoSansSC: 11,\n};\n\nexport const FONT_FAMILY_TO_DISPLAY_NAME: Record<FontFamily, string> = {\n  // Sans Serif Fonts\n  Roboto: \"Roboto\",\n  Lato: \"Lato\",\n  Montserrat: \"Montserrat\",\n  OpenSans: \"Open Sans\",\n  Raleway: \"Raleway\",\n  // Serif Fonts\n  Caladea: \"Caladea\",\n  Lora: \"Lora\",\n  RobotoSlab: \"Roboto Slab\",\n  PlayfairDisplay: \"Playfair Display\",\n  Merriweather: \"Merriweather\",\n  // Non-English Fonts\n  NotoSansSC: \"思源黑体(简体)\",\n};\n"
  },
  {
    "path": "src/app/components/fonts/hooks.tsx",
    "content": "import { useEffect } from \"react\";\nimport { Font } from \"@react-pdf/renderer\";\nimport { ENGLISH_FONT_FAMILIES } from \"components/fonts/constants\";\nimport { getAllFontFamiliesToLoad } from \"components/fonts/lib\";\n\n/**\n * Register all fonts to React PDF so it can render fonts correctly in PDF\n */\nexport const useRegisterReactPDFFont = () => {\n  useEffect(() => {\n    const allFontFamilies = getAllFontFamiliesToLoad();\n    allFontFamilies.forEach((fontFamily) => {\n      Font.register({\n        family: fontFamily,\n        fonts: [\n          {\n            src: `fonts/${fontFamily}-Regular.ttf`,\n          },\n          {\n            src: `fonts/${fontFamily}-Bold.ttf`,\n            fontWeight: \"bold\",\n          },\n        ],\n      });\n    });\n  }, []);\n};\n\nexport const useRegisterReactPDFHyphenationCallback = (fontFamily: string) => {\n  useEffect(() => {\n    if (ENGLISH_FONT_FAMILIES.includes(fontFamily as any)) {\n      // Disable hyphenation for English Font Family so the word wraps each line\n      // https://github.com/diegomura/react-pdf/issues/311#issuecomment-548301604\n      Font.registerHyphenationCallback((word) => [word]);\n    } else {\n      // React PDF doesn't understand how to wrap non-english word on line break\n      // A workaround is to add an empty character after each word\n      // Reference https://github.com/diegomura/react-pdf/issues/1568\n      Font.registerHyphenationCallback((word) =>\n        word\n          .split(\"\")\n          .map((char) => [char, \"\"])\n          .flat()\n      );\n    }\n  }, [fontFamily]);\n};\n"
  },
  {
    "path": "src/app/components/fonts/lib.ts",
    "content": "\"use client\";\nimport {\n  ENGLISH_FONT_FAMILIES,\n  NON_ENGLISH_FONT_FAMILIES,\n  NON_ENGLISH_FONT_FAMILY_TO_LANGUAGE,\n} from \"components/fonts/constants\";\n\n/**\n * getPreferredNonEnglishFontFamilies returns non-english font families that are included in\n * user's preferred languages. This is to avoid loading fonts/languages that users won't use.\n */\nconst getPreferredNonEnglishFontFamilies = () => {\n  return NON_ENGLISH_FONT_FAMILIES.filter((fontFamily) => {\n    const fontLanguages = NON_ENGLISH_FONT_FAMILY_TO_LANGUAGE[fontFamily];\n    const userPreferredLanguages = navigator.languages ?? [navigator.language];\n    return userPreferredLanguages.some((preferredLanguage) =>\n      fontLanguages.includes(preferredLanguage)\n    );\n  });\n};\n\nexport const getAllFontFamiliesToLoad = () => {\n  return [...ENGLISH_FONT_FAMILIES, ...getPreferredNonEnglishFontFamilies()];\n};\n"
  },
  {
    "path": "src/app/globals-css.ts",
    "content": "export const CSS_VARIABLES = {\n  \"--top-nav-bar-height\": \"3.5rem\",\n  \"--resume-control-bar-height\": \"3rem\",\n  \"--resume-padding\": \"1.5rem\",\n} as const;\n"
  },
  {
    "path": "src/app/globals.css",
    "content": "@import url(\"/fonts/fonts.css\");\n@tailwind base;\n@tailwind components;\n@tailwind utilities;\n\n@layer components {\n  .btn-primary {\n    @apply bg-primary outline-theme-purple inline-block rounded-full px-6 py-2 font-semibold shadow-sm;\n  }\n  .text-primary {\n    @apply bg-gradient-to-r from-[color:var(--theme-purple)] to-[color:var(--theme-blue)] bg-clip-text text-transparent !important;\n  }\n  .bg-primary {\n    @apply bg-gradient-to-r from-[color:var(--theme-purple)] to-[color:var(--theme-blue)] text-white;\n  }\n  .outline-theme-purple {\n    @apply hover:opacity-80 hover:outline-[color:var(--theme-purple)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--theme-purple)];\n  }\n  .outline-theme-blue {\n    @apply hover:opacity-80 hover:outline-[color:var(--theme-blue)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--theme-blue)];\n  }\n  .within-outline-theme-purple {\n    @apply focus-within:outline focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-[color:var(--theme-purple)] hover:opacity-80 hover:outline-[color:var(--theme-purple)];\n  }\n}\n\n:root {\n  --theme-purple: #5d52d9;\n  --theme-blue: #4fc5eb;\n  /* Keep the below variable names in sync with CSS_VARIABLES in globals-css.ts */\n  --top-nav-bar-height: 3.5rem;\n  --resume-control-bar-height: 3rem;\n  --resume-padding: 1.5rem;\n}\n"
  },
  {
    "path": "src/app/home/AutoTypingResume.tsx",
    "content": "\"use client\";\nimport { useEffect, useState, useRef } from \"react\";\nimport { ResumePDF } from \"components/Resume/ResumePDF\";\nimport { initialResumeState } from \"lib/redux/resumeSlice\";\nimport { initialSettings } from \"lib/redux/settingsSlice\";\nimport { ResumeIframeCSR } from \"components/Resume/ResumeIFrame\";\nimport { START_HOME_RESUME, END_HOME_RESUME } from \"home/constants\";\nimport { makeObjectCharIterator } from \"lib/make-object-char-iterator\";\nimport { useTailwindBreakpoints } from \"lib/hooks/useTailwindBreakpoints\";\nimport { deepClone } from \"lib/deep-clone\";\n\n// countObjectChar(END_HOME_RESUME) -> ~1800 chars\nconst INTERVAL_MS = 50; // 20 Intervals Per Second\nconst CHARS_PER_INTERVAL = 10;\n// Auto Typing Time:\n//  10 CHARS_PER_INTERVAL -> ~1800 / (20*10) = 9s (let's go with 9s so it feels fast)\n//  9 CHARS_PER_INTERVAL -> ~1800 / (20*9) = 10s\n//  8 CHARS_PER_INTERVAL -> ~1800 / (20*8) = 11s\n\nconst RESET_INTERVAL_MS = 60 * 1000; // 60s\n\nexport const AutoTypingResume = () => {\n  const [resume, setResume] = useState(deepClone(initialResumeState));\n  const resumeCharIterator = useRef(\n    makeObjectCharIterator(START_HOME_RESUME, END_HOME_RESUME)\n  );\n  const hasSetEndResume = useRef(false);\n  const { isLg } = useTailwindBreakpoints();\n\n  useEffect(() => {\n    const intervalId = setInterval(() => {\n      let next = resumeCharIterator.current.next();\n      for (let i = 0; i < CHARS_PER_INTERVAL - 1; i++) {\n        next = resumeCharIterator.current.next();\n      }\n      if (!next.done) {\n        setResume(next.value);\n      } else {\n        // Sometimes the iterator doesn't end on the last char,\n        // so we manually set its end state here\n        if (!hasSetEndResume.current) {\n          setResume(END_HOME_RESUME);\n          hasSetEndResume.current = true;\n        }\n      }\n    }, INTERVAL_MS);\n    return () => clearInterval(intervalId);\n  }, []);\n\n  useEffect(() => {\n    const intervalId = setInterval(() => {\n      resumeCharIterator.current = makeObjectCharIterator(\n        START_HOME_RESUME,\n        END_HOME_RESUME\n      );\n      hasSetEndResume.current = false;\n    }, RESET_INTERVAL_MS);\n    return () => clearInterval(intervalId);\n  }, []);\n\n  return (\n    <>\n      <ResumeIframeCSR documentSize=\"Letter\" scale={isLg ? 0.7 : 0.5}>\n        <ResumePDF\n          resume={resume}\n          settings={{\n            ...initialSettings,\n            fontSize: \"12\",\n            formToHeading: {\n              workExperiences: resume.workExperiences[0].company\n                ? \"WORK EXPERIENCE\"\n                : \"\",\n              educations: resume.educations[0].school ? \"EDUCATION\" : \"\",\n              projects: resume.projects[0].project ? \"PROJECT\" : \"\",\n              skills: resume.skills.featuredSkills[0].skill ? \"SKILLS\" : \"\",\n              custom: \"CUSTOM SECTION\",\n            },\n          }}\n        />\n      </ResumeIframeCSR>\n    </>\n  );\n};\n"
  },
  {
    "path": "src/app/home/Features.tsx",
    "content": "import Image from \"next/image\";\nimport featureFreeSrc from \"public/assets/feature-free.svg\";\nimport featureUSSrc from \"public/assets/feature-us.svg\";\nimport featurePrivacySrc from \"public/assets/feature-privacy.svg\";\nimport featureOpenSourceSrc from \"public/assets/feature-open-source.svg\";\nimport { Link } from \"components/documentation\";\n\nconst FEATURES = [\n  {\n    src: featureFreeSrc,\n    title: \"Free Forever\",\n    text: \"OpenResume is created with the belief that everyone should have free and easy access to a modern professional resume design\",\n  },\n  {\n    src: featureUSSrc,\n    title: \"U.S. Best Practices\",\n    text: \"OpenResume has built-in best practices for the U.S. job market and works well with top ATS platforms such as Greenhouse and Lever\",\n  },\n  {\n    src: featurePrivacySrc,\n    title: \"Privacy Focus\",\n    text: \"OpenResume stores data locally in your browser so only you have access to your data and with complete control\",\n  },\n  {\n    src: featureOpenSourceSrc,\n    title: \"Open-Source\",\n    text: (\n      <>\n        OpenResume is an open-source project, and its source code can be viewed\n        by anyone on its{\" \"}\n        <Link href=\"https://github.com/xitanggg/open-resume\">\n          GitHub repository\n        </Link>\n      </>\n    ),\n  },\n];\n\nexport const Features = () => {\n  return (\n    <section className=\"py-16 lg:py-36\">\n      <div className=\"mx-auto lg:max-w-4xl\">\n        <dl className=\"grid grid-cols-1 justify-items-center gap-y-8 lg:grid-cols-2 lg:gap-x-6 lg:gap-y-16\">\n          {FEATURES.map(({ src, title, text }) => (\n            <div className=\"px-2\" key={title}>\n              <div className=\"relative w-96 self-center pl-16\">\n                <dt className=\"text-2xl font-bold\">\n                  <Image\n                    src={src}\n                    className=\"absolute left-0 top-1 h-12 w-12\"\n                    alt=\"Feature icon\"\n                  />\n                  {title}\n                </dt>\n                <dd className=\"mt-2\">{text}</dd>\n              </div>\n            </div>\n          ))}\n        </dl>\n      </div>\n    </section>\n  );\n};\n"
  },
  {
    "path": "src/app/home/Hero.tsx",
    "content": "import Link from \"next/link\";\nimport { FlexboxSpacer } from \"components/FlexboxSpacer\";\nimport { AutoTypingResume } from \"home/AutoTypingResume\";\n\nexport const Hero = () => {\n  return (\n    <section className=\"lg:flex lg:h-[825px] lg:justify-center\">\n      <FlexboxSpacer maxWidth={75} minWidth={0} className=\"hidden lg:block\" />\n      <div className=\"mx-auto max-w-xl pt-8 text-center lg:mx-0 lg:grow lg:pt-32 lg:text-left\">\n        <h1 className=\"text-primary pb-2 text-4xl font-bold lg:text-5xl\">\n          Create a professional\n          <br />\n          resume easily\n        </h1>\n        <p className=\"mt-3 text-lg lg:mt-5 lg:text-xl\">\n          With this free, open-source, and powerful resume builder\n        </p>\n        <Link href=\"/resume-import\" className=\"btn-primary mt-6 lg:mt-14\">\n          Create Resume <span aria-hidden=\"true\">→</span>\n        </Link>\n        <p className=\"ml-6 mt-3 text-sm text-gray-600\">No sign up required</p>\n        <p className=\"mt-3 text-sm text-gray-600 lg:mt-36\">\n          Already have a resume? Test its ATS readability with the{\" \"}\n          <Link href=\"/resume-parser\" className=\"underline underline-offset-2\">\n            resume parser\n          </Link>\n        </p>\n      </div>\n      <FlexboxSpacer maxWidth={100} minWidth={50} className=\"hidden lg:block\" />\n      <div className=\"mt-6 flex justify-center lg:mt-4 lg:block lg:grow\">\n        <AutoTypingResume />\n      </div>\n    </section>\n  );\n};\n"
  },
  {
    "path": "src/app/home/LogoCloud.tsx",
    "content": "import logoCornellSrc from \"public/assets/logo-cornell.svg\";\nimport logoColumbiaSrc from \"public/assets/logo-columbia.svg\";\nimport logoNortheasternSrc from \"public/assets/logo-northeastern.svg\";\nimport logoDropboxSrc from \"public/assets/logo-dropbox.svg\";\nimport logoGoogleSrc from \"public/assets/logo-google.svg\";\nimport logoAmazonSrc from \"public/assets/logo-amazon.svg\";\nimport Image from \"next/image\";\n\nconst LOGOS = [\n  { src: logoCornellSrc, alt: \"Cornell University logo\" },\n  { src: logoColumbiaSrc, alt: \"Columbia University logo\" },\n  { src: logoNortheasternSrc, alt: \"Northeastern University logo\" },\n  { src: logoDropboxSrc, alt: \"Dropbox logo\" },\n  { src: logoGoogleSrc, alt: \"Google logo\" },\n  { src: logoAmazonSrc, alt: \"Amazon logo\" },\n];\n\n// LogoCloud is disabled per issue: https://github.com/xitanggg/open-resume/issues/7\nexport const LogoCloud = () => (\n  <section className=\"mt-14 lg:mt-10\">\n    <h2 className=\"text-center font-semibold text-gray-500\">\n      Trusted by students and employees from top universities and companies\n      worldwide\n    </h2>\n    <div className=\"mt-6 grid grid-cols-6 items-center justify-items-center gap-x-8 gap-y-10\">\n      {LOGOS.map(({ src, alt }, idx) => (\n        <Image\n          key={idx}\n          className=\"col-span-3 h-full max-h-10 max-w-[130px] lg:col-span-1 lg:max-w-[160px]\"\n          src={src}\n          alt={alt}\n        />\n      ))}\n    </div>\n  </section>\n);\n"
  },
  {
    "path": "src/app/home/QuestionsAndAnswers.tsx",
    "content": "import { Link } from \"components/documentation\";\n\nconst QAS = [\n  {\n    question:\n      \"Q1. What is a resume builder? Why resume builder is better than resume template doc?\",\n    answer: (\n      <>\n        <p>\n          There are two ways to create a resume today. One option is to use a\n          resume template, such as an office/google doc, and customize it\n          according to your needs. The other option is to use a resume builder,\n          an online tool that allows you to input your information and\n          automatically generates a resume for you.\n        </p>\n        <p>\n          Using a resume template requires manual formatting work, like copying\n          and pasting text sections and adjusting spacing, which can be\n          time-consuming and error-prone. It is easy to run into formatting\n          issues, such as using different bullet points or font styles after\n          copying and pasting. On the other hand, a resume builder like\n          OpenResume saves time and prevents formatting mistakes by\n          automatically formatting the resume. It also offers the convenience of\n          easily changing font types or sizes with a simple click. In summary, a\n          resume builder is easier to use compared to a resume template.\n        </p>\n      </>\n    ),\n  },\n  {\n    question:\n      \"Q2. What uniquely sets OpenResume apart from other resume builders and templates?\",\n    answer: (\n      <>\n        <p>\n          Other than OpenResume, there are some great free resume builders out\n          there, e.g. <Link href=\"https://rxresu.me/\">Reactive Resume</Link>,{\" \"}\n          <Link href=\"https://flowcv.com/\">FlowCV</Link>. However, OpenResume\n          stands out with 2 distinctive features:\n        </p>{\" \"}\n        <p>\n          <span className=\"font-semibold\">\n            1. OpenResume is designed specifically for the U.S. job market and\n            best practices.\n          </span>\n          <br />\n          Unlike other resume builders that target a global audience and offer\n          many customization options, OpenResume intentionally only offers\n          options that are aligned with U.S. best practices. For example, it\n          excludes the option to add a profile picture to avoid bias and\n          discrimination. It offers only the core sections, e.g. profile, work\n          experience, education, and skills, while omitting unnecessary sections\n          like references. Additionally, OpenResume only offers a top down\n          single column resume design as opposed to two column design, because\n          single column design works best for AST. <br />{\" \"}\n        </p>\n        <p>\n          <span className=\"font-semibold\">\n            2. OpenResume is super privacy focus.\n          </span>{\" \"}\n          <br />\n          While other resume builders may require email sign up and store user\n          data in their databases, OpenResume believes that resume data should\n          remain private and accessible only on user’s local machine. Therefore,\n          OpenResume doesn’t require sign up to use the app, and all inputted\n          data is stored in user’s browser that only user has access to.\n        </p>\n      </>\n    ),\n  },\n  {\n    question: \"Q3. Who created OpenResume and why?\",\n    answer: (\n      <p>\n        OpenResume was created by{\" \"}\n        <Link href=\"https://github.com/xitanggg\">Xitang Zhao</Link> and designed\n        by <Link href=\"https://www.linkedin.com/in/imzhi\">Zhigang Wen</Link> as\n        a weekend project. As immigrants to the US, we had made many mistakes\n        when creating our first resumes and applying for internships and jobs.\n        It took us a long while to learn some of the best practices. While\n        mentoring first generation students and reviewing their resumes, we\n        noticed students were making the same mistakes that we had made before.\n        This led us to think about how we can be of help with the knowledge and\n        skills we have gained. We started chatting and working over the weekends\n        that led to OpenResume, where we integrated best practices and our\n        knowledge into this resume builder. Our hope is that OpenResume can help\n        anyone to easily create a modern professional resume that follows best\n        practices and enable anyone to apply for jobs with confidence.\n      </p>\n    ),\n  },\n  {\n    question: \"Q4. How can I support OpenResume?\",\n    answer: (\n      <>\n        <p>\n          The best way to support OpenResume is to share your thoughts and\n          feedback with us to help further improve it. You can send us an email\n          at{\" \"}\n          <Link href=\"mailto:hello@open-resume.com\">hello@open-resume.com</Link>{\" \"}\n          or{\" \"}\n          <Link href=\"https://github.com/xitanggg/open-resume/issues/new\">\n            open an issue\n          </Link>{\" \"}\n          at our Github repository. Whether you like it or not, we would love to\n          hear from you.\n        </p>\n        <p>\n          Another great way to support OpenResume is by spreading the words.\n          Share it with your friends, on social media platforms, or with your\n          school’s career center. Our goal is to reach more people who struggle\n          with creating their resume, and your word-of-mouth support would be\n          greatly appreciated. If you use Github, you can also show your support\n          by{\" \"}\n          <Link href=\"https://github.com/xitanggg/open-resume\">\n            giving the project a star\n          </Link>{\" \"}\n          to help increase its popularity and reach.\n        </p>\n      </>\n    ),\n  },\n];\n\nexport const QuestionsAndAnswers = () => {\n  return (\n    <section className=\"mx-auto max-w-3xl divide-y divide-gray-300 lg:mt-4 lg:px-2\">\n      <h2 className=\"text-center text-3xl font-bold\">Questions & Answers</h2>\n      <div className=\"mt-6 divide-y divide-gray-300\">\n        {QAS.map(({ question, answer }) => (\n          <div key={question} className=\"py-6\">\n            <h3 className=\"font-semibold leading-7\">{question}</h3>\n            <div className=\"mt-3 grid gap-2 leading-7 text-gray-600\">\n              {answer}\n            </div>\n          </div>\n        ))}\n      </div>\n    </section>\n  );\n};\n"
  },
  {
    "path": "src/app/home/Steps.tsx",
    "content": "const STEPS = [\n  { title: \"Add a resume pdf\", text: \"or create from scratch\" },\n  { title: \"Preview design\", text: \"and make edits\" },\n  { title: \"Download new resume\", text: \"and apply with confidence\" },\n];\n\nexport const Steps = () => {\n  return (\n    <section className=\"mx-auto mt-8 rounded-2xl bg-sky-50 bg-dot px-8 pb-12 pt-10 lg:mt-2\">\n      <h1 className=\"text-center text-3xl font-bold\">3 Simple Steps</h1>\n      <div className=\"mt-8 flex justify-center\">\n        <dl className=\"flex flex-col gap-y-10 lg:flex-row lg:justify-center lg:gap-x-20\">\n          {STEPS.map(({ title, text }, idx) => (\n            <div className=\"relative self-start pl-14\" key={idx}>\n              <dt className=\"text-lg font-bold\">\n                <div className=\"bg-primary absolute left-0 top-1 flex h-10 w-10 select-none items-center justify-center rounded-full p-[3.5px] opacity-80\">\n                  <div className=\"flex h-full w-full items-center justify-center rounded-full bg-white\">\n                    <div className=\"text-primary -mt-0.5 text-2xl\">\n                      {idx + 1}\n                    </div>\n                  </div>\n                </div>\n                {title}\n              </dt>\n              <dd>{text}</dd>\n            </div>\n          ))}\n        </dl>\n      </div>\n    </section>\n  );\n};\n"
  },
  {
    "path": "src/app/home/Testimonials.tsx",
    "content": "\"use client\";\nimport heartSrc from \"public/assets/heart.svg\";\nimport testimonialSpiegelSrc from \"public/assets/testimonial-spiegel.jpg\";\nimport testimonialSantiSrc from \"public/assets/testimonial-santi.jpg\";\nimport testimonialVivianSrc from \"public/assets/testimonial-vivian.jpg\";\nimport React, { useEffect, useRef, useState } from \"react\";\nimport Image from \"next/image\";\nimport { useTailwindBreakpoints } from \"lib/hooks/useTailwindBreakpoints\";\n\nconst TESTIMONIALS = [\n  {\n    src: testimonialSpiegelSrc,\n    quote:\n      \"Students often make silly mistakes on their resume by using inconsistent bullet points or font sizes. OpenResume’s auto format feature is a great help to ensure consistent format.\",\n    name: \"Ms. Spiegel\",\n    title: \"Educator\",\n  },\n  {\n    src: testimonialSantiSrc,\n    quote:\n      \"I used OpenResume during my last job search and was invited to interview at top tech companies such as Google and Amazon thanks to its slick yet professional resume design.\",\n    name: \"Santi\",\n    title: \"Software Engineer\",\n  },\n  {\n    src: testimonialVivianSrc,\n    quote:\n      \"Creating a professional resume on OpenResume is so smooth and easy! It saves me so much time and headache to not deal with google doc template.\",\n    name: \"Vivian\",\n    title: \"College Student\",\n  },\n];\n\nconst LG_TESTIMONIALS_CLASSNAMES = [\n  \"z-10\",\n  \"translate-x-44 translate-y-24 opacity-40\",\n  \"translate-x-32 -translate-y-28 opacity-40\",\n];\nconst SM_TESTIMONIALS_CLASSNAMES = [\"z-10\", \"opacity-0\", \"opacity-0\"];\nconst ROTATION_INTERVAL_MS = 8 * 1000; // 8s\n\nexport const Testimonials = ({ children }: { children?: React.ReactNode }) => {\n  const [testimonialsClassNames, setTestimonialsClassNames] = useState(\n    LG_TESTIMONIALS_CLASSNAMES\n  );\n  const isHoveredOnTestimonial = useRef(false);\n  useEffect(() => {\n    const intervalId = setInterval(() => {\n      if (!isHoveredOnTestimonial.current) {\n        setTestimonialsClassNames((preClassNames) => {\n          return [preClassNames[1], preClassNames[2], preClassNames[0]];\n        });\n      }\n    }, ROTATION_INTERVAL_MS);\n    return () => clearInterval(intervalId);\n  }, []);\n\n  const { isLg } = useTailwindBreakpoints();\n  useEffect(() => {\n    setTestimonialsClassNames(\n      isLg ? LG_TESTIMONIALS_CLASSNAMES : SM_TESTIMONIALS_CLASSNAMES\n    );\n  }, [isLg]);\n\n  return (\n    <section className=\"mx-auto -mt-2 px-8 pb-24\">\n      <h2 className=\"mb-8 text-center text-3xl font-bold\">\n        People{\" \"}\n        <Image src={heartSrc} alt=\"love\" className=\"-mt-1 inline-block w-7\" />{\" \"}\n        OpenResume\n      </h2>\n      <div className=\"mx-auto mt-10 h-[235px] max-w-lg lg:h-[400px] lg:pt-28\">\n        <div className=\"relative lg:ml-[-50px]\">\n          {TESTIMONIALS.map(({ src, quote, name, title }, idx) => {\n            const className = testimonialsClassNames[idx];\n            return (\n              <div\n                key={idx}\n                className={`bg-primary absolute max-w-lg rounded-[1.7rem] bg-opacity-30 shadow-md transition-all duration-1000 ease-linear ${className}`}\n                onMouseEnter={() => {\n                  if (className === \"z-10\") {\n                    isHoveredOnTestimonial.current = true;\n                  }\n                }}\n                onMouseLeave={() => {\n                  if (className === \"z-10\") {\n                    isHoveredOnTestimonial.current = false;\n                  }\n                }}\n              >\n                <figure className=\"m-1 flex gap-5 rounded-3xl bg-white p-5 text-gray-900 lg:p-7\">\n                  <Image\n                    className=\"hidden h-24 w-24 select-none rounded-full lg:block\"\n                    src={src}\n                    alt=\"profile\"\n                  />\n                  <div>\n                    <blockquote>\n                      <p className=\"before:content-['“'] after:content-['”']\">\n                        {quote}\n                      </p>\n                    </blockquote>\n                    <figcaption className=\"mt-3\">\n                      <div className=\"hidden gap-2 lg:flex\">\n                        <div className=\"font-semibold\">{name}</div>\n                        <div\n                          className=\"select-none text-gray-700\"\n                          aria-hidden=\"true\"\n                        >\n                          •\n                        </div>\n                        <div className=\"text-gray-600\">{title}</div>\n                      </div>\n                      <div className=\"flex gap-4 lg:hidden\">\n                        <Image\n                          className=\" block h-12 w-12 select-none rounded-full\"\n                          src={src}\n                          alt=\"profile\"\n                        />\n                        <div>\n                          <div className=\"font-semibold\">{name}</div>\n                          <div className=\"text-gray-600\">{title}</div>\n                        </div>\n                      </div>\n                    </figcaption>\n                  </div>\n                </figure>\n              </div>\n            );\n          })}\n        </div>\n      </div>\n      {children}\n    </section>\n  );\n};\n"
  },
  {
    "path": "src/app/home/constants.ts",
    "content": "import {\n  initialEducation,\n  initialProfile,\n  initialProject,\n  initialWorkExperience,\n} from \"lib/redux/resumeSlice\";\nimport type { Resume } from \"lib/redux/types\";\nimport { deepClone } from \"lib/deep-clone\";\n\nexport const END_HOME_RESUME: Resume = {\n  profile: {\n    name: \"John Doe\",\n    summary:\n      \"Software engineer obsessed with building exceptional products that people love\",\n    email: \"hello@openresume.com\",\n    phone: \"123-456-7890\",\n    location: \"NYC, NY\",\n    url: \"linkedin.com/in/john-doe\",\n  },\n  workExperiences: [\n    {\n      company: \"ABC Company\",\n      jobTitle: \"Software Engineer\",\n      date: \"May 2023 - Present\",\n      descriptions: [\n        \"Lead a cross-functional team of 5 engineers in developing a search bar, which enables thousands of daily active users to search content across the entire platform\",\n        \"Create stunning home page product demo animations that drives up sign up rate by 20%\",\n        \"Write clean code that is modular and easy to maintain while ensuring 100% test coverage\",\n      ],\n    },\n    {\n      company: \"DEF Organization\",\n      jobTitle: \"Software Engineer Intern\",\n      date: \"Summer 2022\",\n      descriptions: [\n        \"Re-architected the existing content editor to be mobile responsive that led to a 10% increase in mobile user engagement\",\n        \"Created a progress bar to help users track progress that drove up user retention by 15%\",\n        \"Discovered and fixed 5 bugs in the existing codebase to enhance user experience\",\n      ],\n    },\n    {\n      company: \"XYZ University\",\n      jobTitle: \"Research Assistant\",\n      date: \"Summer 2021\",\n      descriptions: [\n        \"Devised a new NLP algorithm in text classification that results in 10% accuracy increase\",\n        \"Compiled and presented research findings to a group of 20+ faculty and students\",\n      ],\n    },\n  ],\n  educations: [\n    {\n      school: \"XYZ University\",\n      degree: \"Bachelor of Science in Computer Science\",\n      date: \"Sep 2019 - May 2023\",\n      gpa: \"3.8\",\n      descriptions: [\n        \"Won 1st place in 2022 Education Hackathon, 2nd place in 2023 Health Tech Competition\",\n        \"Teaching Assistant for Programming for the Web (2022 - 2023)\",\n        \"Coursework: Object-Oriented Programming (A+), Programming for the Web (A+), Cloud Computing (A), Introduction to Machine Learning (A-), Algorithms Analysis (A-)\",\n      ],\n    },\n  ],\n  projects: [\n    {\n      project: \"OpenResume\",\n      date: \"Spring 2023\",\n      descriptions: [\n        \"Created and launched a free resume builder web app that allows thousands of users to create professional resume easily and land their dream jobs\",\n      ],\n    },\n  ],\n  skills: {\n    featuredSkills: [\n      { skill: \"HTML\", rating: 4 },\n      { skill: \"CSS\", rating: 4 },\n      { skill: \"Python\", rating: 3 },\n      { skill: \"TypeScript\", rating: 3 },\n      { skill: \"React\", rating: 3 },\n      { skill: \"C++\", rating: 2 },\n    ],\n    descriptions: [\n      \"Tech: React Hooks, GraphQL, Node.js, SQL, Postgres, NoSql, Redis, REST API, Git\",\n      \"Soft: Teamwork, Creative Problem Solving, Communication, Learning Mindset, Agile\",\n    ],\n  },\n  custom: {\n    descriptions: [],\n  },\n};\n\nexport const START_HOME_RESUME: Resume = {\n  profile: deepClone(initialProfile),\n  workExperiences: END_HOME_RESUME.workExperiences.map(() =>\n    deepClone(initialWorkExperience)\n  ),\n  educations: [deepClone(initialEducation)],\n  projects: [deepClone(initialProject)],\n  skills: {\n    featuredSkills: END_HOME_RESUME.skills.featuredSkills.map((item) => ({\n      skill: \"\",\n      rating: item.rating,\n    })),\n    descriptions: [],\n  },\n  custom: {\n    descriptions: [],\n  },\n};\n"
  },
  {
    "path": "src/app/layout.tsx",
    "content": "import \"globals.css\";\nimport { TopNavBar } from \"components/TopNavBar\";\nimport { Analytics } from \"@vercel/analytics/react\";\n\nexport const metadata = {\n  title: \"OpenResume - Free Open-source Resume Builder and Parser\",\n  description:\n    \"OpenResume is a free, open-source, and powerful resume builder that allows anyone to create a modern professional resume in 3 simple steps. For those who have an existing resume, OpenResume also provides a resume parser to help test and confirm its ATS readability.\",\n};\n\nexport default function RootLayout({\n  children,\n}: {\n  children: React.ReactNode;\n}) {\n  return (\n    <html lang=\"en\">\n      <body>\n        <TopNavBar />\n        {children}\n        <Analytics />\n      </body>\n    </html>\n  );\n}\n"
  },
  {
    "path": "src/app/lib/__tests__/cx.test.ts",
    "content": "import { cx } from \"lib/cx\";\n\ntest(\"cx\", () => {\n  expect(cx(\"px-1\", \"mt-2\")).toEqual(\"px-1 mt-2\");\n  expect(cx(\"px-1\", true && \"mt-2\")).toEqual(\"px-1 mt-2\");\n  expect(cx(\"px-1\", false && \"mt-2\")).toEqual(\"px-1\");\n});\n"
  },
  {
    "path": "src/app/lib/__tests__/make-object-char-iterator.test.ts",
    "content": "import { makeObjectCharIterator } from \"lib/make-object-char-iterator\";\n\ntest(\"Simple object\", () => {\n  const start = { a: \"\" };\n  const end = { a: \"abc\" };\n  const iterator = makeObjectCharIterator(start, end);\n  expect(iterator.next().value).toEqual({ a: \"a\" });\n  expect(iterator.next().value).toEqual({ a: \"ab\" });\n  expect(iterator.next().value).toEqual({ a: \"abc\" });\n  expect(iterator.next().value).toEqual(undefined);\n});\n\ntest(\"Nested object\", () => {\n  const start = { a: { b: \"\" } };\n  const end = { a: { b: \"abc\" } };\n  const iterator = makeObjectCharIterator(start, end);\n  expect(iterator.next().value).toEqual({ a: { b: \"a\" } });\n  expect(iterator.next().value).toEqual({ a: { b: \"ab\" } });\n  expect(iterator.next().value).toEqual({ a: { b: \"abc\" } });\n  expect(iterator.next().value).toEqual(undefined);\n});\n"
  },
  {
    "path": "src/app/lib/constants.ts",
    "content": "export const PX_PER_PT = 4 / 3;\n\n// Reference: https://www.prepressure.com/library/paper-size/letter\n// Letter size is commonly used in US & Canada, while A4 is the standard for rest of world.\nexport const LETTER_WIDTH_PT = 612;\nconst LETTER_HEIGHT_PT = 792;\nexport const LETTER_WIDTH_PX = LETTER_WIDTH_PT * PX_PER_PT;\nexport const LETTER_HEIGHT_PX = LETTER_HEIGHT_PT * PX_PER_PT;\n\n// Reference: https://www.prepressure.com/library/paper-size/din-a4\nexport const A4_WIDTH_PT = 595;\nconst A4_HEIGHT_PT = 842;\nexport const A4_WIDTH_PX = A4_WIDTH_PT * PX_PER_PT;\nexport const A4_HEIGHT_PX = A4_HEIGHT_PT * PX_PER_PT;\n\nexport const DEBUG_RESUME_PDF_FLAG: true | undefined = undefined; // use undefined to disable to deal with a weird error message\n"
  },
  {
    "path": "src/app/lib/cx.ts",
    "content": "/**\n * cx is a simple util to join classNames together. Think of it as a simplified version of the open source classnames util\n * Reference: https://dev.to/gugaguichard/replace-clsx-classnames-or-classcat-with-your-own-little-helper-3bf\n *\n * @example\n * cx('px-1', 'mt-2'); // => 'px-1 mt-2'\n * cx('px-1', true && 'mt-2'); // => 'px-1 mt-2'\n * cx('px-1', false && 'mt-2'); // => 'px-1'\n */\nexport const cx = (...classes: Array<string | boolean | undefined>) => {\n  const newClasses = [];\n  for (const c of classes) {\n    if (typeof c === \"string\") {\n      newClasses.push(c.trim());\n    }\n  }\n  return newClasses.join(\" \");\n};\n"
  },
  {
    "path": "src/app/lib/deep-clone.ts",
    "content": "/**\n * Server side object deep clone util using JSON serialization.\n * Not efficient for large objects but good enough for most use cases.\n *\n * Client side can simply use structuredClone.\n */\nexport const deepClone = <T extends { [key: string]: any }>(object: T) =>\n  JSON.parse(JSON.stringify(object)) as T;\n"
  },
  {
    "path": "src/app/lib/deep-merge.ts",
    "content": "type Object = { [key: string]: any };\n\nconst isObject = (item: any): item is Object => {\n  return item && typeof item === \"object\" && !Array.isArray(item);\n};\n\n/**\n * Deep merge two objects by overriding target with fields in source.\n * It returns a new object and doesn't modify any object in place since\n * it deep clones the target object first.\n */\nexport const deepMerge = (target: Object, source: Object, level = 0) => {\n  const copyTarget = level === 0 ? structuredClone(target) : target;\n  for (const key in source) {\n    const sourceValue = source[key];\n    // Assign source value to copyTarget if source value is not an object.\n    // Otherwise, call deepMerge recursively to merge all its keys\n    if (!isObject(sourceValue)) {\n      copyTarget[key] = sourceValue;\n    } else {\n      if (!isObject(copyTarget[key])) {\n        copyTarget[key] = {};\n      }\n      deepMerge(copyTarget[key], sourceValue, level + 1);\n    }\n  }\n  return copyTarget;\n};\n"
  },
  {
    "path": "src/app/lib/get-px-per-rem.ts",
    "content": "export const getPxPerRem = () => {\n  const bodyComputedStyle = getComputedStyle(\n    document.querySelector(\"body\")!\n  ) as any;\n  return parseFloat(bodyComputedStyle[\"font-size\"]) || 16;\n};\n"
  },
  {
    "path": "src/app/lib/hooks/useAutosizeTextareaHeight.tsx",
    "content": "import { useEffect, useRef } from \"react\";\n\n/**\n * Hook to autosize textarea height.\n *\n * The trick to resize is to first set its height to 0 and then set it back to scroll height.\n * Reference: https://stackoverflow.com/a/25621277/7699841\n *\n * @example // Tailwind CSS\n * const textareaRef = useAutosizeTextareaHeight({ value });\n * <textarea ref={textareaRef} className=\"resize-none overflow-hidden\"/>\n */\nexport const useAutosizeTextareaHeight = ({ value }: { value: string }) => {\n  const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n  const resizeHeight = () => {\n    const textarea = textareaRef.current;\n    if (textarea) {\n      textarea.style.height = \"0px\";\n      textarea.style.height = `${textarea.scrollHeight}px`;\n    }\n  };\n\n  // Resize height when value changes\n  useEffect(() => {\n    resizeHeight();\n  }, [value]);\n\n  // Resize height when viewport resizes\n  useEffect(() => {\n    window.addEventListener(\"resize\", resizeHeight);\n    return () => window.removeEventListener(\"resize\", resizeHeight);\n  }, []);\n\n  return textareaRef;\n};\n"
  },
  {
    "path": "src/app/lib/hooks/useTailwindBreakpoints.tsx",
    "content": "import { useEffect, useState } from \"react\";\n\nconst enum TailwindBreakpoint {\n  sm = 640,\n  md = 768,\n  lg = 1024,\n  xl = 1280,\n  \"2xl\" = 1536,\n}\n\nexport const useTailwindBreakpoints = () => {\n  const [isSm, setIsSm] = useState(false);\n  const [isMd, setIsMd] = useState(false);\n  const [isLg, setIsLg] = useState(false);\n  const [isXl, setIsXl] = useState(false);\n  const [is2xl, setIs2xl] = useState(false);\n\n  useEffect(() => {\n    const handleResize = () => {\n      const screenWidth = window.innerWidth;\n      setIsSm(screenWidth >= TailwindBreakpoint.sm);\n      setIsMd(screenWidth >= TailwindBreakpoint.md);\n      setIsLg(screenWidth >= TailwindBreakpoint.lg);\n      setIsXl(screenWidth >= TailwindBreakpoint.xl);\n      setIs2xl(screenWidth >= TailwindBreakpoint[\"2xl\"]);\n    };\n    handleResize();\n    window.addEventListener(\"resize\", handleResize);\n    return () => window.removeEventListener(\"resize\", handleResize);\n  }, []);\n\n  return { isSm, isMd, isLg, isXl, is2xl };\n};\n"
  },
  {
    "path": "src/app/lib/make-object-char-iterator.ts",
    "content": "import { deepClone } from \"lib/deep-clone\";\n\ntype Object = { [key: string]: any };\n\n/**\n * makeObjectCharIterator is a generator function that iterates a start object to\n * match an end object state by iterating through each string character.\n *\n * Note: Start object and end object must have the same structure and same keys.\n *       And they must have string or array or object as values.\n *\n * @example\n * const start = {a : \"\"}\n * const end = {a : \"abc\"};\n * const iterator = makeObjectCharIterator(start, end);\n * iterator.next().value // {a : \"a\"}\n * iterator.next().value // {a : \"ab\"}\n * iterator.next().value // {a : \"abc\"}\n */\nexport function* makeObjectCharIterator<T extends Object>(\n  start: T,\n  end: T,\n  level = 0\n) {\n  // Have to manually cast Object type and return T type due to https://github.com/microsoft/TypeScript/issues/47357\n  const object: Object = level === 0 ? deepClone(start) : start;\n  for (const [key, endValue] of Object.entries(end)) {\n    if (typeof endValue === \"object\") {\n      const recursiveIterator = makeObjectCharIterator(\n        object[key],\n        endValue,\n        level + 1\n      );\n      while (true) {\n        const next = recursiveIterator.next();\n        if (next.done) {\n          break;\n        }\n        yield deepClone(object) as T;\n      }\n    } else {\n      for (let i = 1; i <= endValue.length; i++) {\n        object[key] = endValue.slice(0, i);\n        yield deepClone(object) as T;\n      }\n    }\n  }\n}\n\nexport const countObjectChar = (object: Object) => {\n  let count = 0;\n  for (const value of Object.values(object)) {\n    if (typeof value === \"object\") {\n      count += countObjectChar(value);\n    } else if (typeof value === \"string\") {\n      count += value.length;\n    }\n  }\n  return count;\n};\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/extract-resume-from-sections/extract-education.ts",
    "content": "import type {\n  TextItem,\n  FeatureSet,\n  ResumeSectionToLines,\n} from \"lib/parse-resume-from-pdf/types\";\nimport type { ResumeEducation } from \"lib/redux/types\";\nimport { getSectionLinesByKeywords } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/get-section-lines\";\nimport { divideSectionIntoSubsections } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/subsections\";\nimport {\n  DATE_FEATURE_SETS,\n  hasComma,\n  hasLetter,\n  hasNumber,\n} from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/common-features\";\nimport { getTextWithHighestFeatureScore } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/feature-scoring-system\";\nimport {\n  getBulletPointsFromLines,\n  getDescriptionsLineIdx,\n} from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/bullet-points\";\n\n/**\n *              Unique Attribute\n * School       Has school\n * Degree       Has degree\n * GPA          Has number\n */\n\n// prettier-ignore\nconst SCHOOLS = ['College', 'University', 'Institute', 'School', 'Academy', 'BASIS', 'Magnet']\nconst hasSchool = (item: TextItem) =>\n  SCHOOLS.some((school) => item.text.includes(school));\n// prettier-ignore\nconst DEGREES = [\"Associate\", \"Bachelor\", \"Master\", \"PhD\", \"Ph.\"];\nconst hasDegree = (item: TextItem) =>\n  DEGREES.some((degree) => item.text.includes(degree)) ||\n  /[ABM][A-Z\\.]/.test(item.text); // Match AA, B.S., MBA, etc.\nconst matchGPA = (item: TextItem) => item.text.match(/[0-4]\\.\\d{1,2}/);\nconst matchGrade = (item: TextItem) => {\n  const grade = parseFloat(item.text);\n  if (Number.isFinite(grade) && grade <= 110) {\n    return [String(grade)] as RegExpMatchArray;\n  }\n  return null;\n};\n\nconst SCHOOL_FEATURE_SETS: FeatureSet[] = [\n  [hasSchool, 4],\n  [hasDegree, -4],\n  [hasNumber, -4],\n];\n\nconst DEGREE_FEATURE_SETS: FeatureSet[] = [\n  [hasDegree, 4],\n  [hasSchool, -4],\n  [hasNumber, -3],\n];\n\nconst GPA_FEATURE_SETS: FeatureSet[] = [\n  [matchGPA, 4, true],\n  [matchGrade, 3, true],\n  [hasComma, -3],\n  [hasLetter, -4],\n];\n\nexport const extractEducation = (sections: ResumeSectionToLines) => {\n  const educations: ResumeEducation[] = [];\n  const educationsScores = [];\n  const lines = getSectionLinesByKeywords(sections, [\"education\"]);\n  const subsections = divideSectionIntoSubsections(lines);\n  for (const subsectionLines of subsections) {\n    const textItems = subsectionLines.flat();\n    const [school, schoolScores] = getTextWithHighestFeatureScore(\n      textItems,\n      SCHOOL_FEATURE_SETS\n    );\n    const [degree, degreeScores] = getTextWithHighestFeatureScore(\n      textItems,\n      DEGREE_FEATURE_SETS\n    );\n    const [gpa, gpaScores] = getTextWithHighestFeatureScore(\n      textItems,\n      GPA_FEATURE_SETS\n    );\n    const [date, dateScores] = getTextWithHighestFeatureScore(\n      textItems,\n      DATE_FEATURE_SETS\n    );\n\n    let descriptions: string[] = [];\n    const descriptionsLineIdx = getDescriptionsLineIdx(subsectionLines);\n    if (descriptionsLineIdx !== undefined) {\n      const descriptionsLines = subsectionLines.slice(descriptionsLineIdx);\n      descriptions = getBulletPointsFromLines(descriptionsLines);\n    }\n\n    educations.push({ school, degree, gpa, date, descriptions });\n    educationsScores.push({\n      schoolScores,\n      degreeScores,\n      gpaScores,\n      dateScores,\n    });\n  }\n\n  if (educations.length !== 0) {\n    const coursesLines = getSectionLinesByKeywords(sections, [\"course\"]);\n    if (coursesLines.length !== 0) {\n      educations[0].descriptions.push(\n        \"Courses: \" +\n          coursesLines\n            .flat()\n            .map((item) => item.text)\n            .join(\" \")\n      );\n    }\n  }\n\n  return {\n    educations,\n    educationsScores,\n  };\n};\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/extract-resume-from-sections/extract-profile.ts",
    "content": "import type {\n  ResumeSectionToLines,\n  TextItem,\n  FeatureSet,\n} from \"lib/parse-resume-from-pdf/types\";\nimport { getSectionLinesByKeywords } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/get-section-lines\";\nimport {\n  isBold,\n  hasNumber,\n  hasComma,\n  hasLetter,\n  hasLetterAndIsAllUpperCase,\n} from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/common-features\";\nimport { getTextWithHighestFeatureScore } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/feature-scoring-system\";\n\n// Name\nexport const matchOnlyLetterSpaceOrPeriod = (item: TextItem) =>\n  item.text.match(/^[a-zA-Z\\s\\.]+$/);\n\n// Email\n// Simple email regex: xxx@xxx.xxx (xxx = anything not space)\nexport const matchEmail = (item: TextItem) => item.text.match(/\\S+@\\S+\\.\\S+/);\nconst hasAt = (item: TextItem) => item.text.includes(\"@\");\n\n// Phone\n// Simple phone regex that matches (xxx)-xxx-xxxx where () and - are optional, - can also be space\nexport const matchPhone = (item: TextItem) =>\n  item.text.match(/\\(?\\d{3}\\)?[\\s-]?\\d{3}[\\s-]?\\d{4}/);\nconst hasParenthesis = (item: TextItem) => /\\([0-9]+\\)/.test(item.text);\n\n// Location\n// Simple location regex that matches \"<City>, <ST>\"\nexport const matchCityAndState = (item: TextItem) =>\n  item.text.match(/[A-Z][a-zA-Z\\s]+, [A-Z]{2}/);\n\n// Url\n// Simple url regex that matches \"xxx.xxx/xxx\" (xxx = anything not space)\nexport const matchUrl = (item: TextItem) => item.text.match(/\\S+\\.[a-z]+\\/\\S+/);\n// Match https://xxx.xxx where s is optional\nconst matchUrlHttpFallback = (item: TextItem) =>\n  item.text.match(/https?:\\/\\/\\S+\\.\\S+/);\n// Match www.xxx.xxx\nconst matchUrlWwwFallback = (item: TextItem) =>\n  item.text.match(/www\\.\\S+\\.\\S+/);\nconst hasSlash = (item: TextItem) => item.text.includes(\"/\");\n\n// Summary\nconst has4OrMoreWords = (item: TextItem) => item.text.split(\" \").length >= 4;\n\n/**\n *              Unique Attribute\n * Name         Bold or Has all uppercase letter\n * Email        Has @\n * Phone        Has ()\n * Location     Has ,    (overlap with summary)\n * Url          Has slash\n * Summary      Has 4 or more words\n */\n\n/**\n * Name -> contains only letters/space/period, e.g. Leonardo W. DiCaprio\n *         (it isn't common to include middle initial in resume)\n *      -> is bolded or has all letters as uppercase\n */\nconst NAME_FEATURE_SETS: FeatureSet[] = [\n  [matchOnlyLetterSpaceOrPeriod, 3, true],\n  [isBold, 2],\n  [hasLetterAndIsAllUpperCase, 2],\n  // Match against other unique attributes\n  [hasAt, -4], // Email\n  [hasNumber, -4], // Phone\n  [hasParenthesis, -4], // Phone\n  [hasComma, -4], // Location\n  [hasSlash, -4], // Url\n  [has4OrMoreWords, -2], // Summary\n];\n\n// Email -> match email regex xxx@xxx.xxx\nconst EMAIL_FEATURE_SETS: FeatureSet[] = [\n  [matchEmail, 4, true],\n  [isBold, -1], // Name\n  [hasLetterAndIsAllUpperCase, -1], // Name\n  [hasParenthesis, -4], // Phone\n  [hasComma, -4], // Location\n  [hasSlash, -4], // Url\n  [has4OrMoreWords, -4], // Summary\n];\n\n// Phone -> match phone regex (xxx)-xxx-xxxx\nconst PHONE_FEATURE_SETS: FeatureSet[] = [\n  [matchPhone, 4, true],\n  [hasLetter, -4], // Name, Email, Location, Url, Summary\n];\n\n// Location -> match location regex <City>, <ST>\nconst LOCATION_FEATURE_SETS: FeatureSet[] = [\n  [matchCityAndState, 4, true],\n  [isBold, -1], // Name\n  [hasAt, -4], // Email\n  [hasParenthesis, -3], // Phone\n  [hasSlash, -4], // Url\n];\n\n// URL -> match url regex xxx.xxx/xxx\nconst URL_FEATURE_SETS: FeatureSet[] = [\n  [matchUrl, 4, true],\n  [matchUrlHttpFallback, 3, true],\n  [matchUrlWwwFallback, 3, true],\n  [isBold, -1], // Name\n  [hasAt, -4], // Email\n  [hasParenthesis, -3], // Phone\n  [hasComma, -4], // Location\n  [has4OrMoreWords, -4], // Summary\n];\n\n// Summary -> has 4 or more words\nconst SUMMARY_FEATURE_SETS: FeatureSet[] = [\n  [has4OrMoreWords, 4],\n  [isBold, -1], // Name\n  [hasAt, -4], // Email\n  [hasParenthesis, -3], // Phone\n  [matchCityAndState, -4, false], // Location\n];\n\nexport const extractProfile = (sections: ResumeSectionToLines) => {\n  const lines = sections.profile || [];\n  const textItems = lines.flat();\n\n  const [name, nameScores] = getTextWithHighestFeatureScore(\n    textItems,\n    NAME_FEATURE_SETS\n  );\n  const [email, emailScores] = getTextWithHighestFeatureScore(\n    textItems,\n    EMAIL_FEATURE_SETS\n  );\n  const [phone, phoneScores] = getTextWithHighestFeatureScore(\n    textItems,\n    PHONE_FEATURE_SETS\n  );\n  const [location, locationScores] = getTextWithHighestFeatureScore(\n    textItems,\n    LOCATION_FEATURE_SETS\n  );\n  const [url, urlScores] = getTextWithHighestFeatureScore(\n    textItems,\n    URL_FEATURE_SETS\n  );\n  const [summary, summaryScores] = getTextWithHighestFeatureScore(\n    textItems,\n    SUMMARY_FEATURE_SETS,\n    undefined,\n    true\n  );\n\n  const summaryLines = getSectionLinesByKeywords(sections, [\"summary\"]);\n  const summarySection = summaryLines\n    .flat()\n    .map((textItem) => textItem.text)\n    .join(\" \");\n  const objectiveLines = getSectionLinesByKeywords(sections, [\"objective\"]);\n  const objectiveSection = objectiveLines\n    .flat()\n    .map((textItem) => textItem.text)\n    .join(\" \");\n\n  return {\n    profile: {\n      name,\n      email,\n      phone,\n      location,\n      url,\n      // Dedicated section takes higher precedence over profile summary\n      summary: summarySection || objectiveSection || summary,\n    },\n    // For debugging\n    profileScores: {\n      name: nameScores,\n      email: emailScores,\n      phone: phoneScores,\n      location: locationScores,\n      url: urlScores,\n      summary: summaryScores,\n    },\n  };\n};\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/extract-resume-from-sections/extract-project.ts",
    "content": "import type { ResumeProject } from \"lib/redux/types\";\nimport type {\n  FeatureSet,\n  ResumeSectionToLines,\n} from \"lib/parse-resume-from-pdf/types\";\nimport { getSectionLinesByKeywords } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/get-section-lines\";\nimport {\n  DATE_FEATURE_SETS,\n  getHasText,\n  isBold,\n} from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/common-features\";\nimport { divideSectionIntoSubsections } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/subsections\";\nimport { getTextWithHighestFeatureScore } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/feature-scoring-system\";\nimport {\n  getBulletPointsFromLines,\n  getDescriptionsLineIdx,\n} from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/bullet-points\";\n\nexport const extractProject = (sections: ResumeSectionToLines) => {\n  const projects: ResumeProject[] = [];\n  const projectsScores = [];\n  const lines = getSectionLinesByKeywords(sections, [\"project\"]);\n  const subsections = divideSectionIntoSubsections(lines);\n\n  for (const subsectionLines of subsections) {\n    const descriptionsLineIdx = getDescriptionsLineIdx(subsectionLines) ?? 1;\n\n    const subsectionInfoTextItems = subsectionLines\n      .slice(0, descriptionsLineIdx)\n      .flat();\n    const [date, dateScores] = getTextWithHighestFeatureScore(\n      subsectionInfoTextItems,\n      DATE_FEATURE_SETS\n    );\n    const PROJECT_FEATURE_SET: FeatureSet[] = [\n      [isBold, 2],\n      [getHasText(date), -4],\n    ];\n    const [project, projectScores] = getTextWithHighestFeatureScore(\n      subsectionInfoTextItems,\n      PROJECT_FEATURE_SET,\n      false\n    );\n\n    const descriptionsLines = subsectionLines.slice(descriptionsLineIdx);\n    const descriptions = getBulletPointsFromLines(descriptionsLines);\n\n    projects.push({ project, date, descriptions });\n    projectsScores.push({\n      projectScores,\n      dateScores,\n    });\n  }\n  return { projects, projectsScores };\n};\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/extract-resume-from-sections/extract-resume-from-sections.test.ts",
    "content": "import {\n  matchOnlyLetterSpaceOrPeriod,\n  matchEmail,\n  matchPhone,\n  matchUrl,\n} from \"lib/parse-resume-from-pdf/extract-resume-from-sections/extract-profile\";\nimport type { TextItem } from \"lib/parse-resume-from-pdf/types\";\n\nconst makeTextItem = (text: string) =>\n  ({\n    text,\n  } as TextItem);\n\ndescribe(\"extract-profile tests - \", () => {\n  it(\"Name\", () => {\n    expect(\n      matchOnlyLetterSpaceOrPeriod(makeTextItem(\"Leonardo W. DiCaprio\"))![0]\n    ).toBe(\"Leonardo W. DiCaprio\");\n  });\n\n  it(\"Email\", () => {\n    expect(matchEmail(makeTextItem(\"  hello@open-resume.org  \"))![0]).toBe(\n      \"hello@open-resume.org\"\n    );\n  });\n\n  it(\"Phone\", () => {\n    expect(matchPhone(makeTextItem(\"  (123)456-7890  \"))![0]).toBe(\n      \"(123)456-7890\"\n    );\n  });\n\n  it(\"Url\", () => {\n    expect(matchUrl(makeTextItem(\"  linkedin.com/in/open-resume  \"))![0]).toBe(\n      \"linkedin.com/in/open-resume\"\n    );\n    expect(matchUrl(makeTextItem(\"hello@open-resume.org\"))).toBeFalsy();\n  });\n});\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/extract-resume-from-sections/extract-skills.ts",
    "content": "import type { ResumeSkills } from \"lib/redux/types\";\nimport type { ResumeSectionToLines } from \"lib/parse-resume-from-pdf/types\";\nimport { deepClone } from \"lib/deep-clone\";\nimport { getSectionLinesByKeywords } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/get-section-lines\";\nimport { initialFeaturedSkills } from \"lib/redux/resumeSlice\";\nimport {\n  getBulletPointsFromLines,\n  getDescriptionsLineIdx,\n} from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/bullet-points\";\n\nexport const extractSkills = (sections: ResumeSectionToLines) => {\n  const lines = getSectionLinesByKeywords(sections, [\"skill\"]);\n  const descriptionsLineIdx = getDescriptionsLineIdx(lines) ?? 0;\n  const descriptionsLines = lines.slice(descriptionsLineIdx);\n  const descriptions = getBulletPointsFromLines(descriptionsLines);\n\n  const featuredSkills = deepClone(initialFeaturedSkills);\n  if (descriptionsLineIdx !== 0) {\n    const featuredSkillsLines = lines.slice(0, descriptionsLineIdx);\n    const featuredSkillsTextItems = featuredSkillsLines\n      .flat()\n      .filter((item) => item.text.trim())\n      .slice(0, 6);\n    for (let i = 0; i < featuredSkillsTextItems.length; i++) {\n      featuredSkills[i].skill = featuredSkillsTextItems[i].text;\n    }\n  }\n\n  const skills: ResumeSkills = {\n    featuredSkills,\n    descriptions,\n  };\n\n  return { skills };\n};\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/extract-resume-from-sections/extract-work-experience.ts",
    "content": "import type { ResumeWorkExperience } from \"lib/redux/types\";\nimport type {\n  TextItem,\n  FeatureSet,\n  ResumeSectionToLines,\n} from \"lib/parse-resume-from-pdf/types\";\nimport { getSectionLinesByKeywords } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/get-section-lines\";\nimport {\n  DATE_FEATURE_SETS,\n  hasNumber,\n  getHasText,\n  isBold,\n} from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/common-features\";\nimport { divideSectionIntoSubsections } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/subsections\";\nimport { getTextWithHighestFeatureScore } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/feature-scoring-system\";\nimport {\n  getBulletPointsFromLines,\n  getDescriptionsLineIdx,\n} from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/bullet-points\";\n\n// prettier-ignore\nconst WORK_EXPERIENCE_KEYWORDS_LOWERCASE = ['work', 'experience', 'employment', 'history', 'job'];\n// prettier-ignore\nconst JOB_TITLES = ['Accountant', 'Administrator', 'Advisor', 'Agent', 'Analyst', 'Apprentice', 'Architect', 'Assistant', 'Associate', 'Auditor', 'Bartender', 'Biologist', 'Bookkeeper', 'Buyer', 'Carpenter', 'Cashier', 'CEO', 'Clerk', 'Co-op', 'Co-Founder', 'Consultant', 'Coordinator', 'CTO', 'Developer', 'Designer', 'Director', 'Driver', 'Editor', 'Electrician', 'Engineer', 'Extern', 'Founder', 'Freelancer', 'Head', 'Intern', 'Janitor', 'Journalist', 'Laborer', 'Lawyer', 'Lead', 'Manager', 'Mechanic', 'Member', 'Nurse', 'Officer', 'Operator', 'Operation', 'Photographer', 'President', 'Producer', 'Recruiter', 'Representative', 'Researcher', 'Sales', 'Server', 'Scientist', 'Specialist', 'Supervisor', 'Teacher', 'Technician', 'Trader', 'Trainee', 'Treasurer', 'Tutor', 'Vice', 'VP', 'Volunteer', 'Webmaster', 'Worker'];\n\nconst hasJobTitle = (item: TextItem) =>\n  JOB_TITLES.some((jobTitle) =>\n    item.text.split(/\\s/).some((word) => word === jobTitle)\n  );\nconst hasMoreThan5Words = (item: TextItem) => item.text.split(/\\s/).length > 5;\nconst JOB_TITLE_FEATURE_SET: FeatureSet[] = [\n  [hasJobTitle, 4],\n  [hasNumber, -4],\n  [hasMoreThan5Words, -2],\n];\n\nexport const extractWorkExperience = (sections: ResumeSectionToLines) => {\n  const workExperiences: ResumeWorkExperience[] = [];\n  const workExperiencesScores = [];\n  const lines = getSectionLinesByKeywords(\n    sections,\n    WORK_EXPERIENCE_KEYWORDS_LOWERCASE\n  );\n  const subsections = divideSectionIntoSubsections(lines);\n\n  for (const subsectionLines of subsections) {\n    const descriptionsLineIdx = getDescriptionsLineIdx(subsectionLines) ?? 2;\n\n    const subsectionInfoTextItems = subsectionLines\n      .slice(0, descriptionsLineIdx)\n      .flat();\n    const [date, dateScores] = getTextWithHighestFeatureScore(\n      subsectionInfoTextItems,\n      DATE_FEATURE_SETS\n    );\n    const [jobTitle, jobTitleScores] = getTextWithHighestFeatureScore(\n      subsectionInfoTextItems,\n      JOB_TITLE_FEATURE_SET\n    );\n    const COMPANY_FEATURE_SET: FeatureSet[] = [\n      [isBold, 2],\n      [getHasText(date), -4],\n      [getHasText(jobTitle), -4],\n    ];\n    const [company, companyScores] = getTextWithHighestFeatureScore(\n      subsectionInfoTextItems,\n      COMPANY_FEATURE_SET,\n      false\n    );\n\n    const subsectionDescriptionsLines =\n      subsectionLines.slice(descriptionsLineIdx);\n    const descriptions = getBulletPointsFromLines(subsectionDescriptionsLines);\n\n    workExperiences.push({ company, jobTitle, date, descriptions });\n    workExperiencesScores.push({\n      companyScores,\n      jobTitleScores,\n      dateScores,\n    });\n  }\n  return { workExperiences, workExperiencesScores };\n};\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/extract-resume-from-sections/index.ts",
    "content": "import type { Resume } from \"lib/redux/types\";\nimport type { ResumeSectionToLines } from \"lib/parse-resume-from-pdf/types\";\nimport { extractProfile } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/extract-profile\";\nimport { extractEducation } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/extract-education\";\nimport { extractWorkExperience } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/extract-work-experience\";\nimport { extractProject } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/extract-project\";\nimport { extractSkills } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/extract-skills\";\n\n/**\n * Step 4. Extract resume from sections.\n *\n * This is the core of the resume parser to resume information from the sections.\n *\n * The gist of the extraction engine is a feature scoring system. Each resume attribute\n * to be extracted has a custom feature sets, where each feature set consists of a\n * feature matching function and a feature matching score if matched (feature matching\n * score can be a positive or negative number). To compute the final feature score of\n * a text item for a particular resume attribute, it would run the text item through\n * all its feature sets and sum up the matching feature scores. This process is carried\n * out for all text items within the section, and the text item with the highest computed\n * feature score is identified as the extracted resume attribute.\n */\nexport const extractResumeFromSections = (\n  sections: ResumeSectionToLines\n): Resume => {\n  const { profile } = extractProfile(sections);\n  const { educations } = extractEducation(sections);\n  const { workExperiences } = extractWorkExperience(sections);\n  const { projects } = extractProject(sections);\n  const { skills } = extractSkills(sections);\n\n  return {\n    profile,\n    educations,\n    workExperiences,\n    projects,\n    skills,\n    custom: {\n      descriptions: [],\n    },\n  };\n};\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/extract-resume-from-sections/lib/bullet-points.ts",
    "content": "import type { Lines, TextItem } from \"lib/parse-resume-from-pdf/types\";\n\n/**\n * List of bullet points\n * Reference: https://stackoverflow.com/questions/56540160/why-isnt-there-a-medium-small-black-circle-in-unicode\n * U+22C5   DOT OPERATOR (⋅)\n * U+2219   BULLET OPERATOR (∙)\n * U+1F784  BLACK SLIGHTLY SMALL CIRCLE (🞄)\n * U+2022   BULLET (•) -------- most common\n * U+2981   Z NOTATION SPOT (⦁)\n * U+26AB   MEDIUM BLACK CIRCLE (⚫︎)\n * U+25CF   BLACK CIRCLE (●)\n * U+2B24   BLACK LARGE CIRCLE (⬤)\n * U+26AC   MEDIUM SMALL WHITE CIRCLE ⚬\n * U+25CB   WHITE CIRCLE ○\n */\nexport const BULLET_POINTS = [\n  \"⋅\",\n  \"∙\",\n  \"🞄\",\n  \"•\",\n  \"⦁\",\n  \"⚫︎\",\n  \"●\",\n  \"⬤\",\n  \"⚬\",\n  \"○\",\n];\n\n/**\n * Convert bullet point lines into a string array aka descriptions.\n */\nexport const getBulletPointsFromLines = (lines: Lines): string[] => {\n  // Simply return all lines with text item joined together if there is no bullet point\n  const firstBulletPointLineIndex = getFirstBulletPointLineIdx(lines);\n  if (firstBulletPointLineIndex === undefined) {\n    return lines.map((line) => line.map((item) => item.text).join(\" \"));\n  }\n\n  // Otherwise, process and remove bullet points\n\n  // Combine all lines into a single string\n  let lineStr = \"\";\n  for (let item of lines.flat()) {\n    const text = item.text;\n    // Make sure a space is added between 2 words\n    if (!lineStr.endsWith(\" \") && !text.startsWith(\" \")) {\n      lineStr += \" \";\n    }\n    lineStr += text;\n  }\n\n  // Get the most common bullet point\n  const commonBulletPoint = getMostCommonBulletPoint(lineStr);\n\n  // Start line string from the beginning of the first bullet point\n  const firstBulletPointIndex = lineStr.indexOf(commonBulletPoint);\n  if (firstBulletPointIndex !== -1) {\n    lineStr = lineStr.slice(firstBulletPointIndex);\n  }\n\n  // Divide the single string using bullet point as divider\n  return lineStr\n    .split(commonBulletPoint)\n    .map((text) => text.trim())\n    .filter((text) => !!text);\n};\n\nconst getMostCommonBulletPoint = (str: string): string => {\n  const bulletToCount: { [bullet: string]: number } = BULLET_POINTS.reduce(\n    (acc: { [bullet: string]: number }, cur) => {\n      acc[cur] = 0;\n      return acc;\n    },\n    {}\n  );\n  let bulletWithMostCount = BULLET_POINTS[0];\n  let bulletMaxCount = 0;\n  for (let char of str) {\n    if (bulletToCount.hasOwnProperty(char)) {\n      bulletToCount[char]++;\n      if (bulletToCount[char] > bulletMaxCount) {\n        bulletWithMostCount = char;\n      }\n    }\n  }\n  return bulletWithMostCount;\n};\n\nconst getFirstBulletPointLineIdx = (lines: Lines): number | undefined => {\n  for (let i = 0; i < lines.length; i++) {\n    for (let item of lines[i]) {\n      if (BULLET_POINTS.some((bullet) => item.text.includes(bullet))) {\n        return i;\n      }\n    }\n  }\n  return undefined;\n};\n\n// Only consider words that don't contain numbers\nconst isWord = (str: string) => /^[^0-9]+$/.test(str);\nconst hasAtLeast8Words = (item: TextItem) =>\n  item.text.split(/\\s/).filter(isWord).length >= 8;\n\nexport const getDescriptionsLineIdx = (lines: Lines): number | undefined => {\n  // The main heuristic to determine descriptions is to check if has bullet point\n  let idx = getFirstBulletPointLineIdx(lines);\n\n  // Fallback heuristic if the main heuristic doesn't apply (e.g. LinkedIn resume) to\n  // check if the line has at least 8 words\n  if (idx === undefined) {\n    for (let i = 0; i < lines.length; i++) {\n      const line = lines[i];\n      if (line.length === 1 && hasAtLeast8Words(line[0])) {\n        idx = i;\n        break;\n      }\n    }\n  }\n\n  return idx;\n};\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/extract-resume-from-sections/lib/common-features.ts",
    "content": "import type { TextItem, FeatureSet } from \"lib/parse-resume-from-pdf/types\";\n\nconst isTextItemBold = (fontName: string) =>\n  fontName.toLowerCase().includes(\"bold\");\nexport const isBold = (item: TextItem) => isTextItemBold(item.fontName);\nexport const hasLetter = (item: TextItem) => /[a-zA-Z]/.test(item.text);\nexport const hasNumber = (item: TextItem) => /[0-9]/.test(item.text);\nexport const hasComma = (item: TextItem) => item.text.includes(\",\");\nexport const getHasText = (text: string) => (item: TextItem) =>\n  item.text.includes(text);\nexport const hasOnlyLettersSpacesAmpersands = (item: TextItem) =>\n  /^[A-Za-z\\s&]+$/.test(item.text);\nexport const hasLetterAndIsAllUpperCase = (item: TextItem) =>\n  hasLetter(item) && item.text.toUpperCase() === item.text;\n\n// Date Features\nconst hasYear = (item: TextItem) => /(?:19|20)\\d{2}/.test(item.text);\n// prettier-ignore\nconst MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\nconst hasMonth = (item: TextItem) =>\n  MONTHS.some(\n    (month) =>\n      item.text.includes(month) || item.text.includes(month.slice(0, 4))\n  );\nconst SEASONS = [\"Summer\", \"Fall\", \"Spring\", \"Winter\"];\nconst hasSeason = (item: TextItem) =>\n  SEASONS.some((season) => item.text.includes(season));\nconst hasPresent = (item: TextItem) => item.text.includes(\"Present\");\nexport const DATE_FEATURE_SETS: FeatureSet[] = [\n  [hasYear, 1],\n  [hasMonth, 1],\n  [hasSeason, 1],\n  [hasPresent, 1],\n  [hasComma, -1],\n];\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/extract-resume-from-sections/lib/feature-scoring-system.ts",
    "content": "import type {\n  TextItems,\n  TextScores,\n  FeatureSet,\n} from \"lib/parse-resume-from-pdf/types\";\n\nconst computeFeatureScores = (\n  textItems: TextItems,\n  featureSets: FeatureSet[]\n): TextScores => {\n  const textScores = textItems.map((item) => ({\n    text: item.text,\n    score: 0,\n    match: false,\n  }));\n\n  for (let i = 0; i < textItems.length; i++) {\n    const textItem = textItems[i];\n\n    for (const featureSet of featureSets) {\n      const [hasFeature, score, returnMatchingText] = featureSet;\n      const result = hasFeature(textItem);\n      if (result) {\n        let text = textItem.text;\n        if (returnMatchingText && typeof result === \"object\") {\n          text = result[0];\n        }\n\n        const textScore = textScores[i];\n        if (textItem.text === text) {\n          textScore.score += score;\n          if (returnMatchingText) {\n            textScore.match = true;\n          }\n        } else {\n          textScores.push({ text, score, match: true });\n        }\n      }\n    }\n  }\n  return textScores;\n};\n\n/**\n * Core util for the feature scoring system.\n *\n * It runs each text item through all feature sets and sums up the matching feature scores.\n * It then returns the text item with the highest computed feature score.\n */\nexport const getTextWithHighestFeatureScore = (\n  textItems: TextItems,\n  featureSets: FeatureSet[],\n  returnEmptyStringIfHighestScoreIsNotPositive = true,\n  returnConcatenatedStringForTextsWithSameHighestScore = false\n) => {\n  const textScores = computeFeatureScores(textItems, featureSets);\n\n  let textsWithHighestFeatureScore: string[] = [];\n  let highestScore = -Infinity;\n  for (const { text, score } of textScores) {\n    if (score >= highestScore) {\n      if (score > highestScore) {\n        textsWithHighestFeatureScore = [];\n      }\n      textsWithHighestFeatureScore.push(text);\n      highestScore = score;\n    }\n  }\n\n  if (returnEmptyStringIfHighestScoreIsNotPositive && highestScore <= 0)\n    return [\"\", textScores] as const;\n\n  // Note: If textItems is an empty array, textsWithHighestFeatureScore[0] is undefined, so we default it to empty string\n  const text = !returnConcatenatedStringForTextsWithSameHighestScore\n    ? textsWithHighestFeatureScore[0] ?? \"\"\n    : textsWithHighestFeatureScore.map((s) => s.trim()).join(\" \");\n\n  return [text, textScores] as const;\n};\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/extract-resume-from-sections/lib/get-section-lines.ts",
    "content": "import type { ResumeSectionToLines } from \"lib/parse-resume-from-pdf/types\";\n\n/**\n * Return section lines that contain any of the keywords.\n */\nexport const getSectionLinesByKeywords = (\n  sections: ResumeSectionToLines,\n  keywords: string[]\n) => {\n  for (const sectionName in sections) {\n    const hasKeyWord = keywords.some((keyword) =>\n      sectionName.toLowerCase().includes(keyword)\n    );\n    if (hasKeyWord) {\n      return sections[sectionName];\n    }\n  }\n  return [];\n};\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/extract-resume-from-sections/lib/subsections.ts",
    "content": "import { BULLET_POINTS } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/bullet-points\";\nimport { isBold } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/common-features\";\nimport type { Lines, Line, Subsections } from \"lib/parse-resume-from-pdf/types\";\n\n/**\n * Divide lines into subsections based on difference in line gap or bold text.\n *\n * For profile section, we can directly pass all the text items to the feature\n * scoring systems. But for other sections, such as education and work experience,\n * we have to first divide the section into subsections since there can be multiple\n * schools or work experiences in the section. The feature scoring system then\n * process each subsection to retrieve each's resume attributes and append the results.\n */\nexport const divideSectionIntoSubsections = (lines: Lines): Subsections => {\n  // The main heuristic to determine a subsection is to check if its vertical line gap\n  // is larger than the typical line gap * 1.4\n  const isLineNewSubsectionByLineGap =\n    createIsLineNewSubsectionByLineGap(lines);\n\n  let subsections = createSubsections(lines, isLineNewSubsectionByLineGap);\n\n  // Fallback heuristic if the main heuristic doesn't apply to check if the text item is bolded\n  if (subsections.length === 1) {\n    const isLineNewSubsectionByBold = (line: Line, prevLine: Line) => {\n      if (\n        !isBold(prevLine[0]) &&\n        isBold(line[0]) &&\n        // Ignore bullet points that sometimes being marked as bolded\n        !BULLET_POINTS.includes(line[0].text)\n      ) {\n        return true;\n      }\n      return false;\n    };\n\n    subsections = createSubsections(lines, isLineNewSubsectionByBold);\n  }\n\n  return subsections;\n};\n\ntype IsLineNewSubsection = (line: Line, prevLine: Line) => boolean;\n\nconst createIsLineNewSubsectionByLineGap = (\n  lines: Lines\n): IsLineNewSubsection => {\n  // Extract the common typical line gap\n  const lineGapToCount: { [lineGap: number]: number } = {};\n  const linesY = lines.map((line) => line[0].y);\n  let lineGapWithMostCount: number = 0;\n  let maxCount = 0;\n  for (let i = 1; i < linesY.length; i++) {\n    const lineGap = Math.round(linesY[i - 1] - linesY[i]);\n    if (!lineGapToCount[lineGap]) lineGapToCount[lineGap] = 0;\n    lineGapToCount[lineGap] += 1;\n    if (lineGapToCount[lineGap] > maxCount) {\n      lineGapWithMostCount = lineGap;\n      maxCount = lineGapToCount[lineGap];\n    }\n  }\n  // Use common line gap to set a sub section threshold\n  const subsectionLineGapThreshold = lineGapWithMostCount * 1.4;\n\n  const isLineNewSubsection = (line: Line, prevLine: Line) => {\n    return Math.round(prevLine[0].y - line[0].y) > subsectionLineGapThreshold;\n  };\n\n  return isLineNewSubsection;\n};\n\nconst createSubsections = (\n  lines: Lines,\n  isLineNewSubsection: IsLineNewSubsection\n): Subsections => {\n  const subsections: Subsections = [];\n  let subsection: Lines = [];\n  for (let i = 0; i < lines.length; i++) {\n    const line = lines[i];\n    if (i === 0) {\n      subsection.push(line);\n      continue;\n    }\n    if (isLineNewSubsection(line, lines[i - 1])) {\n      subsections.push(subsection);\n      subsection = [];\n    }\n    subsection.push(line);\n  }\n  if (subsection.length > 0) {\n    subsections.push(subsection);\n  }\n  return subsections;\n};\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/group-lines-into-sections.ts",
    "content": "import type { ResumeKey } from \"lib/redux/types\";\nimport type {\n  Line,\n  Lines,\n  ResumeSectionToLines,\n} from \"lib/parse-resume-from-pdf/types\";\nimport {\n  hasLetterAndIsAllUpperCase,\n  hasOnlyLettersSpacesAmpersands,\n  isBold,\n} from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/common-features\";\n\nexport const PROFILE_SECTION: ResumeKey = \"profile\";\n\n/**\n * Step 3. Group lines into sections\n *\n * Every section (except the profile section) starts with a section title that\n * takes up the entire line. This is a common pattern not just in resumes but\n * also in books and blogs. The resume parser uses this pattern to group lines\n * into the closest section title above these lines.\n */\nexport const groupLinesIntoSections = (lines: Lines) => {\n  let sections: ResumeSectionToLines = {};\n  let sectionName: string = PROFILE_SECTION;\n  let sectionLines = [];\n  for (let i = 0; i < lines.length; i++) {\n    const line = lines[i];\n    const text = line[0]?.text.trim();\n    if (isSectionTitle(line, i)) {\n      sections[sectionName] = [...sectionLines];\n      sectionName = text;\n      sectionLines = [];\n    } else {\n      sectionLines.push(line);\n    }\n  }\n  if (sectionLines.length > 0) {\n    sections[sectionName] = [...sectionLines];\n  }\n  return sections;\n};\n\nconst SECTION_TITLE_PRIMARY_KEYWORDS = [\n  \"experience\",\n  \"education\",\n  \"project\",\n  \"skill\",\n];\nconst SECTION_TITLE_SECONDARY_KEYWORDS = [\n  \"job\",\n  \"course\",\n  \"extracurricular\",\n  \"objective\",\n  \"summary\", // LinkedIn generated resume has a summary section\n  \"award\",\n  \"honor\",\n  \"project\",\n];\nconst SECTION_TITLE_KEYWORDS = [\n  ...SECTION_TITLE_PRIMARY_KEYWORDS,\n  ...SECTION_TITLE_SECONDARY_KEYWORDS,\n];\n\nconst isSectionTitle = (line: Line, lineNumber: number) => {\n  const isFirstTwoLines = lineNumber < 2;\n  const hasMoreThanOneItemInLine = line.length > 1;\n  const hasNoItemInLine = line.length === 0;\n  if (isFirstTwoLines || hasMoreThanOneItemInLine || hasNoItemInLine) {\n    return false;\n  }\n\n  const textItem = line[0];\n\n  // The main heuristic to determine a section title is to check if the text is double emphasized\n  // to be both bold and all uppercase, which is generally true for a well formatted resume\n  if (isBold(textItem) && hasLetterAndIsAllUpperCase(textItem)) {\n    return true;\n  }\n\n  // The following is a fallback heuristic to detect section title if it includes a keyword match\n  // (This heuristics is not well tested and may not work well)\n  const text = textItem.text.trim();\n  const textHasAtMost2Words =\n    text.split(\" \").filter((s) => s !== \"&\").length <= 2;\n  const startsWithCapitalLetter = /[A-Z]/.test(text.slice(0, 1));\n\n  if (\n    textHasAtMost2Words &&\n    hasOnlyLettersSpacesAmpersands(textItem) &&\n    startsWithCapitalLetter &&\n    SECTION_TITLE_KEYWORDS.some((keyword) =>\n      text.toLowerCase().includes(keyword)\n    )\n  ) {\n    return true;\n  }\n\n  return false;\n};\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/group-text-items-into-lines.ts",
    "content": "import { BULLET_POINTS } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/bullet-points\";\nimport type { TextItems, Line, Lines } from \"lib/parse-resume-from-pdf/types\";\n\n/**\n * Step 2: Group text items into lines. This returns an array where each position\n * contains text items in the same line of the pdf file.\n */\nexport const groupTextItemsIntoLines = (textItems: TextItems): Lines => {\n  const lines: Lines = [];\n\n  // Group text items into lines based on hasEOL\n  let line: Line = [];\n  for (let item of textItems) {\n    // If item is EOL, add current line to lines and start a new empty line\n    if (item.hasEOL) {\n      if (item.text.trim() !== \"\") {\n        line.push({ ...item });\n      }\n      lines.push(line);\n      line = [];\n    }\n    // Otherwise, add item to current line\n    else if (item.text.trim() !== \"\") {\n      line.push({ ...item });\n    }\n  }\n  // Add last line if there is item in last line\n  if (line.length > 0) {\n    lines.push(line);\n  }\n\n  // Many pdf docs are not well formatted, e.g. due to converting from other docs.\n  // This creates many noises, where a single text item is divided into multiple\n  // ones. This step is to merge adjacent text items if their distance is smaller\n  // than a typical char width to filter out those noises.\n  const typicalCharWidth = getTypicalCharWidth(lines.flat());\n  for (let line of lines) {\n    // Start from the end of the line to make things easier to merge and delete\n    for (let i = line.length - 1; i > 0; i--) {\n      const currentItem = line[i];\n      const leftItem = line[i - 1];\n      const leftItemXEnd = leftItem.x + leftItem.width;\n      const distance = currentItem.x - leftItemXEnd;\n      if (distance <= typicalCharWidth) {\n        if (shouldAddSpaceBetweenText(leftItem.text, currentItem.text)) {\n          leftItem.text += \" \";\n        }\n        leftItem.text += currentItem.text;\n        // Update leftItem width to include currentItem after merge before deleting current item\n        const currentItemXEnd = currentItem.x + currentItem.width;\n        leftItem.width = currentItemXEnd - leftItem.x;\n        line.splice(i, 1);\n      }\n    }\n  }\n\n  return lines;\n};\n\n// Sometimes a space is lost while merging adjacent text items. This accounts for some of those cases\nconst shouldAddSpaceBetweenText = (leftText: string, rightText: string) => {\n  const leftTextEnd = leftText[leftText.length - 1];\n  const rightTextStart = rightText[0];\n  const conditions = [\n    [\":\", \",\", \"|\", \".\", ...BULLET_POINTS].includes(leftTextEnd) &&\n      rightTextStart !== \" \",\n    leftTextEnd !== \" \" && [\"|\", ...BULLET_POINTS].includes(rightTextStart),\n  ];\n\n  return conditions.some((condition) => condition);\n};\n\n/**\n * Return the width of a typical character. (Helper util for groupTextItemsIntoLines)\n *\n * A pdf file uses different characters, each with different width due to different\n * font family and font size. This util first extracts the most typically used font\n * family and font height, and compute the average character width using text items\n * that match the typical font family and height.\n */\nconst getTypicalCharWidth = (textItems: TextItems): number => {\n  // Exclude empty space \" \" in calculations since its width isn't precise\n  textItems = textItems.filter((item) => item.text.trim() !== \"\");\n\n  const heightToCount: { [height: number]: number } = {};\n  let commonHeight = 0;\n  let heightMaxCount = 0;\n\n  const fontNameToCount: { [fontName: string]: number } = {};\n  let commonFontName = \"\";\n  let fontNameMaxCount = 0;\n\n  for (let item of textItems) {\n    const { text, height, fontName } = item;\n    // Process height\n    if (!heightToCount[height]) {\n      heightToCount[height] = 0;\n    }\n    heightToCount[height]++;\n    if (heightToCount[height] > heightMaxCount) {\n      commonHeight = height;\n      heightMaxCount = heightToCount[height];\n    }\n\n    // Process font name\n    if (!fontNameToCount[fontName]) {\n      fontNameToCount[fontName] = 0;\n    }\n    fontNameToCount[fontName] += text.length;\n    if (fontNameToCount[fontName] > fontNameMaxCount) {\n      commonFontName = fontName;\n      fontNameMaxCount = fontNameToCount[fontName];\n    }\n  }\n\n  // Find the text items that match common font family and height\n  const commonTextItems = textItems.filter(\n    (item) => item.fontName === commonFontName && item.height === commonHeight\n  );\n  // Aggregate total width and number of characters of all common text items\n  const [totalWidth, numChars] = commonTextItems.reduce(\n    (acc, cur) => {\n      const [preWidth, prevChars] = acc;\n      return [preWidth + cur.width, prevChars + cur.text.length];\n    },\n    [0, 0]\n  );\n  const typicalCharWidth = totalWidth / numChars;\n\n  return typicalCharWidth;\n};\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/index.ts",
    "content": "import { readPdf } from \"lib/parse-resume-from-pdf/read-pdf\";\nimport { groupTextItemsIntoLines } from \"lib/parse-resume-from-pdf/group-text-items-into-lines\";\nimport { groupLinesIntoSections } from \"lib/parse-resume-from-pdf/group-lines-into-sections\";\nimport { extractResumeFromSections } from \"lib/parse-resume-from-pdf/extract-resume-from-sections\";\n\n/**\n * Resume parser util that parses a resume from a resume pdf file\n *\n * Note: The parser algorithm only works for single column resume in English language\n */\nexport const parseResumeFromPdf = async (fileUrl: string) => {\n  // Step 1. Read a pdf resume file into text items to prepare for processing\n  const textItems = await readPdf(fileUrl);\n\n  // Step 2. Group text items into lines\n  const lines = groupTextItemsIntoLines(textItems);\n\n  // Step 3. Group lines into sections\n  const sections = groupLinesIntoSections(lines);\n\n  // Step 4. Extract resume from sections\n  const resume = extractResumeFromSections(sections);\n\n  return resume;\n};\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/read-pdf.ts",
    "content": "// Getting pdfjs to work is tricky. The following 3 lines would make it work\n// https://stackoverflow.com/a/63486898/7699841\nimport * as pdfjs from \"pdfjs-dist\";\n// @ts-ignore\nimport pdfjsWorker from \"pdfjs-dist/build/pdf.worker.entry\";\npdfjs.GlobalWorkerOptions.workerSrc = pdfjsWorker;\n\nimport type { TextItem as PdfjsTextItem } from \"pdfjs-dist/types/src/display/api\";\nimport type { TextItem, TextItems } from \"lib/parse-resume-from-pdf/types\";\n\n/**\n * Step 1: Read pdf and output textItems by concatenating results from each page.\n *\n * To make processing easier, it returns a new TextItem type, which removes unused\n * attributes (dir, transform), adds x and y positions, and replaces loaded font\n * name with original font name.\n *\n * @example\n * const onFileChange = async (e) => {\n *     const fileUrl = URL.createObjectURL(e.target.files[0]);\n *     const textItems = await readPdf(fileUrl);\n * }\n */\nexport const readPdf = async (fileUrl: string): Promise<TextItems> => {\n  const pdfFile = await pdfjs.getDocument(fileUrl).promise;\n  let textItems: TextItems = [];\n\n  for (let i = 1; i <= pdfFile.numPages; i++) {\n    // Parse each page into text content\n    const page = await pdfFile.getPage(i);\n    const textContent = await page.getTextContent();\n\n    // Wait for font data to be loaded\n    await page.getOperatorList();\n    const commonObjs = page.commonObjs;\n\n    // Convert Pdfjs TextItem type to new TextItem type\n    const pageTextItems = textContent.items.map((item) => {\n      const {\n        str: text,\n        dir, // Remove text direction\n        transform,\n        fontName: pdfFontName,\n        ...otherProps\n      } = item as PdfjsTextItem;\n\n      // Extract x, y position of text item from transform.\n      // As a side note, origin (0, 0) is bottom left.\n      // Reference: https://github.com/mozilla/pdf.js/issues/5643#issuecomment-496648719\n      const x = transform[4];\n      const y = transform[5];\n\n      // Use commonObjs to convert font name to original name (e.g. \"GVDLYI+Arial-BoldMT\")\n      // since non system font name by default is a loaded name, e.g. \"g_d8_f1\"\n      // Reference: https://github.com/mozilla/pdf.js/pull/15659\n      const fontObj = commonObjs.get(pdfFontName);\n      const fontName = fontObj.name;\n\n      // pdfjs reads a \"-\" as \"-­‐\" in the resume example. This is to revert it.\n      // Note \"-­‐\" is \"-&#x00AD;‐\" with a soft hyphen in between. It is not the same as \"--\"\n      const newText = text.replace(/-­‐/g, \"-\");\n\n      const newItem = {\n        ...otherProps,\n        fontName,\n        text: newText,\n        x,\n        y,\n      };\n      return newItem;\n    });\n\n    // Some pdf's text items are not in order. This is most likely a result of creating it\n    // from design softwares, e.g. canvas. The commented out method can sort pageTextItems\n    // by y position to put them back in order. But it is not used since it might be more\n    // helpful to let users know that the pdf is not in order.\n    // pageTextItems.sort((a, b) => Math.round(b.y) - Math.round(a.y));\n\n    // Add text items of each page to total\n    textItems.push(...pageTextItems);\n  }\n\n  // Filter out empty space textItem noise\n  const isEmptySpace = (textItem: TextItem) =>\n    !textItem.hasEOL && textItem.text.trim() === \"\";\n  textItems = textItems.filter((textItem) => !isEmptySpace(textItem));\n\n  return textItems;\n};\n"
  },
  {
    "path": "src/app/lib/parse-resume-from-pdf/types.ts",
    "content": "import type { ResumeKey } from \"lib/redux/types\";\n\nexport interface TextItem {\n  text: string;\n  x: number;\n  y: number;\n  width: number;\n  height: number;\n  fontName: string;\n  hasEOL: boolean;\n}\nexport type TextItems = TextItem[];\n\nexport type Line = TextItem[];\nexport type Lines = Line[];\n\nexport type ResumeSectionToLines = { [sectionName in ResumeKey]?: Lines } & {\n  [otherSectionName: string]: Lines;\n};\nexport type Subsections = Lines[];\n\ntype FeatureScore = -4 | -3 | -2 | -1 | 0 | 1 | 2 | 3 | 4;\ntype ReturnMatchingTextOnly = boolean;\nexport type FeatureSet =\n  | [(item: TextItem) => boolean, FeatureScore]\n  | [\n      (item: TextItem) => RegExpMatchArray | null,\n      FeatureScore,\n      ReturnMatchingTextOnly\n    ];\n\nexport interface TextScore {\n  text: string;\n  score: number;\n  match: boolean;\n}\nexport type TextScores = TextScore[];\n"
  },
  {
    "path": "src/app/lib/redux/hooks.tsx",
    "content": "import { useEffect } from \"react\";\nimport {\n  useDispatch,\n  useSelector,\n  type TypedUseSelectorHook,\n} from \"react-redux\";\nimport { store, type RootState, type AppDispatch } from \"lib/redux/store\";\nimport {\n  loadStateFromLocalStorage,\n  saveStateToLocalStorage,\n} from \"lib/redux/local-storage\";\nimport { initialResumeState, setResume } from \"lib/redux/resumeSlice\";\nimport {\n  initialSettings,\n  setSettings,\n  type Settings,\n} from \"lib/redux/settingsSlice\";\nimport { deepMerge } from \"lib/deep-merge\";\nimport type { Resume } from \"lib/redux/types\";\n\nexport const useAppDispatch: () => AppDispatch = useDispatch;\nexport const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;\n\n/**\n * Hook to save store to local storage on store change\n */\nexport const useSaveStateToLocalStorageOnChange = () => {\n  useEffect(() => {\n    const unsubscribe = store.subscribe(() => {\n      saveStateToLocalStorage(store.getState());\n    });\n    return unsubscribe;\n  }, []);\n};\n\nexport const useSetInitialStore = () => {\n  const dispatch = useAppDispatch();\n  useEffect(() => {\n    const state = loadStateFromLocalStorage();\n    if (!state) return;\n    if (state.resume) {\n      // We merge the initial state with the stored state to ensure\n      // backward compatibility, since new fields might be added to\n      // the initial state over time.\n      const mergedResumeState = deepMerge(\n        initialResumeState,\n        state.resume\n      ) as Resume;\n      dispatch(setResume(mergedResumeState));\n    }\n    if (state.settings) {\n      const mergedSettingsState = deepMerge(\n        initialSettings,\n        state.settings\n      ) as Settings;\n      dispatch(setSettings(mergedSettingsState));\n    }\n  }, []);\n};\n"
  },
  {
    "path": "src/app/lib/redux/local-storage.ts",
    "content": "import type { RootState } from \"lib/redux/store\";\n\n// Reference: https://dev.to/igorovic/simplest-way-to-persist-redux-state-to-localstorage-e67\n\nconst LOCAL_STORAGE_KEY = \"open-resume-state\";\n\nexport const loadStateFromLocalStorage = () => {\n  try {\n    const stringifiedState = localStorage.getItem(LOCAL_STORAGE_KEY);\n    if (!stringifiedState) return undefined;\n    return JSON.parse(stringifiedState);\n  } catch (e) {\n    return undefined;\n  }\n};\n\nexport const saveStateToLocalStorage = (state: RootState) => {\n  try {\n    const stringifiedState = JSON.stringify(state);\n    localStorage.setItem(LOCAL_STORAGE_KEY, stringifiedState);\n  } catch (e) {\n    // Ignore\n  }\n};\n\nexport const getHasUsedAppBefore = () => Boolean(loadStateFromLocalStorage());\n"
  },
  {
    "path": "src/app/lib/redux/resumeSlice.ts",
    "content": "import { createSlice, type PayloadAction } from \"@reduxjs/toolkit\";\nimport type { RootState } from \"lib/redux/store\";\nimport type {\n  FeaturedSkill,\n  Resume,\n  ResumeEducation,\n  ResumeProfile,\n  ResumeProject,\n  ResumeSkills,\n  ResumeWorkExperience,\n} from \"lib/redux/types\";\nimport type { ShowForm } from \"lib/redux/settingsSlice\";\n\nexport const initialProfile: ResumeProfile = {\n  name: \"\",\n  summary: \"\",\n  email: \"\",\n  phone: \"\",\n  location: \"\",\n  url: \"\",\n};\n\nexport const initialWorkExperience: ResumeWorkExperience = {\n  company: \"\",\n  jobTitle: \"\",\n  date: \"\",\n  descriptions: [],\n};\n\nexport const initialEducation: ResumeEducation = {\n  school: \"\",\n  degree: \"\",\n  gpa: \"\",\n  date: \"\",\n  descriptions: [],\n};\n\nexport const initialProject: ResumeProject = {\n  project: \"\",\n  date: \"\",\n  descriptions: [],\n};\n\nexport const initialFeaturedSkill: FeaturedSkill = { skill: \"\", rating: 4 };\nexport const initialFeaturedSkills: FeaturedSkill[] = Array(6).fill({\n  ...initialFeaturedSkill,\n});\nexport const initialSkills: ResumeSkills = {\n  featuredSkills: initialFeaturedSkills,\n  descriptions: [],\n};\n\nexport const initialCustom = {\n  descriptions: [],\n};\n\nexport const initialResumeState: Resume = {\n  profile: initialProfile,\n  workExperiences: [initialWorkExperience],\n  educations: [initialEducation],\n  projects: [initialProject],\n  skills: initialSkills,\n  custom: initialCustom,\n};\n\n// Keep the field & value type in sync with CreateHandleChangeArgsWithDescriptions (components\\ResumeForm\\types.ts)\nexport type CreateChangeActionWithDescriptions<T> = {\n  idx: number;\n} & (\n  | {\n      field: Exclude<keyof T, \"descriptions\">;\n      value: string;\n    }\n  | { field: \"descriptions\"; value: string[] }\n);\n\nexport const resumeSlice = createSlice({\n  name: \"resume\",\n  initialState: initialResumeState,\n  reducers: {\n    changeProfile: (\n      draft,\n      action: PayloadAction<{ field: keyof ResumeProfile; value: string }>\n    ) => {\n      const { field, value } = action.payload;\n      draft.profile[field] = value;\n    },\n    changeWorkExperiences: (\n      draft,\n      action: PayloadAction<\n        CreateChangeActionWithDescriptions<ResumeWorkExperience>\n      >\n    ) => {\n      const { idx, field, value } = action.payload;\n      const workExperience = draft.workExperiences[idx];\n      workExperience[field] = value as any;\n    },\n    changeEducations: (\n      draft,\n      action: PayloadAction<CreateChangeActionWithDescriptions<ResumeEducation>>\n    ) => {\n      const { idx, field, value } = action.payload;\n      const education = draft.educations[idx];\n      education[field] = value as any;\n    },\n    changeProjects: (\n      draft,\n      action: PayloadAction<CreateChangeActionWithDescriptions<ResumeProject>>\n    ) => {\n      const { idx, field, value } = action.payload;\n      const project = draft.projects[idx];\n      project[field] = value as any;\n    },\n    changeSkills: (\n      draft,\n      action: PayloadAction<\n        | { field: \"descriptions\"; value: string[] }\n        | {\n            field: \"featuredSkills\";\n            idx: number;\n            skill: string;\n            rating: number;\n          }\n      >\n    ) => {\n      const { field } = action.payload;\n      if (field === \"descriptions\") {\n        const { value } = action.payload;\n        draft.skills.descriptions = value;\n      } else {\n        const { idx, skill, rating } = action.payload;\n        const featuredSkill = draft.skills.featuredSkills[idx];\n        featuredSkill.skill = skill;\n        featuredSkill.rating = rating;\n      }\n    },\n    changeCustom: (\n      draft,\n      action: PayloadAction<{ field: \"descriptions\"; value: string[] }>\n    ) => {\n      const { value } = action.payload;\n      draft.custom.descriptions = value;\n    },\n    addSectionInForm: (draft, action: PayloadAction<{ form: ShowForm }>) => {\n      const { form } = action.payload;\n      switch (form) {\n        case \"workExperiences\": {\n          draft.workExperiences.push(structuredClone(initialWorkExperience));\n          return draft;\n        }\n        case \"educations\": {\n          draft.educations.push(structuredClone(initialEducation));\n          return draft;\n        }\n        case \"projects\": {\n          draft.projects.push(structuredClone(initialProject));\n          return draft;\n        }\n      }\n    },\n    moveSectionInForm: (\n      draft,\n      action: PayloadAction<{\n        form: ShowForm;\n        idx: number;\n        direction: \"up\" | \"down\";\n      }>\n    ) => {\n      const { form, idx, direction } = action.payload;\n      if (form !== \"skills\" && form !== \"custom\") {\n        if (\n          (idx === 0 && direction === \"up\") ||\n          (idx === draft[form].length - 1 && direction === \"down\")\n        ) {\n          return draft;\n        }\n\n        const section = draft[form][idx];\n        if (direction === \"up\") {\n          draft[form][idx] = draft[form][idx - 1];\n          draft[form][idx - 1] = section;\n        } else {\n          draft[form][idx] = draft[form][idx + 1];\n          draft[form][idx + 1] = section;\n        }\n      }\n    },\n    deleteSectionInFormByIdx: (\n      draft,\n      action: PayloadAction<{ form: ShowForm; idx: number }>\n    ) => {\n      const { form, idx } = action.payload;\n      if (form !== \"skills\" && form !== \"custom\") {\n        draft[form].splice(idx, 1);\n      }\n    },\n    setResume: (draft, action: PayloadAction<Resume>) => {\n      return action.payload;\n    },\n  },\n});\n\nexport const {\n  changeProfile,\n  changeWorkExperiences,\n  changeEducations,\n  changeProjects,\n  changeSkills,\n  changeCustom,\n  addSectionInForm,\n  moveSectionInForm,\n  deleteSectionInFormByIdx,\n  setResume,\n} = resumeSlice.actions;\n\nexport const selectResume = (state: RootState) => state.resume;\nexport const selectProfile = (state: RootState) => state.resume.profile;\nexport const selectWorkExperiences = (state: RootState) =>\n  state.resume.workExperiences;\nexport const selectEducations = (state: RootState) => state.resume.educations;\nexport const selectProjects = (state: RootState) => state.resume.projects;\nexport const selectSkills = (state: RootState) => state.resume.skills;\nexport const selectCustom = (state: RootState) => state.resume.custom;\n\nexport default resumeSlice.reducer;\n"
  },
  {
    "path": "src/app/lib/redux/settingsSlice.ts",
    "content": "import { createSlice, type PayloadAction } from \"@reduxjs/toolkit\";\nimport type { RootState } from \"lib/redux/store\";\n\nexport interface Settings {\n  themeColor: string;\n  fontFamily: string;\n  fontSize: string;\n  documentSize: string;\n  formToShow: {\n    workExperiences: boolean;\n    educations: boolean;\n    projects: boolean;\n    skills: boolean;\n    custom: boolean;\n  };\n  formToHeading: {\n    workExperiences: string;\n    educations: string;\n    projects: string;\n    skills: string;\n    custom: string;\n  };\n  formsOrder: ShowForm[];\n  showBulletPoints: {\n    educations: boolean;\n    projects: boolean;\n    skills: boolean;\n    custom: boolean;\n  };\n}\n\nexport type ShowForm = keyof Settings[\"formToShow\"];\nexport type FormWithBulletPoints = keyof Settings[\"showBulletPoints\"];\nexport type GeneralSetting = Exclude<\n  keyof Settings,\n  \"formToShow\" | \"formToHeading\" | \"formsOrder\" | \"showBulletPoints\"\n>;\n\nexport const DEFAULT_THEME_COLOR = \"#38bdf8\"; // sky-400\nexport const DEFAULT_FONT_FAMILY = \"Roboto\";\nexport const DEFAULT_FONT_SIZE = \"11\"; // text-base https://tailwindcss.com/docs/font-size\nexport const DEFAULT_FONT_COLOR = \"#171717\"; // text-neutral-800\n\nexport const initialSettings: Settings = {\n  themeColor: DEFAULT_THEME_COLOR,\n  fontFamily: DEFAULT_FONT_FAMILY,\n  fontSize: DEFAULT_FONT_SIZE,\n  documentSize: \"Letter\",\n  formToShow: {\n    workExperiences: true,\n    educations: true,\n    projects: true,\n    skills: true,\n    custom: false,\n  },\n  formToHeading: {\n    workExperiences: \"WORK EXPERIENCE\",\n    educations: \"EDUCATION\",\n    projects: \"PROJECT\",\n    skills: \"SKILLS\",\n    custom: \"CUSTOM SECTION\",\n  },\n  formsOrder: [\"workExperiences\", \"educations\", \"projects\", \"skills\", \"custom\"],\n  showBulletPoints: {\n    educations: true,\n    projects: true,\n    skills: true,\n    custom: true,\n  },\n};\n\nexport const settingsSlice = createSlice({\n  name: \"settings\",\n  initialState: initialSettings,\n  reducers: {\n    changeSettings: (\n      draft,\n      action: PayloadAction<{ field: GeneralSetting; value: string }>\n    ) => {\n      const { field, value } = action.payload;\n      draft[field] = value;\n    },\n    changeShowForm: (\n      draft,\n      action: PayloadAction<{ field: ShowForm; value: boolean }>\n    ) => {\n      const { field, value } = action.payload;\n      draft.formToShow[field] = value;\n    },\n    changeFormHeading: (\n      draft,\n      action: PayloadAction<{ field: ShowForm; value: string }>\n    ) => {\n      const { field, value } = action.payload;\n      draft.formToHeading[field] = value;\n    },\n    changeFormOrder: (\n      draft,\n      action: PayloadAction<{ form: ShowForm; type: \"up\" | \"down\" }>\n    ) => {\n      const { form, type } = action.payload;\n      const lastIdx = draft.formsOrder.length - 1;\n      const pos = draft.formsOrder.indexOf(form);\n      const newPos = type === \"up\" ? pos - 1 : pos + 1;\n      const swapFormOrder = (idx1: number, idx2: number) => {\n        const temp = draft.formsOrder[idx1];\n        draft.formsOrder[idx1] = draft.formsOrder[idx2];\n        draft.formsOrder[idx2] = temp;\n      };\n      if (newPos >= 0 && newPos <= lastIdx) {\n        swapFormOrder(pos, newPos);\n      }\n    },\n    changeShowBulletPoints: (\n      draft,\n      action: PayloadAction<{\n        field: FormWithBulletPoints;\n        value: boolean;\n      }>\n    ) => {\n      const { field, value } = action.payload;\n      draft[\"showBulletPoints\"][field] = value;\n    },\n    setSettings: (draft, action: PayloadAction<Settings>) => {\n      return action.payload;\n    },\n  },\n});\n\nexport const {\n  changeSettings,\n  changeShowForm,\n  changeFormHeading,\n  changeFormOrder,\n  changeShowBulletPoints,\n  setSettings,\n} = settingsSlice.actions;\n\nexport const selectSettings = (state: RootState) => state.settings;\nexport const selectThemeColor = (state: RootState) => state.settings.themeColor;\n\nexport const selectFormToShow = (state: RootState) => state.settings.formToShow;\nexport const selectShowByForm = (form: ShowForm) => (state: RootState) =>\n  state.settings.formToShow[form];\n\nexport const selectFormToHeading = (state: RootState) =>\n  state.settings.formToHeading;\nexport const selectHeadingByForm = (form: ShowForm) => (state: RootState) =>\n  state.settings.formToHeading[form];\n\nexport const selectFormsOrder = (state: RootState) => state.settings.formsOrder;\nexport const selectIsFirstForm = (form: ShowForm) => (state: RootState) =>\n  state.settings.formsOrder[0] === form;\nexport const selectIsLastForm = (form: ShowForm) => (state: RootState) =>\n  state.settings.formsOrder[state.settings.formsOrder.length - 1] === form;\n\nexport const selectShowBulletPoints =\n  (form: FormWithBulletPoints) => (state: RootState) =>\n    state.settings.showBulletPoints[form];\n\nexport default settingsSlice.reducer;\n"
  },
  {
    "path": "src/app/lib/redux/store.ts",
    "content": "import { configureStore } from \"@reduxjs/toolkit\";\nimport resumeReducer from \"lib/redux/resumeSlice\";\nimport settingsReducer from \"lib/redux/settingsSlice\";\n\nexport const store = configureStore({\n  reducer: {\n    resume: resumeReducer,\n    settings: settingsReducer,\n  },\n});\n\nexport type RootState = ReturnType<typeof store.getState>;\nexport type AppDispatch = typeof store.dispatch;\n"
  },
  {
    "path": "src/app/lib/redux/types.ts",
    "content": "export interface ResumeProfile {\n  name: string;\n  email: string;\n  phone: string;\n  url: string;\n  summary: string;\n  location: string;\n}\n\nexport interface ResumeWorkExperience {\n  company: string;\n  jobTitle: string;\n  date: string;\n  descriptions: string[];\n}\n\nexport interface ResumeEducation {\n  school: string;\n  degree: string;\n  date: string;\n  gpa: string;\n  descriptions: string[];\n}\n\nexport interface ResumeProject {\n  project: string;\n  date: string;\n  descriptions: string[];\n}\n\nexport interface FeaturedSkill {\n  skill: string;\n  rating: number;\n}\n\nexport interface ResumeSkills {\n  featuredSkills: FeaturedSkill[];\n  descriptions: string[];\n}\n\nexport interface ResumeCustom {\n  descriptions: string[];\n}\n\nexport interface Resume {\n  profile: ResumeProfile;\n  workExperiences: ResumeWorkExperience[];\n  educations: ResumeEducation[];\n  projects: ResumeProject[];\n  skills: ResumeSkills;\n  custom: ResumeCustom;\n}\n\nexport type ResumeKey = keyof Resume;\n"
  },
  {
    "path": "src/app/page.tsx",
    "content": "import { Hero } from \"home/Hero\";\nimport { Steps } from \"home/Steps\";\nimport { Features } from \"home/Features\";\nimport { Testimonials } from \"home/Testimonials\";\nimport { QuestionsAndAnswers } from \"home/QuestionsAndAnswers\";\n\nexport default function Home() {\n  return (\n    <main className=\"mx-auto max-w-screen-2xl bg-dot px-8 pb-32 text-gray-900 lg:px-12\">\n      <Hero />\n      <Steps />\n      <Features />\n      <Testimonials />\n      <QuestionsAndAnswers />\n    </main>\n  );\n}\n"
  },
  {
    "path": "src/app/resume-builder/page.tsx",
    "content": "\"use client\";\nimport { Provider } from \"react-redux\";\nimport { store } from \"lib/redux/store\";\nimport { ResumeForm } from \"components/ResumeForm\";\nimport { Resume } from \"components/Resume\";\n\nexport default function Create() {\n  return (\n    <Provider store={store}>\n      <main className=\"relative h-full w-full overflow-hidden bg-gray-50\">\n        <div className=\"grid grid-cols-3 md:grid-cols-6\">\n          <div className=\"col-span-3\">\n            <ResumeForm />\n          </div>\n          <div className=\"col-span-3\">\n            <Resume />\n          </div>\n        </div>\n      </main>\n    </Provider>\n  );\n}\n"
  },
  {
    "path": "src/app/resume-import/page.tsx",
    "content": "\"use client\";\nimport { getHasUsedAppBefore } from \"lib/redux/local-storage\";\nimport { ResumeDropzone } from \"components/ResumeDropzone\";\nimport { useState, useEffect } from \"react\";\nimport Link from \"next/link\";\n\nexport default function ImportResume() {\n  const [hasUsedAppBefore, setHasUsedAppBefore] = useState(false);\n  const [hasAddedResume, setHasAddedResume] = useState(false);\n  const onFileUrlChange = (fileUrl: string) => {\n    setHasAddedResume(Boolean(fileUrl));\n  };\n\n  useEffect(() => {\n    setHasUsedAppBefore(getHasUsedAppBefore());\n  }, []);\n\n  return (\n    <main>\n      <div className=\"mx-auto mt-14 max-w-3xl rounded-md border border-gray-200 px-10 py-10 text-center shadow-md\">\n        {!hasUsedAppBefore ? (\n          <>\n            <h1 className=\"text-lg font-semibold text-gray-900\">\n              Import data from an existing resume\n            </h1>\n            <ResumeDropzone\n              onFileUrlChange={onFileUrlChange}\n              className=\"mt-5\"\n            />\n            {!hasAddedResume && (\n              <>\n                <OrDivider />\n                <SectionWithHeadingAndCreateButton\n                  heading=\"Don't have a resume yet?\"\n                  buttonText=\"Create from scratch\"\n                />\n              </>\n            )}\n          </>\n        ) : (\n          <>\n            {!hasAddedResume && (\n              <>\n                <SectionWithHeadingAndCreateButton\n                  heading=\"You have data saved in browser from prior session\"\n                  buttonText=\"Continue where I left off\"\n                />\n                <OrDivider />\n              </>\n            )}\n            <h1 className=\"font-semibold text-gray-900\">\n              Override data with a new resume\n            </h1>\n            <ResumeDropzone\n              onFileUrlChange={onFileUrlChange}\n              className=\"mt-5\"\n            />\n          </>\n        )}\n      </div>\n    </main>\n  );\n}\n\nconst OrDivider = () => (\n  <div className=\"mx-[-2.5rem] flex items-center pb-6 pt-8\" aria-hidden=\"true\">\n    <div className=\"flex-grow border-t border-gray-200\" />\n    <span className=\"mx-2 mt-[-2px] flex-shrink text-lg text-gray-400\">or</span>\n    <div className=\"flex-grow border-t border-gray-200\" />\n  </div>\n);\n\nconst SectionWithHeadingAndCreateButton = ({\n  heading,\n  buttonText,\n}: {\n  heading: string;\n  buttonText: string;\n}) => {\n  return (\n    <>\n      <p className=\"font-semibold text-gray-900\">{heading}</p>\n      <div className=\"mt-5\">\n        <Link\n          href=\"/resume-builder\"\n          className=\"outline-theme-blue rounded-full bg-sky-500 px-6 pb-2 pt-1.5 text-base font-semibold text-white\"\n        >\n          {buttonText}\n        </Link>\n      </div>\n    </>\n  );\n};\n"
  },
  {
    "path": "src/app/resume-parser/ResumeParserAlgorithmArticle.tsx",
    "content": "import { isBold } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/lib/common-features\";\nimport {\n  Badge,\n  Heading,\n  Link,\n  Paragraph,\n  Table,\n} from \"components/documentation\";\nimport type {\n  Line,\n  Lines,\n  ResumeSectionToLines,\n  TextItem,\n  TextItems,\n  TextScores,\n} from \"lib/parse-resume-from-pdf/types\";\nimport { extractProfile } from \"lib/parse-resume-from-pdf/extract-resume-from-sections/extract-profile\";\n\nexport const ResumeParserAlgorithmArticle = ({\n  textItems,\n  lines,\n  sections,\n}: {\n  textItems: TextItems;\n  lines: Lines;\n  sections: ResumeSectionToLines;\n}) => {\n  const getBadgeContent = (item: TextItem) => {\n    const X1 = Math.round(item.x);\n    const X2 = Math.round(item.x + item.width);\n    const Y = Math.round(item.y);\n    let content = `X₁=${X1} X₂=${X2} Y=${Y}`;\n    if (X1 === X2) {\n      content = `X=${X2} Y=${Y}`;\n    }\n    if (isBold(item)) {\n      content = `${content} Bold`;\n    }\n    if (item.hasEOL) {\n      content = `${content} NewLine`;\n    }\n    return content;\n  };\n  const step1TextItemsTable = [\n    [\"#\", \"Text Content\", \"Metadata\"],\n    ...textItems.map((item, idx) => [\n      idx + 1,\n      item.text,\n      <Badge key={idx}>{getBadgeContent(item)}</Badge>,\n    ]),\n  ];\n\n  const step2LinesTable = [\n    [\"Lines\", \"Line Content\"],\n    ...lines.map((line, idx) => [\n      idx + 1,\n      line.map((item, idx) => (\n        <span key={idx}>\n          {item.text}\n          {idx !== line.length - 1 && (\n            <span className=\"select-none font-extrabold text-sky-400\">\n              &nbsp;&nbsp;{\"|\"}&nbsp;&nbsp;\n            </span>\n          )}\n        </span>\n      )),\n    ]),\n  ];\n\n  const { profile, profileScores } = extractProfile(sections);\n  const Scores = ({ scores }: { scores: TextScores }) => {\n    return (\n      <>\n        {scores\n          .sort((a, b) => b.score - a.score)\n          .map((item, idx) => (\n            <span key={idx} className=\"break-all\">\n              <Badge>{item.score}</Badge> {item.text}\n              <br />\n            </span>\n          ))}\n      </>\n    );\n  };\n  const step4ProfileFeatureScoresTable = [\n    [\n      \"Resume Attribute\",\n      \"Text (Highest Feature Score)\",\n      \"Feature Scores of Other Texts\",\n    ],\n    [\"Name\", profile.name, <Scores key={\"Name\"} scores={profileScores.name} />],\n    [\n      \"Email\",\n      profile.email,\n      <Scores key={\"Email\"} scores={profileScores.email} />,\n    ],\n    [\n      \"Phone\",\n      profile.phone,\n      <Scores key={\"Phone\"} scores={profileScores.phone} />,\n    ],\n  ];\n\n  return (\n    <article className=\"mt-10\">\n      <Heading className=\"text-primary !mt-0 border-t-2 pt-8\">\n        Resume Parser Algorithm Deep Dive\n      </Heading>\n      <Paragraph smallMarginTop={true}>\n        For the technical curious, this section will dive into the OpenResume\n        parser algorithm and walks through the 4 steps on how it works. (Note\n        that the algorithm is designed to parse single column resume in English\n        language)\n      </Paragraph>\n      {/* Step 1. Read the text items from a PDF file */}\n      <Heading level={2}>Step 1. Read the text items from a PDF file</Heading>\n      <Paragraph smallMarginTop={true}>\n        A PDF file is a standardized file format defined by the{\" \"}\n        <Link href=\"https://www.iso.org/standard/51502.html\">\n          ISO 32000 specification\n        </Link>\n        . When you open up a PDF file using a text editor, you'll notice that\n        the raw content looks encoded and is difficult to read. To display it in\n        a readable format, you would need a PDF reader to decode and view the\n        file. Similarly, the resume parser first needs to decode the PDF file in\n        order to extract its text content.\n      </Paragraph>\n      <Paragraph>\n        While it is possible to write a custom PDF reader function following the\n        ISO 32000 specification, it is much simpler to leverage an existing\n        library. In this case, the resume parser uses Mozilla's open source{\" \"}\n        <Link href=\"https://github.com/mozilla/pdf.js\">pdf.js</Link> library to\n        first extract all the text items in the file.\n      </Paragraph>\n      <Paragraph>\n        The table below lists {textItems.length} text items that are extracted\n        from the resume PDF added. A text item contains the text content and\n        also some metadata about the content, e.g. its x, y positions in the\n        document, whether the font is bolded, or whether it starts a new line.\n        (Note that x,y position is relative to the bottom left corner of the\n        page, which is the origin 0,0)\n      </Paragraph>\n      <div className=\"mt-4 max-h-72 overflow-y-scroll border scrollbar scrollbar-track-gray-100 scrollbar-thumb-gray-200 scrollbar-w-3\">\n        <Table\n          table={step1TextItemsTable}\n          className=\"!border-none\"\n          tdClassNames={[\"\", \"\", \"md:whitespace-nowrap\"]}\n        />\n      </div>\n      {/* Step 2. Group text items into lines */}\n      <Heading level={2}>Step 2. Group text items into lines</Heading>\n      <Paragraph smallMarginTop={true}>\n        The extracted text items aren't ready to use yet and have 2 main issues:\n      </Paragraph>\n      <Paragraph>\n        <span className=\"mt-3 block font-semibold\">\n          Issue 1: They have some unwanted noises.\n        </span>\n        Some single text items can get broken into multiple ones, as you might\n        observe on the table above, e.g. a phone number \"(123) 456-7890\" might\n        be broken into 3 text items \"(123) 456\", \"-\" and \"7890\".\n      </Paragraph>\n      <Paragraph smallMarginTop={true}>\n        <span className=\"font-semibold\">Solution:</span> To tackle this issue,\n        the resume parser connects adjacent text items into one text item if\n        their distance is smaller than the average typical character width,\n        where\n        <span\n          dangerouslySetInnerHTML={{\n            __html: `<math display=\"block\">\n                        <mrow>\n                            <mn>Distance </mn>\n                            <mo>=</mo>\n                            <mn>RightTextItemX₁</mn>\n                            <mo>-</mo>\n                            <mn>LeftTextItemX₂</mn>\n                        </mrow>\n                    </math>`,\n          }}\n          className=\"my-2 block text-left text-base\"\n        />\n        The average typical character width is calculated by dividing the sum of\n        all text items' widths by the total number characters of the text items\n        (Bolded texts and new line elements are excluded to not skew the\n        results).\n      </Paragraph>\n      <Paragraph>\n        <span className=\"mt-3 block font-semibold\">\n          Issue 2: They lack contexts and associations.\n        </span>\n        When we read a resume, we scan a resume line by line. Our brains can\n        process each section via visual cues such as texts' boldness and\n        proximity, where we can quickly associate texts closer together to be a\n        related group. The extracted text items however currently don't have\n        those contexts/associations and are just disjointed elements.\n      </Paragraph>\n      <Paragraph smallMarginTop={true}>\n        <span className=\"font-semibold\">Solution:</span> To tackle this issue,\n        the resume parser reconstructs those contexts and associations similar\n        to how our brain would read and process the resume. It first groups text\n        items into lines since we read text line by line. It then groups lines\n        into sections, which will be discussed in the next step.\n      </Paragraph>\n      <Paragraph>\n        At the end of step 2, the resume parser extracts {lines.length} lines\n        from the resume PDF added, as shown in the table below. The result is\n        much more readable when displayed in lines. (Some lines might have\n        multiple text items, which are separated by a blue vertical divider{\" \"}\n        <span className=\"select-none font-extrabold text-sky-400\">\n          &nbsp;{\"|\"}&nbsp;\n        </span>\n        )\n      </Paragraph>\n      <div className=\"mt-4 max-h-96 overflow-y-scroll border scrollbar scrollbar-track-gray-100 scrollbar-thumb-gray-200 scrollbar-w-3\">\n        <Table table={step2LinesTable} className=\"!border-none\" />\n      </div>\n      {/* Step 3. Group lines into sections */}\n      <Heading level={2}>Step 3. Group lines into sections</Heading>\n      <Paragraph smallMarginTop={true}>\n        At step 2, the resume parser starts building contexts and associations\n        to text items by first grouping them into lines. Step 3 continues the\n        process to build additional associations by grouping lines into\n        sections.\n      </Paragraph>\n      <Paragraph>\n        Note that every section (except the profile section) starts with a\n        section title that takes up the entire line. This is a common pattern\n        not just in resumes but also in books and blogs. The resume parser uses\n        this pattern to group lines into the closest section title above these\n        lines.\n      </Paragraph>\n      <Paragraph>\n        The resume parser applies some heuristics to detect a section title. The\n        main heuristic to determine a section title is to check if it fulfills\n        all 3 following conditions: <br />\n        1. It is the only text item in the line <br />\n        2. It is <span className=\"font-bold\">bolded</span> <br />\n        3. Its letters are all UPPERCASE\n        <br />\n      </Paragraph>\n      <Paragraph>\n        In simple words, if a text item is double emphasized to be both bolded\n        and uppercase, it is most likely a section title in a resume. This is\n        generally true for a well formatted resume. There can be exceptions, but\n        it is likely not a good use of bolded and uppercase in those cases.\n      </Paragraph>\n      <Paragraph>\n        The resume parser also has a fallback heuristic if the main heuristic\n        doesn't apply. The fallback heuristic mainly performs a keyword matching\n        against a list of common resume section title keywords.\n      </Paragraph>\n      <Paragraph>\n        At the end of step 3, the resume parser identifies the sections from the\n        resume and groups those lines with the associated section title, as\n        shown in the table below. Note that{\" \"}\n        <span className=\"font-bold\">the section titles are bolded</span> and{\" \"}\n        <span className=\"bg-teal-50\">\n          the lines associated with the section are highlighted with the same\n          colors\n        </span>\n        .\n      </Paragraph>\n      <Step3SectionsTable sections={sections} />\n      {/* Step 4. Extract resume from sections */}\n      <Heading level={2}>Step 4. Extract resume from sections</Heading>\n      <Paragraph smallMarginTop={true}>\n        Step 4 is the last step of the resume parsing process and is also the\n        core of the resume parser, where it extracts resume information from the\n        sections.\n      </Paragraph>\n      <Heading level={3}>Feature Scoring System</Heading>\n      <Paragraph smallMarginTop={true}>\n        The gist of the extraction engine is a feature scoring system. Each\n        resume attribute to be extracted has a custom feature sets, where each\n        feature set consists of a feature matching function and a feature\n        matching score if matched (feature matching score can be a positive or\n        negative number). To compute the final feature score of a text item for\n        a particular resume attribute, it would run the text item through all\n        its feature sets and sum up the matching feature scores. This process is\n        carried out for all text items within the section, and the text item\n        with the highest computed feature score is identified as the extracted\n        resume attribute.\n      </Paragraph>\n      <Paragraph>\n        As a demonstration, the table below shows 3 resume attributes in the\n        profile section of the resume PDF added.\n      </Paragraph>\n      <Table table={step4ProfileFeatureScoresTable} className=\"mt-4\" />\n      {(profileScores.name.find((item) => item.text === profile.name)?.score ||\n        0) > 0 && (\n        <Paragraph smallMarginTop={true}>\n          In the resume PDF added, the resume attribute name is likely to be \"\n          {profile.name}\" since its feature score is{\" \"}\n          {profileScores.name.find((item) => item.text === profile.name)?.score}\n          , which is the highest feature score out of all text items in the\n          profile section. (Some text items' feature scores can be negative,\n          indicating they are very unlikely to be the targeted attribute)\n        </Paragraph>\n      )}\n      <Heading level={3}>Feature Sets</Heading>\n      <Paragraph smallMarginTop={true}>\n        Having explained the feature scoring system, we can dive more into how\n        feature sets are constructed for a resume attribute. It follows 2\n        principles: <br />\n        1. A resume attribute's feature sets are designed relative to all other\n        resume attributes within the same section. <br />\n        2. A resume attribute's feature sets are manually crafted based on its\n        characteristics and likelihood of each characteristic.\n      </Paragraph>\n      <Paragraph>\n        The table below lists some of the feature sets for the resume attribute\n        name. It contains feature function that matches the name attribute with\n        positive feature score and also feature function that only matches other\n        resume attributes in the section with negative feature score.\n      </Paragraph>\n      <Table\n        table={step4NameFeatureSetsTable}\n        title=\"Name Feature Sets\"\n        className=\"mt-4\"\n      />\n      <Heading level={3}>Core Feature Function</Heading>\n      <Paragraph smallMarginTop={true}>\n        Each resume attribute has multiple feature sets. They can be found in\n        the source code under the extract-resume-from-sections folder and we\n        won't list them all out here. Each resume attribute usually has a core\n        feature function that greatly identifies them, so we will list out the\n        core feature function below.\n      </Paragraph>\n      <Table table={step4CoreFeatureFunctionTable} className=\"mt-4\" />\n      <Heading level={3}>Special Case: Subsections</Heading>\n      <Paragraph smallMarginTop={true}>\n        The last thing that is worth mentioning is subsections. For profile\n        section, we can directly pass all the text items to the feature scoring\n        systems. But for other sections, such as education and work experience,\n        we have to first divide the section into subsections since there can be\n        multiple schools or work experiences in the section. The feature scoring\n        system then process each subsection to retrieve each's resume attributes\n        and append the results.\n      </Paragraph>\n      <Paragraph smallMarginTop={true}>\n        The resume parser applies some heuristics to detect a subsection. The\n        main heuristic to determine a subsection is to check if the vertical\n        line gap between 2 lines is larger than the typical line gap * 1.4,\n        since a well formatted resume usually creates a new empty line break\n        before adding the next subsection. There is also a fallback heuristic if\n        the main heuristic doesn't apply to check if the text item is bolded.\n      </Paragraph>\n      <Paragraph>\n        And that is everything about the OpenResume parser algorithm :)\n      </Paragraph>\n      <Paragraph>\n        Written by <Link href=\"https://github.com/xitanggg\">Xitang</Link> on\n        June 2023\n      </Paragraph>\n    </article>\n  );\n};\n\nconst step4NameFeatureSetsTable = [\n  [\"Feature Function\", \"Feature Matching Score\"],\n  [\"Contains only letters, spaces or periods\", \"+3\"],\n  [\"Is bolded\", \"+2\"],\n  [\"Contains all uppercase letters\", \"+2\"],\n  [\"Contains @\", \"-4 (match email)\"],\n  [\"Contains number\", \"-4 (match phone)\"],\n  [\"Contains ,\", \"-4 (match address)\"],\n  [\"Contains /\", \"-4 (match url)\"],\n];\n\nconst step4CoreFeatureFunctionTable = [\n  [\"Resume Attribute\", \"Core Feature Function\", \"Regex\"],\n  [\"Name\", \"Contains only letters, spaces or periods\", \"/^[a-zA-Z\\\\s\\\\.]+$/\"],\n  [\n    \"Email\",\n    <>\n      Match email format xxx@xxx.xxx\n      <br />\n      xxx can be anything not space\n    </>,\n    \"/\\\\S+@\\\\S+\\\\.\\\\S+/\",\n  ],\n  [\n    \"Phone\",\n    <>\n      Match phone format (xxx)-xxx-xxxx <br /> () and - are optional\n    </>,\n    \"/\\\\(?\\\\d{3}\\\\)?[\\\\s-]?\\\\d{3}[\\\\s-]?\\\\d{4}/\",\n  ],\n  [\n    \"Location\",\n    <>Match city and state format {\"City, ST\"}</>,\n    \"/[A-Z][a-zA-Z\\\\s]+, [A-Z]{2}/\",\n  ],\n  [\"Url\", \"Match url format xxx.xxx/xxx\", \"/\\\\S+\\\\.[a-z]+\\\\/\\\\S+/\"],\n  [\"School\", \"Contains a school keyword, e.g. College, University, School\", \"\"],\n  [\"Degree\", \"Contains a degree keyword, e.g. Associate, Bachelor, Master\", \"\"],\n  [\"GPA\", \"Match GPA format x.xx\", \"/[0-4]\\\\.\\\\d{1,2}/\"],\n  [\n    \"Date\",\n    \"Contains date keyword related to year, month, seasons or the word Present\",\n    \"Year: /(?:19|20)\\\\d{2}/\",\n  ],\n  [\n    \"Job Title\",\n    \"Contains a job title keyword, e.g. Analyst, Engineer, Intern\",\n    \"\",\n  ],\n  [\"Company\", \"Is bolded or doesn't match job title & date\", \"\"],\n  [\"Project\", \"Is bolded or doesn't match date\", \"\"],\n];\n\nconst Step3SectionsTable = ({\n  sections,\n}: {\n  sections: ResumeSectionToLines;\n}) => {\n  const table: React.ReactNode[][] = [[\"Lines\", \"Line Content\"]];\n  const trClassNames = [];\n  let lineCounter = 0;\n  const BACKGROUND_COLORS = [\n    \"bg-red-50\",\n    \"bg-yellow-50\",\n    \"bg-orange-50\",\n    \"bg-green-50\",\n    \"bg-blue-50\",\n    \"bg-purple-50\",\n  ] as const;\n  const sectionsEntries = Object.entries(sections);\n\n  const Line = ({ line }: { line: Line }) => {\n    return (\n      <>\n        {line.map((item, idx) => (\n          <span key={idx}>\n            {item.text}\n            {idx !== line.length - 1 && (\n              <span className=\"select-none font-extrabold text-sky-400\">\n                &nbsp;&nbsp;{\"|\"}&nbsp;&nbsp;\n              </span>\n            )}\n          </span>\n        ))}\n      </>\n    );\n  };\n\n  for (let i = 0; i < sectionsEntries.length; i++) {\n    const sectionBackgroundColor = BACKGROUND_COLORS[i % 6];\n    const [sectionTitle, lines] = sectionsEntries[i];\n    table.push([\n      sectionTitle === \"profile\" ? \"\" : lineCounter,\n      sectionTitle === \"profile\" ? \"PROFILE\" : sectionTitle,\n    ]);\n    trClassNames.push(`${sectionBackgroundColor} font-bold`);\n    lineCounter += 1;\n    for (let j = 0; j < lines.length; j++) {\n      table.push([lineCounter, <Line key={lineCounter} line={lines[j]} />]);\n      trClassNames.push(sectionBackgroundColor);\n      lineCounter += 1;\n    }\n  }\n\n  return (\n    <div className=\"mt-4 max-h-96 overflow-y-scroll border scrollbar scrollbar-track-gray-100 scrollbar-thumb-gray-200 scrollbar-w-3\">\n      <Table\n        table={table}\n        className=\"!border-none\"\n        trClassNames={trClassNames}\n      />\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/app/resume-parser/ResumeTable.tsx",
    "content": "import { Fragment } from \"react\";\nimport type { Resume } from \"lib/redux/types\";\nimport { initialEducation, initialWorkExperience } from \"lib/redux/resumeSlice\";\nimport { deepClone } from \"lib/deep-clone\";\nimport { cx } from \"lib/cx\";\n\nconst TableRowHeader = ({ children }: { children: React.ReactNode }) => (\n  <tr className=\"divide-x bg-gray-50\">\n    <th className=\"px-3 py-2 font-semibold\" scope=\"colgroup\" colSpan={2}>\n      {children}\n    </th>\n  </tr>\n);\n\nconst TableRow = ({\n  label,\n  value,\n  className,\n}: {\n  label: string;\n  value: string | string[];\n  className?: string | false;\n}) => (\n  <tr className={cx(\"divide-x\", className)}>\n    <th className=\"px-3 py-2 font-medium\" scope=\"row\">\n      {label}\n    </th>\n    <td className=\"w-full px-3 py-2\">\n      {typeof value === \"string\"\n        ? value\n        : value.map((x, idx) => (\n            <Fragment key={idx}>\n              • {x}\n              <br />\n            </Fragment>\n          ))}\n    </td>\n  </tr>\n);\n\nexport const ResumeTable = ({ resume }: { resume: Resume }) => {\n  const educations =\n    resume.educations.length === 0\n      ? [deepClone(initialEducation)]\n      : resume.educations;\n  const workExperiences =\n    resume.workExperiences.length === 0\n      ? [deepClone(initialWorkExperience)]\n      : resume.workExperiences;\n  const skills = [...resume.skills.descriptions];\n  const featuredSkills = resume.skills.featuredSkills\n    .filter((item) => item.skill.trim())\n    .map((item) => item.skill)\n    .join(\", \")\n    .trim();\n  if (featuredSkills) {\n    skills.unshift(featuredSkills);\n  }\n  return (\n    <table className=\"mt-2 w-full border text-sm text-gray-900\">\n      <tbody className=\"divide-y text-left align-top\">\n        <TableRowHeader>Profile</TableRowHeader>\n        <TableRow label=\"Name\" value={resume.profile.name} />\n        <TableRow label=\"Email\" value={resume.profile.email} />\n        <TableRow label=\"Phone\" value={resume.profile.phone} />\n        <TableRow label=\"Location\" value={resume.profile.location} />\n        <TableRow label=\"Link\" value={resume.profile.url} />\n        <TableRow label=\"Summary\" value={resume.profile.summary} />\n        <TableRowHeader>Education</TableRowHeader>\n        {educations.map((education, idx) => (\n          <Fragment key={idx}>\n            <TableRow label=\"School\" value={education.school} />\n            <TableRow label=\"Degree\" value={education.degree} />\n            <TableRow label=\"GPA\" value={education.gpa} />\n            <TableRow label=\"Date\" value={education.date} />\n            <TableRow\n              label=\"Descriptions\"\n              value={education.descriptions}\n              className={\n                educations.length - 1 !== 0 &&\n                idx !== educations.length - 1 &&\n                \"!border-b-4\"\n              }\n            />\n          </Fragment>\n        ))}\n        <TableRowHeader>Work Experience</TableRowHeader>\n        {workExperiences.map((workExperience, idx) => (\n          <Fragment key={idx}>\n            <TableRow label=\"Company\" value={workExperience.company} />\n            <TableRow label=\"Job Title\" value={workExperience.jobTitle} />\n            <TableRow label=\"Date\" value={workExperience.date} />\n            <TableRow\n              label=\"Descriptions\"\n              value={workExperience.descriptions}\n              className={\n                workExperiences.length - 1 !== 0 &&\n                idx !== workExperiences.length - 1 &&\n                \"!border-b-4\"\n              }\n            />\n          </Fragment>\n        ))}\n        {resume.projects.length > 0 && (\n          <TableRowHeader>Projects</TableRowHeader>\n        )}\n        {resume.projects.map((project, idx) => (\n          <Fragment key={idx}>\n            <TableRow label=\"Project\" value={project.project} />\n            <TableRow label=\"Date\" value={project.date} />\n            <TableRow\n              label=\"Descriptions\"\n              value={project.descriptions}\n              className={\n                resume.projects.length - 1 !== 0 &&\n                idx !== resume.projects.length - 1 &&\n                \"!border-b-4\"\n              }\n            />\n          </Fragment>\n        ))}\n        <TableRowHeader>Skills</TableRowHeader>\n        <TableRow label=\"Descriptions\" value={skills} />\n      </tbody>\n    </table>\n  );\n};\n"
  },
  {
    "path": "src/app/resume-parser/page.tsx",
    "content": "\"use client\";\nimport { useState, useEffect } from \"react\";\nimport { readPdf } from \"lib/parse-resume-from-pdf/read-pdf\";\nimport type { TextItems } from \"lib/parse-resume-from-pdf/types\";\nimport { groupTextItemsIntoLines } from \"lib/parse-resume-from-pdf/group-text-items-into-lines\";\nimport { groupLinesIntoSections } from \"lib/parse-resume-from-pdf/group-lines-into-sections\";\nimport { extractResumeFromSections } from \"lib/parse-resume-from-pdf/extract-resume-from-sections\";\nimport { ResumeDropzone } from \"components/ResumeDropzone\";\nimport { cx } from \"lib/cx\";\nimport { Heading, Link, Paragraph } from \"components/documentation\";\nimport { ResumeTable } from \"resume-parser/ResumeTable\";\nimport { FlexboxSpacer } from \"components/FlexboxSpacer\";\nimport { ResumeParserAlgorithmArticle } from \"resume-parser/ResumeParserAlgorithmArticle\";\n\nconst RESUME_EXAMPLES = [\n  {\n    fileUrl: \"resume-example/laverne-resume.pdf\",\n    description: (\n      <span>\n        Borrowed from University of La Verne Career Center -{\" \"}\n        <Link href=\"https://laverne.edu/careers/wp-content/uploads/sites/15/2010/12/Undergraduate-Student-Resume-Examples.pdf\">\n          Link\n        </Link>\n      </span>\n    ),\n  },\n  {\n    fileUrl: \"resume-example/openresume-resume.pdf\",\n    description: (\n      <span>\n        Created with OpenResume resume builder -{\" \"}\n        <Link href=\"/resume-builder\">Link</Link>\n      </span>\n    ),\n  },\n];\n\nconst defaultFileUrl = RESUME_EXAMPLES[0][\"fileUrl\"];\nexport default function ResumeParser() {\n  const [fileUrl, setFileUrl] = useState(defaultFileUrl);\n  const [textItems, setTextItems] = useState<TextItems>([]);\n  const lines = groupTextItemsIntoLines(textItems || []);\n  const sections = groupLinesIntoSections(lines);\n  const resume = extractResumeFromSections(sections);\n\n  useEffect(() => {\n    async function test() {\n      const textItems = await readPdf(fileUrl);\n      setTextItems(textItems);\n    }\n    test();\n  }, [fileUrl]);\n\n  return (\n    <main className=\"h-full w-full overflow-hidden\">\n      <div className=\"grid md:grid-cols-6\">\n        <div className=\"flex justify-center px-2 md:col-span-3 md:h-[calc(100vh-var(--top-nav-bar-height))] md:justify-end\">\n          <section className=\"mt-5 grow px-4 md:max-w-[600px] md:px-0\">\n            <div className=\"aspect-h-[9.5] aspect-w-7\">\n              <iframe src={`${fileUrl}#navpanes=0`} className=\"h-full w-full\" />\n            </div>\n          </section>\n          <FlexboxSpacer maxWidth={45} className=\"hidden md:block\" />\n        </div>\n        <div className=\"flex px-6 text-gray-900 md:col-span-3 md:h-[calc(100vh-var(--top-nav-bar-height))] md:overflow-y-scroll\">\n          <FlexboxSpacer maxWidth={45} className=\"hidden md:block\" />\n          <section className=\"max-w-[600px] grow\">\n            <Heading className=\"text-primary !mt-4\">\n              Resume Parser Playground\n            </Heading>\n            <Paragraph smallMarginTop={true}>\n              This playground showcases the OpenResume resume parser and its\n              ability to parse information from a resume PDF. Click around the\n              PDF examples below to observe different parsing results.\n            </Paragraph>\n            <div className=\"mt-3 flex gap-3\">\n              {RESUME_EXAMPLES.map((example, idx) => (\n                <article\n                  key={idx}\n                  className={cx(\n                    \"flex-1 cursor-pointer rounded-md border-2 px-4 py-3 shadow-sm outline-none hover:bg-gray-50 focus:bg-gray-50\",\n                    example.fileUrl === fileUrl\n                      ? \"border-blue-400\"\n                      : \"border-gray-300\"\n                  )}\n                  onClick={() => setFileUrl(example.fileUrl)}\n                  onKeyDown={(e) => {\n                    if ([\"Enter\", \" \"].includes(e.key))\n                      setFileUrl(example.fileUrl);\n                  }}\n                  tabIndex={0}\n                >\n                  <h1 className=\"font-semibold\">Resume Example {idx + 1}</h1>\n                  <p className=\"mt-2 text-sm text-gray-500\">\n                    {example.description}\n                  </p>\n                </article>\n              ))}\n            </div>\n            <Paragraph>\n              You can also{\" \"}\n              <span className=\"font-semibold\">add your resume below</span> to\n              access how well your resume would be parsed by similar Application\n              Tracking Systems (ATS) used in job applications. The more\n              information it can parse out, the better it indicates the resume\n              is well formatted and easy to read. It is beneficial to have the\n              name and email accurately parsed at the very least.\n            </Paragraph>\n            <div className=\"mt-3\">\n              <ResumeDropzone\n                onFileUrlChange={(fileUrl) =>\n                  setFileUrl(fileUrl || defaultFileUrl)\n                }\n                playgroundView={true}\n              />\n            </div>\n            <Heading level={2} className=\"!mt-[1.2em]\">\n              Resume Parsing Results\n            </Heading>\n            <ResumeTable resume={resume} />\n            <ResumeParserAlgorithmArticle\n              textItems={textItems}\n              lines={lines}\n              sections={sections}\n            />\n            <div className=\"pt-24\" />\n          </section>\n        </div>\n      </div>\n    </main>\n  );\n}\n"
  },
  {
    "path": "tailwind.config.js",
    "content": "/** @type {import('tailwindcss').Config} */\nmodule.exports = {\n  content: [\"./src/app/**/*.{ts,tsx,mdx}\"],\n  theme: {\n    extend: {\n      backgroundImage: {\n        dot: \"url('/assets/dots.svg')\",\n      },\n    },\n  },\n  corePlugins: {\n    aspectRatio: false,\n  },\n  plugins: [\n    require(\"tailwind-scrollbar\")({ nocompatible: true }),\n    require(\"@tailwindcss/aspect-ratio\"),\n  ],\n};\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"es5\",\n    \"lib\": [\"dom\", \"dom.iterable\", \"esnext\"],\n    \"allowJs\": true,\n    \"skipLibCheck\": true,\n    \"strict\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"noEmit\": true,\n    \"esModuleInterop\": true,\n    \"module\": \"esnext\",\n    \"moduleResolution\": \"node\",\n    \"resolveJsonModule\": true,\n    \"isolatedModules\": true,\n    \"jsx\": \"preserve\",\n    \"incremental\": true,\n    \"plugins\": [\n      {\n        \"name\": \"next\"\n      }\n    ],\n    \"baseUrl\": \"./src/app\",\n    // Path Mapping Doc: https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping\n    \"paths\": {\n      \"public/*\": [\"../../public/*\"],\n      \"*\": [\"*\"]\n    }\n  },\n  \"include\": [\"next-env.d.ts\", \"**/*.ts\", \"**/*.tsx\", \".next/types/**/*.ts\"],\n  \"exclude\": [\"node_modules\"]\n}\n"
  }
]