commit 593bbd888faab62c69f309f35d3c98f1b6e4350b Author: John Coffey Date: Tue Sep 8 23:26:22 2026 -0700 Long Range Scan: the 1971 galaxy, on the terminal it was written for An independent rebuild of the 1971 starship patrol game. Eight by eight quadrants of eight by eight sectors, three digits a quadrant on the chart, courses round a nine-point compass, and a stardate clock that is the real opponent. The name and the nouns are ours and NOTICE.md says why: the mechanics are free to rebuild, the trademarks are not. Raiders rather than the enemy from the television programme, beams rather than the energy weapon, and every sentence the machine prints written for this project rather than borrowed from a listing. This is the 1971 skin only -- paper, ink and a print head. The remaster and the synth come next, and the tokens and the structured transcript are already shaped for them. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..570f20e --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +# The scores service writes its database here in development. +data +*.db +*.db-shm +*.db-wal diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..be3f7b2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/NOTICE.md b/NOTICE.md new file mode 100644 index 0000000..03a3302 --- /dev/null +++ b/NOTICE.md @@ -0,0 +1,116 @@ +# Notice, credits and provenance + +## What this is + +An independent reimplementation of the starship patrol game that went round +timesharing systems from 1971 and then every home computer of the following +decade, written from scratch in TypeScript in 2026. + +## Credit where it is due + +- **Mike Mayfield**, 1971 — wrote the original, on a Sigma 7 at a college in + California, in BASIC, for a machine with no screen. An eight by eight + galaxy of eight by eight sectors, searched three digits at a time, is his + idea and it is a very good one. +- **David Ahl** and **Creative Computing**, who carried the version most + people actually met, in the type-in book that put a hundred games on a + hundred thousand desks. +- Every university terminal room and school computer club that passed it + along, which is how it got everywhere. + +This project is not affiliated with or endorsed by anyone connected to the +original, or with any television programme. No original source code was used, +consulted or copied. + +## Why it is not called what you expect + +The 1971 game and its descendants borrowed their setting, and their nouns, +from a television series. Those nouns are live trademarks belonging to a +company that enforces them, and this is a public site with somebody's name on +the footer. + +So the mechanics are rebuilt and the vocabulary is ours: + +| The original's | Ours | +| --- | --- | +| the ship, the fleet, the enemy | your ship, the Fleet, raiders | +| the energy weapon | beams | +| the guided weapon | torpedoes | +| starbase, shields, warp, damage control, stardate | kept — generic to the whole genre, and to science fiction generally | + +None of that is a copyright question. Game mechanics are ideas rather than +expression, and nobody gets to fence off an eight by eight grid. Names are a +trademark question, which is a different thing entirely: it is about whether +a reader would think this came from them. Calling it *Long Range Scan* and +naming the enemy *raiders* answers that, and costs the game nothing — the +three digits on the chart are what anybody actually remembers. + +## How this code came to exist + +Clean-room, and worth being specific about because it is what makes the +licence below meaningful: + +- **The rules are not ours to own, and we use them freely.** Sixty-four + quadrants of sixty-four sectors, three digits a quadrant, courses 1 to 9 + round the compass, warp 1 for eight sectors, energy that is also your + shields, eight devices that break. All of it is arithmetic that has been in + print since 1978. +- **The constants are reconstructed from behaviour, not copied from a + listing.** How much a warp costs, how hard a raider hits at range, how long + a repair takes — these are in `src/game/constants.ts`, each with the + reasoning next to it, and the places where a judgement call was needed are + marked as judgement calls. +- **The artwork is ours.** There are no imported assets of any kind. The one + drawing in the repository is `public/favicon.svg`, which is a scan grid. + +## The words on screen are ours, deliberately + +This is the part worth reading, because the obvious thing to do was the wrong +thing. + +The published listings have memorable lines in them. Those sentences are +their authors' writing, not a rule and not a fact — and a project released +under a copyleft licence has no business licensing words it did not write. +The two sibling games make exactly this argument in their own NOTICE files; +this one never shipped with anybody else's wording. + +So every line the machine prints here was written for this project, and they +live together in `src/game/constants.ts` where they can be checked. They are +shouted because the terminal had no lower case, not because we are shouting. + +Two things are not original, and neither is a copyright question: + +- **`COMMAND ?`, `COURSE (1-9) ?`, `WARP FACTOR (0-8) ?`.** These are the only + sensible words for what they ask, and asking them one at a time is what a + printing terminal forces on you rather than a style anybody chose. +- **The three-digit quadrant code.** `205` meaning two raiders, no starbase + and five stars is a fact about an encoding. There is no expression in it to + own, and changing it would break the one piece of shared literacy this + genre has. + +## One rule that is ours + +The original ends when the clock does. So does this. What is new is the +frame: one to four captains fly one patrol each, in turn, and are ranked +against each other and against the shared board — raiders destroyed, then +days left, then torpedoes unfired. The reasoning is in `src/game/reducer.ts`. + +## Licence + +Copyright (C) 2026 John Coffey. + +This program is free software: you can redistribute it and/or modify it under +the terms of the **GNU Affero General Public License** as published by the Free +Software Foundation, either version 3 of the License, or (at your option) any +later version — see [LICENSE](LICENSE). + +AGPL rather than plain GPL because the leaderboard is a network service: §13 +means anyone who runs a modified copy of this for other people over a network +has to offer them its source. Running the game without the scores service is +entirely supported and imposes nothing extra. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + +*None of the above is legal advice.* diff --git a/README.md b/README.md new file mode 100644 index 0000000..45564c7 --- /dev/null +++ b/README.md @@ -0,0 +1,91 @@ +# Long Range Scan + +A browser recreation of the 1971 starship patrol game — the one you played on +a printing terminal, hunting through sixty-four quadrants by reading three +digits at a time. + +It is called *Long Range Scan* rather than the name you are thinking of, and +[NOTICE.md](NOTICE.md) explains why at length. The short version: the rules +are free to rebuild and the trademarks are not, so the mechanics are exact +and the vocabulary is ours. + +React + TypeScript + Vite, and not one binary asset. + +## Playing + +``` +npm install +npm run dev +``` + +The leaderboard is a separate service; run +[games-scores](https://github.com/Coffey-Labs/games-scores) alongside this if +you want one, or do not, and the board will say so rather than break. + +You dial in rather than switch on, because in 1971 the game was not on your +machine — it was on somebody else's, down a telephone line. + +One to four captains share the keyboard, hot-seat style. A turn is one whole +patrol rather than one command: you fly yours until the raiders are gone or +something ends you, and only then does the next captain sit down. Each gets +their own galaxy, dealt off the same seed. + +- The galaxy is **eight by eight quadrants**, each of **eight by eight + sectors**. A long range scan reads three digits per quadrant — raiders, + starbases, stars — so `205` is two raiders, no base and five stars. + Reading those is the whole game. +- **Courses run 1 to 9** anticlockwise: 1 along the row, 3 up, 5 back, 7 + down, and 9 is 1 again so that 8.5 has somewhere to go. **Warp 1 is eight + sectors.** +- **3000 units of energy and ten torpedoes.** Energy moves you, fires the + beams, and fills the shields; it is all one pool, and that is the entire + economy of the game. +- **Eight devices can break** when you are hit. Damage control only works + while you fly, which is why a hurt ship has to keep moving. +- **Moor beside a starbase** and you are full again — tanks, racks, and a day + of repairs. There are rarely more than three or four in a galaxy. +- **A raider hits harder the closer it is, and spends itself doing it.** Sit + at range and you take less and give less. Close in and it is settled either + way in two exchanges. +- **A torpedo goes where it is pointed and nowhere else.** A star swallows + it. So does your own starbase, and that ends the patrol in the worst way + there is. +- The clock is the real opponent. Twenty-five to thirty-five days, and + sixty-four quadrants to look in. + +## High scores + +One board, shared by everybody. Ending a session posts every captain in the +party, and the top 50 comes back ranked best first: raiders destroyed, then +days left on the orders, then torpedoes still in the racks. + +There is no way to clear it. A captain leaves the list only by being pushed +off the bottom by a better one. + +## What is not built yet + +- **The remaster.** The 1971 skin is the machine as it was: paper, ink, and a + print head. The cel-shaded tactical view is next, and everything is already + shaped for it — every colour is a token, the transcript is structured data + rather than strings on a page, and `Line.kind` is what the map will read. +- **Sound.** The synth arrives with the remaster. The dial-up boot in + `screens.tsx` is already written to a schedule so it can be played rather + than only printed. +- **Registration on the shared board.** `games-scores` needs one file for + `scan` before anything posts; until then the game plays fine and the board + says it is not answering. + +## Layout + +| Path | What is in it | +| --- | --- | +| `src/game/constants.ts` | every number, and every word the machine says | +| `src/game/galaxy.ts` | the compass, the scatter, laying out a quadrant | +| `src/game/engine.ts` | the rules: warp, beams, torpedoes, being shot at | +| `src/game/reducer.ts` | phases, and the only place a turn changes hands | +| `src/components/` | the paper, the console, and the screens either side | + +`npm test` proves the parts that are arithmetic rather than judgement: that +the compass closes, that a scattered galaxy is always worth flying, that a +warp stops at the rim and short of anything in the way, and that every way a +patrol can end, ends it. diff --git a/index.html b/index.html new file mode 100644 index 0000000..8e6e78a --- /dev/null +++ b/index.html @@ -0,0 +1,143 @@ + + + + + + Long Range Scan — the 1971 starship game, in your browser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..76f2105 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,2928 @@ +{ + "name": "long-range-scan", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "long-range-scan", + "version": "0.1.0", + "license": "AGPL-3.0-or-later", + "dependencies": { + "react": "^19.2.8", + "react-dom": "^19.2.8" + }, + "devDependencies": { + "@types/node": "^24.13.3", + "@types/react": "^19.2.18", + "@types/react-dom": "^19.2.4", + "@vitejs/plugin-react": "^6.1.0", + "oxlint": "^1.79.0", + "typescript": "~6.0.2", + "vite": "^8.2.2", + "vitest": "^3.2.7" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@napi-rs/lzma-linux-x64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", + "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.148.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.148.0.tgz", + "integrity": "sha512-Nm4s/jB+4FpFsPhWGEC4h7rzksesmtnMXomo6rCMcg/b8zLQuOziRgkCS1fxDCXOlJB/6Q8oABOZ/OP6RIPj9A==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@oxlint/binding-android-arm-eabi": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm-eabi/-/binding-android-arm-eabi-1.82.0.tgz", + "integrity": "sha512-a3LB+C5Dsj5b/qtmG/mv5WrzuiXEpg1KF5nXWcEvaoN5TYAqkIvxPOwTPp3Jy/FoGpRo8zsTFhMElMXfeoOEzA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-android-arm64": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm64/-/binding-android-arm64-1.82.0.tgz", + "integrity": "sha512-OBlhRgNqFblGpGenno/aqOfJLOkQ2B8Ig3iDAalfn0H8hJGZKXPeexCRTDm6uwv6YUjSA9Xnwt1y/Bgj5ZH8uw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-darwin-arm64": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-arm64/-/binding-darwin-arm64-1.82.0.tgz", + "integrity": "sha512-dsopxqtY5ZdyT9uLHyGt1SyiLop6hi7hWI3PKpePodkRQOkLaCm+OE4fR9CAz9qdfjiFO8531tX/QDyP/psjFg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-darwin-x64": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-x64/-/binding-darwin-x64-1.82.0.tgz", + "integrity": "sha512-94Lu0SgTClKColU66g1VDuigV3HkcbkJBnTtZjGYfE8UPugaWDgKrm2icjC6HJVUYler2OXaHP/X0TBy8+CowQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-freebsd-x64": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-freebsd-x64/-/binding-freebsd-x64-1.82.0.tgz", + "integrity": "sha512-hne/V06ewhh1i0w8+l7GDNROAGCGPmyFuOwiP7YTRu0JycyStJ4785dmF8xU5p0uUwt2emvIF9vc7Xjis+cJ0g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm-gnueabihf": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.82.0.tgz", + "integrity": "sha512-aWY2xtbZf1LneW9Qsv/n2Sp8gOu74JrlQzEtj4coHX2SHFrCfhmAumaU+sI/A5nr+yoTRTSmI/pL2s6ADlNSkw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm-musleabihf": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-1.82.0.tgz", + "integrity": "sha512-Fe+TtXCXMh/5f7kWlZ2VAwsMumZWtraFlKVk1NJlL52/beGwfDE7ov+/8gVirHzWokzGu7X65hSPq0ucPDskWQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm64-gnu": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.82.0.tgz", + "integrity": "sha512-6azCZ6OJudlvipNttXCCQcyeFfcJ/NvUZdSN1z8elo73kCHtyQC7WTiUcSjWYvJ1jaq9KDUyMAoAS/vNzhBomA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm64-musl": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.82.0.tgz", + "integrity": "sha512-PLEaSD8IAIIlwW4dwOd9YaxuxeOpwiXL4J24rcnE4iNtyM5j9Q9/3+gti08oXpx0u2ygNjRDx9xjWWpQonuJEw==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-ppc64-gnu": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.82.0.tgz", + "integrity": "sha512-D94em/BwknNTn4vqxjHh5wb2oL566eFhArabqKIr0cNZMHOJuiraFp1A8tXpH05bbE5tqwEfLXTI0MWEGtn3Dw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-riscv64-gnu": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-1.82.0.tgz", + "integrity": "sha512-MOprxBaoYU2D4VgxXCl3ghydThWtx7Um1lL51kGYNeQ5Al7WzsH7/tqGdNtbLrIWnjq3bsm13+nz/gRIxjrOXw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-riscv64-musl": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-1.82.0.tgz", + "integrity": "sha512-5h55QsfJ/luDXZzC20k6SNOY1Az+dCP9WvntKtcUWh2JhckAdwApY2ZusaBTwLENnReXU+A2fJtSrYvZJNKNPg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-s390x-gnu": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.82.0.tgz", + "integrity": "sha512-IE8NJNLlHr0CaXyGJPGVn0eTkUyoj1I2UfA8x7I4PSOYKsQ/6btVC7Pywrj5onk0cMH25r6Z38SoN3AvE5Zuog==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-x64-gnu": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.82.0.tgz", + "integrity": "sha512-XUUUxaBo9XKl+J1B9EmP1cTGQPddzeURvoGkfwh/94PGnbW+hBprDljneoI2M1jzC1bzrIV3ihc7iM9UXl8+tg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-x64-musl": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-musl/-/binding-linux-x64-musl-1.82.0.tgz", + "integrity": "sha512-SWLSFulX9TDuH6yvbPYp4+VNn6jkkIvvI+KiujDM5rWBRHEfkesCC/pCneIIUr6ovkxZ5fRtpi2v5Cz5FrMJZg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-openharmony-arm64": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-openharmony-arm64/-/binding-openharmony-arm64-1.82.0.tgz", + "integrity": "sha512-BQy35f6ZUdNr9a6c7B7orxQTcLjByGT2z3WAgmRovpRwmPYAaJ+NTplmMzhdjdJ4qSchfMNZy/Ukg+qRg6zseQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-arm64-msvc": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.82.0.tgz", + "integrity": "sha512-V4QhSTg5gctZue8RJjsGi7NpQPThr/p1/HfmiMC5kfe1KFEup9SQRVub4A6kijQjdHfxj7bLL1KO3QO7/5bwMQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-ia32-msvc": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.82.0.tgz", + "integrity": "sha512-TUSCLaKB2yktpFAJ/r3HAUYsaV/3DT7JS4iNKyoh3a9YNwD0UG7Ezh4D8m23654vQcU6P/RQrCAjRPKe4peP/A==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-x64-msvc": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.82.0.tgz", + "integrity": "sha512-VTVoRIWJTb+wvUX8EYoPArfFH02whuR10goFXE/LHRRX33ajRrFgqbcONXZMiF4C5rnattfkm87HqYn8jb8hmQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.7.tgz", + "integrity": "sha512-EypzgnYCwyVY4NDHKzGmNJT5b+XaQEBniHxsMdeIQLB/tcCzZnhqrzHpZFbX9iaxx+5RiB8caATBtfvZP7zVxQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.7.tgz", + "integrity": "sha512-l17HE9EweWaqJZhuUuNBN/FzM62xw+DECVnJyvMsxn8vJFAGLy5QfLDoYAcronkAN8VxKZHezDpulHDPx95vFw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.7.tgz", + "integrity": "sha512-8ED8ELFvHXc6OCETIn4gXObPiaR6bckM/ipXtbzlPVDRMBfEGjCKgO90F9YtfdpDatVx/ZQw7aZ1vUMf/+T3Mw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.7.tgz", + "integrity": "sha512-/WPripjtiAIZ2tWY7ddijORT0Ujg87wxWW/qcoFVCKAWVDPhtY0xr7Dj0M3GyNGz60jGwTElhro/mkF9dT7dDQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.7.tgz", + "integrity": "sha512-14DI4NcqpvbICxSnGLx3PmtDaWqRP/KGSGb6C+JLLVPeZRl6dKdHba3pGsqT3vpdTqhEYIPG0MMQ8c0xYqoJxA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.7.tgz", + "integrity": "sha512-bxrWIRvHWQvbJwi+VIie/kDJmQxcNE6xxWwZdqF/ExVAigtHkv54WTLQPb+QsZdnFy18fg7JPfWGL0RH6vwIlQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.7.tgz", + "integrity": "sha512-toOY2BChBZyuxU7OYX6Tn389di4IzAqPTycVcci0O7FSfBqzRB3RZn+K5Is6ANf4tmgRd/K1yZTsNTXbkXsnLg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.7.tgz", + "integrity": "sha512-lAIXTH/aiLRLxsTgQvfhjo4K1ydWIp00+V0voOr9beb/9ZmkUFrSIb03dXNFRgMNvkE6oGsF10ioQ6UsI+vS5Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.7.tgz", + "integrity": "sha512-kdnwS28Pkenp/mZMRwjXXXwxQ7pIsm+bF919LUK93BOyhcLsrVKdP2p9fxpiPNPAbNuch8ypQt0pm2P2LYCAGg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.7.tgz", + "integrity": "sha512-516OdsyLdr5E65paF3yBF55t8mfm9+gmtCsK3xI7XKXIT7EfRlHhxL8K/NR6Hu8BWSgF5+1w74lTL0+nxcc8Qw==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.7.tgz", + "integrity": "sha512-r8/z8n7GFaYRln3xmP1Cxy0HH/HLM0uBUPkEuSVEfKGDA89M0FsZRZJRSwe/tJjRx+fpH/gjorfhB8tmEbSFLA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.7.tgz", + "integrity": "sha512-pAsE8iiDxUg1xBqdhrTfg45AVDVpirjz00sblEYClGNNcMnDb+e8beQgqIAw6LvauX/APvgxUnwrgun/YYGBhw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.7.tgz", + "integrity": "sha512-lTcIYmmnQQA8Or/2DatS6oSqcdLHvendjS+zLu+FwgToynWMRSmQdpM65fTANJgIS4mjbMOo5KT2lnT9SAb96w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.7.tgz", + "integrity": "sha512-e3Gu3WxbNk/UqQhxqU7YIYO+9ZBvWNz3U+h/qRFosscMFzdRPbXYSaSWgSnklv2fz1TgzBTcti2z35c/7irsHw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.7.tgz", + "integrity": "sha512-W/jg5qoRSqjsEv0+dZi4e687mcHqmVuU0P4fK6qS/xjetW2Gmc1W8j//z5nAeNcC8Ttm0hV46IjcYeuVwYhuiw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.63.1.tgz", + "integrity": "sha512-UZ8sUxPTiHWYX9QNdJedb1kDZSpS1t/VPWBWGSgqHNi9w3Cu6IXvu2mzbhiTiPvtrqgTQJ+zqiAq2iPIPilpaQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.63.1.tgz", + "integrity": "sha512-cQ4nFQABN5cDvDpbvJ7bMStCpnaVxynZrRMfUJYgxcIk9Sh54FIO1vtfkg0B69REjER77ioZ/ov+eAApx/KmLQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.63.1.tgz", + "integrity": "sha512-FQNqd1lRy/0QhDk3xeRIkSBiCpXCiDnZO3YLVdcDKN1UBiKToNftCzcXYNLshmPDUMlu2TdeS8tGcsU6f3YF1Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.63.1.tgz", + "integrity": "sha512-pvD16V939D3CloK0+qikpGaxiPrDUXTe7Y5cWOMkMSy7m1cawa8EGy/kXYi/G/cKAC4HDAbSnzCIk1WmsoOKXg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.63.1.tgz", + "integrity": "sha512-pcFGeL2345VwdTnJhA6zLbew+YgWB0qBG2+dMtXjCicf6+rm6kO6cOoh5VnTe0ZMrMRgRyuHmCJxZWrIdzYuOw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.63.1.tgz", + "integrity": "sha512-mRJlqSRulVzcKq/LKA6ICSIc3K/l4fzlVn/gePn2nXIHy8seRi5z/eeRE0d/XMBxcMldiXtQTSpRj0tkkC3g8Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.63.1.tgz", + "integrity": "sha512-YDUNvVM85TI3g/1OpnqKP1h4NeW/j64DfWMf+G3M809xNk1bJSnpFp4sh83NpmVE5DXnkh8ULor4LTVZKoYLHw==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.63.1.tgz", + "integrity": "sha512-7Mcn71p9ZuQFAj+h+dhQXy/yeLePRS2yKRnmW1DijA9thKO5qap0GNOIQK4yQ6iP3SU0Mrb/yWo8h8vgRba8lw==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.63.1.tgz", + "integrity": "sha512-4YiLQTX6U4CSl0L9cluep9A9W6UmTfqBDc2/CH6wlu54pl4E7Jn3cOD8oxzvBDEGk/JMKgJ47C8g+radF7mwvg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.63.1.tgz", + "integrity": "sha512-2ra8F7w8OquwZN9z2/fKFnli69wa8PLwaVzRMIPGb13ByMJwC28Fbp8YcVGoUhlYMTt7j5j9bNgpysrN2UM+vw==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.63.1.tgz", + "integrity": "sha512-Sy20ncyhjmBP0Ml+UvQbimjlk6VFgjW5uNP+qqwHB00mTE8Bl2C1TuHTlRwK2YoXeZbee5lP2XevBWVkAQAtSQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.63.1.tgz", + "integrity": "sha512-noITLp8oNjYliPnGWmLyelIHwULGqbHloQHGw1rtxbWhTuWooRpnZarZQJ1y9EUC4szuCusCc+HEpUtxpIwYvA==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.63.1.tgz", + "integrity": "sha512-hlxxXd+F1mWiAcaFR7Sv9ZQT6m6UfI8+Vy/kFJzztq2pDMU/0wZ9sish0iszNZvsQDo8Gc0i5yuFEOz5dDf6fA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.63.1.tgz", + "integrity": "sha512-EF7OpqQTQ/BvGqLzUi4rEHuagCV9MugAUXSHemwPW5vxZ75RR+jxO/2j95Ph2dalMpFHSVECjRoioHZgA9zOYA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.63.1.tgz", + "integrity": "sha512-wQO3JesW9PRkwlabQ27y7sPfVOOTLRG73I4F2UYHG5PXun3J9U3y+b7ezVKSYbsvSKGQ1k1cq8Qlun4C9kLt3w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.63.1.tgz", + "integrity": "sha512-ouAGwhO6wHRXdnOVCOsB0tRFkA7nhNB2Nwax6oECXN0YiN8EYUTBAOudADOB1PI+yDL61TeNx/u7MVCzksNbkQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.63.1.tgz", + "integrity": "sha512-q2R38Sn+1J8RxhfJ+T54wSWmyKXWec+9jgDfqO2AtArEqHO5R2aeayp5H5OYLr5UYDVGsVaZPEFUooMhYCdz5A==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.63.1.tgz", + "integrity": "sha512-gfI5T24WLLuFfSKw7Go/zDXjAAV0fny0swTaDv+WjK7vqcw4cRhFfdsyKL1n+ukI+ooBxn3bVQnyrn06WpI50w==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.63.1.tgz", + "integrity": "sha512-4h6XqthmB4Hspji84wvgk+ElodTsGj+dbZqHJHHtKxj4mYq0ANSEEPX9ys3moJueqsRjwpaJYH7874Itwnj2ow==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.63.1.tgz", + "integrity": "sha512-dlfCOa87o1VAYegLQ9EKilx2JCeRofiyPGhTCmqnuXZ6bMPiycO1rq1+sKoulAp7pGLIsTIw+1x5R+zgh5LhhA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.63.1.tgz", + "integrity": "sha512-cjkLbOlfcm3QGhMM1J5zaZjsw1GggbN6rw9UTSSRrPrR1KkcXnN7Uq9rPw34xImQ9VOY9GN+6u2Zj80B9ptkcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.63.1.tgz", + "integrity": "sha512-Li1KdUnWGE4N3e1F/B4RTB1ms+nG4WBgjByO46pkeBVX/2UBsY53xf5vK9WygVmnH3RwncIST7lkSdLSY6P9lg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.63.1.tgz", + "integrity": "sha512-t4ZYOSoLTgwhuFMrmTMLx/+i1DQVK7HYqMc6kY46EApwi8X0nIVphzdNoThU3xt6n+N5urG1/gxBdCaKDLavfg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.63.1.tgz", + "integrity": "sha512-RgroPfMmKlD1RzSDxvwgcPiy2HNQKoYV7OmwIXDsk73uKW5t6B/V8KIy27SMv/FNXFo/oSBtWc9J0X7t91ezZg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.63.1.tgz", + "integrity": "sha512-at8QVep6S3h5Y6gSbdGU06bRY5WJkf6WUduM9YtvYMbYhB1MOFfUgc6kehitQXzOtMSaT70q7f9ydPhpqu821w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "24.13.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.13.3.tgz", + "integrity": "sha512-Dh8vAsV36ig5wa9OX4pXvMc9D3Veibfw2wix0CUwYODLD8nkj9UsLjASr49nPg+2eKzxhBV+v7L8pXvT4e639Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.18.0" + } + }, + "node_modules/@types/react": { + "version": "19.2.18", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.18.tgz", + "integrity": "sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.2.7", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.7.tgz", + "integrity": "sha512-I8bPpDLcHBv1qiIiXDCy71Rt8eQDKJP0sMSWJphDdAcdqiJ1sGpZamavoEIRZmYzjia9LuEb2HlYdDpmoENpvQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.2.0" + } + }, + "node_modules/@vitejs/plugin-react": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.1.1.tgz", + "integrity": "sha512-yxLaQV9gkhS8ezJqCM6+ndU7mDY6gqAg75NQ+0IjwEI8IYOmQCgkRwHKVSfWXW076DsqMo0Dk+0FK1U+M5RgFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rolldown/pluginutils": "^1.0.1" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "peerDependencies": { + "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0", + "babel-plugin-react-compiler": "^1.0.0", + "oxc-transform-react": "^0.145.0", + "vite": "^8.0.0" + }, + "peerDependenciesMeta": { + "@rolldown/plugin-babel": { + "optional": true + }, + "babel-plugin-react-compiler": { + "optional": true + }, + "oxc-transform-react": { + "optional": true + } + } + }, + "node_modules/@vitest/expect": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.2.7.tgz", + "integrity": "sha512-E8eBXaKibuvH2pSZErOjdVb5vF4PbKYcrnluBTYxEk1l/VhhwZg1kZQsdtjq+CsF5CFydf2Rdkz7jDHKSisi3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/spy": "3.2.7", + "@vitest/utils": "3.2.7", + "chai": "^5.2.0", + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/pretty-format": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.2.7.tgz", + "integrity": "sha512-KUHlwqVu0sRlhCdyPdQ/wBoTfRahjUky1MubOmYw9fWfIZy1gNoHpuaaQBPAaMaVYdQYHJLurzj8ECCj5OwTqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-3.2.7.tgz", + "integrity": "sha512-sB9y4ovltoQP+WaUPwmSxO9WIg9Ig694Di5PalVPsYHklAdE027mehpWF2SQSVq+k6sFgaivbTjTJwZLSHbedA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "3.2.7", + "pathe": "^2.0.3", + "strip-literal": "^3.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-3.2.7.tgz", + "integrity": "sha512-7C+MwShwtBSI5Buwoyg3s/iY1eHL9PKAf+O1wVh/TdnjXUtkoL/9YQtre90i4MtNXM6edP1wJ2zOBpfCyhIS7g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "3.2.7", + "magic-string": "^0.30.17", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.2.7.tgz", + "integrity": "sha512-Q2eQGI6d2L/hBtZ0qNuKcAGid68XK6cv1xsoaIma6PaJhHPoqcEJhYpXZ/5myCMqkNgtP6UKuBhbc0nHKnrkuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyspy": "^4.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.2.7.tgz", + "integrity": "sha512-x6BDOd7dyo3PFLY3I9/HJ25X/6OurhGXk2/B9gOZNPF7XDVjeBK4k01lQE5uvDpbuheErh91qYuE1E2OEjK3Rw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "3.2.7", + "loupe": "^3.1.4", + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/chai": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/chai/-/chai-5.3.3.tgz", + "integrity": "sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "assertion-error": "^2.0.1", + "check-error": "^2.1.1", + "deep-eql": "^5.0.1", + "loupe": "^3.1.0", + "pathval": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/check-error": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.3.tgz", + "integrity": "sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 16" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-eql": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", + "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/es-module-lexer": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", + "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "dev": true, + "license": "MIT" + }, + "node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/js-tokens": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz", + "integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/loupe": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.2.1.tgz", + "integrity": "sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.18", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz", + "integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/oxlint": { + "version": "1.82.0", + "resolved": "https://registry.npmjs.org/oxlint/-/oxlint-1.82.0.tgz", + "integrity": "sha512-+iFM1BGw1ntYJt3QngbJmjbrGxPaKMUADOXOijpWGnYcBPq8YZnQftSS1C+pVcDYy9YxqDVJKQqQkTazTQMboQ==", + "dev": true, + "license": "MIT", + "bin": { + "oxlint": "bin/oxlint" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/oxc-project" + }, + "optionalDependencies": { + "@oxlint/binding-android-arm-eabi": "1.82.0", + "@oxlint/binding-android-arm64": "1.82.0", + "@oxlint/binding-darwin-arm64": "1.82.0", + "@oxlint/binding-darwin-x64": "1.82.0", + "@oxlint/binding-freebsd-x64": "1.82.0", + "@oxlint/binding-linux-arm-gnueabihf": "1.82.0", + "@oxlint/binding-linux-arm-musleabihf": "1.82.0", + "@oxlint/binding-linux-arm64-gnu": "1.82.0", + "@oxlint/binding-linux-arm64-musl": "1.82.0", + "@oxlint/binding-linux-ppc64-gnu": "1.82.0", + "@oxlint/binding-linux-riscv64-gnu": "1.82.0", + "@oxlint/binding-linux-riscv64-musl": "1.82.0", + "@oxlint/binding-linux-s390x-gnu": "1.82.0", + "@oxlint/binding-linux-x64-gnu": "1.82.0", + "@oxlint/binding-linux-x64-musl": "1.82.0", + "@oxlint/binding-openharmony-arm64": "1.82.0", + "@oxlint/binding-win32-arm64-msvc": "1.82.0", + "@oxlint/binding-win32-ia32-msvc": "1.82.0", + "@oxlint/binding-win32-x64-msvc": "1.82.0" + }, + "peerDependencies": { + "oxlint-tsgolint": ">=7.0.2001", + "vite-plus": "*" + }, + "peerDependenciesMeta": { + "oxlint-tsgolint": { + "optional": true + }, + "vite-plus": { + "optional": true + } + } + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/pathval": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.1.tgz", + "integrity": "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.16" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.28", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz", + "integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.18", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/react": { + "version": "19.2.8", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.8.tgz", + "integrity": "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.2.8", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.8.tgz", + "integrity": "sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.27.0" + }, + "peerDependencies": { + "react": "^19.2.8" + } + }, + "node_modules/rolldown": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.7.tgz", + "integrity": "sha512-g0EtLvBjTUB7jhyV0S/TCup3v/XSVl45vUIGbOGU4QPiyjTenCe4mKuFvW9fEgYmS2Fo42AUssRmNuMziXdrig==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.148.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.2.7", + "@rolldown/binding-android-arm64": "1.2.7", + "@rolldown/binding-darwin-arm64": "1.2.7", + "@rolldown/binding-darwin-x64": "1.2.7", + "@rolldown/binding-freebsd-x64": "1.2.7", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.7", + "@rolldown/binding-linux-arm64-gnu": "1.2.7", + "@rolldown/binding-linux-arm64-musl": "1.2.7", + "@rolldown/binding-linux-ppc64-gnu": "1.2.7", + "@rolldown/binding-linux-s390x-gnu": "1.2.7", + "@rolldown/binding-linux-x64-gnu": "1.2.7", + "@rolldown/binding-linux-x64-musl": "1.2.7", + "@rolldown/binding-openharmony-arm64": "1.2.7", + "@rolldown/binding-win32-arm64-msvc": "1.2.7", + "@rolldown/binding-win32-x64-msvc": "1.2.7" + } + }, + "node_modules/rollup": { + "version": "4.63.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.63.1.tgz", + "integrity": "sha512-3Df9jsstwhccuEfmAMi9l8XUh/GOkVObmFTU7CCVBysEbcOZLl84jCtaAZMcPiMz2EGKsATzQcU+Xr3n/wU6cg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@napi-rs/lzma-linux-x64-gnu": "1.5.1", + "@rollup/rollup-android-arm-eabi": "4.63.1", + "@rollup/rollup-android-arm64": "4.63.1", + "@rollup/rollup-darwin-arm64": "4.63.1", + "@rollup/rollup-darwin-x64": "4.63.1", + "@rollup/rollup-freebsd-arm64": "4.63.1", + "@rollup/rollup-freebsd-x64": "4.63.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.63.1", + "@rollup/rollup-linux-arm-musleabihf": "4.63.1", + "@rollup/rollup-linux-arm64-gnu": "4.63.1", + "@rollup/rollup-linux-arm64-musl": "4.63.1", + "@rollup/rollup-linux-loong64-gnu": "4.63.1", + "@rollup/rollup-linux-loong64-musl": "4.63.1", + "@rollup/rollup-linux-ppc64-gnu": "4.63.1", + "@rollup/rollup-linux-ppc64-musl": "4.63.1", + "@rollup/rollup-linux-riscv64-gnu": "4.63.1", + "@rollup/rollup-linux-riscv64-musl": "4.63.1", + "@rollup/rollup-linux-s390x-gnu": "4.63.1", + "@rollup/rollup-linux-x64-gnu": "4.63.1", + "@rollup/rollup-linux-x64-musl": "4.63.1", + "@rollup/rollup-openbsd-x64": "4.63.1", + "@rollup/rollup-openharmony-arm64": "4.63.1", + "@rollup/rollup-win32-arm64-msvc": "4.63.1", + "@rollup/rollup-win32-ia32-msvc": "4.63.1", + "@rollup/rollup-win32-x64-gnu": "4.63.1", + "@rollup/rollup-win32-x64-msvc": "4.63.1", + "fsevents": "~2.3.2" + } + }, + "node_modules/scheduler": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "license": "MIT" + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/std-env": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.10.0.tgz", + "integrity": "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==", + "dev": true, + "license": "MIT" + }, + "node_modules/strip-literal": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-3.1.0.tgz", + "integrity": "sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==", + "dev": true, + "license": "MIT", + "dependencies": { + "js-tokens": "^9.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", + "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinypool": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.1.1.tgz", + "integrity": "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.0.0 || >=20.0.0" + } + }, + "node_modules/tinyrainbow": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz", + "integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-4.0.6.tgz", + "integrity": "sha512-u8KszXvGfU68hVcZpRHKG28T0krMuv2G5nDhiHaMLen/gIuFEgIJhaJuO69qjnXg5paSrbPMFfx3brNuN8eVSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/typescript": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "7.18.2", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz", + "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/vite": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.2.2.tgz", + "integrity": "sha512-cFKLV/PRgAUlIRm5WjMjJ86jrftzpqcgH+Us+DS8mI3CDNiH30Whrz8uHL3+MOLPAgqbMBAqWdAHAphOAM+z/Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "lightningcss": "^1.33.0", + "picomatch": "^4.0.5", + "postcss": "^8.5.26", + "rolldown": "~1.2.4", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.4.0 || ^0.5.0", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vite-node": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.2.4.tgz", + "integrity": "sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.4.1", + "es-module-lexer": "^1.7.0", + "pathe": "^2.0.3", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vite-node/node_modules/vite": { + "version": "7.3.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.6.tgz", + "integrity": "sha512-4XP60spRGjSZFf1qYH+dJIkK2znL3zQfl9KkOV9MkkRR/3Dls0dxaBsQPTloEc5BLXWPL9vsOxopxyKoMmDueg==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.27.0 || ^0.28.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "lightningcss": "^1.21.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vitest": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.2.7.tgz", + "integrity": "sha512-KrxIJ62Fd89gfysR4WotlgZABiz2dqFPgqGzX7s+CwsqLFomRH7777ZcrOD6+WVAh7khPQP41A+BKbpcJFrdEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/expect": "3.2.7", + "@vitest/mocker": "3.2.7", + "@vitest/pretty-format": "^3.2.7", + "@vitest/runner": "3.2.7", + "@vitest/snapshot": "3.2.7", + "@vitest/spy": "3.2.7", + "@vitest/utils": "3.2.7", + "chai": "^5.2.0", + "debug": "^4.4.1", + "expect-type": "^1.2.1", + "magic-string": "^0.30.17", + "pathe": "^2.0.3", + "picomatch": "^4.0.2", + "std-env": "^3.9.0", + "tinybench": "^2.9.0", + "tinyexec": "^0.3.2", + "tinyglobby": "^0.2.14", + "tinypool": "^1.1.1", + "tinyrainbow": "^2.0.0", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0", + "vite-node": "3.2.4", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@types/debug": "^4.1.12", + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "@vitest/browser": "3.2.7", + "@vitest/ui": "3.2.7", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@types/debug": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/@vitest/mocker": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.2.7.tgz", + "integrity": "sha512-Trr0hYO9CM3Wj6ksWHRhK9IZpIY6wTMO5u/MqXurMxT57sWBaOPEtP3Oq60ihZuh5JsiagKfz95OcxdEP6dBrA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "3.2.7", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.17" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/vite": { + "version": "7.3.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.6.tgz", + "integrity": "sha512-4XP60spRGjSZFf1qYH+dJIkK2znL3zQfl9KkOV9MkkRR/3Dls0dxaBsQPTloEc5BLXWPL9vsOxopxyKoMmDueg==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.27.0 || ^0.28.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "lightningcss": "^1.21.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..5aee94a --- /dev/null +++ b/package.json @@ -0,0 +1,30 @@ +{ + "name": "long-range-scan", + "private": true, + "version": "0.1.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc -b && vite build", + "lint": "oxlint", + "test": "vitest run", + "preview": "vite preview" + }, + "dependencies": { + "react": "^19.2.8", + "react-dom": "^19.2.8" + }, + "devDependencies": { + "@types/node": "^24.13.3", + "@types/react": "^19.2.18", + "@types/react-dom": "^19.2.4", + "@vitejs/plugin-react": "^6.1.0", + "oxlint": "^1.79.0", + "typescript": "~6.0.2", + "vite": "^8.2.2", + "vitest": "^3.2.7" + }, + "description": "A browser recreation of the 1971 BASIC starship game, with a cel-shaded remaster.", + "license": "AGPL-3.0-or-later", + "author": "John Coffey" +} diff --git a/public/favicon.svg b/public/favicon.svg new file mode 100644 index 0000000..5efd9c8 --- /dev/null +++ b/public/favicon.svg @@ -0,0 +1,18 @@ + + + + + + + + + + 1 + 2 + 0 + 3 + + + diff --git a/src/App.css b/src/App.css new file mode 100644 index 0000000..304419c --- /dev/null +++ b/src/App.css @@ -0,0 +1,400 @@ +/* ===================================================================== + One skin so far, and it is the machine as it was. + + 1971 is a printing terminal: black ink on fanfold paper, one weight, one + family, no colour at all. Anything that wants to be emphatic has to do it + with capitals or spacing, which is exactly the constraint the original was + written under. + + Everything the skin owns is a token, so that the remaster can swap the lot + under `html[data-skin='modern']` without touching a rule below. + ===================================================================== */ + +:root { + --ink: #241f1a; + --ink-dim: #6b6157; + --ink-bright: #0d0b09; + --accent: #241f1a; + --warn: #241f1a; + --outline: #b6a992; + --screen-bg: #e8e0cc; + --screen-radius: 2px; + --paper-edge: #d6cbb2; + --glow: none; + --btn-radius: 0; + --btn-shadow: none; + --btn-bg: #f3ecd9; + --btn-fg: #241f1a; + --field-bg: #f7f1e0; + --field-fg: #241f1a; + --body-font: ui-monospace, "DejaVu Sans Mono", "Cascadia Mono", "Courier New", monospace; + --line-height: 1.42; + --letter-spacing: 0.02em; + + color-scheme: light; +} + +/* ===================================================================== + Layout + ===================================================================== */ + +.app { + flex: 1; + width: 100%; + display: flex; + align-items: center; + justify-content: center; +} + +.cabinet { + width: min(980px, 100%); + display: flex; + flex-direction: column; + gap: 12px; +} + +.bezel { + position: relative; + padding: clamp(10px, 2vw, 20px); + border-radius: calc(var(--screen-radius) + 10px); + background: #cfc4ab; + box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45); +} + +/* The platen: the roller the paper comes over, with the feed knob at the end. */ +.platen { + height: 16px; + margin: -4px 0 10px; + border-radius: 8px; + background: linear-gradient(180deg, #4a4038 0%, #2b241e 60%, #1a1512 100%); + box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.5); + position: relative; +} + +.platen::after { + content: ''; + position: absolute; + right: -10px; + top: -5px; + width: 26px; + height: 26px; + border-radius: 50%; + background: radial-gradient(circle at 35% 30%, #6b5c4d, #241f1a 70%); +} + +.screen { + position: relative; + overflow: hidden; + border-radius: var(--screen-radius); + background: var(--screen-bg); + aspect-ratio: 4 / 3; + box-shadow: var(--glow); +} + +@media (max-width: 640px) { + /* A phone is taller than it is wide; a fixed 4:3 wastes most of it. */ + .screen { + aspect-ratio: 3 / 4; + } +} + +.screen-inner { + position: absolute; + inset: 0; + display: flex; + flex-direction: column; + padding: clamp(12px, 2.6vw, 26px) 34px; + color: var(--ink); + font-family: var(--body-font); + font-size: clamp(10px, 1.45vw, 14px); + line-height: var(--line-height); + letter-spacing: var(--letter-spacing); +} + +.screen-body { + flex: 1; + min-height: 0; + display: flex; + flex-direction: column; +} + +/* Fit shrinks rather than clipping; see Frame.tsx. */ +.screen-body > * { + transform: scale(var(--fit, 1)); + transform-origin: top center; + width: 100%; +} + +.stack { + display: flex; + flex-direction: column; + gap: 2px; + width: 100%; + max-width: 72ch; + margin: 0 auto; +} + +.line { + white-space: pre-wrap; + min-height: 1.2em; +} + +.dim { + color: var(--ink-dim); +} + +/* On paper there is no colour, so emphasis is weight and spacing only. */ +.accent, +.warn { + color: var(--accent); + font-weight: 700; + letter-spacing: 0.14em; +} + +/* --- paper chrome ---------------------------------------------------- */ + +.sprockets { + position: absolute; + top: 0; + bottom: 0; + width: 22px; + background-image: radial-gradient(circle at 50% 10px, #b6a992 3.5px, transparent 4px); + background-size: 22px 26px; + background-color: var(--paper-edge); + pointer-events: none; +} + +.sprockets-left { + left: 0; + border-right: 1px dashed #c3b79e; +} + +.sprockets-right { + right: 0; + border-left: 1px dashed #c3b79e; +} + +/* Paper is not flat and not one colour; a faint fibre keeps it from reading + as a beige rectangle. */ +.paper-grain { + position: absolute; + inset: 0; + pointer-events: none; + opacity: 0.35; + background-image: + repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.025) 0 1px, transparent 1px 3px), + repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.02) 0 1px, transparent 1px 4px); +} + +/* ===================================================================== + The transcript + ===================================================================== */ + +.console { + flex: 1; + min-height: 0; + display: flex; + flex-direction: column; +} + +.paper { + flex: 1; + min-height: 0; + overflow-y: auto; + scrollbar-width: none; + display: flex; + flex-direction: column; + gap: 1px; +} + +.paper::-webkit-scrollbar { + display: none; +} + +.printed { + white-space: pre; + min-height: 1.2em; +} + +/* The print head: a block where the next character is about to land. */ +.head { + display: inline-block; + width: 0.62em; + height: 1em; + margin-left: 1px; + vertical-align: text-bottom; + background: currentColor; + opacity: 0.5; +} + +/* ===================================================================== + The prompt + ===================================================================== */ + +.prompt { + margin-top: 10px; + display: flex; + flex-direction: column; + gap: 6px; +} + +.prompt-q { + font-weight: 700; +} + +.prompt-row { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 8px; +} + +.keys { + display: flex; + flex-wrap: wrap; + gap: 2px 4px; +} + +.key { + padding: 3px 8px; + font-size: 0.9em; +} + +.statusbar { + display: flex; + flex-wrap: wrap; + gap: 6px 16px; + margin-top: 10px; + padding-top: 8px; + border-top: 1px solid var(--outline); + color: var(--ink-dim); + font-size: 0.9em; +} + +/* Condition red. On paper it can only be said louder, not redder. */ +.statusbar .senses { + color: var(--ink-bright); + font-weight: 700; + letter-spacing: 0.14em; +} + +.banner { + margin: 0; + font-family: var(--body-font); + font-weight: 900; + font-size: clamp(1.3rem, 4.4vw, 2.4rem); + letter-spacing: 0.08em; + line-height: 1.1; + color: var(--ink-bright); +} + +.field { + display: flex; + align-items: center; + gap: 10px; + margin: 3px 0; +} + +.field label { + min-width: 11ch; + color: var(--ink-dim); +} + +.field-input { + flex: 1; + max-width: 22ch; + padding: 5px 8px; + border: 2px solid var(--outline); + border-radius: var(--btn-radius); + background: var(--field-bg); + color: var(--field-fg); + font: inherit; + text-transform: uppercase; +} + +/* ===================================================================== + Buttons + ===================================================================== */ + +.btn { + padding: 6px 14px; + border: 2px solid var(--outline); + border-radius: var(--btn-radius); + background: var(--btn-bg); + color: var(--btn-fg); + font: inherit; + font-weight: 700; + letter-spacing: 0.04em; + cursor: pointer; + box-shadow: var(--btn-shadow); + text-decoration: none; + display: inline-block; +} + +.btn:disabled { + opacity: 0.45; + cursor: default; +} + +.btn-primary { + background: #241f1a; + color: #f3ecd9; +} + +.btn-ghost { + background: transparent; + color: var(--ink-dim); + border-color: transparent; + box-shadow: none; + font-weight: 600; +} + +.btn-ghost:hover:not(:disabled) { + color: var(--ink); +} + +/* The stack is a column, so a button in it stretches to the full width unless + it is told not to. A button that wide reads as a banner rather than a + control. */ +.stack > .btn { + align-self: flex-start; +} + +/* ===================================================================== + The footer + + It sits outside the frame, on the page rather than on the paper -- so it + cannot use the ink tokens, which are chosen to be dark on a light sheet. + ===================================================================== */ + +.controls { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 4px 8px; + color: #9a9186; + font-family: var(--body-font); + font-size: 12px; +} + +.controls .btn-ghost { + color: #9a9186; +} + +.controls .btn-ghost:hover:not(:disabled) { + color: #f0e8d4; +} + +/* + * The way back. The arrow is a pseudo-element rather than part of the label so + * that it can be the right arrow for the machine you are looking at: the two + * ASCII characters a printing terminal could actually strike. + */ +.controls .back::before { + content: '<-\00a0'; +} + +.seed { + margin-left: auto; + opacity: 0.7; +} diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000..b27c209 --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,298 @@ +import { useCallback, useEffect, useRef, useState, useReducer } from 'react' +import { HAIL_TEXT } from './game/constants' +import { makePatrol, randomSeed, shortRangeScan, step } from './game/engine' +import { fetchScores, submitScores, type Score } from './game/highscores' +import { makeRng, type Rng } from './game/rng' +import { currentCaptain, initialState, reducer } from './game/reducer' +import type { Command, Line } from './game/types' +import { Btn, Fit, Frame } from './components/Frame' +import { BridgeScreen } from './components/BridgeScreen' +import { + BootScreen, + GameOverScreen, + HighScoreScreen, + InstructionsScreen, + ReportScreen, + SetupScreen, + TitleScreen, + type BoardState, +} from './components/screens' +import './App.css' + +/** + * AGPL section 13: anyone playing this over a network is entitled to the + * source of the version they are playing, so the offer sits on every screen. + */ +const SOURCE_URL = 'https://github.com/Coffey-Labs/long-range-scan' + +/** + * The way back out. + * + * Absolute rather than `/`, because this game is served from a subdirectory in + * production and from the root in development -- so the relative answer is + * right in one of those and points at the game itself in the other. The + * destination is a particular site, and naming it is the honest way to say so. + * The source link next to it works the same way for the same reason. + */ +const GAMES_URL = 'https://games.jcoffey.dev/' + +export default function App() { + const [seed] = useState(randomSeed) + const [state, dispatch] = useReducer(reducer, seed, initialState) + const rng = useRef(makeRng(seed)) + const [scores, setScores] = useState([]) + const [boardState, setBoardState] = useState('loading') + const [freshScores, setFreshScores] = useState([]) + /** True while the printer is mid-line, so no prompt appears over it. */ + const [printing, setPrinting] = useState(false) + + const who = currentCaptain(state) + + const loadBoard = useCallback(async () => { + setBoardState('loading') + try { + setScores(await fetchScores()) + setBoardState('ready') + } catch { + setBoardState('error') + } + }, []) + + // ---------------------------------------------------------------- turns + + /** + * Deal a galaxy for whoever is up, and open the way the machine opened: the + * orders, then a scan, because the first thing anybody did was look. + * + * The galaxy is dealt off the same seeded stream as everything else, which + * is what makes a whole session -- four captains, four patrols -- replayable + * from the one number in the footer. + */ + const beginPatrol = useCallback(() => { + const patrol = makePatrol(rng.current) + const lines: Line[] = [ + ...HAIL_TEXT.map((text): Line => ({ kind: 'system', text })), + { + kind: 'system', + text: `${patrol.raidersLeft} RAIDERS. ${patrol.basesLeft} STARBASE${patrol.basesLeft === 1 ? '' : 'S'}. ${patrol.deadline - patrol.day} DAYS.`, + }, + ...shortRangeScan(patrol), + ] + dispatch({ type: 'BEGIN_PATROL', patrol, lines }) + }, []) + + // Whenever it is somebody's turn and there is no galaxy, deal them one. + useEffect(() => { + if (state.phase !== 'patrol' || state.patrol || !who) return + beginPatrol() + }, [state.phase, state.patrol, who, beginPatrol]) + + const command = (cmd: Command, echo: Line[]) => { + if (!state.patrol) return + const { patrol, lines } = step(state.patrol, cmd, rng.current) + dispatch({ type: 'ADVANCE', patrol, lines: [...echo, ...lines] }) + } + + // The report waits for the printer to finish saying how it ended. + useEffect(() => { + if (state.phase !== 'resolve' || printing) return + const t = window.setTimeout(() => dispatch({ type: 'SHOW_REPORT' }), 500) + return () => window.clearTimeout(t) + }, [state.phase, printing]) + + /** + * Close the books. The standings show straight away; posting to the board + * happens behind them, so a slow or missing line out never holds up the end + * of a session. + */ + const post = useCallback((captains: typeof state.captains) => { + setBoardState('loading') + submitScores( + captains.map((c) => ({ + name: c.name, + killed: c.killed, + daysLeft: c.daysLeft, + torpedoes: c.torpedoes, + ending: c.outcome, + })), + ) + .then(({ ids, scores: table }) => { + setScores(table) + setFreshScores(ids) + setBoardState('ready') + }) + .catch(() => setBoardState('error')) + }, []) + + const posted = useRef(false) + useEffect(() => { + if (state.phase !== 'gameover' || posted.current) return + posted.current = true + post(state.captains) + }, [state.phase, state.captains, post]) + + const restart = () => { + const s = randomSeed() + rng.current = makeRng(s) + posted.current = false + setFreshScores([]) + dispatch({ type: 'RESTART', seed: s }) + } + + const showScores = () => { + dispatch({ type: 'SHOW_SCORES' }) + if (boardState !== 'ready') void loadBoard() + } + + // --------------------------------------------------------------- render + + const moreToCome = state.captains.some((c) => !c.done && c.id !== who?.id) + + return ( +
+ + {/* Leftmost, because that is where a way back belongs. */} + + GAMES + + + NEW PATROL + + + SOURCE + + SEED {state.seed} +
+ } + > + {state.phase === 'boot' && dispatch({ type: 'BOOTED' })} />} + + + {state.phase === 'title' && ( + dispatch({ type: 'SHOW_SETUP' })} + onInstructions={() => dispatch({ type: 'SHOW_INSTRUCTIONS' })} + onScores={showScores} + /> + )} + + {state.phase === 'instructions' && ( + dispatch({ type: 'SHOW_SETUP' })} /> + )} + + {state.phase === 'setup' && ( + dispatch({ type: 'START', names })} /> + )} + + {(state.phase === 'patrol' || state.phase === 'resolve') && state.patrol && who && ( + dispatch({ type: 'PRINT', lines })} + /> + )} + + {state.phase === 'report' && state.patrol && who && ( + dispatch({ type: 'NEXT_TURN' })} + /> + )} + + {state.phase === 'gameover' && ( + + )} + + {state.phase === 'scores' && ( + dispatch({ type: 'CLOSE_SCORES' })} + onRetry={() => void loadBoard()} + /> + )} + + + {/* Kept out of the tree above so a re-render of the game cannot reset it. */} + + + ) +} + +/** + * Whether the machine is still typing. + * + * The prompt must not appear while a line is half printed -- the whole point + * of the printing terminal is that you read what arrived before you answer + * it. + * + * It times the characters that have just *arrived*, not the whole transcript. + * Timing the whole thing is the obvious way to write this and it is wrong in + * a way that takes a few turns to notice: `Teletype` only prints lines it has + * not printed yet, so the wait keeps growing while the actual printing stays + * the same length. A scan is not timed at all, because it lands whole. + */ +function PrintingWatcher({ + lines, + onChange, +}: { + lines: Line[] + onChange: (busy: boolean) => void +}) { + const chars = lines.reduce((n, l) => n + (l.kind === 'scan' ? 0 : l.text.length), 0) + const printed = useRef(0) + + useEffect(() => { + // A new patrol throws the transcript away; nothing is owed from the old one. + if (chars < printed.current) printed.current = 0 + + const fresh = chars - printed.current + printed.current = chars + if (fresh <= 0) { + onChange(false) + return + } + + onChange(true) + // 60 characters a second, plus a beat to read the last line. + const t = window.setTimeout(() => onChange(false), (fresh / 60) * 1000 + 120) + return () => window.clearTimeout(t) + }, [chars, onChange]) + return null +} + +/** Enter or Space takes the patrol, the way a terminal would take it. */ +function TitleGate(props: { + onStart: () => void + onInstructions: () => void + onScores: () => void +}) { + const { onStart } = props + useEffect(() => { + const onKey = (e: KeyboardEvent) => { + if (e.key === 'Enter' || e.key === ' ') onStart() + } + window.addEventListener('keydown', onKey) + return () => window.removeEventListener('keydown', onKey) + }, [onStart]) + return +} diff --git a/src/components/BridgeScreen.tsx b/src/components/BridgeScreen.tsx new file mode 100644 index 0000000..2d0a0f5 --- /dev/null +++ b/src/components/BridgeScreen.tsx @@ -0,0 +1,221 @@ +import { useEffect, useRef, useState } from 'react' +import { condition, daysLeft } from '../game/engine' +import type { Command, Line, Patrol } from '../game/types' +import { Teletype } from './Teletype' + +/** + * The console: the paper, and the one line you are allowed to type on. + * + * The original asks for a command and then asks for whatever that command + * needs, one question at a time -- COMMAND, then COURSE, then WARP FACTOR -- + * because a printing terminal has no form to fill in and no way back to a + * field you have already left. That is kept exactly, and it is why this + * component is a tiny state machine rather than a set of inputs. + */ +type Ask = 'command' | 'nav-course' | 'nav-warp' | 'tor-course' | 'beams' | 'shields' + +const QUESTION: Record = { + command: 'COMMAND', + 'nav-course': 'COURSE (1-9)', + 'nav-warp': 'WARP FACTOR (0-8)', + 'tor-course': 'TORPEDO COURSE (1-9)', + beams: 'UNITS TO FIRE', + shields: 'UNITS TO SHIELDS', +} + +/** The nine, in the order the machine lists them when asked. */ +export const COMMANDS: readonly (readonly [string, string])[] = [ + ['NAV', 'WARP SOMEWHERE ELSE'], + ['SRS', 'SHORT RANGE SCAN'], + ['LRS', 'LONG RANGE SCAN'], + ['BEA', 'FIRE THE BEAMS'], + ['TOR', 'FIRE A TORPEDO'], + ['SHE', 'PUT ENERGY IN THE SHIELDS'], + ['DAM', 'DAMAGE REPORT'], + ['COM', 'THE CHART, AND WHERE YOU ARE ON IT'], + ['XXX', 'BREAK OFF AND GO HOME'], +] + +export function BridgeScreen({ + patrol, + transcript, + captainName, + over, + onCommand, + onPrint, +}: { + patrol: Patrol + transcript: Line[] + captainName: string + /** The patrol has ended. There is nothing left to ask. */ + over: boolean + onCommand: (cmd: Command, echo: Line[]) => void + onPrint: (lines: Line[]) => void +}) { + const [ask, setAsk] = useState('command') + const [course, setCourse] = useState(0) + const [text, setText] = useState('') + const input = useRef(null) + + // The question moves on; the cursor should be waiting under it. + useEffect(() => { + input.current?.focus() + }, [ask]) + + const echo = (answer: string): Line => ({ + kind: 'system', + text: `${QUESTION[ask]} ? ${answer}`, + }) + + /** `raw` is how the command buttons answer: a click is a whole answer. */ + const submit = (raw?: string) => { + const answer = (raw ?? text).trim().toUpperCase() + if (answer === '') return + setText('') + + if (ask === 'command') { + const cmd = answer.slice(0, 3) + const known = COMMANDS.some(([id]) => id === cmd) + if (!known) { + onPrint([echo(answer), { kind: 'system', text: 'THAT IS NOT ONE OF THE NINE.' }]) + return + } + + // Two of them need more asking before anything happens. + if (cmd === 'NAV') { + onPrint([echo(answer)]) + setAsk('nav-course') + return + } + if (cmd === 'TOR') { + onPrint([echo(answer)]) + setAsk('tor-course') + return + } + if (cmd === 'BEA') { + onPrint([echo(answer)]) + setAsk('beams') + return + } + if (cmd === 'SHE') { + onPrint([echo(answer)]) + setAsk('shields') + return + } + + const simple: Record = { + SRS: { type: 'srs' }, + LRS: { type: 'lrs' }, + DAM: { type: 'damage' }, + COM: { type: 'chart' }, + XXX: { type: 'resign' }, + } + onCommand(simple[cmd]!, [echo(answer)]) + return + } + + const value = Number(answer) + if (!Number.isFinite(value)) { + onPrint([echo(answer), { kind: 'system', text: 'A NUMBER, PLEASE.' }]) + return + } + + switch (ask) { + case 'nav-course': + onPrint([echo(answer)]) + setCourse(value) + setAsk('nav-warp') + break + case 'nav-warp': + onCommand({ type: 'nav', course, warp: value }, [echo(answer)]) + setAsk('command') + break + case 'tor-course': + onCommand({ type: 'torpedo', course: value }, [echo(answer)]) + setAsk('command') + break + case 'beams': + onCommand({ type: 'beams', energy: value }, [echo(answer)]) + setAsk('command') + break + case 'shields': + onCommand({ type: 'shields', energy: value }, [echo(answer)]) + setAsk('command') + break + } + } + + return ( +
+ + + {/* + A concession, and the only one: the machine printed the ship's numbers + beside a short range scan and nowhere else, so the 1971 way to know + your energy was to remember it or spend a command asking. That is fine + on paper you can hold and unkind on a phone, where the answer has + already scrolled. The scan is still the only place the *galaxy* + appears; this strip only ever says what is true of the ship. + */} +
+ {captainName} + STARDATE {patrol.day.toFixed(1)} + DAYS {daysLeft(patrol).toFixed(1)} + ENERGY {Math.round(patrol.energy)} + SHIELDS {Math.round(patrol.shields)} + TORP {patrol.torpedoes} + RAIDERS {patrol.raidersLeft} + {condition(patrol)} +
+ + {/* + The prompt never goes away while the patrol is running, even mid-print. + Hiding it until the printer catches up is the obvious thing and it is + wrong: a terminal took type-ahead, and somebody who already knows they + want SRS should not have their keystrokes eaten because the machine is + still hammering out the last line. It cost two commands to find that + out by playing it. + */} + {!over && ( +
+
+ {QUESTION[ask]} ? + setText(e.target.value)} + onKeyDown={(e) => { + if (e.key === 'Enter') submit() + }} + aria-label={QUESTION[ask]} + autoComplete="off" + spellCheck={false} + /> +
+ + {/* + The nine, as buttons. A terminal had a keyboard and a phone does + not, and making somebody thumb-type NAV forty times is not + faithfulness, it is an obstacle the original never had. Typing + still works and is still the way it is meant to be played. + */} + {ask === 'command' && ( +
+ {COMMANDS.map(([id, what]) => ( + + ))} +
+ )} +
+ )} +
+ ) +} diff --git a/src/components/Frame.tsx b/src/components/Frame.tsx new file mode 100644 index 0000000..d108aa3 --- /dev/null +++ b/src/components/Frame.tsx @@ -0,0 +1,86 @@ +import { useLayoutEffect, useRef, useState, type ReactNode } from 'react' + +/** + * The thing the game is happening inside. + * + * 1971 is a printing terminal on the end of a telephone line, so the frame is + * a sheet of fanfold paper coming out of a machine: sprocket holes down both + * edges, a platen at the top, and no screen anywhere. When the remaster + * arrives it will bring its own frame and everything inside will be laid out + * identically -- only the box will change. + */ +export function Frame({ children, footer }: { children: ReactNode; footer?: ReactNode }) { + return ( +
+
+
+
+
{children}
+
+
+
+
+
+ {footer} +
+ ) +} + +/** + * A sheet of paper does not scroll. If the page comes out taller than the + * frame, shrink it rather than clipping it. Lifted from the sibling games, + * where the argument was about televisions and cave mouths. + */ +export function Fit({ children }: { children: ReactNode }) { + const box = useRef(null) + const [scale, setScale] = useState(1) + + useLayoutEffect(() => { + const measure = () => { + const el = box.current + const page = el?.firstElementChild as HTMLElement | null + if (!el || !page) return + // offsetHeight is the laid-out size and ignores the transform, so + // measuring here cannot feed back into itself. + const h = page.offsetHeight + const avail = el.clientHeight + setScale(h > 0 && avail > 0 ? Math.min(1, avail / h) : 1) + } + + measure() + const ro = new ResizeObserver(measure) + if (box.current) ro.observe(box.current) + if (box.current?.firstElementChild) ro.observe(box.current.firstElementChild) + return () => ro.disconnect() + }) + + return ( +
+ {children} +
+ ) +} + +export function Line({ children, className = '' }: { children?: ReactNode; className?: string }) { + return
{children ?? ' '}
+} + +export function Btn({ + children, + onClick, + kind = 'normal', + disabled, + title, +}: { + children: ReactNode + onClick: () => void + kind?: 'normal' | 'primary' | 'ghost' + disabled?: boolean + title?: string +}) { + return ( + + ) +} diff --git a/src/components/Teletype.tsx b/src/components/Teletype.tsx new file mode 100644 index 0000000..00d6886 --- /dev/null +++ b/src/components/Teletype.tsx @@ -0,0 +1,84 @@ +import { useEffect, useRef, useState } from 'react' +import type { Line } from '../game/types' + +/** + * The 1971 skin: everything the machine has said, printed. + * + * A printing terminal runs at ten characters a second and cannot take any of + * it back, so this types rather than appears, and nothing already printed + * ever changes. That is not decoration -- it is the reason the game feels the + * way it does. A short range scan arriving row by row is a different + * experience from finding the whole grid already on the page, and this game + * is eleven lines of grid arriving while something shoots at you. + * + * A scan is exempt. Eight rows of it at reading speed is most of a minute, + * and the original's printer was hammering all eight out while the captain + * was already deciding -- so the grid lands whole and the sentences type. + */ +const CPS = 60 // Faster than a real ASR-33. A real one is 10, and it is a lot. + +export function Teletype({ lines }: { lines: Line[] }) { + const [printed, setPrinted] = useState([]) + const [partial, setPartial] = useState('') + const done = useRef(0) + const paper = useRef(null) + + // A new patrol throws the old transcript away rather than scrolling it. + useEffect(() => { + if (lines.length < done.current) { + done.current = 0 + setPrinted([]) + setPartial('') + } + }, [lines.length]) + + useEffect(() => { + if (done.current >= lines.length) return + const next = lines[done.current]! + + if (next.kind === 'scan') { + done.current += 1 + setPrinted((p) => [...p, next.text]) + return + } + + const text = next.text + let at = 0 + setPartial('') + + const timer = window.setInterval(() => { + at += 1 + setPartial(text.slice(0, at)) + if (at >= text.length) { + window.clearInterval(timer) + done.current += 1 + setPartial('') + setPrinted((p) => [...p, text]) + } + }, 1000 / CPS) + + return () => window.clearInterval(timer) + // `printed` is the trigger: finishing one line starts the next. + }, [lines, printed.length]) + + // The paper feeds up; you always read at the bottom. + useEffect(() => { + paper.current?.scrollTo({ top: paper.current.scrollHeight }) + }, [printed.length, partial]) + + return ( +
+ {printed.map((text, i) => ( +
+ {text} +
+ ))} + {partial && ( +
+ {partial} + +
+ )} +
+ ) +} diff --git a/src/components/screens.tsx b/src/components/screens.tsx new file mode 100644 index 0000000..1d61dd8 --- /dev/null +++ b/src/components/screens.tsx @@ -0,0 +1,310 @@ +import { useEffect, useState } from 'react' +import { MAX_CAPTAINS, MAX_NAME, START_ENERGY, START_TORPEDOES } from '../game/constants' +import { comparePatrols, outcomeText } from '../game/engine' +import type { Score } from '../game/highscores' +import type { Captain, Patrol } from '../game/types' +import { isWin } from '../game/types' +import { COMMANDS } from './BridgeScreen' +import { Btn, Line } from './Frame' + +/** + * Everything that is not the patrol itself. These are small enough that + * keeping them in one file makes the shape of the game easier to see than + * eight files would, and none of them holds a rule. + */ + +// ------------------------------------------------------------------- boot + +/** + * Dialling in. + * + * The lemonade stand loads from cassette because that is how an Atari got its + * programs. This game is eight years older than that machine and did not live + * on a machine you owned at all -- it lived on a mainframe at the end of a + * telephone line, which you called. So the boot is a call, and it is the same + * gesture the cave game opens with for the same reason. + * + * There is no sound yet. When the remaster lands it brings the synth with it, + * and this schedule is already shaped to be played rather than only printed. + */ +const STAGES: [number, string][] = [ + [0, 'DIAL TONE'], + [1.1, 'DIALLING'], + [2.6, 'RINGING'], + [4.2, 'ANSWER TONE'], + [5.2, 'CARRIER -- 110 BAUD, FULL DUPLEX'], + [6.0, 'LOGIN ACCEPTED'], +] + +const BOOT_TOTAL = 6.8 + +export function BootScreen({ onLoaded }: { onLoaded: () => void }) { + const [dialling, setDialling] = useState(false) + const [stage, setStage] = useState(-1) + + useEffect(() => { + if (!dialling) return + + const timers = STAGES.map(([at], i) => window.setTimeout(() => setStage(i), at * 1000)) + const done = window.setTimeout(onLoaded, BOOT_TOTAL * 1000) + + return () => { + for (const t of timers) window.clearTimeout(t) + window.clearTimeout(done) + } + }, [dialling, onLoaded]) + + if (!dialling) { + return ( +
+ LONG RANGE SCAN + + THE PROGRAM IS NOT ON THIS MACHINE. IT IS ON SOMEBODY ELSE'S. + PUT THE HANDSET IN THE COUPLER AND CALL IT. + + setDialling(true)}> + DIAL + +
+ ) + } + + return ( +
+ {STAGES.slice(0, stage + 1).map(([, what], i) => ( + + {what} + + ))} +
+ ) +} + +// ------------------------------------------------------------------ title + +export function TitleScreen({ + onStart, + onInstructions, + onScores, +}: { + onStart: () => void + onInstructions: () => void + onScores: () => void +}) { + return ( +
+

