commit 4c51d5133c4987fa1f6cfd919786a732af7f71fd
Author: samtiz
Date: Fri Jul 4 14:31:04 2025 +0900
Initial Commit
diff --git a/.firebaserc b/.firebaserc
new file mode 100644
index 0000000..c3724db
--- /dev/null
+++ b/.firebaserc
@@ -0,0 +1,5 @@
+{
+ "projects": {
+ "default": "pickle-3651a"
+ }
+}
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..09f6325
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,116 @@
+# Logs
+src/data
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+lerna-debug.log*
+
+# Diagnostic reports (https://nodejs.org/api/report.html)
+report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+.DS_Store
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+*.lcov
+
+# nyc test coverage
+.nyc_output
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (https://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules/
+jspm_packages/
+
+# TypeScript v1 declaration files
+typings/
+
+# TypeScript cache
+*.tsbuildinfo
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Optional REPL history
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env
+.env.test
+
+# parcel-bundler cache (https://parceljs.org/)
+.cache
+
+# next.js build output
+.next
+
+# nuxt.js build output
+.nuxt
+
+# vuepress build output
+.vuepress/dist
+
+# Serverless directories
+.serverless/
+
+# FuseBox cache
+.fusebox/
+
+# DynamoDB Local files
+.dynamodb/
+
+# Webpack
+.webpack/
+
+# Vite
+.vite/
+
+# Electron-Forge
+out/
+.specstory
+.specstory/
+
+data/pickleglass.db
+pickleglass_web/backend/__pycache__/
+pickleglass_web/venv/
+
+# Node / JS
+node_modules/
+npm-debug.log
+yarn-error.log
+package-lock.json
+
+# Database
+data/*.db
+data/*.db-journal
+data/*.db-shm
+data/*.db-wal
+
+# Build output
+out/
+dist/
+build/
\ No newline at end of file
diff --git a/.npmrc b/.npmrc
new file mode 100644
index 0000000..d422cf4
--- /dev/null
+++ b/.npmrc
@@ -0,0 +1,3 @@
+better-sqlite3:ignore-scripts=true
+electron-deeplink:ignore-scripts=true
+sharp:ignore-scripts=true
\ No newline at end of file
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 0000000..1734101
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,2 @@
+src/assets
+node_modules
diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 0000000..2ef7ebb
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,10 @@
+{
+ "semi": true,
+ "tabWidth": 4,
+ "printWidth": 150,
+ "singleQuote": true,
+ "trailingComma": "es5",
+ "bracketSpacing": true,
+ "arrowParens": "avoid",
+ "endOfLine": "lf"
+}
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..972944b
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "search.useIgnoreFiles": true
+}
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..e72bfdd
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 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 General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is 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. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ 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.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ 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 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. Use with the GNU Affero General Public License.
+
+ 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 Affero 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 special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU 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 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 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 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 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ 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 GPL, see
+ .
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..610bf7b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,102 @@
+
+
+
+
+
+
Glass by Pickle: Digital Mind Extension π§
+
+
+
+
+
+
+
+
+> This project is a fork of [CheatingDaddy](https://github.com/sohzm/cheating-daddy) with modifications and enhancements. Thanks to [Soham](https://x.com/soham_btw) and all the open-source contributors who made this possible!
+
+π€ **Fast, light & open-source**βGlass lives on your desktop, sees what you see, listens in real time, understands your context, and turns every moment into structured knowledge.
+
+π¬ **Proactive in meetings**βit surfaces action items, summaries, and answers the instant you need them.
+
+π«₯οΈ **Truly invisible**βnever shows up in screen recordings, screenshots, or your dock; no always-on capture or hidden sharing.
+
+To have fun building with us, join our [Discord](https://discord.gg/UCZH5B5Hpd)!
+
+## Instant Launch
+
+β‘οΈ Β Skip the setupβlaunch instantly with our ready-to-run macOS app. [[Download Here]](https://www.dropbox.com/scl/fi/znid09apxiwtwvxer6oc9/Glass_latest.dmg?rlkey=gwvvyb3bizkl25frhs4k1zwds&st=37q31b4w&dl=1)
+
+## Quick Start (Local Build)
+
+### Prerequisites
+
+First download & install [Python](https://www.python.org/downloads/) and [Node](https://nodejs.org/en/download).
+If you are using Windows, you need to also install [Build Tools for Visual Studio](https://visualstudio.microsoft.com/downloads/)
+
+Ensure you're using Node.js version 20.x.x to avoid build errors with native dependencies.
+
+```bash
+# Check your Node.js version
+node --version
+
+# If you need to install Node.js 20.x.x, we recommend using nvm:
+# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
+# nvm install 20
+# nvm use 20
+```
+
+### Installation
+
+```bash
+npm run setup
+```
+
+## Highlights
+
+
+### Ask: get answers based on all your previous screen actions & audio
+
+
+
+### Meetings: real-time meeting notes, live summaries, session records
+
+
+
+### Use your own OpenAI API key, or sign up to use ours (free)
+
+
+
+You can visit [here](https://platform.openai.com/api-keys) to get your OpenAI API Key.
+
+### Liquid Glass Design (coming soon)
+
+
+
+
+ for a more detailed guide, please refer to this video.
+
+ we don't waste money on fancy vids; we just code.
+
+
+
+
+## Keyboard Shortcuts
+
+`Ctrl/Cmd + \` : show and hide main window
+
+`Ctrl/Cmd + Enter` : ask AI using all your previous screen and audio
+
+`Ctrl/Cmd + Arrows` : move main window position
+
+## Contributing
+
+We love contributions! Feel free to open issues for bugs or feature requests.
+
+## About Pickle
+
+**Our mission is to build a living digital clone for everyone.** Glass is part of Step 1βa trusted pipeline that transforms your daily data into a scalable clone. Visit [pickle.com](https://pickle.com) to learn more.
+
+## Star History
+
+
+
diff --git a/build.js b/build.js
new file mode 100644
index 0000000..a56b5e2
--- /dev/null
+++ b/build.js
@@ -0,0 +1,57 @@
+const esbuild = require('esbuild');
+const path = require('path');
+
+const baseConfig = {
+ bundle: true,
+ platform: 'browser',
+ format: 'esm',
+ loader: { '.js': 'jsx' },
+ sourcemap: true,
+ external: ['electron'],
+ define: {
+ 'process.env.NODE_ENV': `"${process.env.NODE_ENV || 'development'}"`,
+ },
+};
+
+const entryPoints = [
+ { in: 'src/app/HeaderController.js', out: 'public/build/header' },
+ { in: 'src/app/PickleGlassApp.js', out: 'public/build/content' },
+];
+
+async function build() {
+ try {
+ console.log('Building renderer process code...');
+ await Promise.all(entryPoints.map(point => esbuild.build({
+ ...baseConfig,
+ entryPoints: [point.in],
+ outfile: `${point.out}.js`,
+ })));
+ console.log('β
Renderer builds successful!');
+ } catch (e) {
+ console.error('Renderer build failed:', e);
+ process.exit(1);
+ }
+}
+
+async function watch() {
+ try {
+ const contexts = await Promise.all(entryPoints.map(point => esbuild.context({
+ ...baseConfig,
+ entryPoints: [point.in],
+ outfile: `${point.out}.js`,
+ })));
+
+ console.log('Watching for changes...');
+ await Promise.all(contexts.map(context => context.watch()));
+
+ } catch (e) {
+ console.error('Watch mode failed:', e);
+ process.exit(1);
+ }
+}
+
+if (process.argv.includes('--watch')) {
+ watch();
+} else {
+ build();
+}
\ No newline at end of file
diff --git a/electron-builder.yml b/electron-builder.yml
new file mode 100644
index 0000000..532f4ef
--- /dev/null
+++ b/electron-builder.yml
@@ -0,0 +1,36 @@
+# electron-builder.yml
+
+# The unique application ID
+appId: com.pickle.glass
+
+# The user-facing application name
+productName: Glass
+
+# Publish configuration for GitHub releases
+publish:
+ provider: github
+ owner: pickle-com
+ repo: glass
+ releaseType: draft
+
+# List of files to be included in the app package
+files:
+ - src/**/*
+ - package.json
+ - pickleglass_web/backend_node/**/*
+ - '!**/node_modules/electron/**'
+ - public/build/**/*
+
+# Additional resources to be copied into the app's resources directory
+extraResources:
+ - from: src/assets/SystemAudioDump
+ to: SystemAudioDump
+ - from: pickleglass_web/out
+ to: out
+
+# macOS specific configuration
+mac:
+ # The application category type
+ category: public.app-category.utilities
+ # Path to the .icns icon file
+ icon: src/assets/logo.icns
\ No newline at end of file
diff --git a/entitlements.plist b/entitlements.plist
new file mode 100644
index 0000000..240a1a3
--- /dev/null
+++ b/entitlements.plist
@@ -0,0 +1,28 @@
+
+
+
+
+ com.apple.security.cs.allow-jit
+
+ com.apple.security.cs.allow-unsigned-executable-memory
+
+ com.apple.security.cs.debugger
+
+ com.apple.security.cs.disable-library-validation
+
+ com.apple.security.device.audio-input
+
+ com.apple.security.device.microphone
+
+ com.apple.security.network.client
+
+ com.apple.security.network.server
+
+ com.apple.security.temporary-exception.mach-lookup.global-name
+
+ com.deeplink.pickleglass.MachPortRendezvousServer.*
+
+ com.apple.security.app-sandbox
+
+
+
\ No newline at end of file
diff --git a/firebase.json b/firebase.json
new file mode 100644
index 0000000..a3edd99
--- /dev/null
+++ b/firebase.json
@@ -0,0 +1,36 @@
+{
+ "functions": [
+ {
+ "source": "functions",
+ "codebase": "pickle-glass",
+ "ignore": [
+ "node_modules",
+ ".git",
+ "firebase-debug.log",
+ "firebase-debug.*.log",
+ "*.local"
+ ],
+ "predeploy": [
+ "npm --prefix \"$RESOURCE_DIR\" run lint"
+ ]
+ }
+ ],
+ "firestore": {
+ "rules": "firestore.rules",
+ "indexes": "firestore.indexes.json"
+ },
+ "hosting": {
+ "public": "pickleglass_web/out",
+ "ignore": [
+ "firebase.json",
+ "**/.*",
+ "**/node_modules/**"
+ ],
+ "rewrites": [
+ {
+ "source": "**",
+ "destination": "/index.html"
+ }
+ ]
+ }
+}
diff --git a/firestore.indexes.json b/firestore.indexes.json
new file mode 100644
index 0000000..f028cbf
--- /dev/null
+++ b/firestore.indexes.json
@@ -0,0 +1,4 @@
+{
+ "indexes": [],
+ "fieldOverrides": []
+}
\ No newline at end of file
diff --git a/forge.config.js b/forge.config.js
new file mode 100644
index 0000000..4f0bd19
--- /dev/null
+++ b/forge.config.js
@@ -0,0 +1,86 @@
+const { FusesPlugin } = require('@electron-forge/plugin-fuses');
+const { FuseV1Options, FuseVersion } = require('@electron/fuses');
+const { notarizeApp } = require('./notarize');
+
+module.exports = {
+ packagerConfig: {
+ asar: {
+ unpack:
+ '**/*.node,**/*.dylib,' +
+ '**/node_modules/{sharp,@img}/**/*'
+ },
+ extraResource: ['./src/assets/SystemAudioDump', './pickleglass_web/out'],
+ name: 'Glass',
+ icon: 'src/assets/logo',
+ appBundleId: 'com.pickle.glass',
+ protocols: [
+ {
+ name: 'PickleGlass Protocol',
+ schemes: ['pickleglass']
+ }
+ ],
+ asarUnpack: [
+ "**/*.node",
+ "**/*.dylib",
+ "node_modules/@img/sharp-darwin-arm64/**",
+ "node_modules/@img/sharp-libvips-darwin-arm64/**"
+ ],
+ osxSign: {
+ identity: process.env.APPLE_SIGNING_IDENTITY,
+ 'hardened-runtime': true,
+ entitlements: 'entitlements.plist',
+ 'entitlements-inherit': 'entitlements.plist',
+ },
+ osxNotarize: {
+ tool: 'notarytool',
+ appleId: process.env.APPLE_ID,
+ appleIdPassword: process.env.APPLE_ID_PASSWORD,
+ teamId: process.env.APPLE_TEAM_ID
+ }
+ },
+ rebuildConfig: {},
+ makers: [
+ {
+ name: '@electron-forge/maker-squirrel',
+ config: {
+ name: 'pickle-glass',
+ productName: 'Glass',
+ shortcutName: 'Glass',
+ createDesktopShortcut: true,
+ createStartMenuShortcut: true,
+ },
+ },
+ {
+ name: '@electron-forge/maker-dmg',
+ platforms: ['darwin'],
+ },
+ {
+ name: '@electron-forge/maker-deb',
+ config: {},
+ },
+ {
+ name: '@electron-forge/maker-rpm',
+ config: {},
+ },
+ ],
+ hooks: {
+ afterSign: async (context, forgeConfig, platform, arch, appPath) => {
+ await notarizeApp(context, forgeConfig, platform, arch, appPath);
+ },
+ },
+ plugins: [
+ {
+ name: '@electron-forge/plugin-auto-unpack-natives',
+ config: {},
+ },
+ new FusesPlugin({
+ version: FuseVersion.V1,
+ [FuseV1Options.RunAsNode]: false,
+ [FuseV1Options.EnableCookieEncryption]: true,
+ [FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
+ [FuseV1Options.EnableNodeCliInspectArguments]: false,
+ [FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
+ [FuseV1Options.OnlyLoadAppFromAsar]: false,
+ }),
+ ],
+};
diff --git a/functions/.eslintrc.js b/functions/.eslintrc.js
new file mode 100644
index 0000000..f4cb76c
--- /dev/null
+++ b/functions/.eslintrc.js
@@ -0,0 +1,28 @@
+module.exports = {
+ env: {
+ es6: true,
+ node: true,
+ },
+ parserOptions: {
+ "ecmaVersion": 2018,
+ },
+ extends: [
+ "eslint:recommended",
+ "google",
+ ],
+ rules: {
+ "no-restricted-globals": ["error", "name", "length"],
+ "prefer-arrow-callback": "error",
+ "quotes": ["error", "double", {"allowTemplateLiterals": true}],
+ },
+ overrides: [
+ {
+ files: ["**/*.spec.*"],
+ env: {
+ mocha: true,
+ },
+ rules: {},
+ },
+ ],
+ globals: {},
+};
diff --git a/functions/.gitignore b/functions/.gitignore
new file mode 100644
index 0000000..21ee8d3
--- /dev/null
+++ b/functions/.gitignore
@@ -0,0 +1,2 @@
+node_modules/
+*.local
\ No newline at end of file
diff --git a/functions/index.js b/functions/index.js
new file mode 100644
index 0000000..964c3d6
--- /dev/null
+++ b/functions/index.js
@@ -0,0 +1,90 @@
+/**
+ * Import function triggers from their respective submodules:
+ *
+ * const {onCall} = require("firebase-functions/v2/https");
+ * const {onDocumentWritten} = require("firebase-functions/v2/firestore");
+ *
+ * See a full list of supported triggers at https://firebase.google.com/docs/functions
+ */
+
+const {onRequest} = require("firebase-functions/v2/https");
+const logger = require("firebase-functions/logger");
+const admin = require("firebase-admin");
+const cors = require("cors")({origin: true});
+
+admin.initializeApp();
+
+// Create and deploy your first functions
+// https://firebase.google.com/docs/functions/get-started
+
+// exports.helloWorld = onRequest((request, response) => {
+// logger.info("Hello logs!", {structuredData: true});
+// response.send("Hello from Firebase!");
+// });
+
+/**
+ * @name pickleGlassAuthCallback
+ * @description
+ * Validate Firebase ID token and return custom token.
+ * On success, return success response with user information.
+ * On failure, return error message.
+ *
+ * @param {object} request - HTTPS request object. Contains { token: "..." } in body.
+ * @param {object} response - HTTPS response object.
+ */
+const authCallbackHandler = (request, response) => {
+ cors(request, response, async () => {
+ try {
+ logger.info("pickleGlassAuthCallback function triggered", {
+ body: request.body,
+ });
+
+ if (request.method !== "POST") {
+ response.status(405).send("Method Not Allowed");
+ return;
+ }
+ if (!request.body || !request.body.token) {
+ logger.error("Token is missing from the request body");
+ response.status(400).send({
+ success: false,
+ error: "ID token is required.",
+ });
+ return;
+ }
+
+ const idToken = request.body.token;
+ logger.info("Received token:", idToken.substring(0, 20) + "...");
+
+ const decodedToken = await admin.auth().verifyIdToken(idToken);
+ const uid = decodedToken.uid;
+
+ logger.info("Successfully verified token for UID:", uid);
+
+ const customToken = await admin.auth().createCustomToken(uid);
+
+ response.status(200).send({
+ success: true,
+ message: "Authentication successful.",
+ user: {
+ uid: decodedToken.uid,
+ email: decodedToken.email,
+ name: decodedToken.name,
+ picture: decodedToken.picture,
+ },
+ customToken,
+ });
+ } catch (error) {
+ logger.error("Authentication failed:", error);
+ response.status(401).send({
+ success: false,
+ error: "Invalid token or authentication failed.",
+ details: error.message,
+ });
+ }
+ });
+};
+
+exports.pickleGlassAuthCallback = onRequest(
+ {region: "us-west1"},
+ authCallbackHandler,
+);
diff --git a/functions/package.json b/functions/package.json
new file mode 100644
index 0000000..3478f7b
--- /dev/null
+++ b/functions/package.json
@@ -0,0 +1,27 @@
+{
+ "name": "functions",
+ "description": "Cloud Functions for Firebase",
+ "scripts": {
+ "lint": "eslint . --fix",
+ "serve": "firebase emulators:start --only functions",
+ "shell": "firebase functions:shell",
+ "start": "npm run shell",
+ "deploy": "firebase deploy --only functions",
+ "logs": "firebase functions:log"
+ },
+ "engines": {
+ "node": "18"
+ },
+ "main": "index.js",
+ "dependencies": {
+ "cors": "^2.8.5",
+ "firebase-admin": "^12.7.0",
+ "firebase-functions": "^6.0.1"
+ },
+ "devDependencies": {
+ "eslint": "^8.15.0",
+ "eslint-config-google": "^0.14.0",
+ "firebase-functions-test": "^3.1.0"
+ },
+ "private": true
+}
diff --git a/notarize.js b/notarize.js
new file mode 100644
index 0000000..df38397
--- /dev/null
+++ b/notarize.js
@@ -0,0 +1,27 @@
+const { notarize } = require('@electron/notarize');
+
+exports.notarizeApp = async function (context) {
+ if (context.electronPlatformName !== 'darwin') {
+ return;
+ }
+
+ console.log(' notarizing a macOS build!');
+
+ const { appOutDir } = context;
+ const appName = context.packager.appInfo.productFilename;
+ const appPath = `${appOutDir}/${appName}.app`;
+
+ if (!process.env.APPLE_ID || !process.env.APPLE_ID_PASSWORD || !process.env.APPLE_TEAM_ID) {
+ throw new Error('APPLE_ID, APPLE_ID_PASSWORD, and APPLE_TEAM_ID environment variables are required for notarization.');
+ }
+
+ await notarize({
+ appBundleId: 'com.pickle.glass',
+ appPath: appPath,
+ appleId: process.env.APPLE_ID,
+ appleIdPassword: process.env.APPLE_ID_PASSWORD,
+ teamId: process.env.APPLE_TEAM_ID,
+ });
+
+ console.log(`Successfully notarized ${appName}`);
+};
\ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..b5eaa2a
--- /dev/null
+++ b/package.json
@@ -0,0 +1,69 @@
+{
+ "name": "pickle-glass",
+ "productName": "Glass",
+ "version": "0.1.1",
+ "description": "Cl*ely for Free",
+ "main": "src/index.js",
+ "scripts": {
+ "setup": "npm install && cd pickleglass_web && npm install && npm run build && cd .. && npm start",
+ "start": "npm run build:renderer && electron-forge start",
+ "package": "npm run build:renderer && electron-forge package",
+ "make": "npm run build:renderer && electron-forge make",
+ "build": "npm run build:renderer && electron-builder --config electron-builder.yml --publish never",
+ "publish": "npm run build:renderer && electron-builder --config electron-builder.yml --publish always",
+ "lint": "eslint --ext .ts,.tsx,.js .",
+ "postinstall": "electron-builder install-app-deps",
+ "build:renderer": "node build.js",
+ "watch:renderer": "node build.js --watch"
+ },
+ "keywords": [
+ "glass",
+ "pickle glass",
+ "ai assistant",
+ "real-time",
+ "live summary",
+ "contextual ai"
+ ],
+ "author": {
+ "name": "Pickle Team"
+ },
+ "license": "GPL-3.0",
+ "dependencies": {
+ "axios": "^1.10.0",
+ "better-sqlite3": "^9.4.3",
+ "cors": "^2.8.5",
+ "dotenv": "^17.0.0",
+ "electron-deeplink": "^1.0.10",
+ "electron-squirrel-startup": "^1.0.1",
+ "electron-store": "^8.2.0",
+ "electron-updater": "^6.6.2",
+ "express": "^4.18.2",
+ "firebase": "^11.10.0",
+ "firebase-admin": "^13.4.0",
+ "jsonwebtoken": "^9.0.2",
+ "node-fetch": "^2.7.0",
+ "openai": "^4.70.0",
+ "react-hot-toast": "^2.5.2",
+ "sharp": "^0.34.2",
+ "sqlite3": "^5.1.7",
+ "validator": "^13.11.0",
+ "wait-on": "^8.0.3",
+ "ws": "^8.18.0"
+ },
+ "devDependencies": {
+ "@electron-forge/cli": "^7.8.1",
+ "@electron-forge/maker-deb": "^7.8.1",
+ "@electron-forge/maker-dmg": "^7.8.1",
+ "@electron-forge/maker-rpm": "^7.8.1",
+ "@electron-forge/maker-squirrel": "^7.8.1",
+ "@electron-forge/maker-zip": "^7.8.1",
+ "@electron-forge/plugin-auto-unpack-natives": "^7.8.1",
+ "@electron-forge/plugin-fuses": "^7.8.1",
+ "@electron/fuses": "^1.8.0",
+ "@electron/notarize": "^2.5.0",
+ "electron": "^30.5.1",
+ "electron-builder": "^26.0.12",
+ "electron-reloader": "^1.2.3",
+ "esbuild": "^0.25.5"
+ }
+}
diff --git a/pickleglass_web/Dockerfile.backend b/pickleglass_web/Dockerfile.backend
new file mode 100644
index 0000000..74a4526
--- /dev/null
+++ b/pickleglass_web/Dockerfile.backend
@@ -0,0 +1,17 @@
+FROM python:3.11-slim
+
+WORKDIR /app
+
+RUN apt-get update && apt-get install -y \
+ gcc \
+ && rm -rf /var/lib/apt/lists/*
+
+COPY requirements.txt .
+
+RUN pip install --no-cache-dir -r requirements.txt
+
+COPY backend/ .
+
+EXPOSE 8000
+
+CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
\ No newline at end of file
diff --git a/pickleglass_web/Dockerfile.frontend b/pickleglass_web/Dockerfile.frontend
new file mode 100644
index 0000000..5cb13b4
--- /dev/null
+++ b/pickleglass_web/Dockerfile.frontend
@@ -0,0 +1,15 @@
+FROM node:18-alpine
+
+WORKDIR /app
+
+COPY package*.json ./
+
+RUN npm ci --only=production
+
+COPY . .
+
+RUN npm run build
+
+EXPOSE 3000
+
+CMD ["npm", "start"]
\ No newline at end of file
diff --git a/pickleglass_web/app/activity/details/page.tsx b/pickleglass_web/app/activity/details/page.tsx
new file mode 100644
index 0000000..f00f71a
--- /dev/null
+++ b/pickleglass_web/app/activity/details/page.tsx
@@ -0,0 +1,149 @@
+'use client'
+
+import { useState, useEffect, Suspense } from 'react'
+import { useRedirectIfNotAuth } from '@/utils/auth'
+import { useSearchParams } from 'next/navigation'
+import Link from 'next/link'
+import {
+ UserProfile,
+ SessionDetails,
+ Transcript,
+ AiMessage,
+ getSessionDetails,
+} from '@/utils/api'
+
+type ConversationItem = (Transcript & { type: 'transcript' }) | (AiMessage & { type: 'ai_message' });
+
+const Section = ({ title, children }: { title: string, children: React.ReactNode }) => (
+
+
{title}
+
+ {children}
+
+
+);
+
+function SessionDetailsContent() {
+ const userInfo = useRedirectIfNotAuth() as UserProfile | null;
+ const [sessionDetails, setSessionDetails] = useState(null);
+ const [isLoading, setIsLoading] = useState(true);
+ const searchParams = useSearchParams();
+ const sessionId = searchParams.get('sessionId');
+
+ useEffect(() => {
+ if (userInfo && sessionId) {
+ const fetchDetails = async () => {
+ setIsLoading(true);
+ try {
+ const details = await getSessionDetails(sessionId as string);
+ setSessionDetails(details);
+ } catch (error) {
+ console.error('Failed to load session details:', error);
+ } finally {
+ setIsLoading(false);
+ }
+ };
+ fetchDetails();
+ }
+ }, [userInfo, sessionId]);
+
+ if (!userInfo || isLoading) {
+ return (
+
+
+
+
Loading session details...
+
+
+ );
+ }
+
+ if (!sessionDetails) {
+ return (
+
+
+
Session Not Found
+
The requested session could not be found.
+
+ ← Back to Activity
+
+
+
+ )
+ }
+
+ const combinedConversation = [
+ ...sessionDetails.transcripts.map(t => ({ ...t, type: 'transcript' as const, created_at: t.start_at })),
+ ...sessionDetails.ai_messages.map(m => ({ ...m, type: 'ai_message' as const, created_at: m.sent_at }))
+ ].sort((a, b) => (a.created_at || 0) - (b.created_at || 0));
+
+ const audioTranscripts = sessionDetails.transcripts.filter(t => t.speaker !== 'Me');
+
+ return (
+
+
+
+
+
+
+
+ {sessionDetails.session.title || `Conversation on ${new Date(sessionDetails.session.started_at * 1000).toLocaleDateString()}`}
+
+
+ {new Date(sessionDetails.session.started_at * 1000).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })}
+ {new Date(sessionDetails.session.started_at * 1000).toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit', hour12: true })}
+
+
+
+ {sessionDetails.summary && (
+
+ "{sessionDetails.summary.tldr}"
+
+ )}
+
+
+ {combinedConversation.map((item) => (
+
+ {(item.type === 'transcript' && item.speaker === 'Me') || (item.type === 'ai_message' && item.role === 'user') ? 'You: ' : 'AI: '}
+ {item.type === 'transcript' ? item.text : item.content}
+
+ ))}
+ {combinedConversation.length === 0 && No notes recorded for this session.
}
+
+
+
+ {audioTranscripts.length > 0 ? (
+
+ {audioTranscripts.map(t => {t.text} )}
+
+ ) : (
+ No audio transcript available for this session.
+ )}
+
+
+
+
+ );
+}
+
+export default function SessionDetailsPage() {
+ return (
+
+
+
+ }>
+
+
+ );
+}
\ No newline at end of file
diff --git a/pickleglass_web/app/activity/page.tsx b/pickleglass_web/app/activity/page.tsx
new file mode 100644
index 0000000..2909c45
--- /dev/null
+++ b/pickleglass_web/app/activity/page.tsx
@@ -0,0 +1,97 @@
+'use client'
+
+import { useState, useEffect } from 'react'
+import Link from 'next/link'
+import { useRedirectIfNotAuth } from '@/utils/auth'
+import {
+ UserProfile,
+ Session,
+ getSessions,
+} from '@/utils/api'
+
+export default function ActivityPage() {
+ const userInfo = useRedirectIfNotAuth() as UserProfile | null;
+ const [sessions, setSessions] = useState([])
+ const [isLoading, setIsLoading] = useState(true)
+
+ const fetchSessions = async () => {
+ try {
+ const fetchedSessions = await getSessions();
+ setSessions(fetchedSessions);
+ } catch (error) {
+ console.error('Failed to fetch conversations:', error)
+ } finally {
+ setIsLoading(false)
+ }
+ }
+
+ useEffect(() => {
+ fetchSessions()
+ }, [])
+
+ if (!userInfo) {
+ return (
+
+ )
+ }
+
+ const getGreeting = () => {
+ const hour = new Date().getHours()
+ if (hour < 12) return 'Good morning'
+ if (hour < 18) return 'Good afternoon'
+ return 'Good evening'
+ }
+
+ return (
+
+
+
+
+ {getGreeting()}, {userInfo.display_name}
+
+
+
+
+ Your Past Activity
+
+ {isLoading ? (
+
+
+
Loading conversations...
+
+ ) : sessions.length > 0 ? (
+
+ {sessions.map((session) => (
+
+
+
{session.title || `Conversation - ${new Date(session.started_at * 1000).toLocaleDateString()}`}
+
+ {new Date(session.started_at * 1000).toLocaleString()}
+
+
+
+ Conversation
+
+
+ ))}
+
+ ) : (
+
+
+ No conversations yet. Start a conversation in the desktop app to see your activity here.
+
+
+ π‘ Tip: Use the desktop app to have AI-powered conversations that will appear here automatically.
+
+
+ )}
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/pickleglass_web/app/download/page.tsx b/pickleglass_web/app/download/page.tsx
new file mode 100644
index 0000000..79e9c31
--- /dev/null
+++ b/pickleglass_web/app/download/page.tsx
@@ -0,0 +1,102 @@
+'use client'
+
+import { Download, Smartphone, Monitor, Tablet } from 'lucide-react'
+import { useRedirectIfNotAuth } from '@/utils/auth'
+
+export default function DownloadPage() {
+ const userInfo = useRedirectIfNotAuth()
+
+ if (!userInfo) {
+ return (
+
+ )
+ }
+
+ return (
+
+
+
Download pickleglass
+
+ Use pickleglass on various platforms
+
+
+
+
+
+
Desktop
+
Windows, macOS, Linux
+
+
+ Download Desktop
+
+
+
+
+
+
Mobile
+
iOS, Android
+
+
+ App Store
+
+
+ Google Play
+
+
+
+
+
+
+
Tablet
+
iPad, Android Tablet
+
+
+ Download Tablet
+
+
+
+
+
+
System Requirements
+
+
+
Windows
+
+ β’ Windows 10 or later
+ β’ 4GB RAM
+ β’ 100MB Storage
+
+
+
+
macOS
+
+ β’ macOS 11.0 or later
+ β’ 4GB RAM
+ β’ 100MB Storage
+
+
+
+
Mobile
+
+ β’ iOS 14.0 or later
+ β’ Android 8.0 or later
+ β’ 50MB Storage
+
+
+
+
+
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/pickleglass_web/app/globals.css b/pickleglass_web/app/globals.css
new file mode 100644
index 0000000..85589d4
--- /dev/null
+++ b/pickleglass_web/app/globals.css
@@ -0,0 +1,34 @@
+@tailwind base;
+@tailwind components;
+@tailwind utilities;
+
+:root {
+ --foreground-rgb: 0, 0, 0;
+ --background-start-rgb: 214, 219, 220;
+ --background-end-rgb: 255, 255, 255;
+}
+
+@media (prefers-color-scheme: dark) {
+ :root {
+ --foreground-rgb: 255, 255, 255;
+ --background-start-rgb: 0, 0, 0;
+ --background-end-rgb: 0, 0, 0;
+ }
+}
+
+body {
+ color: rgb(var(--foreground-rgb));
+ background: linear-gradient(
+ to bottom,
+ transparent,
+ rgb(var(--background-end-rgb))
+ )
+ rgb(var(--background-start-rgb));
+ letter-spacing: -0.03em;
+}
+
+@layer utilities {
+ .text-balance {
+ text-wrap: balance;
+ }
+}
\ No newline at end of file
diff --git a/pickleglass_web/app/help/page.tsx b/pickleglass_web/app/help/page.tsx
new file mode 100644
index 0000000..5bc91d1
--- /dev/null
+++ b/pickleglass_web/app/help/page.tsx
@@ -0,0 +1,110 @@
+'use client'
+
+import { HelpCircle, Book, MessageCircle, Mail } from 'lucide-react'
+import { useRedirectIfNotAuth } from '@/utils/auth'
+
+export default function HelpPage() {
+ const userInfo = useRedirectIfNotAuth()
+
+ if (!userInfo) {
+ return (
+
+ )
+ }
+
+ return (
+
+
+
Help Center
+
+
+
+
+
+
Getting Started
+
+
+ New to pickleglass? Learn about basic features and setup methods.
+
+
+ β’ Setting up personalized contexts
+ β’ Selecting presets and creating custom contexts
+ β’ Checking activity records
+ β’ Changing settings
+
+
+
+
+
+
+
Frequently Asked Questions
+
+
+ Check out frequently asked questions and answers from other users.
+
+
+
+
+ How do I change the context?
+
+
+ On the Personalize page, select a preset or enter a custom context, then click the Save button.
+
+
+
+
+ Where can I check my activity history?
+
+
+ You can check your past activity records on the My Activity page.
+
+
+
+
+
+
+
+
+
+
+
Community
+
+
+ Connect with other users and share tips.
+
+
+ Join Community β
+
+
+
+
+
+
+
Contact Us
+
+
+ Couldn't find a solution? Contact us directly.
+
+
+ Contact via Email β
+
+
+
+
+
+
π‘ Tip
+
+ Each context is optimized for different situations.
+ Choose the appropriate preset for your work environment,
+ or create your own custom context!
+
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/pickleglass_web/app/layout.tsx b/pickleglass_web/app/layout.tsx
new file mode 100644
index 0000000..c9a1b38
--- /dev/null
+++ b/pickleglass_web/app/layout.tsx
@@ -0,0 +1,26 @@
+import './globals.css'
+import { Inter } from 'next/font/google'
+import ClientLayout from '@/components/ClientLayout'
+
+const inter = Inter({ subsets: ['latin'] })
+
+export const metadata = {
+ title: 'pickleglass - AI Assistant',
+ description: 'Personalized AI Assistant for various contexts',
+}
+
+export default function RootLayout({
+ children,
+}: {
+ children: React.ReactNode
+}) {
+ return (
+
+
+
+ {children}
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/pickleglass_web/app/login/page.tsx b/pickleglass_web/app/login/page.tsx
new file mode 100644
index 0000000..60ab49a
--- /dev/null
+++ b/pickleglass_web/app/login/page.tsx
@@ -0,0 +1,132 @@
+'use client'
+
+import { useRouter } from 'next/navigation'
+import { GoogleAuthProvider, signInWithPopup } from 'firebase/auth'
+import { auth } from '@/utils/firebase'
+import { Chrome } from 'lucide-react'
+import { useState, useEffect } from 'react'
+
+export default function LoginPage() {
+ const router = useRouter()
+ const [isLoading, setIsLoading] = useState(false)
+ const [isElectronMode, setIsElectronMode] = useState(false)
+
+ useEffect(() => {
+ const urlParams = new URLSearchParams(window.location.search)
+ const mode = urlParams.get('mode')
+ setIsElectronMode(mode === 'electron')
+ }, [])
+
+ const handleGoogleSignIn = async () => {
+ const provider = new GoogleAuthProvider()
+ setIsLoading(true)
+
+ try {
+ const result = await signInWithPopup(auth, provider)
+ const user = result.user
+
+ if (user) {
+ console.log('β
Google login successful:', user.uid)
+
+ if (isElectronMode) {
+ try {
+ const idToken = await user.getIdToken()
+
+ const deepLinkUrl = `pickleglass://auth-success?` + new URLSearchParams({
+ uid: user.uid,
+ email: user.email || '',
+ displayName: user.displayName || '',
+ token: idToken
+ }).toString()
+
+ console.log('π Return to electron app via deep link:', deepLinkUrl)
+
+ window.location.href = deepLinkUrl
+
+ setTimeout(() => {
+ alert('Login completed. Please return to Pickle Glass app.')
+ }, 1000)
+
+ } catch (error) {
+ console.error('β Deep link processing failed:', error)
+ alert('Login was successful but failed to return to app. Please check the app.')
+ }
+ }
+ else if (typeof window !== 'undefined' && window.require) {
+ try {
+ const { ipcRenderer } = window.require('electron')
+ const idToken = await user.getIdToken()
+
+ ipcRenderer.send('firebase-auth-success', {
+ uid: user.uid,
+ displayName: user.displayName,
+ email: user.email,
+ idToken
+ })
+
+ console.log('π‘ Auth info sent to electron successfully')
+ } catch (error) {
+ console.error('β Electron communication failed:', error)
+ }
+ }
+ else {
+ router.push('/settings')
+ }
+ }
+ } catch (error: any) {
+ console.error('β Google login failed:', error)
+
+ if (error.code !== 'auth/popup-closed-by-user') {
+ alert('An error occurred during login. Please try again.')
+ }
+ } finally {
+ setIsLoading(false)
+ }
+ }
+
+ return (
+
+
+
Welcome to Pickle Glass
+
Sign in with your Google account to sync your data across all devices.
+ {isElectronMode ? (
+
π Login requested from Electron app
+ ) : (
+
Local mode will run if you don't sign in.
+ )}
+
+
+
+
+
+
+ {isLoading ? 'Signing in...' : 'Sign in with Google'}
+
+
+
+ {
+ if (isElectronMode) {
+ window.location.href = 'pickleglass://auth-success?uid=default_user&email=contact@pickle.com&displayName=Default%20User'
+ } else {
+ router.push('/settings')
+ }
+ }}
+ className="text-sm text-gray-500 hover:text-gray-700 underline"
+ >
+ Continue in local mode
+
+
+
+
+
+ By signing in, you agree to our Terms of Service and Privacy Policy.
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/pickleglass_web/app/page.tsx b/pickleglass_web/app/page.tsx
new file mode 100644
index 0000000..6b09af1
--- /dev/null
+++ b/pickleglass_web/app/page.tsx
@@ -0,0 +1,21 @@
+'use client'
+
+import { useEffect } from 'react'
+import { useRouter } from 'next/navigation'
+
+export default function Home() {
+ const router = useRouter()
+
+ useEffect(() => {
+ router.push('/personalize')
+ }, [router])
+
+ return (
+
+ )
+}
\ No newline at end of file
diff --git a/pickleglass_web/app/personalize/page.tsx b/pickleglass_web/app/personalize/page.tsx
new file mode 100644
index 0000000..1a0d562
--- /dev/null
+++ b/pickleglass_web/app/personalize/page.tsx
@@ -0,0 +1,172 @@
+'use client'
+
+import { useState, useEffect } from 'react'
+import { ChevronDown } from 'lucide-react'
+import { getPresets, updatePreset, PromptPreset } from '@/utils/api'
+
+export default function PersonalizePage() {
+ const [allPresets, setAllPresets] = useState([]);
+ const [selectedPreset, setSelectedPreset] = useState(null);
+ const [showPresets, setShowPresets] = useState(true);
+ const [editorContent, setEditorContent] = useState('');
+ const [loading, setLoading] = useState(true);
+ const [saving, setSaving] = useState(false);
+ const [isDirty, setIsDirty] = useState(false);
+
+ useEffect(() => {
+ const fetchData = async () => {
+ try {
+ setLoading(true);
+ const presetsData = await getPresets();
+ setAllPresets(presetsData);
+
+ if (presetsData.length > 0) {
+ const firstUserPreset = presetsData.find(p => p.is_default === 0) || presetsData[0];
+ setSelectedPreset(firstUserPreset);
+ setEditorContent(firstUserPreset.prompt);
+ }
+ } catch (error) {
+ console.error("Failed to fetch presets:", error);
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ fetchData();
+ }, []);
+
+ const handlePresetClick = (preset: PromptPreset) => {
+ if (isDirty && !window.confirm("You have unsaved changes. Are you sure you want to switch?")) {
+ return;
+ }
+ setSelectedPreset(preset);
+ setEditorContent(preset.prompt);
+ setIsDirty(false);
+ };
+
+ const handleEditorChange = (e: React.ChangeEvent) => {
+ setEditorContent(e.target.value);
+ setIsDirty(true);
+ };
+
+ const handleSave = async () => {
+ if (!selectedPreset || saving || !isDirty) return;
+
+ if (selectedPreset.is_default === 1) {
+ alert("Default presets cannot be modified.");
+ return;
+ }
+
+ try {
+ setSaving(true);
+ await updatePreset(selectedPreset.id, {
+ title: selectedPreset.title,
+ prompt: editorContent
+ });
+
+ setAllPresets(prev =>
+ prev.map(p =>
+ p.id === selectedPreset.id
+ ? { ...p, prompt: editorContent }
+ : p
+ )
+ );
+ setIsDirty(false);
+ console.log('Save completed!');
+ } catch (error) {
+ console.error("Save failed:", error);
+ alert("Failed to save preset. See console for details.");
+ } finally {
+ setSaving(false);
+ }
+ };
+
+ if (loading) {
+ return (
+
+ );
+ }
+
+ return (
+
+
+
+
+
+
Presets
+
Personalize
+
+
+ {!isDirty && !saving ? 'Saved' : saving ? 'Saving...' : 'Save'}
+
+
+
+
+
+
+
+
+ setShowPresets(!showPresets)}
+ className="flex items-center gap-2 text-gray-600 hover:text-gray-800 text-sm font-medium transition-colors"
+ >
+
+ {showPresets ? 'Hide Presets' : 'Show Presets'}
+
+
+
+ {showPresets && (
+
+ {allPresets.map((preset) => (
+
handlePresetClick(preset)}
+ className={`
+ p-4 rounded-lg cursor-pointer transition-all duration-200 bg-white
+ h-48 flex flex-col shadow-sm hover:shadow-md
+ ${selectedPreset?.id === preset.id
+ ? 'border-2 border-blue-500 shadow-md'
+ : 'border border-gray-200 hover:border-gray-300'
+ }
+ `}
+ >
+
+ {preset.title}
+
+
+ {preset.prompt.substring(0, 100) + (preset.prompt.length > 100 ? '...' : '')}
+
+
+ ))}
+
+ )}
+
+
+
+
+
+ );
+}
\ No newline at end of file
diff --git a/pickleglass_web/app/settings/billing/page.tsx b/pickleglass_web/app/settings/billing/page.tsx
new file mode 100644
index 0000000..833c1e0
--- /dev/null
+++ b/pickleglass_web/app/settings/billing/page.tsx
@@ -0,0 +1,59 @@
+'use client'
+
+import { useRedirectIfNotAuth } from '@/utils/auth'
+
+export default function BillingPage() {
+ const userInfo = useRedirectIfNotAuth()
+
+ if (!userInfo) {
+ return (
+
+ )
+ }
+
+ const tabs = [
+ { id: 'profile', name: 'Personal profile', href: '/settings' },
+ { id: 'privacy', name: 'Data & privacy', href: '/settings/privacy' },
+ { id: 'billing', name: 'Billing', href: '/settings/billing' },
+ ]
+
+ return (
+
+
+
+
Settings
+
Personal settings
+
+
+
+
+
+
+ Cl*ely For Free
+
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/pickleglass_web/app/settings/page.tsx b/pickleglass_web/app/settings/page.tsx
new file mode 100644
index 0000000..97b00e2
--- /dev/null
+++ b/pickleglass_web/app/settings/page.tsx
@@ -0,0 +1,506 @@
+'use client'
+
+import { useState, useEffect } from 'react'
+import { Check, ExternalLink, Cloud, HardDrive } from 'lucide-react'
+import { useAuth } from '@/utils/auth'
+import {
+ UserProfile,
+ getUserProfile,
+ updateUserProfile,
+ checkApiKeyStatus,
+ saveApiKey,
+ deleteAccount,
+ logout
+} from '@/utils/api'
+import { useRouter } from 'next/navigation'
+
+declare global {
+ interface Window {
+ ipcRenderer?: any;
+ }
+}
+
+type Tab = 'profile' | 'privacy' | 'billing'
+type BillingCycle = 'monthly' | 'annually'
+
+export default function SettingsPage() {
+ const { user: userInfo, isLoading, mode } = useAuth()
+ const [activeTab, setActiveTab] = useState('profile')
+ const [billingCycle, setBillingCycle] = useState('monthly')
+ const [profile, setProfile] = useState(null)
+ const [hasApiKey, setHasApiKey] = useState(false)
+ const [apiKeyInput, setApiKeyInput] = useState('')
+ const [isSaving, setIsSaving] = useState(false)
+ const [displayNameInput, setDisplayNameInput] = useState('')
+ const router = useRouter()
+
+ const fetchApiKeyStatus = async () => {
+ try {
+ const apiKeyStatus = await checkApiKeyStatus()
+ setHasApiKey(apiKeyStatus.hasApiKey)
+ } catch (error) {
+ console.error("Failed to fetch API key status:", error);
+ }
+ }
+
+ useEffect(() => {
+ if (!userInfo) return
+
+ const fetchProfileData = async () => {
+ try {
+ const userProfile = await getUserProfile()
+ setProfile(userProfile)
+ setDisplayNameInput(userProfile.display_name)
+ await fetchApiKeyStatus();
+ } catch (error) {
+ console.error("Failed to fetch profile data:", error)
+ }
+ }
+ fetchProfileData()
+
+ if (window.ipcRenderer) {
+ window.ipcRenderer.on('api-key-updated', () => {
+ console.log('Received api-key-updated event from main process.');
+ fetchApiKeyStatus();
+ });
+ }
+
+ return () => {
+ if (window.ipcRenderer) {
+ window.ipcRenderer.removeAllListeners('api-key-updated');
+ }
+ }
+ }, [userInfo])
+
+ if (isLoading) {
+ return (
+
+ )
+ }
+
+ if (!userInfo) {
+ router.push('/login')
+ return null
+ }
+
+ const isFirebaseMode = mode === 'firebase'
+
+ const tabs = [
+ { id: 'profile' as Tab, name: 'Personal Profile', href: '/settings' },
+ { id: 'privacy' as Tab, name: 'Data & Privacy', href: '/settings/privacy' },
+ { id: 'billing' as Tab, name: 'Billing', href: '/settings/billing' },
+ ]
+
+ const handleSaveApiKey = async () => {
+ setIsSaving(true)
+ try {
+ await saveApiKey(apiKeyInput)
+ setHasApiKey(true)
+ setApiKeyInput('')
+ if (window.ipcRenderer) {
+ window.ipcRenderer.invoke('save-api-key', apiKeyInput);
+ }
+ } catch (error) {
+ console.error("Failed to save API key:", error)
+ } finally {
+ setIsSaving(false)
+ }
+ }
+
+ const handleUpdateDisplayName = async () => {
+ if (!profile || displayNameInput === profile.display_name) return;
+ setIsSaving(true);
+ try {
+ await updateUserProfile({ displayName: displayNameInput });
+ setProfile(prev => prev ? { ...prev, display_name: displayNameInput } : null);
+ } catch (error) {
+ console.error("Failed to update display name:", error);
+ } finally {
+ setIsSaving(false);
+ }
+ }
+
+ const handleDeleteAccount = async () => {
+ const confirmMessage = isFirebaseMode
+ ? "Are you sure you want to delete your account? This action cannot be undone and all data stored in Firebase will be deleted."
+ : "Are you sure you want to delete your account? This action cannot be undone and all data will be deleted."
+
+ if (window.confirm(confirmMessage)) {
+ try {
+ await deleteAccount()
+ router.push('/login');
+ } catch (error) {
+ console.error("Failed to delete account:", error)
+ }
+ }
+ }
+
+ const handleLogout = async () => {
+ try {
+ await logout()
+ } catch (error) {
+ console.error("Logout failed:", error)
+ }
+ }
+
+ const renderBillingContent = () => (
+
+
+
+ {isFirebaseMode ? (
+
+ ) : (
+
+ )}
+
+ {isFirebaseMode ? 'Firebase Hosting Mode' : 'Local Execution Mode'}
+
+
+
+ {isFirebaseMode
+ ? 'All data is safely stored and synchronized in Firebase Cloud.'
+ : 'Data is stored in local database and you can use personal API keys.'
+ }
+
+
+
+
+ setBillingCycle('monthly')}
+ className={`px-4 py-2 rounded-md text-sm font-medium transition-colors ${
+ billingCycle === 'monthly'
+ ? 'bg-gray-200 text-gray-900'
+ : 'text-gray-600 hover:text-gray-900'
+ }`}
+ >
+ Monthly
+
+ setBillingCycle('annually')}
+ className={`px-4 py-2 rounded-md text-sm font-medium transition-colors ${
+ billingCycle === 'annually'
+ ? 'bg-gray-200 text-gray-900'
+ : 'text-gray-600 hover:text-gray-900'
+ }`}
+ >
+ Annually
+
+
+
+
+
+
+
+
+ Experience how Pickle Glass works with unlimited responses.
+
+
+
+
+
+ Daily unlimited responses
+
+
+
+ Unlimited access to free models
+
+
+
+ Unlimited text output
+
+
+
+ Screen viewing, audio listening
+
+
+
+ Custom system prompts
+
+
+
+ Community support only
+
+
+
+
+ Current Plan
+
+
+
+
+
+
+
+ Use latest models, get full response output, and work with custom prompts.
+
+
+
+
+
+ Unlimited pro responses
+
+
+
+ Unlimited access to latest models
+
+
+
+ Full access to conversation dashboard
+
+
+
+ Priority support
+
+
+
+ All features from free plan
+
+
+
+
+ Coming Soon
+
+
+
+
+
+
+
+ Specially crafted for teams that need complete customization.
+
+
+
+
+
+ Custom integrations
+
+
+
+ User provisioning & role-based access
+
+
+
+ Advanced post-call analytics
+
+
+
+ Single sign-on
+
+
+
+ Advanced security features
+
+
+
+ Centralized billing
+
+
+
+ Usage analytics & reporting dashboard
+
+
+
+
+ Coming Soon
+
+
+
+
+
+
+
+
+
All features are currently free!
+
+ {isFirebaseMode
+ ? 'Enjoy all Pickle Glass features for free in Firebase hosting mode. Pro and Enterprise plans will be released soon with additional premium features.'
+ : 'Enjoy all Pickle Glass features for free in local mode. You can use personal API keys or continue using the free system.'
+ }
+
+
+
+
+
+ )
+
+ const renderTabContent = () => {
+ switch (activeTab) {
+ case 'billing':
+ return renderBillingContent()
+ case 'profile':
+ return (
+
+
+
+
+ {isFirebaseMode ? (
+
+ ) : (
+
+ )}
+
+
+ {isFirebaseMode ? 'Firebase Hosting Mode' : 'Local Execution Mode'}
+
+
+ {isFirebaseMode
+ ? `Logged in with Google account (${userInfo.email})`
+ : 'Running as local user'
+ }
+
+
+
+ {isFirebaseMode && (
+
+ Logout
+
+ )}
+
+
+
+
+
Display Name
+
Enter your full name or a display name you're comfortable using.
+
+
setDisplayNameInput(e.target.value)}
+ className="block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm text-black"
+ maxLength={32}
+ />
+
You can use up to 32 characters.
+
+
+
+ Update
+
+
+
+
+ {!isFirebaseMode && (
+
+
API Key
+
+ If you want to use your own LLM API key, you can add it here. It will be used for all requests made by the local application.
+
+
+
+
+ API Key
+
+
+ setApiKeyInput(e.target.value)}
+ className="flex-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm text-black"
+ placeholder="Enter new API key or existing API key"
+ />
+
+ {hasApiKey ? (
+
API key is currently set.
+ ) : (
+
No API key set. Using free system.
+ )}
+
+
+
+
+ {isSaving ? 'Saving...' : 'Save'}
+
+
+
+ )}
+
+ {(isFirebaseMode || (!isFirebaseMode && !hasApiKey)) && (
+
+
Delete Account
+
+ {isFirebaseMode
+ ? 'Permanently remove your Firebase account and all content. This action cannot be undone, so please proceed carefully.'
+ : 'Permanently remove your personal account and all content from the Pickle Glass platform. This action cannot be undone, so please proceed carefully.'
+ }
+
+
+
+ Delete
+
+
+
+ )}
+
+ )
+ case 'privacy':
+ return null
+ default:
+ return renderBillingContent()
+ }
+ }
+
+ return (
+
+
+
+
Settings
+
Personal Settings
+
+
+
+
+ {renderTabContent()}
+
+
+ )
+}
\ No newline at end of file
diff --git a/pickleglass_web/app/settings/privacy/page.tsx b/pickleglass_web/app/settings/privacy/page.tsx
new file mode 100644
index 0000000..0ec44d1
--- /dev/null
+++ b/pickleglass_web/app/settings/privacy/page.tsx
@@ -0,0 +1,92 @@
+'use client'
+
+import { ExternalLink } from 'lucide-react'
+import { useRedirectIfNotAuth } from '@/utils/auth'
+
+export default function PrivacySettingsPage() {
+ const userInfo = useRedirectIfNotAuth()
+
+ if (!userInfo) {
+ return (
+
+ )
+ }
+
+ const tabs = [
+ { id: 'profile', name: 'Personal profile', href: '/settings' },
+ { id: 'privacy', name: 'Data & privacy', href: '/settings/privacy' },
+ { id: 'billing', name: 'Billing', href: '/settings/billing' },
+ ]
+
+ return (
+
+
+
+
Settings
+
Personal settings
+
+
+
+
+
+
+
+
Privacy Policy
+
+ Understand how we collect, use, and protect your personal information.
+
+
+
+ window.open('https://www.pickle.com/ko/privacy-policy', '_blank')}
+ className="flex items-center gap-2 px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-md text-sm font-medium transition-colors"
+ >
+ Privacy
+
+
+
+
+
+
+
+
Terms of Service
+
+ Understand your rights and responsibilities when using our platform.
+
+
+
+ window.open('https://www.pickle.com/ko/terms-of-service', '_blank')}
+ className="flex items-center gap-2 px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-md text-sm font-medium transition-colors"
+ >
+ Terms
+
+
+
+
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/pickleglass_web/backend_node/db.js b/pickleglass_web/backend_node/db.js
new file mode 100644
index 0000000..2fb78a0
--- /dev/null
+++ b/pickleglass_web/backend_node/db.js
@@ -0,0 +1,103 @@
+const path = require('path');
+const databaseInitializer = require('../../src/common/services/databaseInitializer');
+const Database = require('better-sqlite3');
+
+const dbPath = databaseInitializer.getDatabasePath();
+const db = new Database(dbPath);
+
+db.pragma('journal_mode = WAL');
+
+db.exec(`
+-- users
+CREATE TABLE IF NOT EXISTS users (
+ uid TEXT PRIMARY KEY,
+ display_name TEXT NOT NULL,
+ email TEXT NOT NULL,
+ created_at INTEGER,
+ api_key TEXT
+);
+
+-- sessions
+CREATE TABLE IF NOT EXISTS sessions (
+ id TEXT PRIMARY KEY,
+ uid TEXT NOT NULL,
+ title TEXT,
+ started_at INTEGER,
+ ended_at INTEGER,
+ sync_state TEXT DEFAULT 'clean',
+ updated_at INTEGER
+);
+
+-- transcripts
+CREATE TABLE IF NOT EXISTS transcripts (
+ id TEXT PRIMARY KEY,
+ session_id TEXT NOT NULL,
+ start_at INTEGER,
+ end_at INTEGER,
+ speaker TEXT,
+ text TEXT,
+ lang TEXT,
+ created_at INTEGER,
+ sync_state TEXT DEFAULT 'clean'
+);
+
+-- ai_messages
+CREATE TABLE IF NOT EXISTS ai_messages (
+ id TEXT PRIMARY KEY,
+ session_id TEXT NOT NULL,
+ sent_at INTEGER,
+ role TEXT,
+ content TEXT,
+ tokens INTEGER,
+ model TEXT,
+ created_at INTEGER,
+ sync_state TEXT DEFAULT 'clean'
+);
+
+-- summaries
+CREATE TABLE IF NOT EXISTS summaries (
+ session_id TEXT PRIMARY KEY,
+ generated_at INTEGER,
+ model TEXT,
+ text TEXT,
+ tldr TEXT,
+ bullet_json TEXT,
+ action_json TEXT,
+ tokens_used INTEGER,
+ updated_at INTEGER,
+ sync_state TEXT DEFAULT 'clean'
+);
+
+-- prompt_presets
+CREATE TABLE IF NOT EXISTS prompt_presets (
+ id TEXT PRIMARY KEY,
+ uid TEXT NOT NULL,
+ title TEXT NOT NULL,
+ prompt TEXT NOT NULL,
+ is_default INTEGER NOT NULL,
+ created_at INTEGER,
+ sync_state TEXT DEFAULT 'clean'
+);
+`);
+
+const defaultPresets = [
+ ['school', 'School', 'You are a school and lecture assistant. Your goal is to help the user, a student, understand academic material and answer questions.\n\nWhenever a question appears on the user\'s screen or is asked aloud, you provide a direct, step-by-step answer, showing all necessary reasoning or calculations.\n\nIf the user is watching a lecture or working through new material, you offer concise explanations of key concepts and clarify definitions as they come up.', 1],
+ ['meetings', 'Meetings', 'You are a meeting assistant. Your goal is to help the user capture key information during meetings and follow up effectively.\n\nYou help capture meeting notes, track action items, identify key decisions, and summarize important points discussed during meetings.', 1],
+ ['sales', 'Sales', 'You are a real-time AI sales assistant, and your goal is to help the user close deals during sales interactions.\n\nYou provide real-time sales support, suggest responses to objections, help identify customer needs, and recommend strategies to advance deals.', 1],
+ ['recruiting', 'Recruiting', 'You are a recruiting assistant. Your goal is to help the user interview candidates and evaluate talent effectively.\n\nYou help evaluate candidates, suggest interview questions, analyze responses, and provide insights about candidate fit for positions.', 1],
+ ['customer-support', 'Customer Support', 'You are a customer support assistant. Your goal is to help resolve customer issues efficiently and thoroughly.\n\nYou help diagnose customer problems, suggest solutions, provide step-by-step troubleshooting guidance, and ensure customer satisfaction.', 1],
+];
+
+const stmt = db.prepare(`
+INSERT OR IGNORE INTO prompt_presets (id, uid, title, prompt, is_default, created_at)
+VALUES (@id, 'default_user', @title, @prompt, @is_default, strftime('%s','now'));
+`);
+db.transaction(() => defaultPresets.forEach(([id, title, prompt, is_default]) => stmt.run({ id, title, prompt, is_default })))();
+
+const defaultUserStmt = db.prepare(`
+INSERT OR IGNORE INTO users (uid, display_name, email, created_at)
+VALUES ('default_user', 'Default User', 'contact@pickle.com', strftime('%s','now'));
+`);
+defaultUserStmt.run();
+
+module.exports = db;
diff --git a/pickleglass_web/backend_node/index.js b/pickleglass_web/backend_node/index.js
new file mode 100644
index 0000000..a60d6f0
--- /dev/null
+++ b/pickleglass_web/backend_node/index.js
@@ -0,0 +1,59 @@
+const express = require('express');
+const cors = require('cors');
+const db = require('./db');
+const { identifyUser } = require('./middleware/auth');
+
+function createApp() {
+ const app = express();
+
+ const webUrl = process.env.pickleglass_WEB_URL || 'http://localhost:3000';
+ console.log(`π§ Backend CORS configured for: ${webUrl}`);
+
+ app.use(cors({
+ origin: webUrl,
+ credentials: true,
+ }));
+
+ app.use(express.json());
+
+ app.get('/', (req, res) => {
+ res.json({ message: "pickleglass API is running" });
+ });
+
+ app.use('/api', identifyUser);
+
+ app.use('/api/auth', require('./routes/auth'));
+ app.use('/api/user', require('./routes/user'));
+ app.use('/api/conversations', require('./routes/conversations'));
+ app.use('/api/presets', require('./routes/presets'));
+
+ app.get('/api/sync/status', (req, res) => {
+ res.json({
+ status: 'online',
+ timestamp: new Date().toISOString(),
+ version: '1.0.0'
+ });
+ });
+
+ app.post('/api/desktop/set-user', (req, res) => {
+ res.json({
+ success: true,
+ message: "Direct IPC communication is now used. This endpoint is deprecated.",
+ user: req.body,
+ deprecated: true
+ });
+ });
+
+ app.get('/api/desktop/status', (req, res) => {
+ res.json({
+ connected: true,
+ current_user: null,
+ communication_method: "IPC",
+ file_based_deprecated: true
+ });
+ });
+
+ return app;
+}
+
+module.exports = createApp;
diff --git a/pickleglass_web/backend_node/jwt.js b/pickleglass_web/backend_node/jwt.js
new file mode 100644
index 0000000..abb79ad
--- /dev/null
+++ b/pickleglass_web/backend_node/jwt.js
@@ -0,0 +1,13 @@
+const jwt = require('jsonwebtoken');
+const SECRET = process.env.JWT_SECRET_KEY || 'change-me';
+const EXPIRE = 60 * 24; // minutes
+
+exports.sign = (sub, extra = {}) => jwt.sign({ sub, ...extra }, SECRET, { algorithm: 'HS256', expiresIn: `${EXPIRE}m` });
+
+exports.verify = token => {
+ try {
+ return jwt.verify(token, SECRET).sub;
+ } catch {
+ return null;
+ }
+};
diff --git a/pickleglass_web/backend_node/middleware/auth.js b/pickleglass_web/backend_node/middleware/auth.js
new file mode 100644
index 0000000..f20b0eb
--- /dev/null
+++ b/pickleglass_web/backend_node/middleware/auth.js
@@ -0,0 +1,15 @@
+const { verify } = require('../jwt');
+
+function identifyUser(req, res, next) {
+ const userId = req.get('X-User-ID');
+
+ if (userId) {
+ req.uid = userId;
+ } else {
+ req.uid = 'default_user';
+ }
+
+ next();
+}
+
+module.exports = { identifyUser };
\ No newline at end of file
diff --git a/pickleglass_web/backend_node/routes/auth.js b/pickleglass_web/backend_node/routes/auth.js
new file mode 100644
index 0000000..5dbe34d
--- /dev/null
+++ b/pickleglass_web/backend_node/routes/auth.js
@@ -0,0 +1,19 @@
+const express = require('express');
+const db = require('../db');
+const router = express.Router();
+
+router.get('/status', (req, res) => {
+ const user = db.prepare('SELECT uid, display_name FROM users WHERE uid = ?').get('default_user');
+ if (!user) {
+ return res.status(500).json({ error: 'Default user not initialized' });
+ }
+ res.json({
+ authenticated: true,
+ user: {
+ id: user.uid,
+ name: user.display_name
+ }
+ });
+});
+
+module.exports = router;
diff --git a/pickleglass_web/backend_node/routes/conversations.js b/pickleglass_web/backend_node/routes/conversations.js
new file mode 100644
index 0000000..cce7866
--- /dev/null
+++ b/pickleglass_web/backend_node/routes/conversations.js
@@ -0,0 +1,121 @@
+const express = require('express');
+const db = require('../db');
+const router = express.Router();
+const crypto = require('crypto');
+const validator = require('validator');
+
+router.get('/', (req, res) => {
+ try {
+ const sessions = db.prepare(
+ "SELECT id, uid, title, started_at, ended_at, sync_state, updated_at FROM sessions WHERE uid = ? ORDER BY started_at DESC"
+ ).all(req.uid);
+ res.json(sessions);
+ } catch (error) {
+ console.error('Failed to get sessions:', error);
+ res.status(500).json({ error: 'Failed to retrieve sessions' });
+ }
+});
+
+router.post('/', (req, res) => {
+ const { title } = req.body;
+ const sessionId = crypto.randomUUID();
+ const now = Math.floor(Date.now() / 1000);
+
+ try {
+ db.prepare(
+ `INSERT INTO sessions (id, uid, title, started_at, updated_at)
+ VALUES (?, ?, ?, ?, ?)`
+ ).run(sessionId, req.uid, title || 'New Conversation', now, now);
+
+ res.status(201).json({ id: sessionId, message: 'Session created successfully' });
+ } catch (error) {
+ console.error('Failed to create session:', error);
+ res.status(500).json({ error: 'Failed to create session' });
+ }
+});
+
+router.get('/:session_id', (req, res) => {
+ const { session_id } = req.params;
+ try {
+ const session = db.prepare("SELECT * FROM sessions WHERE id = ?").get(session_id);
+ if (!session) {
+ return res.status(404).json({ error: 'Session not found' });
+ }
+
+ const transcripts = db.prepare("SELECT * FROM transcripts WHERE session_id = ? ORDER BY start_at ASC").all(session_id);
+ const ai_messages = db.prepare("SELECT * FROM ai_messages WHERE session_id = ? ORDER BY sent_at ASC").all(session_id);
+ const summary = db.prepare("SELECT * FROM summaries WHERE session_id = ?").get(session_id);
+
+ res.json({
+ session,
+ transcripts,
+ ai_messages,
+ summary: summary || null
+ });
+ } catch (error) {
+ console.error(`Failed to get session ${session_id}:`, error);
+ res.status(500).json({ error: 'Failed to retrieve session details' });
+ }
+});
+
+router.delete('/:session_id', (req, res) => {
+ const { session_id } = req.params;
+
+ const session = db.prepare("SELECT id FROM sessions WHERE id = ?").get(session_id);
+ if (!session) {
+ return res.status(404).json({ error: 'Session not found' });
+ }
+
+ try {
+ db.transaction(() => {
+ db.prepare("DELETE FROM transcripts WHERE session_id = ?").run(session_id);
+ db.prepare("DELETE FROM ai_messages WHERE session_id = ?").run(session_id);
+ db.prepare("DELETE FROM summaries WHERE session_id = ?").run(session_id);
+ db.prepare("DELETE FROM sessions WHERE id = ?").run(session_id);
+ })();
+ res.status(200).json({ message: 'Session deleted successfully' });
+ } catch (error) {
+ console.error(`Failed to delete session ${session_id}:`, error);
+ res.status(500).json({ error: 'Failed to delete session' });
+ }
+});
+
+router.get('/search', (req, res) => {
+ const { q } = req.query;
+ if (!q || !validator.isLength(q, { min: 3 })) {
+ return res.status(400).json({ error: 'Query parameter "q" is required' });
+ }
+ // Sanitize and validate input
+ const sanitizedQuery = validator.escape(q.trim()); // Escapes HTML and special chars
+ if (sanitizedQuery.length === 0 || sanitizedQuery.length > 255) {
+ return res.status(400).json({ error: 'Query parameter "q" must be between 3 and 255 characters' });
+ }
+ try {
+ const searchQuery = `%${sanitizedQuery}%`;
+ const sessionIds = db.prepare(`
+ SELECT DISTINCT session_id FROM (
+ SELECT session_id FROM transcripts WHERE text LIKE ?
+ UNION
+ SELECT session_id FROM ai_messages WHERE content LIKE ?
+ UNION
+ SELECT session_id FROM summaries WHERE text LIKE ? OR tldr LIKE ?
+ )
+ `).all(searchQuery, searchQuery, searchQuery, searchQuery).map(row => row.session_id);
+
+ if (sessionIds.length === 0) {
+ return res.json([]);
+ }
+
+ const placeholders = sessionIds.map(() => '?').join(',');
+ const sessions = db.prepare(
+ `SELECT id, uid, title, started_at, ended_at, sync_state, updated_at FROM sessions WHERE id IN (${placeholders}) ORDER BY started_at DESC`
+ ).all(sessionIds);
+
+ res.json(sessions);
+ } catch (error) {
+ console.error('Search failed:', error);
+ res.status(500).json({ error: 'Failed to perform search' });
+ }
+});
+
+module.exports = router;
\ No newline at end of file
diff --git a/pickleglass_web/backend_node/routes/presets.js b/pickleglass_web/backend_node/routes/presets.js
new file mode 100644
index 0000000..8812f7e
--- /dev/null
+++ b/pickleglass_web/backend_node/routes/presets.js
@@ -0,0 +1,87 @@
+const express = require('express');
+const crypto = require('crypto');
+const db = require('../db');
+const router = express.Router();
+
+router.get('/', (req, res) => {
+ try {
+ const presets = db.prepare(
+ `SELECT * FROM prompt_presets
+ WHERE uid = ? OR is_default = 1
+ ORDER BY is_default DESC, title ASC`
+ ).all(req.uid);
+ res.json(presets);
+ } catch (error) {
+ console.error('Failed to get presets:', error);
+ res.status(500).json({ error: 'Failed to retrieve presets' });
+ }
+});
+
+router.post('/', (req, res) => {
+ const { title, prompt } = req.body;
+ if (!title || !prompt) {
+ return res.status(400).json({ error: 'Title and prompt are required' });
+ }
+
+ const presetId = crypto.randomUUID();
+ const now = Math.floor(Date.now() / 1000);
+
+ try {
+ db.prepare(
+ `INSERT INTO prompt_presets (id, uid, title, prompt, is_default, created_at, sync_state)
+ VALUES (?, ?, ?, ?, 0, ?, 'dirty')`
+ ).run(presetId, req.uid, title, prompt, now);
+
+ res.status(201).json({ id: presetId, message: 'Preset created successfully' });
+ } catch (error) {
+ console.error('Failed to create preset:', error);
+ res.status(500).json({ error: 'Failed to create preset' });
+ }
+});
+
+router.put('/:id', (req, res) => {
+ const { id } = req.params;
+ const { title, prompt } = req.body;
+ if (!title || !prompt) {
+ return res.status(400).json({ error: 'Title and prompt are required' });
+ }
+
+ try {
+ const result = db.prepare(
+ `UPDATE prompt_presets
+ SET title = ?, prompt = ?, sync_state = 'dirty'
+ WHERE id = ? AND uid = ? AND is_default = 0`
+ ).run(title, prompt, id, req.uid);
+
+ if (result.changes === 0) {
+ return res.status(404).json({ error: "Preset not found or you don't have permission to edit it." });
+ }
+
+ res.json({ message: 'Preset updated successfully' });
+ } catch (error) {
+ console.error('Failed to update preset:', error);
+ res.status(500).json({ error: 'Failed to update preset' });
+ }
+});
+
+router.delete('/:id', (req, res) => {
+ const { id } = req.params;
+
+ try {
+ const result = db.prepare(
+ `DELETE FROM prompt_presets
+ WHERE id = ? AND uid = ? AND is_default = 0`
+ ).run(id, req.uid);
+
+ if (result.changes === 0) {
+ return res.status(404).json({ error: "Preset not found or you don't have permission to delete it." });
+ }
+
+ res.json({ message: 'Preset deleted successfully' });
+ } catch (error) {
+ console.error('Failed to delete preset:', error);
+ res.status(500).json({ error: 'Failed to delete preset' });
+ }
+});
+
+module.exports = router;
\ No newline at end of file
diff --git a/pickleglass_web/backend_node/routes/user.js b/pickleglass_web/backend_node/routes/user.js
new file mode 100644
index 0000000..8e5ff19
--- /dev/null
+++ b/pickleglass_web/backend_node/routes/user.js
@@ -0,0 +1,144 @@
+const express = require('express');
+const db = require('../db');
+const router = express.Router();
+
+router.put('/profile', (req, res) => {
+ const { displayName } = req.body;
+ if (!displayName) return res.status(400).json({ error: 'displayName is required' });
+
+ try {
+ db.prepare("UPDATE users SET display_name = ? WHERE uid = ?").run(displayName, req.uid);
+ res.json({ message: 'Profile updated successfully' });
+ } catch (error) {
+ console.error('Failed to update profile:', error);
+ res.status(500).json({ error: 'Failed to update profile' });
+ }
+});
+
+router.get('/profile', (req, res) => {
+ try {
+ const user = db.prepare('SELECT uid, display_name, email FROM users WHERE uid = ?').get(req.uid);
+ if (!user) return res.status(404).json({ error: 'User not found' });
+ res.json(user);
+ } catch (error) {
+ console.error('Failed to get profile:', error);
+ res.status(500).json({ error: 'Failed to get profile' });
+ }
+});
+
+router.post('/find-or-create', (req, res) => {
+ const { uid, displayName, email } = req.body;
+ if (!uid || !displayName || !email) {
+ return res.status(400).json({ error: 'uid, displayName, and email are required' });
+ }
+
+ try {
+ const now = Math.floor(Date.now() / 1000);
+ db.prepare(
+ `INSERT INTO users (uid, display_name, email, created_at)
+ VALUES (?, ?, ?, ?)
+ ON CONFLICT(uid) DO NOTHING`
+ ).run(uid, displayName, email, now);
+
+ const user = db.prepare('SELECT * FROM users WHERE uid = ?').get(uid);
+ res.status(200).json(user);
+
+ } catch (error) {
+ console.error('Failed to find or create user:', error);
+ res.status(500).json({ error: 'Failed to find or create user' });
+ }
+});
+
+router.post('/api-key', (req, res) => {
+ const { apiKey } = req.body;
+ if (typeof apiKey !== 'string') {
+ return res.status(400).json({ error: 'API key must be a string' });
+ }
+
+ try {
+ db.prepare("UPDATE users SET api_key = ? WHERE uid = ?").run(apiKey, req.uid);
+ res.json({ message: 'API key saved successfully' });
+ } catch (error) {
+ console.error('Failed to save API key:', error);
+ res.status(500).json({ error: 'Failed to save API key' });
+ }
+});
+
+router.get('/api-key-status', (req, res) => {
+ try {
+ const row = db.prepare('SELECT api_key FROM users WHERE uid = ?').get(req.uid);
+ if (!row) {
+ return res.status(404).json({ error: 'User not found' });
+ }
+ res.json({ hasApiKey: !!row.api_key && row.api_key.length > 0 });
+ } catch (error) {
+ console.error('Failed to get API key status:', error);
+ res.status(500).json({ error: 'Failed to get API key status' });
+ }
+});
+
+router.delete('/profile', (req, res) => {
+ try {
+ const user = db.prepare('SELECT uid FROM users WHERE uid = ?').get(req.uid);
+ if (!user) {
+ return res.status(404).json({ error: 'User not found' });
+ }
+
+ const userSessions = db.prepare('SELECT id FROM sessions WHERE uid = ?').all(user.uid);
+ const sessionIds = userSessions.map(s => s.id);
+
+ db.transaction(() => {
+ if (sessionIds.length > 0) {
+ const placeholders = sessionIds.map(() => '?').join(',');
+ db.prepare(`DELETE FROM transcripts WHERE session_id IN (${placeholders})`).run(...sessionIds);
+ db.prepare(`DELETE FROM ai_messages WHERE session_id IN (${placeholders})`).run(...sessionIds);
+ db.prepare(`DELETE FROM summaries WHERE session_id IN (${placeholders})`).run(...sessionIds);
+ db.prepare(`DELETE FROM sessions WHERE uid = ?`).run(user.uid);
+ }
+ db.prepare('DELETE FROM prompt_presets WHERE uid = ?').run(user.uid);
+ db.prepare('DELETE FROM users WHERE uid = ?').run(user.uid);
+ })();
+
+ res.status(200).json({ message: 'User account and all data deleted successfully.' });
+
+ } catch (error) {
+ console.error('Failed to delete user account:', error);
+ res.status(500).json({ error: 'Failed to delete user account' });
+ }
+});
+
+async function getUserBatchData(req, res) {
+ const { include = 'profile,presets,sessions' } = req.query;
+
+ try {
+ const includes = include.split(',').map(item => item.trim());
+ const result = {};
+
+ if (includes.includes('profile')) {
+ const user = db.prepare('SELECT uid, display_name, email FROM users WHERE uid = ?').get(req.uid);
+ result.profile = user || null;
+ }
+
+ if (includes.includes('presets')) {
+ const presets = db.prepare('SELECT * FROM prompt_presets WHERE uid = ? OR is_default = 1').all(req.uid);
+ result.presets = presets || [];
+ }
+
+ if (includes.includes('sessions')) {
+ const recent_sessions = db.prepare(
+ "SELECT id, title, started_at, updated_at FROM sessions WHERE uid = ? ORDER BY updated_at DESC LIMIT 10"
+ ).all(req.uid);
+ result.sessions = recent_sessions || [];
+ }
+
+ res.json(result);
+
+ } catch (error) {
+ console.error('Failed to get batch data:', error);
+ res.status(500).json({ error: 'Failed to get batch data' });
+ }
+}
+
+router.get('/batch', getUserBatchData);
+
+module.exports = router;
diff --git a/pickleglass_web/components/ClientLayout.tsx b/pickleglass_web/components/ClientLayout.tsx
new file mode 100644
index 0000000..324f198
--- /dev/null
+++ b/pickleglass_web/components/ClientLayout.tsx
@@ -0,0 +1,44 @@
+'use client'
+
+import { useState, useEffect } from 'react'
+import Sidebar from '@/components/Sidebar'
+import SearchPopup from '@/components/SearchPopup'
+
+export default function ClientLayout({
+ children,
+}: {
+ children: React.ReactNode
+}) {
+ const [isSidebarCollapsed, setIsSidebarCollapsed] = useState(false)
+ const [isSearchOpen, setIsSearchOpen] = useState(false)
+
+ useEffect(() => {
+ const handleKeyDown = (e: KeyboardEvent) => {
+ if ((e.metaKey || e.ctrlKey) && e.key === 'k') {
+ e.preventDefault()
+ setIsSearchOpen(true)
+ }
+ }
+
+ document.addEventListener('keydown', handleKeyDown)
+ return () => document.removeEventListener('keydown', handleKeyDown)
+ }, [])
+
+ return (
+
+ setIsSearchOpen(true)}
+ />
+
+ {children}
+
+
+ setIsSearchOpen(false)}
+ />
+
+ )
+}
\ No newline at end of file
diff --git a/pickleglass_web/components/SearchPopup.tsx b/pickleglass_web/components/SearchPopup.tsx
new file mode 100644
index 0000000..551255d
--- /dev/null
+++ b/pickleglass_web/components/SearchPopup.tsx
@@ -0,0 +1,151 @@
+'use client'
+
+import { useState, useEffect, useRef } from 'react'
+import { useRouter } from 'next/navigation'
+import { Search, X } from 'lucide-react'
+import { searchConversations, Session } from '@/utils/api'
+import { MessageSquare } from 'lucide-react'
+
+interface SearchPopupProps {
+ isOpen: boolean
+ onClose: () => void
+}
+
+export default function SearchPopup({ isOpen, onClose }: SearchPopupProps) {
+ const [searchQuery, setSearchQuery] = useState('')
+ const [searchResults, setSearchResults] = useState([])
+ const [isLoading, setIsLoading] = useState(false)
+ const inputRef = useRef(null)
+ const router = useRouter()
+
+ useEffect(() => {
+ if (isOpen && inputRef.current) {
+ inputRef.current.focus()
+ }
+ }, [isOpen])
+
+ useEffect(() => {
+ const handleEscape = (e: KeyboardEvent) => {
+ if (e.key === 'Escape' && isOpen) {
+ onClose()
+ }
+ }
+
+ document.addEventListener('keydown', handleEscape)
+ return () => document.removeEventListener('keydown', handleEscape)
+ }, [isOpen, onClose])
+
+ const handleSearch = async (query: string) => {
+ if (!query.trim()) {
+ setSearchResults([])
+ return
+ }
+
+ setIsLoading(true)
+ try {
+ const results = await searchConversations(query)
+ setSearchResults(results)
+ } catch (error) {
+ console.error('Search failed:', error)
+ setSearchResults([])
+ } finally {
+ setIsLoading(false)
+ }
+ }
+
+ const handleInputChange = (e: React.ChangeEvent) => {
+ const query = e.target.value
+ setSearchQuery(query)
+ handleSearch(query)
+ }
+
+ const handleBackgroundClick = (e: React.MouseEvent) => {
+ if (e.target === e.currentTarget) {
+ onClose()
+ }
+ }
+
+ if (!isOpen) return null
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+ Type
+ #
+ to access summaries,
+ ?
+ for help.
+
+
+
+ {searchQuery && (
+
+ {isLoading ? (
+
+ ) : searchResults.length > 0 ? (
+
+ {searchResults.map((result) => {
+ const timestamp = new Date(result.started_at * 1000).toLocaleString()
+
+ return (
+
{
+ router.push(`/activity/${result.id}`)
+ onClose()
+ }}
+ >
+
+
+
+
+ {result.title || 'Untitled Conversation'}
+
+
+ {timestamp}
+
+
+
+
+ )
+ })}
+
+ ) : (
+
+
+
No results found for "{searchQuery}"
+
+ )}
+
+ )}
+
+
+ )
+}
\ No newline at end of file
diff --git a/pickleglass_web/components/Sidebar.tsx b/pickleglass_web/components/Sidebar.tsx
new file mode 100644
index 0000000..050d3f3
--- /dev/null
+++ b/pickleglass_web/components/Sidebar.tsx
@@ -0,0 +1,637 @@
+'use client';
+
+import Link from 'next/link';
+import { usePathname, useRouter } from 'next/navigation';
+import Image from 'next/image';
+import { useState, createElement, useEffect, useMemo, useCallback, memo } from 'react';
+import { Search, Activity, HelpCircle, Download, ChevronDown, User, Shield, Database, CreditCard, LogOut, LucideIcon } from 'lucide-react';
+import { logout, UserProfile, checkApiKeyStatus } from '@/utils/api';
+import { useAuth } from '@/utils/auth';
+
+const ANIMATION_DURATION = {
+ SIDEBAR: 500,
+ TEXT: 300,
+ SUBMENU: 500,
+ ICON_HOVER: 200,
+ COLOR_TRANSITION: 200,
+ HOVER_SCALE: 200,
+} as const;
+
+const DIMENSIONS = {
+ SIDEBAR_EXPANDED: 220,
+ SIDEBAR_COLLAPSED: 64,
+ ICON_SIZE: 18,
+ USER_AVATAR_SIZE: 32,
+ HEADER_HEIGHT: 64,
+} as const;
+
+const ANIMATION_DELAYS = {
+ BASE: 0,
+ INCREMENT: 50,
+ TEXT_BASE: 250,
+ SUBMENU_INCREMENT: 30,
+} as const;
+
+interface NavigationItem {
+ name: string;
+ href?: string;
+ action?: () => void;
+ icon: LucideIcon | string;
+ isLucide: boolean;
+ hasSubmenu?: boolean;
+ ariaLabel?: string;
+}
+
+interface SubmenuItem {
+ name: string;
+ href: string;
+ icon: LucideIcon | string;
+ isLucide: boolean;
+ ariaLabel?: string;
+}
+
+interface SidebarProps {
+ isCollapsed: boolean;
+ onToggle: (collapsed: boolean) => void;
+ onSearchClick?: () => void;
+}
+
+interface AnimationStyles {
+ text: React.CSSProperties;
+ submenu: React.CSSProperties;
+ sidebarContainer: React.CSSProperties;
+ textContainer: React.CSSProperties;
+}
+
+const useAnimationStyles = (isCollapsed: boolean) => {
+ const [isAnimating, setIsAnimating] = useState(false);
+
+ useEffect(() => {
+ setIsAnimating(true);
+ const timer = setTimeout(() => setIsAnimating(false), ANIMATION_DURATION.SIDEBAR);
+ return () => clearTimeout(timer);
+ }, [isCollapsed]);
+
+ const getTextAnimationStyle = useCallback(
+ (delay = 0): React.CSSProperties => ({
+ willChange: 'opacity',
+ transition: `opacity ${ANIMATION_DURATION.TEXT}ms ease-out`,
+ transitionDelay: `${delay}ms`,
+ opacity: isCollapsed ? 0 : 1,
+ pointerEvents: isCollapsed ? 'none' : 'auto',
+ }),
+ [isCollapsed]
+ );
+
+ const getSubmenuAnimationStyle = useCallback(
+ (isExpanded: boolean): React.CSSProperties => ({
+ willChange: 'opacity, max-height',
+ transition: `all ${ANIMATION_DURATION.SUBMENU}ms cubic-bezier(0.25, 0.46, 0.45, 0.94)`,
+ maxHeight: isCollapsed || !isExpanded ? '0px' : '400px',
+ opacity: isCollapsed || !isExpanded ? 0 : 1,
+ }),
+ [isCollapsed]
+ );
+
+ const sidebarContainerStyle: React.CSSProperties = useMemo(
+ () => ({
+ willChange: 'width',
+ transition: `width ${ANIMATION_DURATION.SIDEBAR}ms cubic-bezier(0.4, 0, 0.2, 1)`,
+ }),
+ []
+ );
+
+ const getTextContainerStyle = useCallback(
+ (): React.CSSProperties => ({
+ width: isCollapsed ? '0px' : '150px',
+ overflow: 'hidden',
+ transition: `width ${ANIMATION_DURATION.SIDEBAR}ms cubic-bezier(0.4, 0, 0.2, 1)`,
+ }),
+ [isCollapsed]
+ );
+
+ const getUniformTextStyle = useCallback(
+ (): React.CSSProperties => ({
+ willChange: 'opacity',
+ opacity: isCollapsed ? 0 : 1,
+ transition: `opacity 300ms ease ${isCollapsed ? '0ms' : '200ms'}`,
+ whiteSpace: 'nowrap' as const,
+ }),
+ [isCollapsed]
+ );
+
+ return {
+ isAnimating,
+ getTextAnimationStyle,
+ getSubmenuAnimationStyle,
+ sidebarContainerStyle,
+ getTextContainerStyle,
+ getUniformTextStyle,
+ };
+};
+
+const IconComponent = memo<{
+ icon: LucideIcon | string;
+ isLucide: boolean;
+ alt: string;
+ className?: string;
+}>(({ icon, isLucide, alt, className = 'h-[18px] w-[18px] transition-transform duration-200' }) => {
+ if (isLucide) {
+ return createElement(icon as LucideIcon, { className, 'aria-hidden': true });
+ }
+
+ return ;
+});
+
+IconComponent.displayName = 'IconComponent';
+
+const SidebarComponent = ({ isCollapsed, onToggle, onSearchClick }: SidebarProps) => {
+ const pathname = usePathname();
+ const router = useRouter();
+ const [isSettingsExpanded, setIsSettingsExpanded] = useState(pathname.startsWith('/settings'));
+ const { user: userInfo, isLoading: authLoading } = useAuth();
+ const [hasApiKey, setHasApiKey] = useState(null);
+
+ const { isAnimating, getTextAnimationStyle, getSubmenuAnimationStyle, sidebarContainerStyle, getTextContainerStyle, getUniformTextStyle } =
+ useAnimationStyles(isCollapsed);
+
+ useEffect(() => {
+ checkApiKeyStatus()
+ .then(status => setHasApiKey(status.hasApiKey))
+ .catch(err => {
+ console.error('Failed to check API key status:', err);
+ setHasApiKey(null); // Set to null on error
+ });
+ }, []);
+
+ useEffect(() => {
+ if (pathname.startsWith('/settings')) {
+ setIsSettingsExpanded(true);
+ }
+ }, [pathname]);
+
+ const navigation = useMemo(
+ () => [
+ {
+ name: 'Search',
+ action: onSearchClick,
+ icon: '/search.svg',
+ isLucide: false,
+ ariaLabel: 'Open search',
+ },
+ {
+ name: 'My Activity',
+ href: '/activity',
+ icon: '/activity.svg',
+ isLucide: false,
+ ariaLabel: 'View my activity',
+ },
+ {
+ name: 'Personalize',
+ href: '/personalize',
+ icon: '/book.svg',
+ isLucide: false,
+ ariaLabel: 'Personalization settings',
+ },
+ {
+ name: 'Settings',
+ href: '/settings',
+ icon: '/setting.svg',
+ isLucide: false,
+ hasSubmenu: true,
+ ariaLabel: 'Settings menu',
+ },
+ ],
+ [onSearchClick]
+ );
+
+ const settingsSubmenu = useMemo(
+ () => [
+ { name: 'Personal Profile', href: '/settings', icon: '/user.svg', isLucide: false, ariaLabel: 'Personal profile settings' },
+ { name: 'Data & privacy', href: '/settings/privacy', icon: '/privacy.svg', isLucide: false, ariaLabel: 'Data and privacy settings' },
+ { name: 'Billing', href: '/settings/billing', icon: '/credit-card.svg', isLucide: false, ariaLabel: 'Billing settings' },
+ ],
+ []
+ );
+
+ const bottomItems = useMemo(
+ () => [
+ {
+ href: 'https://discord.gg/UCZH5B5Hpd',
+ icon: '/linkout.svg',
+ text: 'Join Discord',
+ ariaLabel: 'Help Center (new window)',
+ },
+ {
+ href: 'https://www.dropbox.com/scl/fi/esk4h8z45sryvbremy57v/Pickle_latest.dmg?rlkey=92y535bz6p6gov6vd17x6q53b&st=9kl0annj&dl=1',
+ icon: '/download.svg',
+ text: 'Download Pickle Camera',
+ ariaLabel: 'Download Pickle Camera (new window)',
+ },
+ {
+ href: 'hhttps://www.dropbox.com/scl/fi/znid09apxiwtwvxer6oc9/Glass_latest.dmg?rlkey=gwvvyb3bizkl25frhs4k1zwds&st=37q31b4w&dl=1',
+ icon: '/download.svg',
+ text: 'Download Pickle Glass',
+ ariaLabel: 'Download Pickle Glass (new window)',
+ },
+ ],
+ []
+ );
+
+ const toggleSidebar = useCallback(() => {
+ onToggle(!isCollapsed);
+ }, [isCollapsed, onToggle]);
+
+ const toggleSettings = useCallback(() => {
+ if (!pathname.startsWith('/settings')) {
+ setIsSettingsExpanded(prev => !prev);
+ }
+ }, [pathname]);
+
+ const handleLogout = useCallback(async () => {
+ try {
+ await logout();
+ } catch (error) {
+ console.error('An error occurred during logout:', error);
+ }
+ }, []);
+
+ const handleKeyDown = useCallback((event: React.KeyboardEvent, action?: () => void) => {
+ if (event.key === 'Enter' || event.key === ' ') {
+ event.preventDefault();
+ action?.();
+ }
+ }, []);
+
+ const renderNavigationItem = useCallback(
+ (item: NavigationItem, index: number) => {
+ const isActive = item.href ? pathname.startsWith(item.href) : false;
+ const animationDelay = 0;
+
+ const baseButtonClasses = `
+ group flex items-center rounded-[8px] px-[12px] py-[10px] text-[14px] text-[#282828] w-full relative
+ transition-colors duration-${ANIMATION_DURATION.COLOR_TRANSITION} ease-out
+ focus:outline-none
+ `;
+
+ const getStateClasses = (isActive: boolean) =>
+ isActive ? 'bg-[#f2f2f2] text-[#282828]' : 'text-[#282828] hover:text-[#282828] hover:bg-[#f7f7f7]';
+
+ if (item.action) {
+ return (
+
+ handleKeyDown(e, item.action)}
+ className={`${baseButtonClasses} ${getStateClasses(false)}`}
+ title={isCollapsed ? item.name : undefined}
+ aria-label={item.ariaLabel || item.name}
+ style={{ willChange: 'background-color, color' }}
+ >
+
+
+
+
+
+
+ {item.name}
+
+
+
+
+ );
+ }
+
+ if (item.hasSubmenu) {
+ return (
+
+ handleKeyDown(e, toggleSettings)}
+ className={`${baseButtonClasses} ${getStateClasses(isActive)}`}
+ title={isCollapsed ? item.name : undefined}
+ aria-label={item.ariaLabel || item.name}
+ aria-expanded={isSettingsExpanded}
+ aria-controls="settings-submenu"
+ style={{ willChange: 'background-color, color' }}
+ >
+
+
+
+
+
+
+ {item.name}
+
+
+
+
+
+
+
+ );
+ }
+
+ return (
+
+
+
+
+
+
+
+
+ {item.name}
+
+
+
+
+ );
+ },
+ [
+ pathname,
+ isCollapsed,
+ isSettingsExpanded,
+ toggleSettings,
+ handleLogout,
+ handleKeyDown,
+ getUniformTextStyle,
+ getTextContainerStyle,
+ getSubmenuAnimationStyle,
+ settingsSubmenu,
+ ]
+ );
+
+ const getUserDisplayName = useCallback(() => {
+ if (authLoading) return 'Loading...';
+ return userInfo?.display_name || 'Guest';
+ }, [userInfo, authLoading]);
+
+ const getUserInitial = useCallback(() => {
+ if (authLoading) return 'L';
+ return userInfo?.display_name ? userInfo.display_name.charAt(0).toUpperCase() : 'G';
+ }, [userInfo, authLoading]);
+
+ const isFirebaseUser = userInfo && userInfo.uid !== 'default_user';
+
+ return (
+
+ );
+};
+
+const Sidebar = memo(SidebarComponent);
+Sidebar.displayName = 'Sidebar';
+
+export default Sidebar;
diff --git a/pickleglass_web/docker-compose.yml b/pickleglass_web/docker-compose.yml
new file mode 100644
index 0000000..061817b
--- /dev/null
+++ b/pickleglass_web/docker-compose.yml
@@ -0,0 +1,35 @@
+version: '3.8'
+
+services:
+ backend:
+ build:
+ context: .
+ dockerfile: Dockerfile.backend
+ container_name: pickleglass-backend
+ restart: always
+ ports:
+ - "8000:8000"
+ environment:
+ - DATABASE_URL=/app/data/pickleglass.db
+ volumes:
+ - ./backend:/app
+ - ./data:/app/data
+
+ frontend:
+ build:
+ context: .
+ dockerfile: Dockerfile.frontend
+ container_name: pickleglass-frontend
+ restart: always
+ ports:
+ - "3000:3000"
+ environment:
+ - NEXT_PUBLIC_API_URL=http://localhost:8000
+ depends_on:
+ - backend
+ volumes:
+ - .:/app
+ - /app/node_modules
+
+volumes:
+ mongodb_data:
\ No newline at end of file
diff --git a/pickleglass_web/next-env.d.ts b/pickleglass_web/next-env.d.ts
new file mode 100644
index 0000000..40c3d68
--- /dev/null
+++ b/pickleglass_web/next-env.d.ts
@@ -0,0 +1,5 @@
+///
+///
+
+// NOTE: This file should not be edited
+// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
diff --git a/pickleglass_web/next.config.js b/pickleglass_web/next.config.js
new file mode 100644
index 0000000..9990f7a
--- /dev/null
+++ b/pickleglass_web/next.config.js
@@ -0,0 +1,10 @@
+/** @type {import('next').NextConfig} */
+const nextConfig = {
+ reactStrictMode: true,
+ swcMinify: true,
+ output: 'export',
+
+ images: { unoptimized: true },
+}
+
+module.exports = nextConfig
\ No newline at end of file
diff --git a/pickleglass_web/package.json b/pickleglass_web/package.json
new file mode 100644
index 0000000..bf7c1b2
--- /dev/null
+++ b/pickleglass_web/package.json
@@ -0,0 +1,32 @@
+{
+ "name": "pickleglass-frontend",
+ "version": "0.1.0",
+ "private": true,
+ "scripts": {
+ "dev": "next dev",
+ "build": "next build",
+ "start": "next start",
+ "lint": "next lint"
+ },
+ "dependencies": {
+ "@headlessui/react": "^1.7.17",
+ "autoprefixer": "^10.4.16",
+ "axios": "^1.6.0",
+ "firebase": "^11.10.0",
+ "lucide-react": "^0.294.0",
+ "next": "^14.2.30",
+ "postcss": "^8.4.32",
+ "react": "^18",
+ "react-dom": "^18",
+ "react-hot-toast": "^2.5.2",
+ "tailwindcss": "^3.3.0"
+ },
+ "devDependencies": {
+ "@types/node": "^20",
+ "@types/react": "^18",
+ "@types/react-dom": "^18",
+ "eslint": "^8",
+ "eslint-config-next": "14.0.4",
+ "typescript": "^5"
+ }
+}
diff --git a/pickleglass_web/postcss.config.js b/pickleglass_web/postcss.config.js
new file mode 100644
index 0000000..0cc9a9d
--- /dev/null
+++ b/pickleglass_web/postcss.config.js
@@ -0,0 +1,6 @@
+module.exports = {
+ plugins: {
+ tailwindcss: {},
+ autoprefixer: {},
+ },
+}
\ No newline at end of file
diff --git a/pickleglass_web/public/README.md b/pickleglass_web/public/README.md
new file mode 100644
index 0000000..e1e5e87
--- /dev/null
+++ b/pickleglass_web/public/README.md
@@ -0,0 +1,19 @@
+# Public Assets
+
+This folder contains static files.
+
+## Logo Image
+
+**@symbol.svg** - Logo image for the pickleglass application
+
+### Requirements:
+- Filename: `symbol.png`
+- Recommended size: 32x32px or 64x64px
+- Format: PNG
+- Transparent background recommended
+
+### Usage:
+- Used as logo in sidebar header
+- Loaded optimized through Next.js Image component
+
+Currently there is a placeholder file, please replace it with the actual logo image.
\ No newline at end of file
diff --git a/pickleglass_web/public/activity.svg b/pickleglass_web/public/activity.svg
new file mode 100644
index 0000000..1733978
--- /dev/null
+++ b/pickleglass_web/public/activity.svg
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/pickleglass_web/public/book.svg b/pickleglass_web/public/book.svg
new file mode 100644
index 0000000..8796619
--- /dev/null
+++ b/pickleglass_web/public/book.svg
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/pickleglass_web/public/credit-card.svg b/pickleglass_web/public/credit-card.svg
new file mode 100644
index 0000000..8dfd66f
--- /dev/null
+++ b/pickleglass_web/public/credit-card.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/pickleglass_web/public/download.svg b/pickleglass_web/public/download.svg
new file mode 100644
index 0000000..d9a09d1
--- /dev/null
+++ b/pickleglass_web/public/download.svg
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/pickleglass_web/public/linkout.svg b/pickleglass_web/public/linkout.svg
new file mode 100644
index 0000000..d50e3fd
--- /dev/null
+++ b/pickleglass_web/public/linkout.svg
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/pickleglass_web/public/privacy.svg b/pickleglass_web/public/privacy.svg
new file mode 100644
index 0000000..fd9d75b
--- /dev/null
+++ b/pickleglass_web/public/privacy.svg
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/pickleglass_web/public/search.svg b/pickleglass_web/public/search.svg
new file mode 100644
index 0000000..a4ba050
--- /dev/null
+++ b/pickleglass_web/public/search.svg
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/pickleglass_web/public/setting.svg b/pickleglass_web/public/setting.svg
new file mode 100644
index 0000000..7a35367
--- /dev/null
+++ b/pickleglass_web/public/setting.svg
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/pickleglass_web/public/symbol.svg b/pickleglass_web/public/symbol.svg
new file mode 100644
index 0000000..232bc63
--- /dev/null
+++ b/pickleglass_web/public/symbol.svg
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/pickleglass_web/public/unfold.svg b/pickleglass_web/public/unfold.svg
new file mode 100644
index 0000000..60652c1
--- /dev/null
+++ b/pickleglass_web/public/unfold.svg
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/pickleglass_web/public/user.svg b/pickleglass_web/public/user.svg
new file mode 100644
index 0000000..b66eb09
--- /dev/null
+++ b/pickleglass_web/public/user.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/pickleglass_web/public/word.svg b/pickleglass_web/public/word.svg
new file mode 100644
index 0000000..6ea3230
--- /dev/null
+++ b/pickleglass_web/public/word.svg
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/pickleglass_web/requirements.txt b/pickleglass_web/requirements.txt
new file mode 100644
index 0000000..2c32788
--- /dev/null
+++ b/pickleglass_web/requirements.txt
@@ -0,0 +1,13 @@
+fastapi==0.104.1
+uvicorn[standard]==0.24.0
+aiosqlite==0.19.0
+pydantic==2.5.0
+python-dotenv==1.0.0
+python-multipart==0.0.6
+bcrypt==4.1.2
+python-jose[cryptography]==3.3.0
+passlib[bcrypt]==1.7.4
+python-dateutil==2.8.2
+email-validator==2.1.0
+fastapi-cors==0.0.6
+PyJWT==2.8.0
\ No newline at end of file
diff --git a/pickleglass_web/tailwind.config.js b/pickleglass_web/tailwind.config.js
new file mode 100644
index 0000000..af616ba
--- /dev/null
+++ b/pickleglass_web/tailwind.config.js
@@ -0,0 +1,20 @@
+/** @type {import('tailwindcss').Config} */
+module.exports = {
+ content: [
+ './pages/**/*.{js,ts,jsx,tsx,mdx}',
+ './components/**/*.{js,ts,jsx,tsx,mdx}',
+ './app/**/*.{js,ts,jsx,tsx,mdx}',
+ ],
+ theme: {
+ extend: {
+ colors: {
+ primary: '#3b82f6',
+ secondary: '#64748b',
+ accent: '#06b6d4',
+ 'subtle-bg': '#f8f7f4',
+ 'subtle-active-bg': '#e7e5e4',
+ },
+ },
+ },
+ plugins: [],
+}
\ No newline at end of file
diff --git a/pickleglass_web/tsconfig.json b/pickleglass_web/tsconfig.json
new file mode 100644
index 0000000..103a088
--- /dev/null
+++ b/pickleglass_web/tsconfig.json
@@ -0,0 +1,27 @@
+{
+ "compilerOptions": {
+ "lib": ["dom", "dom.iterable", "es6"],
+ "allowJs": true,
+ "skipLibCheck": true,
+ "strict": true,
+ "noEmit": true,
+ "esModuleInterop": true,
+ "module": "esnext",
+ "moduleResolution": "bundler",
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "jsx": "preserve",
+ "incremental": true,
+ "plugins": [
+ {
+ "name": "next"
+ }
+ ],
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./*"]
+ }
+ },
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
+ "exclude": ["node_modules"]
+}
\ No newline at end of file
diff --git a/pickleglass_web/utils/api.ts b/pickleglass_web/utils/api.ts
new file mode 100644
index 0000000..6e6561f
--- /dev/null
+++ b/pickleglass_web/utils/api.ts
@@ -0,0 +1,607 @@
+import { auth as firebaseAuth } from './firebase';
+import {
+ FirestoreUserService,
+ FirestoreSessionService,
+ FirestoreTranscriptService,
+ FirestoreAiMessageService,
+ FirestoreSummaryService,
+ FirestorePromptPresetService,
+ FirestoreSession,
+ FirestoreTranscript,
+ FirestoreAiMessage,
+ FirestoreSummary,
+ FirestorePromptPreset
+} from './firestore';
+import { Timestamp } from 'firebase/firestore';
+
+export interface UserProfile {
+ uid: string;
+ display_name: string;
+ email: string;
+}
+
+export interface Session {
+ id: string;
+ uid: string;
+ title: string;
+ started_at: number;
+ ended_at?: number;
+ sync_state: 'clean' | 'dirty';
+ updated_at: number;
+}
+
+export interface Transcript {
+ id: string;
+ session_id: string;
+ start_at: number;
+ end_at?: number;
+ speaker?: string;
+ text: string;
+ lang?: string;
+ created_at: number;
+ sync_state: 'clean' | 'dirty';
+}
+
+export interface AiMessage {
+ id: string;
+ session_id: string;
+ sent_at: number;
+ role: 'user' | 'assistant';
+ content: string;
+ tokens?: number;
+ model?: string;
+ created_at: number;
+ sync_state: 'clean' | 'dirty';
+}
+
+export interface Summary {
+ session_id: string;
+ generated_at: number;
+ model?: string;
+ text: string;
+ tldr: string;
+ bullet_json: string;
+ action_json: string;
+ tokens_used?: number;
+ updated_at: number;
+ sync_state: 'clean' | 'dirty';
+}
+
+export interface PromptPreset {
+ id: string;
+ uid: string;
+ title: string;
+ prompt: string;
+ is_default: 0 | 1;
+ created_at: number;
+ sync_state: 'clean' | 'dirty';
+}
+
+export interface SessionDetails {
+ session: Session;
+ transcripts: Transcript[];
+ ai_messages: AiMessage[];
+ summary: Summary | null;
+}
+
+
+const isFirebaseMode = (): boolean => {
+ return firebaseAuth.currentUser !== null;
+};
+
+const timestampToUnix = (timestamp: Timestamp): number => {
+ return timestamp.seconds * 1000 + Math.floor(timestamp.nanoseconds / 1000000);
+};
+
+const unixToTimestamp = (unix: number): Timestamp => {
+ return Timestamp.fromMillis(unix);
+};
+
+const convertFirestoreSession = (session: { id: string } & FirestoreSession, uid: string): Session => {
+ return {
+ id: session.id,
+ uid,
+ title: session.title,
+ started_at: timestampToUnix(session.startedAt),
+ ended_at: session.endedAt ? timestampToUnix(session.endedAt) : undefined,
+ sync_state: 'clean',
+ updated_at: timestampToUnix(session.startedAt)
+ };
+};
+
+const convertFirestoreTranscript = (transcript: { id: string } & FirestoreTranscript): Transcript => {
+ return {
+ id: transcript.id,
+ session_id: '',
+ start_at: timestampToUnix(transcript.startAt),
+ end_at: transcript.endAt ? timestampToUnix(transcript.endAt) : undefined,
+ speaker: transcript.speaker,
+ text: transcript.text,
+ lang: transcript.lang,
+ created_at: timestampToUnix(transcript.createdAt),
+ sync_state: 'clean'
+ };
+};
+
+const convertFirestoreAiMessage = (message: { id: string } & FirestoreAiMessage): AiMessage => {
+ return {
+ id: message.id,
+ session_id: '',
+ sent_at: timestampToUnix(message.sentAt),
+ role: message.role,
+ content: message.content,
+ tokens: message.tokens,
+ model: message.model,
+ created_at: timestampToUnix(message.createdAt),
+ sync_state: 'clean'
+ };
+};
+
+const convertFirestoreSummary = (summary: FirestoreSummary, sessionId: string): Summary => {
+ return {
+ session_id: sessionId,
+ generated_at: timestampToUnix(summary.generatedAt),
+ model: summary.model,
+ text: summary.text,
+ tldr: summary.tldr,
+ bullet_json: JSON.stringify(summary.bulletPoints),
+ action_json: JSON.stringify(summary.actionItems),
+ tokens_used: summary.tokensUsed,
+ updated_at: timestampToUnix(summary.generatedAt),
+ sync_state: 'clean'
+ };
+};
+
+const convertFirestorePreset = (preset: { id: string } & FirestorePromptPreset, uid: string): PromptPreset => {
+ return {
+ id: preset.id,
+ uid,
+ title: preset.title,
+ prompt: preset.prompt,
+ is_default: preset.isDefault ? 1 : 0,
+ created_at: timestampToUnix(preset.createdAt),
+ sync_state: 'clean'
+ };
+};
+
+
+let API_ORIGIN = process.env.NODE_ENV === 'development'
+ ? 'http://localhost:9001'
+ : '';
+
+const loadRuntimeConfig = async (): Promise => {
+ try {
+ const response = await fetch('/runtime-config.json');
+ if (response.ok) {
+ const config = await response.json();
+ console.log('β
Runtime config loaded:', config);
+ return config.API_URL;
+ }
+ } catch (error) {
+ console.log('β οΈ Failed to load runtime config:', error);
+ }
+ return null;
+};
+
+const getApiUrlFromElectron = (): string | null => {
+ if (typeof window !== 'undefined') {
+ try {
+ const { ipcRenderer } = window.require?.('electron') || {};
+ if (ipcRenderer) {
+ try {
+ const apiUrl = ipcRenderer.sendSync('get-api-url-sync');
+ if (apiUrl) {
+ console.log('β
API URL from Electron IPC:', apiUrl);
+ return apiUrl;
+ }
+ } catch (error) {
+ console.log('β οΈ Electron IPC failed:', error);
+ }
+ }
+ } catch (error) {
+ console.log('βΉοΈ Not in Electron environment');
+ }
+ }
+ return null;
+};
+
+let apiUrlInitialized = false;
+let initializationPromise: Promise | null = null;
+
+const initializeApiUrl = async () => {
+ if (apiUrlInitialized) return;
+
+ const electronUrl = getApiUrlFromElectron();
+ if (electronUrl) {
+ API_ORIGIN = electronUrl;
+ apiUrlInitialized = true;
+ return;
+ }
+
+ const runtimeUrl = await loadRuntimeConfig();
+ if (runtimeUrl) {
+ API_ORIGIN = runtimeUrl;
+ apiUrlInitialized = true;
+ return;
+ }
+
+ console.log('π Using fallback API URL:', API_ORIGIN);
+ apiUrlInitialized = true;
+};
+
+if (typeof window !== 'undefined') {
+ initializationPromise = initializeApiUrl();
+}
+
+const userInfoListeners: Array<(userInfo: UserProfile | null) => void> = [];
+
+export const getUserInfo = (): UserProfile | null => {
+ if (typeof window === 'undefined') return null;
+
+ const storedUserInfo = localStorage.getItem('pickleglass_user');
+ if (storedUserInfo) {
+ try {
+ return JSON.parse(storedUserInfo);
+ } catch (error) {
+ console.error('Failed to parse user info:', error);
+ localStorage.removeItem('pickleglass_user');
+ }
+ }
+ return null;
+};
+
+export const setUserInfo = (userInfo: UserProfile | null, skipEvents: boolean = false) => {
+ if (typeof window === 'undefined') return;
+
+ if (userInfo) {
+ localStorage.setItem('pickleglass_user', JSON.stringify(userInfo));
+ } else {
+ localStorage.removeItem('pickleglass_user');
+ }
+
+ if (!skipEvents) {
+ userInfoListeners.forEach(listener => listener(userInfo));
+
+ window.dispatchEvent(new Event('userInfoChanged'));
+ }
+};
+
+export const onUserInfoChange = (listener: (userInfo: UserProfile | null) => void) => {
+ userInfoListeners.push(listener);
+
+ return () => {
+ const index = userInfoListeners.indexOf(listener);
+ if (index > -1) {
+ userInfoListeners.splice(index, 1);
+ }
+ };
+};
+
+export const getApiHeaders = (): HeadersInit => {
+ const headers: HeadersInit = {
+ 'Content-Type': 'application/json',
+ };
+
+ const userInfo = getUserInfo();
+ if (userInfo?.uid) {
+ headers['X-User-ID'] = userInfo.uid;
+ }
+
+ return headers;
+};
+
+
+export const apiCall = async (path: string, options: RequestInit = {}) => {
+ if (!apiUrlInitialized && initializationPromise) {
+ await initializationPromise;
+ }
+
+ if (!apiUrlInitialized) {
+ await initializeApiUrl();
+ }
+
+ const url = `${API_ORIGIN}${path}`;
+ console.log('π apiCall (Local Mode):', {
+ path,
+ API_ORIGIN,
+ fullUrl: url,
+ initialized: apiUrlInitialized,
+ timestamp: new Date().toISOString()
+ });
+
+ const defaultOpts: RequestInit = {
+ headers: {
+ 'Content-Type': 'application/json',
+ ...getApiHeaders(),
+ ...(options.headers || {}),
+ },
+ ...options,
+ };
+ return fetch(url, defaultOpts);
+};
+
+
+export const searchConversations = async (query: string): Promise => {
+ if (!query.trim()) {
+ return [];
+ }
+
+ if (isFirebaseMode()) {
+ const sessions = await getSessions();
+ return sessions.filter(session =>
+ session.title.toLowerCase().includes(query.toLowerCase())
+ );
+ } else {
+ const response = await apiCall(`/api/conversations/search?q=${encodeURIComponent(query)}`, {
+ method: 'GET',
+ });
+ if (!response.ok) {
+ throw new Error('Failed to search conversations');
+ }
+ return response.json();
+ }
+};
+
+export const getSessions = async (): Promise => {
+ if (isFirebaseMode()) {
+ const uid = firebaseAuth.currentUser!.uid;
+ const firestoreSessions = await FirestoreSessionService.getSessions(uid);
+ return firestoreSessions.map(session => convertFirestoreSession(session, uid));
+ } else {
+ const response = await apiCall(`/api/conversations`, { method: 'GET' });
+ if (!response.ok) throw new Error('Failed to fetch sessions');
+ return response.json();
+ }
+};
+
+export const getSessionDetails = async (sessionId: string): Promise => {
+ if (isFirebaseMode()) {
+ const uid = firebaseAuth.currentUser!.uid;
+
+ const [session, transcripts, aiMessages, summary] = await Promise.all([
+ FirestoreSessionService.getSession(uid, sessionId),
+ FirestoreTranscriptService.getTranscripts(uid, sessionId),
+ FirestoreAiMessageService.getAiMessages(uid, sessionId),
+ FirestoreSummaryService.getSummary(uid, sessionId)
+ ]);
+
+ if (!session) {
+ throw new Error('Session not found');
+ }
+
+ return {
+ session: convertFirestoreSession({ id: sessionId, ...session }, uid),
+ transcripts: transcripts.map(t => ({ ...convertFirestoreTranscript(t), session_id: sessionId })),
+ ai_messages: aiMessages.map(m => ({ ...convertFirestoreAiMessage(m), session_id: sessionId })),
+ summary: summary ? convertFirestoreSummary(summary, sessionId) : null
+ };
+ } else {
+ const response = await apiCall(`/api/conversations/${sessionId}`, { method: 'GET' });
+ if (!response.ok) throw new Error('Failed to fetch session details');
+ return response.json();
+ }
+};
+
+export const createSession = async (title?: string): Promise<{ id: string }> => {
+ if (isFirebaseMode()) {
+ const uid = firebaseAuth.currentUser!.uid;
+ const sessionId = await FirestoreSessionService.createSession(uid, {
+ title: title || 'New Session',
+ endedAt: undefined
+ });
+ return { id: sessionId };
+ } else {
+ const response = await apiCall(`/api/conversations`, {
+ method: 'POST',
+ body: JSON.stringify({ title }),
+ });
+ if (!response.ok) throw new Error('Failed to create session');
+ return response.json();
+ }
+};
+
+export const deleteSession = async (sessionId: string): Promise => {
+ if (isFirebaseMode()) {
+ const uid = firebaseAuth.currentUser!.uid;
+ await FirestoreSessionService.deleteSession(uid, sessionId);
+ } else {
+ const response = await apiCall(`/api/conversations/${sessionId}`, { method: 'DELETE' });
+ if (!response.ok) throw new Error('Failed to delete session');
+ }
+};
+
+export const getUserProfile = async (): Promise => {
+ if (isFirebaseMode()) {
+ const user = firebaseAuth.currentUser!;
+ const firestoreProfile = await FirestoreUserService.getUser(user.uid);
+
+ return {
+ uid: user.uid,
+ display_name: firestoreProfile?.displayName || user.displayName || 'User',
+ email: firestoreProfile?.email || user.email || 'no-email@example.com'
+ };
+ } else {
+ const response = await apiCall(`/api/user/profile`, { method: 'GET' });
+ if (!response.ok) throw new Error('Failed to fetch user profile');
+ return response.json();
+ }
+};
+
+export const updateUserProfile = async (data: { displayName: string }): Promise => {
+ if (isFirebaseMode()) {
+ const uid = firebaseAuth.currentUser!.uid;
+ await FirestoreUserService.updateUser(uid, { displayName: data.displayName });
+ } else {
+ const response = await apiCall(`/api/user/profile`, {
+ method: 'PUT',
+ body: JSON.stringify(data),
+ });
+ if (!response.ok) throw new Error('Failed to update user profile');
+ }
+};
+
+export const findOrCreateUser = async (user: UserProfile): Promise => {
+ if (isFirebaseMode()) {
+ const uid = firebaseAuth.currentUser!.uid;
+ const existingUser = await FirestoreUserService.getUser(uid);
+
+ if (!existingUser) {
+ await FirestoreUserService.createUser(uid, {
+ displayName: user.display_name,
+ email: user.email
+ });
+ }
+
+ return user;
+ } else {
+ const response = await apiCall(`/api/user/find-or-create`, {
+ method: 'POST',
+ body: JSON.stringify(user),
+ });
+ if (!response.ok) throw new Error('Failed to find or create user');
+ return response.json();
+ }
+};
+
+export const saveApiKey = async (apiKey: string): Promise => {
+ if (isFirebaseMode()) {
+ console.log('API key is not needed in Firebase mode');
+ return;
+ } else {
+ const response = await apiCall(`/api/user/api-key`, {
+ method: 'POST',
+ body: JSON.stringify({ apiKey }),
+ });
+ if (!response.ok) throw new Error('Failed to save API key');
+ }
+};
+
+export const checkApiKeyStatus = async (): Promise<{ hasApiKey: boolean }> => {
+ if (isFirebaseMode()) {
+ return { hasApiKey: true };
+ } else {
+ const response = await apiCall(`/api/user/api-key-status`, { method: 'GET' });
+ if (!response.ok) throw new Error('Failed to check API key status');
+ return response.json();
+ }
+};
+
+export const deleteAccount = async (): Promise => {
+ if (isFirebaseMode()) {
+ const uid = firebaseAuth.currentUser!.uid;
+
+ await FirestoreUserService.deleteUser(uid);
+
+ await firebaseAuth.currentUser!.delete();
+ } else {
+ const response = await apiCall(`/api/user/profile`, { method: 'DELETE' });
+ if (!response.ok) throw new Error('Failed to delete account');
+ }
+};
+
+export const getPresets = async (): Promise => {
+ if (isFirebaseMode()) {
+ const uid = firebaseAuth.currentUser!.uid;
+ const firestorePresets = await FirestorePromptPresetService.getPresets(uid);
+ return firestorePresets.map(preset => convertFirestorePreset(preset, uid));
+ } else {
+ const response = await apiCall(`/api/presets`, { method: 'GET' });
+ if (!response.ok) throw new Error('Failed to fetch presets');
+ return response.json();
+ }
+};
+
+export const createPreset = async (data: { title: string, prompt: string }): Promise<{ id: string }> => {
+ if (isFirebaseMode()) {
+ const uid = firebaseAuth.currentUser!.uid;
+ const presetId = await FirestorePromptPresetService.createPreset(uid, {
+ title: data.title,
+ prompt: data.prompt,
+ isDefault: false
+ });
+ return { id: presetId };
+ } else {
+ const response = await apiCall(`/api/presets`, {
+ method: 'POST',
+ body: JSON.stringify(data),
+ });
+ if (!response.ok) throw new Error('Failed to create preset');
+ return response.json();
+ }
+};
+
+export const updatePreset = async (id: string, data: { title: string, prompt: string }): Promise => {
+ if (isFirebaseMode()) {
+ const uid = firebaseAuth.currentUser!.uid;
+ await FirestorePromptPresetService.updatePreset(uid, id, {
+ title: data.title,
+ prompt: data.prompt
+ });
+ } else {
+ const response = await apiCall(`/api/presets/${id}`, {
+ method: 'PUT',
+ body: JSON.stringify(data),
+ });
+ if (!response.ok) throw new Error('Failed to update preset');
+ }
+};
+
+export const deletePreset = async (id: string): Promise => {
+ if (isFirebaseMode()) {
+ const uid = firebaseAuth.currentUser!.uid;
+ await FirestorePromptPresetService.deletePreset(uid, id);
+ } else {
+ const response = await apiCall(`/api/presets/${id}`, { method: 'DELETE' });
+ if (!response.ok) throw new Error('Failed to delete preset');
+ }
+};
+
+export interface BatchData {
+ profile?: UserProfile;
+ presets?: PromptPreset[];
+ sessions?: Session[];
+}
+
+export const getBatchData = async (includes: ('profile' | 'presets' | 'sessions')[]): Promise => {
+ if (isFirebaseMode()) {
+ const result: BatchData = {};
+
+ const promises: Promise[] = [];
+
+ if (includes.includes('profile')) {
+ promises.push(getUserProfile().then(profile => ({ type: 'profile', data: profile })));
+ }
+ if (includes.includes('presets')) {
+ promises.push(getPresets().then(presets => ({ type: 'presets', data: presets })));
+ }
+ if (includes.includes('sessions')) {
+ promises.push(getSessions().then(sessions => ({ type: 'sessions', data: sessions })));
+ }
+
+ const results = await Promise.all(promises);
+
+ results.forEach(({ type, data }) => {
+ result[type as keyof BatchData] = data;
+ });
+
+ return result;
+ } else {
+ const response = await apiCall(`/api/user/batch?include=${includes.join(',')}`, { method: 'GET' });
+ if (!response.ok) throw new Error('Failed to fetch batch data');
+ return response.json();
+ }
+};
+
+export const logout = async () => {
+ if (isFirebaseMode()) {
+ const { signOut } = await import('firebase/auth');
+ await signOut(firebaseAuth);
+ }
+
+ setUserInfo(null);
+
+ localStorage.removeItem('openai_api_key');
+ localStorage.removeItem('user_info');
+
+ window.location.href = '/login';
+};
\ No newline at end of file
diff --git a/pickleglass_web/utils/auth.ts b/pickleglass_web/utils/auth.ts
new file mode 100644
index 0000000..c3de542
--- /dev/null
+++ b/pickleglass_web/utils/auth.ts
@@ -0,0 +1,76 @@
+import { useEffect, useState } from 'react'
+import { useRouter } from 'next/navigation'
+import { UserProfile, setUserInfo, findOrCreateUser } from './api'
+import { auth as firebaseAuth } from './firebase'
+import { onAuthStateChanged, User as FirebaseUser } from 'firebase/auth'
+
+const defaultLocalUser: UserProfile = {
+ uid: 'default_user',
+ display_name: 'Default User',
+ email: 'contact@pickle.com',
+};
+
+export const useAuth = () => {
+ const [user, setUser] = useState(null)
+ const [isLoading, setIsLoading] = useState(true)
+ const [mode, setMode] = useState<'local' | 'firebase' | null>(null)
+
+ useEffect(() => {
+ const unsubscribe = onAuthStateChanged(firebaseAuth, async (firebaseUser: FirebaseUser | null) => {
+ if (firebaseUser) {
+ console.log('π₯ Firebase mode activated:', firebaseUser.uid);
+ setMode('firebase');
+
+ let profile: UserProfile = {
+ uid: firebaseUser.uid,
+ display_name: firebaseUser.displayName || 'User',
+ email: firebaseUser.email || 'no-email@example.com',
+ };
+
+ try {
+ profile = await findOrCreateUser(profile);
+ console.log('β
Firestore user created/verified:', profile);
+ } catch (error) {
+ console.error('β Firestore user creation/verification failed:', error);
+ }
+
+ setUser(profile);
+ setUserInfo(profile);
+
+ if (window.ipcRenderer) {
+ window.ipcRenderer.send('set-current-user', profile.uid);
+ }
+
+ } else {
+ console.log('π Local mode activated');
+ setMode('local');
+
+ setUser(defaultLocalUser);
+ setUserInfo(defaultLocalUser);
+
+ if (window.ipcRenderer) {
+ window.ipcRenderer.send('set-current-user', defaultLocalUser.uid);
+ }
+ }
+ setIsLoading(false);
+ });
+
+ return () => unsubscribe();
+ }, [])
+
+ return { user, isLoading, mode }
+}
+
+export const useRedirectIfNotAuth = () => {
+ const { user, isLoading } = useAuth()
+ const router = useRouter()
+
+ useEffect(() => {
+ // This hook is now simplified. It doesn't redirect for local mode.
+ // If you want to force login for hosting mode, you'd add logic here.
+ // For example: if (!isLoading && !user) router.push('/login');
+ // But for now, we allow both modes.
+ }, [user, isLoading, router])
+
+ return user
+}
\ No newline at end of file
diff --git a/pickleglass_web/utils/firebase.ts b/pickleglass_web/utils/firebase.ts
new file mode 100644
index 0000000..25e6bab
--- /dev/null
+++ b/pickleglass_web/utils/firebase.ts
@@ -0,0 +1,23 @@
+// Import the functions you need from the SDKs you need
+import { initializeApp, getApp, getApps } from "firebase/app";
+import { getAuth } from "firebase/auth";
+import { getFirestore } from "firebase/firestore";
+// import { getAnalytics } from "firebase/analytics";
+
+const firebaseConfig = {
+ apiKey: "AIzaSyAgtJrmsFWG1C7m9S55HyT1laICEzuUS2g",
+ authDomain: "pickle-3651a.firebaseapp.com",
+ projectId: "pickle-3651a",
+ storageBucket: "pickle-3651a.firebasestorage.app",
+ messagingSenderId: "904706892885",
+ appId: "1:904706892885:web:0e42b3dda796674ead20dc",
+ measurementId: "G-SQ0WM6S28T"
+};
+
+// Initialize Firebase
+const app = !getApps().length ? initializeApp(firebaseConfig) : getApp();
+const auth = getAuth(app);
+const firestore = getFirestore(app);
+// const analytics = getAnalytics(app);
+
+export { app, auth, firestore };
\ No newline at end of file
diff --git a/pickleglass_web/utils/firestore.ts b/pickleglass_web/utils/firestore.ts
new file mode 100644
index 0000000..7664b92
--- /dev/null
+++ b/pickleglass_web/utils/firestore.ts
@@ -0,0 +1,260 @@
+import {
+ doc,
+ collection,
+ addDoc,
+ getDoc,
+ getDocs,
+ setDoc,
+ updateDoc,
+ deleteDoc,
+ query,
+ where,
+ orderBy,
+ serverTimestamp,
+ Timestamp,
+ writeBatch
+} from 'firebase/firestore';
+import { firestore } from './firebase';
+
+export interface FirestoreUserProfile {
+ displayName: string;
+ email: string;
+ createdAt: Timestamp;
+}
+
+export interface FirestoreSession {
+ title: string;
+ startedAt: Timestamp;
+ endedAt?: Timestamp;
+}
+
+export interface FirestoreTranscript {
+ startAt: Timestamp;
+ endAt: Timestamp;
+ speaker: 'me' | 'other';
+ text: string;
+ lang?: string;
+ createdAt: Timestamp;
+}
+
+export interface FirestoreAiMessage {
+ sentAt: Timestamp;
+ role: 'user' | 'assistant';
+ content: string;
+ tokens?: number;
+ model?: string;
+ createdAt: Timestamp;
+}
+
+export interface FirestoreSummary {
+ generatedAt: Timestamp;
+ model: string;
+ text: string;
+ tldr: string;
+ bulletPoints: string[];
+ actionItems: Array<{ owner: string; task: string; due: string }>;
+ tokensUsed?: number;
+}
+
+export interface FirestorePromptPreset {
+ title: string;
+ prompt: string;
+ isDefault: boolean;
+ createdAt: Timestamp;
+}
+
+export class FirestoreUserService {
+ static async createUser(uid: string, profile: Omit) {
+ const userRef = doc(firestore, 'users', uid);
+ await setDoc(userRef, {
+ ...profile,
+ createdAt: serverTimestamp()
+ });
+ }
+
+ static async getUser(uid: string): Promise {
+ const userRef = doc(firestore, 'users', uid);
+ const userSnap = await getDoc(userRef);
+ return userSnap.exists() ? userSnap.data() as FirestoreUserProfile : null;
+ }
+
+ static async updateUser(uid: string, updates: Partial) {
+ const userRef = doc(firestore, 'users', uid);
+ await updateDoc(userRef, updates);
+ }
+
+ static async deleteUser(uid: string) {
+ const batch = writeBatch(firestore);
+
+ const sessionsRef = collection(firestore, 'users', uid, 'sessions');
+ const sessionsSnap = await getDocs(sessionsRef);
+
+ for (const sessionDoc of sessionsSnap.docs) {
+ const sessionId = sessionDoc.id;
+
+ const transcriptsRef = collection(firestore, 'users', uid, 'sessions', sessionId, 'transcripts');
+ const transcriptsSnap = await getDocs(transcriptsRef);
+ transcriptsSnap.docs.forEach(doc => batch.delete(doc.ref));
+
+ const aiMessagesRef = collection(firestore, 'users', uid, 'sessions', sessionId, 'aiMessages');
+ const aiMessagesSnap = await getDocs(aiMessagesRef);
+ aiMessagesSnap.docs.forEach(doc => batch.delete(doc.ref));
+
+ const summaryRef = doc(firestore, 'users', uid, 'sessions', sessionId, 'summary', 'data');
+ batch.delete(summaryRef);
+
+ batch.delete(sessionDoc.ref);
+ }
+
+ const presetsRef = collection(firestore, 'users', uid, 'promptPresets');
+ const presetsSnap = await getDocs(presetsRef);
+ presetsSnap.docs.forEach(doc => batch.delete(doc.ref));
+
+ const userRef = doc(firestore, 'users', uid);
+ batch.delete(userRef);
+
+ await batch.commit();
+ }
+}
+
+export class FirestoreSessionService {
+ static async createSession(uid: string, session: Omit): Promise {
+ const sessionsRef = collection(firestore, 'users', uid, 'sessions');
+ const docRef = await addDoc(sessionsRef, {
+ ...session,
+ startedAt: serverTimestamp()
+ });
+ return docRef.id;
+ }
+
+ static async getSession(uid: string, sessionId: string): Promise {
+ const sessionRef = doc(firestore, 'users', uid, 'sessions', sessionId);
+ const sessionSnap = await getDoc(sessionRef);
+ return sessionSnap.exists() ? sessionSnap.data() as FirestoreSession : null;
+ }
+
+ static async getSessions(uid: string): Promise> {
+ const sessionsRef = collection(firestore, 'users', uid, 'sessions');
+ const q = query(sessionsRef, orderBy('startedAt', 'desc'));
+ const querySnapshot = await getDocs(q);
+
+ return querySnapshot.docs.map(doc => ({
+ id: doc.id,
+ ...doc.data() as FirestoreSession
+ }));
+ }
+
+ static async updateSession(uid: string, sessionId: string, updates: Partial) {
+ const sessionRef = doc(firestore, 'users', uid, 'sessions', sessionId);
+ await updateDoc(sessionRef, updates);
+ }
+
+ static async deleteSession(uid: string, sessionId: string) {
+ const batch = writeBatch(firestore);
+
+ const transcriptsRef = collection(firestore, 'users', uid, 'sessions', sessionId, 'transcripts');
+ const transcriptsSnap = await getDocs(transcriptsRef);
+ transcriptsSnap.docs.forEach(doc => batch.delete(doc.ref));
+
+ const aiMessagesRef = collection(firestore, 'users', uid, 'sessions', sessionId, 'aiMessages');
+ const aiMessagesSnap = await getDocs(aiMessagesRef);
+ aiMessagesSnap.docs.forEach(doc => batch.delete(doc.ref));
+
+ const summaryRef = doc(firestore, 'users', uid, 'sessions', sessionId, 'summary', 'data');
+ batch.delete(summaryRef);
+
+ const sessionRef = doc(firestore, 'users', uid, 'sessions', sessionId);
+ batch.delete(sessionRef);
+
+ await batch.commit();
+ }
+}
+
+export class FirestoreTranscriptService {
+ static async addTranscript(uid: string, sessionId: string, transcript: Omit): Promise {
+ const transcriptsRef = collection(firestore, 'users', uid, 'sessions', sessionId, 'transcripts');
+ const docRef = await addDoc(transcriptsRef, {
+ ...transcript,
+ createdAt: serverTimestamp()
+ });
+ return docRef.id;
+ }
+
+ static async getTranscripts(uid: string, sessionId: string): Promise> {
+ const transcriptsRef = collection(firestore, 'users', uid, 'sessions', sessionId, 'transcripts');
+ const q = query(transcriptsRef, orderBy('startAt', 'asc'));
+ const querySnapshot = await getDocs(q);
+
+ return querySnapshot.docs.map(doc => ({
+ id: doc.id,
+ ...doc.data() as FirestoreTranscript
+ }));
+ }
+}
+
+export class FirestoreAiMessageService {
+ static async addAiMessage(uid: string, sessionId: string, message: Omit): Promise {
+ const aiMessagesRef = collection(firestore, 'users', uid, 'sessions', sessionId, 'aiMessages');
+ const docRef = await addDoc(aiMessagesRef, {
+ ...message,
+ createdAt: serverTimestamp()
+ });
+ return docRef.id;
+ }
+
+ static async getAiMessages(uid: string, sessionId: string): Promise> {
+ const aiMessagesRef = collection(firestore, 'users', uid, 'sessions', sessionId, 'aiMessages');
+ const q = query(aiMessagesRef, orderBy('sentAt', 'asc'));
+ const querySnapshot = await getDocs(q);
+
+ return querySnapshot.docs.map(doc => ({
+ id: doc.id,
+ ...doc.data() as FirestoreAiMessage
+ }));
+ }
+}
+
+export class FirestoreSummaryService {
+ static async setSummary(uid: string, sessionId: string, summary: FirestoreSummary) {
+ const summaryRef = doc(firestore, 'users', uid, 'sessions', sessionId, 'summary', 'data');
+ await setDoc(summaryRef, summary);
+ }
+
+ static async getSummary(uid: string, sessionId: string): Promise {
+ const summaryRef = doc(firestore, 'users', uid, 'sessions', sessionId, 'summary', 'data');
+ const summarySnap = await getDoc(summaryRef);
+ return summarySnap.exists() ? summarySnap.data() as FirestoreSummary : null;
+ }
+}
+
+export class FirestorePromptPresetService {
+ static async createPreset(uid: string, preset: Omit): Promise {
+ const presetsRef = collection(firestore, 'users', uid, 'promptPresets');
+ const docRef = await addDoc(presetsRef, {
+ ...preset,
+ createdAt: serverTimestamp()
+ });
+ return docRef.id;
+ }
+
+ static async getPresets(uid: string): Promise> {
+ const presetsRef = collection(firestore, 'users', uid, 'promptPresets');
+ const q = query(presetsRef, orderBy('createdAt', 'desc'));
+ const querySnapshot = await getDocs(q);
+
+ return querySnapshot.docs.map(doc => ({
+ id: doc.id,
+ ...doc.data() as FirestorePromptPreset
+ }));
+ }
+
+ static async updatePreset(uid: string, presetId: string, updates: Partial) {
+ const presetRef = doc(firestore, 'users', uid, 'promptPresets', presetId);
+ await updateDoc(presetRef, updates);
+ }
+
+ static async deletePreset(uid: string, presetId: string) {
+ const presetRef = doc(firestore, 'users', uid, 'promptPresets', presetId);
+ await deleteDoc(presetRef);
+ }
+}
\ No newline at end of file
diff --git a/public/assets/00.gif b/public/assets/00.gif
new file mode 100644
index 0000000..7732bd6
Binary files /dev/null and b/public/assets/00.gif differ
diff --git a/public/assets/01.gif b/public/assets/01.gif
new file mode 100644
index 0000000..d64ebdb
Binary files /dev/null and b/public/assets/01.gif differ
diff --git a/public/assets/02.gif b/public/assets/02.gif
new file mode 100644
index 0000000..7a9e919
Binary files /dev/null and b/public/assets/02.gif differ
diff --git a/public/assets/03.gif b/public/assets/03.gif
new file mode 100644
index 0000000..3a33a4d
Binary files /dev/null and b/public/assets/03.gif differ
diff --git a/public/assets/banner.gif b/public/assets/banner.gif
new file mode 100644
index 0000000..73a2653
Binary files /dev/null and b/public/assets/banner.gif differ
diff --git a/public/assets/banner.png b/public/assets/banner.png
new file mode 100644
index 0000000..4d9c705
Binary files /dev/null and b/public/assets/banner.png differ
diff --git a/public/assets/button_dc.png b/public/assets/button_dc.png
new file mode 100644
index 0000000..a5fda10
Binary files /dev/null and b/public/assets/button_dc.png differ
diff --git a/public/assets/button_we.png b/public/assets/button_we.png
new file mode 100644
index 0000000..07bc957
Binary files /dev/null and b/public/assets/button_we.png differ
diff --git a/public/assets/button_xe.png b/public/assets/button_xe.png
new file mode 100644
index 0000000..f5deac4
Binary files /dev/null and b/public/assets/button_xe.png differ
diff --git a/public/assets/dompurify-3.0.7.min.js b/public/assets/dompurify-3.0.7.min.js
new file mode 100644
index 0000000..b096892
--- /dev/null
+++ b/public/assets/dompurify-3.0.7.min.js
@@ -0,0 +1,3 @@
+/*! @license DOMPurify 3.0.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.7/LICENSE */
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DOMPurify=t()}(this,(function(){"use strict";const{entries:e,setPrototypeOf:t,isFrozen:n,getPrototypeOf:o,getOwnPropertyDescriptor:r}=Object;let{freeze:i,seal:a,create:l}=Object,{apply:c,construct:s}="undefined"!=typeof Reflect&&Reflect;i||(i=function(e){return e}),a||(a=function(e){return e}),c||(c=function(e,t,n){return e.apply(t,n)}),s||(s=function(e,t){return new e(...t)});const u=b(Array.prototype.forEach),m=b(Array.prototype.pop),f=b(Array.prototype.push),p=b(String.prototype.toLowerCase),d=b(String.prototype.toString),h=b(String.prototype.match),g=b(String.prototype.replace),T=b(String.prototype.indexOf),y=b(String.prototype.trim),E=b(RegExp.prototype.test),A=(_=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n1?n-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:p;t&&t(e,null);let i=o.length;for(;i--;){let t=o[i];if("string"==typeof t){const e=r(t);e!==t&&(n(o)||(o[i]=e),t=e)}e[t]=!0}return e}function S(e){for(let t=0;t/gm),z=a(/\${[\w\W]*}/gm),B=a(/^data-[\-\w.\u00B7-\uFFFF]/),W=a(/^aria-[\-\w]+$/),G=a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Y=a(/^(?:\w+script|data):/i),j=a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),q=a(/^html$/i);var X=Object.freeze({__proto__:null,MUSTACHE_EXPR:F,ERB_EXPR:H,TMPLIT_EXPR:z,DATA_ATTR:B,ARIA_ATTR:W,IS_ALLOWED_URI:G,IS_SCRIPT_OR_DATA:Y,ATTR_WHITESPACE:j,DOCTYPE_NAME:q});const K=function(){return"undefined"==typeof window?null:window},V=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}};var $=function t(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:K();const o=e=>t(e);if(o.version="3.0.7",o.removed=[],!n||!n.document||9!==n.document.nodeType)return o.isSupported=!1,o;let{document:r}=n;const a=r,c=a.currentScript,{DocumentFragment:s,HTMLTemplateElement:_,Node:b,Element:S,NodeFilter:F,NamedNodeMap:H=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:z,DOMParser:B,trustedTypes:W}=n,Y=S.prototype,j=w(Y,"cloneNode"),$=w(Y,"nextSibling"),Z=w(Y,"childNodes"),J=w(Y,"parentNode");if("function"==typeof _){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let Q,ee="";const{implementation:te,createNodeIterator:ne,createDocumentFragment:oe,getElementsByTagName:re}=r,{importNode:ie}=a;let ae={};o.isSupported="function"==typeof e&&"function"==typeof J&&te&&void 0!==te.createHTMLDocument;const{MUSTACHE_EXPR:le,ERB_EXPR:ce,TMPLIT_EXPR:se,DATA_ATTR:ue,ARIA_ATTR:me,IS_SCRIPT_OR_DATA:fe,ATTR_WHITESPACE:pe}=X;let{IS_ALLOWED_URI:de}=X,he=null;const ge=N({},[...D,...L,...v,...k,...O]);let Te=null;const ye=N({},[...I,...M,...U,...P]);let Ee=Object.seal(l(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,_e=null,be=!0,Ne=!0,Se=!1,Re=!0,we=!1,De=!1,Le=!1,ve=!1,xe=!1,ke=!1,Ce=!1,Oe=!0,Ie=!1;const Me="user-content-";let Ue=!0,Pe=!1,Fe={},He=null;const ze=N({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Be=null;const We=N({},["audio","video","img","source","image","track"]);let Ge=null;const Ye=N({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),je="http://www.w3.org/1998/Math/MathML",qe="http://www.w3.org/2000/svg",Xe="http://www.w3.org/1999/xhtml";let Ke=Xe,Ve=!1,$e=null;const Ze=N({},[je,qe,Xe],d);let Je=null;const Qe=["application/xhtml+xml","text/html"],et="text/html";let tt=null,nt=null;const ot=r.createElement("form"),rt=function(e){return e instanceof RegExp||e instanceof Function},it=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!nt||nt!==e){if(e&&"object"==typeof e||(e={}),e=R(e),Je=-1===Qe.indexOf(e.PARSER_MEDIA_TYPE)?et:e.PARSER_MEDIA_TYPE,tt="application/xhtml+xml"===Je?d:p,he="ALLOWED_TAGS"in e?N({},e.ALLOWED_TAGS,tt):ge,Te="ALLOWED_ATTR"in e?N({},e.ALLOWED_ATTR,tt):ye,$e="ALLOWED_NAMESPACES"in e?N({},e.ALLOWED_NAMESPACES,d):Ze,Ge="ADD_URI_SAFE_ATTR"in e?N(R(Ye),e.ADD_URI_SAFE_ATTR,tt):Ye,Be="ADD_DATA_URI_TAGS"in e?N(R(We),e.ADD_DATA_URI_TAGS,tt):We,He="FORBID_CONTENTS"in e?N({},e.FORBID_CONTENTS,tt):ze,Ae="FORBID_TAGS"in e?N({},e.FORBID_TAGS,tt):{},_e="FORBID_ATTR"in e?N({},e.FORBID_ATTR,tt):{},Fe="USE_PROFILES"in e&&e.USE_PROFILES,be=!1!==e.ALLOW_ARIA_ATTR,Ne=!1!==e.ALLOW_DATA_ATTR,Se=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Re=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,we=e.SAFE_FOR_TEMPLATES||!1,De=e.WHOLE_DOCUMENT||!1,xe=e.RETURN_DOM||!1,ke=e.RETURN_DOM_FRAGMENT||!1,Ce=e.RETURN_TRUSTED_TYPE||!1,ve=e.FORCE_BODY||!1,Oe=!1!==e.SANITIZE_DOM,Ie=e.SANITIZE_NAMED_PROPS||!1,Ue=!1!==e.KEEP_CONTENT,Pe=e.IN_PLACE||!1,de=e.ALLOWED_URI_REGEXP||G,Ke=e.NAMESPACE||Xe,Ee=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&rt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ee.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&rt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ee.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Ee.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),we&&(Ne=!1),ke&&(xe=!0),Fe&&(he=N({},O),Te=[],!0===Fe.html&&(N(he,D),N(Te,I)),!0===Fe.svg&&(N(he,L),N(Te,M),N(Te,P)),!0===Fe.svgFilters&&(N(he,v),N(Te,M),N(Te,P)),!0===Fe.mathMl&&(N(he,k),N(Te,U),N(Te,P))),e.ADD_TAGS&&(he===ge&&(he=R(he)),N(he,e.ADD_TAGS,tt)),e.ADD_ATTR&&(Te===ye&&(Te=R(Te)),N(Te,e.ADD_ATTR,tt)),e.ADD_URI_SAFE_ATTR&&N(Ge,e.ADD_URI_SAFE_ATTR,tt),e.FORBID_CONTENTS&&(He===ze&&(He=R(He)),N(He,e.FORBID_CONTENTS,tt)),Ue&&(he["#text"]=!0),De&&N(he,["html","head","body"]),he.table&&(N(he,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw A('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw A('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');Q=e.TRUSTED_TYPES_POLICY,ee=Q.createHTML("")}else void 0===Q&&(Q=V(W,c)),null!==Q&&"string"==typeof ee&&(ee=Q.createHTML(""));i&&i(e),nt=e}},at=N({},["mi","mo","mn","ms","mtext"]),lt=N({},["foreignobject","desc","title","annotation-xml"]),ct=N({},["title","style","font","a","script"]),st=N({},[...L,...v,...x]),ut=N({},[...k,...C]),mt=function(e){let t=J(e);t&&t.tagName||(t={namespaceURI:Ke,tagName:"template"});const n=p(e.tagName),o=p(t.tagName);return!!$e[e.namespaceURI]&&(e.namespaceURI===qe?t.namespaceURI===Xe?"svg"===n:t.namespaceURI===je?"svg"===n&&("annotation-xml"===o||at[o]):Boolean(st[n]):e.namespaceURI===je?t.namespaceURI===Xe?"math"===n:t.namespaceURI===qe?"math"===n&<[o]:Boolean(ut[n]):e.namespaceURI===Xe?!(t.namespaceURI===qe&&!lt[o])&&(!(t.namespaceURI===je&&!at[o])&&(!ut[n]&&(ct[n]||!st[n]))):!("application/xhtml+xml"!==Je||!$e[e.namespaceURI]))},ft=function(e){f(o.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},pt=function(e,t){try{f(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){f(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Te[e])if(xe||ke)try{ft(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},dt=function(e){let t=null,n=null;if(ve)e=" "+e;else{const t=h(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Je&&Ke===Xe&&(e=''+e+"");const o=Q?Q.createHTML(e):e;if(Ke===Xe)try{t=(new B).parseFromString(o,Je)}catch(e){}if(!t||!t.documentElement){t=te.createDocument(Ke,"template",null);try{t.documentElement.innerHTML=Ve?ee:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),Ke===Xe?re.call(t,De?"html":"body")[0]:De?t.documentElement:i},ht=function(e){return ne.call(e.ownerDocument||e,e,F.SHOW_ELEMENT|F.SHOW_COMMENT|F.SHOW_TEXT,null)},gt=function(e){return e instanceof z&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof H)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Tt=function(e){return"function"==typeof b&&e instanceof b},yt=function(e,t,n){ae[e]&&u(ae[e],(e=>{e.call(o,t,n,nt)}))},Et=function(e){let t=null;if(yt("beforeSanitizeElements",e,null),gt(e))return ft(e),!0;const n=tt(e.nodeName);if(yt("uponSanitizeElement",e,{tagName:n,allowedTags:he}),e.hasChildNodes()&&!Tt(e.firstElementChild)&&E(/<[/\w]/g,e.innerHTML)&&E(/<[/\w]/g,e.textContent))return ft(e),!0;if(!he[n]||Ae[n]){if(!Ae[n]&&_t(n)){if(Ee.tagNameCheck instanceof RegExp&&E(Ee.tagNameCheck,n))return!1;if(Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(n))return!1}if(Ue&&!He[n]){const t=J(e)||e.parentNode,n=Z(e)||e.childNodes;if(n&&t){for(let o=n.length-1;o>=0;--o)t.insertBefore(j(n[o],!0),$(e))}}return ft(e),!0}return e instanceof S&&!mt(e)?(ft(e),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!E(/<\/no(script|embed|frames)/i,e.innerHTML)?(we&&3===e.nodeType&&(t=e.textContent,u([le,ce,se],(e=>{t=g(t,e," ")})),e.textContent!==t&&(f(o.removed,{element:e.cloneNode()}),e.textContent=t)),yt("afterSanitizeElements",e,null),!1):(ft(e),!0)},At=function(e,t,n){if(Oe&&("id"===t||"name"===t)&&(n in r||n in ot))return!1;if(Ne&&!_e[t]&&E(ue,t));else if(be&&E(me,t));else if(!Te[t]||_e[t]){if(!(_t(e)&&(Ee.tagNameCheck instanceof RegExp&&E(Ee.tagNameCheck,e)||Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(e))&&(Ee.attributeNameCheck instanceof RegExp&&E(Ee.attributeNameCheck,t)||Ee.attributeNameCheck instanceof Function&&Ee.attributeNameCheck(t))||"is"===t&&Ee.allowCustomizedBuiltInElements&&(Ee.tagNameCheck instanceof RegExp&&E(Ee.tagNameCheck,n)||Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(n))))return!1}else if(Ge[t]);else if(E(de,g(n,pe,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==T(n,"data:")||!Be[e]){if(Se&&!E(fe,g(n,pe,"")));else if(n)return!1}else;return!0},_t=function(e){return e.indexOf("-")>0},bt=function(e){yt("beforeSanitizeAttributes",e,null);const{attributes:t}=e;if(!t)return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Te};let r=t.length;for(;r--;){const i=t[r],{name:a,namespaceURI:l,value:c}=i,s=tt(a);let f="value"===a?c:y(c);if(n.attrName=s,n.attrValue=f,n.keepAttr=!0,n.forceKeepAttr=void 0,yt("uponSanitizeAttribute",e,n),f=n.attrValue,n.forceKeepAttr)continue;if(pt(a,e),!n.keepAttr)continue;if(!Re&&E(/\/>/i,f)){pt(a,e);continue}we&&u([le,ce,se],(e=>{f=g(f,e," ")}));const p=tt(e.nodeName);if(At(p,s,f)){if(!Ie||"id"!==s&&"name"!==s||(pt(a,e),f=Me+f),Q&&"object"==typeof W&&"function"==typeof W.getAttributeType)if(l);else switch(W.getAttributeType(p,s)){case"TrustedHTML":f=Q.createHTML(f);break;case"TrustedScriptURL":f=Q.createScriptURL(f)}try{l?e.setAttributeNS(l,a,f):e.setAttribute(a,f),m(o.removed)}catch(e){}}}yt("afterSanitizeAttributes",e,null)},Nt=function e(t){let n=null;const o=ht(t);for(yt("beforeSanitizeShadowDOM",t,null);n=o.nextNode();)yt("uponSanitizeShadowNode",n,null),Et(n)||(n.content instanceof s&&e(n.content),bt(n));yt("afterSanitizeShadowDOM",t,null)};return o.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=null,i=null,l=null;if(Ve=!e,Ve&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Tt(e)){if("function"!=typeof e.toString)throw A("toString is not a function");if("string"!=typeof(e=e.toString()))throw A("dirty is not a string, aborting")}if(!o.isSupported)return e;if(Le||it(t),o.removed=[],"string"==typeof e&&(Pe=!1),Pe){if(e.nodeName){const t=tt(e.nodeName);if(!he[t]||Ae[t])throw A("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof b)n=dt("\x3c!----\x3e"),r=n.ownerDocument.importNode(e,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?n=r:n.appendChild(r);else{if(!xe&&!we&&!De&&-1===e.indexOf("<"))return Q&&Ce?Q.createHTML(e):e;if(n=dt(e),!n)return xe?null:Ce?ee:""}n&&ve&&ft(n.firstChild);const c=ht(Pe?e:n);for(;i=c.nextNode();)Et(i)||(i.content instanceof s&&Nt(i.content),bt(i));if(Pe)return e;if(xe){if(ke)for(l=oe.call(n.ownerDocument);n.firstChild;)l.appendChild(n.firstChild);else l=n;return(Te.shadowroot||Te.shadowrootmode)&&(l=ie.call(a,l,!0)),l}let m=De?n.outerHTML:n.innerHTML;return De&&he["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&E(q,n.ownerDocument.doctype.name)&&(m="\n"+m),we&&u([le,ce,se],(e=>{m=g(m,e," ")})),Q&&Ce?Q.createHTML(m):m},o.setConfig=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};it(e),Le=!0},o.clearConfig=function(){nt=null,Le=!1},o.isValidAttribute=function(e,t,n){nt||it({});const o=tt(e),r=tt(t);return At(o,r,n)},o.addHook=function(e,t){"function"==typeof t&&(ae[e]=ae[e]||[],f(ae[e],t))},o.removeHook=function(e){if(ae[e])return m(ae[e])},o.removeHooks=function(e){ae[e]&&(ae[e]=[])},o.removeAllHooks=function(){ae={}},o}();return $}));
+//# sourceMappingURL=purify.min.js.map
diff --git a/public/assets/icon-listen.svg b/public/assets/icon-listen.svg
new file mode 100644
index 0000000..86abfa4
--- /dev/null
+++ b/public/assets/icon-listen.svg
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/public/assets/product_shot.png b/public/assets/product_shot.png
new file mode 100644
index 0000000..07b4856
Binary files /dev/null and b/public/assets/product_shot.png differ
diff --git a/public/assets/star-history-202574.png b/public/assets/star-history-202574.png
new file mode 100644
index 0000000..34851fc
Binary files /dev/null and b/public/assets/star-history-202574.png differ
diff --git a/public/assets/streamline_incognito-mode-remix.svg b/public/assets/streamline_incognito-mode-remix.svg
new file mode 100644
index 0000000..c788e3e
--- /dev/null
+++ b/public/assets/streamline_incognito-mode-remix.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/public/assets/tabler_dots.svg b/public/assets/tabler_dots.svg
new file mode 100644
index 0000000..9e9d7a8
--- /dev/null
+++ b/public/assets/tabler_dots.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/app/ApiKeyHeader.js b/src/app/ApiKeyHeader.js
new file mode 100644
index 0000000..2940b50
--- /dev/null
+++ b/src/app/ApiKeyHeader.js
@@ -0,0 +1,492 @@
+import { html, css, LitElement } from '../assets/lit-core-2.7.4.min.js';
+
+export class ApiKeyHeader extends LitElement {
+ static properties = {
+ apiKey: { type: String },
+ isLoading: { type: Boolean },
+ errorMessage: { type: String },
+ };
+
+ static styles = css`
+ :host {
+ display: block;
+ transform: translate3d(0, 0, 0);
+ backface-visibility: hidden;
+ transition: opacity 0.25s ease-out;
+ }
+
+ :host(.sliding-out) {
+ animation: slideOutUp 0.3s ease-in forwards;
+ will-change: opacity, transform;
+ }
+
+ :host(.hidden) {
+ opacity: 0;
+ pointer-events: none;
+ }
+
+ @keyframes slideOutUp {
+ from {
+ opacity: 1;
+ transform: translateY(0);
+ }
+ to {
+ opacity: 0;
+ transform: translateY(-20px);
+ }
+ }
+
+ * {
+ font-family: 'Helvetica Neue', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
+ cursor: default;
+ user-select: none;
+ box-sizing: border-box;
+ }
+
+ .container {
+ width: 285px;
+ height: 220px;
+ padding: 18px 20px;
+ background: rgba(0, 0, 0, 0.3);
+ border-radius: 16px;
+ overflow: hidden;
+ position: relative;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ }
+
+ .container::after {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ border-radius: 16px;
+ padding: 1px;
+ background: linear-gradient(169deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.5) 100%);
+ -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
+ -webkit-mask-composite: destination-out;
+ mask-composite: exclude;
+ pointer-events: none;
+ }
+
+ .close-button {
+ position: absolute;
+ top: 10px;
+ right: 10px;
+ width: 14px;
+ height: 14px;
+ background: rgba(255, 255, 255, 0.1);
+ border: none;
+ border-radius: 3px;
+ color: rgba(255, 255, 255, 0.7);
+ cursor: pointer;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ transition: all 0.15s ease;
+ z-index: 10;
+ font-size: 14px;
+ line-height: 1;
+ padding: 0;
+ }
+
+ .close-button:hover {
+ background: rgba(255, 255, 255, 0.2);
+ color: rgba(255, 255, 255, 0.9);
+ }
+
+ .close-button:active {
+ transform: scale(0.95);
+ }
+
+ .title {
+ color: white;
+ font-size: 16px;
+ font-weight: 500; /* Medium */
+ margin: 0;
+ text-align: center;
+ flex-shrink: 0; /* μ λͺ©μ΄ μ€μ΄λ€μ§ μλλ‘ κ³ μ */
+ }
+
+ .form-content {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ width: 100%;
+ margin-top: auto; /* μ΄ μμ±μ΄ μ λͺ©κ³Ό νΌ μ¬μ΄μ 곡κ°μ λ§λλλ€. */
+ }
+
+ .error-message {
+ color: rgba(239, 68, 68, 0.9);
+ font-weight: 500;
+ font-size: 11px;
+ height: 14px; /* Reserve space to prevent layout shift */
+ text-align: center;
+ margin-bottom: 4px;
+ }
+
+ .api-input {
+ width: 100%;
+ height: 34px;
+ background: rgba(255, 255, 255, 0.1);
+ border-radius: 10px;
+ border: none;
+ padding: 0 10px;
+ color: white;
+ font-size: 12px;
+ font-weight: 400; /* Regular */
+ margin-bottom: 6px;
+ text-align: center;
+ user-select: text;
+ cursor: text;
+ }
+
+ .api-input::placeholder {
+ color: rgba(255, 255, 255, 0.6);
+ }
+
+ .api-input:focus {
+ outline: none;
+ }
+
+ .action-button {
+ width: 100%;
+ height: 34px;
+ background: rgba(255, 255, 255, 0.2);
+ border: none;
+ border-radius: 10px;
+ color: white;
+ font-size: 12px;
+ font-weight: 500; /* Medium */
+ cursor: pointer;
+ transition: background 0.15s ease;
+ position: relative;
+ overflow: hidden;
+ }
+
+ .action-button::after {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ border-radius: 10px;
+ padding: 1px;
+ background: linear-gradient(169deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.5) 100%);
+ -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
+ -webkit-mask-composite: destination-out;
+ mask-composite: exclude;
+ pointer-events: none;
+ }
+
+ .action-button:hover {
+ background: rgba(255, 255, 255, 0.3);
+ }
+
+ .action-button:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+
+ .or-text {
+ color: rgba(255, 255, 255, 0.5);
+ font-size: 12px;
+ font-weight: 500; /* Medium */
+ margin: 10px 0;
+ }
+ `;
+
+ constructor() {
+ super();
+ this.dragState = null;
+ this.wasJustDragged = false;
+ this.apiKey = '';
+ this.isLoading = false;
+ this.errorMessage = '';
+ this.validatedApiKey = null;
+
+ this.handleMouseMove = this.handleMouseMove.bind(this);
+ this.handleMouseUp = this.handleMouseUp.bind(this);
+ this.handleKeyPress = this.handleKeyPress.bind(this);
+ this.handleSubmit = this.handleSubmit.bind(this);
+ this.handleInput = this.handleInput.bind(this);
+ this.handleAnimationEnd = this.handleAnimationEnd.bind(this);
+ this.handleUsePicklesKey = this.handleUsePicklesKey.bind(this);
+ }
+
+ reset() {
+ this.apiKey = '';
+ this.isLoading = false;
+ this.errorMessage = '';
+ this.validatedApiKey = null;
+ this.requestUpdate();
+ }
+
+ async handleMouseDown(e) {
+ if (e.target.tagName === 'INPUT' || e.target.tagName === 'BUTTON') {
+ return;
+ }
+
+ e.preventDefault();
+
+ const { ipcRenderer } = window.require('electron');
+ const initialPosition = await ipcRenderer.invoke('get-header-position');
+
+ this.dragState = {
+ initialMouseX: e.screenX,
+ initialMouseY: e.screenY,
+ initialWindowX: initialPosition.x,
+ initialWindowY: initialPosition.y,
+ moved: false,
+ };
+
+ window.addEventListener('mousemove', this.handleMouseMove);
+ window.addEventListener('mouseup', this.handleMouseUp, { once: true });
+ }
+
+ handleMouseMove(e) {
+ if (!this.dragState) return;
+
+ const deltaX = Math.abs(e.screenX - this.dragState.initialMouseX);
+ const deltaY = Math.abs(e.screenY - this.dragState.initialMouseY);
+
+ if (deltaX > 3 || deltaY > 3) {
+ this.dragState.moved = true;
+ }
+
+ const newWindowX = this.dragState.initialWindowX + (e.screenX - this.dragState.initialMouseX);
+ const newWindowY = this.dragState.initialWindowY + (e.screenY - this.dragState.initialMouseY);
+
+ const { ipcRenderer } = window.require('electron');
+ ipcRenderer.invoke('move-header-to', newWindowX, newWindowY);
+ }
+
+ handleMouseUp(e) {
+ if (!this.dragState) return;
+
+ const wasDragged = this.dragState.moved;
+
+ window.removeEventListener('mousemove', this.handleMouseMove);
+ this.dragState = null;
+
+ if (wasDragged) {
+ this.wasJustDragged = true;
+ setTimeout(() => {
+ this.wasJustDragged = false;
+ }, 200);
+ }
+ }
+
+ handleInput(e) {
+ this.apiKey = e.target.value;
+ this.errorMessage = '';
+ console.log('Input changed:', this.apiKey?.length || 0, 'chars');
+
+ this.requestUpdate();
+ this.updateComplete.then(() => {
+ const inputField = this.shadowRoot?.querySelector('.apikey-input');
+ if (inputField && this.isInputFocused) {
+ inputField.focus();
+ }
+ });
+ }
+
+ handlePaste(e) {
+ e.preventDefault();
+ this.errorMessage = '';
+ const clipboardText = (e.clipboardData || window.clipboardData).getData('text');
+ console.log('Paste event detected:', clipboardText?.substring(0, 10) + '...');
+
+ if (clipboardText) {
+ this.apiKey = clipboardText.trim();
+
+ const inputElement = e.target;
+ inputElement.value = this.apiKey;
+ }
+
+ this.requestUpdate();
+ this.updateComplete.then(() => {
+ const inputField = this.shadowRoot?.querySelector('.apikey-input');
+ if (inputField) {
+ inputField.focus();
+ inputField.setSelectionRange(inputField.value.length, inputField.value.length);
+ }
+ });
+ }
+
+ handleKeyPress(e) {
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ this.handleSubmit();
+ }
+ }
+
+ async handleSubmit() {
+ if (this.wasJustDragged || this.isLoading || !this.apiKey.trim()) {
+ console.log('Submit blocked:', {
+ wasJustDragged: this.wasJustDragged,
+ isLoading: this.isLoading,
+ hasApiKey: !!this.apiKey.trim(),
+ });
+ return;
+ }
+
+ console.log('Starting API key validation...');
+ this.isLoading = true;
+ this.errorMessage = '';
+ this.requestUpdate();
+
+ const apiKey = this.apiKey.trim();
+ let isValid = false;
+ try {
+ const isValid = await this.validateApiKey(this.apiKey.trim());
+
+ if (isValid) {
+ console.log('API key valid - starting slide out animation');
+ this.startSlideOutAnimation();
+ this.validatedApiKey = this.apiKey.trim();
+ } else {
+ this.errorMessage = 'Invalid API key - please check and try again';
+ console.log('API key validation failed');
+ }
+ } catch (error) {
+ console.error('API key validation error:', error);
+ this.errorMessage = 'Validation error - please try again';
+ } finally {
+ this.isLoading = false;
+ this.requestUpdate();
+ }
+ }
+
+ async validateApiKey(apiKey) {
+ if (!apiKey || apiKey.length < 15) return false;
+ if (!apiKey.match(/^[A-Za-z0-9_-]+$/)) return false;
+
+ try {
+ console.log('Validating API key with openai models endpoint...');
+
+ const response = await fetch('https://api.openai.com/v1/models', {
+ headers: {
+ 'Content-Type': 'application/json',
+ Authorization: `Bearer ${apiKey}`,
+ },
+ });
+
+ if (response.ok) {
+ const data = await response.json();
+
+ const hasGPTModels = data.data && data.data.some(m => m.id.startsWith('gpt-'));
+ if (hasGPTModels) {
+ console.log('API key validation successful - GPT models available');
+ return true;
+ } else {
+ console.log('API key valid but no GPT models available');
+ return false;
+ }
+ } else {
+ const errorData = await response.json().catch(() => ({}));
+ console.log('API key validation failed:', response.status, errorData.error?.message || 'Unknown error');
+ return false;
+ }
+ } catch (error) {
+ console.error('API key validation network error:', error);
+ return apiKey.length >= 20; // Fallback for network issues
+ }
+ }
+
+ startSlideOutAnimation() {
+ this.classList.add('sliding-out');
+ }
+
+ handleUsePicklesKey(e) {
+ e.preventDefault();
+ if (this.wasJustDragged) return;
+
+ console.log('Requesting Firebase authentication from main process...');
+ if (window.require) {
+ window.require('electron').ipcRenderer.invoke('start-firebase-auth');
+ }
+ }
+
+ handleClose() {
+ console.log('Close button clicked');
+ if (window.require) {
+ window.require('electron').ipcRenderer.invoke('quit-application');
+ }
+ }
+
+ handleAnimationEnd(e) {
+ if (e.target !== this) return;
+
+ if (this.classList.contains('sliding-out')) {
+ this.classList.remove('sliding-out');
+ this.classList.add('hidden');
+
+ if (this.validatedApiKey) {
+ if (window.require) {
+ window.require('electron').ipcRenderer.invoke('api-key-validated', this.validatedApiKey);
+ }
+ this.validatedApiKey = null;
+ }
+ }
+ }
+
+ connectedCallback() {
+ super.connectedCallback();
+ this.addEventListener('animationend', this.handleAnimationEnd);
+
+ }
+
+ disconnectedCallback() {
+ super.disconnectedCallback();
+ this.removeEventListener('animationend', this.handleAnimationEnd);
+
+ }
+
+ render() {
+ const isButtonDisabled = this.isLoading || !this.apiKey || !this.apiKey.trim();
+
+ return html`
+
+
+
+
+
+
+
Choose how to power your AI
+
+
+
${this.errorMessage}
+
(this.errorMessage = '')}
+ ?disabled=${this.isLoading}
+ autocomplete="off"
+ spellcheck="false"
+ tabindex="0"
+ />
+
+
+ ${this.isLoading ? 'Validating...' : 'Confirm'}
+
+
+
or
+
+
Use Pickle's API Key
+
+
+ `;
+ }
+}
+
+customElements.define('apikey-header', ApiKeyHeader);
diff --git a/src/app/AppHeader.js b/src/app/AppHeader.js
new file mode 100644
index 0000000..ad0bcef
--- /dev/null
+++ b/src/app/AppHeader.js
@@ -0,0 +1,592 @@
+import { html, css, LitElement } from '../assets/lit-core-2.7.4.min.js';
+
+export class AppHeader extends LitElement {
+ static properties = {
+ isSessionActive: { type: Boolean, state: true },
+ };
+
+ static styles = css`
+ :host {
+ display: block;
+ transform: translate3d(0, 0, 0);
+ backface-visibility: hidden;
+ transition: transform 0.25s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.25s ease-out;
+ }
+
+ :host(.hiding) {
+ animation: slideUp 0.45s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
+ }
+
+ :host(.showing) {
+ animation: slideDown 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
+ }
+
+ :host(.sliding-in) {
+ animation: fadeIn 0.25s ease-out forwards;
+ will-change: opacity;
+ }
+
+ :host(.hidden) {
+ opacity: 0;
+ transform: translateY(-180%) scale(0.8);
+ pointer-events: none;
+ }
+
+ @keyframes slideUp {
+ 0% {
+ opacity: 1;
+ transform: translateY(0) scale(1);
+ filter: blur(0px) brightness(1);
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
+ }
+ 25% {
+ opacity: 0.85;
+ transform: translateY(-20%) scale(0.96);
+ filter: blur(0px) brightness(0.95);
+ box-shadow: 0 6px 28px rgba(0, 0, 0, 0.25);
+ }
+ 50% {
+ opacity: 0.5;
+ transform: translateY(-60%) scale(0.9);
+ filter: blur(1px) brightness(0.85);
+ box-shadow: 0 3px 15px rgba(0, 0, 0, 0.15);
+ }
+ 75% {
+ opacity: 0.15;
+ transform: translateY(-120%) scale(0.85);
+ filter: blur(2px) brightness(0.75);
+ box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
+ }
+ 100% {
+ opacity: 0;
+ transform: translateY(-180%) scale(0.8);
+ filter: blur(3px) brightness(0.7);
+ box-shadow: 0 0px 0px rgba(0, 0, 0, 0);
+ }
+ }
+
+ @keyframes slideDown {
+ 0% {
+ opacity: 0;
+ transform: translateY(-180%) scale(0.8);
+ filter: blur(3px) brightness(0.7);
+ box-shadow: 0 0px 0px rgba(0, 0, 0, 0);
+ }
+ 40% {
+ opacity: 0.6;
+ transform: translateY(-30%) scale(0.95);
+ filter: blur(1px) brightness(0.9);
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
+ }
+ 70% {
+ opacity: 0.9;
+ transform: translateY(-5%) scale(1.01);
+ filter: blur(0.3px) brightness(1.02);
+ box-shadow: 0 7px 28px rgba(0, 0, 0, 0.28);
+ }
+ 85% {
+ opacity: 0.98;
+ transform: translateY(1%) scale(0.995);
+ filter: blur(0.1px) brightness(1.01);
+ box-shadow: 0 8px 30px rgba(0, 0, 0, 0.31);
+ }
+ 100% {
+ opacity: 1;
+ transform: translateY(0) scale(1);
+ filter: blur(0px) brightness(1);
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
+ }
+ }
+
+ @keyframes fadeIn {
+ 0% {
+ opacity: 0;
+ }
+ 100% {
+ opacity: 1;
+ }
+ }
+
+ * {
+ font-family: 'Helvetica Neue', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
+ cursor: default;
+ user-select: none;
+ }
+
+ .header {
+ width: 100%;
+ height: 47px;
+ padding: 2px 10px 2px 13px;
+ background: transparent;
+ overflow: hidden;
+ border-radius: 9000px;
+ /* backdrop-filter: blur(1px); */
+ justify-content: space-between;
+ align-items: center;
+ display: inline-flex;
+ box-sizing: border-box;
+ position: relative;
+ }
+
+ .header::before {
+ content: '';
+ position: absolute;
+ top: 0; left: 0; right: 0; bottom: 0;
+ width: 100%;
+ height: 100%;
+ background: rgba(0, 0, 0, 0.6);
+ border-radius: 9000px;
+ z-index: -1;
+ }
+
+ .header::after {
+ content: '';
+ position: absolute;
+ top: 0; left: 0; right: 0; bottom: 0;
+ border-radius: 9000px;
+ padding: 1px;
+ background: linear-gradient(169deg, rgba(255, 255, 255, 0.17) 0%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.17) 100%);
+ -webkit-mask:
+ linear-gradient(#fff 0 0) content-box,
+ linear-gradient(#fff 0 0);
+ -webkit-mask-composite: destination-out;
+ mask-composite: exclude;
+ pointer-events: none;
+ }
+
+ .listen-button {
+ height: 26px;
+ padding: 0 13px;
+ background: transparent;
+ border-radius: 9000px;
+ justify-content: center;
+ width: 78px;
+ align-items: center;
+ gap: 6px;
+ display: flex;
+ border: none;
+ cursor: pointer;
+ position: relative;
+ }
+
+ .listen-button.active::before {
+ background: rgba(215, 0, 0, 0.5);
+ }
+
+ .listen-button.active:hover::before {
+ background: rgba(255, 20, 20, 0.6);
+ }
+
+ .listen-button:hover::before {
+ background: rgba(255, 255, 255, 0.18);
+ }
+
+ .listen-button::before {
+ content: '';
+ position: absolute;
+ top: 0; left: 0; right: 0; bottom: 0;
+ background: rgba(255, 255, 255, 0.14);
+ border-radius: 9000px;
+ z-index: -1;
+ transition: background 0.15s ease;
+ }
+
+ .listen-button::after {
+ content: '';
+ position: absolute;
+ top: 0; left: 0; right: 0; bottom: 0;
+ border-radius: 9000px;
+ padding: 1px;
+ background: linear-gradient(169deg, rgba(255, 255, 255, 0.17) 0%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.17) 100%);
+ -webkit-mask:
+ linear-gradient(#fff 0 0) content-box,
+ linear-gradient(#fff 0 0);
+ -webkit-mask-composite: destination-out;
+ mask-composite: exclude;
+ pointer-events: none;
+ }
+
+ .header-actions {
+ height: 26px;
+ box-sizing: border-box;
+ justify-content: flex-start;
+ align-items: center;
+ gap: 9px;
+ display: flex;
+ padding: 0 8px;
+ border-radius: 6px;
+ transition: background 0.15s ease;
+ }
+
+ .header-actions:hover {
+ background: rgba(255, 255, 255, 0.1);
+ }
+
+ .ask-action {
+ margin-left: 4px;
+ }
+
+ .action-button,
+ .settings-button {
+ background: transparent;
+ color: white;
+ border: none;
+ cursor: pointer;
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ }
+
+ .action-text {
+ padding-bottom: 1px;
+ justify-content: center;
+ align-items: center;
+ gap: 10px;
+ display: flex;
+ }
+
+ .action-text-content {
+ color: white;
+ font-size: 12px;
+ font-family: 'Helvetica Neue', sans-serif;
+ font-weight: 500; /* Medium */
+ word-wrap: break-word;
+ }
+
+ .icon-container {
+ justify-content: flex-start;
+ align-items: center;
+ gap: 4px;
+ display: flex;
+ }
+
+ .icon-container.ask-icons svg,
+ .icon-container.showhide-icons svg {
+ width: 12px;
+ height: 12px;
+ }
+
+ .listen-icon svg {
+ width: 12px;
+ height: 11px;
+ position: relative;
+ top: 1px;
+ }
+
+ .icon-box {
+ color: white;
+ font-size: 12px;
+ font-family: 'Helvetica Neue', sans-serif;
+ font-weight: 500;
+ background-color: rgba(255, 255, 255, 0.1);
+ border-radius: 13%;
+ width: 18px;
+ height: 18px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .settings-button {
+ padding: 5px;
+ border-radius: 50%;
+ transition: background 0.15s ease;
+ }
+
+ .settings-button:hover {
+ background: rgba(255, 255, 255, 0.1);
+ }
+
+ .settings-icon {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .settings-icon svg {
+ width: 16px;
+ height: 16px;
+ }
+ `;
+
+ constructor() {
+ super();
+ this.dragState = null;
+ this.wasJustDragged = false;
+ this.isVisible = true;
+ this.isAnimating = false;
+ this.hasSlidIn = false;
+ this.settingsHideTimer = null;
+ this.isSessionActive = false;
+
+ if (window.require) {
+ const { ipcRenderer } = window.require('electron');
+
+ ipcRenderer.on('toggle-header-visibility', () => {
+ this.toggleVisibility();
+ });
+
+ ipcRenderer.on('cancel-hide-settings', () => {
+ this.cancelHideWindow('settings');
+ });
+ }
+
+ this.handleMouseMove = this.handleMouseMove.bind(this);
+ this.handleMouseUp = this.handleMouseUp.bind(this);
+ this.handleAnimationEnd = this.handleAnimationEnd.bind(this);
+ }
+
+ async handleMouseDown(e) {
+ e.preventDefault();
+
+ const { ipcRenderer } = window.require('electron');
+ const initialPosition = await ipcRenderer.invoke('get-header-position');
+
+ this.dragState = {
+ initialMouseX: e.screenX,
+ initialMouseY: e.screenY,
+ initialWindowX: initialPosition.x,
+ initialWindowY: initialPosition.y,
+ moved: false,
+ };
+
+ window.addEventListener('mousemove', this.handleMouseMove, { capture: true });
+ window.addEventListener('mouseup', this.handleMouseUp, { once: true, capture: true });
+ }
+
+ handleMouseMove(e) {
+ if (!this.dragState) return;
+
+ const deltaX = Math.abs(e.screenX - this.dragState.initialMouseX);
+ const deltaY = Math.abs(e.screenY - this.dragState.initialMouseY);
+
+ if (deltaX > 3 || deltaY > 3) {
+ this.dragState.moved = true;
+ }
+
+ const newWindowX = this.dragState.initialWindowX + (e.screenX - this.dragState.initialMouseX);
+ const newWindowY = this.dragState.initialWindowY + (e.screenY - this.dragState.initialMouseY);
+
+ const { ipcRenderer } = window.require('electron');
+ ipcRenderer.invoke('move-header-to', newWindowX, newWindowY);
+ }
+
+ handleMouseUp(e) {
+ if (!this.dragState) return;
+
+ const wasDragged = this.dragState.moved;
+
+ window.removeEventListener('mousemove', this.handleMouseMove, { capture: true });
+ this.dragState = null;
+
+ if (wasDragged) {
+ this.wasJustDragged = true;
+ setTimeout(() => {
+ this.wasJustDragged = false;
+ }, 0);
+ }
+ }
+
+ toggleVisibility() {
+ if (this.isAnimating) return;
+
+ this.isAnimating = true;
+
+ if (this.isVisible) {
+ this.hide();
+ } else {
+ this.show();
+ }
+ }
+
+ hide() {
+ this.classList.remove('showing', 'hidden');
+ this.classList.add('hiding');
+ this.isVisible = false;
+ }
+
+ show() {
+ this.classList.remove('hiding', 'hidden');
+ this.classList.add('showing');
+ this.isVisible = true;
+ }
+
+ handleAnimationEnd(e) {
+ if (e.target !== this) return;
+
+ this.isAnimating = false;
+
+ if (this.classList.contains('hiding')) {
+ this.classList.remove('hiding');
+ this.classList.add('hidden');
+
+ if (window.require) {
+ const { ipcRenderer } = window.require('electron');
+ ipcRenderer.send('header-animation-complete', 'hidden');
+ }
+ } else if (this.classList.contains('showing')) {
+ this.classList.remove('showing');
+
+ if (window.require) {
+ const { ipcRenderer } = window.require('electron');
+ ipcRenderer.send('header-animation-complete', 'visible');
+ }
+ } else if (this.classList.contains('sliding-in')) {
+ this.classList.remove('sliding-in');
+ this.hasSlidIn = true;
+ console.log('AppHeader slide-in animation completed');
+ }
+ }
+
+ startSlideInAnimation() {
+ if (this.hasSlidIn) return;
+ this.classList.add('sliding-in');
+ }
+
+ connectedCallback() {
+ super.connectedCallback();
+ this.addEventListener('animationend', this.handleAnimationEnd);
+
+ if (window.require) {
+ const { ipcRenderer } = window.require('electron');
+ this._sessionStateListener = (event, { isActive }) => {
+ this.isSessionActive = isActive;
+ };
+ ipcRenderer.on('session-state-changed', this._sessionStateListener);
+ }
+ }
+
+ disconnectedCallback() {
+ super.disconnectedCallback();
+ this.removeEventListener('animationend', this.handleAnimationEnd);
+
+ if (window.require) {
+ const { ipcRenderer } = window.require('electron');
+ ipcRenderer.removeAllListeners('toggle-header-visibility');
+ ipcRenderer.removeAllListeners('cancel-hide-settings');
+ if (this._sessionStateListener) {
+ ipcRenderer.removeListener('session-state-changed', this._sessionStateListener);
+ }
+ }
+ }
+
+ invoke(channel, ...args) {
+ if (this.wasJustDragged) {
+ return;
+ }
+ if (window.require) {
+ window.require('electron').ipcRenderer.invoke(channel, ...args);
+ }
+ }
+
+ showWindow(name, element) {
+ if (this.wasJustDragged) return;
+ if (window.require) {
+ const { ipcRenderer } = window.require('electron');
+ console.log(`[AppHeader] showWindow('${name}') called at ${Date.now()}`);
+
+ ipcRenderer.send('cancel-hide-window', name);
+
+ if (name === 'settings' && element) {
+ const rect = element.getBoundingClientRect();
+ ipcRenderer.send('show-window', {
+ name: 'settings',
+ bounds: {
+ x: rect.left,
+ y: rect.top,
+ width: rect.width,
+ height: rect.height
+ }
+ });
+ } else {
+ ipcRenderer.send('show-window', name);
+ }
+ }
+ }
+
+ hideWindow(name) {
+ if (this.wasJustDragged) return;
+ if (window.require) {
+ console.log(`[AppHeader] hideWindow('${name}') called at ${Date.now()}`);
+ window.require('electron').ipcRenderer.send('hide-window', name);
+ }
+ }
+
+ cancelHideWindow(name) {
+
+ }
+
+ render() {
+ return html`
+
+ `;
+ }
+}
+
+customElements.define('app-header', AppHeader);
diff --git a/src/app/HeaderController.js b/src/app/HeaderController.js
new file mode 100644
index 0000000..ee02b6c
--- /dev/null
+++ b/src/app/HeaderController.js
@@ -0,0 +1,273 @@
+import { initializeApp } from 'firebase/app';
+import { getAuth, onAuthStateChanged, GoogleAuthProvider, signInWithCredential, signInWithCustomToken, signOut } from 'firebase/auth';
+
+import './AppHeader.js';
+import './ApiKeyHeader.js';
+
+const firebaseConfig = {
+ apiKey: 'AIzaSyAgtJrmsFWG1C7m9S55HyT1laICEzuUS2g',
+ authDomain: 'pickle-3651a.firebaseapp.com',
+ projectId: 'pickle-3651a',
+ storageBucket: 'pickle-3651a.firebasestorage.app',
+ messagingSenderId: '904706892885',
+ appId: '1:904706892885:web:0e42b3dda796674ead20dc',
+ measurementId: 'G-SQ0WM6S28T',
+};
+
+const firebaseApp = initializeApp(firebaseConfig);
+const auth = getAuth(firebaseApp);
+
+class HeaderTransitionManager {
+ constructor() {
+
+ this.headerContainer = document.getElementById('header-container');
+ this.currentHeaderType = null; // 'apikey' | 'app'
+ this.apiKeyHeader = null;
+ this.appHeader = null;
+
+ /**
+ * only one header window is allowed
+ * @param {'apikey'|'app'} type
+ */
+ this.ensureHeader = (type) => {
+ if (this.currentHeaderType === type) return;
+
+ if (this.apiKeyHeader) { this.apiKeyHeader.remove(); this.apiKeyHeader = null; }
+ if (this.appHeader) { this.appHeader.remove(); this.appHeader = null; }
+
+ if (type === 'apikey') {
+ this.apiKeyHeader = document.createElement('apikey-header');
+ this.headerContainer.appendChild(this.apiKeyHeader);
+ } else {
+ this.appHeader = document.createElement('app-header');
+ this.headerContainer.appendChild(this.appHeader);
+ this.appHeader.startSlideInAnimation?.();
+ }
+
+ this.currentHeaderType = type;
+ this.notifyHeaderState(type);
+ };
+
+ console.log('[HeaderController] Manager initialized');
+
+ if (window.require) {
+ const { ipcRenderer } = window.require('electron');
+ ipcRenderer
+ .invoke('get-current-api-key')
+ .then(storedKey => {
+ this.hasApiKey = !!storedKey;
+ })
+ .catch(() => {});
+ }
+
+ if (window.require) {
+ const { ipcRenderer } = window.require('electron');
+
+ ipcRenderer.on('login-successful', async (event, payload) => {
+ const { customToken, token, error } = payload || {};
+ try {
+ if (customToken) {
+ console.log('[HeaderController] Received custom token, signing in with custom token...');
+ await signInWithCustomToken(auth, customToken);
+ return;
+ }
+
+ if (token) {
+ console.log('[HeaderController] Received ID token, attempting Google credential sign-in...');
+ const credential = GoogleAuthProvider.credential(token);
+ await signInWithCredential(auth, credential);
+ return;
+ }
+
+ if (error) {
+ console.warn('[HeaderController] Login payload indicates verification failure. Proceeding to AppHeader UI only.');
+ this.transitionToAppHeader();
+ }
+ } catch (error) {
+ console.error('[HeaderController] Sign-in failed', error);
+ this.transitionToAppHeader();
+ }
+ });
+
+
+ ipcRenderer.on('request-firebase-logout', async () => {
+ console.log('[HeaderController] Received request to sign out.');
+ try {
+ await signOut(auth);
+ } catch (error) {
+ console.error('[HeaderController] Sign out failed', error);
+ }
+ });
+
+ ipcRenderer.on('api-key-validated', () => {
+ this.hasApiKey = true;
+ this.transitionToAppHeader();
+ });
+
+ ipcRenderer.on('api-key-removed', () => {
+ this.hasApiKey = false;
+ this.transitionToApiKeyHeader();
+ });
+
+ ipcRenderer.on('api-key-updated', () => {
+ this.hasApiKey = true;
+ if (!auth.currentUser) {
+ this.transitionToAppHeader();
+ }
+ });
+
+ ipcRenderer.on('firebase-auth-success', async (event, firebaseUser) => {
+ console.log('[HeaderController] Received firebase-auth-success:', firebaseUser.uid);
+ try {
+ if (firebaseUser.idToken) {
+ const credential = GoogleAuthProvider.credential(firebaseUser.idToken);
+ await signInWithCredential(auth, credential);
+ console.log('[HeaderController] Firebase sign-in successful via ID token');
+ } else {
+ console.warn('[HeaderController] No ID token received from deeplink, virtual key request may fail');
+ this.transitionToAppHeader();
+ }
+ } catch (error) {
+ console.error('[HeaderController] Firebase auth failed:', error);
+ this.transitionToAppHeader();
+ }
+ });
+ }
+
+ this._bootstrap();
+
+ onAuthStateChanged(auth, async user => {
+ console.log('[HeaderController] Auth state changed. User:', user ? user.email : 'null');
+
+ if (window.require) {
+ const { ipcRenderer } = window.require('electron');
+
+ let userDataWithToken = null;
+ if (user) {
+ try {
+ const idToken = await user.getIdToken();
+ userDataWithToken = {
+ uid: user.uid,
+ email: user.email,
+ name: user.displayName,
+ photoURL: user.photoURL,
+ idToken: idToken,
+ };
+ } catch (error) {
+ console.error('[HeaderController] Failed to get ID token:', error);
+ userDataWithToken = {
+ uid: user.uid,
+ email: user.email,
+ name: user.displayName,
+ photoURL: user.photoURL,
+ idToken: null,
+ };
+ }
+ }
+
+ ipcRenderer.invoke('firebase-auth-state-changed', userDataWithToken).catch(console.error);
+ }
+
+ if (!this.isInitialized) {
+ this.isInitialized = true;
+ }
+
+ if (user) {
+ console.log('[HeaderController] User is logged in, transitioning to AppHeader');
+ this.transitionToAppHeader(!this.hasApiKey);
+ } else if (this.hasApiKey) {
+ console.log('[HeaderController] No Firebase user but API key exists, showing AppHeader');
+ this.transitionToAppHeader(false);
+ } else {
+ console.log('[HeaderController] No auth & no API key β showing ApiKeyHeader');
+ this.transitionToApiKeyHeader();
+ }
+ });
+ }
+
+
+ notifyHeaderState(stateOverride) {
+ const state = stateOverride || this.currentHeaderType || 'apikey';
+ if (window.require) {
+ window.require('electron').ipcRenderer.send('header-state-changed', state);
+ }
+ }
+
+ async _bootstrap() {
+ let storedKey = null;
+ if (window.require) {
+ try {
+ storedKey = await window
+ .require('electron')
+ .ipcRenderer.invoke('get-current-api-key');
+ } catch (_) {}
+ }
+ this.hasApiKey = !!storedKey;
+
+ const user = await new Promise(resolve => {
+ const unsubscribe = onAuthStateChanged(auth, u => {
+ unsubscribe();
+ resolve(u);
+ });
+ });
+
+ if (user || this.hasApiKey) {
+ await this._resizeForApp();
+ this.ensureHeader('app');
+ } else {
+ await this._resizeForApiKey();
+ this.ensureHeader('apikey');
+ }
+ }
+
+
+ async transitionToAppHeader(animate = true) {
+ if (this.currentHeaderType === 'app') {
+ return this._resizeForApp();
+ }
+
+ const canAnimate =
+ animate &&
+ this.apiKeyHeader &&
+ !this.apiKeyHeader.classList.contains('hidden') &&
+ typeof this.apiKeyHeader.startSlideOutAnimation === 'function';
+
+ if (canAnimate) {
+ const old = this.apiKeyHeader;
+ const onEnd = () => {
+ clearTimeout(fallback);
+ this._resizeForApp().then(() => this.ensureHeader('app'));
+ };
+ old.addEventListener('animationend', onEnd, { once: true });
+ old.startSlideOutAnimation();
+
+ const fallback = setTimeout(onEnd, 450);
+ } else {
+ this.ensureHeader('app');
+ this._resizeForApp();
+ }
+ }
+
+ _resizeForApp() {
+ if (!window.require) return;
+ return window
+ .require('electron')
+ .ipcRenderer.invoke('resize-header-window', { width: 353, height: 60 })
+ .catch(() => {});
+ }
+
+ async transitionToApiKeyHeader() {
+ await window.require('electron')
+ .ipcRenderer.invoke('resize-header-window', { width: 285, height: 220 });
+
+ if (this.currentHeaderType !== 'apikey') {
+ this.ensureHeader('apikey');
+ }
+
+ if (this.apiKeyHeader) this.apiKeyHeader.reset();
+ }
+}
+
+window.addEventListener('DOMContentLoaded', () => {
+ new HeaderTransitionManager();
+});
diff --git a/src/app/PickleGlassApp.js b/src/app/PickleGlassApp.js
new file mode 100644
index 0000000..8ce44d6
--- /dev/null
+++ b/src/app/PickleGlassApp.js
@@ -0,0 +1,285 @@
+import { html, css, LitElement } from '../assets/lit-core-2.7.4.min.js';
+import { CustomizeView } from '../features/customize/CustomizeView.js';
+import { AssistantView } from '../features/listen/AssistantView.js';
+import { OnboardingView } from '../features/onboarding/OnboardingView.js';
+import { AskView } from '../features/ask/AskView.js';
+
+import '../features/listen/renderer.js';
+
+export class PickleGlassApp extends LitElement {
+ static styles = css`
+ :host {
+ display: block;
+ width: 100%;
+ color: var(--text-color);
+ background: transparent;
+ border-radius: 7px;
+ }
+
+ assistant-view {
+ display: block;
+ width: 100%;
+ }
+
+ ask-view, customize-view, history-view, help-view, onboarding-view, setup-view {
+ display: block;
+ width: 100%;
+ }
+
+ `;
+
+ static properties = {
+ currentView: { type: String },
+ statusText: { type: String },
+ startTime: { type: Number },
+ currentResponseIndex: { type: Number },
+ isMainViewVisible: { type: Boolean },
+ selectedProfile: { type: String },
+ selectedLanguage: { type: String },
+ selectedScreenshotInterval: { type: String },
+ selectedImageQuality: { type: String },
+ isClickThrough: { type: Boolean, state: true },
+ layoutMode: { type: String },
+ _viewInstances: { type: Object, state: true },
+ _isClickThrough: { state: true },
+ structuredData: { type: Object },
+ };
+
+ constructor() {
+ super();
+ const urlParams = new URLSearchParams(window.location.search);
+ this.currentView = urlParams.get('view') || 'listen';
+ this.currentResponseIndex = -1;
+ this.selectedProfile = localStorage.getItem('selectedProfile') || 'interview';
+ this.selectedLanguage = localStorage.getItem('selectedLanguage') || 'en-US';
+ this.selectedScreenshotInterval = localStorage.getItem('selectedScreenshotInterval') || '5';
+ this.selectedImageQuality = localStorage.getItem('selectedImageQuality') || 'medium';
+ this._isClickThrough = false;
+ this.outlines = [];
+ this.analysisRequests = [];
+
+ window.pickleGlass.setStructuredData = data => {
+ this.updateStructuredData(data);
+ };
+ }
+
+ connectedCallback() {
+ super.connectedCallback();
+
+ if (window.require) {
+ const { ipcRenderer } = window.require('electron');
+
+ ipcRenderer.on('update-status', (_, status) => this.setStatus(status));
+ ipcRenderer.on('click-through-toggled', (_, isEnabled) => {
+ this._isClickThrough = isEnabled;
+ });
+ ipcRenderer.on('show-view', (_, view) => {
+ this.currentView = view;
+ this.isMainViewVisible = true;
+ });
+ ipcRenderer.on('start-listening-session', () => {
+ console.log('Received start-listening-session command, calling handleListenClick.');
+ this.handleListenClick();
+ });
+ }
+ }
+
+ disconnectedCallback() {
+ super.disconnectedCallback();
+ if (window.require) {
+ const { ipcRenderer } = window.require('electron');
+ ipcRenderer.removeAllListeners('update-status');
+ ipcRenderer.removeAllListeners('click-through-toggled');
+ ipcRenderer.removeAllListeners('show-view');
+ ipcRenderer.removeAllListeners('start-listening-session');
+ }
+ }
+
+ updated(changedProperties) {
+ if (changedProperties.has('isMainViewVisible') || changedProperties.has('currentView')) {
+ this.requestWindowResize();
+ }
+
+ if (changedProperties.has('currentView') && window.require) {
+ const { ipcRenderer } = window.require('electron');
+ ipcRenderer.send('view-changed', this.currentView);
+
+ const viewContainer = this.shadowRoot?.querySelector('.view-container');
+ if (viewContainer) {
+ viewContainer.classList.add('entering');
+ requestAnimationFrame(() => {
+ viewContainer.classList.remove('entering');
+ });
+ }
+ }
+
+ // Only update localStorage when these specific properties change
+ if (changedProperties.has('selectedProfile')) {
+ localStorage.setItem('selectedProfile', this.selectedProfile);
+ }
+ if (changedProperties.has('selectedLanguage')) {
+ localStorage.setItem('selectedLanguage', this.selectedLanguage);
+ }
+ if (changedProperties.has('selectedScreenshotInterval')) {
+ localStorage.setItem('selectedScreenshotInterval', this.selectedScreenshotInterval);
+ }
+ if (changedProperties.has('selectedImageQuality')) {
+ localStorage.setItem('selectedImageQuality', this.selectedImageQuality);
+ }
+ if (changedProperties.has('layoutMode')) {
+ this.updateLayoutMode();
+ }
+ }
+
+ requestWindowResize() {
+ if (window.require) {
+ const { ipcRenderer } = window.require('electron');
+ ipcRenderer.invoke('resize-window', {
+ isMainViewVisible: this.isMainViewVisible,
+ view: this.currentView,
+ });
+ }
+ }
+
+ setStatus(text) {
+ this.statusText = text;
+ }
+
+ async handleListenClick() {
+ if (window.require) {
+ const { ipcRenderer } = window.require('electron');
+ const isActive = await ipcRenderer.invoke('is-session-active');
+ if (isActive) {
+ console.log('Session is already active. No action needed.');
+ return;
+ }
+ }
+
+ if (window.pickleGlass) {
+ await window.pickleGlass.initializeopenai(this.selectedProfile, this.selectedLanguage);
+ window.pickleGlass.startCapture(this.selectedScreenshotInterval, this.selectedImageQuality);
+ }
+
+ // π Clear previous summary/analysis when a new listening session begins
+ this.structuredData = {
+ summary: [],
+ topic: { header: '', bullets: [] },
+ actions: [],
+ followUps: [],
+ };
+
+ this.currentResponseIndex = -1;
+ this.startTime = Date.now();
+ this.currentView = 'listen';
+ this.isMainViewVisible = true;
+ }
+
+ handleShowHideClick() {
+ this.isMainViewVisible = !this.isMainViewVisible;
+ }
+
+ handleCustomizeClick() {
+ this.currentView = 'customize';
+ this.isMainViewVisible = true;
+ }
+
+ handleHelpClick() {
+ this.currentView = 'help';
+ this.isMainViewVisible = true;
+ }
+
+ handleHistoryClick() {
+ this.currentView = 'history';
+ this.isMainViewVisible = true;
+ }
+
+ async handleClose() {
+ if (window.require) {
+ const { ipcRenderer } = window.require('electron');
+ await ipcRenderer.invoke('quit-application');
+ }
+ }
+
+ handleBackClick() {
+ this.currentView = 'listen';
+ }
+
+ async handleSendText(message) {
+ if (window.pickleGlass) {
+ const result = await window.pickleGlass.sendTextMessage(message);
+
+ if (!result.success) {
+ console.error('Failed to send message:', result.error);
+ this.setStatus('Error sending message: ' + result.error);
+ } else {
+ this.setStatus('Message sent...');
+ }
+ }
+ }
+
+ // updateOutline(outline) {
+ // console.log('π PickleGlassApp updateOutline:', outline);
+ // this.outlines = [...outline];
+ // this.requestUpdate();
+ // }
+
+ // updateAnalysisRequests(requests) {
+ // console.log('π PickleGlassApp updateAnalysisRequests:', requests);
+ // this.analysisRequests = [...requests];
+ // this.requestUpdate();
+ // }
+
+ updateStructuredData(data) {
+ console.log('π PickleGlassApp updateStructuredData:', data);
+ this.structuredData = data;
+ this.requestUpdate();
+
+ const assistantView = this.shadowRoot?.querySelector('assistant-view');
+ if (assistantView) {
+ assistantView.structuredData = data;
+ console.log('β
Structured data passed to AssistantView');
+ }
+ }
+
+ handleResponseIndexChanged(e) {
+ this.currentResponseIndex = e.detail.index;
+ }
+
+ handleOnboardingComplete() {
+ this.currentView = 'main';
+ }
+
+ render() {
+ switch (this.currentView) {
+ case 'listen':
+ return html` this.handleSendText(message)}
+ @response-index-changed=${e => (this.currentResponseIndex = e.detail.index)}
+ > `;
+ case 'ask':
+ return html` `;
+ case 'customize':
+ return html` (this.selectedProfile = profile)}
+ .onLanguageChange=${lang => (this.selectedLanguage = lang)}
+ > `;
+ case 'history':
+ return html` `;
+ case 'help':
+ return html` `;
+ case 'onboarding':
+ return html` `;
+ case 'setup':
+ return html` `;
+ default:
+ return html`Unknown view: ${this.currentView}
`;
+ }
+ }
+}
+
+customElements.define('pickle-glass-app', PickleGlassApp);
diff --git a/src/app/content.html b/src/app/content.html
new file mode 100644
index 0000000..48c7691
--- /dev/null
+++ b/src/app/content.html
@@ -0,0 +1,316 @@
+
+
+
+
+ Pickle Glass Content
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/header.html b/src/app/header.html
new file mode 100644
index 0000000..2f35e05
--- /dev/null
+++ b/src/app/header.html
@@ -0,0 +1,24 @@
+
+
+
+
+ Pickle Glass Header
+
+
+
+
+
+
+
+
diff --git a/src/assets/Listen.svg b/src/assets/Listen.svg
new file mode 100644
index 0000000..33ac43b
--- /dev/null
+++ b/src/assets/Listen.svg
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/src/assets/SystemAudioDump b/src/assets/SystemAudioDump
new file mode 100755
index 0000000..7f5e54f
Binary files /dev/null and b/src/assets/SystemAudioDump differ
diff --git a/src/assets/Vector.svg b/src/assets/Vector.svg
new file mode 100644
index 0000000..3cd2ae5
--- /dev/null
+++ b/src/assets/Vector.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/assets/command.svg b/src/assets/command.svg
new file mode 100644
index 0000000..8603de2
--- /dev/null
+++ b/src/assets/command.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/assets/dompurify-3.0.7.min.js b/src/assets/dompurify-3.0.7.min.js
new file mode 100644
index 0000000..b096892
--- /dev/null
+++ b/src/assets/dompurify-3.0.7.min.js
@@ -0,0 +1,3 @@
+/*! @license DOMPurify 3.0.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.7/LICENSE */
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DOMPurify=t()}(this,(function(){"use strict";const{entries:e,setPrototypeOf:t,isFrozen:n,getPrototypeOf:o,getOwnPropertyDescriptor:r}=Object;let{freeze:i,seal:a,create:l}=Object,{apply:c,construct:s}="undefined"!=typeof Reflect&&Reflect;i||(i=function(e){return e}),a||(a=function(e){return e}),c||(c=function(e,t,n){return e.apply(t,n)}),s||(s=function(e,t){return new e(...t)});const u=b(Array.prototype.forEach),m=b(Array.prototype.pop),f=b(Array.prototype.push),p=b(String.prototype.toLowerCase),d=b(String.prototype.toString),h=b(String.prototype.match),g=b(String.prototype.replace),T=b(String.prototype.indexOf),y=b(String.prototype.trim),E=b(RegExp.prototype.test),A=(_=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n1?n-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:p;t&&t(e,null);let i=o.length;for(;i--;){let t=o[i];if("string"==typeof t){const e=r(t);e!==t&&(n(o)||(o[i]=e),t=e)}e[t]=!0}return e}function S(e){for(let t=0;t/gm),z=a(/\${[\w\W]*}/gm),B=a(/^data-[\-\w.\u00B7-\uFFFF]/),W=a(/^aria-[\-\w]+$/),G=a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Y=a(/^(?:\w+script|data):/i),j=a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),q=a(/^html$/i);var X=Object.freeze({__proto__:null,MUSTACHE_EXPR:F,ERB_EXPR:H,TMPLIT_EXPR:z,DATA_ATTR:B,ARIA_ATTR:W,IS_ALLOWED_URI:G,IS_SCRIPT_OR_DATA:Y,ATTR_WHITESPACE:j,DOCTYPE_NAME:q});const K=function(){return"undefined"==typeof window?null:window},V=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}};var $=function t(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:K();const o=e=>t(e);if(o.version="3.0.7",o.removed=[],!n||!n.document||9!==n.document.nodeType)return o.isSupported=!1,o;let{document:r}=n;const a=r,c=a.currentScript,{DocumentFragment:s,HTMLTemplateElement:_,Node:b,Element:S,NodeFilter:F,NamedNodeMap:H=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:z,DOMParser:B,trustedTypes:W}=n,Y=S.prototype,j=w(Y,"cloneNode"),$=w(Y,"nextSibling"),Z=w(Y,"childNodes"),J=w(Y,"parentNode");if("function"==typeof _){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let Q,ee="";const{implementation:te,createNodeIterator:ne,createDocumentFragment:oe,getElementsByTagName:re}=r,{importNode:ie}=a;let ae={};o.isSupported="function"==typeof e&&"function"==typeof J&&te&&void 0!==te.createHTMLDocument;const{MUSTACHE_EXPR:le,ERB_EXPR:ce,TMPLIT_EXPR:se,DATA_ATTR:ue,ARIA_ATTR:me,IS_SCRIPT_OR_DATA:fe,ATTR_WHITESPACE:pe}=X;let{IS_ALLOWED_URI:de}=X,he=null;const ge=N({},[...D,...L,...v,...k,...O]);let Te=null;const ye=N({},[...I,...M,...U,...P]);let Ee=Object.seal(l(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,_e=null,be=!0,Ne=!0,Se=!1,Re=!0,we=!1,De=!1,Le=!1,ve=!1,xe=!1,ke=!1,Ce=!1,Oe=!0,Ie=!1;const Me="user-content-";let Ue=!0,Pe=!1,Fe={},He=null;const ze=N({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Be=null;const We=N({},["audio","video","img","source","image","track"]);let Ge=null;const Ye=N({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),je="http://www.w3.org/1998/Math/MathML",qe="http://www.w3.org/2000/svg",Xe="http://www.w3.org/1999/xhtml";let Ke=Xe,Ve=!1,$e=null;const Ze=N({},[je,qe,Xe],d);let Je=null;const Qe=["application/xhtml+xml","text/html"],et="text/html";let tt=null,nt=null;const ot=r.createElement("form"),rt=function(e){return e instanceof RegExp||e instanceof Function},it=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!nt||nt!==e){if(e&&"object"==typeof e||(e={}),e=R(e),Je=-1===Qe.indexOf(e.PARSER_MEDIA_TYPE)?et:e.PARSER_MEDIA_TYPE,tt="application/xhtml+xml"===Je?d:p,he="ALLOWED_TAGS"in e?N({},e.ALLOWED_TAGS,tt):ge,Te="ALLOWED_ATTR"in e?N({},e.ALLOWED_ATTR,tt):ye,$e="ALLOWED_NAMESPACES"in e?N({},e.ALLOWED_NAMESPACES,d):Ze,Ge="ADD_URI_SAFE_ATTR"in e?N(R(Ye),e.ADD_URI_SAFE_ATTR,tt):Ye,Be="ADD_DATA_URI_TAGS"in e?N(R(We),e.ADD_DATA_URI_TAGS,tt):We,He="FORBID_CONTENTS"in e?N({},e.FORBID_CONTENTS,tt):ze,Ae="FORBID_TAGS"in e?N({},e.FORBID_TAGS,tt):{},_e="FORBID_ATTR"in e?N({},e.FORBID_ATTR,tt):{},Fe="USE_PROFILES"in e&&e.USE_PROFILES,be=!1!==e.ALLOW_ARIA_ATTR,Ne=!1!==e.ALLOW_DATA_ATTR,Se=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Re=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,we=e.SAFE_FOR_TEMPLATES||!1,De=e.WHOLE_DOCUMENT||!1,xe=e.RETURN_DOM||!1,ke=e.RETURN_DOM_FRAGMENT||!1,Ce=e.RETURN_TRUSTED_TYPE||!1,ve=e.FORCE_BODY||!1,Oe=!1!==e.SANITIZE_DOM,Ie=e.SANITIZE_NAMED_PROPS||!1,Ue=!1!==e.KEEP_CONTENT,Pe=e.IN_PLACE||!1,de=e.ALLOWED_URI_REGEXP||G,Ke=e.NAMESPACE||Xe,Ee=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&rt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ee.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&rt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ee.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Ee.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),we&&(Ne=!1),ke&&(xe=!0),Fe&&(he=N({},O),Te=[],!0===Fe.html&&(N(he,D),N(Te,I)),!0===Fe.svg&&(N(he,L),N(Te,M),N(Te,P)),!0===Fe.svgFilters&&(N(he,v),N(Te,M),N(Te,P)),!0===Fe.mathMl&&(N(he,k),N(Te,U),N(Te,P))),e.ADD_TAGS&&(he===ge&&(he=R(he)),N(he,e.ADD_TAGS,tt)),e.ADD_ATTR&&(Te===ye&&(Te=R(Te)),N(Te,e.ADD_ATTR,tt)),e.ADD_URI_SAFE_ATTR&&N(Ge,e.ADD_URI_SAFE_ATTR,tt),e.FORBID_CONTENTS&&(He===ze&&(He=R(He)),N(He,e.FORBID_CONTENTS,tt)),Ue&&(he["#text"]=!0),De&&N(he,["html","head","body"]),he.table&&(N(he,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw A('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw A('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');Q=e.TRUSTED_TYPES_POLICY,ee=Q.createHTML("")}else void 0===Q&&(Q=V(W,c)),null!==Q&&"string"==typeof ee&&(ee=Q.createHTML(""));i&&i(e),nt=e}},at=N({},["mi","mo","mn","ms","mtext"]),lt=N({},["foreignobject","desc","title","annotation-xml"]),ct=N({},["title","style","font","a","script"]),st=N({},[...L,...v,...x]),ut=N({},[...k,...C]),mt=function(e){let t=J(e);t&&t.tagName||(t={namespaceURI:Ke,tagName:"template"});const n=p(e.tagName),o=p(t.tagName);return!!$e[e.namespaceURI]&&(e.namespaceURI===qe?t.namespaceURI===Xe?"svg"===n:t.namespaceURI===je?"svg"===n&&("annotation-xml"===o||at[o]):Boolean(st[n]):e.namespaceURI===je?t.namespaceURI===Xe?"math"===n:t.namespaceURI===qe?"math"===n&<[o]:Boolean(ut[n]):e.namespaceURI===Xe?!(t.namespaceURI===qe&&!lt[o])&&(!(t.namespaceURI===je&&!at[o])&&(!ut[n]&&(ct[n]||!st[n]))):!("application/xhtml+xml"!==Je||!$e[e.namespaceURI]))},ft=function(e){f(o.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},pt=function(e,t){try{f(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){f(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Te[e])if(xe||ke)try{ft(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},dt=function(e){let t=null,n=null;if(ve)e=" "+e;else{const t=h(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Je&&Ke===Xe&&(e=''+e+"");const o=Q?Q.createHTML(e):e;if(Ke===Xe)try{t=(new B).parseFromString(o,Je)}catch(e){}if(!t||!t.documentElement){t=te.createDocument(Ke,"template",null);try{t.documentElement.innerHTML=Ve?ee:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),Ke===Xe?re.call(t,De?"html":"body")[0]:De?t.documentElement:i},ht=function(e){return ne.call(e.ownerDocument||e,e,F.SHOW_ELEMENT|F.SHOW_COMMENT|F.SHOW_TEXT,null)},gt=function(e){return e instanceof z&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof H)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Tt=function(e){return"function"==typeof b&&e instanceof b},yt=function(e,t,n){ae[e]&&u(ae[e],(e=>{e.call(o,t,n,nt)}))},Et=function(e){let t=null;if(yt("beforeSanitizeElements",e,null),gt(e))return ft(e),!0;const n=tt(e.nodeName);if(yt("uponSanitizeElement",e,{tagName:n,allowedTags:he}),e.hasChildNodes()&&!Tt(e.firstElementChild)&&E(/<[/\w]/g,e.innerHTML)&&E(/<[/\w]/g,e.textContent))return ft(e),!0;if(!he[n]||Ae[n]){if(!Ae[n]&&_t(n)){if(Ee.tagNameCheck instanceof RegExp&&E(Ee.tagNameCheck,n))return!1;if(Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(n))return!1}if(Ue&&!He[n]){const t=J(e)||e.parentNode,n=Z(e)||e.childNodes;if(n&&t){for(let o=n.length-1;o>=0;--o)t.insertBefore(j(n[o],!0),$(e))}}return ft(e),!0}return e instanceof S&&!mt(e)?(ft(e),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!E(/<\/no(script|embed|frames)/i,e.innerHTML)?(we&&3===e.nodeType&&(t=e.textContent,u([le,ce,se],(e=>{t=g(t,e," ")})),e.textContent!==t&&(f(o.removed,{element:e.cloneNode()}),e.textContent=t)),yt("afterSanitizeElements",e,null),!1):(ft(e),!0)},At=function(e,t,n){if(Oe&&("id"===t||"name"===t)&&(n in r||n in ot))return!1;if(Ne&&!_e[t]&&E(ue,t));else if(be&&E(me,t));else if(!Te[t]||_e[t]){if(!(_t(e)&&(Ee.tagNameCheck instanceof RegExp&&E(Ee.tagNameCheck,e)||Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(e))&&(Ee.attributeNameCheck instanceof RegExp&&E(Ee.attributeNameCheck,t)||Ee.attributeNameCheck instanceof Function&&Ee.attributeNameCheck(t))||"is"===t&&Ee.allowCustomizedBuiltInElements&&(Ee.tagNameCheck instanceof RegExp&&E(Ee.tagNameCheck,n)||Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(n))))return!1}else if(Ge[t]);else if(E(de,g(n,pe,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==T(n,"data:")||!Be[e]){if(Se&&!E(fe,g(n,pe,"")));else if(n)return!1}else;return!0},_t=function(e){return e.indexOf("-")>0},bt=function(e){yt("beforeSanitizeAttributes",e,null);const{attributes:t}=e;if(!t)return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Te};let r=t.length;for(;r--;){const i=t[r],{name:a,namespaceURI:l,value:c}=i,s=tt(a);let f="value"===a?c:y(c);if(n.attrName=s,n.attrValue=f,n.keepAttr=!0,n.forceKeepAttr=void 0,yt("uponSanitizeAttribute",e,n),f=n.attrValue,n.forceKeepAttr)continue;if(pt(a,e),!n.keepAttr)continue;if(!Re&&E(/\/>/i,f)){pt(a,e);continue}we&&u([le,ce,se],(e=>{f=g(f,e," ")}));const p=tt(e.nodeName);if(At(p,s,f)){if(!Ie||"id"!==s&&"name"!==s||(pt(a,e),f=Me+f),Q&&"object"==typeof W&&"function"==typeof W.getAttributeType)if(l);else switch(W.getAttributeType(p,s)){case"TrustedHTML":f=Q.createHTML(f);break;case"TrustedScriptURL":f=Q.createScriptURL(f)}try{l?e.setAttributeNS(l,a,f):e.setAttribute(a,f),m(o.removed)}catch(e){}}}yt("afterSanitizeAttributes",e,null)},Nt=function e(t){let n=null;const o=ht(t);for(yt("beforeSanitizeShadowDOM",t,null);n=o.nextNode();)yt("uponSanitizeShadowNode",n,null),Et(n)||(n.content instanceof s&&e(n.content),bt(n));yt("afterSanitizeShadowDOM",t,null)};return o.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=null,i=null,l=null;if(Ve=!e,Ve&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Tt(e)){if("function"!=typeof e.toString)throw A("toString is not a function");if("string"!=typeof(e=e.toString()))throw A("dirty is not a string, aborting")}if(!o.isSupported)return e;if(Le||it(t),o.removed=[],"string"==typeof e&&(Pe=!1),Pe){if(e.nodeName){const t=tt(e.nodeName);if(!he[t]||Ae[t])throw A("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof b)n=dt("\x3c!----\x3e"),r=n.ownerDocument.importNode(e,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?n=r:n.appendChild(r);else{if(!xe&&!we&&!De&&-1===e.indexOf("<"))return Q&&Ce?Q.createHTML(e):e;if(n=dt(e),!n)return xe?null:Ce?ee:""}n&&ve&&ft(n.firstChild);const c=ht(Pe?e:n);for(;i=c.nextNode();)Et(i)||(i.content instanceof s&&Nt(i.content),bt(i));if(Pe)return e;if(xe){if(ke)for(l=oe.call(n.ownerDocument);n.firstChild;)l.appendChild(n.firstChild);else l=n;return(Te.shadowroot||Te.shadowrootmode)&&(l=ie.call(a,l,!0)),l}let m=De?n.outerHTML:n.innerHTML;return De&&he["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&E(q,n.ownerDocument.doctype.name)&&(m="\n"+m),we&&u([le,ce,se],(e=>{m=g(m,e," ")})),Q&&Ce?Q.createHTML(m):m},o.setConfig=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};it(e),Le=!0},o.clearConfig=function(){nt=null,Le=!1},o.isValidAttribute=function(e,t,n){nt||it({});const o=tt(e),r=tt(t);return At(o,r,n)},o.addHook=function(e,t){"function"==typeof t&&(ae[e]=ae[e]||[],f(ae[e],t))},o.removeHook=function(e){if(ae[e])return m(ae[e])},o.removeHooks=function(e){ae[e]&&(ae[e]=[])},o.removeAllHooks=function(){ae={}},o}();return $}));
+//# sourceMappingURL=purify.min.js.map
diff --git a/src/assets/enter.svg b/src/assets/enter.svg
new file mode 100644
index 0000000..562405f
--- /dev/null
+++ b/src/assets/enter.svg
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/src/assets/highlight-11.9.0.min.js b/src/assets/highlight-11.9.0.min.js
new file mode 100644
index 0000000..5d699ae
--- /dev/null
+++ b/src/assets/highlight-11.9.0.min.js
@@ -0,0 +1,1213 @@
+/*!
+ Highlight.js v11.9.0 (git: f47103d4f1)
+ (c) 2006-2023 undefined and other contributors
+ License: BSD-3-Clause
+ */
+var hljs=function(){"use strict";function e(n){
+return n instanceof Map?n.clear=n.delete=n.set=()=>{
+throw Error("map is read-only")}:n instanceof Set&&(n.add=n.clear=n.delete=()=>{
+throw Error("set is read-only")
+}),Object.freeze(n),Object.getOwnPropertyNames(n).forEach((t=>{
+const a=n[t],i=typeof a;"object"!==i&&"function"!==i||Object.isFrozen(a)||e(a)
+})),n}class n{constructor(e){
+void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}
+ignoreMatch(){this.isMatchIgnored=!0}}function t(e){
+return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")
+}function a(e,...n){const t=Object.create(null);for(const n in e)t[n]=e[n]
+;return n.forEach((e=>{for(const n in e)t[n]=e[n]})),t}const i=e=>!!e.scope
+;class r{constructor(e,n){
+this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){
+this.buffer+=t(e)}openNode(e){if(!i(e))return;const n=((e,{prefix:n})=>{
+if(e.startsWith("language:"))return e.replace("language:","language-")
+;if(e.includes(".")){const t=e.split(".")
+;return[`${n}${t.shift()}`,...t.map(((e,n)=>`${e}${"_".repeat(n+1)}`))].join(" ")
+}return`${n}${e}`})(e.scope,{prefix:this.classPrefix});this.span(n)}
+closeNode(e){i(e)&&(this.buffer+="")}value(){return this.buffer}span(e){
+this.buffer+=``}}const s=(e={})=>{const n={children:[]}
+;return Object.assign(n,e),n};class o{constructor(){
+this.rootNode=s(),this.stack=[this.rootNode]}get top(){
+return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){
+this.top.children.push(e)}openNode(e){const n=s({scope:e})
+;this.add(n),this.stack.push(n)}closeNode(){
+if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){
+for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}
+walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){
+return"string"==typeof n?e.addText(n):n.children&&(e.openNode(n),
+n.children.forEach((n=>this._walk(e,n))),e.closeNode(n)),e}static _collapse(e){
+"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{
+o._collapse(e)})))}}class l extends o{constructor(e){super(),this.options=e}
+addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){
+this.closeNode()}__addSublanguage(e,n){const t=e.root
+;n&&(t.scope="language:"+n),this.add(t)}toHTML(){
+return new r(this,this.options).value()}finalize(){
+return this.closeAllNodes(),!0}}function c(e){
+return e?"string"==typeof e?e:e.source:null}function d(e){return b("(?=",e,")")}
+function g(e){return b("(?:",e,")*")}function u(e){return b("(?:",e,")?")}
+function b(...e){return e.map((e=>c(e))).join("")}function m(...e){const n=(e=>{
+const n=e[e.length-1]
+;return"object"==typeof n&&n.constructor===Object?(e.splice(e.length-1,1),n):{}
+})(e);return"("+(n.capture?"":"?:")+e.map((e=>c(e))).join("|")+")"}
+function p(e){return RegExp(e.toString()+"|").exec("").length-1}
+const _=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./
+;function h(e,{joinWith:n}){let t=0;return e.map((e=>{t+=1;const n=t
+;let a=c(e),i="";for(;a.length>0;){const e=_.exec(a);if(!e){i+=a;break}
+i+=a.substring(0,e.index),
+a=a.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?i+="\\"+(Number(e[1])+n):(i+=e[0],
+"("===e[0]&&t++)}return i})).map((e=>`(${e})`)).join(n)}
+const f="[a-zA-Z]\\w*",E="[a-zA-Z_]\\w*",y="\\b\\d+(\\.\\d+)?",N="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",w="\\b(0b[01]+)",v={
+begin:"\\\\[\\s\\S]",relevance:0},O={scope:"string",begin:"'",end:"'",
+illegal:"\\n",contains:[v]},k={scope:"string",begin:'"',end:'"',illegal:"\\n",
+contains:[v]},x=(e,n,t={})=>{const i=a({scope:"comment",begin:e,end:n,
+contains:[]},t);i.contains.push({scope:"doctag",
+begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",
+end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0})
+;const r=m("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/)
+;return i.contains.push({begin:b(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),i
+},M=x("//","$"),S=x("/\\*","\\*/"),A=x("#","$");var C=Object.freeze({
+__proto__:null,APOS_STRING_MODE:O,BACKSLASH_ESCAPE:v,BINARY_NUMBER_MODE:{
+scope:"number",begin:w,relevance:0},BINARY_NUMBER_RE:w,COMMENT:x,
+C_BLOCK_COMMENT_MODE:S,C_LINE_COMMENT_MODE:M,C_NUMBER_MODE:{scope:"number",
+begin:N,relevance:0},C_NUMBER_RE:N,END_SAME_AS_BEGIN:e=>Object.assign(e,{
+"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{
+n.data._beginMatch!==e[1]&&n.ignoreMatch()}}),HASH_COMMENT_MODE:A,IDENT_RE:f,
+MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:{begin:"\\.\\s*"+E,relevance:0},
+NUMBER_MODE:{scope:"number",begin:y,relevance:0},NUMBER_RE:y,
+PHRASAL_WORDS_MODE:{
+begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
+},QUOTE_STRING_MODE:k,REGEXP_MODE:{scope:"regexp",begin:/\/(?=[^/\n]*\/)/,
+end:/\/[gimuy]*/,contains:[v,{begin:/\[/,end:/\]/,relevance:0,contains:[v]}]},
+RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",
+SHEBANG:(e={})=>{const n=/^#![ ]*\//
+;return e.binary&&(e.begin=b(n,/.*\b/,e.binary,/\b.*/)),a({scope:"meta",begin:n,
+end:/$/,relevance:0,"on:begin":(e,n)=>{0!==e.index&&n.ignoreMatch()}},e)},
+TITLE_MODE:{scope:"title",begin:f,relevance:0},UNDERSCORE_IDENT_RE:E,
+UNDERSCORE_TITLE_MODE:{scope:"title",begin:E,relevance:0}});function T(e,n){
+"."===e.input[e.index-1]&&n.ignoreMatch()}function R(e,n){
+void 0!==e.className&&(e.scope=e.className,delete e.className)}function D(e,n){
+n&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",
+e.__beforeBegin=T,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,
+void 0===e.relevance&&(e.relevance=0))}function I(e,n){
+Array.isArray(e.illegal)&&(e.illegal=m(...e.illegal))}function L(e,n){
+if(e.match){
+if(e.begin||e.end)throw Error("begin & end are not supported with match")
+;e.begin=e.match,delete e.match}}function B(e,n){
+void 0===e.relevance&&(e.relevance=1)}const $=(e,n)=>{if(!e.beforeMatch)return
+;if(e.starts)throw Error("beforeMatch cannot be used with starts")
+;const t=Object.assign({},e);Object.keys(e).forEach((n=>{delete e[n]
+})),e.keywords=t.keywords,e.begin=b(t.beforeMatch,d(t.begin)),e.starts={
+relevance:0,contains:[Object.assign(t,{endsParent:!0})]
+},e.relevance=0,delete t.beforeMatch
+},z=["of","and","for","in","not","or","if","then","parent","list","value"],F="keyword"
+;function U(e,n,t=F){const a=Object.create(null)
+;return"string"==typeof e?i(t,e.split(" ")):Array.isArray(e)?i(t,e):Object.keys(e).forEach((t=>{
+Object.assign(a,U(e[t],n,t))})),a;function i(e,t){
+n&&(t=t.map((e=>e.toLowerCase()))),t.forEach((n=>{const t=n.split("|")
+;a[t[0]]=[e,j(t[0],t[1])]}))}}function j(e,n){
+return n?Number(n):(e=>z.includes(e.toLowerCase()))(e)?0:1}const P={},K=e=>{
+console.error(e)},H=(e,...n)=>{console.log("WARN: "+e,...n)},q=(e,n)=>{
+P[`${e}/${n}`]||(console.log(`Deprecated as of ${e}. ${n}`),P[`${e}/${n}`]=!0)
+},G=Error();function Z(e,n,{key:t}){let a=0;const i=e[t],r={},s={}
+;for(let e=1;e<=n.length;e++)s[e+a]=i[e],r[e+a]=!0,a+=p(n[e-1])
+;e[t]=s,e[t]._emit=r,e[t]._multi=!0}function W(e){(e=>{
+e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,
+delete e.scope)})(e),"string"==typeof e.beginScope&&(e.beginScope={
+_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope
+}),(e=>{if(Array.isArray(e.begin)){
+if(e.skip||e.excludeBegin||e.returnBegin)throw K("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),
+G
+;if("object"!=typeof e.beginScope||null===e.beginScope)throw K("beginScope must be object"),
+G;Z(e,e.begin,{key:"beginScope"}),e.begin=h(e.begin,{joinWith:""})}})(e),(e=>{
+if(Array.isArray(e.end)){
+if(e.skip||e.excludeEnd||e.returnEnd)throw K("skip, excludeEnd, returnEnd not compatible with endScope: {}"),
+G
+;if("object"!=typeof e.endScope||null===e.endScope)throw K("endScope must be object"),
+G;Z(e,e.end,{key:"endScope"}),e.end=h(e.end,{joinWith:""})}})(e)}function Q(e){
+function n(n,t){
+return RegExp(c(n),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(t?"g":""))
+}class t{constructor(){
+this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}
+addRule(e,n){
+n.position=this.position++,this.matchIndexes[this.matchAt]=n,this.regexes.push([n,e]),
+this.matchAt+=p(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null)
+;const e=this.regexes.map((e=>e[1]));this.matcherRe=n(h(e,{joinWith:"|"
+}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex
+;const n=this.matcherRe.exec(e);if(!n)return null
+;const t=n.findIndex(((e,n)=>n>0&&void 0!==e)),a=this.matchIndexes[t]
+;return n.splice(0,t),Object.assign(n,a)}}class i{constructor(){
+this.rules=[],this.multiRegexes=[],
+this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){
+if(this.multiRegexes[e])return this.multiRegexes[e];const n=new t
+;return this.rules.slice(e).forEach((([e,t])=>n.addRule(e,t))),
+n.compile(),this.multiRegexes[e]=n,n}resumingScanAtSamePosition(){
+return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,n){
+this.rules.push([e,n]),"begin"===n.type&&this.count++}exec(e){
+const n=this.getMatcher(this.regexIndex);n.lastIndex=this.lastIndex
+;let t=n.exec(e)
+;if(this.resumingScanAtSamePosition())if(t&&t.index===this.lastIndex);else{
+const n=this.getMatcher(0);n.lastIndex=this.lastIndex+1,t=n.exec(e)}
+return t&&(this.regexIndex+=t.position+1,
+this.regexIndex===this.count&&this.considerAll()),t}}
+if(e.compilerExtensions||(e.compilerExtensions=[]),
+e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.")
+;return e.classNameAliases=a(e.classNameAliases||{}),function t(r,s){const o=r
+;if(r.isCompiled)return o
+;[R,L,W,$].forEach((e=>e(r,s))),e.compilerExtensions.forEach((e=>e(r,s))),
+r.__beforeBegin=null,[D,I,B].forEach((e=>e(r,s))),r.isCompiled=!0;let l=null
+;return"object"==typeof r.keywords&&r.keywords.$pattern&&(r.keywords=Object.assign({},r.keywords),
+l=r.keywords.$pattern,
+delete r.keywords.$pattern),l=l||/\w+/,r.keywords&&(r.keywords=U(r.keywords,e.case_insensitive)),
+o.keywordPatternRe=n(l,!0),
+s&&(r.begin||(r.begin=/\B|\b/),o.beginRe=n(o.begin),r.end||r.endsWithParent||(r.end=/\B|\b/),
+r.end&&(o.endRe=n(o.end)),
+o.terminatorEnd=c(o.end)||"",r.endsWithParent&&s.terminatorEnd&&(o.terminatorEnd+=(r.end?"|":"")+s.terminatorEnd)),
+r.illegal&&(o.illegalRe=n(r.illegal)),
+r.contains||(r.contains=[]),r.contains=[].concat(...r.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((n=>a(e,{
+variants:null},n)))),e.cachedVariants?e.cachedVariants:X(e)?a(e,{
+starts:e.starts?a(e.starts):null
+}):Object.isFrozen(e)?a(e):e))("self"===e?r:e)))),r.contains.forEach((e=>{t(e,o)
+})),r.starts&&t(r.starts,s),o.matcher=(e=>{const n=new i
+;return e.contains.forEach((e=>n.addRule(e.begin,{rule:e,type:"begin"
+}))),e.terminatorEnd&&n.addRule(e.terminatorEnd,{type:"end"
+}),e.illegal&&n.addRule(e.illegal,{type:"illegal"}),n})(o),o}(e)}function X(e){
+return!!e&&(e.endsWithParent||X(e.starts))}class V extends Error{
+constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}
+const J=t,Y=a,ee=Symbol("nomatch"),ne=t=>{
+const a=Object.create(null),i=Object.create(null),r=[];let s=!0
+;const o="Could not find the language '{}', did you forget to load/include a language module?",c={
+disableAutodetect:!0,name:"Plain text",contains:[]};let p={
+ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,
+languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",
+cssSelector:"pre code",languages:null,__emitter:l};function _(e){
+return p.noHighlightRe.test(e)}function h(e,n,t){let a="",i=""
+;"object"==typeof n?(a=e,
+t=n.ignoreIllegals,i=n.language):(q("10.7.0","highlight(lang, code, ...args) has been deprecated."),
+q("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),
+i=e,a=n),void 0===t&&(t=!0);const r={code:a,language:i};x("before:highlight",r)
+;const s=r.result?r.result:f(r.language,r.code,t)
+;return s.code=r.code,x("after:highlight",s),s}function f(e,t,i,r){
+const l=Object.create(null);function c(){if(!x.keywords)return void S.addText(A)
+;let e=0;x.keywordPatternRe.lastIndex=0;let n=x.keywordPatternRe.exec(A),t=""
+;for(;n;){t+=A.substring(e,n.index)
+;const i=w.case_insensitive?n[0].toLowerCase():n[0],r=(a=i,x.keywords[a]);if(r){
+const[e,a]=r
+;if(S.addText(t),t="",l[i]=(l[i]||0)+1,l[i]<=7&&(C+=a),e.startsWith("_"))t+=n[0];else{
+const t=w.classNameAliases[e]||e;g(n[0],t)}}else t+=n[0]
+;e=x.keywordPatternRe.lastIndex,n=x.keywordPatternRe.exec(A)}var a
+;t+=A.substring(e),S.addText(t)}function d(){null!=x.subLanguage?(()=>{
+if(""===A)return;let e=null;if("string"==typeof x.subLanguage){
+if(!a[x.subLanguage])return void S.addText(A)
+;e=f(x.subLanguage,A,!0,M[x.subLanguage]),M[x.subLanguage]=e._top
+}else e=E(A,x.subLanguage.length?x.subLanguage:null)
+;x.relevance>0&&(C+=e.relevance),S.__addSublanguage(e._emitter,e.language)
+})():c(),A=""}function g(e,n){
+""!==e&&(S.startScope(n),S.addText(e),S.endScope())}function u(e,n){let t=1
+;const a=n.length-1;for(;t<=a;){if(!e._emit[t]){t++;continue}
+const a=w.classNameAliases[e[t]]||e[t],i=n[t];a?g(i,a):(A=i,c(),A=""),t++}}
+function b(e,n){
+return e.scope&&"string"==typeof e.scope&&S.openNode(w.classNameAliases[e.scope]||e.scope),
+e.beginScope&&(e.beginScope._wrap?(g(A,w.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),
+A=""):e.beginScope._multi&&(u(e.beginScope,n),A="")),x=Object.create(e,{parent:{
+value:x}}),x}function m(e,t,a){let i=((e,n)=>{const t=e&&e.exec(n)
+;return t&&0===t.index})(e.endRe,a);if(i){if(e["on:end"]){const a=new n(e)
+;e["on:end"](t,a),a.isMatchIgnored&&(i=!1)}if(i){
+for(;e.endsParent&&e.parent;)e=e.parent;return e}}
+if(e.endsWithParent)return m(e.parent,t,a)}function _(e){
+return 0===x.matcher.regexIndex?(A+=e[0],1):(D=!0,0)}function h(e){
+const n=e[0],a=t.substring(e.index),i=m(x,e,a);if(!i)return ee;const r=x
+;x.endScope&&x.endScope._wrap?(d(),
+g(n,x.endScope._wrap)):x.endScope&&x.endScope._multi?(d(),
+u(x.endScope,e)):r.skip?A+=n:(r.returnEnd||r.excludeEnd||(A+=n),
+d(),r.excludeEnd&&(A=n));do{
+x.scope&&S.closeNode(),x.skip||x.subLanguage||(C+=x.relevance),x=x.parent
+}while(x!==i.parent);return i.starts&&b(i.starts,e),r.returnEnd?0:n.length}
+let y={};function N(a,r){const o=r&&r[0];if(A+=a,null==o)return d(),0
+;if("begin"===y.type&&"end"===r.type&&y.index===r.index&&""===o){
+if(A+=t.slice(r.index,r.index+1),!s){const n=Error(`0 width match regex (${e})`)
+;throw n.languageName=e,n.badRule=y.rule,n}return 1}
+if(y=r,"begin"===r.type)return(e=>{
+const t=e[0],a=e.rule,i=new n(a),r=[a.__beforeBegin,a["on:begin"]]
+;for(const n of r)if(n&&(n(e,i),i.isMatchIgnored))return _(t)
+;return a.skip?A+=t:(a.excludeBegin&&(A+=t),
+d(),a.returnBegin||a.excludeBegin||(A=t)),b(a,e),a.returnBegin?0:t.length})(r)
+;if("illegal"===r.type&&!i){
+const e=Error('Illegal lexeme "'+o+'" for mode "'+(x.scope||"")+'"')
+;throw e.mode=x,e}if("end"===r.type){const e=h(r);if(e!==ee)return e}
+if("illegal"===r.type&&""===o)return 1
+;if(R>1e5&&R>3*r.index)throw Error("potential infinite loop, way more iterations than matches")
+;return A+=o,o.length}const w=v(e)
+;if(!w)throw K(o.replace("{}",e)),Error('Unknown language: "'+e+'"')
+;const O=Q(w);let k="",x=r||O;const M={},S=new p.__emitter(p);(()=>{const e=[]
+;for(let n=x;n!==w;n=n.parent)n.scope&&e.unshift(n.scope)
+;e.forEach((e=>S.openNode(e)))})();let A="",C=0,T=0,R=0,D=!1;try{
+if(w.__emitTokens)w.__emitTokens(t,S);else{for(x.matcher.considerAll();;){
+R++,D?D=!1:x.matcher.considerAll(),x.matcher.lastIndex=T
+;const e=x.matcher.exec(t);if(!e)break;const n=N(t.substring(T,e.index),e)
+;T=e.index+n}N(t.substring(T))}return S.finalize(),k=S.toHTML(),{language:e,
+value:k,relevance:C,illegal:!1,_emitter:S,_top:x}}catch(n){
+if(n.message&&n.message.includes("Illegal"))return{language:e,value:J(t),
+illegal:!0,relevance:0,_illegalBy:{message:n.message,index:T,
+context:t.slice(T-100,T+100),mode:n.mode,resultSoFar:k},_emitter:S};if(s)return{
+language:e,value:J(t),illegal:!1,relevance:0,errorRaised:n,_emitter:S,_top:x}
+;throw n}}function E(e,n){n=n||p.languages||Object.keys(a);const t=(e=>{
+const n={value:J(e),illegal:!1,relevance:0,_top:c,_emitter:new p.__emitter(p)}
+;return n._emitter.addText(e),n})(e),i=n.filter(v).filter(k).map((n=>f(n,e,!1)))
+;i.unshift(t);const r=i.sort(((e,n)=>{
+if(e.relevance!==n.relevance)return n.relevance-e.relevance
+;if(e.language&&n.language){if(v(e.language).supersetOf===n.language)return 1
+;if(v(n.language).supersetOf===e.language)return-1}return 0})),[s,o]=r,l=s
+;return l.secondBest=o,l}function y(e){let n=null;const t=(e=>{
+let n=e.className+" ";n+=e.parentNode?e.parentNode.className:""
+;const t=p.languageDetectRe.exec(n);if(t){const n=v(t[1])
+;return n||(H(o.replace("{}",t[1])),
+H("Falling back to no-highlight mode for this block.",e)),n?t[1]:"no-highlight"}
+return n.split(/\s+/).find((e=>_(e)||v(e)))})(e);if(_(t))return
+;if(x("before:highlightElement",{el:e,language:t
+}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e)
+;if(e.children.length>0&&(p.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),
+console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),
+console.warn("The element with unescaped HTML:"),
+console.warn(e)),p.throwUnescapedHTML))throw new V("One of your code blocks includes unescaped HTML.",e.innerHTML)
+;n=e;const a=n.textContent,r=t?h(a,{language:t,ignoreIllegals:!0}):E(a)
+;e.innerHTML=r.value,e.dataset.highlighted="yes",((e,n,t)=>{const a=n&&i[n]||t
+;e.classList.add("hljs"),e.classList.add("language-"+a)
+})(e,t,r.language),e.result={language:r.language,re:r.relevance,
+relevance:r.relevance},r.secondBest&&(e.secondBest={
+language:r.secondBest.language,relevance:r.secondBest.relevance
+}),x("after:highlightElement",{el:e,result:r,text:a})}let N=!1;function w(){
+"loading"!==document.readyState?document.querySelectorAll(p.cssSelector).forEach(y):N=!0
+}function v(e){return e=(e||"").toLowerCase(),a[e]||a[i[e]]}
+function O(e,{languageName:n}){"string"==typeof e&&(e=[e]),e.forEach((e=>{
+i[e.toLowerCase()]=n}))}function k(e){const n=v(e)
+;return n&&!n.disableAutodetect}function x(e,n){const t=e;r.forEach((e=>{
+e[t]&&e[t](n)}))}
+"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(()=>{
+N&&w()}),!1),Object.assign(t,{highlight:h,highlightAuto:E,highlightAll:w,
+highlightElement:y,
+highlightBlock:e=>(q("10.7.0","highlightBlock will be removed entirely in v12.0"),
+q("10.7.0","Please use highlightElement now."),y(e)),configure:e=>{p=Y(p,e)},
+initHighlighting:()=>{
+w(),q("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},
+initHighlightingOnLoad:()=>{
+w(),q("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")
+},registerLanguage:(e,n)=>{let i=null;try{i=n(t)}catch(n){
+if(K("Language definition for '{}' could not be registered.".replace("{}",e)),
+!s)throw n;K(n),i=c}
+i.name||(i.name=e),a[e]=i,i.rawDefinition=n.bind(null,t),i.aliases&&O(i.aliases,{
+languageName:e})},unregisterLanguage:e=>{delete a[e]
+;for(const n of Object.keys(i))i[n]===e&&delete i[n]},
+listLanguages:()=>Object.keys(a),getLanguage:v,registerAliases:O,
+autoDetection:k,inherit:Y,addPlugin:e=>{(e=>{
+e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=n=>{
+e["before:highlightBlock"](Object.assign({block:n.el},n))
+}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=n=>{
+e["after:highlightBlock"](Object.assign({block:n.el},n))})})(e),r.push(e)},
+removePlugin:e=>{const n=r.indexOf(e);-1!==n&&r.splice(n,1)}}),t.debugMode=()=>{
+s=!1},t.safeMode=()=>{s=!0},t.versionString="11.9.0",t.regex={concat:b,
+lookahead:d,either:m,optional:u,anyNumberOfTimes:g}
+;for(const n in C)"object"==typeof C[n]&&e(C[n]);return Object.assign(t,C),t
+},te=ne({});te.newInstance=()=>ne({});var ae=te;const ie=e=>({IMPORTANT:{
+scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{
+scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},
+FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},
+ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",
+contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{
+scope:"number",
+begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",
+relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}
+}),re=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],se=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],oe=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],le=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],ce=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse(),de=oe.concat(le)
+;var ge="[0-9](_*[0-9])*",ue=`\\.(${ge})`,be="[0-9a-fA-F](_*[0-9a-fA-F])*",me={
+className:"number",variants:[{
+begin:`(\\b(${ge})((${ue})|\\.)?|(${ue}))[eE][+-]?(${ge})[fFdD]?\\b`},{
+begin:`\\b(${ge})((${ue})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{
+begin:`(${ue})[fFdD]?\\b`},{begin:`\\b(${ge})[fFdD]\\b`},{
+begin:`\\b0[xX]((${be})\\.?|(${be})?\\.(${be}))[pP][+-]?(${ge})[fFdD]?\\b`},{
+begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${be})[lL]?\\b`},{
+begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],
+relevance:0};function pe(e,n,t){return-1===t?"":e.replace(n,(a=>pe(e,n,t-1)))}
+const _e="[A-Za-z$_][0-9A-Za-z$_]*",he=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],fe=["true","false","null","undefined","NaN","Infinity"],Ee=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],ye=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Ne=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],we=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],ve=[].concat(Ne,Ee,ye)
+;function Oe(e){const n=e.regex,t=_e,a={begin:/<[A-Za-z0-9\\._:-]+/,
+end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{
+const t=e[0].length+e.index,a=e.input[t]
+;if("<"===a||","===a)return void n.ignoreMatch();let i
+;">"===a&&(((e,{after:n})=>{const t=""+e[0].slice(1)
+;return-1!==e.input.indexOf(t,n)})(e,{after:t})||n.ignoreMatch())
+;const r=e.input.substring(t)
+;((i=r.match(/^\s*=/))||(i=r.match(/^\s+extends\s+/))&&0===i.index)&&n.ignoreMatch()
+}},i={$pattern:_e,keyword:he,literal:fe,built_in:ve,"variable.language":we
+},r="[0-9](_?[0-9])*",s=`\\.(${r})`,o="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",l={
+className:"number",variants:[{
+begin:`(\\b(${o})((${s})|\\.)?|(${s}))[eE][+-]?(${r})\\b`},{
+begin:`\\b(${o})\\b((${s})\\b|\\.)?|(${s})\\b`},{
+begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{
+begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{
+begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{
+begin:"\\b0[0-7]+n?\\b"}],relevance:0},c={className:"subst",begin:"\\$\\{",
+end:"\\}",keywords:i,contains:[]},d={begin:"html`",end:"",starts:{end:"`",
+returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,c],subLanguage:"xml"}},g={
+begin:"css`",end:"",starts:{end:"`",returnEnd:!1,
+contains:[e.BACKSLASH_ESCAPE,c],subLanguage:"css"}},u={begin:"gql`",end:"",
+starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,c],
+subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",
+contains:[e.BACKSLASH_ESCAPE,c]},m={className:"comment",
+variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{
+begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",
+begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,
+excludeBegin:!0,relevance:0},{className:"variable",begin:t+"(?=\\s*(-)|$)",
+endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]
+}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]
+},p=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,g,u,b,{match:/\$\d+/},l]
+;c.contains=p.concat({begin:/\{/,end:/\}/,keywords:i,contains:["self"].concat(p)
+});const _=[].concat(m,c.contains),h=_.concat([{begin:/\(/,end:/\)/,keywords:i,
+contains:["self"].concat(_)}]),f={className:"params",begin:/\(/,end:/\)/,
+excludeBegin:!0,excludeEnd:!0,keywords:i,contains:h},E={variants:[{
+match:[/class/,/\s+/,t,/\s+/,/extends/,/\s+/,n.concat(t,"(",n.concat(/\./,t),")*")],
+scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{
+match:[/class/,/\s+/,t],scope:{1:"keyword",3:"title.class"}}]},y={relevance:0,
+match:n.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),
+className:"title.class",keywords:{_:[...Ee,...ye]}},N={variants:[{
+match:[/function/,/\s+/,t,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],
+className:{1:"keyword",3:"title.function"},label:"func.def",contains:[f],
+illegal:/%/},w={
+match:n.concat(/\b/,(v=[...Ne,"super","import"],n.concat("(?!",v.join("|"),")")),t,n.lookahead(/\(/)),
+className:"title.function",relevance:0};var v;const O={
+begin:n.concat(/\./,n.lookahead(n.concat(t,/(?![0-9A-Za-z$_(])/))),end:t,
+excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},k={
+match:[/get|set/,/\s+/,t,/(?=\()/],className:{1:"keyword",3:"title.function"},
+contains:[{begin:/\(\)/},f]
+},x="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",M={
+match:[/const|var|let/,/\s+/,t,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(x)],
+keywords:"async",className:{1:"keyword",3:"title.function"},contains:[f]}
+;return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:i,exports:{
+PARAMS_CONTAINS:h,CLASS_REFERENCE:y},illegal:/#(?![$_A-z])/,
+contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{
+label:"use_strict",className:"meta",relevance:10,
+begin:/^\s*['"]use (strict|asm)['"]/
+},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,g,u,b,m,{match:/\$\d+/},l,y,{
+className:"attr",begin:t+n.lookahead(":"),relevance:0},M,{
+begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",
+keywords:"return throw case",relevance:0,contains:[m,e.REGEXP_MODE,{
+className:"function",begin:x,returnBegin:!0,end:"\\s*=>",contains:[{
+className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{
+className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,
+excludeEnd:!0,keywords:i,contains:h}]}]},{begin:/,/,relevance:0},{match:/\s+/,
+relevance:0},{variants:[{begin:"<>",end:">"},{
+match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:a.begin,
+"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{
+begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},N,{
+beginKeywords:"while if switch catch for"},{
+begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",
+returnBegin:!0,label:"func.def",contains:[f,e.inherit(e.TITLE_MODE,{begin:t,
+className:"title.function"})]},{match:/\.\.\./,relevance:0},O,{match:"\\$"+t,
+relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},
+contains:[f]},w,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,
+className:"variable.constant"},E,k,{match:/\$[(.]/}]}}
+const ke=e=>b(/\b/,e,/\w$/.test(e)?/\b/:/\B/),xe=["Protocol","Type"].map(ke),Me=["init","self"].map(ke),Se=["Any","Self"],Ae=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Ce=["false","nil","true"],Te=["assignment","associativity","higherThan","left","lowerThan","none","right"],Re=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],De=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Ie=m(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),Le=m(Ie,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Be=b(Ie,Le,"*"),$e=m(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),ze=m($e,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Fe=b($e,ze,"*"),Ue=b(/[A-Z]/,ze,"*"),je=["attached","autoclosure",b(/convention\(/,m("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",b(/objc\(/,Fe,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],Pe=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"]
+;var Ke=Object.freeze({__proto__:null,grmr_bash:e=>{const n=e.regex,t={},a={
+begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]}
+;Object.assign(t,{className:"variable",variants:[{
+begin:n.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},a]});const i={
+className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},r={
+begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,
+end:/(\w+)/,className:"string"})]}},s={className:"string",begin:/"/,end:/"/,
+contains:[e.BACKSLASH_ESCAPE,t,i]};i.contains.push(s);const o={begin:/\$?\(\(/,
+end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,t]
+},l=e.SHEBANG({binary:"(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)",relevance:10
+}),c={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,
+contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{
+name:"Bash",aliases:["sh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,
+keyword:["if","then","else","elif","fi","for","while","until","in","do","done","case","esac","function","select"],
+literal:["true","false"],
+built_in:["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset","alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","type","typeset","ulimit","unalias","set","shopt","autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp","chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"]
+},contains:[l,e.SHEBANG(),c,o,e.HASH_COMMENT_MODE,r,{match:/(\/[a-z._-]+)+/},s,{
+match:/\\"/},{className:"string",begin:/'/,end:/'/},{match:/\\'/},t]}},
+grmr_c:e=>{const n=e.regex,t=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]
+}),a="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",r="("+a+"|"+n.optional(i)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",s={
+className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{
+match:/\batomic_[a-z]{3,6}\b/}]},o={className:"string",variants:[{
+begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{
+begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",
+end:"'",illegal:"."},e.END_SAME_AS_BEGIN({
+begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},l={
+className:"number",variants:[{begin:"\\b(0b[01']+)"},{
+begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"
+},{
+begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"
+}],relevance:0},c={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{
+keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"
+},contains:[{begin:/\\\n/,relevance:0},e.inherit(o,{className:"string"}),{
+className:"string",begin:/<.*?>/},t,e.C_BLOCK_COMMENT_MODE]},d={
+className:"title",begin:n.optional(i)+e.IDENT_RE,relevance:0
+},g=n.optional(i)+e.IDENT_RE+"\\s*\\(",u={
+keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],
+type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal128","const","static","complex","bool","imaginary"],
+literal:"true false NULL",
+built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"
+},b=[c,s,t,e.C_BLOCK_COMMENT_MODE,l,o],m={variants:[{begin:/=/,end:/;/},{
+begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],
+keywords:u,contains:b.concat([{begin:/\(/,end:/\)/,keywords:u,
+contains:b.concat(["self"]),relevance:0}]),relevance:0},p={
+begin:"("+r+"[\\*&\\s]+)+"+g,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,
+keywords:u,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:a,keywords:u,relevance:0},{
+begin:g,returnBegin:!0,contains:[e.inherit(d,{className:"title.function"})],
+relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,
+keywords:u,relevance:0,contains:[t,e.C_BLOCK_COMMENT_MODE,o,l,s,{begin:/\(/,
+end:/\)/,keywords:u,relevance:0,contains:["self",t,e.C_BLOCK_COMMENT_MODE,o,l,s]
+}]},s,t,e.C_BLOCK_COMMENT_MODE,c]};return{name:"C",aliases:["h"],keywords:u,
+disableAutodetect:!0,illegal:"",contains:[].concat(m,p,b,[c,{
+begin:e.IDENT_RE+"::",keywords:u},{className:"class",
+beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{
+beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:c,
+strings:o,keywords:u}}},grmr_cpp:e=>{const n=e.regex,t=e.COMMENT("//","$",{
+contains:[{begin:/\\\n/}]
+}),a="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",r="(?!struct)("+a+"|"+n.optional(i)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",s={
+className:"type",begin:"\\b[a-z\\d_]*_t\\b"},o={className:"string",variants:[{
+begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{
+begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",
+end:"'",illegal:"."},e.END_SAME_AS_BEGIN({
+begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},l={
+className:"number",variants:[{begin:"\\b(0b[01']+)"},{
+begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"
+},{
+begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"
+}],relevance:0},c={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{
+keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"
+},contains:[{begin:/\\\n/,relevance:0},e.inherit(o,{className:"string"}),{
+className:"string",begin:/<.*?>/},t,e.C_BLOCK_COMMENT_MODE]},d={
+className:"title",begin:n.optional(i)+e.IDENT_RE,relevance:0
+},g=n.optional(i)+e.IDENT_RE+"\\s*\\(",u={
+type:["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],
+keyword:["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],
+literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],
+_type_hints:["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"]
+},b={className:"function.dispatch",relevance:0,keywords:{
+_hint:["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"]
+},
+begin:n.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,n.lookahead(/(<[^<>]+>|)\s*\(/))
+},m=[b,c,s,t,e.C_BLOCK_COMMENT_MODE,l,o],p={variants:[{begin:/=/,end:/;/},{
+begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],
+keywords:u,contains:m.concat([{begin:/\(/,end:/\)/,keywords:u,
+contains:m.concat(["self"]),relevance:0}]),relevance:0},_={className:"function",
+begin:"("+r+"[\\*&\\s]+)+"+g,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,
+keywords:u,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:a,keywords:u,relevance:0},{
+begin:g,returnBegin:!0,contains:[d],relevance:0},{begin:/::/,relevance:0},{
+begin:/:/,endsWithParent:!0,contains:[o,l]},{relevance:0,match:/,/},{
+className:"params",begin:/\(/,end:/\)/,keywords:u,relevance:0,
+contains:[t,e.C_BLOCK_COMMENT_MODE,o,l,s,{begin:/\(/,end:/\)/,keywords:u,
+relevance:0,contains:["self",t,e.C_BLOCK_COMMENT_MODE,o,l,s]}]
+},s,t,e.C_BLOCK_COMMENT_MODE,c]};return{name:"C++",
+aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:u,illegal:"",
+classNameAliases:{"function.dispatch":"built_in"},
+contains:[].concat(p,_,b,m,[c,{
+begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function)\\s*<(?!<)",
+end:">",keywords:u,contains:["self",s]},{begin:e.IDENT_RE+"::",keywords:u},{
+match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],
+className:{1:"keyword",3:"title.class"}}])}},grmr_csharp:e=>{const n={
+keyword:["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"].concat(["add","alias","and","ascending","async","await","by","descending","equals","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","remove","select","set","unmanaged","value|0","var","when","where","with","yield"]),
+built_in:["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],
+literal:["default","false","null","true"]},t=e.inherit(e.TITLE_MODE,{
+begin:"[a-zA-Z](\\.?\\w)*"}),a={className:"number",variants:[{
+begin:"\\b(0b[01']+)"},{
+begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{
+begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"
+}],relevance:0},i={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]
+},r=e.inherit(i,{illegal:/\n/}),s={className:"subst",begin:/\{/,end:/\}/,
+keywords:n},o=e.inherit(s,{illegal:/\n/}),l={className:"string",begin:/\$"/,
+end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/
+},e.BACKSLASH_ESCAPE,o]},c={className:"string",begin:/\$@"/,end:'"',contains:[{
+begin:/\{\{/},{begin:/\}\}/},{begin:'""'},s]},d=e.inherit(c,{illegal:/\n/,
+contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},o]})
+;s.contains=[c,l,i,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.C_BLOCK_COMMENT_MODE],
+o.contains=[d,l,r,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.inherit(e.C_BLOCK_COMMENT_MODE,{
+illegal:/\n/})];const g={variants:[c,l,i,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]
+},u={begin:"<",end:">",contains:[{beginKeywords:"in out"},t]
+},b=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",m={
+begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],
+keywords:n,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,
+contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{
+begin:"\x3c!--|--\x3e"},{begin:"?",end:">"}]}]
+}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",
+end:"$",keywords:{
+keyword:"if else elif endif define undef warning error line region endregion pragma checksum"
+}},g,a,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,
+illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"
+},t,u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",
+relevance:0,end:/[{;=]/,illegal:/[^\s:]/,
+contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{
+beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,
+contains:[t,u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",
+begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{
+className:"string",begin:/"/,end:/"/}]},{
+beginKeywords:"new return throw await else",relevance:0},{className:"function",
+begin:"("+b+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,
+end:/\s*[{;=]/,excludeEnd:!0,keywords:n,contains:[{
+beginKeywords:"public private protected static internal protected abstract async extern override unsafe virtual new sealed partial",
+relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,
+contains:[e.TITLE_MODE,u],relevance:0},{match:/\(\)/},{className:"params",
+begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:n,relevance:0,
+contains:[g,a,e.C_BLOCK_COMMENT_MODE]
+},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},m]}},grmr_css:e=>{
+const n=e.regex,t=ie(e),a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{
+name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{
+keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},
+contains:[t.BLOCK_COMMENT,{begin:/-(webkit|moz|ms|o)-(?=[a-z])/
+},t.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0
+},{className:"selector-class",begin:"\\.[a-zA-Z-][a-zA-Z0-9_-]*",relevance:0
+},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{
+begin:":("+oe.join("|")+")"},{begin:":(:)?("+le.join("|")+")"}]
+},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+ce.join("|")+")\\b"},{
+begin:/:/,end:/[;}{]/,
+contains:[t.BLOCK_COMMENT,t.HEXCOLOR,t.IMPORTANT,t.CSS_NUMBER_MODE,...a,{
+begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"
+},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,
+excludeEnd:!0}]},t.FUNCTION_DISPATCH]},{begin:n.lookahead(/@/),end:"[{;]",
+relevance:0,illegal:/:/,contains:[{className:"keyword",begin:/@-?\w[\w]*(-\w+)*/
+},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{
+$pattern:/[a-z-]+/,keyword:"and or not only",attribute:se.join(" ")},contains:[{
+begin:/[a-z-]+(?=:)/,className:"attribute"},...a,t.CSS_NUMBER_MODE]}]},{
+className:"selector-tag",begin:"\\b("+re.join("|")+")\\b"}]}},grmr_diff:e=>{
+const n=e.regex;return{name:"Diff",aliases:["patch"],contains:[{
+className:"meta",relevance:10,
+match:n.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)
+},{className:"comment",variants:[{
+begin:n.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),
+end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{
+className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,
+end:/$/}]}},grmr_go:e=>{const n={
+keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],
+type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],
+literal:["true","false","iota","nil"],
+built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]
+};return{name:"Go",aliases:["golang"],keywords:n,illegal:"",
+contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",
+variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{
+className:"number",variants:[{begin:e.C_NUMBER_RE+"[i]",relevance:1
+},e.C_NUMBER_MODE]},{begin:/:=/},{className:"function",beginKeywords:"func",
+end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",
+begin:/\(/,end:/\)/,endsParent:!0,keywords:n,illegal:/["']/}]}]}},
+grmr_graphql:e=>{const n=e.regex;return{name:"GraphQL",aliases:["gql"],
+case_insensitive:!0,disableAutodetect:!1,keywords:{
+keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],
+literal:["true","false","null"]},
+contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{
+scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",
+begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,
+end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{
+scope:"symbol",begin:n.concat(/[_A-Za-z][_0-9A-Za-z]*/,n.lookahead(/\s*:/)),
+relevance:0}],illegal:[/[;<']/,/BEGIN/]}},grmr_ini:e=>{const n=e.regex,t={
+className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{
+begin:e.NUMBER_RE}]},a=e.COMMENT();a.variants=[{begin:/;/,end:/$/},{begin:/#/,
+end:/$/}];const i={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{
+begin:/\$\{(.*?)\}/}]},r={className:"literal",
+begin:/\bon|off|true|false|yes|no\b/},s={className:"string",
+contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{
+begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]
+},o={begin:/\[/,end:/\]/,contains:[a,r,i,s,t,"self"],relevance:0
+},l=n.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{
+name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,
+contains:[a,{className:"section",begin:/\[+/,end:/\]+/},{
+begin:n.concat(l,"(\\s*\\.\\s*",l,")*",n.lookahead(/\s*=\s*[^#\s]/)),
+className:"attr",starts:{end:/$/,contains:[a,o,r,i,s,t]}}]}},grmr_java:e=>{
+const n=e.regex,t="[\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*",a=t+pe("(?:<"+t+"~~~(?:\\s*,\\s*"+t+"~~~)*>)?",/~~~/g,2),i={
+keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits"],
+literal:["false","true","null"],
+type:["char","boolean","long","float","int","byte","short","double"],
+built_in:["super","this"]},r={className:"meta",begin:"@"+t,contains:[{
+begin:/\(/,end:/\)/,contains:["self"]}]},s={className:"params",begin:/\(/,
+end:/\)/,keywords:i,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0}
+;return{name:"Java",aliases:["jsp"],keywords:i,illegal:/<\/|#/,
+contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,
+relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{
+begin:/import java\.[a-z]+\./,keywords:"import",relevance:2
+},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,
+className:"string",contains:[e.BACKSLASH_ESCAPE]
+},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{
+match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,t],className:{
+1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{
+begin:[n.concat(/(?!else)/,t),/\s+/,t,/\s+/,/=(?!=)/],className:{1:"type",
+3:"variable",5:"operator"}},{begin:[/record/,/\s+/,t],className:{1:"keyword",
+3:"title.class"},contains:[s,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{
+beginKeywords:"new throw return else",relevance:0},{
+begin:["(?:"+a+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{
+2:"title.function"},keywords:i,contains:[{className:"params",begin:/\(/,
+end:/\)/,keywords:i,relevance:0,
+contains:[r,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,me,e.C_BLOCK_COMMENT_MODE]
+},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},me,r]}},grmr_javascript:Oe,
+grmr_json:e=>{const n=["true","false","null"],t={scope:"literal",
+beginKeywords:n.join(" ")};return{name:"JSON",keywords:{literal:n},contains:[{
+className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{
+match:/[{}[\],:]/,className:"punctuation",relevance:0
+},e.QUOTE_STRING_MODE,t,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],
+illegal:"\\S"}},grmr_kotlin:e=>{const n={
+keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",
+built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",
+literal:"true false null"},t={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"
+},a={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},i={
+className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},r={className:"string",
+variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,a]},{begin:"'",end:"'",
+illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,
+contains:[e.BACKSLASH_ESCAPE,i,a]}]};a.contains.push(r);const s={
+className:"meta",
+begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"
+},o={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,
+end:/\)/,contains:[e.inherit(r,{className:"string"}),"self"]}]
+},l=me,c=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),d={
+variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,
+contains:[]}]},g=d;return g.variants[1].contains=[d],d.variants[1].contains=[g],
+{name:"Kotlin",aliases:["kt","kts"],keywords:n,
+contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",
+begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,c,{className:"keyword",
+begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",
+begin:/@\w+/}]}},t,s,o,{className:"function",beginKeywords:"fun",end:"[(]|$",
+returnBegin:!0,excludeEnd:!0,keywords:n,relevance:5,contains:[{
+begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,
+contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/,end:/>/,
+keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,
+endsParent:!0,keywords:n,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,
+endsWithParent:!0,contains:[d,e.C_LINE_COMMENT_MODE,c],relevance:0
+},e.C_LINE_COMMENT_MODE,c,s,o,r,e.C_NUMBER_MODE]},c]},{
+begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{
+3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,
+illegal:"extends implements",contains:[{
+beginKeywords:"public protected internal private constructor"
+},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/,end:/>/,excludeBegin:!0,
+excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,
+excludeBegin:!0,returnEnd:!0},s,o]},r,{className:"meta",begin:"^#!/usr/bin/env",
+end:"$",illegal:"\n"},l]}},grmr_less:e=>{
+const n=ie(e),t=de,a="[\\w-]+",i="("+a+"|@\\{"+a+"\\})",r=[],s=[],o=e=>({
+className:"string",begin:"~?"+e+".*?"+e}),l=(e,n,t)=>({className:e,begin:n,
+relevance:t}),c={$pattern:/[a-z-]+/,keyword:"and or not only",
+attribute:se.join(" ")},d={begin:"\\(",end:"\\)",contains:s,keywords:c,
+relevance:0}
+;s.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,o("'"),o('"'),n.CSS_NUMBER_MODE,{
+begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",
+excludeEnd:!0}
+},n.HEXCOLOR,d,l("variable","@@?"+a,10),l("variable","@\\{"+a+"\\}"),l("built_in","~?`[^`]*?`"),{
+className:"attribute",begin:a+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0
+},n.IMPORTANT,{beginKeywords:"and not"},n.FUNCTION_DISPATCH);const g=s.concat({
+begin:/\{/,end:/\}/,contains:r}),u={beginKeywords:"when",endsWithParent:!0,
+contains:[{beginKeywords:"and not"}].concat(s)},b={begin:i+"\\s*:",
+returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/
+},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+ce.join("|")+")\\b",
+end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:s}}]
+},m={className:"keyword",
+begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",
+starts:{end:"[;{}]",keywords:c,returnEnd:!0,contains:s,relevance:0}},p={
+className:"variable",variants:[{begin:"@"+a+"\\s*:",relevance:15},{begin:"@"+a
+}],starts:{end:"[;}]",returnEnd:!0,contains:g}},_={variants:[{
+begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:i,end:/\{/}],returnBegin:!0,
+returnEnd:!0,illegal:"[<='$\"]",relevance:0,
+contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,u,l("keyword","all\\b"),l("variable","@\\{"+a+"\\}"),{
+begin:"\\b("+re.join("|")+")\\b",className:"selector-tag"
+},n.CSS_NUMBER_MODE,l("selector-tag",i,0),l("selector-id","#"+i),l("selector-class","\\."+i,0),l("selector-tag","&",0),n.ATTRIBUTE_SELECTOR_MODE,{
+className:"selector-pseudo",begin:":("+oe.join("|")+")"},{
+className:"selector-pseudo",begin:":(:)?("+le.join("|")+")"},{begin:/\(/,
+end:/\)/,relevance:0,contains:g},{begin:"!important"},n.FUNCTION_DISPATCH]},h={
+begin:a+":(:)?"+`(${t.join("|")})`,returnBegin:!0,contains:[_]}
+;return r.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,m,p,h,b,_,u,n.FUNCTION_DISPATCH),
+{name:"Less",case_insensitive:!0,illegal:"[=>'/<($\"]",contains:r}},
+grmr_lua:e=>{const n="\\[=*\\[",t="\\]=*\\]",a={begin:n,end:t,contains:["self"]
+},i=[e.COMMENT("--(?!"+n+")","$"),e.COMMENT("--"+n,t,{contains:[a],relevance:10
+})];return{name:"Lua",keywords:{$pattern:e.UNDERSCORE_IDENT_RE,
+literal:"true false nil",
+keyword:"and break do else elseif end for goto if in local not or repeat return then until while",
+built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"
+},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",
+contains:[e.inherit(e.TITLE_MODE,{
+begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",
+begin:"\\(",endsWithParent:!0,contains:i}].concat(i)
+},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",
+begin:n,end:t,contains:[a],relevance:5}])}},grmr_makefile:e=>{const n={
+className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",
+contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%\^\+\*]/}]},t={className:"string",
+begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n]},a={className:"variable",
+begin:/\$\([\w-]+\s/,end:/\)/,keywords:{
+built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"
+},contains:[n]},i={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},r={
+className:"section",begin:/^[^\s]+:/,end:/$/,contains:[n]};return{
+name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,
+keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"
+},contains:[e.HASH_COMMENT_MODE,n,t,a,i,{className:"meta",begin:/^\.PHONY:/,
+end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},r]}},grmr_markdown:e=>{
+const n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},t={
+variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{
+begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,
+relevance:2},{
+begin:e.regex.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),
+relevance:2},{begin:/\[.+?\]\([./?].*?\)/,relevance:1},{
+begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/
+},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,
+returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",
+excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",
+end:"\\]",excludeBegin:!0,excludeEnd:!0}]},a={className:"strong",contains:[],
+variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]
+},i={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{
+begin:/_(?![_\s])/,end:/_/,relevance:0}]},r=e.inherit(a,{contains:[]
+}),s=e.inherit(i,{contains:[]});a.contains.push(s),i.contains.push(r)
+;let o=[n,t];return[a,i,r,s].forEach((e=>{e.contains=e.contains.concat(o)
+})),o=o.concat(a,i),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{
+className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:o},{
+begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",
+contains:o}]}]},n,{className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)",
+end:"\\s+",excludeEnd:!0},a,i,{className:"quote",begin:"^>\\s+",contains:o,
+end:"$"},{className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{
+begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{
+begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",
+contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{
+begin:"^[-\\*]{3,}",end:"$"},t,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{
+className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{
+className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]}]}},grmr_objectivec:e=>{
+const n=/[a-zA-Z@][a-zA-Z0-9_]*/,t={$pattern:n,
+keyword:["@interface","@class","@protocol","@implementation"]};return{
+name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],
+keywords:{"variable.language":["this","super"],$pattern:n,
+keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],
+literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],
+built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],
+type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]
+},illegal:"",contains:[{className:"built_in",
+begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"
+},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{
+className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",
+contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,
+keywords:{
+keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"
+},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{
+className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"
+},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",
+begin:"("+t.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:t,
+contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,
+relevance:0}]}},grmr_perl:e=>{const n=e.regex,t=/[dualxmsipngr]{0,12}/,a={
+$pattern:/[\w.]+/,
+keyword:"abs accept alarm and atan2 bind binmode bless break caller chdir chmod chomp chop chown chr chroot close closedir connect continue cos crypt dbmclose dbmopen defined delete die do dump each else elsif endgrent endhostent endnetent endprotoent endpwent endservent eof eval exec exists exit exp fcntl fileno flock for foreach fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt given glob gmtime goto grep gt hex if index int ioctl join keys kill last lc lcfirst length link listen local localtime log lstat lt ma map mkdir msgctl msgget msgrcv msgsnd my ne next no not oct open opendir or ord our pack package pipe pop pos print printf prototype push q|0 qq quotemeta qw qx rand read readdir readline readlink readpipe recv redo ref rename require reset return reverse rewinddir rindex rmdir say scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat state study sub substr symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst umask undef unless unlink unpack unshift untie until use utime values vec wait waitpid wantarray warn when while write x|0 xor y|0"
+},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:a},r={begin:/->\{/,
+end:/\}/},s={variants:[{begin:/\$\d/},{
+begin:n.concat(/[$%@](\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")
+},{begin:/[$%@][^\s\w{]/,relevance:0}]
+},o=[e.BACKSLASH_ESCAPE,i,s],l=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],c=(e,a,i="\\1")=>{
+const r="\\1"===i?i:n.concat(i,a)
+;return n.concat(n.concat("(?:",e,")"),a,/(?:\\.|[^\\\/])*?/,r,/(?:\\.|[^\\\/])*?/,i,t)
+},d=(e,a,i)=>n.concat(n.concat("(?:",e,")"),a,/(?:\\.|[^\\\/])*?/,i,t),g=[s,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{
+endsWithParent:!0}),r,{className:"string",contains:o,variants:[{
+begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",
+end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{
+begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",
+relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",
+contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",
+contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{
+begin:"-?\\w+\\s*=>",relevance:0}]},{className:"number",
+begin:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",
+relevance:0},{
+begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",
+keywords:"split return print reverse grep",relevance:0,
+contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{
+begin:c("s|tr|y",n.either(...l,{capture:!0}))},{begin:c("s|tr|y","\\(","\\)")},{
+begin:c("s|tr|y","\\[","\\]")},{begin:c("s|tr|y","\\{","\\}")}],relevance:2},{
+className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{
+begin:d("(?:m|qr)?",/\//,/\//)},{begin:d("m|qr",n.either(...l,{capture:!0
+}),/\1/)},{begin:d("m|qr",/\(/,/\)/)},{begin:d("m|qr",/\[/,/\]/)},{
+begin:d("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub",
+end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE]},{
+begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",
+subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]
+}];return i.contains=g,r.contains=g,{name:"Perl",aliases:["pl","pm"],keywords:a,
+contains:g}},grmr_php:e=>{
+const n=e.regex,t=/(?![A-Za-z0-9])(?![$])/,a=n.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,t),i=n.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,t),r={
+scope:"variable",match:"\\$+"+a},s={scope:"subst",variants:[{begin:/\$\w+/},{
+begin:/\{\$/,end:/\}/}]},o=e.inherit(e.APOS_STRING_MODE,{illegal:null
+}),l="[ \t\n]",c={scope:"string",variants:[e.inherit(e.QUOTE_STRING_MODE,{
+illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(s)}),o,{
+begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,
+contains:e.QUOTE_STRING_MODE.contains.concat(s),"on:begin":(e,n)=>{
+n.data._beginMatch=e[1]||e[2]},"on:end":(e,n)=>{
+n.data._beginMatch!==e[1]&&n.ignoreMatch()}},e.END_SAME_AS_BEGIN({
+begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/})]},d={scope:"number",variants:[{
+begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{
+begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{
+begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"
+}],relevance:0
+},g=["false","null","true"],u=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],b=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],m={
+keyword:u,literal:(e=>{const n=[];return e.forEach((e=>{
+n.push(e),e.toLowerCase()===e?n.push(e.toUpperCase()):n.push(e.toLowerCase())
+})),n})(g),built_in:b},p=e=>e.map((e=>e.replace(/\|\d+$/,""))),_={variants:[{
+match:[/new/,n.concat(l,"+"),n.concat("(?!",p(b).join("\\b|"),"\\b)"),i],scope:{
+1:"keyword",4:"title.class"}}]},h=n.concat(a,"\\b(?!\\()"),f={variants:[{
+match:[n.concat(/::/,n.lookahead(/(?!class\b)/)),h],scope:{2:"variable.constant"
+}},{match:[/::/,/class/],scope:{2:"variable.language"}},{
+match:[i,n.concat(/::/,n.lookahead(/(?!class\b)/)),h],scope:{1:"title.class",
+3:"variable.constant"}},{match:[i,n.concat("::",n.lookahead(/(?!class\b)/))],
+scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",
+3:"variable.language"}}]},E={scope:"attr",
+match:n.concat(a,n.lookahead(":"),n.lookahead(/(?!::)/))},y={relevance:0,
+begin:/\(/,end:/\)/,keywords:m,contains:[E,r,f,e.C_BLOCK_COMMENT_MODE,c,d,_]
+},N={relevance:0,
+match:[/\b/,n.concat("(?!fn\\b|function\\b|",p(u).join("\\b|"),"|",p(b).join("\\b|"),"\\b)"),a,n.concat(l,"*"),n.lookahead(/(?=\()/)],
+scope:{3:"title.function.invoke"},contains:[y]};y.contains.push(N)
+;const w=[E,f,e.C_BLOCK_COMMENT_MODE,c,d,_];return{case_insensitive:!1,
+keywords:m,contains:[{begin:n.concat(/#\[\s*/,i),beginScope:"meta",end:/]/,
+endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{
+begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},
+contains:["self",...w]},...w,{scope:"meta",match:i}]
+},e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{
+scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,
+keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,
+contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},{scope:"meta",variants:[{
+begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{
+begin:/\?>/}]},{scope:"variable.language",match:/\$this\b/},r,N,f,{
+match:[/const/,/\s/,a],scope:{1:"keyword",3:"variable.constant"}},_,{
+scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,
+excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"
+},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",
+begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:m,
+contains:["self",r,f,e.C_BLOCK_COMMENT_MODE,c,d]}]},{scope:"class",variants:[{
+beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",
+illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{
+beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{
+beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,
+contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{
+beginKeywords:"use",relevance:0,end:";",contains:[{
+match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},c,d]}
+},grmr_php_template:e=>({name:"PHP template",subLanguage:"xml",contains:[{
+begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",
+end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0
+},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,
+skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,
+contains:null,skip:!0})]}]}),grmr_plaintext:e=>({name:"Plain text",
+aliases:["text","txt"],disableAutodetect:!0}),grmr_python:e=>{
+const n=e.regex,t=/[\p{XID_Start}_]\p{XID_Continue}*/u,a=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],i={
+$pattern:/[A-Za-z]\w+|__\w+__/,keyword:a,
+built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],
+literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],
+type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]
+},r={className:"meta",begin:/^(>>>|\.\.\.) /},s={className:"subst",begin:/\{/,
+end:/\}/,keywords:i,illegal:/#/},o={begin:/\{\{/,relevance:0},l={
+className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{
+begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,
+contains:[e.BACKSLASH_ESCAPE,r],relevance:10},{
+begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,
+contains:[e.BACKSLASH_ESCAPE,r],relevance:10},{
+begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,
+contains:[e.BACKSLASH_ESCAPE,r,o,s]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,
+end:/"""/,contains:[e.BACKSLASH_ESCAPE,r,o,s]},{begin:/([uU]|[rR])'/,end:/'/,
+relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{
+begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,
+end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,
+contains:[e.BACKSLASH_ESCAPE,o,s]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,
+contains:[e.BACKSLASH_ESCAPE,o,s]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]
+},c="[0-9](_?[0-9])*",d=`(\\b(${c}))?\\.(${c})|\\b(${c})\\.`,g="\\b|"+a.join("|"),u={
+className:"number",relevance:0,variants:[{
+begin:`(\\b(${c})|(${d}))[eE][+-]?(${c})[jJ]?(?=${g})`},{begin:`(${d})[jJ]?`},{
+begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${g})`},{
+begin:`\\b0[bB](_?[01])+[lL]?(?=${g})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${g})`
+},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${g})`},{begin:`\\b(${c})[jJ](?=${g})`
+}]},b={className:"comment",begin:n.lookahead(/# type:/),end:/$/,keywords:i,
+contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={
+className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,
+end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,
+contains:["self",r,u,l,e.HASH_COMMENT_MODE]}]};return s.contains=[l,u,r],{
+name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:i,
+illegal:/(<\/|\?)|=>/,contains:[r,u,{begin:/\bself\b/},{beginKeywords:"if",
+relevance:0},l,b,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,t],scope:{
+1:"keyword",3:"title.function"},contains:[m]},{variants:[{
+match:[/\bclass/,/\s+/,t,/\s*/,/\(\s*/,t,/\s*\)/]},{match:[/\bclass/,/\s+/,t]}],
+scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{
+className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[u,m,l]}]}},
+grmr_python_repl:e=>({aliases:["pycon"],contains:[{className:"meta.prompt",
+starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{
+begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}),grmr_r:e=>{
+const n=e.regex,t=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,a=n.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,r=n.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/)
+;return{name:"R",keywords:{$pattern:t,
+keyword:"function if in break next repeat else for while",
+literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",
+built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"
+},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,
+starts:{end:n.lookahead(n.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),
+endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{
+scope:"variable",variants:[{match:t},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0
+}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]
+}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],
+variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/
+}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/
+}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/
+}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/
+}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/
+}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',
+relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{
+1:"operator",2:"number"},match:[i,a]},{scope:{1:"operator",2:"number"},
+match:[/%[^%]*%/,a]},{scope:{1:"punctuation",2:"number"},match:[r,a]},{scope:{
+2:"number"},match:[/[^a-zA-Z0-9._]|^/,a]}]},{scope:{3:"operator"},
+match:[t,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{
+match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:r},{begin:"`",end:"`",
+contains:[{begin:/\\./}]}]}},grmr_ruby:e=>{
+const n=e.regex,t="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",a=n.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=n.concat(a,/(::\w+)*/),r={
+"variable.constant":["__FILE__","__LINE__","__ENCODING__"],
+"variable.language":["self","super"],
+keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield","include","extend","prepend","public","private","protected","raise","throw"],
+built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],
+literal:["true","false","nil"]},s={className:"doctag",begin:"@[A-Za-z]+"},o={
+begin:"#<",end:">"},l=[e.COMMENT("#","$",{contains:[s]
+}),e.COMMENT("^=begin","^=end",{contains:[s],relevance:10
+}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],c={className:"subst",begin:/#\{/,
+end:/\}/,keywords:r},d={className:"string",contains:[e.BACKSLASH_ESCAPE,c],
+variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{
+begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{
+begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?,end:/>/},{begin:/%[qQwWx]?\//,
+end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{
+begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{
+begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{
+begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{
+begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{
+begin:n.concat(/<<[-~]?'?/,n.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),
+contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,
+contains:[e.BACKSLASH_ESCAPE,c]})]}]},g="[0-9](_?[0-9])*",u={className:"number",
+relevance:0,variants:[{
+begin:`\\b([1-9](_?[0-9])*|0)(\\.(${g}))?([eE][+-]?(${g})|r)?i?\\b`},{
+begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"
+},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{
+begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{
+begin:"\\b0(_?[0-7])+r?i?\\b"}]},b={variants:[{match:/\(\)/},{
+className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,
+keywords:r}]},m=[d,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{
+match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",
+4:"title.class.inherited"},keywords:r},{match:[/(include|extend)\s+/,i],scope:{
+2:"title.class"},keywords:r},{relevance:0,match:[i,/\.new[. (]/],scope:{
+1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,
+className:"variable.constant"},{relevance:0,match:a,scope:"title.class"},{
+match:[/def/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[b]},{
+begin:e.IDENT_RE+"::"},{className:"symbol",
+begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",
+begin:":(?!\\s)",contains:[d,{begin:t}],relevance:0},u,{className:"variable",
+begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{
+className:"params",begin:/\|/,end:/\|/,excludeBegin:!0,excludeEnd:!0,
+relevance:0,keywords:r},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",
+keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,c],
+illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{
+begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",
+end:"\\][a-z]*"}]}].concat(o,l),relevance:0}].concat(o,l)
+;c.contains=m,b.contains=m;const p=[{begin:/^\s*=>/,starts:{end:"$",contains:m}
+},{className:"meta.prompt",
+begin:"^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])",
+starts:{end:"$",keywords:r,contains:m}}];return l.unshift(o),{name:"Ruby",
+aliases:["rb","gemspec","podspec","thor","irb"],keywords:r,illegal:/\/\*/,
+contains:[e.SHEBANG({binary:"ruby"})].concat(p).concat(l).concat(m)}},
+grmr_rust:e=>{const n=e.regex,t={className:"title.function.invoke",relevance:0,
+begin:n.concat(/\b/,/(?!let|for|while|if|else|match\b)/,e.IDENT_RE,n.lookahead(/\s*\(/))
+},a="([ui](8|16|32|64|128|size)|f(32|64))?",i=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],r=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"]
+;return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:r,
+keyword:["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","unsafe","unsized","use","virtual","where","while","yield"],
+literal:["true","false","Some","None","Ok","Err"],built_in:i},illegal:"",
+contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]
+}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{
+className:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{
+begin:/b?'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/}]},{className:"symbol",
+begin:/'[a-zA-Z_][a-zA-Z0-9_]*/},{className:"number",variants:[{
+begin:"\\b0b([01_]+)"+a},{begin:"\\b0o([0-7_]+)"+a},{
+begin:"\\b0x([A-Fa-f0-9_]+)"+a},{
+begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+a}],relevance:0},{
+begin:[/fn/,/\s+/,e.UNDERSCORE_IDENT_RE],className:{1:"keyword",
+3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{
+className:"string",begin:/"/,end:/"/}]},{
+begin:[/let/,/\s+/,/(?:mut\s+)?/,e.UNDERSCORE_IDENT_RE],className:{1:"keyword",
+3:"keyword",4:"variable"}},{
+begin:[/for/,/\s+/,e.UNDERSCORE_IDENT_RE,/\s+/,/in/],className:{1:"keyword",
+3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,e.UNDERSCORE_IDENT_RE],
+className:{1:"keyword",3:"title.class"}},{
+begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,e.UNDERSCORE_IDENT_RE],
+className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{
+keyword:"Self",built_in:i,type:r}},{className:"punctuation",begin:"->"},t]}},
+grmr_scss:e=>{const n=ie(e),t=le,a=oe,i="@[a-z-]+",r={className:"variable",
+begin:"(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b",relevance:0};return{name:"SCSS",
+case_insensitive:!0,illegal:"[=/|']",
+contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,n.CSS_NUMBER_MODE,{
+className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{
+className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0
+},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",
+begin:"\\b("+re.join("|")+")\\b",relevance:0},{className:"selector-pseudo",
+begin:":("+a.join("|")+")"},{className:"selector-pseudo",
+begin:":(:)?("+t.join("|")+")"},r,{begin:/\(/,end:/\)/,
+contains:[n.CSS_NUMBER_MODE]},n.CSS_VARIABLE,{className:"attribute",
+begin:"\\b("+ce.join("|")+")\\b"},{
+begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"
+},{begin:/:/,end:/[;}{]/,relevance:0,
+contains:[n.BLOCK_COMMENT,r,n.HEXCOLOR,n.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,n.IMPORTANT,n.FUNCTION_DISPATCH]
+},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{
+begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,
+keyword:"and or not only",attribute:se.join(" ")},contains:[{begin:i,
+className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"
+},r,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,n.HEXCOLOR,n.CSS_NUMBER_MODE]
+},n.FUNCTION_DISPATCH]}},grmr_shell:e=>({name:"Shell Session",
+aliases:["console","shellsession"],contains:[{className:"meta.prompt",
+begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,
+subLanguage:"bash"}}]}),grmr_sql:e=>{
+const n=e.regex,t=e.COMMENT("--","$"),a=["true","false","unknown"],i=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],r=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],s=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],o=r,l=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year","add","asc","collation","desc","final","first","last","view"].filter((e=>!r.includes(e))),c={
+begin:n.concat(/\b/,n.either(...o),/\s*\(/),relevance:0,keywords:{built_in:o}}
+;return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{
+$pattern:/\b[\w\.]+/,keyword:((e,{exceptions:n,when:t}={})=>{const a=t
+;return n=n||[],e.map((e=>e.match(/\|\d+$/)||n.includes(e)?e:a(e)?e+"|0":e))
+})(l,{when:e=>e.length<3}),literal:a,type:i,
+built_in:["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"]
+},contains:[{begin:n.either(...s),relevance:0,keywords:{$pattern:/[\w\.]+/,
+keyword:l.concat(s),literal:a,type:i}},{className:"type",
+begin:n.either("double precision","large object","with timezone","without timezone")
+},c,{className:"variable",begin:/@[a-z0-9][a-z0-9_]*/},{className:"string",
+variants:[{begin:/'/,end:/'/,contains:[{begin:/''/}]}]},{begin:/"/,end:/"/,
+contains:[{begin:/""/}]},e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,t,{
+className:"operator",begin:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,
+relevance:0}]}},grmr_swift:e=>{const n={match:/\s+/,relevance:0
+},t=e.COMMENT("/\\*","\\*/",{contains:["self"]}),a=[e.C_LINE_COMMENT_MODE,t],i={
+match:[/\./,m(...xe,...Me)],className:{2:"keyword"}},r={match:b(/\./,m(...Ae)),
+relevance:0},s=Ae.filter((e=>"string"==typeof e)).concat(["_|0"]),o={variants:[{
+className:"keyword",
+match:m(...Ae.filter((e=>"string"!=typeof e)).concat(Se).map(ke),...Me)}]},l={
+$pattern:m(/\b\w+/,/#\w+/),keyword:s.concat(Re),literal:Ce},c=[i,r,o],g=[{
+match:b(/\./,m(...De)),relevance:0},{className:"built_in",
+match:b(/\b/,m(...De),/(?=\()/)}],u={match:/->/,relevance:0},p=[u,{
+className:"operator",relevance:0,variants:[{match:Be},{match:`\\.(\\.|${Le})+`}]
+}],_="([0-9]_*)+",h="([0-9a-fA-F]_*)+",f={className:"number",relevance:0,
+variants:[{match:`\\b(${_})(\\.(${_}))?([eE][+-]?(${_}))?\\b`},{
+match:`\\b0x(${h})(\\.(${h}))?([pP][+-]?(${_}))?\\b`},{match:/\b0o([0-7]_*)+\b/
+},{match:/\b0b([01]_*)+\b/}]},E=(e="")=>({className:"subst",variants:[{
+match:b(/\\/,e,/[0\\tnr"']/)},{match:b(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]
+}),y=(e="")=>({className:"subst",match:b(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)
+}),N=(e="")=>({className:"subst",label:"interpol",begin:b(/\\/,e,/\(/),end:/\)/
+}),w=(e="")=>({begin:b(e,/"""/),end:b(/"""/,e),contains:[E(e),y(e),N(e)]
+}),v=(e="")=>({begin:b(e,/"/),end:b(/"/,e),contains:[E(e),N(e)]}),O={
+className:"string",
+variants:[w(),w("#"),w("##"),w("###"),v(),v("#"),v("##"),v("###")]
+},k=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,
+contains:[e.BACKSLASH_ESCAPE]}],x={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,
+contains:k},M=e=>{const n=b(e,/\//),t=b(/\//,e);return{begin:n,end:t,
+contains:[...k,{scope:"comment",begin:`#(?!.*${t})`,end:/$/}]}},S={
+scope:"regexp",variants:[M("###"),M("##"),M("#"),x]},A={match:b(/`/,Fe,/`/)
+},C=[A,{className:"variable",match:/\$\d+/},{className:"variable",
+match:`\\$${ze}+`}],T=[{match:/(@|#(un)?)available/,scope:"keyword",starts:{
+contains:[{begin:/\(/,end:/\)/,keywords:Pe,contains:[...p,f,O]}]}},{
+scope:"keyword",match:b(/@/,m(...je))},{scope:"meta",match:b(/@/,Fe)}],R={
+match:d(/\b[A-Z]/),relevance:0,contains:[{className:"type",
+match:b(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,ze,"+")
+},{className:"type",match:Ue,relevance:0},{match:/[?!]+/,relevance:0},{
+match:/\.\.\./,relevance:0},{match:b(/\s+&\s+/,d(Ue)),relevance:0}]},D={
+begin:/,end:/>/,keywords:l,contains:[...a,...c,...T,u,R]};R.contains.push(D)
+;const I={begin:/\(/,end:/\)/,relevance:0,keywords:l,contains:["self",{
+match:b(Fe,/\s*:/),keywords:"_|0",relevance:0
+},...a,S,...c,...g,...p,f,O,...C,...T,R]},L={begin:/,end:/>/,
+keywords:"repeat each",contains:[...a,R]},B={begin:/\(/,end:/\)/,keywords:l,
+contains:[{begin:m(d(b(Fe,/\s*:/)),d(b(Fe,/\s+/,Fe,/\s*:/))),end:/:/,
+relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",
+match:Fe}]},...a,...c,...p,f,O,...T,R,I],endsParent:!0,illegal:/["']/},$={
+match:[/(func|macro)/,/\s+/,m(A.match,Fe,Be)],className:{1:"keyword",
+3:"title.function"},contains:[L,B,n],illegal:[/\[/,/%/]},z={
+match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},
+contains:[L,B,n],illegal:/\[|%/},F={match:[/operator/,/\s+/,Be],className:{
+1:"keyword",3:"title"}},U={begin:[/precedencegroup/,/\s+/,Ue],className:{
+1:"keyword",3:"title"},contains:[R],keywords:[...Te,...Ce],end:/}/}
+;for(const e of O.variants){const n=e.contains.find((e=>"interpol"===e.label))
+;n.keywords=l;const t=[...c,...g,...p,f,O,...C];n.contains=[...t,{begin:/\(/,
+end:/\)/,contains:["self",...t]}]}return{name:"Swift",keywords:l,
+contains:[...a,$,z,{beginKeywords:"struct protocol class extension enum actor",
+end:"\\{",excludeEnd:!0,keywords:l,contains:[e.inherit(e.TITLE_MODE,{
+className:"title.class",begin:/[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/}),...c]
+},F,U,{beginKeywords:"import",end:/$/,contains:[...a],relevance:0
+},S,...c,...g,...p,f,O,...C,...T,R,I]}},grmr_typescript:e=>{
+const n=Oe(e),t=_e,a=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={
+beginKeywords:"namespace",end:/\{/,excludeEnd:!0,
+contains:[n.exports.CLASS_REFERENCE]},r={beginKeywords:"interface",end:/\{/,
+excludeEnd:!0,keywords:{keyword:"interface extends",built_in:a},
+contains:[n.exports.CLASS_REFERENCE]},s={$pattern:_e,
+keyword:he.concat(["type","namespace","interface","public","private","protected","implements","declare","abstract","readonly","enum","override"]),
+literal:fe,built_in:ve.concat(a),"variable.language":we},o={className:"meta",
+begin:"@"+t},l=(e,n,t)=>{const a=e.contains.findIndex((e=>e.label===n))
+;if(-1===a)throw Error("can not find mode to replace");e.contains.splice(a,1,t)}
+;return Object.assign(n.keywords,s),
+n.exports.PARAMS_CONTAINS.push(o),n.contains=n.contains.concat([o,i,r]),
+l(n,"shebang",e.SHEBANG()),l(n,"use_strict",{className:"meta",relevance:10,
+begin:/^\s*['"]use strict['"]/
+}),n.contains.find((e=>"func.def"===e.label)).relevance=0,Object.assign(n,{
+name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n},grmr_vbnet:e=>{
+const n=e.regex,t=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,i=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,r=/\d{1,2}(:\d{1,2}){1,2}/,s={
+className:"literal",variants:[{begin:n.concat(/# */,n.either(a,t),/ *#/)},{
+begin:n.concat(/# */,r,/ *#/)},{begin:n.concat(/# */,i,/ *#/)},{
+begin:n.concat(/# */,n.either(a,t),/ +/,n.either(i,r),/ *#/)}]
+},o=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]
+}),l=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]})
+;return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,
+classNameAliases:{label:"symbol"},keywords:{
+keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",
+built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",
+type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",
+literal:"true false nothing"},
+illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[{
+className:"string",begin:/"(""|[^/n])"C\b/},{className:"string",begin:/"/,
+end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s,{className:"number",relevance:0,
+variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/
+},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{
+begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},{
+className:"label",begin:/^\w+:/},o,l,{className:"meta",
+begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,
+end:/$/,keywords:{
+keyword:"const disable else elseif enable end externalsource if region then"},
+contains:[l]}]}},grmr_wasm:e=>{e.regex;const n=e.COMMENT(/\(;/,/;\)/)
+;return n.contains.push("self"),{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,
+keyword:["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"]
+},contains:[e.COMMENT(/;;/,/$/),n,{match:[/(?:offset|align)/,/\s*/,/=/],
+className:{1:"keyword",3:"operator"}},{className:"variable",begin:/\$[\w_]+/},{
+match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},{
+begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",
+3:"title.function"}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/,
+className:"type"},{className:"keyword",
+match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/
+},{className:"number",relevance:0,
+match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/
+}]}},grmr_xml:e=>{
+const n=e.regex,t=n.concat(/[\p{L}_]/u,n.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),a={
+className:"symbol",begin:/&[a-z]+;|[0-9]+;|[a-f0-9]+;/},i={begin:/\s/,
+contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]
+},r=e.inherit(i,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{
+className:"string"}),o=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),l={
+endsWithParent:!0,illegal:/,relevance:0,contains:[{className:"attr",
+begin:/[\p{L}0-9._:-]+/u,relevance:0},{begin:/=\s*/,relevance:0,contains:[{
+className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[a]},{
+begin:/'/,end:/'/,contains:[a]},{begin:/[^\s"'=<>`]+/}]}]}]};return{
+name:"HTML, XML",
+aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],
+case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[i,o,s,r,{begin:/\[/,end:/\]/,contains:[{
+className:"meta",begin://,contains:[i,r,o,s]}]}]
+},e.COMMENT(//,{relevance:10}),{begin://,
+relevance:10},a,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,
+relevance:10,contains:[o]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",
+begin:/