git-history-ui 4.0.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/CODE_OF_CONDUCT.md +53 -0
  3. package/CONTRIBUTING.md +132 -0
  4. package/LICENSE +21 -0
  5. package/README.md +75 -15
  6. package/SECURITY.md +51 -0
  7. package/build/frontend/{chunk-CFCRPNUQ.js → chunk-3E3FVV4X.js} +1 -1
  8. package/build/frontend/chunk-465Y7ZAS.js +2 -0
  9. package/build/frontend/{chunk-I4VBIHH2.js → chunk-7VJNS7EY.js} +1 -1
  10. package/build/frontend/{chunk-UIWFTWLF.js → chunk-GBKH4M7W.js} +1 -1
  11. package/build/frontend/{chunk-UHWTLUOW.js → chunk-GJRIJIZY.js} +1 -1
  12. package/build/frontend/chunk-LRN4ELHN.js +9 -0
  13. package/build/frontend/chunk-PJETIVS4.js +1 -0
  14. package/build/frontend/chunk-QH2BEUIU.js +5 -0
  15. package/build/frontend/{chunk-UWM4ZZWH.js → chunk-SJJTMQGL.js} +1 -1
  16. package/build/frontend/chunk-TI46NMVL.js +1 -0
  17. package/build/frontend/chunk-V6G3DEZ6.js +1 -0
  18. package/build/frontend/{chunk-UNROVCUZ.js → chunk-WPYI663L.js} +1 -1
  19. package/build/frontend/chunk-Y6GOUMAT.js +1 -0
  20. package/build/frontend/index.html +1 -1
  21. package/build/frontend/main-735KK4CH.js +1 -0
  22. package/dist/backend/aggregations.d.ts +1 -0
  23. package/dist/backend/aggregations.d.ts.map +1 -0
  24. package/dist/backend/annotations.d.ts +1 -0
  25. package/dist/backend/annotations.d.ts.map +1 -0
  26. package/dist/backend/cache/sqliteIndex.d.ts +1 -0
  27. package/dist/backend/cache/sqliteIndex.d.ts.map +1 -0
  28. package/dist/backend/dev-server.d.ts +1 -0
  29. package/dist/backend/dev-server.d.ts.map +1 -0
  30. package/dist/backend/gitService.d.ts +1 -0
  31. package/dist/backend/gitService.d.ts.map +1 -0
  32. package/dist/backend/grouping/prGrouping.d.ts +1 -0
  33. package/dist/backend/grouping/prGrouping.d.ts.map +1 -0
  34. package/dist/backend/impact.d.ts +1 -0
  35. package/dist/backend/impact.d.ts.map +1 -0
  36. package/dist/backend/insights.d.ts +1 -0
  37. package/dist/backend/insights.d.ts.map +1 -0
  38. package/dist/backend/llm/anthropicProvider.d.ts +2 -0
  39. package/dist/backend/llm/anthropicProvider.d.ts.map +1 -0
  40. package/dist/backend/llm/anthropicProvider.js +10 -4
  41. package/dist/backend/llm/anthropicProvider.js.map +1 -1
  42. package/dist/backend/llm/heuristicProvider.d.ts +2 -0
  43. package/dist/backend/llm/heuristicProvider.d.ts.map +1 -0
  44. package/dist/backend/llm/heuristicProvider.js +54 -4
  45. package/dist/backend/llm/heuristicProvider.js.map +1 -1
  46. package/dist/backend/llm/index.d.ts +7 -0
  47. package/dist/backend/llm/index.d.ts.map +1 -0
  48. package/dist/backend/llm/index.js +15 -5
  49. package/dist/backend/llm/index.js.map +1 -1
  50. package/dist/backend/llm/openaiProvider.d.ts +2 -0
  51. package/dist/backend/llm/openaiProvider.d.ts.map +1 -0
  52. package/dist/backend/llm/openaiProvider.js +8 -3
  53. package/dist/backend/llm/openaiProvider.js.map +1 -1
  54. package/dist/backend/llm/types.d.ts +3 -1
  55. package/dist/backend/llm/types.d.ts.map +1 -0
  56. package/dist/backend/presets.d.ts +1 -0
  57. package/dist/backend/presets.d.ts.map +1 -0
  58. package/dist/backend/search/datePhrase.d.ts +1 -0
  59. package/dist/backend/search/datePhrase.d.ts.map +1 -0
  60. package/dist/backend/search/nlSearch.d.ts +1 -0
  61. package/dist/backend/search/nlSearch.d.ts.map +1 -0
  62. package/dist/backend/server.d.ts +1 -0
  63. package/dist/backend/server.d.ts.map +1 -0
  64. package/dist/backend/server.js +47 -18
  65. package/dist/backend/server.js.map +1 -1
  66. package/dist/backend/snapshot.d.ts +1 -0
  67. package/dist/backend/snapshot.d.ts.map +1 -0
  68. package/dist/cli.d.ts +1 -0
  69. package/dist/cli.d.ts.map +1 -0
  70. package/docs/API.md +70 -0
  71. package/docs/architecture.md +85 -0
  72. package/docs/configuration.md +54 -0
  73. package/docs/troubleshooting.md +85 -0
  74. package/package.json +44 -8
  75. package/build/frontend/chunk-4JCUQ6Y5.js +0 -1
  76. package/build/frontend/chunk-6VRZZB3T.js +0 -1
  77. package/build/frontend/chunk-EZUFC4CQ.js +0 -1
  78. package/build/frontend/chunk-GRG6HTLW.js +0 -9
  79. package/build/frontend/chunk-OBPR2XVH.js +0 -5
  80. package/build/frontend/chunk-QNEGGJHP.js +0 -2
  81. package/build/frontend/chunk-VHEMN3MU.js +0 -1
  82. package/build/frontend/main-SQFBVJA6.js +0 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,24 @@ All notable changes to this project are documented in this file.