LONG RANGE SCAN

+ A PATROL, A CLOCK, AND SIXTY-FOUR QUADRANTS TO SEARCH. + + RAIDERS ARE SCATTERED THROUGH THE GALAXY. YOU HAVE ONE SHIP AND NOT LONG. + +
+ + TAKE THE PATROL + + ORDERS + BOARD +
+
+ ) +} + +// ----------------------------------------------------------- instructions + +export function InstructionsScreen({ onDone }: { onDone: () => void }) { + return ( +
+ YOUR ORDERS + FIND EVERY RAIDER IN THE GALAXY AND DESTROY IT BEFORE YOUR TIME RUNS OUT. + + THE GALAXY + EIGHT BY EIGHT QUADRANTS. EACH QUADRANT IS EIGHT BY EIGHT SECTORS. + A LONG RANGE SCAN READS THREE DIGITS PER QUADRANT: RAIDERS, STARBASES, STARS. + SO 205 IS TWO RAIDERS, NO BASE AND FIVE STARS. READING THOSE IS THE GAME. + + THE SHIP + + {START_ENERGY} UNITS OF ENERGY AND {START_TORPEDOES} TORPEDOES. ENERGY MOVES YOU, FIRES + THE BEAMS AND FILLS THE SHIELDS -- IT IS ALL THE SAME POOL. + + EIGHT DEVICES CAN BE BROKEN BY A HIT. DAMAGE CONTROL WORKS ONLY WHILE YOU FLY. + MOOR NEXT TO A STARBASE AND YOU ARE FULL AGAIN. THERE ARE NOT MANY OF THEM. + + STEERING + COURSES RUN 1 TO 9 ANTICLOCKWISE. 1 IS ALONG THE ROW, 3 IS UP, 5 IS BACK, 7 IS + DOWN, AND 9 IS 1 AGAIN. WARP 1 IS EIGHT SECTORS. + + THE COMMANDS + {COMMANDS.map(([id, what]) => ( + + {id} {' '} {what} + + ))} + + + UNDERSTOOD + +
+ ) +} + +// ------------------------------------------------------------------ setup + +export function SetupScreen({ onStart }: { onStart: (names: string[]) => void }) { + const [names, setNames] = useState(['']) + + const set = (i: number, v: string) => + setNames((n) => n.map((old, j) => (j === i ? v.slice(0, MAX_NAME) : old))) + + return ( +
+ WHO IS FLYING? + EACH CAPTAIN GETS THEIR OWN GALAXY. YOU TAKE IT IN TURNS. + + {names.map((name, i) => ( +
+ + set(i, e.target.value)} + /> +
+ ))} + +
+ {names.length < MAX_CAPTAINS && ( + setNames((n) => [...n, ''])}>ONE MORE + )} + onStart(names)}> + CAST OFF + +
+
+ ) +} + +// ----------------------------------------------------------------- report + +/** The end of one captain's patrol, before the next one sits down. */ +export function ReportScreen({ + patrol, + captain, + moreToCome, + onNext, +}: { + patrol: Patrol + captain: Captain + moreToCome: boolean + onNext: () => void +}) { + const won = isWin(patrol.outcome) + return ( +
+ + {patrol.outcome ? outcomeText(patrol.outcome) : ''} + + + + {captain.name} — {captain.killed} DESTROYED, {captain.daysLeft.toFixed(1)} DAYS LEFT,{' '} + {captain.torpedoes} TORPEDO{captain.torpedoes === 1 ? '' : 'ES'} + + + {patrol.raidersLeft} RAIDER{patrol.raidersLeft === 1 ? '' : 'S'} STILL OUT THERE. + + + + {moreToCome ? 'NEXT CAPTAIN' : 'THAT IS THAT'} + +
+ ) +} + +// --------------------------------------------------------------- standings + +export function GameOverScreen({ + captains, + onRestart, + onScores, +}: { + captains: Captain[] + onRestart: () => void + onScores: () => void +}) { + const ranked = [...captains].sort(comparePatrols) + const anyWon = captains.some((c) => isWin(c.outcome)) + return ( +
+ + {anyWon ? 'THE FLEET IS SATISFIED.' : 'THE RAIDERS ARE STILL OUT THERE.'} + + + {ranked.map((c, i) => ( + + {String(i + 1).padStart(2)}. {c.name.padEnd(MAX_NAME)}{' '} + {String(c.killed).padStart(2)} KILLED {c.daysLeft.toFixed(1).padStart(5)} DAYS{' '} + {String(c.torpedoes).padStart(2)} TORP + + ))} + +
+ + AGAIN + + BOARD +
+
+ ) +} + +// ------------------------------------------------------------------- board + +export type BoardState = 'loading' | 'ready' | 'error' + +export function HighScoreScreen({ + scores, + state, + highlight, + onBack, + onRetry, +}: { + scores: Score[] + state: BoardState + highlight: string[] + onBack: () => void + onRetry: () => void +}) { + return ( +
+ THE BOARD + RANKED ON RAIDERS DESTROYED, THEN DAYS LEFT, THEN TORPEDOES. + + {state === 'loading' && ASKING THE MACHINE...} + {state === 'error' && ( + <> + {/* The game is entirely playable without the board, and says so + rather than pretending the patrol did not happen. */} + THE BOARD IS NOT ANSWERING. YOUR PATROL STILL COUNTED. + + TRY AGAIN + + )} + {state === 'ready' && scores.length === 0 && NOBODY HAS REPORTED IN YET.} + {state === 'ready' && + scores.map((s, i) => ( + + {String(i + 1).padStart(2)}. {s.name.padEnd(MAX_NAME)}{' '} + {String(s.killed).padStart(2)} {s.daysLeft.toFixed(1).padStart(5)}{' '} + {String(s.torpedoes).padStart(2)} + + ))} + + + BACK + +
+ ) +} diff --git a/src/game/constants.ts b/src/game/constants.ts new file mode 100644 index 0000000..0c3be2a --- /dev/null +++ b/src/game/constants.ts @@ -0,0 +1,133 @@ +/** + * The numbers, all of them, in one place. + * + * The 1971 game is arithmetic where Hunt the Wumpus is arrangement: almost + * everything here is a constant somebody typed into a BASIC listing, and the + * feel of the game is those constants rather than any one rule. They are + * reconstructed from the published behaviour of the 1978 type-in -- how much + * a warp costs, how hard a raider hits at range, how long a repair takes -- + * and the places where a judgement call was needed are marked. + */ + +/** Quadrants across the galaxy, and sectors across a quadrant. Both 8. */ +export const GALAXY = 8 +export const SECTORS = 8 + +export const START_ENERGY = 3000 +export const START_TORPEDOES = 10 + +/** A patrol is short. That is the whole tension: the clock, not the shooting. */ +export const MIN_DAYS = 25 +export const MAX_EXTRA_DAYS = 10 + +/** + * How thickly raiders are scattered, quadrant by quadrant. A roll over 0.98 + * puts three in one quadrant, which is very nearly a death sentence to warp + * into and is meant to be. + */ +export const RAIDER_ODDS: readonly (readonly [number, number])[] = [ + [0.98, 3], + [0.95, 2], + [0.8, 1], +] + +/** A starbase is rare. Most quadrants have nowhere to refit. */ +export const BASE_ODDS = 0.96 + +/** Stars per quadrant: one to eight, and they block everything. */ +export const MAX_STARS = 8 + +export const RAIDER_ENERGY = 200 +/** Spread, so two raiders are never quite the same fight. */ +export const RAIDER_ENERGY_SPREAD = 200 + +/** + * What a warp costs: one unit per sector crossed, plus ten to light the + * engines. That looks far too cheap until you notice where energy actually + * goes -- into the beams and into the shields. Crossing the galaxy is not the + * expensive thing. Arriving somewhere with raiders in it is. + */ +export const WARP_COST_PER_SECTOR = 1 +export const WARP_COST_FIXED = 10 + +/** Warp engines out means you crawl: two-tenths, and no further. */ +export const CRIPPLED_WARP = 0.2 +export const MAX_WARP = 8 + +/** Below this, a beam does not get through the raider's own shields. */ +export const BEAM_FLOOR = 0.15 + +/** Days of repair a hit costs a device, before the roll that softens it. */ +export const DAMAGE_DAYS = 6 +export const DAMAGE_CHANCE = 0.2 + +/** Docking repairs everything, in a hurry rather than instantly. */ +export const DOCK_REPAIR_DAYS = 1 + +/** A yellow board: running out of power a long way from anywhere. */ +export const LOW_ENERGY = 0.1 + +export const MAX_CAPTAINS = 4 +export const MAX_NAME = 12 + +/* + * Everything the machine says, and none of it is anybody else's. + * + * The 1971 game and the 1978 type-in that carried it have famous lines in + * them, and those sentences belong to the people who wrote them. A project + * released under a copyleft licence cannot go around licensing words it did + * not write, so every line below was written for this project. See NOTICE.md, + * which is the same argument the two sibling games make. + * + * They are shouted because the machine had no lower case, not because we are + * shouting. + */ + +export const HAIL_TEXT = [ + 'FLEET COMMAND TO PATROL VESSEL', + 'RAIDERS ARE LOOSE IN ALL EIGHT BY EIGHT QUADRANTS.', + 'FIND THEM AND END THEM BEFORE YOUR TIME RUNS OUT.', +] + +export const CONDITION_TEXT: Record = { + DOCKED: 'DOCKED', + RED: 'RED', + YELLOW: 'YELLOW', + GREEN: 'GREEN', +} + +export const OUTCOME_TEXT: Record = { + 'mission-complete': 'THE LAST RAIDER IS GONE. THE QUADRANTS ARE QUIET.', + 'out-of-time': 'THE CLOCK RUNS OUT. WHAT IS LEFT OUT THERE STAYS OUT THERE.', + destroyed: 'THE HULL OPENS. NOTHING FURTHER IS RECEIVED FROM YOU.', + stranded: 'NO POWER, NO SHIELDS, NO WAY HOME. YOU DRIFT.', + resigned: 'YOU BREAK OFF AND TURN FOR HOME.', + 'base-destroyed': 'YOUR OWN TORPEDO TAKES THE STARBASE. FLEET COMMAND RELIEVES YOU.', +} + +/** The eight things that can be broken, in the order the report lists them. */ +export const DEVICE_NAMES: Record = { + warp: 'WARP ENGINES', + srs: 'SHORT RANGE SENSORS', + lrs: 'LONG RANGE SENSORS', + beams: 'BEAM CONTROL', + tubes: 'TORPEDO TUBES', + repair: 'DAMAGE CONTROL', + shields: 'SHIELD CONTROL', + computer: 'COMPUTER', +} + +/** What a sector looks like on paper. Three columns each, so the grid squares up. */ +export const GLYPH = { + ship: '', + raider: '+R+', + base: '>!<', + star: ' * ', + empty: ' ', +} as const + +export const NO_SUCH_COURSE = 'COURSE MUST BE 1 THROUGH 9' +export const BLOCKED_TEXT = 'SOMETHING IS IN THE WAY. ALL STOP.' +export const EDGE_TEXT = 'THE GALAXY ENDS HERE. ALL STOP AT THE RIM.' +export const DOCKED_TEXT = 'MOORED TO THE STARBASE. TANKS FULL, TUBES FULL, SHIELDS DOWN.' +export const SHIELDS_DOWN_TEXT = 'SHIELD CONTROL IS OUT. NOTHING TO PUT IT IN.' diff --git a/src/game/engine.test.ts b/src/game/engine.test.ts new file mode 100644 index 0000000..a2b9b52 --- /dev/null +++ b/src/game/engine.test.ts @@ -0,0 +1,224 @@ +import { describe, expect, it } from 'vitest' +import { GALAXY, GLYPH, SECTORS, START_ENERGY, START_TORPEDOES } from './constants' +import { makePatrol, shortRangeScan, step } from './engine' +import { makeRng } from './rng' +import { DEVICES, type Census, type DeviceId, type Patrol } from './types' + +const rng = () => makeRng(4242) + +const emptyGalaxy = (): Census[][] => + Array.from({ length: GALAXY }, () => + Array.from({ length: GALAXY }, () => ({ raiders: 0, base: false, stars: 0 })), + ) + +/** + * A patrol with nothing in it, to be furnished a piece at a time. Building + * one by hand rather than dealing one is the only way to test a rule instead + * of testing the dice. + */ +function bare(over: Partial = {}): Patrol { + const galaxy = emptyGalaxy() + return { + day: 2000, + deadline: 2030, + galaxy, + chart: Array.from({ length: GALAXY }, () => Array.from({ length: GALAXY }, () => null)), + quadrant: { row: 0, col: 0 }, + sector: { row: 0, col: 0 }, + energy: START_ENERGY, + shields: 500, + torpedoes: START_TORPEDOES, + damage: Object.fromEntries(DEVICES.map((d) => [d, 0])) as Record, + raiders: [], + stars: [], + base: null, + docked: false, + raidersLeft: 5, + raidersKilled: 0, + basesLeft: 1, + outcome: null, + ...over, + } +} + +describe('a dealt patrol', () => { + it('agrees with its own galaxy about how many raiders there are', () => { + for (const seed of [1, 2, 3, 99, 12345]) { + const p = makePatrol(makeRng(seed)) + const actual = p.galaxy.flat().reduce((n, q) => n + q.raiders, 0) + expect(p.raidersLeft).toBe(actual) + expect(p.raidersKilled).toBe(0) + expect(p.outcome).toBeNull() + } + }) + + it('charts the quadrant it starts in, and nothing else', () => { + const p = makePatrol(makeRng(5)) + const charted = p.chart.flat().filter((c) => c !== null) + expect(charted).toHaveLength(1) + expect(p.chart[p.quadrant.row]![p.quadrant.col]).not.toBeNull() + }) +}) + +describe('the short range scan', () => { + it('prints eight rows between two rules, with the ship on one of them', () => { + const p = bare({ sector: { row: 2, col: 3 } }) + const lines = shortRangeScan(p) + expect(lines).toHaveLength(SECTORS + 2) + expect(lines[3]!.text).toContain(GLYPH.ship) + }) + + it('refuses when the sensors are out, rather than guessing', () => { + const damage = { ...bare().damage, srs: 3 } + const lines = shortRangeScan(bare({ damage })) + expect(lines).toHaveLength(1) + expect(lines[0]!.text).toContain('SENSORS ARE OUT') + }) +}) + +describe('warp', () => { + it('crosses eight sectors for every whole warp factor', () => { + const { patrol } = step(bare(), { type: 'nav', course: 1, warp: 1 }, rng()) + // Eight sectors east from 1,1 is the first sector of the next quadrant. + expect(patrol.quadrant).toEqual({ row: 0, col: 1 }) + expect(patrol.sector).toEqual({ row: 0, col: 0 }) + }) + + it('stops at the rim rather than falling off it', () => { + const { patrol, lines } = step(bare(), { type: 'nav', course: 5, warp: 2 }, rng()) + expect(patrol.quadrant).toEqual({ row: 0, col: 0 }) + expect(patrol.sector).toEqual({ row: 0, col: 0 }) + expect(lines.some((l) => l.text.includes('GALAXY ENDS'))).toBe(true) + }) + + it('stops short of anything in the way', () => { + const p = bare({ stars: [{ row: 0, col: 2 }] }) + const { patrol, lines } = step(p, { type: 'nav', course: 1, warp: 0.25 }, rng()) + expect(patrol.sector).toEqual({ row: 0, col: 1 }) + expect(lines.some((l) => l.text.includes('IN THE WAY'))).toBe(true) + }) + + it('refuses more than a crawl when the engines are out', () => { + const damage = { ...bare().damage, warp: 4 } + const p = bare({ damage }) + const { patrol, lines } = step(p, { type: 'nav', course: 1, warp: 3 }, rng()) + expect(patrol.sector).toEqual(p.sector) + expect(lines[0]!.text).toContain('WARP ENGINES ARE OUT') + }) + + it('spends a day, and a day is what repairs things', () => { + const damage = { ...bare().damage, lrs: 0.5 } + const { patrol } = step(bare({ damage }), { type: 'nav', course: 7, warp: 1 }, rng()) + expect(patrol.day).toBe(2001) + expect(patrol.damage.lrs).toBe(0) + }) +}) + +describe('mooring', () => { + it('fills the tanks and the racks when you pull up beside a starbase', () => { + const p = bare({ base: { row: 0, col: 3 }, energy: 40, torpedoes: 1, shields: 300 }) + const { patrol } = step(p, { type: 'nav', course: 1, warp: 0.25 }, rng()) + expect(patrol.docked).toBe(true) + expect(patrol.energy).toBe(START_ENERGY) + expect(patrol.torpedoes).toBe(START_TORPEDOES) + expect(patrol.shields).toBe(0) + }) +}) + +describe('torpedoes', () => { + it('take a raider off the board and off the count', () => { + const p = bare({ + raidersLeft: 1, + raiders: [{ at: { row: 0, col: 4 }, energy: 300 }], + galaxy: (() => { + const g = emptyGalaxy() + g[0]![0] = { raiders: 1, base: false, stars: 0 } + return g + })(), + }) + const { patrol } = step(p, { type: 'torpedo', course: 1 }, rng()) + expect(patrol.raiders).toHaveLength(0) + expect(patrol.raidersKilled).toBe(1) + expect(patrol.raidersLeft).toBe(0) + expect(patrol.torpedoes).toBe(START_TORPEDOES - 1) + // Nothing left anywhere is the end of it. + expect(patrol.outcome).toBe('mission-complete') + }) + + it('are swallowed by a star, and the star is still there', () => { + const p = bare({ stars: [{ row: 0, col: 3 }] }) + const { patrol, lines } = step(p, { type: 'torpedo', course: 1 }, rng()) + expect(lines.some((l) => l.text.includes('SWALLOWS'))).toBe(true) + expect(patrol.stars).toHaveLength(1) + expect(patrol.outcome).toBeNull() + }) + + it('end the patrol if they take the starbase', () => { + const p = bare({ base: { row: 0, col: 5 } }) + const { patrol } = step(p, { type: 'torpedo', course: 1 }, rng()) + expect(patrol.outcome).toBe('base-destroyed') + }) + + it('are refused when the racks are empty, at no cost', () => { + const p = bare({ torpedoes: 0 }) + const { patrol, lines } = step(p, { type: 'torpedo', course: 1 }, rng()) + expect(patrol.torpedoes).toBe(0) + expect(lines[0]!.text).toContain('RACKS ARE EMPTY') + }) +}) + +describe('being shot at', () => { + it('ends the patrol when the shields are gone', () => { + const p = bare({ + shields: 1, + raiders: [{ at: { row: 0, col: 1 }, energy: 400 }], + }) + const { patrol } = step(p, { type: 'beams', energy: 1 }, rng()) + expect(patrol.outcome).toBe('destroyed') + }) + + it('does not happen at all while moored', () => { + const p = bare({ + base: { row: 0, col: 1 }, + docked: true, + shields: 1, + raiders: [{ at: { row: 0, col: 2 }, energy: 400 }], + }) + const { patrol, lines } = step(p, { type: 'beams', energy: 1 }, rng()) + expect(patrol.outcome).toBeNull() + expect(lines.some((l) => l.text.includes('STARBASE TAKES THE FIRE'))).toBe(true) + }) +}) + +describe('the clock', () => { + it('ends the patrol when the orders expire', () => { + const p = bare({ day: 2029.5, deadline: 2030 }) + const { patrol } = step(p, { type: 'nav', course: 7, warp: 1 }, rng()) + expect(patrol.outcome).toBe('out-of-time') + }) +}) + +describe('running dry', () => { + it('takes the last of it out of the shields before giving up', () => { + const p = bare({ energy: 5, shields: 400 }) + const { patrol } = step(p, { type: 'nav', course: 7, warp: 1 }, rng()) + expect(patrol.energy).toBe(0) + expect(patrol.shields).toBeLessThan(400) + expect(patrol.outcome).toBeNull() + }) + + it('strands you when there is nothing left in either', () => { + const p = bare({ energy: 5, shields: 2 }) + const { patrol } = step(p, { type: 'nav', course: 7, warp: 1 }, rng()) + expect(patrol.outcome).toBe('stranded') + }) +}) + +describe('a finished patrol', () => { + it('takes no further commands', () => { + const p = bare({ outcome: 'resigned' }) + const { patrol, lines } = step(p, { type: 'nav', course: 1, warp: 4 }, rng()) + expect(patrol).toBe(p) + expect(lines).toHaveLength(0) + }) +}) diff --git a/src/game/engine.ts b/src/game/engine.ts new file mode 100644 index 0000000..647a6a6 --- /dev/null +++ b/src/game/engine.ts @@ -0,0 +1,634 @@ +import { + BEAM_FLOOR, + BLOCKED_TEXT, + CRIPPLED_WARP, + DAMAGE_CHANCE, + DAMAGE_DAYS, + DEVICE_NAMES, + DOCKED_TEXT, + DOCK_REPAIR_DAYS, + EDGE_TEXT, + GALAXY, + GLYPH, + LOW_ENERGY, + MAX_WARP, + MIN_DAYS, + MAX_EXTRA_DAYS, + NO_SUCH_COURSE, + OUTCOME_TEXT, + SECTORS, + SHIELDS_DOWN_TEXT, + START_ENERGY, + START_TORPEDOES, + WARP_COST_FIXED, + WARP_COST_PER_SECTOR, +} from './constants' +import { + adjacent, + censusCode, + distance, + heading, + inGalaxy, + layQuadrant, + makeGalaxy, + occupant, + randomCoord, + same, +} from './galaxy' +import type { Rng } from './rng' +import { + DEVICES, + type Captain, + type Command, + type Condition, + type Coord, + type DeviceId, + type Line, + type Outcome, + type Patrol, +} from './types' + +export const randomSeed = () => Math.floor(Math.random() * 0x7fffffff) + +const line = (kind: Line['kind'], text: string): Line => ({ kind, text }) + +/** One-based, and printed the way the machine prints it: row then column. */ +const say = (c: Coord) => `${c.row + 1},${c.col + 1}` + +const clamp = (n: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, n)) + +/** Sectors are whole; a course is not. Round on arrival, never on the way. */ +const round = (c: Coord): Coord => ({ row: Math.round(c.row), col: Math.round(c.col) }) + +// ---------------------------------------------------------------- setting up + +export function makePatrol(rng: Rng): Patrol { + const { galaxy, raiders, bases } = makeGalaxy(rng) + const day = (20 + Math.floor(rng() * 20)) * 100 + const damage = Object.fromEntries(DEVICES.map((d) => [d, 0])) as Record + + const patrol: Patrol = { + day, + deadline: day + MIN_DAYS + Math.floor(rng() * MAX_EXTRA_DAYS), + galaxy, + chart: Array.from({ length: GALAXY }, () => Array.from({ length: GALAXY }, () => null)), + quadrant: randomCoord(rng, GALAXY), + sector: randomCoord(rng), + energy: START_ENERGY, + shields: 0, + torpedoes: START_TORPEDOES, + damage, + raiders: [], + stars: [], + base: null, + docked: false, + raidersLeft: raiders, + raidersKilled: 0, + basesLeft: bases, + outcome: null, + } + + return arrive(patrol, rng).patrol +} + +/** + * Come out of warp: lay the quadrant out, write it on the chart, and find out + * whether anything here has noticed. Being in a quadrant is what charts it -- + * the long range scan is for the eight you are *not* in. + */ +export function arrive(patrol: Patrol, rng: Rng): { patrol: Patrol; lines: Line[] } { + let next = layQuadrant(patrol, rng) + const { row, col } = next.quadrant + const chart = next.chart.map((r) => r.slice()) + chart[row]![col] = { ...next.galaxy[row]![col]! } + next = { ...next, chart } + + const lines: Line[] = [] + next = redock(next, lines) + + if (next.raiders.length > 0 && !next.docked) { + lines.push( + line( + 'hit', + `CONDITION RED. ${next.raiders.length} RAIDER${next.raiders.length > 1 ? 'S' : ''} IN THIS QUADRANT.`, + ), + ) + } + + return { patrol: next, lines } +} + +/** Moored, if there is a starbase in the next sector over. */ +function redock(patrol: Patrol, lines: Line[]): Patrol { + const docked = patrol.base !== null && adjacent(patrol.sector, patrol.base) + if (!docked) return { ...patrol, docked: false } + if (patrol.docked) return patrol + + lines.push(line('system', DOCKED_TEXT)) + const damage = { ...patrol.damage } + for (const d of DEVICES) damage[d] = Math.max(0, damage[d] - DOCK_REPAIR_DAYS) + return { + ...patrol, + docked: true, + energy: START_ENERGY, + torpedoes: START_TORPEDOES, + shields: 0, + damage, + } +} + +export function condition(patrol: Patrol): Condition { + if (patrol.docked) return 'DOCKED' + if (patrol.raiders.length > 0) return 'RED' + if (patrol.energy < START_ENERGY * LOW_ENERGY) return 'YELLOW' + return 'GREEN' +} + +// ------------------------------------------------------------------- scanning + +/** + * The short range scan, and the status board printed down its right-hand side. + * + * Eight rows of sectors and eight facts about the ship, one to a row, because + * that is what fits on a line of paper and because a printing terminal has no + * second place to put anything. This is the screen of the game: everything a + * captain decides is decided off these eleven lines. + */ +export function shortRangeScan(patrol: Patrol): Line[] { + if (patrol.damage.srs > 0) { + return [line('system', 'SHORT RANGE SENSORS ARE OUT. NOTHING TO SEE BY.')] + } + + const status = [ + `STARDATE ${patrol.day.toFixed(1)}`, + `CONDITION ${condition(patrol)}`, + `QUADRANT ${say(patrol.quadrant)}`, + `SECTOR ${say(patrol.sector)}`, + `ENERGY ${Math.round(patrol.energy)}`, + `SHIELDS ${Math.round(patrol.shields)}`, + `TORPEDOES ${patrol.torpedoes}`, + `RAIDERS ${patrol.raidersLeft}`, + ] + + const rule = '-'.repeat(SECTORS * 4 + 1) + const lines = [line('scan', rule)] + + for (let row = 0; row < SECTORS; row++) { + let text = '' + for (let col = 0; col < SECTORS; col++) { + const who = occupant(patrol, { row, col }) + text += + who === 'ship' + ? GLYPH.ship + : who === 'raider' + ? GLYPH.raider + : who === 'base' + ? GLYPH.base + : who === 'star' + ? GLYPH.star + : GLYPH.empty + text += ' ' + } + lines.push(line('scan', `${text} ${status[row]}`)) + } + + lines.push(line('scan', rule)) + return lines +} + +/** + * The long range scan: three digits a quadrant, for the nine quadrants + * centred on this one. Raiders, starbases, stars, in that order and no + * spaces -- 205 is two raiders, no base, five stars, and reading those three + * digits at a glance is the skill the whole game is built on. + */ +export function longRangeScan(patrol: Patrol): { patrol: Patrol; lines: Line[] } { + if (patrol.damage.lrs > 0) { + return { patrol, lines: [line('system', 'LONG RANGE SENSORS ARE OUT.')] } + } + + const chart = patrol.chart.map((r) => r.slice()) + const lines: Line[] = [line('scan', `LONG RANGE SCAN FOR QUADRANT ${say(patrol.quadrant)}`)] + const rule = '-------------------' + + lines.push(line('scan', rule)) + for (let dr = -1; dr <= 1; dr++) { + let text = ':' + for (let dc = -1; dc <= 1; dc++) { + const q = { row: patrol.quadrant.row + dr, col: patrol.quadrant.col + dc } + if (!inGalaxy(q)) { + text += ' *** :' + continue + } + const census = patrol.galaxy[q.row]![q.col]! + chart[q.row]![q.col] = { ...census } + text += ` ${censusCode(census)} :` + } + lines.push(line('scan', text)) + lines.push(line('scan', rule)) + } + + return { patrol: { ...patrol, chart }, lines } +} + +/** What the computer has been told, all sixty-four quadrants of it. */ +export function galaxyChart(patrol: Patrol): Line[] { + if (patrol.damage.computer > 0) { + return [line('system', 'THE COMPUTER IS DOWN. THE CHART IS IN IT.')] + } + + const lines = [ + line('scan', 'CHART OF THE GALAXY AS RECORDED'), + line('scan', ' 1 2 3 4 5 6 7 8'), + ] + for (let row = 0; row < GALAXY; row++) { + let text = `${row + 1} ` + for (let col = 0; col < GALAXY; col++) text += ` ${censusCode(patrol.chart[row]![col]!)} ` + lines.push(line('scan', text)) + } + lines.push( + line('scan', `RAIDERS LEFT ${patrol.raidersLeft} DAYS LEFT ${daysLeft(patrol).toFixed(1)}`), + ) + return lines +} + +export function damageReport(patrol: Patrol): Line[] { + const broken = DEVICES.filter((d) => patrol.damage[d] > 0) + if (broken.length === 0) return [line('damage', 'ALL SYSTEMS ANSWER.')] + return [ + line('damage', 'DEVICE DAYS TO REPAIR'), + ...broken.map((d) => + line('damage', `${DEVICE_NAMES[d]!.padEnd(20)}${patrol.damage[d]!.toFixed(1)}`), + ), + ] +} + +export const daysLeft = (patrol: Patrol) => Math.max(0, patrol.deadline - patrol.day) + +// -------------------------------------------------------------------- fighting + +/** + * Everything still alive in this quadrant shoots back. + * + * A raider hits harder the closer it is and spends itself doing it, which is + * the only reason a long fight is ever winnable: sit at range and you take + * less and give less, close in and it is settled either way in two exchanges. + */ +function raidersFire(patrol: Patrol, rng: Rng, lines: Line[]): Patrol { + if (patrol.raiders.length === 0) return patrol + if (patrol.docked) { + lines.push(line('hit', 'THE STARBASE TAKES THE FIRE FOR YOU.')) + return patrol + } + + let shields = patrol.shields + const damage = { ...patrol.damage } + const raiders = patrol.raiders.map((k) => ({ ...k })) + + for (const k of raiders) { + const range = Math.max(1, distance(k.at, patrol.sector)) + const hit = Math.floor((k.energy / range) * (2 + rng())) + shields -= hit + k.energy /= 3 + rng() + + lines.push( + line( + 'hit', + `${hit} UNIT HIT FROM THE RAIDER AT ${say(k.at)}. SHIELDS AT ${Math.max(0, Math.round(shields))}.`, + ), + ) + + if (shields <= 0) break + + if (rng() < DAMAGE_CHANCE) { + const d = DEVICES[Math.floor(rng() * DEVICES.length)]! + damage[d] += DAMAGE_DAYS * rng() + 1 + lines.push(line('damage', `${DEVICE_NAMES[d]} DAMAGED.`)) + } + } + + const next = { ...patrol, shields: Math.max(0, shields), damage, raiders } + if (shields <= 0) { + lines.push(line('end', 'SHIELDS ARE GONE.')) + return { ...next, outcome: 'destroyed' } + } + return next +} + +/** Take a raider off the board, here and in the galaxy's own count. */ +function killRaider(patrol: Patrol, at: Coord): Patrol { + const galaxy = patrol.galaxy.map((r) => r.map((c) => ({ ...c }))) + const q = galaxy[patrol.quadrant.row]![patrol.quadrant.col]! + q.raiders = Math.max(0, q.raiders - 1) + + const chart = patrol.chart.map((r) => r.slice()) + chart[patrol.quadrant.row]![patrol.quadrant.col] = { ...q } + + return { + ...patrol, + galaxy, + chart, + raiders: patrol.raiders.filter((k) => !same(k.at, at)), + raidersLeft: Math.max(0, patrol.raidersLeft - 1), + raidersKilled: patrol.raidersKilled + 1, + } +} + +function fireBeams(patrol: Patrol, amount: number, rng: Rng): { patrol: Patrol; lines: Line[] } { + const lines: Line[] = [] + if (patrol.damage.beams > 0) return { patrol, lines: [line('system', 'BEAM CONTROL IS OUT.')] } + if (patrol.raiders.length === 0) { + return { patrol, lines: [line('system', 'NOTHING IN THIS QUADRANT TO SHOOT AT.')] } + } + + const spend = clamp(Math.floor(amount), 0, Math.floor(patrol.energy)) + if (spend <= 0) return { patrol, lines: [line('system', 'NO ENERGY RELEASED.')] } + + let next: Patrol = { ...patrol, energy: patrol.energy - spend } + lines.push(line('fire', `BEAMS FIRED. ${spend} UNITS RELEASED.`)) + + // A blind shot is a worse shot. The computer is what spreads the energy + // across the targets; without it you are pointing the ship and hoping. + let effective = spend + if (next.damage.computer > 0) { + effective = spend * 0.6 + lines.push(line('system', 'WITHOUT THE COMPUTER THE SPREAD IS WIDE.')) + } + + const share = effective / next.raiders.length + // A snapshot: killRaider rewrites next.raiders underneath this loop. + const targets = next.raiders.slice() + for (const k of targets) { + const range = Math.max(1, distance(k.at, next.sector)) + const hit = Math.floor((share * (2 + rng())) / range) + + if (hit <= k.energy * BEAM_FLOOR) { + lines.push(line('fire', `THE RAIDER AT ${say(k.at)} SHRUGS IT OFF.`)) + continue + } + + const left = k.energy - hit + if (left <= 0) { + lines.push(line('fire', `THE RAIDER AT ${say(k.at)} COMES APART.`)) + next = killRaider(next, k.at) + } else { + next = { + ...next, + raiders: next.raiders.map((r) => (same(r.at, k.at) ? { ...r, energy: left } : r)), + } + lines.push(line('fire', `${hit} UNITS ONTO THE RAIDER AT ${say(k.at)}.`)) + } + } + + return { patrol: raidersFire(next, rng, lines), lines } +} + +/** + * One torpedo, one course, and no guidance at all: it goes where it is + * pointed until it meets something. Meeting a star means the star wins, and + * meeting the starbase means the patrol is over in the worst way there is. + */ +function fireTorpedo(patrol: Patrol, course: number, rng: Rng): { patrol: Patrol; lines: Line[] } { + if (patrol.damage.tubes > 0) return { patrol, lines: [line('system', 'THE TUBES ARE OUT.')] } + if (patrol.torpedoes <= 0) return { patrol, lines: [line('system', 'THE RACKS ARE EMPTY.')] } + if (!(course >= 1 && course <= 9)) return { patrol, lines: [line('system', NO_SUCH_COURSE)] } + + const lines: Line[] = [line('fire', 'TORPEDO AWAY.')] + let next: Patrol = { ...patrol, torpedoes: patrol.torpedoes - 1 } + const step = heading(course) + let at = { row: next.sector.row, col: next.sector.col } + + for (;;) { + at = { row: at.row + step.row, col: at.col + step.col } + const cell = round(at) + if (cell.row < 0 || cell.row >= SECTORS || cell.col < 0 || cell.col >= SECTORS) { + lines.push(line('fire', 'THE TORPEDO LEAVES THE QUADRANT AND KEEPS GOING.')) + break + } + + const who = occupant(next, cell) + if (who === 'raider') { + lines.push(line('fire', `DIRECT HIT. THE RAIDER AT ${say(cell)} IS GONE.`)) + next = killRaider(next, cell) + break + } + if (who === 'star') { + lines.push(line('fire', `THE STAR AT ${say(cell)} SWALLOWS IT.`)) + break + } + if (who === 'base') { + lines.push(line('end', `THE STARBASE AT ${say(cell)} IS GONE.`)) + return { patrol: { ...next, outcome: 'base-destroyed' }, lines } + } + } + + return { patrol: raidersFire(next, rng, lines), lines } +} + +// -------------------------------------------------------------------- moving + +/** + * Warp. + * + * The whole move happens in galaxy coordinates -- sixty-four sectors on a + * side -- because a course does not stop at a quadrant boundary and neither + * should the arithmetic. Blocking only applies inside the quadrant you can + * actually see: the ship has no idea what is in the next one until it gets + * there, which is exactly the bargain the game is offering. + */ +function navigate( + patrol: Patrol, + course: number, + warp: number, + rng: Rng, +): { patrol: Patrol; lines: Line[] } { + if (!(course >= 1 && course <= 9)) return { patrol, lines: [line('system', NO_SUCH_COURSE)] } + + if (patrol.damage.warp > 0 && warp > CRIPPLED_WARP) { + return { + patrol, + lines: [line('system', `WARP ENGINES ARE OUT. ${CRIPPLED_WARP} IS ALL THERE IS.`)], + } + } + + const w = clamp(warp, 0, MAX_WARP) + const sectors = Math.round(w * SECTORS) + if (sectors <= 0) return { patrol, lines: [line('system', 'ALL STOP.')] } + + const lines: Line[] = [] + const step = heading(course) + const startQuadrant = patrol.quadrant + let pos = { + row: patrol.quadrant.row * SECTORS + patrol.sector.row, + col: patrol.quadrant.col * SECTORS + patrol.sector.col, + } + + for (let i = 0; i < sectors; i++) { + const next = { row: pos.row + step.row, col: pos.col + step.col } + const cell = round(next) + + if (cell.row < 0 || cell.row >= GALAXY * SECTORS || cell.col < 0 || cell.col >= GALAXY * SECTORS) { + lines.push(line('move', EDGE_TEXT)) + break + } + + const q = { row: Math.floor(cell.row / SECTORS), col: Math.floor(cell.col / SECTORS) } + if (same(q, startQuadrant)) { + const local = { row: cell.row % SECTORS, col: cell.col % SECTORS } + if (occupant(patrol, local) !== null && !same(local, patrol.sector)) { + lines.push(line('move', BLOCKED_TEXT)) + break + } + } + + pos = next + } + + const cell = round(pos) + const quadrant = { row: Math.floor(cell.row / SECTORS), col: Math.floor(cell.col / SECTORS) } + const sector = { row: cell.row % SECTORS, col: cell.col % SECTORS } + const moved = !same(quadrant, startQuadrant) + + const cost = sectors * WARP_COST_PER_SECTOR + WARP_COST_FIXED + const days = w >= 1 ? 1 : Math.round(w * 10) / 10 + + let next: Patrol = { ...patrol, quadrant, sector, energy: patrol.energy - cost } + + // Out of power is not out of options while there is anything in the + // shields; the original let you cannibalise them and so does this. + if (next.energy < 0) { + const short = -next.energy + next = { ...next, energy: 0, shields: next.shields - short } + if (next.shields <= 0) { + lines.push(line('end', 'THE LAST OF THE POWER GOES INTO THE ENGINES.')) + return { patrol: { ...next, shields: 0, outcome: 'stranded' }, lines } + } + lines.push(line('system', 'SHIELD POWER DIVERTED TO THE ENGINES.')) + } + + next = passDays(next, days, rng, lines) + + if (moved) { + lines.push(line('move', `WARP ${w} TO QUADRANT ${say(quadrant)}, SECTOR ${say(sector)}.`)) + const arrived = arrive(next, rng) + next = arrived.patrol + lines.push(...arrived.lines) + } else { + lines.push(line('move', `SECTOR ${say(sector)}.`)) + next = redock(next, lines) + } + + if (next.outcome) return { patrol: next, lines } + return { patrol: raidersFire(next, rng, lines), lines } +} + +/** + * Time passing, which is the only thing that repairs anything. + * + * Damage control works while the ship flies; it does not work while you sit + * still thinking, because sitting still costs no days. That is why a badly + * hurt ship has to keep moving, and why the temptation to limp to a starbase + * at warp 0.2 is a real decision rather than a formality. + */ +function passDays(patrol: Patrol, days: number, rng: Rng, lines: Line[]): Patrol { + const damage = { ...patrol.damage } + for (const d of DEVICES) { + if (damage[d] <= 0) continue + damage[d] = Math.max(0, damage[d] - days) + if (damage[d] === 0) lines.push(line('damage', `${DEVICE_NAMES[d]} BACK ON LINE.`)) + } + + // Damage control occasionally finds something, or breaks something. + if (patrol.damage.repair === 0 && rng() < 0.1) { + const d = DEVICES[Math.floor(rng() * DEVICES.length)]! + if (damage[d] > 0) { + damage[d] = 0 + lines.push(line('damage', `DAMAGE CONTROL HAS ${DEVICE_NAMES[d]} WORKING AGAIN.`)) + } + } + + return { ...patrol, day: patrol.day + days, damage } +} + +function setShields(patrol: Patrol, amount: number): { patrol: Patrol; lines: Line[] } { + if (patrol.damage.shields > 0) return { patrol, lines: [line('system', SHIELDS_DOWN_TEXT)] } + + const pool = patrol.energy + patrol.shields + const shields = clamp(Math.floor(amount), 0, Math.floor(pool)) + return { + patrol: { ...patrol, shields, energy: pool - shields }, + lines: [line('system', `SHIELDS AT ${shields}. ENERGY AT ${Math.round(pool - shields)}.`)], + } +} + +// ---------------------------------------------------------------------- turn + +/** Whatever the patrol has run out of, said once and only once. */ +function settle(patrol: Patrol, lines: Line[]): Patrol { + if (patrol.outcome) return patrol + + if (patrol.raidersLeft <= 0) { + lines.push(line('win', 'THE LAST OF THEM IS OFF THE BOARD.')) + return { ...patrol, outcome: 'mission-complete' } + } + if (patrol.day >= patrol.deadline) { + lines.push(line('end', 'THE ORDERS EXPIRE.')) + return { ...patrol, outcome: 'out-of-time' } + } + if (patrol.energy <= 0 && patrol.shields <= 0) { + lines.push(line('end', 'EVERY LAST UNIT IS SPENT.')) + return { ...patrol, outcome: 'stranded' } + } + return patrol +} + +/** One command, and everything it sets off. The only way the patrol changes. */ +export function step(patrol: Patrol, cmd: Command, rng: Rng): { patrol: Patrol; lines: Line[] } { + if (patrol.outcome) return { patrol, lines: [] } + + let out: { patrol: Patrol; lines: Line[] } + switch (cmd.type) { + case 'nav': + out = navigate(patrol, cmd.course, cmd.warp, rng) + break + case 'srs': + out = { patrol, lines: shortRangeScan(patrol) } + break + case 'lrs': + out = longRangeScan(patrol) + break + case 'beams': + out = fireBeams(patrol, cmd.energy, rng) + break + case 'torpedo': + out = fireTorpedo(patrol, cmd.course, rng) + break + case 'shields': + out = setShields(patrol, cmd.energy) + break + case 'damage': + out = { patrol, lines: damageReport(patrol) } + break + case 'chart': + out = { patrol, lines: galaxyChart(patrol) } + break + case 'resign': + out = { patrol: { ...patrol, outcome: 'resigned' }, lines: [] } + break + } + + const lines = [...out.lines] + return { patrol: settle(out.patrol, lines), lines } +} + +/** What to print when a patrol ends. The words are in constants.ts. */ +export const outcomeText = (o: Outcome): string => OUTCOME_TEXT[o] ?? '' + +/** + * The standings, and the same order the shared board ranks in: raiders + * destroyed first, then days you did not need, then torpedoes you did not + * fire. Two captains who cleared the galaxy are separated by how fast, and + * then by how tidily. + */ +export const comparePatrols = (a: Captain, b: Captain): number => + b.killed - a.killed || b.daysLeft - a.daysLeft || b.torpedoes - a.torpedoes diff --git a/src/game/galaxy.test.ts b/src/game/galaxy.test.ts new file mode 100644 index 0000000..abda017 --- /dev/null +++ b/src/game/galaxy.test.ts @@ -0,0 +1,106 @@ +import { describe, expect, it } from 'vitest' +import { GALAXY, RAIDER_ODDS, SECTORS } from './constants' +import { adjacent, censusCode, heading, layQuadrant, makeGalaxy, same } from './galaxy' +import { makeRng } from './rng' +import type { Census, Patrol } from './types' + +/** + * The galaxy is arithmetic, so it can be checked rather than trusted. These + * are the facts the rest of the game leans on without ever re-testing them. + */ + +describe('the compass', () => { + it('puts the four cardinals where the printed grid wants them', () => { + expect(heading(1)).toEqual({ row: 0, col: 1 }) // east, along the row + expect(heading(3)).toEqual({ row: -1, col: 0 }) // north, up the page + expect(heading(5)).toEqual({ row: 0, col: -1 }) + expect(heading(7)).toEqual({ row: 1, col: 0 }) + }) + + it('closes the circle, so 9 is 1 again', () => { + expect(heading(9)).toEqual(heading(1)) + }) + + it('interpolates between the spokes', () => { + // Halfway from east to north-east is half a row up and a whole column on. + expect(heading(1.5)).toEqual({ row: -0.5, col: 1 }) + }) +}) + +describe('a scattered galaxy', () => { + it('is always worth flying: at least one raider and one base', () => { + // The scatter is thin enough that an empty galaxy is not a freak event, + // which is exactly why the fix-ups exist. + for (let seed = 1; seed <= 200; seed++) { + const { galaxy, raiders, bases } = makeGalaxy(makeRng(seed)) + expect(raiders).toBeGreaterThan(0) + expect(bases).toBeGreaterThan(0) + expect(galaxy.flat().reduce((n, q) => n + q.raiders, 0)).toBe(raiders) + expect(galaxy.flat().filter((q) => q.base).length).toBe(bases) + } + }) + + it('is eight by eight, and every quadrant has at least one star', () => { + const { galaxy } = makeGalaxy(makeRng(7)) + expect(galaxy).toHaveLength(GALAXY) + for (const row of galaxy) { + expect(row).toHaveLength(GALAXY) + for (const q of row) { + expect(q.stars).toBeGreaterThan(0) + expect(q.raiders).toBeLessThanOrEqual(RAIDER_ODDS[0]![1]) + } + } + }) +}) + +describe('the three-digit code', () => { + it('reads raiders, starbases, stars, in that order', () => { + expect(censusCode({ raiders: 2, base: false, stars: 5 })).toBe('205') + expect(censusCode({ raiders: 0, base: true, stars: 1 })).toBe('011') + }) + + it('says nothing at all about a quadrant nobody has scanned', () => { + expect(censusCode(null)).toBe('***') + }) +}) + +const emptyGalaxy = (): Census[][] => + Array.from({ length: GALAXY }, () => + Array.from({ length: GALAXY }, () => ({ raiders: 0, base: false, stars: 0 })), + ) + +describe('laying out a quadrant', () => { + it('puts down exactly what the census says, and never on top of anything', () => { + const galaxy = emptyGalaxy() + galaxy[0]![0] = { raiders: 3, base: true, stars: 8 } + + const patrol = { + galaxy, + quadrant: { row: 0, col: 0 }, + sector: { row: 4, col: 4 }, + raiders: [], + stars: [], + base: null, + } as unknown as Patrol + + const laid = layQuadrant(patrol, makeRng(11)) + expect(laid.raiders).toHaveLength(3) + expect(laid.stars).toHaveLength(8) + expect(laid.base).not.toBeNull() + + const all = [...laid.raiders.map((r) => r.at), ...laid.stars, laid.base!, laid.sector] + for (const a of all) { + expect(a.row).toBeGreaterThanOrEqual(0) + expect(a.row).toBeLessThan(SECTORS) + expect(all.filter((b) => same(a, b))).toHaveLength(1) + } + }) +}) + +describe('mooring', () => { + it('counts the corners, and does not count standing on it', () => { + expect(adjacent({ row: 3, col: 3 }, { row: 2, col: 2 })).toBe(true) + expect(adjacent({ row: 3, col: 3 }, { row: 3, col: 5 })).toBe(false) + expect(adjacent({ row: 3, col: 3 }, { row: 3, col: 3 })).toBe(false) + }) +}) diff --git a/src/game/galaxy.ts b/src/game/galaxy.ts new file mode 100644 index 0000000..a9efdfd --- /dev/null +++ b/src/game/galaxy.ts @@ -0,0 +1,159 @@ +import { + BASE_ODDS, + GALAXY, + MAX_STARS, + RAIDER_ENERGY, + RAIDER_ENERGY_SPREAD, + RAIDER_ODDS, + SECTORS, +} from './constants' +import type { Rng } from './rng' +import type { Census, Coord, Patrol, Raider } from './types' + +/** + * The compass, and the one piece of this game most people misremember. + * + * Courses run 1 to 9 anticlockwise with 1 pointing along the row -- east, if + * you are looking at the printed grid -- and 9 is 1 again, so that a course of + * 8.5 has somewhere to go. A course is not an angle in degrees and never was: + * the whole point is that you can hold the nine of them in your head while + * reading a scan, and steer by counting round. + * + * Rows increase downward, because the grid is printed rather than plotted. + */ +const COMPASS: readonly Coord[] = [ + { row: 0, col: 1 }, // 1 east + { row: -1, col: 1 }, // 2 + { row: -1, col: 0 }, // 3 north + { row: -1, col: -1 }, // 4 + { row: 0, col: -1 }, // 5 west + { row: 1, col: -1 }, // 6 + { row: 1, col: 0 }, // 7 south + { row: 1, col: 1 }, // 8 + { row: 0, col: 1 }, // 9 east again +] + +/** The unit step for a course, interpolating between the nine spokes. */ +export function heading(course: number): Coord { + const i = Math.min(Math.floor(course), 8) + const f = course - i + const a = COMPASS[i - 1]! + const b = COMPASS[i]! + return { row: a.row + (b.row - a.row) * f, col: a.col + (b.col - a.col) * f } +} + +export const inGalaxy = (c: Coord) => + c.row >= 0 && c.row < GALAXY && c.col >= 0 && c.col < GALAXY + +export const inQuadrant = (c: Coord) => + c.row >= 0 && c.row < SECTORS && c.col >= 0 && c.col < SECTORS + +export const same = (a: Coord, b: Coord) => a.row === b.row && a.col === b.col + +export const distance = (a: Coord, b: Coord) => + Math.sqrt((a.row - b.row) ** 2 + (a.col - b.col) ** 2) + +/** Two sectors touching, corners included. What docking means. */ +export const adjacent = (a: Coord, b: Coord) => + !same(a, b) && Math.abs(a.row - b.row) <= 1 && Math.abs(a.col - b.col) <= 1 + +const pick = (rng: Rng, n: number) => Math.floor(rng() * n) + +export const randomCoord = (rng: Rng, n = SECTORS): Coord => ({ + row: pick(rng, n), + col: pick(rng, n), +}) + +function censusFor(rng: Rng): Census { + const roll = rng() + let raiders = 0 + for (const [over, n] of RAIDER_ODDS) { + if (roll > over) { + raiders = n + break + } + } + return { raiders, base: rng() > BASE_ODDS, stars: 1 + pick(rng, MAX_STARS) } +} + +/** + * Scatter the galaxy. + * + * Two fix-ups afterwards, both of which the original also needed: a galaxy + * with no raiders in it is not a patrol, and a galaxy with no starbase in it + * is not survivable. Rolling until the scatter happens to be playable would + * bias every other quadrant; placing the missing one is honest about what it + * is. + */ +export function makeGalaxy(rng: Rng): { galaxy: Census[][]; raiders: number; bases: number } { + const galaxy: Census[][] = [] + for (let row = 0; row < GALAXY; row++) { + const line: Census[] = [] + for (let col = 0; col < GALAXY; col++) line.push(censusFor(rng)) + galaxy.push(line) + } + + let raiders = galaxy.flat().reduce((n, q) => n + q.raiders, 0) + let bases = galaxy.flat().filter((q) => q.base).length + + if (raiders === 0) { + const c = randomCoord(rng, GALAXY) + galaxy[c.row]![c.col]!.raiders = 1 + raiders = 1 + } + if (bases === 0) { + const c = randomCoord(rng, GALAXY) + galaxy[c.row]![c.col]!.base = true + bases = 1 + } + + return { galaxy, raiders, bases } +} + +/** A three-digit quadrant code: raiders, starbases, stars. Unscanned is stars. */ +export const censusCode = (c: Census | null): string => + c === null ? '***' : `${Math.min(c.raiders, 9)}${c.base ? 1 : 0}${Math.min(c.stars, 9)}` + +/** + * Lay out the quadrant the ship has just arrived in. + * + * The census says how many of each; where they go is decided now and + * forgotten on the way out. That is the original's behaviour and it is worth + * keeping rather than tidying: a quadrant is a fight, not a place, and the + * only thing that persists about it is the count on the chart. + */ +export function layQuadrant(patrol: Patrol, rng: Rng): Patrol { + const census = patrol.galaxy[patrol.quadrant.row]![patrol.quadrant.col]! + const taken: Coord[] = [patrol.sector] + + const free = (): Coord => { + for (;;) { + const c = randomCoord(rng) + if (!taken.some((t) => same(t, c))) { + taken.push(c) + return c + } + } + } + + const raiders: Raider[] = [] + for (let i = 0; i < census.raiders; i++) { + raiders.push({ at: free(), energy: RAIDER_ENERGY + rng() * RAIDER_ENERGY_SPREAD }) + } + const base = census.base ? free() : null + const stars: Coord[] = [] + for (let i = 0; i < census.stars; i++) stars.push(free()) + + return { ...patrol, raiders, base, stars } +} + +/** What is standing in a sector, if anything. */ +export type Occupant = 'ship' | 'raider' | 'base' | 'star' | null + +export function occupant(patrol: Patrol, at: Coord): Occupant { + if (same(at, patrol.sector)) return 'ship' + if (patrol.raiders.some((k) => same(k.at, at))) return 'raider' + if (patrol.base && same(patrol.base, at)) return 'base' + if (patrol.stars.some((s) => same(s, at))) return 'star' + return null +} diff --git a/src/game/highscores.ts b/src/game/highscores.ts new file mode 100644 index 0000000..ce77105 --- /dev/null +++ b/src/game/highscores.ts @@ -0,0 +1,92 @@ +/** + * One board, shared by everybody, held by the scores service rather than the + * browser. Nothing about it is trusted on the way in: the server decides what + * is plausible, and the client re-checks the shape of whatever comes back + * before putting it on screen. + * + * The service is shared with the other games on the site rather than being one + * of ours -- see https://github.com/Coffey-Labs/games-scores. That is why + * every call names the game. Nothing else about it leaks in here: the rows + * come back in this game's own field names, so this file would be identical if + * the board were ours alone. + */ + +/** Which board on the shared service is ours. */ +export const GAME = 'scan' + +const BASE = (import.meta.env.VITE_SCORES_API ?? '/api').replace(/\/+$/, '') +const TIMEOUT_MS = 8000 + +export const MAX_SCORES = 50 + +export interface Score { + id: string + name: string + /** Raiders destroyed. The rank, before any tie-break. */ + killed: number + /** Days still on the orders when the patrol ended. */ + daysLeft: number + /** Torpedoes still in the racks. */ + torpedoes: number + /** How it ended, in the game's own words. */ + ending: string | null + at: number +} + +export type NewScore = Omit + +function isScore(v: unknown): v is Score { + if (typeof v !== 'object' || v === null) return false + const s = v as Record + return ( + typeof s.id === 'string' && + typeof s.name === 'string' && + Number.isFinite(s.killed) && + Number.isFinite(s.daysLeft) && + Number.isFinite(s.torpedoes) && + (s.ending === null || typeof s.ending === 'string') && + Number.isFinite(s.at) + ) +} + +const parseBoard = (body: unknown): Score[] => { + const rows = (body as { scores?: unknown })?.scores + if (!Array.isArray(rows)) return [] + return rows + .filter(isScore) + .map((s) => ({ ...s, name: s.name.slice(0, 12) })) + .slice(0, MAX_SCORES) +} + +async function call(path: string, init?: RequestInit): Promise { + const res = await fetch(`${BASE}${path}`, { + ...init, + signal: AbortSignal.timeout(TIMEOUT_MS), + headers: { 'content-type': 'application/json', ...(init?.headers ?? {}) }, + }) + const body: unknown = await res.json().catch(() => null) + if (!res.ok) { + const why = (body as { error?: string })?.error + throw new Error(why ?? `scores service returned ${res.status}`) + } + return body +} + +export async function fetchScores(): Promise { + return parseBoard(await call(`/scores?game=${GAME}`)) +} + +/** Posts every captain in the party at once and returns the new board. */ +export async function submitScores( + entries: NewScore[], +): Promise<{ ids: string[]; scores: Score[] }> { + const body = await call('/scores', { + method: 'POST', + body: JSON.stringify({ game: GAME, entries }), + }) + const ids = (body as { ids?: unknown })?.ids + return { + ids: Array.isArray(ids) ? ids.filter((i): i is string => typeof i === 'string') : [], + scores: parseBoard(body), + } +} diff --git a/src/game/reducer.ts b/src/game/reducer.ts new file mode 100644 index 0000000..e59c0e5 --- /dev/null +++ b/src/game/reducer.ts @@ -0,0 +1,153 @@ +import { daysLeft } from './engine' +import type { Captain, Line, Patrol, Phase } from './types' + +/** + * The phase machine, and the only place a turn changes hands. + * + * A turn is one whole patrol, not one command. A captain flies until the + * raiders are gone or something ends them, and only then does the printer go + * quiet and the next captain sit down. Splitting turns command by command + * would be fairer in some abstract sense and unplayable in practice: this is + * a game about a galaxy you are holding in your head, and four people cannot + * hold four of them at once. It is the same rule the cave game plays by, for + * the same reason. + * + * Each captain gets their own galaxy, dealt off the same seeded stream. They + * are not competing over one map -- they are being set the same kind of + * problem and judged on what they did with it. + */ +export interface GameState { + phase: Phase + seed: number + captains: Captain[] + /** Index into `captains`; the finished are skipped, never removed. */ + turn: number + patrol: Patrol | null + /** Everything the machine has printed for the patrol now being flown. */ + transcript: Line[] + /** Where the board was opened from, so BACK has somewhere to go. */ + scoresReturn: Phase +} + +export const initialState = (seed: number, phase: Phase = 'boot'): GameState => ({ + phase, + seed, + captains: [], + turn: 0, + patrol: null, + transcript: [], + scoresReturn: 'title', +}) + +export type Action = + | { type: 'BOOTED' } + | { type: 'SHOW_INSTRUCTIONS' } + | { type: 'SHOW_SETUP' } + | { type: 'START'; names: string[] } + | { type: 'BEGIN_PATROL'; patrol: Patrol; lines: Line[] } + | { type: 'PRINT'; lines: Line[] } + | { type: 'ADVANCE'; patrol: Patrol; lines: Line[] } + | { type: 'SHOW_REPORT' } + | { type: 'NEXT_TURN' } + | { type: 'SHOW_SCORES' } + | { type: 'CLOSE_SCORES' } + | { type: 'RESTART'; seed: number } + +/** Whose turn it is, or undefined once everybody has flown. */ +export const currentCaptain = (s: GameState): Captain | undefined => s.captains[s.turn] + +/** The next captain who has not flown yet, or -1 when they all have. */ +export function nextWaiting(captains: Captain[], from: number): number { + for (let i = 1; i <= captains.length; i++) { + const at = (from + i) % captains.length + if (!captains[at]!.done) return at + } + return -1 +} + +export function reducer(state: GameState, action: Action): GameState { + switch (action.type) { + case 'BOOTED': + return { ...state, phase: 'title' } + + case 'SHOW_INSTRUCTIONS': + return { ...state, phase: 'instructions' } + + case 'SHOW_SETUP': + return { ...state, phase: 'setup' } + + case 'START': + return { + ...state, + phase: 'patrol', + captains: action.names.map((name, i) => ({ + id: i, + name: name.trim().toUpperCase() || `CAPTAIN ${i + 1}`, + killed: 0, + daysLeft: 0, + torpedoes: 0, + done: false, + outcome: null, + })), + turn: 0, + patrol: null, + transcript: [], + } + + case 'BEGIN_PATROL': + return { ...state, phase: 'patrol', patrol: action.patrol, transcript: action.lines } + + case 'PRINT': + return { ...state, transcript: [...state.transcript, ...action.lines] } + + case 'ADVANCE': + return { + ...state, + patrol: action.patrol, + transcript: [...state.transcript, ...action.lines], + phase: action.patrol.outcome ? 'resolve' : 'patrol', + } + + /** The patrol has ended; settle it against the captain and show the report. */ + case 'SHOW_REPORT': { + const patrol = state.patrol + const who = currentCaptain(state) + if (!patrol?.outcome || !who) return { ...state, phase: 'report' } + + const captains = state.captains.map((c) => + c.id !== who.id + ? c + : { + ...c, + killed: patrol.raidersKilled, + daysLeft: Math.round(daysLeft(patrol) * 10) / 10, + torpedoes: patrol.torpedoes, + done: true, + outcome: patrol.outcome, + }, + ) + return { ...state, phase: 'report', captains } + } + + case 'NEXT_TURN': { + const at = nextWaiting(state.captains, state.turn) + if (at === -1) return { ...state, phase: 'gameover', patrol: null } + return { ...state, phase: 'patrol', turn: at, patrol: null, transcript: [] } + } + + case 'SHOW_SCORES': + return state.phase === 'scores' + ? state + : { ...state, phase: 'scores', scoresReturn: state.phase } + + case 'CLOSE_SCORES': + return { ...state, phase: state.scoresReturn } + + case 'RESTART': + // The tape only loads once a session; a new patrol starts at the title. + return initialState(action.seed, 'title') + + default: + return state + } +} diff --git a/src/game/rng.ts b/src/game/rng.ts new file mode 100644 index 0000000..382e08d --- /dev/null +++ b/src/game/rng.ts @@ -0,0 +1,19 @@ +/** + * mulberry32 — small, fast, seedable PRNG. + * The 1971 listing ran on RND(1); we keep a seed so a galaxy can be replayed or + * shared, and so a test can lay out the same quadrant twice. + */ +export function makeRng(seed: number) { + let a = seed >>> 0 + return function rng(): number { + a = (a + 0x6d2b79f5) >>> 0 + let t = a + t = Math.imul(t ^ (t >>> 15), t | 1) + t ^= t + Math.imul(t ^ (t >>> 7), t | 61) + return ((t ^ (t >>> 14)) >>> 0) / 4294967296 + } +} + +export type Rng = ReturnType + +export const chance = (rng: Rng, p: number) => rng() < p diff --git a/src/game/types.ts b/src/game/types.ts new file mode 100644 index 0000000..1fe7ef5 --- /dev/null +++ b/src/game/types.ts @@ -0,0 +1,139 @@ +/** A position, zero-based. Everything the machine prints adds one. */ +export interface Coord { + row: number + col: number +} + +export type DeviceId = + | 'warp' + | 'srs' + | 'lrs' + | 'beams' + | 'tubes' + | 'repair' + | 'shields' + | 'computer' + +export const DEVICES: readonly DeviceId[] = [ + 'warp', + 'srs', + 'lrs', + 'beams', + 'tubes', + 'repair', + 'shields', + 'computer', +] + +/** + * What a quadrant holds, without saying where in it. This is the galaxy's + * whole memory: the sectors are laid out fresh each time you arrive, exactly + * as the original did, which is why leaving and coming back rearranges the + * furniture but never changes the count. + */ +export interface Census { + raiders: number + base: boolean + stars: number +} + +export interface Raider { + at: Coord + /** Spent by taking hits and by shooting from a long way off. */ + energy: number +} + +export type Condition = 'DOCKED' | 'RED' | 'YELLOW' | 'GREEN' + +export type Outcome = + | 'mission-complete' + | 'out-of-time' + | 'destroyed' + | 'stranded' + | 'resigned' + | 'base-destroyed' + +/** True when the patrol ended in a way the captain walks away from. */ +export const isWin = (o: Outcome | null): boolean => o === 'mission-complete' + +/** One captain's whole patrol. The only mutable thing in the game. */ +export interface Patrol { + /** Today, in the fleet's own numbering. Counts up. */ + day: number + /** The day the orders expire. */ + deadline: number + + /** The truth, all sixty-four quadrants of it. */ + galaxy: Census[][] + /** What has actually been scanned. A quadrant never seen is null. */ + chart: (Census | null)[][] + + quadrant: Coord + sector: Coord + + energy: number + shields: number + torpedoes: number + + /** Days of repair each device still needs. Zero is a working device. */ + damage: Record + + /** Laid out on arrival, thrown away on leaving. */ + raiders: Raider[] + stars: Coord[] + base: Coord | null + + docked: boolean + + raidersLeft: number + raidersKilled: number + basesLeft: number + + outcome: Outcome | null +} + +/** + * One line of the transcript. The teletype prints these and, when the + * remaster lands, the tactical view will read them for its log -- so both + * skins will say exactly the same things. + */ +export interface Line { + kind: 'system' | 'scan' | 'move' | 'fire' | 'hit' | 'damage' | 'end' | 'win' + text: string +} + +export interface Captain { + id: number + name: string + /** Raiders destroyed. The score, before any tie-break. */ + killed: number + /** Days left on the orders when it ended. First tie-break. */ + daysLeft: number + /** Torpedoes still in the racks. Second tie-break. */ + torpedoes: number + done: boolean + outcome: Outcome | null +} + +export type Phase = + | 'boot' + | 'title' + | 'instructions' + | 'setup' + | 'patrol' + | 'resolve' + | 'report' + | 'gameover' + | 'scores' + +/** A command, assembled from as many prompts as it takes to ask for it. */ +export type Command = + | { type: 'nav'; course: number; warp: number } + | { type: 'srs' } + | { type: 'lrs' } + | { type: 'beams'; energy: number } + | { type: 'torpedo'; course: number } + | { type: 'shields'; energy: number } + | { type: 'damage' } + | { type: 'chart' } + | { type: 'resign' } diff --git a/src/index.css b/src/index.css new file mode 100644 index 0000000..76e7965 --- /dev/null +++ b/src/index.css @@ -0,0 +1,46 @@ +:root { + font-synthesis: none; + -webkit-font-smoothing: antialiased; +} + +* { + box-sizing: border-box; +} + +html, +body, +#root { + height: 100%; + margin: 0; +} + +/* The root is a flex item of body; without this the cabinet shrinks to fit. */ +#root { + flex: 1; + width: 100%; + display: flex; + align-items: center; + justify-content: center; +} + +/* The room the machine is standing in: a terminal room in a university + basement, lit by the ceiling and nothing else. */ +body { + background: radial-gradient(120% 80% at 50% 0%, #5a5a5a 0%, #3a3a3a 55%, #232323 100%); + color: #241f1a; + font-family: ui-monospace, "DejaVu Sans Mono", "Cascadia Mono", "Courier New", monospace; + display: flex; + align-items: center; + justify-content: center; + padding: clamp(8px, 2vw, 28px); +} + +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation-duration: 0.001ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.001ms !important; + } +} diff --git a/src/main.tsx b/src/main.tsx new file mode 100644 index 0000000..60d0162 --- /dev/null +++ b/src/main.tsx @@ -0,0 +1,18 @@ +import { StrictMode } from 'react' +import { createRoot } from 'react-dom/client' +import './index.css' +import App from './App.tsx' + +/** + * There is one skin so far, and it is the machine as it was. The remaster + * will bring a provider and a toggle with it; until then the attribute is set + * once here so the stylesheet has something to key off and nothing has to + * pretend there is a choice. + */ +document.documentElement.dataset.skin = 'teletype' + +createRoot(document.getElementById('root')!).render( + + + , +) diff --git a/tsconfig.app.json b/tsconfig.app.json new file mode 100644 index 0000000..c44bf8f --- /dev/null +++ b/tsconfig.app.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + "target": "es2023", + "lib": ["ES2023", "DOM"], + "module": "esnext", + "types": ["vite/client"], + "allowArbitraryExtensions": true, + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "moduleDetection": "force", + "noEmit": true, + "jsx": "react-jsx", + "strict": true, + + /* Linting */ + "noUnusedLocals": true, + "noUnusedParameters": true, + "erasableSyntaxOnly": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"] +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..1ffef60 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,7 @@ +{ + "files": [], + "references": [ + { "path": "./tsconfig.app.json" }, + { "path": "./tsconfig.node.json" } + ] +} diff --git a/tsconfig.node.json b/tsconfig.node.json new file mode 100644 index 0000000..8455dcb --- /dev/null +++ b/tsconfig.node.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "target": "es2023", + "lib": ["ES2023"], + "types": ["node"], + "skipLibCheck": true, + + /* Bundler mode */ + "module": "nodenext", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "noUnusedLocals": true, + "noUnusedParameters": true, + "erasableSyntaxOnly": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["vite.config.ts"] +} diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..608fb1d --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,24 @@ +import react from '@vitejs/plugin-react' +import { defineConfig } from 'vite' + +// Vitest is left on its defaults on purpose: it already picks up *.test.ts and +// nothing else, and importing `vitest/config` here drags in a second copy of +// vite whose plugin types disagree with this one's. +export default defineConfig({ + // Asset URLs are baked in at build time, so this has to match the path the + // game is served from. Local development stays at the root. + base: process.env.BASE_PATH ?? '/', + plugins: [react()], + server: { + // The game talks to /api in every environment; in production that is + // nginx in front of the shared scores container. In development, run + // https://github.com/Coffey-Labs/games-scores alongside this -- or do not, + // and the board will say so rather than breaking. + proxy: { + '/api': { + target: process.env.SCORES_TARGET ?? 'http://localhost:5184', + changeOrigin: true, + }, + }, + }, +}) diff --git a/web/Dockerfile b/web/Dockerfile new file mode 100644 index 0000000..9e39928 --- /dev/null +++ b/web/Dockerfile @@ -0,0 +1,20 @@ +# The game is a static bundle. It is built here and served by nginx, in its own +# container - it shares nothing with the scores service but the domain. +FROM node:26-alpine AS build +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm ci +COPY tsconfig*.json vite.config.ts index.html ./ +COPY public ./public +COPY src ./src +# Must match where the host proxies it, or the asset URLs will be wrong. +ARG BASE_PATH=/scan/ +ENV BASE_PATH=${BASE_PATH} +RUN npm run build + +FROM nginx:alpine +COPY web/nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/dist /usr/share/nginx/html +EXPOSE 8080 +HEALTHCHECK --interval=30s --timeout=3s --retries=3 \ + CMD wget -qO- http://127.0.0.1:8080/healthz >/dev/null || exit 1 diff --git a/web/nginx.conf b/web/nginx.conf new file mode 100644 index 0000000..e368b82 --- /dev/null +++ b/web/nginx.conf @@ -0,0 +1,22 @@ +server { + listen 8080; + server_name _; + root /usr/share/nginx/html; + + # Hashed filenames, so they can be cached hard. + location /assets/ { + expires 1y; + add_header Cache-Control "public, immutable"; + try_files $uri =404; + } + + location / { + try_files $uri $uri/ /index.html; + add_header Cache-Control "no-cache"; + } + + location = /healthz { + access_log off; + return 200 "ok\n"; + } +}