4
4
  The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
5
5
  this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [5.0.0] - 2026-05-03
8
+
9
+ ### Added
10
+
11
+ - AI explanations now render as formatted markdown with an internal scrollbar
12
+ for long responses.
13
+ - OpenAI and Anthropic model selection can be overridden with
14
+ `GHUI_LLM_MODEL`, `OPENAI_MODEL`, or `ANTHROPIC_MODEL`.
15
+ - Project governance docs, PR templates, issue templates, and expanded test
16
+ coverage were added for a more release-ready package.
17
+
18
+ ### Changed
19
+
20
+ - OpenAI defaults to `gpt-4.1-nano` and Anthropic defaults to the available
21
+ Sonnet model `claude-sonnet-4-6`.
22
+ - AI summaries and commit explanations use larger token budgets and tighter
23
+ prompts to avoid truncated prose.
24
+
7
25
  ## [4.0.1] - 2026-05-02
8
26
 
9
27
  ### Fixed
@@ -0,0 +1,53 @@
1
+ # Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We pledge to make participation in this project a harassment-free experience
6
+ for everyone, regardless of age, body size, visible or invisible disability,
7
+ ethnicity, sex characteristics, gender identity and expression, level of
8
+ experience, education, socio-economic status, nationality, personal appearance,
9
+ race, religion, or sexual identity and orientation.
10
+
11
+ ## Our Standards
12
+
13
+ Examples of behavior that contributes to a positive environment include:
14
+
15
+ - Demonstrating empathy and kindness toward other people
16
+ - Being respectful of differing opinions, viewpoints, and experiences
17
+ - Giving and gracefully accepting constructive feedback
18
+ - Accepting responsibility and apologizing to those affected by mistakes
19
+ - Focusing on what is best for the overall community
20
+
21
+ Examples of unacceptable behavior include:
22
+
23
+ - The use of sexualized language or imagery, and sexual attention or advances
24
+ - Trolling, insulting or derogatory comments, and personal or political attacks
25
+ - Public or private harassment
26
+ - Publishing others' private information without explicit permission
27
+ - Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Project maintainers are responsible for clarifying and enforcing standards of
33
+ acceptable behavior and may remove, edit, or reject comments, commits, code,
34
+ wiki edits, issues, and other contributions that are not aligned with this Code
35
+ of Conduct.
36
+
37
+ ## Scope
38
+
39
+ This Code of Conduct applies within all project spaces, and also applies when an
40
+ individual is officially representing the project in public spaces.
41
+
42
+ ## Enforcement
43
+
44
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
45
+ reported to the project maintainer at
46
+ [ankit.sharma199803@gmail.com](mailto:ankit.sharma199803@gmail.com).
47
+
48
+ All complaints will be reviewed and investigated promptly and fairly.
49
+
50
+ ## Attribution
51
+
52
+ This Code of Conduct is adapted from the
53
+ [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
@@ -0,0 +1,132 @@
1
+ # Contributing to git-history-ui
2
+
3
+ Thanks for your interest in improving git-history-ui! This guide will help you
4
+ get started.
5
+
6
+ ## Development Setup
7
+
8
+ ```bash
9
+ # 1. Fork and clone
10
+ git clone https://github.com/<your-user>/git-history-ui.git
11
+ cd git-history-ui
12
+
13
+ # 2. Use the correct Node version
14
+ nvm use # reads .nvmrc → Node 20
15
+
16
+ # 3. Install dependencies
17
+ npm install
18
+ npm install --prefix frontend
19
+
20
+ # 4. Start the dev server (backend + frontend with hot reload)
21
+ npm run dev
22
+ ```
23
+
24
+ The backend runs on `http://localhost:3000` and the Angular dev server on
25
+ `http://localhost:4200` with API requests proxied to the backend.
26
+
27
+ ## Project Structure
28
+
29
+ ```
30
+ src/
31
+ cli.ts # CLI entry point (Commander)
32
+ backend/
33
+ server.ts # Express app + API routes
34
+ gitService.ts # All git operations
35
+ llm/ # LLM provider abstraction
36
+ search/ # Natural-language search
37
+ cache/ # SQLite indexer
38
+ ...
39
+ __tests__/ # Backend tests (Jest)
40
+
41
+ frontend/
42
+ src/app/
43
+ components/ # Angular standalone components
44
+ services/ # Angular services
45
+ models/ # Shared TypeScript interfaces
46
+ ```
47
+
48
+ ## Making Changes
49
+
50
+ 1. **Create a feature branch** from `main`:
51
+
52
+ ```bash
53
+ git checkout -b feat/my-feature
54
+ ```
55
+
56
+ 2. **Write code.** Follow the existing style — Prettier and ESLint will
57
+ enforce formatting on commit (via the pre-commit hook).
58
+
59
+ 3. **Write tests.** Backend coverage must stay above 90% (CI enforces this).
60
+ Add tests in `src/__tests__/` for any new backend logic.
61
+
62
+ 4. **Run checks locally** before pushing:
63
+
64
+ ```bash
65
+ npm run lint # ESLint
66
+ npm run typecheck # tsc --noEmit
67
+ npm test # Jest (backend)
68
+ npm test --prefix frontend -- --watch=false # Karma (frontend)
69
+ ```
70
+
71
+ 5. **Commit with a conventional message:**
72
+
73
+ ```
74
+ feat: add branch comparison view
75
+ fix: handle empty commit body in NL search
76
+ docs: update API endpoint reference
77
+ chore: bump express to 4.22
78
+ ```
79
+
80
+ The format is `type(optional-scope): description`. See
81
+ [Conventional Commits](https://www.conventionalcommits.org/) for the full
82
+ spec.
83
+
84
+ 6. **Push and open a PR** against `main`. Fill in the PR template and link
85
+ any related issues.
86
+
87
+ ## Commit Message Convention
88
+
89
+ We use [Conventional Commits](https://www.conventionalcommits.org/):
90
+
91
+ | Prefix | When to use |
92
+ | ---------- | ------------------------------------ |
93
+ | `feat:` | New user-facing feature |
94
+ | `fix:` | Bug fix |
95
+ | `docs:` | Documentation only |
96
+ | `style:` | Formatting, whitespace |
97
+ | `refactor:`| Code change that neither fixes nor adds |
98
+ | `perf:` | Performance improvement |
99
+ | `test:` | Adding or updating tests |
100
+ | `chore:` | Build, CI, dependency updates |
101
+
102
+ ## Code Style
103
+
104
+ - **TypeScript** throughout (backend + frontend).
105
+ - **Prettier** formats on save / on commit.
106
+ - **ESLint** with `@typescript-eslint` and `prettier` integration.
107
+ - Prefer `const` over `let`, avoid `any` when practical.
108
+ - Keep functions small and testable.
109
+
110
+ ## Tests
111
+
112
+ - **Backend:** Jest + ts-jest. Tests live in `src/__tests__/`.
113
+ - Use `supertest` for HTTP endpoint tests.
114
+ - Use `nock` for external HTTP mocking (GitHub API, LLM providers).
115
+ - Use `helpers/repo.ts` to create ephemeral git repos.
116
+ - **Frontend:** Karma + Jasmine. Specs live alongside components (`*.spec.ts`).
117
+
118
+ ## Reporting Bugs
119
+
120
+ Use the [bug report template](https://github.com/beingmartinbmc/git-history-ui/issues/new?template=bug_report.yml)
121
+ on GitHub. Include your Node version, OS, and the output of
122
+ `npx git-history-ui --version`.
123
+
124
+ ## Requesting Features
125
+
126
+ Use the [feature request template](https://github.com/beingmartinbmc/git-history-ui/issues/new?template=feature_request.yml)
127
+ on GitHub. Describe the use case, not just the solution.
128
+
129
+ ## License
130
+
131
+ By contributing, you agree that your contributions will be licensed under the
132
+ [MIT License](LICENSE).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ankit Sharma
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -21,6 +21,24 @@ Zero setup. Runs locally. Your code never leaves your machine unless you opt in.
21
21
  npx git-history-ui@latest
22
22
  ```
23
23
 
24
+ ## Table of contents
25
+
26
+ - [10-second workflow](#-10-second-workflow)
27
+ - [Preview](#-preview)
28
+ - [Why this exists](#-why-this-exists)
29
+ - [What makes it different](#-what-makes-it-different)
30
+ - [Quick Start](#-quick-start)
31
+ - [How it compares](#-how-it-compares)
32
+ - [All features](#-all-features)
33
+ - [Usage](#-usage)
34
+ - [Docs](#-docs)
35
+ - [Production](#-production)
36
+ - [Development](#-development)
37
+ - [Requirements](#-requirements)
38
+ - [Contributing](#-contributing)
39
+ - [Security](#-security)
40
+ - [License](#-license)
41
+
24
42
  ## ⚡ 10-second workflow
25
43
 
26
44
  1. Run `npx git-history-ui` inside any git repo
@@ -86,14 +104,16 @@ directory — no installs, no config, no account.
86
104
 
87
105
  ## ⚖️ How it compares
88
106
 
89
- - **vs GitHub UI:** NL search and PR grouping work *with* your unpushed
90
- commits. Time travel and impact analysis aren't on GitHub at all.
91
- - **vs `tig` / `git log`:** visual lanes, browser diffs, optional AI
92
- explanations, insights dashboard.
93
- - **vs desktop clients (GitKraken, SourceTree, Fork):** starts on demand,
94
- no project import, no account, no native install. AI features are
95
- pay-as-you-go on *your* key nothing about your code leaves your
96
- machine unless you opt in.
107
+ | Capability | `git-history-ui` | GitHub UI | `tig` / `git log` | Desktop clients |
108
+ | --- | --- | --- | --- | --- |
109
+ | Works with local and unpushed commits | Yes | No | Yes | Usually |
110
+ | Natural-language history search | Yes | No | No | Rare |
111
+ | PR / feature grouping for local history | Yes | Partial | No | Partial |
112
+ | Time-travel snapshot diffing | Yes | No | No | Rare |
113
+ | Commit impact analysis | Yes | No | No | Rare |
114
+ | Browser-based unified / split diffs | Yes | Yes | No | Yes |
115
+ | Optional AI summaries on your key | Yes | No | No | Rare |
116
+ | No account, import, or desktop install | Yes | No | Yes | No |
97
117
 
98
118
  ## 📦 All features
99
119
 
@@ -172,17 +192,48 @@ npx git-history-ui@latest --no-open # don't open the browser
172
192
  npx git-history-ui@latest --help # full flag list
173
193
  ```
174
194
 
195
+ ### CLI reference
196
+
197
+ ```text
198
+ Usage: git-history-ui [options] [command]
199
+
200
+ Beautiful git history visualization in your browser
201
+
202
+ Options:
203
+ -v, --version output the version number
204
+ -p, --port <number> port to run server on (default: "3000")
205
+ -H, --host <host> host to bind to (default: "localhost")
206
+ -f, --file <path> filter commits by a specific file
207
+ -s, --since <date> filter commits since a date (YYYY-MM-DD)
208
+ -a, --author <name> filter commits by author
209
+ --no-open do not automatically open browser
210
+ --cwd <path> path to the git repository (defaults to cwd)
211
+ --llm <provider> LLM provider: heuristic, anthropic, openai (default:
212
+ auto)
213
+ --preset <name> load filters from a saved preset
214
+ --save-preset <name> save the current flags as a preset for next time
215
+ -h, --help display help for command
216
+
217
+ Commands:
218
+ presets <action> [name] manage saved CLI presets
219
+ ```
220
+
175
221
  ### Optional: bring your own AI key
176
222
 
177
223
  ```bash
178
- # Anthropic (recommended; uses claude-3-5-haiku by default)
224
+ # Anthropic (uses Claude Sonnet 4 by default)
179
225
  export ANTHROPIC_API_KEY=sk-ant-...
180
226
 
181
- # Or OpenAI (uses gpt-4o-mini by default)
227
+ # Or OpenAI (uses GPT 4.1 Nano by default)
182
228
  export OPENAI_API_KEY=sk-...
183
229
 
184
230
  # Force a specific provider when both are set
185
231
  export GHUI_LLM_PROVIDER=anthropic # anthropic | openai | heuristic
232
+
233
+ # Optional model overrides
234
+ export GHUI_LLM_MODEL=claude-sonnet-4-6
235
+ export ANTHROPIC_MODEL=claude-sonnet-4-6
236
+ export OPENAI_MODEL=gpt-4.1-nano
186
237
  ```
187
238
 
188
239
  ### Optional: GitHub PR enrichment
@@ -193,6 +244,13 @@ export GITHUB_TOKEN=ghp_... # fine-grained PAT, read-only on the repo
193
244
 
194
245
  This hydrates the *Grouped* view with PR titles, authors, and labels.
195
246
 
247
+ ## 📚 Docs
248
+
249
+ - [API reference](./docs/API.md)
250
+ - [Architecture](./docs/architecture.md)
251
+ - [Configuration](./docs/configuration.md)
252
+ - [Troubleshooting](./docs/troubleshooting.md)
253
+
196
254
  ## 🏭 Production
197
255
 
198
256
  ```bash
@@ -225,11 +283,13 @@ cd frontend && npm test
225
283
 
226
284
  ## 🤝 Contributing
227
285
 
228
- 1. Fork the repository
229
- 2. Create a feature branch
230
- 3. Make your changes
231
- 4. Run tests
232
- 5. Submit a pull request
286
+ Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for local
287
+ setup, commit conventions, test commands, and PR expectations.
288
+
289
+ ## 🔐 Security
290
+
291
+ Please do not open public issues for security vulnerabilities. See
292
+ [SECURITY.md](SECURITY.md) for the responsible disclosure process.
233
293
 
234
294
  ## 📄 License
235
295
 
package/SECURITY.md ADDED
@@ -0,0 +1,51 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ | ------- | ------------------ |
7
+ | 4.x | :white_check_mark: |
8
+ | 3.x | :x: |
9
+ | < 3.0 | :x: |
10
+
11
+ ## Reporting a Vulnerability
12
+
13
+ If you discover a security vulnerability in `git-history-ui`, **please do not
14
+ open a public issue.** Instead, report it responsibly so we can fix it before
15
+ it's disclosed.
16
+
17
+ **Email:** [ankit.sharma199803@gmail.com](mailto:ankit.sharma199803@gmail.com)
18
+
19
+ Please include:
20
+
21
+ - A description of the vulnerability
22
+ - Steps to reproduce
23
+ - The version(s) affected
24
+ - Any potential impact you've identified
25
+
26
+ You should receive an acknowledgment within **48 hours**. We'll work with you
27
+ to understand the issue and coordinate a fix and disclosure timeline.
28
+
29
+ ## Scope
30
+
31
+ The following are in scope:
32
+
33
+ - The `git-history-ui` npm package and CLI
34
+ - The Express backend server (`src/backend/`)
35
+ - API key handling (Anthropic, OpenAI, GitHub tokens)
36
+ - The local SQLite index (`~/.git-history-ui/`)
37
+
38
+ The following are **out of scope**:
39
+
40
+ - Third-party services (Anthropic, OpenAI, GitHub APIs)
41
+ - The user's own git repository contents
42
+ - The Chrome extension and GitHub App scaffolds (experimental, not published)
43
+
44
+ ## Principles
45
+
46
+ - **Local-first.** Your repository data never leaves your machine unless you
47
+ explicitly configure an LLM provider key.
48
+ - **No telemetry.** We do not collect analytics, crash reports, or usage data.
49
+ - **API keys are yours.** Keys are read from environment variables and sent
50
+ directly to the provider you chose. They are never logged, stored, or
51
+ transmitted elsewhere.
@@ -1 +1 @@
1
- import{$ as a,Qb as v,Rb as l,Sb as m,U as f,W as h,ja as y,ka as b,l as g,la as d,oa as i}from"./chunk-OBPR2XVH.js";function U(n,e){let t=e?.injector??a(y),s=new g(1),u=m(()=>{let r;try{r=n()}catch(c){v(()=>s.error(c));return}v(()=>s.next(r))},{injector:t,manualCleanup:!0});return t.get(d).onDestroy(()=>{u.destroy(),s.complete()}),s.asObservable()}function L(n,e){let s=!e?.manualCleanup?e?.injector?.get(d)??a(d):null,u=w(e?.equal),r;e?.requireSync?r=i({kind:0},{equal:u}):r=i({kind:1,value:e?.initialValue},{equal:u});let c,p=n.subscribe({next:o=>r.set({kind:1,value:o}),error:o=>{r.set({kind:2,error:o}),c?.()},complete:()=>{c?.()}});if(e?.requireSync&&r().kind===0)throw new f(601,!1);return c=s?.onDestroy(p.unsubscribe.bind(p)),l(()=>{let o=r();switch(o.kind){case 1:return o.value;case 2:throw o.error;case 0:throw new f(601,!1)}},{equal:e?.equal})}function w(n=Object.is){return(e,t)=>e.kind===1&&t.kind===1&&n(e.value,t.value)}var k="ghui:theme",D=class n{doc=a(b);mediaQuery=null;preference=i(this.read());systemDark=i(!1);resolved=l(()=>{let e=this.preference();return e==="system"?this.systemDark()?"dark":"light":e});constructor(){typeof window<"u"&&window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.systemDark.set(this.mediaQuery.matches),this.mediaQuery.addEventListener("change",e=>this.systemDark.set(e.matches))),m(()=>{let e=this.resolved(),t=this.doc.documentElement;t.classList.toggle("dark",e==="dark"),t.dataset.theme=e,this.doc.body?.classList?.toggle("dark",e==="dark")})}setPreference(e){this.preference.set(e);try{localStorage.setItem(k,e)}catch{}}cycle(){let t=this.resolved()==="light"?"dark":"light";this.setPreference(t)}read(){try{let e=localStorage.getItem(k);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}static \u0275fac=function(t){return new(t||n)};static \u0275prov=h({token:n,factory:n.\u0275fac,providedIn:"root"})};export{U as a,L as b,D as c};
1
+ import{$ as a,U as f,W as h,ac as v,bc as l,cc as m,ja as y,ka as b,l as g,la as d,oa as i}from"./chunk-QH2BEUIU.js";function U(n,e){let t=e?.injector??a(y),s=new g(1),u=m(()=>{let r;try{r=n()}catch(c){v(()=>s.error(c));return}v(()=>s.next(r))},{injector:t,manualCleanup:!0});return t.get(d).onDestroy(()=>{u.destroy(),s.complete()}),s.asObservable()}function L(n,e){let s=!e?.manualCleanup?e?.injector?.get(d)??a(d):null,u=w(e?.equal),r;e?.requireSync?r=i({kind:0},{equal:u}):r=i({kind:1,value:e?.initialValue},{equal:u});let c,p=n.subscribe({next:o=>r.set({kind:1,value:o}),error:o=>{r.set({kind:2,error:o}),c?.()},complete:()=>{c?.()}});if(e?.requireSync&&r().kind===0)throw new f(601,!1);return c=s?.onDestroy(p.unsubscribe.bind(p)),l(()=>{let o=r();switch(o.kind){case 1:return o.value;case 2:throw o.error;case 0:throw new f(601,!1)}},{equal:e?.equal})}function w(n=Object.is){return(e,t)=>e.kind===1&&t.kind===1&&n(e.value,t.value)}var k="ghui:theme",D=class n{doc=a(b);mediaQuery=null;preference=i(this.read());systemDark=i(!1);resolved=l(()=>{let e=this.preference();return e==="system"?this.systemDark()?"dark":"light":e});constructor(){typeof window<"u"&&window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.systemDark.set(this.mediaQuery.matches),this.mediaQuery.addEventListener("change",e=>this.systemDark.set(e.matches))),m(()=>{let e=this.resolved(),t=this.doc.documentElement;t.classList.toggle("dark",e==="dark"),t.dataset.theme=e,this.doc.body?.classList?.toggle("dark",e==="dark")})}setPreference(e){this.preference.set(e);try{localStorage.setItem(k,e)}catch{}}cycle(){let t=this.resolved()==="light"?"dark":"light";this.setPreference(t)}read(){try{let e=localStorage.getItem(k);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}static \u0275fac=function(t){return new(t||n)};static \u0275prov=h({token:n,factory:n.\u0275fac,providedIn:"root"})};export{U as a,L as b,D as c};