on master help sign in
146 files changed+11149−14538
since splitsnapshots
unifiedsplit
.gitattributes+1 .github/pull_request_template.md+10 .gitignore+3−2 .hlint.yaml+65 CONTRIBUTING.md+125−3 ChangeLog.md+156 FAQ.md+117 LICENSE+30 README.md+306−35 acme.nix+430 all-builds.nix+113 all-tests.nix+145 default.nix+344−219 lib/https/default.nix → dep/ghcid/default.nix dep/ghcid/github.json+7 dep/gitignore.nix/default.nix+8 dep/gitignore.nix/github.json+8 dep/hnix/default.nix+7 dep/hnix/github.json+7 dep/reflex-platform/default.nix+1−6 dep/reflex-platform/github.json+4−3 dep/reflex-platform/thunk.nix+9 dep/snap-core/default.nix+8 dep/snap-core/github.json+8 docs/obelisk-logo-640.png ghcjs.externs.js−12270 guides/app-deploy/README.md+324 guides/app-deploy/assets/android-app.jpg guides/app-deploy/assets/android-confirm-usb-debugging.jpg guides/app-deploy/assets/app-deploy-2.png guides/app-deploy/assets/app-deploy.png guides/app-deploy/assets/ios-deploy-example.png guides/app-deploy/assets/ios-deploy-keychain.png guides/app-deploy/assets/ios-obelisk-app-icon.jpg guides/app-deploy/assets/ios-obelisk-app-open.jpg guides/app-deploy/assets/nano-edit-nixos-configuration.png guides/app-deploy/assets/virtualbox-appliance-import-loading.png guides/app-deploy/assets/virtualbox-appliance-import.png guides/app-deploy/assets/virtualbox-dashboard-nixos.png guides/app-deploy/assets/virtualbox-image-settings-network.png guides/app-deploy/assets/virtualbox-nioxs-after-boot.png guides/app-deploy/assets/xcode-devices.png haskell-overlays/ghcide.nix+40 haskell-overlays/misc-deps.nix+26 haskell-overlays/obelisk.nix+48 haskell-overlays/tighten-ob-exes.nix+32 hydra.json+29 lib/README.md+3−1 lib/asset/README.md+17−20 lib/asset/assets.nix+28−5 lib/asset/manifest/obelisk-asset-manifest.cabal+5−2 lib/asset/manifest/src/Obelisk/Asset/Gather.hs+5−3 lib/asset/manifest/src/Obelisk/Asset/Promoted.hs+15−5 lib/asset/manifest/src/Obelisk/Asset/Symlink.hs+1−1 lib/asset/serve-snap/obelisk-asset-serve.cabal → lib/asset/serve-snap/obelisk-asset-serve-snap.cabal+4−2 lib/asset/serve-snap/src/Obelisk/Asset/Accept.hs+6−6 lib/asset/serve-snap/src/Obelisk/Asset/Serve/Snap.hs+22−11 lib/backend/obelisk-backend.cabal+19−3 lib/backend/src/Obelisk/Backend.hs+278−21 lib/cliapp/obelisk-cliapp.cabal+37 lib/cliapp/src/Obelisk/CliApp.hs+65 lib/cliapp/src/Obelisk/CliApp/Logging.hs+253 lib/cliapp/src/Obelisk/CliApp/Process.hs+272 lib/cliapp/src/Obelisk/CliApp/Spinner.hs+145 lib/cliapp/src/Obelisk/CliApp/TerminalString.hs+84 lib/cliapp/src/Obelisk/CliApp/Theme.hs+29 lib/cliapp/src/Obelisk/CliApp/Types.hs+132 lib/command/obelisk-command.cabal+27−17 lib/command/src/Obelisk/App.hs+94−12 lib/command/src/Obelisk/CLI.hs−55 lib/command/src/Obelisk/CLI/Logging.hs−115 lib/command/src/Obelisk/CLI/Process.hs−94 lib/command/src/Obelisk/CLI/Spinner.hs−77 lib/command/src/Obelisk/Command.hs+328−177 lib/command/src/Obelisk/Command/Deploy.hs+357−90 lib/command/src/Obelisk/Command/Nix.hs+192−39 lib/command/src/Obelisk/Command/Preprocessor.hs+100 lib/command/src/Obelisk/Command/Project.hs+232−76 lib/command/src/Obelisk/Command/Repl.hs−20 lib/command/src/Obelisk/Command/Run.hs+540−80 lib/command/src/Obelisk/Command/Thunk.hs+992−456 lib/command/src/Obelisk/Command/Utils.hs+247−20 lib/command/src/Obelisk/Command/VmBuilder.hs+202 lib/executable-config/README.md+2−7 lib/executable-config/default.nix+38−15 lib/executable-config/inject/obelisk-executable-config-inject.cabal+6−5 lib/executable-config/inject/src/Obelisk/ExecutableConfig/Inject.hs+18−10 lib/executable-config/lookup/default.nix−24 lib/executable-config/lookup/obelisk-executable-config-lookup.cabal+48 lib/executable-config/lookup/obelisk-executable-config.cabal−30 lib/executable-config/lookup/src-android/Obelisk/ExecutableConfig.hs−27 lib/executable-config/lookup/src-android/Obelisk/ExecutableConfig/Lookup.hs+60 lib/executable-config/lookup/src-ghcjs/Obelisk/ExecutableConfig.hs−17 lib/executable-config/lookup/src-ghcjs/Obelisk/ExecutableConfig/Lookup.hs+51 lib/executable-config/lookup/src-ios/Obelisk/ExecutableConfig.hs−22 lib/executable-config/lookup/src-ios/Obelisk/ExecutableConfig/Lookup.hs+17 lib/executable-config/lookup/src-other/Obelisk/ExecutableConfig/Lookup.hs+11 lib/executable-config/lookup/src/Obelisk/Configs.hs+148 lib/executable-config/lookup/src/Obelisk/Configs/Internal/Directory.hs+24 lib/executable-config/lookup/src/Obelisk/ExecutableConfig.hs−13 lib/frontend/obelisk-frontend.cabal+29 lib/frontend/src/Obelisk/Frontend.hs+254 lib/frontend/src/Obelisk/Frontend/Cookie.hs+103 lib/https/github.json−7 lib/route/README.md+6 lib/route/obelisk-route.cabal+42 lib/route/src/Obelisk/Route.hs+1228 lib/route/src/Obelisk/Route/Frontend.hs+662 lib/route/src/Obelisk/Route/TH.hs+17 lib/run-frontend/obelisk-run-frontend.cabal−28 lib/run-frontend/src/Obelisk/Widget/Run.hs−95 lib/run/obelisk-run.cabal+53 lib/run/src/Obelisk/Run.hs+268 lib/selftest/obelisk-selftest.cabal+17−3 lib/selftest/src/Obelisk/SelfTest.hs+613−12 lib/snap-extras/obelisk-snap-extras.cabal+2−3 lib/snap-extras/src/Obelisk/Snap/Extras.hs+2−2 lib/snap/default.nix−17 lib/snap/obelisk-snap.cabal−39 lib/snap/src/Obelisk/Snap.hs−158 lib/tabulation/CHANGELOG.md+5 lib/tabulation/LICENSE+30 lib/tabulation/Setup.hs+2 lib/tabulation/src/Data/Tabulation.hs+21 lib/tabulation/tabulation.cabal+26 nixpkgs-overlays/default.nix+15 release.nix+7−18 skeleton/.gitignore+14−1 skeleton/.obelisk/.gitignore+3 skeleton/backend/backend.cabal+10−2 skeleton/backend/frontendJs/frontend.jsexe+1 skeleton/backend/src-bin/main.hs+6 skeleton/backend/src/Backend.hs+7−4 skeleton/backend/src/main.hs−5 skeleton/cabal.project+1 skeleton/common/common.cabal+5−1 skeleton/common/src/Common/Api.hs+1−1 skeleton/common/src/Common/Route.hs+47 skeleton/config/common/example+1 skeleton/config/common/route+1 skeleton/default.nix+17−2 skeleton/frontend/frontend.cabal+16−10 skeleton/frontend/src-bin/main.hs+10 skeleton/frontend/src/Frontend.hs+39−9 skeleton/frontend/src/main.hs−5 skeleton/static/main.css+3
.gitattributesnew file+1
@@ -0,0 +1 @@
1+migration/* linguist-vendored linguist-generated=true
.github/pull_request_template.mdnew file+10
@@ -0,0 +1,10 @@
1+<!-- Provide a clear overview of your changes. -->
2+
3+I have:
4+
5+ - [ ] Based work on latest `develop` branch
6+ - [ ] Followed the [contribution guide](https://github.com/obsidiansystems/obelisk/blob/develop/CONTRIBUTING.md#submitting-changes)
7+ - [ ] Looked for lint in my changes with `hlint .` (lint found code you did not write can be left alone)
8+ - [ ] Run the test suite: `$(nix-build -A selftest --no-out-link)`
9+ - [ ] [Updated the changelog](https://github.com/obsidiansystems/obelisk/blob/develop/CONTRIBUTING.md#in-the-changelog)
10+ - [ ] (Optional) Run CI tests locally: `nix-build release.nix -A build.x86_64-linux --no-out-link` (or `x86_64-darwin` on macOS)
.gitignore+3−2
@@ -2,12 +2,13 @@
22**/.cabal-sandbox
33**/cabal.sandbox.config
44result
5+result-*
56*.o
67*.hi
7−
88TAGS
99tags
1010ctags
1111dist-newstyle
1212cabal.project.local
13−.ghc.environment.*
13+.ghc.environment.*
14+**/ghcid-output.txt
.hlint.yamlnew file+65
@@ -0,0 +1,65 @@
1+# HLint configuration file
2+# https://github.com/ndmitchell/hlint
3+##########################
4+
5+# This file contains a template configuration file, which is typically
6+# placed as .hlint.yaml in the root of your project
7+
8+
9+# Specify additional command line arguments
10+#
11+# - arguments: [--color, --cpp-simple, -XQuasiQuotes]
12+
13+
14+# Control which extensions/flags/modules/functions can be used
15+#
16+# - extensions:
17+# - default: false # all extension are banned by default
18+# - name: [PatternGuards, ViewPatterns] # only these listed extensions can be used
19+# - {name: CPP, within: CrossPlatform} # CPP can only be used in a given module
20+#
21+# - flags:
22+# - {name: -w, within: []} # -w is allowed nowhere
23+#
24+# - modules:
25+# - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'
26+# - {name: Control.Arrow, within: []} # Certain modules are banned entirely
27+#
28+# - functions:
29+# - {name: unsafePerformIO, within: []} # unsafePerformIO can only appear in no modules
30+
31+
32+# Add custom hints for this project
33+#
34+# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"
35+# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}
36+
37+
38+# Turn on hints that are off by default
39+#
40+# Ban "module X(module X) where", to require a real export list
41+# - warn: {name: Use explicit module export list}
42+#
43+# Replace a $ b $ c with a . b $ c
44+# - group: {name: dollar, enabled: true}
45+#
46+# Generalise map to fmap, ++ to <>
47+# - group: {name: generalise, enabled: true}
48+
49+
50+# Ignore some builtin hints
51+- ignore: {name: Redundant do}
52+- ignore: {name: Redundant flip}
53+- ignore: {name: Use <$>}
54+- ignore: {name: Use camelCase}
55+- ignore: {name: Use if}
56+- ignore: {name: Use unless}
57+# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules
58+
59+
60+# Define some custom infix operators
61+# - fixity: infixr 3 ~^#^~
62+
63+
64+# To generate a suitable file for HLint do:
65+# $ hlint --default > .hlint.yaml
CONTRIBUTING.md+125−3
@@ -1,9 +1,131 @@
1−## Contributing to Obelisk
1+# Contribution Guide
22
3−Thanks for taking the time to contribute!
3+Contributions and issue reports are encouraged and appreciated!
44
5−Before submitting a pull request, please run the tests:
5+- [Opening Issues](#opening-issues)
6+- [Submitting Changes](#submitting-changes)
7+ - [Guidelines for Commit Messages](#guidelines-for-commit-messages)
8+ - [Guidelines for Pull Requests](#guidelines-for-pull-requests)
9+ - [Code Quality](#code-quality)
10+ - [Documentation](#documentation)
11+- [Development Environment](#development-environment)
612
13+## Opening Issues
14+
15+Before opening an issue, please check whether your issue has already been reported. Assuming it has not:
16+
17+* Describe the issue you're encountering or the suggestion you're making
18+* Include any relevant steps to reproduce or code samples you can. It's always easier for us to debug if we have something that demonstrates the error.
19+* Let us know what version of this project you were using. If you're using a github checkout, provide the git hash.
20+
21+## Submitting Changes
22+
23+Most pull requests should target the `develop` branch. `master` is the release branch. `develop` is periodically merged into master after a period of testing.
24+
25+### Guidelines for Commit Messages
26+
27+#### Summary Line
28+The summary line of your commit message should summarize the changes being made. Commit messages should be written in the imperative mood and should describe what happens when the commit is applied. If your commit modifies one of the in-tree haskell packages (found in `./lib`), please prefix your commit summary with the name of the package being modified.
29+
30+One way to think about it is that your commit message should be able to complete the sentence:
31+"When applied, this commit will..."
32+
33+##### Note on bumping dependencies
34+Commits that update a dependency should include some information about why the dependency was updated in the commit message.
35+
36+#### Body
37+For breaking changes, new features, refactors, or other major changes, the body of the commit message should describe the motivation behind the change in greater detail and may include references to the issue tracker. The body shouldn't repeat code/comments from the diff.
38+
39+### Guidelines for Pull Requests
40+
41+Wherever possible, pull requests should add a single feature or fix a single bug. Pull requests should not bundle several unrelated changes.
42+
43+
44+### Code Quality
45+
46+#### Warnings
47+
48+Your pull request should add no new warnings to the project. It should also generally not disable any warnings.
49+
50+#### Build and Test
51+
52+Make sure the project builds and that the tests pass! This will generally also be checked by CI before merge, but trying it yourself first means you'll catch problems earlier and your contribution can be merged that much sooner!
53+
54+You can run the tests like this:
755```bash
856$(nix-build -A selftest --no-out-link)
957```
58+
59+To test that your changes build across platforms, you can also try to build release.nix, like this:
60+```bash
61+nix-build release.nix
62+```
63+
64+Note, however, that to build release.nix you must accept the android license agreement and your machine must be configured to build both ios and android executables (usually via remote builders).
65+
66+
67+### Documentation
68+
69+#### In the code
70+We're always striving to improve documentation. Please include [haddock](https://haskell-haddock.readthedocs.io/en/latest/index.html) documentation for any added code, and update the documentation for any code you modify.
71+
72+#### In the [Changelog](ChangeLog.md)
73+Add an entry to the changelog when your PR:
74+* Adds a feature
75+* Deprecates something
76+* Includes a breaking change
77+* Makes any other change that will impact users
78+
79+#### In the [Readme](README.md)
80+The readme is the first place a lot of people look for information about the repository. Update any parts of the readme that are affected by your PR.
81+
82+
83+## Development Environment
84+
85+There are two ways to get live compiler feedback while developing Obelisk libraries. For libraries that are dependencies of the `skeleton` application, the easiest way to get feedback is to
86+
87+```bash
88+cd skeleton
89+ob run
90+```
91+
92+This `ob run` session only loads modules that are dependencies of the skeleton and `obelisk-run`. For example, `obelisk-asset` and `obelisk-route` are used by the skeleton.
93+
94+For other libraries like `obelisk-command` you can use `ghcid`. To launch `ghcid` for `lib/command` you can run
95+
96+```bash
97+nix-shell -A obeliskEnvs.obelisk-command --run "cd lib/command && ghcid"
98+```
99+
100+### Building `ob` for testing
101+
102+To re-install `ob` from source globally you can do
103+
104+```bash
105+nix-env -f /path/to/obelisk -iA command
106+```
107+
108+You can also open a shell with the local version of `ob` available on your `$PATH`:
109+
110+```bash
111+nix run -f /path/to/obelisk command
112+```
113+
114+### Hacking on Obelisk from within an Obelisk project
115+
116+`ob` will defer to the version found in your project's `.obelisk/impl` directory. To work on that version specifically:
117+
118+```bash
119+ob thunk unpack ./.obelisk/impl
120+cd ./.obelisk/impl
121+# apply your changes
122+```
123+
124+If you want to commit your changes, first push them to your fork of obelisk and then
125+
126+```bash
127+cd /your/project/root
128+ob thunk pack .obelisk/impl
129+git add .obelisk/impl
130+git commit -m "Bump obelisk"
131+```
ChangeLog.mdnew file+156
@@ -0,0 +1,156 @@
1+# Revision history for obelisk
2+
3+This project's release branch is `master`. This log is written from the perspective of the release branch: when changes hit `master`, they are considered released.
4+
5+## v0.9.1.0
6+
7+* [#801](https://github.com/obsidiansystems/obelisk/pull/801): Remove errors and warning for local packages without a library component
8+* [#812](https://github.com/obsidiansystems/obelisk/pull/812): Add support for `NoImplicitPrelude` and other extensions disabled via `No`
9+* Pinned version bumps:
10+ * reflex-platform [0.7.0.0](https://github.com/reflex-frp/reflex-platform/releases/tag/v0.7.0.0)
11+ * hnix 0.8.0
12+* [#787](https://github.com/obsidiansystems/obelisk/pull/787): Set `immutable` cache control directive when serving content-addressed static assets
13+* Use iOS SDK 13.2
14+
15+
16+## v0.9.0.1
17+
18+* ([#810](https://github.com/obsidiansystems/obelisk/pull/810)) Fix loading of `all.js` in fully compiled web apps.
19+
20+## v0.9.0.0
21+
22+* **(Breaking change)** Backport nixpkgs upgrades to ACME/Let's Encrypt handling so that HTTPS deployments continue to work flawlessly. If your deployment is having trouble renewing [Let's Encrypt](https://letsencrypt.org/) certificates, upgrade to this version.
23+ * **IMPORTANT:** In order to use [Let's Encrypt](https://letsencrypt.org/) you must now accept their [terms of service](https://letsencrypt.org/repository/). To do that, add `terms.security.acme.acceptTerms = true;` to the `import ./.obelisk/impl {` section in your `default.nix`. The new skeleton application may serve as an [example](https://github.com/obsidiansystems/obelisk/blob/4759342ab3570888c027d4c58cb5694cb832d624/skeleton/default.nix#L13).
24+* Update reflex-platform dependency to v0.6.0.0
25+* ([#715](https://github.com/obsidiansystems/obelisk/pull/715)) In `Obelisk.Route` deprecate `isoEncoder` and `prismEncoder` in favor of more precisely named `viewEncoder` and `reviewEncoder` (respectively) and improve documentation regarding contravariance of `reviewEncoder`.
26+* ([#739](https://github.com/obsidiansystems/obelisk/pull/739)) Improve `ob shell` by allowing commands to be passed verbatim after a `--` argument. For example, `ob shell 'run command'` can now be written `ob shell -- run command`.
27+* ([#735](https://github.com/obsidiansystems/obelisk/pull/735)) Fix regression causing custom `Prelude`s to break `ob run`/`ob watch`/`ob repl`.
28+* ([#737](https://github.com/obsidiansystems/obelisk/pull/737)) Fix bug causing custom `Prelude`s to break `ob profile`.
29+* ([#752](https://github.com/obsidiansystems/obelisk/pull/752)) Fix the `ob` command-line tool to return non-zero exit code when underlying processes fail.
30+* ([#742](https://github.com/obsidiansystems/obelisk/pull/742), [#57](https://github.com/obsidiansystems/obelisk/pull/57), [#406](https://github.com/obsidiansystems/obelisk/pull/406)) Enable `-dedupe` and `-DGHCJS_BROWSER` in GHCJS builds to make JavaScript output considerably smaller leading to faster load/parse times and faster build times.
31+ * **Migration:** New Obelisk projects will automatically benefit from this change, but existing projects need to apply a change similar to [this one](https://github.com/obsidiansystems/obelisk/blob/371cb3302085601c5ec73e9574d51c8b95e3e493/skeleton/frontend/frontend.cabal#L32-L34).
32+* ([#742](https://github.com/obsidiansystems/obelisk/pull/742)) Update `reflex-platform` which includes:
33+ * A new version of GHCJS where `-dedupe` is fixed.
34+
35+## v0.8.0.0
36+
37+* ([#674](https://github.com/obsidiansystems/obelisk/pull/674), [#711](https://github.com/obsidiansystems/obelisk/pull/711)) Introduce a new thunk format to support accessing the thunk's source directly when packed. When packed, thunks have an additional file called `thunk.nix` and `default.nix` is now a thin wrapper around that.
38+* ([#665](https://github.com/obsidiansystems/obelisk/pull/665)) Add `--interpret` and `--no-interpret` options to `ob run`/`ob watch`/`ob repl`/`ob shell`. These options allow you to pick which paths will be pre-compiled by `nix` when entering the shell/session and which won't. For example `ob run --no-interpret dep` will ensure that any dependencies found in `./dep` will be built by `nix` before loading the rest of the project into the `ghci` session. The same configuration for `ob shell` will ensure that those packages are built and available in the `ghc` package database inside the shell.
39+
40+ **NOTE:** `ob shell`'s default behavior is now different. By default it now behaves like `ob run`/`ob watch`/`ob repl` in that it does *not* pre-build any packages whose `.cabal` or `package.yaml` files are found in the project. To regain the previous behavior, use `ob shell --no-interpret . --interpret backend --interpret common --interpret frontend` from the project root.
41+* ([#695](https://github.com/obsidiansystems/obelisk/pull/695)) `ob deploy init` now requires that your obelisk project be a clean `git` checkout with pushed changes. It has always required that your obelisk project be a `git` repository, but it did not require that your local changes be committed and pushed. This new requirement is added to ensure users don't accidentally create a deployment pointing to an old version of the project.
42+* ([#705](https://github.com/obsidiansystems/obelisk/pull/705)) Add `Obelisk.Route.packTextEncoder` and generalize `Obelisk.Route.unpackTextEncoder` over any `Data.Text.Lens.IsText`.
43+* ([#712](https://github.com/obsidiansystems/obelisk/pull/712)) Update [`reflex-platform`](https://github.com/reflex-frp/reflex-platform) to version 0.5.3.0.
44+* ([#700](https://github.com/obsidiansystems/obelisk/pull/700)) Ensure `ob init` uses the thunk format of the target obelisk rather than the one currently running the init command. If a user had installed a version of obelisk with a new thunk format, a newly initialized skeleton of an older version would not be able to unpack its own `.obelisk/impl`.
45+* ([#693](https://github.com/obsidiansystems/obelisk/pull/693)) Fix a bug where some packages in `.attr-cache` directories would be incorrectly picked up and used instead of the correct ones when using `ob run`/`ob watch`/`ob repl`.
46+* ([#709](https://github.com/obsidiansystems/obelisk/pull/709)) Fix a bug in obelisk's preprocessor causing it to incorrectly skip files in some circumstances.
47+* ([#663](https://github.com/obsidiansystems/obelisk/pull/663)) Add **experimental** support for [`ghcide`](https://github.com/digital-asset/ghcide). See the README for more information.
48+* ([#714](https://github.com/obsidiansystems/obelisk/pull/714)) Miscellaneous improvements to CLI help and logging.
49+
50+## v0.7.0.1
51+
52+* Fix the version number for `ob` the command-line tool. ([#679](https://github.com/obsidiansystems/obelisk/pull/679))
53+
54+## v0.7.0.0
55+
56+* Fully support HTTP [Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range) requests on static assets to support Safari. ([#664](https://github.com/obsidiansystems/obelisk/pull/664))
57+* Support non-EC2 deployments. ([#658](https://github.com/obsidiansystems/obelisk/pull/658))
58+* Fix `ob deploy test android` to work. ([#645](https://github.com/obsidiansystems/obelisk/pull/645))
59+* Fix vulnerability where Android deployments would leave signing keys in the nix store which is world readable. ([#645](https://github.com/obsidiansystems/obelisk/pull/645)) (Thanks to [kmicklas](https://github.com/kmicklas) for the report.)
60+* Add `Obelisk.Backend.runBackendWith` to allow several customizations. ([#668](https://github.com/obsidiansystems/obelisk/pull/668), [#644](https://github.com/obsidiansystems/obelisk/pull/644))
61+* Add `ob profile` command to run Obelisk projects with profiling. `ob profile` works like `ob run`, but instead of using `ghci`, it builds an executable that is built with profiling enabled. ([#654](https://github.com/obsidiansystems/obelisk/pull/654))
62+* Obelisk's `default.nix` now exposes `mkAssets` function which is used to construct the assets served by an Obelisk application. ([#651](https://github.com/obsidiansystems/obelisk/pull/651))
63+* Bump reflex-platform to v0.5.2.0. ([#671](https://github.com/obsidiansystems/obelisk/pull/671))
64+
65+## v0.6.0.0 - 2020-02-21
66+
67+* Fix a bug in `Obelisk.Route.Frontend` where `routeLink`, `routeLinkDynAttr`, and `dynRouteLink` would not behave exactly like `<a href="...">` when run by JavaScript. These functions now scroll to the top of the page when the link is clicked. ([#540](https://github.com/obsidiansystems/obelisk/pull/540))
68+* Fix a bug in `ob run`/`ob watch`/`ob repl` where nested Obelisk projects would also be loaded into the session. These are now ignored. ([#652](https://github.com/obsidiansystems/obelisk/pull/652))
69+* Improve behavior of `ob run`/`ob watch`/`ob repl` when multiple packages with the same name are encountered. Obelisk now issues a warning and tells you which one it will use. ([#653](https://github.com/obsidiansystems/obelisk/pull/653))
70+* Removed `Obelisk.Backend.mkRouteToUrl` since it is easily written in terms of `Obelisk.Route.renderObeliskRoute`:
71+
72+ mkRouteToUrl validFullEncoder (k :/ v) = renderObeliskRoute validFullEncoder (FullRoute_Frontend (ObeliskRoute_App k) :/ v)
73+
74+* Add `Obelisk.Backend.renderAllJsPath` to expose URL path to `ghcjs/all.js`. ([#545](https://github.com/obsidiansystems/obelisk/pull/545))
75+* Add argument to `serveDefaultObeliskApp`, `serveObeliskApp`, and `serveGhcjsApp` to take the path to `all.js` instead of hard-coding it. ([#545](https://github.com/obsidiansystems/obelisk/pull/545))
76+
77+## v0.5.0.0 - 2020-02-07
78+
79+* Add `Obelisk.Route.(?/)`, a convenience function for constructing routes nested in `Maybe`. ([#457](https://github.com/obsidiansystems/obelisk/pull/457))
80+* Add local unpacked packages to the `ob run`, `ob watch`, and `ob repl` sessions. Any `.cabal` or hpack package inside the current obelisk project will be loaded into the session. For `ob run`/`ob watch` this means the session will automatically reload when you save a source file in any of those packages. For `ob repl` it means that `:r` will reload changes to any of those packages. There are some edge cases where this integration is still rough. Report any issues you encounter. ([#489](https://github.com/obsidiansystems/obelisk/pull/489))
81+* Add `ob hoogle` command to start a local [Hoogle](https://hoogle.haskell.org/) server for the project. ([#628](https://github.com/obsidiansystems/obelisk/pull/628))
82+* `ob thunk pack` will now attempt to automatically detect if the thunk is a private or public repo. To avoid this detection, specify `--private` or `--public` manually. ([#607](https://github.com/obsidiansystems/obelisk/pull/607))
83+* Fix a bug in the plain git thunk loader for thunks marked as 'private' when the revision is not in the default branch. ([#648](https://github.com/obsidiansystems/obelisk/pull/648))
84+* Improve handling of runtime nix dependencies. This may fix some issues encountered particularly by users on systems other than NixOS.
85+
86+## v0.4.0.0 - 2020-01-10
87+
88+* Bump reflex-platform which, notably, bumps nixpkgs to 19.09. ([#585](https://github.com/obsidiansystems/obelisk/pull/585))
89+* Add new thunk loader for Git repositories that supports `file://` Git remotes and supports private repositories via `builtins.fetchGit` for private repositories (when the `git.json` file specifies `"private": true`). ([#594](https://github.com/obsidiansystems/obelisk/pull/594))
90+* Add a new thunk loader for GitHub repositories that uses `builtins.fetchTarball` for public repositories to increase loader performance and uses `fetchFromGitHub` for private repositories (when the `github.json` file specifies `"private": true`). Note that `fetchFromGitHub` requires some Nix configuration for the Nix builder to access the repository. If `ob thunk pack` fails in this case, use `-v` to see Nix's helpful message. ([#594](https://github.com/obsidiansystems/obelisk/pull/594))
91+* Add `--public`/`--private` options to `ob thunk pack` to specify if a repository should be treated as a public or private. ([#594](https://github.com/obsidiansystems/obelisk/pull/594))
92+* Improve error messaging when a dependency doesn't have the expected `.cabal` or `package.yaml` file. ([#597](https://github.com/obsidiansystems/obelisk/pull/597))
93+* Improve the skeleton in small ways. ([#593](https://github.com/obsidiansystems/obelisk/pull/593), [#589](https://github.com/obsidiansystems/obelisk/pull/589))
94+* Fix `ob` commands to again support running from any subdirectory of an obelisk project ([#591](https://github.com/obsidiansystems/obelisk/pull/591))
95+* Add `reflex-platform-func` argument to Obelisk's `default.nix`. It defaults to its prior behavior of using the reflex-platform in in `dep`. ([#612](https://github.com/obsidiansystems/obelisk/pull/612))
96+
97+## v0.3.0.0 - 2019-12-20
98+
99+* Change the structure of Obelisk routes to use a designated
100+ `FullRoute` type. This combines frontend and backend routes into one
101+ structure. This is a **breaking** change which requires Obelisk apps
102+ to take specific migrations. They are:
103+ * Rewrite the implementation of `_backend_routeEncoder` in
104+ `Backend` to use `mkFullRouteEncoder` instead of
105+ `handleEncoder`. Specifically, the backend and frontend cases of
106+ the top-level `pathComponentEncoder` become the second and third
107+ arguments of `mkFullRouteEncoder` respectively, while the
108+ missing route becomes the first argument. An example of how to
109+ do this is available in [a reflex-examples
110+ commit](https://github.com/reflex-frp/reflex-examples/commits/28f566c3e7dc615578dc74297b7c620c1f13683e).
111+ * Replace type constructions of `InL` with `FullRoute_Backend` and
112+ `InR` with `FullRoute_Frontend`.
113+* Generalised `pathSegmentEncoder`, added `pathFieldEncoder`.
114+* Added some `Prism`s to the encoder library for manipulating `DSum`s.
115+* Add `ob doc` command, which lists paths to haddock documentation for specified packages.
116+* Bump reflex-platform so that obelisk now uses GHC 8.6.5 and the nixos-19.03 nixpkgs set.
117+* Add support in `obelisk-route` for single parameters in URL paths.
118+* Bump reflex-platform so that obelisk now uses reflex-dom 0.5.2.0.
119+* Use a `--pure` nix shell in `ob run` for parity with `ob repl` and more resilience against "works on my machine".
120+* Pin usages of `<nixpkgs>` in obelisk thunks, etc. to the nixpkgs used by the project's obelisk impl.
121+* Backport ACMEv2 support in obelisk server to regain LetsEncrypt account creation.
122+* Enable HTTPS in `ob run`.
123+* `ob run` now handles `ghci` errors better, and includes a custom `ghcid`
124+ version. As a result, you no longer need to have ghcid installed to
125+ use `ob run`, as we provide one for you.
126+* `ob` commands now complain less on systems with umasks other than `0022`.
127+* Ignore package environment files in `ob run` and `ob repl`.
128+* Add `Obelisk.Route.Frontend.routeLinkDynAttr`.
129+
130+## v0.2.0.0 - 2019-8-17
131+
132+* Configs become ByteStrings.
133+* FrontendConfigsT has been changed into ConfigsT and configs are made available via getConfig/getConfigs
134+ * The frontend will still only have access to configs that are placed in config/frontend and config/common, while the backend has access to the entire contents of the config directory via `Obelisk.ExecutableConfig.Lookup.getConfigs`.
135+* The backend no longer runs in BackendConfigsT.
136+* Add tabulation package. See Data.Tabulation for details.
137+* Add encoders for `DMap`, `HasFields` (cf. Data.Tabulation), and JSON.
138+* Use IP address for nginx proxy pass instead of localhost
139+
140+## v0.1.1.0 - 2019-05-17
141+
142+* Fix crashes of Android apps on 32-bit ARM devices.
143+* Provide a way to indicate acceptance of the Android SDK license by passing `config.android_sdk.accept_license = true;` in the arguments to the import of `.obelisk/impl` in the project's `default.nix`.
144+* Add `COMPLETE` pragma to `(:/)`. Using this pattern synonym should no longer generate spurious warnings about non-exhaustive pattern matching.
145+* Make asset path hashing strict (see `Obelisk.Asset.Gather`)
146+* Add the `ob shell` command to enter a nix shell for an obelisk project
147+* Allow skeleton's obelisk to be overridden. This changes the skeleton's default.nix interface: the arguments that it used to take are now part of the new "obelisk" argument.
148+* Removed `MonadIO` from `ObeliskWidget` to prevent accidental IO during prerendering. If you need to do IO in a widget it should be on the right hand side of a `prerender`.
149+* Significantly changed the interface to the "executable config" packages. `obelisk-executable-config-lookup` is a new internal package which looks up all configs in a platform-specific way. `obelisk-executable-frontend` and `obelisk-executable-backend` provide MTL-style monad classes (`HasFrontendConfigs` and `HasBackendConfigs`) which the frontend and backend, respectively, can use to look up configs. This replaces the old `get` function which ran in `IO`.
150+* Add a flag to force thunk packing even if there are unpushed changes in the unpacked thunk.
151+
152+
153+## v0.1.0.0 - 2019-03-29
154+
155+* Use reflex-dom's `HydrationDomBuilder` to "hydrate" statically rendered DOM served by the Obelisk backend (rather than re-creating DOM and replacing it all).
156+* Add `HasCookies` and `CookiesT` to allow `ObeliskWidget`s to access cookies during static and "hydrated" DOM rendering.
FAQ.mdnew file+117
@@ -0,0 +1,117 @@
1+# Frequently Asked Questions
2+
3+1. [How do I declare a new Haskell dependency?](#how-do-i-declare-a-new-haskell-dependency)
4+1. [How do I add or override Haskell dependencies in the package set?](#how-do-i-add-or-override-haskell-dependencies-in-the-package-set)
5+1. [How do I extend my Obelisk application with more local packages?](#how-do-i-extend-my-obelisk-application-with-more-local-packages)
6+1. [How do I use `ob run` over HTTPS?](#how-do-i-use-ob-run-over-https)
7+1. [How do I fix invalid entitlements?](#how-do-i-fix-invalid-entitlements)
8+1. [`ob thunk update` or `ob deploy update` fails](#ob-thunk-update-or-ob-deploy-update-fails)
9+1. [How do I fix `Ambiguous module name` errors?](#how-do-i-fix-ambiguous-module-name-errors)
10+
11+### How do I declare a new Haskell dependency?
12+
13+Every component of your Obelisk application is a standard [cabal](https://www.haskell.org/cabal/) package. That means declaring new Haskell dependencies simply involves updating the `build-depends` field in the appropriate cabal file (`backend.cabal` for example). By default, Obelisk will use its curated package set to choose which version of each package you get. It's possible that the package you need is not already in the curated set or the curated version isn't the one you want. See [How do I add or override Haskell dependencies in the package set?](#how-do-i-add-or-override-haskell-dependencies-in-the-package-set) for a solution to this.
14+
15+### How do I add or override Haskell dependencies in the package set?
16+
17+To add a Haskell package that doesn't exist in Obelisk's package set or to override the version of a package, use the `overrides` attribute in your project's `default.nix`. For example, to use a specific version of the `aeson` package fetched from GitHub and a specific version of the `waargonaut` package fetched from Hackage, your `default.nix` will look like:
18+
19+```nix
20+# ...
21+project ./. ({ pkgs, ... }: {
22+# ...
23+ overrides = self: super: let
24+ aesonSrc = pkgs.fetchFromGitHub {
25+ owner = "obsidiansystems";
26+ repo = "aeson-gadt-th";
27+ rev = "ed573c2cccf54d72aa6279026752a3fecf9c1383";
28+ sha256 = "08q6rnz7w9pn76jkrafig6f50yd0f77z48rk2z5iyyl2jbhcbhx3";
29+ };
30+ in
31+ {
32+ aeson = self.callCabal2nix "aeson" aesonSrc {};
33+ waargonaut = self.callHackageDirect {
34+ pkg = "waargonaut";
35+ ver = "0.8.0.1";
36+ sha256 = "1zv28np3k3hg378vqm89v802xr0g8cwk7gy3mr77xrzy5jbgpa39";
37+ } {};
38+ };
39+# ...
40+```
41+
42+For further information see [the Haskell section](https://nixos.org/nixpkgs/manual/#users-guide-to-the-haskell-infrastructure) of nixpkgs "Contributors Guide".
43+
44+### How do I extend my Obelisk application with more local packages?
45+
46+If the standard packages (`frontend`, `backend`, and `common`) are not enough, you may add more local packages by defining them with the `packages` attribute in your `default.nix`. The sources of these packages will be automatically loaded by `ob run`/`ob repl`/etc.
47+
48+```nix
49+# ...
50+project ./. ({ pkgs, ... }: {
51+# ...
52+ packages = {
53+ another = ./dep/another;
54+ };
55+# ...
56+```
57+
58+### How do I use `ob run` over HTTPS?
59+
60+To run your app locally over HTTPS, update the protocol in `config/common/route` to `https`, and then use `ob run` as normal.
61+
62+Obelisk generates a self-signed certificate for running HTTPS so the browser will issue a warning about using an invalid certificate. On Chrome, you can go to `chrome://flags/#allow-insecure-localhost` to enable invalid certificates for localhost.
63+
64+
65+### How do I fix invalid entitlements?
66+
67+You probably did not set `ios.bundleIdentifier` correctly in `default.nix`. When this happens you'll see an error something like this:
68+
69+```
70+2018-11-25 09:34:22.438 ios-deploy[58106:8521046] [ !! ] Error 0xe8008016: The executable was signed with invalid entitlements. AMDeviceSecureInstallApplication(0, device, url, options, install_callback, 0)
71+```
72+
73+Fixing the value of `ios.bundleIdentifier` should fix the error.
74+
75+### `ob thunk update` or `ob deploy update` fails
76+Whenever an `ob` command fails, try re-running it with `-v`.
77+
78+If you're using a private repo, and you get a failure in `nix-prefetch-url`, you may need to unpack and repack the thunk. Here's some example output that shows this issue:
79+
80+```
81+Starting Obelisk </nix/store/j8wls8a89xr6s1a47lg6g83gnbdrfd0l-obelisk-command-0.1/bin/.ob-wrapped> args=["deploy","update","-v"] logging-level=Debug
82+Creating process: 'nix-build' './.obelisk/impl' '-A' 'command' '--no-out-link'
83+✔ Built on ./.obelisk/impl [command]
84+Handing off to /nix/store/j8wls8a89xr6s1a47lg6g83gnbdrfd0l-obelisk-command-0.1/bin/ob
85+Starting Obelisk </nix/store/j8wls8a89xr6s1a47lg6g83gnbdrfd0l-obelisk-command-0.1/bin/.ob-wrapped> args=["--no-handoff","deploy","update","-v"] logging-level=Debug
86+Creating process: 'git' 'ls-remote' '--exit-code' '--symref' 'https://github.com/obsidiansystems/some-private-repo.git' 'refs/heads/master'
87+git ls-remote maps: (fromList [],fromList [(GitRef_Branch "master","8546dfc8be9653f20bb26214e0991dbb957cb290")])
88+Latest commit in branch master from remote repo https://github.com/obsidiansystems/some-private-repo.git is 8546dfc8be9653f20bb26214e0991dbb957cb290
89+Creating process: 'nix-prefetch-url' '--unpack' '--type' 'sha256' 'https://github.com/obsidiansystems/some-private-repo/archive/8546dfc8be9653f20bb26214e0991dbb957cb290.tar.gz'
90+error: unable to download 'https://github.com/obsidiansystems/some-private-repo/archive/8546dfc8be9653f20bb26214e0991dbb957cb290.tar.gz': HTTP error 404
91+Process exited with code 1; 'nix-prefetch-url' '--unpack' '--type' 'sha256' 'https://github.com/obsidiansystems/some-private-repo/archive/8546dfc8be9653f20bb26214e0991dbb957cb290.tar.gz'
92+nix-prefetch-url: Failed to determine sha256 hash of URL https://github.com/obsidiansystems/some-private-repo/archive/8546dfc8be9653f20bb26214e0991dbb957cb290.tar.gz
93+✖ Updating thunk ./src to latest
94+```
95+
96+And here's how you can fix it:
97+
98+```bash
99+ob thunk unpack $SOME_THUNK
100+ob thunk pack $SOME_THUNK
101+```
102+Substitute the directory of your thunk for `$SOME_THUNK`. In the case of `ob deploy update`, `$SOME_THUNK` will be `src` in the deployment directory.
103+
104+(Based on issue #351).
105+
106+### How do I fix `Ambiguous module name` errors?
107+Since obelisk places the common/backend/frontend modules packages into the same ghci, and ghci doesn't "sandbox" them, it is possible to have conflicting module errors inside `ob repl/watch/run` that do not appear when doing a cabal build.
108+
109+You can disambiguate this via [PackageImports](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#package-qualified-imports). For instance, if you see
110+```
111+error:
112+ Ambiguous module name ‘Crypto.Hash’:
113+ it was found in multiple packages:
114+ cryptohash-0.11.9 cryptonite-0.25
115+```
116+then specify the package you want in the import, e.g:
117+`import "cryptonite" Crypto.Hash`
LICENSEnew file+30
@@ -0,0 +1,30 @@
1+Copyright (c) 2020 Obsidian Systems
2+
3+All rights reserved.
4+
5+Redistribution and use in source and binary forms, with or without
6+modification, are permitted provided that the following conditions are met:
7+
8+ * Redistributions of source code must retain the above copyright
9+ notice, this list of conditions and the following disclaimer.
10+
11+ * Redistributions in binary form must reproduce the above
12+ copyright notice, this list of conditions and the following
13+ disclaimer in the documentation and/or other materials provided
14+ with the distribution.
15+
16+ * Neither the name of Elliot Cameron nor the names of other
17+ contributors may be used to endorse or promote products derived
18+ from this software without specific prior written permission.
19+
20+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
README.md+306−35
@@ -1,55 +1,326 @@
1−## Installation
1+# Obelisk
2+
3+[![Haskell Programming Language](https://img.shields.io/badge/language-Haskell-blue.svg)](http://www.haskell.org)
4+[![BSD3 License](http://img.shields.io/badge/license-BSD3-brightgreen.svg)](https://github.com/obsidiansystems/obelisk/blob/master/LICENSE)
5+
6+<p align="center"><img src="docs/obelisk-logo-640.png" width="50%" alt="Obelisk Logo"></p>
7+
8+Functional reactive web and mobile applications, with batteries included. Obelisk's goal is to represent a cohesive, highly-curated set of choices that [Obsidian Systems](https://obsidian.systems/) has made for building these types of applications in a way that is extremely fast but does not compromise on production readiness.
9+
10+- [Overview](#overview)
11+ - [Who should consider using it?](#who-should-consider-using-it)
12+- [Installing Obelisk](#installing-obelisk)
13+- [Developing an Obelisk project](#developing-an-obelisk-project)
14+ - [IDE Support](#ide-support)
15+- [Deploying](#deploying)
16+ - [Default EC2 Deployment](#default-ec2-deployment)
17+ - [Custom Non-EC2 Deployment](#custom-non-ec2-deployment)
18+ - [VirtualBox Deployment](#virtualbox-deployment)
19+ - [Locally](#locally)
20+ - [From macOS](#from-macos)
21+ - [Deploying an updated version](#deploying-an-updated-version)
22+- [Mobile](#mobile)
23+ - [iOS](#ios)
24+ - [Android](#android)
25+- [Frequently Asked Questions (FAQ)](#frequently-asked-questions-faq)
26+- [Contributing](#contributing)
27+
28+## Overview
29+
30+Obelisk allows you to build high-quality web and mobile applications very quickly using [Reflex](https://reflex-frp.org/). In minutes you can go from an empty directory to an interactive application that works on web, iOS, and Android, all sharing the same Haskell codebase! Obelisk's development environment also enables extremely rapid development and feedback. You can take advantage of Haskell's type system across the frontend and backend boundary. This means changes to your backend that would break your frontend are immediately detected during development and vice versa. Obelisk uses Haskell's compiler to give you a complete "TODO list" of what needs to be updated.
31+
32+Obelisk is targeted primarily at Haskell developers who want to build high-quality web and/or mobile applications in Haskell, without the distractions of manually choosing and integrating technology for every piece of the system.
33+
34+### Who should consider using it?
35+
36+Obelisk assumes basic knowledge of [Haskell](https://www.haskell.org/) and [Reflex/Reflex-DOM](https://reflex-frp.org/), web technologies like [HTML](https://developer.mozilla.org/en-US/docs/Web/HTML) and [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS), and a terminal shell like [Bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell)). Knowledge of [Nix](https://nixos.org/) helps but is not strictly necessary.
37+
38+
39+## Installing Obelisk
40+
41+1. [Install Nix](https://nixos.org/nix/).
42+ If you already have Nix installed, make sure you have version 2.0 or higher. To check your current version, run `nix-env --version`.
2431. Set up nix caches
3− 1. Add this to `/etc/nixos/configuration.nix`:
4− ```
44+ 1. If you are running NixOS, add this to `/etc/nixos/configuration.nix`:
45+ ```nix
546 nix.binaryCaches = [ "https://nixcache.reflex-frp.org" ];
647 nix.binaryCachePublicKeys = [ "ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=" ];
748 ```
8−1. Get set up to access private repositories
9− 1. [Get set up to connect to GitHub with SSH](https://help.github.com/articles/connecting-to-github-with-ssh/)
10− 1. [Create a GitHub personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/)
11− 1. Add this to `/etc/nixos/configuration.nix`:
49+ and rebuild your NixOS configuration (e.g. `sudo nixos-rebuild switch`).
50+ 1. If you are using another operating system or Linux distribution, ensure that these lines are present in your Nix configuration file (`/etc/nix/nix.conf` on most systems; [see full list](https://nixos.org/nix/manual/#sec-conf-file)):
51+ ```nix
52+ binary-caches = https://cache.nixos.org https://nixcache.reflex-frp.org
53+ binary-cache-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=
54+ binary-caches-parallel-connections = 40
1255 ```
13− nix.envVars = {
14− NIX_GITHUB_PRIVATE_USERNAME = "your-github-username";
15− NIX_GITHUB_PRIVATE_PASSWORD = "your-github-personal-access-token";
16− };
17− ```
18− 1. `nix-env -i hub` OR `nix-env -iA nixos.gitAndTools.hub`
19− 1. `hub clone obsidiansystems/obelisk`
20− * NOTE: you must authenticate with hub at least once, because the `ob` command uses `hub` for authentication
21− #TODO: Make ob do this itself (either invoke hub automatically or not depend on hub)
22−1. Install `ob`: `nix-env -f obelisk -iA command`.
23− Alternatively, if you prefer not to install to your user nix environment, you can
24− enter a shell with the `ob` command available: `nix-shell -A shell`.
56+ * If you're on a Linux distribution other than NixOS, enable sandboxing (see these [issue 172](https://github.com/obsidiansystems/obelisk/issues/172#issuecomment-411507818) or [issue 6](https://github.com/obsidiansystems/obelisk/issues/6) if you run into build problems) by adding the following:
57+ ```nix
58+ sandbox = true
59+ ```
60+ * If you're on MacOS, disable sandboxing (there are still some impure dependencies for now) by adding the following:
61+ ```nix
62+ sandbox = false
63+ ```
64+ then restart the nix daemon
65+ ```bash
66+ sudo launchctl stop org.nixos.nix-daemon
67+ sudo launchctl start org.nixos.nix-daemon
68+ ```
69+1. Install obelisk:
70+ ```bash
71+ nix-env -f https://github.com/obsidiansystems/obelisk/archive/master.tar.gz -iA command
72+ ```
73+
74+### Accessing private repositories
75+
76+To allow the Nix builder to access private git repositories, you must be set up
77+to access them via SSH. Follow these steps depending on the platform you need
78+access to:
79+
80+- [GitHub](https://help.github.com/articles/connecting-to-github-with-ssh/)
81+- [GitLab](https://docs.gitlab.com/ee/gitlab-basics/create-your-ssh-keys.html)
82+
83+## Developing an Obelisk project
84+
85+To create a new Obelisk project, go to an empty directory and run:
86+
87+```bash
88+ob init
89+```
90+
91+Obelisk leverages ghcid to provide a live-reloading server that handles both frontend and backend. To run your Obelisk app and monitor the source for changes:
92+
93+```bash
94+ob run
95+```
2596
26−## Building
27−Build the frontend by running
97+Now, with an appropriate browser, go to http://localhost:8000 (or the address/port specified in `config/common/route`) to access your app.
98+Firefox will not be able to properly run the development website due to [issue 460](https://github.com/obsidiansystems/obelisk/issues/460). Fortunately, this problem does not occur on a fully built website.
99+
100+Every time you change the Haskell source files in frontend, common or backend, `ob run` will automatically recompile the modified files and reload the server. Furthermore, it will display on screen compilation errors and warnings if any.
101+
102+### IDE Support
103+
104+Obelisk officially supports terminal-based feedback (akin to [`ghcid`](https://github.com/ndmitchell/ghcid)) in `ob run` and `ob watch`.
105+
106+## Deploying
107+
108+### Default EC2 Deployment
109+
110+In this section we will demonstrate how to deploy your Obelisk app to an Amazon EC2 instance. Obelisk deployments are configured for EC2 by default (see [Custom Non-EC2 Deployment](#custom-non-ec2-deployment)).
111+
112+First create a new EC2 instance:
113+
114+1. Launch a NixOS 19.09 EC2 instance (we recommend [this AMI](https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#LaunchInstanceWizard:ami=ami-00a8eeaf232a74f84))
115+1. In the instance configuration wizard ensure that your instance has at least 1GB RAM and 10GB disk space.
116+1. When prompted save your AWS private key (`~/myaws.pem`) somewhere safe. We'll need it later during deployment.
117+1. Go to "Security Groups", select your instance's security group and under "Inbound" tab add a new rule for HTTP port 80 and HTTPS port 443.
118+
119+At this stage your instance should be booting and become accessible shortly. Note down the hostname of your EC2 instance.
120+
121+Now go to your Obelisk project directory (`~/code/myapp`), and initialize a deployment config (`~/code/myapp-deploy`):
122+Your project directory must be "thunkable", i.e. something on which `ob thunk pack` can be called. Usually it will be a git repository whose current revision has been pushed upstream.
28123
29124```bash
30−nix-build -A ghcjs.frontend --out-link frontend-js
125+cd ~/code/myapp
126+SERVER=ec2-35-183-22-197.ca-central-1.compute.amazonaws.com
127+ROUTE=https://myapp.com # Publicly accessible route to your app
128+EMAIL=myname@myapp.com
129+ob deploy init \
130+ --ssh-key ~/myaws.pem \
131+ --hostname $SERVER \
132+ --route $ROUTE \
133+ --admin-email $EMAIL \
134+ ~/code/myapp-deploy
31135```
32136
33−Now you can try running the backend in GHCi by running
137+HTTPS is enabled by default; to disable HTTPS pass `--disable-https` to the `ob deploy init` command above.
138+
139+This step will also require that you manually verify the authenticity of the host `$SERVER`. Obelisk will save the fingerprint in a deployment-specific configuration. **Obelisk deployments do *not* rely on the `known_hosts` of your local machine.** This is because, in the event that you need to switch from one deploy machine / bastion host to another, you want to be absolutely sure that you're still connecting to the machines you think you are, even if that deploy machine / bastion host has never connected to them before. Obelisk explicitly avoids a workflow that encourages people to accept host keys without checking them, since that could result in leaking production secrets to anyone who manages to MITM you, e.g. via DNS spoofing or cache poisoning. (Note that an active attack is a circumstance where you may need to quickly switch bastion hosts, e.g. because the attacker has taken one down or you have taken it down in case it was compromised. In this circumstance you might need to deploy to production to fix an exploit or rotate keys, etc.) When you run `ob deploy` later it will rely on the saved verification in this step.
140+
141+Next, go to the deployment directory that you just initialized and deploy!
34142
35143```bash
36−ob repl backend
144+cd ~/code/myapp-deploy
145+ob deploy push
146+```
147+
148+`ob deploy push` will locally build your app and then transfer it, along with all the Nix package dependencies, via ssh to the EC2 instance. The backend will live in `/var/lib/backend`.
149+
150+At this point you are done. Your app will be accessible at `${ROUTE}`. The currently deployed version - the git commit hash of the source repo - can be found at `${ROUTE}/version`.
151+
152+### Custom Non-EC2 Deployment
153+
154+By default Obelisk deployments are configured for NixOS machines running on AWS EC2. To provide your own configuration, you need to write a custom `module.nix` in the deployment repository. This still requires that your server is running NixOS.
155+
156+`module.nix` must contain a Nix *function* that produces a [NixOS module function](https://nixos.org/nixos/manual/index.html#sec-writing-modules). The top-level function takes deployment configuration as arguments: `hostName`, `adminEmail`, `routeHost`, `enableHttps`, `version`, `exe`, `nixosPkgs`. Most of these are the values you specified during `ob deploy init` and are stored in the deployment repository. `version` is a `git` hash for the app that you're deploying. `exe` is the Linux build of the app (as seen in [Deploying Locally](#locally)). `nixosPkgs` is the package set used to construct the NixOS VM.
157+
158+The [VirtualBox Deployment](#virtualbox-deployment) section provides an example.
159+
160+#### VirtualBox Deployment
161+
162+Here's a `module.nix` that is configured for deployment to a VirtualBox VM (running NixOS):
163+
164+```nix
165+{ nixosPkgs, ... }: {...}: {
166+ imports = [ (nixosPkgs.path + /nixos/modules/virtualisation/virtualbox-image.nix) ];
167+}
37168```
38−and then typing
169+
170+The `{...}:` and following is the [NixOS module](https://nixos.org/nixos/manual/index.html#sec-writing-modules) definition.
171+
172+### Locally
173+
174+If you want deploy your application locally or test a production-oriented build you can build and deploy the app as described below.
175+
176+Build the application:
39177
40178```bash
41−backend
179+nix-build -A exe --no-out-link
42180```
43181
44−at the GHCi prompt.
182+Copy the result to a new directory, add configuration, and run!
183+
184+```bash
185+mkdir test-app
186+ln -s $(nix-build -A exe --no-out-link)/* test-app/
187+cp -r config test-app
188+(cd test-app && ./backend)
189+```
190+
191+### From macOS
192+
193+Deploying from macOS requires some extra setup:
194+
195+- [Install nix-darwin](https://github.com/LnL7/nix-darwin)
196+- [Install docker](https://docs.docker.com/)
197+
198+Running `ob deploy push` will give you additional setup instructions.
199+
200+### Deploying an updated version
201+
202+If you'd like to deploy an updated version (with new commits) of your Obelisk app: simply go to the configuration directory, update the source thunk and push:
203+
204+```bash
205+cd ~/code/myapp-deploy
206+ob deploy update
207+ob deploy push
208+```
209+
210+## Mobile
211+Until Obelisk offers a `ob deploy` equivalent for mobile apps, you are recommended to do it manually as follows.
212+
213+### iOS
214+
215+#### First time setup
216+Development on iOS requires a computer running macOS and an iOS developer account.
217+Your account must also belong to an Apple Developer Team, if you want to access developer portal links (otherwise they'll redirect to your account page).
218+
219+##### iPhone
220+1. Connect the iPhone on which you'd like to run builds - this will open up iTunes.
221+1. Click accept to authorize on both the computer and the iPhone.
222+
223+##### Xcode
224+Install Xcode 11.2 (contains iOS SDK 13.2) and open it so that it runs its post install tool setup.
225+
226+These versions will work out of the box but iOS SDKs prior to 11.3 should also work. You can choose another installed version in `default.nix`
227+
228+More recent Xcodes should also work, as long as one of the SDKs mentioned above has been used.
229+To add another SDK to your current Xcode, [download](https://developer.apple.com/download/more/) the corresponding Xcode, extract it and copy its SDK folder next to the installed one, e.g.
230+```bash
231+open -W Xcode_9.2.xip
232+sudo cp -R Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk
233+```
234+
235+
236+You can verify that you have correct versions by running
237+```bash
238+xcodebuild -showsdks
239+```
240+
241+##### Certificates
242+To deploy and/or package apps, you'll need to inform Apple of your development devices and permissions by
243+adding credentials to the correct provisioning profile via the Apple Developer portal.
244+
245+1. Open up XCode and go to Preferences - Accounts. Select the organization
246+Member role, click Manage Certificates, and add an iOS Development
247+certificate.
248+1. Go to [developer portal - devices](https://developer.apple.com/account/ios/device/) and add your device.
249+To find your device's UDID, select it in iTunes and click the serial number.
250+1. Go to [developer portal - development profiles](https://developer.apple.com/account/ios/profile/limited).
251+Create a development profile and add your certificate and device.
252+Click "Generate" and then download and open the profile.
253+
254+#### Building
255+1. In your project's `default.nix` set values for `ios.bundleIdentifier` and `ios.bundleName`.
256+Ensure that `bundleIdentifier` matches the App ID of the development profile, or that you are using a wildcard profile.
257+1. Run `nix-build -A ios.frontend -o result-ios` to build the app. Find it at `result-ios/frontend.app`
258+
259+#### Deploying
260+1. Connect the registered iPhone.
261+1. Find your Apple Team ID in the [developer portal](https://developer.apple.com/account/#/membership).
262+1. Run the deploy command with your Team ID:
263+```bash
264+result-ios/bin/deploy [TEAM_ID]
265+# or in debug mode via lldb:
266+result-ios/bin/deploy [TEAM_ID] -d
267+```
268+
269+#### Packaging
270+1. Go to [developer portal - distribution profiles](https://developer.apple.com/account/ios/profile/production).
271+Create and download a distribution profile.
272+1. Run the package script with your TEAM ID and your distribution profile to create a `.ipa`:
273+```bash
274+result-ios/bin/package [TEAM_ID] /path/to/output/.ipa /path/to/profile/file
275+```
276+
277+#### Debugging
278+It's also possible to inspect iOS WkWebView apps once they are installed in the iPhone:
279+1. On the desktop, go to Safari > Preferences > Advanced and enable Develop menu.
280+1. On the iPhone go to Settings > Safari > Advanced and enable Web Inspector.
281+1. Open the app on the iPhone while it is connected to the desktop.
282+1. In the desktop's Safari Develop menu, you should see your iPhone. Select the screen under the name of the app.
283+
284+### Android
285+
286+NOTE: Currently Android builds are only supported on Linux.
287+
288+1. In your project's `default.nix` set a suitable value for `android.applicationId` and `android.displayName`.
289+1. In your project's `default.nix` pass `config.android_sdk.accept_license = true;` in the arguments to the import of of `.obelisk/impl` to indicate your acceptance of the [Android Software Development Kit License Agreement](https://developer.android.com/studio/terms), which is required to build Android apps.
290+1. Run `nix-build -A android.frontend -o result-android` to build the Android app.
291+1. A debug version of the app should be generated at `result-android/android-app-debug.apk`
292+
293+Now deploy the built apk file to your Android device:
294+
295+1. Enable *USB debugging* in your Android device ([instructions here](https://developer.android.com/studio/debug/dev-options))
296+1. Connect the device using USB (be sure to confirm any security prompts on the device)
297+1. Run the deploy script: `result-android/bin/deploy`
298+
299+Alternatively, you can deploy from an obelisk deployment directory (a directory generated post `ob deploy init ...` command) using the `ob deploy test android` command.
300+This command will accomplish the following:
301+
302+1. Create a key store and apk signing key (`android_keystore.jks`)
303+1. Build a Signed Android apk for your application
304+1. Deploy the Signed apk to your connected Android device
305+
306+In the event that you change your key or keystore password, you will have to update your credentials within the JSON object found in `android_keytool_config.json`.
307+
308+Additional documentation on Java key stores can be found [here](https://docs.oracle.com/javase/8/docs/technotes/tools/unix/keytool.html).
309+
310+This should copy over and install the application on your device (if you see a "*signatures do not match*" error, simply uninstall the previous app from the device before retrying the deploy). The name of the installed application will be what you have specified for `android.displayName` in the `default.nix`.
311+
312+#### Releasing to Play Store
313+
314+##### Build a release version
315+
316+After having configured signing for your app, you may proceed to build a release version of the app. This is no different to how you build the non-release version, so consult the section [Android](#android) further above for exact instructions on building and deploying to your device.
317+
318+
319+## Frequently Asked Questions (FAQ)
320+
321+Refer to [FAQ](FAQ.md).
45322
46−Point your web browser at [localhost:8000](localhost:8000) and everything should work.
47323
48−Feel free to edit the frontend and backend directories as you see fit.
324+## Contributing
49325
50−## Developer Tools
51−To increase developer productivity it is highly recommended to make use of the
52−`ob watch` command. This will open a live repl that
53−will compile and refresh itself showing you the latest possible syntax or type errors
54−as well as any other ghc warnings whenever files within their respective directories
55−are saved and updated.
326+Contributions and issue reports are encouraged and appreciated! Refer to the [Contributing](CONTRIBUTING.md) guide for information about getting started.
acme.nixnew file+430
@@ -0,0 +1,430 @@
1+# Copied from https://github.com/NixOS/nixpkgs-channels/blob/70717a337f7ae4e486ba71a500367cad697e5f09/nixos/modules/security/acme.nix # MODIFIED
2+# Lines marked '# MODIFIED' have been added or modified from the original. # MODIFIED
3+{ config, lib, pkgs, ... }:
4+with lib;
5+let
6+
7+ cfg = config.security.acme;
8+
9+ certOpts = { name, ... }: {
10+ options = {
11+ webroot = mkOption {
12+ type = types.nullOr types.str;
13+ default = null;
14+ example = "/var/lib/acme/acme-challenges";
15+ description = ''
16+ Where the webroot of the HTTP vhost is located.
17+ <filename>.well-known/acme-challenge/</filename> directory
18+ will be created below the webroot if it doesn't exist.
19+ <literal>http://example.org/.well-known/acme-challenge/</literal> must also
20+ be available (notice unencrypted HTTP).
21+ '';
22+ };
23+
24+ server = mkOption {
25+ type = types.nullOr types.str;
26+ default = null;
27+ description = ''
28+ ACME Directory Resource URI. Defaults to let's encrypt
29+ production endpoint,
30+ https://acme-v02.api.letsencrypt.org/directory, if unset.
31+ '';
32+ };
33+
34+ domain = mkOption {
35+ type = types.str;
36+ default = name;
37+ description = "Domain to fetch certificate for (defaults to the entry name)";
38+ };
39+
40+ email = mkOption {
41+ type = types.nullOr types.str;
42+ default = cfg.email;
43+ description = "Contact email address for the CA to be able to reach you.";
44+ };
45+
46+ user = mkOption {
47+ type = types.str;
48+ default = "root";
49+ description = "User running the ACME client.";
50+ };
51+
52+ group = mkOption {
53+ type = types.str;
54+ default = "root";
55+ description = "Group running the ACME client.";
56+ };
57+
58+ allowKeysForGroup = mkOption {
59+ type = types.bool;
60+ default = false;
61+ description = ''
62+ Give read permissions to the specified group
63+ (<option>security.acme.cert.&lt;name&gt;.group</option>) to read SSL private certificates.
64+ '';
65+ };
66+
67+ postRun = mkOption {
68+ type = types.lines;
69+ default = "";
70+ example = "systemctl reload nginx.service";
71+ description = ''
72+ Commands to run after new certificates go live. Typically
73+ the web server and other servers using certificates need to
74+ be reloaded.
75+ Executed in the same directory with the new certificate.
76+ '';
77+ };
78+
79+ directory = mkOption {
80+ type = types.str;
81+ readOnly = true;
82+ default = "/var/lib/acme/${name}";
83+ description = "Directory where certificate and other state is stored.";
84+ };
85+
86+ extraDomains = mkOption {
87+ type = types.attrsOf (types.nullOr types.str);
88+ default = {};
89+ example = literalExample ''
90+ {
91+ "example.org" = null;
92+ "mydomain.org" = null;
93+ }
94+ '';
95+ description = ''
96+ A list of extra domain names, which are included in the one certificate to be issued.
97+ Setting a distinct server root is deprecated and not functional in 20.03+
98+ '';
99+ };
100+
101+ keyType = mkOption {
102+ type = types.str;
103+ default = "ec256";
104+ description = ''
105+ Key type to use for private keys.
106+ For an up to date list of supported values check the --key-type option
107+ at https://go-acme.github.io/lego/usage/cli/#usage.
108+ '';
109+ };
110+
111+ dnsProvider = mkOption {
112+ type = types.nullOr types.str;
113+ default = null;
114+ example = "route53";
115+ description = ''
116+ DNS Challenge provider. For a list of supported providers, see the "code"
117+ field of the DNS providers listed at https://go-acme.github.io/lego/dns/.
118+ '';
119+ };
120+
121+ credentialsFile = mkOption {
122+ type = types.path;
123+ description = ''
124+ Path to an EnvironmentFile for the cert's service containing any required and
125+ optional environment variables for your selected dnsProvider.
126+ To find out what values you need to set, consult the documentation at
127+ https://go-acme.github.io/lego/dns/ for the corresponding dnsProvider.
128+ '';
129+ example = "/var/src/secrets/example.org-route53-api-token";
130+ };
131+
132+ dnsPropagationCheck = mkOption {
133+ type = types.bool;
134+ default = true;
135+ description = ''
136+ Toggles lego DNS propagation check, which is used alongside DNS-01
137+ challenge to ensure the DNS entries required are available.
138+ '';
139+ };
140+ };
141+ };
142+
143+in
144+
145+{
146+
147+ ###### interface
148+ imports = [
149+ (mkRemovedOptionModule [ "security" "acme" "production" ] ''
150+ Use security.acme.server to define your staging ACME server URL instead.
151+ To use the let's encrypt staging server, use security.acme.server =
152+ "https://acme-staging-v02.api.letsencrypt.org/directory".
153+ ''
154+ )
155+ # (mkRemovedOptionModule [ "security" "acme" "directory"] "ACME Directory is now hardcoded to /var/lib/acme and its permisisons are managed by systemd. See https://github.com/NixOS/nixpkgs/issues/53852 for more info.") # MODIFIED
156+ # (mkRemovedOptionModule [ "security" "acme" "preDelay"] "This option has been removed. If you want to make sure that something executes before certificates are provisioned, add a RequiredBy=acme-\${cert}.service to the service you want to execute before the cert renewal") # MODIFIED
157+ # (mkRemovedOptionModule [ "security" "acme" "activationDelay"] "This option has been removed. If you want to make sure that something executes before certificates are provisioned, add a RequiredBy=acme-\${cert}.service to the service you want to execute before the cert renewal") # MODIFIED
158+ (mkChangedOptionModule [ "security" "acme" "validMin"] [ "security" "acme" "validMinDays"] (config: config.security.acme.validMin / (24 * 3600)))
159+ ];
160+ options = {
161+ security.acme = {
162+
163+ validMinDays = mkOption {
164+ type = types.int;
165+ default = 30;
166+ description = "Minimum remaining validity before renewal in days.";
167+ };
168+
169+ email = mkOption {
170+ type = types.nullOr types.str;
171+ default = null;
172+ description = "Contact email address for the CA to be able to reach you.";
173+ };
174+
175+ renewInterval = mkOption {
176+ type = types.str;
177+ default = "daily";
178+ description = ''
179+ Systemd calendar expression when to check for renewal. See
180+ <citerefentry><refentrytitle>systemd.time</refentrytitle>
181+ <manvolnum>7</manvolnum></citerefentry>.
182+ '';
183+ };
184+
185+ server = mkOption {
186+ type = types.nullOr types.str;
187+ default = null;
188+ description = ''
189+ ACME Directory Resource URI. Defaults to let's encrypt
190+ production endpoint,
191+ <literal>https://acme-v02.api.letsencrypt.org/directory</literal>, if unset.
192+ '';
193+ };
194+
195+ preliminarySelfsigned = mkOption {
196+ type = types.bool;
197+ default = true;
198+ description = ''
199+ Whether a preliminary self-signed certificate should be generated before
200+ doing ACME requests. This can be useful when certificates are required in
201+ a webserver, but ACME needs the webserver to make its requests.
202+ With preliminary self-signed certificate the webserver can be started and
203+ can later reload the correct ACME certificates.
204+ '';
205+ };
206+
207+ acceptTerms = mkOption {
208+ type = types.bool;
209+ default = false;
210+ description = ''
211+ Accept the CA's terms of service. The default provier is Let's Encrypt,
212+ you can find their ToS at https://letsencrypt.org/repository/
213+ '';
214+ };
215+
216+ certs = mkOption {
217+ default = { };
218+ type = with types; attrsOf (submodule certOpts);
219+ description = ''
220+ Attribute set of certificates to get signed and renewed. Creates
221+ <literal>acme-''${cert}.{service,timer}</literal> systemd units for
222+ each certificate defined here. Other services can add dependencies
223+ to those units if they rely on the certificates being present,
224+ or trigger restarts of the service if certificates get renewed.
225+ '';
226+ example = literalExample ''
227+ {
228+ "example.com" = {
229+ webroot = "/var/www/challenges/";
230+ email = "foo@example.com";
231+ extraDomains = { "www.example.com" = null; "foo.example.com" = null; };
232+ };
233+ "bar.example.com" = {
234+ webroot = "/var/www/challenges/";
235+ email = "bar@example.com";
236+ };
237+ }
238+ '';
239+ };
240+ };
241+ };
242+
243+ ###### implementation
244+ config = mkMerge [
245+ (mkIf (cfg.certs != { }) {
246+
247+ assertions = let
248+ certs = (mapAttrsToList (k: v: v) cfg.certs);
249+ in [
250+ {
251+ assertion = all (certOpts: certOpts.dnsProvider == null || certOpts.webroot == null) certs;
252+ message = ''
253+ Options `security.acme.certs.<name>.dnsProvider` and
254+ `security.acme.certs.<name>.webroot` are mutually exclusive.
255+ '';
256+ }
257+ {
258+ assertion = cfg.email != null || all (certOpts: certOpts.email != null) certs;
259+ message = ''
260+ You must define `security.acme.certs.<name>.email` or
261+ `security.acme.email` to register with the CA.
262+ '';
263+ }
264+ {
265+ assertion = cfg.acceptTerms;
266+ message = ''
267+ You must accept the CA's terms of service before using
268+ the ACME module by setting `security.acme.acceptTerms`
269+ to `true`. For Let's Encrypt's ToS see https://letsencrypt.org/repository/
270+ '';
271+ }
272+ ];
273+
274+ systemd.services = let
275+ services = concatLists servicesLists;
276+ servicesLists = mapAttrsToList certToServices cfg.certs;
277+ certToServices = cert: data:
278+ let
279+ # StateDirectory must be relative, and will be created under /var/lib by systemd
280+ lpath = "acme/${cert}";
281+ apath = "/var/lib/${lpath}";
282+ spath = "/var/lib/acme/.lego/${cert}";
283+ fileMode = if data.allowKeysForGroup then "640" else "600";
284+ globalOpts = [ "-d" data.domain "--email" data.email "--path" "." "--key-type" data.keyType ]
285+ ++ optionals (cfg.acceptTerms) [ "--accept-tos" ]
286+ ++ optionals (data.dnsProvider != null && !data.dnsPropagationCheck) [ "--dns.disable-cp" ]
287+ ++ concatLists (mapAttrsToList (name: root: [ "-d" name ]) data.extraDomains)
288+ ++ (if data.dnsProvider != null then [ "--dns" data.dnsProvider ] else [ "--http" "--http.webroot" data.webroot ])
289+ ++ optionals (cfg.server != null || data.server != null) ["--server" (if data.server == null then cfg.server else data.server)];
290+ runOpts = escapeShellArgs (globalOpts ++ [ "run" ]);
291+ renewOpts = escapeShellArgs (globalOpts ++ [ "renew" "--days" (toString cfg.validMinDays) ]);
292+ acmeService = {
293+ description = "Renew ACME Certificate for ${cert}";
294+ after = [ "network.target" "network-online.target" ];
295+ wants = [ "network-online.target" ];
296+ wantedBy = mkIf (!config.boot.isContainer) [ "multi-user.target" ];
297+ serviceConfig = {
298+ Type = "oneshot";
299+ User = data.user;
300+ Group = data.group;
301+ PrivateTmp = true;
302+ StateDirectory = "acme/.lego/${cert} acme/.lego/accounts ${lpath}";
303+ StateDirectoryMode = if data.allowKeysForGroup then "750" else "700";
304+ WorkingDirectory = spath;
305+ # Only try loading the credentialsFile if the dns challenge is enabled
306+ EnvironmentFile = if data.dnsProvider != null then data.credentialsFile else null;
307+ ExecStart = pkgs.writeScript "acme-start" ''
308+ #!${pkgs.runtimeShell} -e
309+ test -L ${spath}/accounts -o -d ${spath}/accounts || ln -s ../accounts ${spath}/accounts
310+ ${pkgs.lego}/bin/lego ${renewOpts} || ${pkgs.lego}/bin/lego ${runOpts}
311+ '';
312+ ExecStartPost =
313+ let
314+ keyName = builtins.replaceStrings ["*"] ["_"] data.domain;
315+ script = pkgs.writeScript "acme-post-start" ''
316+ #!${pkgs.runtimeShell} -e
317+ cd ${apath}
318+ # Test that existing cert is older than new cert
319+ KEY=${spath}/certificates/${keyName}.key
320+ KEY_CHANGED=no
321+ if [ -e $KEY -a $KEY -nt key.pem ]; then
322+ KEY_CHANGED=yes
323+ cp -p ${spath}/certificates/${keyName}.key key.pem
324+ cp -p ${spath}/certificates/${keyName}.crt fullchain.pem
325+ cp -p ${spath}/certificates/${keyName}.issuer.crt chain.pem
326+ ln -sf fullchain.pem cert.pem
327+ cat key.pem fullchain.pem > full.pem
328+ fi
329+ chmod ${fileMode} *.pem
330+ chown '${data.user}:${data.group}' *.pem
331+ if [ "$KEY_CHANGED" = "yes" ]; then
332+ : # noop in case postRun is empty
333+ ${data.postRun}
334+ fi
335+ '';
336+ in
337+ "+${script}";
338+ };
339+
340+ };
341+ selfsignedService = {
342+ description = "Create preliminary self-signed certificate for ${cert}";
343+ path = [ pkgs.openssl ];
344+ script =
345+ ''
346+ workdir="$(mktemp -d)"
347+ # Create CA
348+ openssl genrsa -des3 -passout pass:xxxx -out $workdir/ca.pass.key 2048
349+ openssl rsa -passin pass:xxxx -in $workdir/ca.pass.key -out $workdir/ca.key
350+ openssl req -new -key $workdir/ca.key -out $workdir/ca.csr \
351+ -subj "/C=UK/ST=Warwickshire/L=Leamington/O=OrgName/OU=Security Department/CN=example.com"
352+ openssl x509 -req -days 1 -in $workdir/ca.csr -signkey $workdir/ca.key -out $workdir/ca.crt
353+ # Create key
354+ openssl genrsa -des3 -passout pass:xxxx -out $workdir/server.pass.key 2048
355+ openssl rsa -passin pass:xxxx -in $workdir/server.pass.key -out $workdir/server.key
356+ openssl req -new -key $workdir/server.key -out $workdir/server.csr \
357+ -subj "/C=UK/ST=Warwickshire/L=Leamington/O=OrgName/OU=IT Department/CN=example.com"
358+ openssl x509 -req -days 1 -in $workdir/server.csr -CA $workdir/ca.crt \
359+ -CAkey $workdir/ca.key -CAserial $workdir/ca.srl -CAcreateserial \
360+ -out $workdir/server.crt
361+ # Copy key to destination
362+ cp $workdir/server.key ${apath}/key.pem
363+ # Create fullchain.pem (same format as "simp_le ... -f fullchain.pem" creates)
364+ cat $workdir/{server.crt,ca.crt} > "${apath}/fullchain.pem"
365+ # Create full.pem for e.g. lighttpd
366+ cat $workdir/{server.key,server.crt,ca.crt} > "${apath}/full.pem"
367+ # Give key acme permissions
368+ chown '${data.user}:${data.group}' "${apath}/"{key,fullchain,full}.pem
369+ chmod ${fileMode} "${apath}/"{key,fullchain,full}.pem
370+ '';
371+ serviceConfig = {
372+ Type = "oneshot";
373+ PrivateTmp = true;
374+ StateDirectory = lpath;
375+ User = data.user;
376+ Group = data.group;
377+ };
378+ unitConfig = {
379+ # Do not create self-signed key when key already exists
380+ ConditionPathExists = "!${apath}/key.pem";
381+ };
382+ };
383+ in (
384+ [ { name = "acme-${cert}"; value = acmeService; } ]
385+ ++ optional cfg.preliminarySelfsigned { name = "acme-selfsigned-${cert}"; value = selfsignedService; }
386+ );
387+ servicesAttr = listToAttrs services;
388+ in
389+ servicesAttr;
390+
391+ systemd.tmpfiles.rules =
392+ map (data: "d ${data.webroot}/.well-known/acme-challenge - ${data.user} ${data.group}") (filter (data: data.webroot != null) (attrValues cfg.certs));
393+
394+ systemd.timers = let
395+ # Allow systemd to pick a convenient time within the day
396+ # to run the check.
397+ # This allows the coalescing of multiple timer jobs.
398+ # We divide by the number of certificates so that if you
399+ # have many certificates, the renewals are distributed over
400+ # the course of the day to avoid rate limits.
401+ numCerts = length (attrNames cfg.certs);
402+ _24hSecs = 60 * 60 * 24;
403+ AccuracySec = "${toString (_24hSecs / numCerts)}s";
404+ in flip mapAttrs' cfg.certs (cert: data: nameValuePair
405+ ("acme-${cert}")
406+ ({
407+ description = "Renew ACME Certificate for ${cert}";
408+ wantedBy = [ "timers.target" ];
409+ timerConfig = {
410+ OnCalendar = cfg.renewInterval;
411+ Unit = "acme-${cert}.service";
412+ Persistent = "yes";
413+ inherit AccuracySec;
414+ # Skew randomly within the day, per https://letsencrypt.org/docs/integration-guide/.
415+ RandomizedDelaySec = "24h";
416+ };
417+ })
418+ );
419+
420+ systemd.targets.acme-selfsigned-certificates = mkIf cfg.preliminarySelfsigned {};
421+ systemd.targets.acme-certificates = {};
422+ })
423+
424+ ];
425+
426+ meta = {
427+ maintainers = with lib.maintainers; [ abbradar fpletz globin m1cr0man ];
428+ # doc = ./acme.xml; # MODIFIED
429+ };
430+}
all-builds.nixnew file+113
@@ -0,0 +1,113 @@
1+{ self-args ? {
2+ config.android_sdk.accept_license = true;
3+ iosSdkVersion = "13.2";
4+ }
5+, local-self ? import ./. self-args
6+, supportedSystems ? [ builtins.currentSystem ]
7+}:
8+
9+let
10+ inherit (local-self.nixpkgs) lib runCommand nix;
11+ cacheBuildSystems = supportedSystems;
12+
13+ obeliskPackagesCommon = [
14+ "obelisk-frontend"
15+ "obelisk-route"
16+ "obelisk-executable-config-lookup"
17+ ];
18+
19+ obeliskPackagesBackend = obeliskPackagesCommon ++ [
20+ "obelisk-asset-manifest"
21+ "obelisk-asset-serve-snap"
22+ "obelisk-backend"
23+ "obelisk-cliapp"
24+ "obelisk-command"
25+ "obelisk-executable-config-inject"
26+ "obelisk-frontend"
27+ "obelisk-run"
28+ "obelisk-route"
29+ "obelisk-selftest"
30+ "obelisk-snap-extras"
31+ ];
32+
33+ pnameToAttrs = pkgsSet: pnames:
34+ lib.listToAttrs (map
35+ (name: { inherit name; value = pkgsSet.${name}; })
36+ pnames);
37+
38+ collect = v:
39+ if lib.isDerivation v then [v]
40+ else if lib.isAttrs v then lib.concatMap collect (builtins.attrValues v)
41+ else if lib.isList v then lib.concatMap collect v
42+ else [];
43+
44+ perPlatform = lib.genAttrs cacheBuildSystems (system: let
45+ reflex-platform = import ./dep/reflex-platform { inherit system; };
46+
47+ mkPerProfiling = profiling: let
48+ obelisk = import ./. (self-args // { inherit system profiling; });
49+ ghc = pnameToAttrs
50+ obelisk.haskellPackageSets.ghc
51+ obeliskPackagesBackend;
52+ ghcjs = pnameToAttrs
53+ obelisk.haskellPackageSets.ghcjs
54+ obeliskPackagesCommon;
55+ command = obelisk.command;
56+
57+ withSkeletonOptions = skel: options: (skel.passthru.__unstable__.self.extend (self: super: {
58+ userSettings = super.userSettings // options;
59+ })).project;
60+ rawSkeleton = import ./skeleton { inherit obelisk; };
61+ skeleton = withSkeletonOptions rawSkeleton {
62+ withHoogle = true; # cache the Hoogle database for the skeleton
63+ __withGhcide = true; # cache the ghcide build for the skeleton
64+ };
65+
66+ serverSkeletonExe = rawSkeleton.exe;
67+ # TODO fix nixpkgs so it doesn't try to run the result of haskell shells as setup hooks.
68+ serverSkeletonShell = local-self.nixpkgs.runCommand "shell-safe-for-dep" {} ''
69+ touch "$out"
70+ echo "return" >> "$out"
71+ cat "${skeleton.shells.ghc}" >> "$out"
72+ '';
73+ androidSkeleton = skeleton.android.frontend;
74+ iosSkeleton = skeleton.ios.frontend;
75+ nameSuffix = if profiling then "profiled" else "unprofiled";
76+ packages = {
77+ skeletonProfiledObRun = rawSkeleton.__unstable__.profiledObRun;
78+ inherit
79+ command
80+ serverSkeletonShell
81+ ghc
82+ ;
83+ } // lib.optionalAttrs (!profiling) {
84+ inherit
85+ ghcjs
86+ serverSkeletonExe
87+ ;
88+ } // lib.optionalAttrs reflex-platform.androidSupport {
89+ inherit androidSkeleton;
90+ } // lib.optionalAttrs reflex-platform.iosSupport {
91+ inherit iosSkeleton;
92+ };
93+ in packages // {
94+ cache = reflex-platform.pinBuildInputs
95+ "obelisk-${system}-${nameSuffix}"
96+ (collect packages);
97+ };
98+
99+ perProfiling = {
100+ profiled = mkPerProfiling true;
101+ unprofiled = mkPerProfiling false;
102+ };
103+ in perProfiling // {
104+ cache = reflex-platform.pinBuildInputs
105+ "obelisk-${system}"
106+ (map (p: p.cache) (builtins.attrValues perProfiling));
107+ });
108+
109+ metaCache = local-self.reflex-platform.pinBuildInputs
110+ "obelisk-everywhere"
111+ (map (a: a.cache) (builtins.attrValues perPlatform));
112+
113+in perPlatform // { inherit metaCache; }
all-tests.nixnew file+145
@@ -0,0 +1,145 @@
1+{
2+ supportedSystems ? [ builtins.currentSystem ]
3+}:
4+let
5+ nginxRoot = "/run/nginx";
6+ obelisk = import ./default.nix {};
7+ # Get NixOS a pre-release 20.03 that contains the python based tests and recursive nix
8+ pkgs = import (builtins.fetchTarball https://github.com/nixos/nixpkgs/archive/3de5266.tar.gz) {};
9+ sshKeys = import (pkgs.path + /nixos/tests/ssh-keys.nix) pkgs;
10+ make-test = import (pkgs.path + /nixos/tests/make-test-python.nix);
11+ obelisk-everywhere = (import ./all-builds.nix { inherit supportedSystems; }).x86_64-linux.cache;
12+ snakeOilPrivateKey = sshKeys.snakeOilPrivateKey.text;
13+ snakeOilPublicKey = sshKeys.snakeOilPublicKey;
14+in
15+ make-test ({...}: {
16+ name = "obelisk";
17+ nodes = {
18+ githost = {
19+ networking.firewall.allowedTCPPorts = [ 22 80 ];
20+ services.openssh = {
21+ enable = true;
22+ };
23+ environment.systemPackages = [
24+ pkgs.git
25+ ];
26+ users.users.root.openssh.authorizedKeys.keys = [
27+ snakeOilPublicKey
28+ ];
29+ };
30+
31+ client = {
32+ imports = [
33+ (pkgs.path + /nixos/modules/installer/cd-dvd/channel.nix)
34+ ];
35+ nix.useSandbox = false;
36+ nix.binaryCaches = [];
37+ environment.systemPackages = [
38+ obelisk.command
39+ obelisk.shell
40+ obelisk-everywhere
41+ pkgs.git
42+ ];
43+ };
44+ };
45+
46+ testScript =
47+ let
48+ privateKeyFile = pkgs.writeText "id_rsa" ''${snakeOilPrivateKey}'';
49+ thunkableSample = pkgs.writeText "default.nix" ''
50+ let pkgs = import <nixpkgs> {}; in pkgs.git
51+ '';
52+ invalidThunkableSample = pkgs.writeText "default.nix" ''
53+ let pkgs = import <nixpkgs> {}; in pkgtypo.git
54+ '';
55+ sshConfigFile = pkgs.writeText "ssh_config" ''
56+ Host *
57+ StrictHostKeyChecking no
58+ UserKnownHostsFile=/dev/null
59+ ConnectionAttempts=1
60+ ConnectTimeout=1
61+ IdentityFile=~/.ssh/id_rsa
62+ User=root
63+ '';
64+ in ''
65+ start_all()
66+
67+ with subtest("obelisk is installed and git is configured"):
68+ client.succeed("ob --help")
69+ client.succeed('git config --global user.email "you@example.com"')
70+ client.succeed('git config --global user.name "Your Name"')
71+
72+ githost.wait_for_open_port("22")
73+
74+ with subtest("the client can access the server via ssh"):
75+ client.succeed("mkdir -p ~/.ssh/")
76+ client.succeed(
77+ "cp ${privateKeyFile} ~/.ssh/id_rsa"
78+ )
79+ client.succeed("chmod 600 ~/.ssh/id_rsa")
80+ client.wait_until_succeeds(
81+ "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa githost true"
82+ )
83+ client.succeed(
84+ "cp ${sshConfigFile} ~/.ssh/config"
85+ )
86+ client.wait_until_succeeds("ssh githost true")
87+
88+ with subtest("a remote bare repo can be started"):
89+ githost.succeed("mkdir -p ~/myorg/myapp.git")
90+ githost.succeed("cd ~/myorg/myapp.git && git init --bare")
91+
92+ with subtest("a git project can be configured with a remote using ssh"):
93+ client.succeed("mkdir -p ~/code/myapp")
94+ client.succeed("cd ~/code/myapp && git init")
95+ client.succeed(
96+ "cp ${thunkableSample} ~/code/myapp/default.nix"
97+ )
98+ client.succeed("cd ~/code/myapp && git add .")
99+
100+ client.succeed('cd ~/code/myapp && git commit -m "Initial"')
101+ client.succeed(
102+ "cd ~/code/myapp && git remote add origin root@githost:/root/myorg/myapp.git"
103+ )
104+
105+
106+ with subtest("pushing code to the remote"):
107+ client.succeed("cd ~/code/myapp && git push -u origin master")
108+ client.succeed("cd ~/code/myapp && git status")
109+
110+ with subtest("obelisk can pack"):
111+ client.succeed("ob -v thunk pack ~/code/myapp")
112+ client.succeed("grep -qF 'git.json' ~/code/myapp/thunk.nix")
113+ client.succeed("grep -qF 'myorg' ~/code/myapp/git.json")
114+ client.succeed("ob -v thunk unpack ~/code/myapp")
115+
116+ with subtest("obelisk can set the public / private flag"):
117+ client.succeed("ob -v thunk pack ~/code/myapp --private")
118+ client.fail("""grep -qF '"private": practice' ~/code/myapp/git.json""")
119+ client.succeed("""grep -qF '"private": true' ~/code/myapp/git.json""")
120+ client.succeed("nix-build ~/code/myapp")
121+ client.succeed("ob -v thunk unpack ~/code/myapp")
122+ client.succeed("ob -v thunk pack ~/code/myapp --public")
123+ client.succeed("""grep -qF '"private": false' ~/code/myapp/git.json""")
124+ client.succeed("nix-build ~/code/myapp")
125+ client.succeed("ob -v thunk unpack ~/code/myapp")
126+
127+ with subtest("building an invalid thunk fails"):
128+ client.succeed("cd ~/code/myapp && git checkout -b bad")
129+ client.succeed(
130+ "cp ${invalidThunkableSample} ~/code/myapp/default.nix"
131+ )
132+ client.succeed("cd ~/code/myapp && git add .")
133+ client.succeed('cd ~/code/myapp && git commit -m "Bad commit"')
134+ client.succeed("cd ~/code/myapp && git push -u origin bad")
135+ client.succeed("ob -v thunk pack ~/code/myapp --public")
136+ client.fail("nix-build ~/code/myapp")
137+ client.succeed("ob -v thunk unpack ~/code/myapp")
138+ client.succeed("cd ~/code/myapp && git checkout master")
139+
140+ with subtest("obelisk can detect private repos"):
141+ client.succeed("ob -v thunk pack ~/code/myapp")
142+ client.succeed("""grep -qF '"private": true' ~/code/myapp/git.json""")
143+ client.succeed("ob -v thunk unpack ~/code/myapp")
144+ '';
145+ }) {}
default.nix+344−219
@@ -1,267 +1,392 @@
11{ system ? builtins.currentSystem
22, profiling ? false
3+, iosSdkVersion ? "13.2"
4+, config ? {}
5+, terms ? { # Accepted terms, conditions, and licenses
6+ security.acme.acceptTerms = false;
7+ }
8+, reflex-platform-func ? import ./dep/reflex-platform
39}:
4−let reflex-platform = import ./dep/reflex-platform { inherit system; };
5− inherit (reflex-platform) hackGet;
6− pkgs = reflex-platform.nixpkgs;
7−in with pkgs.haskell.lib; with pkgs.lib;
8−let #TODO: Upstream
9− # Modify a Haskell package to add completion scripts for the given
10− # executable produced by it. These completion scripts will be picked up
11− # automatically if the resulting derivation is installed, e.g. by
12− # `nix-env -i`.
13−
14− # TODO: Remove this after updating nixpkgs: https://github.com/NixOS/nixpkgs/issues/37750
15− justStaticExecutables' = drv: let
16− drv' = justStaticExecutables drv;
17− in if pkgs.stdenv.isDarwin
18− then removeConfigureFlag drv' "--ghc-option=-optl=-dead_strip"
19− else drv';
20−
21−
22− addOptparseApplicativeCompletionScripts = exeName: pkg: overrideCabal pkg (drv: {
23− postInstall = (drv.postInstall or "") + ''
24− BASH_COMP_DIR="$out/share/bash-completion/completions"
25− mkdir -p "$BASH_COMP_DIR"
26− "$out/bin/${exeName}" --bash-completion-script "$out/bin/${exeName}" >"$BASH_COMP_DIR/ob"
27−
28− ZSH_COMP_DIR="$out/share/zsh/vendor-completions"
29− mkdir -p "$ZSH_COMP_DIR"
30− "$out/bin/${exeName}" --zsh-completion-script "$out/bin/${exeName}" >"$ZSH_COMP_DIR/_ob"
31−
32− FISH_COMP_DIR="$out/share/fish/vendor_completions.d"
33− mkdir -p "$FISH_COMP_DIR"
34− "$out/bin/${exeName}" --fish-completion-script "$out/bin/${exeName}" >"$FISH_COMP_DIR/ob.fish"
35− '';
36− });
37−
38− # The haskell environment used to build Obelisk itself, e.g. the 'ob' command
39− ghcObelisk = reflex-platform.ghc.override {
40− overrides = composeExtensions defaultHaskellOverrides (self: super: {
41− mkDerivation = args: super.mkDerivation (args // {
42− enableLibraryProfiling = profiling;
43− });
44−
45− #TODO: Eliminate this when https://github.com/phadej/github/pull/307 makes its way to reflex-platform
46− github = overrideCabal super.github (drv: {
47− src = pkgs.fetchFromGitHub {
48− owner = "ryantrinkle";
49− repo = "github";
50− rev = "8f543cdc07876bfb7b924d3722e3dbc1df4b02ca";
51− sha256 = "0vcnx9cxqd821kmjx1r4cvj95zs742qm1pwqnb52vw3djplbqd86";
52− };
53− sha256 = null;
54− revision = null;
55− editedCabalFile = null;
56− });
10+let
11+ reflex-platform = getReflexPlatform { inherit system; };
12+ inherit (reflex-platform) hackGet nixpkgs;
13+ pkgs = nixpkgs;
5714
58− # Dynamic linking with split objects dramatically increases startup time (about 0.5 seconds on a decent machine with SSD)
59− obelisk-command = addOptparseApplicativeCompletionScripts "ob" (justStaticExecutables' super.obelisk-command);
15+ inherit (import dep/gitignore.nix { inherit (nixpkgs) lib; }) gitignoreSource;
6016
61− optparse-applicative = self.callHackage "optparse-applicative" "0.14.0.0" {};
62− });
63− };
17+ getReflexPlatform = { system, enableLibraryProfiling ? profiling }: reflex-platform-func {
18+ inherit iosSdkVersion config system enableLibraryProfiling;
6419
65− fixUpstreamPkgs = self: super: {
66− heist = doJailbreak super.heist; #TODO: Move up to reflex-platform; create tests for r-p supported packages
67− network-transport = self.callHackage "network-transport" "0.5.2" {};
68− network-transport-tcp = self.callHackage "network-transport-tcp" "0.6.0" {};
69− };
20+ nixpkgsOverlays = [
21+ (import ./nixpkgs-overlays)
22+ ];
7023
71− cleanSource = builtins.filterSource (name: _: let baseName = builtins.baseNameOf name; in !(
72− builtins.match "^\\.ghc\\.environment.*" baseName != null ||
73− baseName == "cabal.project.local"
74− ));
75−
76− addLibs = self: super: {
77− obelisk-asset-manifest = self.callCabal2nix "obelisk-asset-manifest" (hackGet ./lib/asset + "/manifest") {};
78− obelisk-asset-serve-snap = self.callCabal2nix "obelisk-asset-serve-snap" (hackGet ./lib/asset + "/serve-snap") {};
79− obelisk-backend = self.callCabal2nix "obelisk-backend" (cleanSource ./lib/backend) {};
80− obelisk-command = (self.callCabal2nix "obelisk-command" (cleanSource ./lib/command) {}).override { Cabal = super.Cabal_2_0_0_2; };
81− obelisk-run-frontend = self.callCabal2nix "obelisk-run-frontend" (cleanSource ./lib/run-frontend) {};
82− obelisk-selftest = self.callCabal2nix "obelisk-selftest" (cleanSource ./lib/selftest) {};
83− obelisk-snap = self.callCabal2nix "obelisk-snap" (cleanSource ./lib/snap) {};
84− obelisk-snap-extras = self.callCabal2nix "obelisk-snap-extras" (cleanSource ./lib/snap-extras) {};
85− };
24+ haskellOverlays = [
25+ (import ./haskell-overlays/misc-deps.nix { inherit hackGet; })
26+ pkgs.obeliskExecutableConfig.haskellOverlay
27+ (import ./haskell-overlays/obelisk.nix)
28+ (import ./haskell-overlays/tighten-ob-exes.nix)
29+ ];
30+ };
31+
32+ # The haskell environment used to build Obelisk itself, e.g. the 'ob' command
33+ ghcObelisk = reflex-platform.ghc;
8634
87− defaultHaskellOverrides = composeExtensions fixUpstreamPkgs addLibs;
88−in
89−with pkgs.lib;
90−rec {
35+ # Development environments for obelisk packages.
36+ ghcObeliskEnvs = pkgs.lib.mapAttrs (n: v: reflex-platform.workOn ghcObelisk v) ghcObelisk;
37+
38+ inherit (import ./lib/asset/assets.nix { inherit nixpkgs; }) mkAssets;
39+
40+ haskellLib = pkgs.haskell.lib;
41+
42+in rec {
9143 inherit reflex-platform;
92− inherit (reflex-platform) nixpkgs;
44+ inherit (reflex-platform) nixpkgs pinBuildInputs;
45+ inherit (nixpkgs) lib;
46+ pathGit = ./.; # Used in CI by the migration graph hash algorithm to correctly ignore files.
9347 path = reflex-platform.filterGit ./.;
48+ obelisk = ghcObelisk;
49+ obeliskEnvs = pkgs.lib.filterAttrs (k: _: k == "tabulation" || pkgs.lib.strings.hasPrefix "obelisk-" k) ghcObeliskEnvs; #TODO: use thunkSet https://github.com/reflex-frp/reflex-platform/pull/671
9450 command = ghcObelisk.obelisk-command;
95− shell = nixpkgs.stdenv.mkDerivation {
96− name = "obelisk-shell";
97− src = null;
98− nativeBuildInputs = [command];
99− };
51+ shell = pinBuildInputs "obelisk-shell" ([command] ++ command.commandRuntimeDeps);
10052
10153 selftest = pkgs.writeScript "selftest" ''
102− #!/usr/bin/env bash
54+ #!${pkgs.runtimeShell}
10355 set -euo pipefail
10456
105− PATH="${ghcObelisk.obelisk-command}/bin:$PATH"
106− export OBELISK_IMPL="${hackGet ./.}"
107− "${justStaticExecutables' ghcObelisk.obelisk-selftest}/bin/obelisk-selftest"
57+ PATH="${command}/bin:$PATH"
58+ cd ${./.}
59+ "${ghcObelisk.obelisk-selftest}/bin/obelisk-selftest" +RTS -N -RTS "$@"
10860 '';
109− #TODO: Why can't I build ./skeleton directly as a derivation? `nix-build -E ./.` doesn't work
11061 skeleton = pkgs.runCommand "skeleton" {
11162 dir = builtins.filterSource (path: type: builtins.trace path (baseNameOf path != ".obelisk")) ./skeleton;
11263 } ''
11364 ln -s "$dir" "$out"
11465 '';
115− nullIfAbsent = p: if pathExists p then p else null;
116− haskellOverrides = addLibs;
66+ nullIfAbsent = p: if lib.pathExists p then p else null;
11767 #TODO: Avoid copying files within the nix store. Right now, obelisk-asset-manifest-generate copies files into a big blob so that the android/ios static assets can be imported from there; instead, we should get everything lined up right before turning it into an APK, so that copies, if necessary, only exist temporarily.
118− processAssets = { src, packageName ? "static", moduleName ? "Static" }: pkgs.runCommand "asset-manifest" {
68+ processAssets = { src, packageName ? "obelisk-generated-static", moduleName ? "Obelisk.Generated.Static" }: pkgs.runCommand "asset-manifest" {
11969 inherit src;
12070 outputs = [ "out" "haskellManifest" "symlinked" ];
121− buildInputs = [
122− (reflex-platform.ghc.callCabal2nix "obelisk-asset-manifest" (hackGet ./lib/asset + "/manifest") {})
123− ];
71+ nativeBuildInputs = [ ghcObelisk.obelisk-asset-manifest ];
12472 } ''
12573 set -euo pipefail
12674 touch "$out"
75+ mkdir -p "$symlinked"
12776 obelisk-asset-manifest-generate "$src" "$haskellManifest" ${packageName} ${moduleName} "$symlinked"
12877 '';
129− ghcjsExterns = ./ghcjs.externs.js;
130− serverExe = backend: frontend: assets: config:
131− pkgs.runCommand "serverExe" { buildInputs = [ pkgs.closurecompiler ]; } ''
132− mkdir $out
133− set -eux
134− ln -s "${backend}"/bin/backend $out/backend
135− ln -s "${assets}" $out/static
136− ln -s "${config}" $out/config
137−
138− mkdir $out/frontend.jsexe
139− cd $out/frontend.jsexe
140− ln -s "${frontend}/bin/frontend.jsexe/all.js" all.unminified.js
141− closure-compiler --externs "${ghcjsExterns}" -O ADVANCED --create_source_map="all.js.map" --source_map_format=V3 --js_output_file="all.js" all.unminified.js
142− echo "//# sourceMappingURL=all.js.map" >> all.js
143− '';
14478
145− server = exe: hostName:
146− let system = "x86_64-linux";
147− nixos = import (pkgs.path + /nixos);
148− https = import (pkgs.fetchFromGitHub {
149− owner = "obsidiansystems";
150− repo = "obelisk-https";
151− rev = "999e36b4ab14cbe31be6815cdbc3a1223a7b4617";
152− sha256 = "0qxi7hg751ikkp4r5j7d706gjrsl26lzlrnh905havij10plcg1l";
153− private = true;
154− } + "/module.nix") {} {
155− backendPort = 8000; # TODO read from config
156− # sslConfig = {
157− # hostName = "example.com";
158− # adminEmail = "webmaster@example.com";
159− # subdomains = [ "www" ];
160− # };
161− };
162− in nixos {
163− inherit system;
164− configuration = args: {
165− imports = [
166− (pkgs.path + /nixos/modules/virtualisation/amazon-image.nix)
167− https
168− ];
169− networking = { inherit hostName; };
170− systemd.services.backend = {
171− wantedBy = [ "multi-user.target" ];
172− after = [ "network.target" ];
173− restartIfChanged = true;
174− script = ''
175− ln -sft . "${exe}"/*
176− mkdir -p log
177− exec ./backend >>backend.out 2>>backend.err </dev/null
178− '';
179− serviceConfig = {
180− User = "backend";
181− KillMode = "process";
182− WorkingDirectory = "~";
183− Restart = "always";
184− RestartSec = 5;
79+ compressedJs = frontend: optimizationLevel: pkgs.runCommand "compressedJs" {} ''
80+ set -euo pipefail
81+ cd '${haskellLib.justStaticExecutables frontend}'
82+ shopt -s globstar
83+ for f in **/all.js; do
84+ dir="$out/$(basename "$(dirname "$f")")"
85+ mkdir -p "$dir"
86+ ln -s "$(realpath "$f")" "$dir/all.unminified.js"
87+ ${if optimizationLevel == null then ''
88+ ln -s "$dir/all.unminified.js" "$dir/all.js"
89+ '' else ''
90+ '${pkgs.closurecompiler}/bin/closure-compiler' --externs '${reflex-platform.ghcjsExternsJs}' -O '${optimizationLevel}' --jscomp_warning=checkVars --create_source_map="$dir/all.js.map" --source_map_format=V3 --js_output_file="$dir/all.js" "$dir/all.unminified.js"
91+ echo '//# sourceMappingURL=all.js.map' >> "$dir/all.js"
92+ ''}
93+ done
94+ '';
95+
96+ serverModules = {
97+ mkBaseEc2 = { nixosPkgs, ... }: {...}: {
98+ imports = [
99+ (nixosPkgs.path + /nixos/modules/virtualisation/amazon-image.nix)
100+ ];
101+ ec2.hvm = true;
102+ };
103+
104+ mkDefaultNetworking = { adminEmail, enableHttps, hostName, routeHost, ... }: {...}: {
105+ networking = {
106+ inherit hostName;
107+ firewall.allowedTCPPorts = if enableHttps then [ 80 443 ] else [ 80 ];
108+ };
109+
110+ # `amazon-image.nix` already sets these but if the user provides their own module then
111+ # forgetting these can cause them to lose access to the server!
112+ # https://github.com/NixOS/nixpkgs/blob/fab05f17d15e4e125def4fd4e708d205b41d8d74/nixos/modules/virtualisation/amazon-image.nix#L133-L136
113+ services.openssh.enable = true;
114+ services.openssh.permitRootLogin = "prohibit-password";
115+
116+ security.acme.certs = if enableHttps then {
117+ "${routeHost}".email = adminEmail;
118+ } else {};
119+
120+ security.acme.${if enableHttps && (terms.security.acme.acceptTerms or false) then "acceptTerms" else null} = true;
121+ };
122+
123+ mkObeliskApp =
124+ { exe
125+ , routeHost
126+ , enableHttps
127+ , name ? "backend"
128+ , user ? name
129+ , group ? user
130+ , baseUrl ? "/"
131+ , internalPort ? 8000
132+ , backendArgs ? "--port=${toString internalPort}"
133+ , ...
134+ }: {...}: {
135+ services.nginx = {
136+ enable = true;
137+ recommendedProxySettings = true;
138+ virtualHosts."${routeHost}" = {
139+ enableACME = enableHttps;
140+ forceSSL = enableHttps;
141+ locations.${baseUrl} = {
142+ proxyPass = "http://127.0.0.1:" + toString internalPort;
143+ proxyWebsockets = true;
144+ extraConfig = ''
145+ access_log off;
146+ '';
185147 };
186148 };
187− users.extraUsers.backend = {
188− description = "backend service";
189− home = "/var/lib/backend";
149+ };
150+ systemd.services.${name} = {
151+ wantedBy = [ "multi-user.target" ];
152+ after = [ "network.target" ];
153+ restartIfChanged = true;
154+ path = [ pkgs.gnutar ];
155+ script = ''
156+ ln -sft . '${exe}'/*
157+ mkdir -p log
158+ exec ./backend ${backendArgs} </dev/null
159+ '';
160+ serviceConfig = {
161+ User = user;
162+ KillMode = "process";
163+ WorkingDirectory = "~";
164+ Restart = "always";
165+ RestartSec = 5;
166+ };
167+ };
168+ users = {
169+ users.${user} = {
170+ description = "${user} service";
171+ home = "/var/lib/${user}";
190172 createHome = true;
191173 isSystemUser = true;
192− group = "backend";
174+ group = group;
193175 };
194− ec2.hvm = true;
176+ groups.${group} = {};
195177 };
196178 };
179+ };
180+
181+ inherit mkAssets;
182+
183+ serverExe = backend: frontend: assets: optimizationLevel: version:
184+ pkgs.runCommand "serverExe" {} ''
185+ mkdir $out
186+ set -eux
187+ ln -s '${if profiling then backend else haskellLib.justStaticExecutables backend}'/bin/* $out/
188+ ln -s '${mkAssets assets}' $out/static.assets
189+ for d in '${mkAssets (compressedJs frontend optimizationLevel)}'/*/; do
190+ ln -s "$d" "$out"/"$(basename "$d").assets"
191+ done
192+ echo ${version} > $out/version
193+ '';
194+
195+ server = { exe, hostName, adminEmail, routeHost, enableHttps, version, module ? serverModules.mkBaseEc2 }@args:
196+ let
197+ nixos = import (pkgs.path + /nixos);
198+ in nixos {
199+ system = "x86_64-linux";
200+ configuration = {
201+ imports = [
202+ (module { inherit exe hostName adminEmail routeHost enableHttps version; nixosPkgs = pkgs; })
203+ (serverModules.mkDefaultNetworking args)
204+ (serverModules.mkObeliskApp args)
205+ ./acme.nix # Backport of ACME upgrades from 20.03
206+ ];
197207
208+ # Backport of ACME upgrades from 20.03
209+ disabledModules = [
210+ (pkgs.path + /nixos/modules/security/acme.nix)
211+ ];
212+ nixpkgs.overlays = [
213+ (self: super: {
214+ lego = (import (builtins.fetchTarball {
215+ url = https://github.com/NixOS/nixpkgs-channels/archive/70717a337f7ae4e486ba71a500367cad697e5f09.tar.gz;
216+ sha256 = "1sbmqn7yc5iilqnvy9nvhsa9bx6spfq1kndvvis9031723iyymd1";
217+ }) {}).lego;
218+ })
219+ ];
220+ };
221+ };
198222
199223 # An Obelisk project is a reflex-platform project with a predefined layout and role for each component
200− project = base: projectDefinition:
201− let assets = processAssets { src = base + "/static"; };
202− configPath = base + "/config";
203− projectOut = reflex-platform.project (args@{ nixpkgs, ... }:
204− let mkProject = { android ? null #TODO: Better error when missing
205− , ios ? null #TODO: Better error when missing
206− , packages ? {}
207− , overrides ? _: _: {}
208− }:
209− let frontendName = "frontend";
210− backendName = "backend";
211− commonName = "common";
212− staticName = "static";
213− staticPath = base + "/static";
214− assets = processAssets { src = base + "/static"; };
215− # The packages whose names and roles are defined by this package
216− predefinedPackages = filterAttrs (_: x: x != null) {
217− ${frontendName} = nullIfAbsent (base + "/frontend");
218− ${commonName} = nullIfAbsent (base + "/common");
219− ${backendName} = nullIfAbsent (base + "/backend");
220− };
221− combinedPackages = predefinedPackages // packages;
222− projectOverrides = self: super: {
223− ${staticName} = dontHaddock (self.callCabal2nix "static" assets.haskellManifest {});
224− frontend = if self.ghc.isGhcjs or false then super.frontend.override { obelisk-run-frontend = null; } else super.frontend;
225− };
226− totalOverrides = composeExtensions (composeExtensions defaultHaskellOverrides projectOverrides) overrides;
227− ghcDevPackages = ["obelisk-run-frontend"];
228− in {
229− overrides = totalOverrides;
230− packages = combinedPackages;
231− shells = {
232− ghc = (filter (x: hasAttr x combinedPackages) [
233− backendName
234− commonName
235− frontendName
236− ]);
237− ghcjs = filter (x: hasAttr x combinedPackages) [
238− frontendName
239− commonName
240− ];
224+ project = base': projectDefinition:
225+ let
226+ projectOut = { system, enableLibraryProfiling ? profiling }: let reflexPlatformProject = (getReflexPlatform { inherit system enableLibraryProfiling; }).project; in reflexPlatformProject (args@{ nixpkgs, ... }:
227+ let
228+ inherit (lib.strings) hasPrefix;
229+ mkProject =
230+ { android ? null #TODO: Better error when missing
231+ , ios ? null #TODO: Better error when missing
232+ , packages ? {}
233+ , overrides ? _: _: {}
234+ , staticFiles ? null
235+ , tools ? _: []
236+ , shellToolOverrides ? _: _: {}
237+ , withHoogle ? false # Setting this to `true` makes shell reloading far slower
238+ , __closureCompilerOptimizationLevel ? "ADVANCED" # Set this to `null` to skip the closure-compiler step
239+ , __withGhcide ? false
240+ }:
241+ let
242+ allConfig = nixpkgs.lib.makeExtensible (self: {
243+ base = base';
244+ inherit args;
245+ userSettings = {
246+ inherit android ios packages overrides tools shellToolOverrides withHoogle __closureCompilerOptimizationLevel __withGhcide;
247+ staticFiles = if staticFiles == null then self.base + /static else staticFiles;
248+ };
249+ frontendName = "frontend";
250+ backendName = "backend";
251+ commonName = "common";
252+ staticName = "obelisk-generated-static";
253+ staticFilesImpure = let fs = self.userSettings.staticFiles; in if lib.isDerivation fs then fs else toString fs;
254+ processedStatic = processAssets { src = self.userSettings.staticFiles; };
255+ # The packages whose names and roles are defined by this package
256+ predefinedPackages = lib.filterAttrs (_: x: x != null) {
257+ ${self.frontendName} = nullIfAbsent (self.base + "/frontend");
258+ ${self.commonName} = nullIfAbsent (self.base + "/common");
259+ ${self.backendName} = nullIfAbsent (self.base + "/backend");
260+ };
261+ shellPackages = {};
262+ combinedPackages = self.predefinedPackages // self.userSettings.packages // self.shellPackages;
263+ projectOverrides = self': super': {
264+ ${self.staticName} = haskellLib.dontHaddock (self'.callCabal2nix self.staticName self.processedStatic.haskellManifest {});
265+ ${self.backendName} = haskellLib.addBuildDepend super'.${self.backendName} self'.obelisk-run;
241266 };
242− withHoogle = false; # Setting this to `true` makes shell reloading far slower
243− android = {
244− ${if android == null then null else frontendName} = {
267+ totalOverrides = lib.composeExtensions self.projectOverrides self.userSettings.overrides;
268+ privateConfigDirs = ["config/backend"];
269+ injectableConfig = builtins.filterSource (path: _:
270+ !(lib.lists.any (x: hasPrefix (toString self.base + "/" + toString x) (toString path)) self.privateConfigDirs)
271+ );
272+ __androidWithConfig = configPath: {
273+ ${if self.userSettings.android == null then null else self.frontendName} = {
245274 executableName = "frontend";
246− ${if builtins.pathExists staticPath then "assets" else null} = assets.symlinked;
247− } // android;
275+ ${if builtins.pathExists self.userSettings.staticFiles then "assets" else null} =
276+ nixpkgs.obeliskExecutableConfig.platforms.android.inject
277+ (self.injectableConfig configPath)
278+ self.processedStatic.symlinked;
279+ } // self.userSettings.android;
248280 };
249− ios = {
250− ${if ios == null then null else frontendName} = {
281+ __iosWithConfig = configPath: {
282+ ${if self.userSettings.ios == null then null else self.frontendName} = {
251283 executableName = "frontend";
252− ${if builtins.pathExists staticPath then "staticSrc" else null} = assets.symlinked;
253− } // ios;
284+ ${if builtins.pathExists self.userSettings.staticFiles then "staticSrc" else null} =
285+ nixpkgs.obeliskExecutableConfig.platforms.ios.inject
286+ (self.injectableConfig configPath)
287+ self.processedStatic.symlinked;
288+ } // self.userSettings.ios;
254289 };
255− };
256− in mkProject (projectDefinition args));
257− in projectOut //
258− { server = { hostName }:
259− let exe = serverExe projectOut.ghc.backend projectOut.ghcjs.frontend assets.symlinked configPath;
260− in server exe hostName;
261− };
262− haskellPackageSets = {
263− ghc = reflex-platform.ghc.override {
264− overrides = defaultHaskellOverrides;
290+
291+ shells-ghc = builtins.attrNames (self.predefinedPackages // self.shellPackages);
292+
293+ shells-ghcjs = [
294+ self.frontendName
295+ self.commonName
296+ ];
297+
298+ shells-ghcSavedSplices = [
299+ self.commonName
300+ self.frontendName
301+ ];
302+
303+ shellToolOverrides = lib.composeExtensions
304+ self.userSettings.shellToolOverrides
305+ (if self.userSettings.__withGhcide
306+ then (import ./haskell-overlays/ghcide.nix)
307+ else (_: _: {})
308+ );
309+
310+ project = reflexPlatformProject ({...}: self.projectConfig);
311+ projectConfig = {
312+ inherit (self) shellToolOverrides;
313+ inherit (self.userSettings) tools withHoogle;
314+ overrides = self.totalOverrides;
315+ packages = self.combinedPackages;
316+ shells = {
317+ ${if self.userSettings.android == null && self.userSettings.ios == null then null else "ghcSavedSplices"} =
318+ lib.filter (x: lib.hasAttr x self.combinedPackages) self.shells-ghcSavedSplices;
319+ ghc = lib.filter (x: lib.hasAttr x self.combinedPackages) self.shells-ghc;
320+ ghcjs = lib.filter (x: lib.hasAttr x self.combinedPackages) self.shells-ghcjs;
321+ };
322+ android = self.__androidWithConfig (self.base + "/config");
323+ ios = self.__iosWithConfig (self.base + "/config");
324+
325+ passthru = {
326+ __unstable__.self = allConfig;
327+ inherit (self)
328+ staticFilesImpure processedStatic
329+ __iosWithConfig __androidWithConfig
330+ ;
331+ inherit (self.userSettings)
332+ android ios overrides packages shellToolOverrides staticFiles tools withHoogle
333+ __closureCompilerOptimizationLevel
334+ ;
335+ };
336+ };
337+ });
338+ in allConfig;
339+ in (mkProject (projectDefinition args)).projectConfig);
340+ mainProjectOut = projectOut { inherit system; };
341+ serverOn = projectInst: version: serverExe
342+ projectInst.ghc.backend
343+ mainProjectOut.ghcjs.frontend
344+ projectInst.passthru.staticFiles
345+ projectInst.passthru.__closureCompilerOptimizationLevel
346+ version;
347+ linuxExe = serverOn (projectOut { system = "x86_64-linux"; });
348+ dummyVersion = "Version number is only available for deployments";
349+ in mainProjectOut // {
350+ __unstable__.profiledObRun = let
351+ profiled = projectOut { inherit system; enableLibraryProfiling = true; };
352+ exeSource = builtins.toFile "ob-run.hs" ''
353+ {-# LANGUAGE NoImplicitPrelude #-}
354+ {-# LANGUAGE PackageImports #-}
355+ module Main where
356+
357+ -- Explicitly import Prelude from base lest there be multiple modules called Prelude
358+ import "base" Prelude (IO, (++), read)
359+
360+ import "base" Control.Exception (finally)
361+ import "reflex" Reflex.Profiled (writeProfilingData)
362+ import "base" System.Environment (getArgs)
363+
364+ import qualified "obelisk-run" Obelisk.Run
365+ import qualified Frontend
366+ import qualified Backend
367+
368+ main :: IO ()
369+ main = do
370+ [portStr, assets, profFileName] <- getArgs
371+ Obelisk.Run.run (read portStr) (Obelisk.Run.runServeAsset assets) Backend.backend Frontend.frontend
372+ `finally` writeProfilingData (profFileName ++ ".rprof")
373+ '';
374+ in nixpkgs.runCommand "ob-run" {
375+ buildInputs = [ (profiled.ghc.ghcWithPackages (p: [p.backend p.frontend])) ];
376+ } ''
377+ cp ${exeSource} ob-run.hs
378+ mkdir -p $out/bin
379+ ghc -x hs -prof -fno-prof-auto -threaded ob-run.hs -o $out/bin/ob-run
380+ '';
381+
382+ linuxExeConfigurable = linuxExe;
383+ linuxExe = linuxExe dummyVersion;
384+ exe = serverOn mainProjectOut dummyVersion;
385+ server = args@{ hostName, adminEmail, routeHost, enableHttps, version, module ? serverModules.mkBaseEc2 }:
386+ server (args // { exe = linuxExe version; });
387+ obelisk = import (base' + "/.obelisk/impl") {};
265388 };
389+ haskellPackageSets = {
390+ inherit (reflex-platform) ghc ghcjs;
266391 };
267392}
lib/https/default.nix → dep/ghcid/default.nixrenamed

The content is the same.

dep/ghcid/github.jsonnew file+7
@@ -0,0 +1,7 @@
1+{
2+ "owner": "ndmitchell",
3+ "repo": "ghcid",
4+ "branch": "master",
5+ "rev": "f572318f32b1617f6054248e5888af68222f8e50",
6+ "sha256": "1icg3r70lg2kmd9gdc024ih1n9nrja98yav74z9nvykqygvv5w0n"
7+}
dep/gitignore.nix/default.nixnew file+8
@@ -0,0 +1,8 @@
1+# DO NOT HAND-EDIT THIS FILE
2+let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }:
3+ if !fetchSubmodules && !private then builtins.fetchTarball {
4+ url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256;
5+ } else (import <nixpkgs> {}).fetchFromGitHub {
6+ inherit owner repo rev sha256 fetchSubmodules private;
7+ };
8+in import (fetch (builtins.fromJSON (builtins.readFile ./github.json)))
dep/gitignore.nix/github.jsonnew file+8
@@ -0,0 +1,8 @@
1+{
2+ "owner": "hercules-ci",
3+ "repo": "gitignore.nix",
4+ "branch": "master",
5+ "private": false,
6+ "rev": "7415c4feb127845553943a3856cbc5cb967ee5e0",
7+ "sha256": "1zd1ylgkndbb5szji32ivfhwh04mr1sbgrnvbrqpmfb67g2g3r9i"
8+}
dep/hnix/default.nixnew file+7
@@ -0,0 +1,7 @@
1+# DO NOT HAND-EDIT THIS FILE
2+import ((import <nixpkgs> {}).fetchFromGitHub (
3+ let json = builtins.fromJSON (builtins.readFile ./github.json);
4+ in { inherit (json) owner repo rev sha256;
5+ private = json.private or false;
6+ }
7+))
dep/hnix/github.jsonnew file+7
@@ -0,0 +1,7 @@
1+{
2+ "owner": "haskell-nix",
3+ "repo": "hnix",
4+ "branch": "master",
5+ "rev": "6c9c7c310c54372b3db0fdf5a0137b395cde1bdb",
6+ "sha256": "1i5903b7lxqn2s3jarb14h6wdq8bxiik1hp0xy43w5w1hgvvq0g5"
7+}
dep/reflex-platform/default.nix+1−6
@@ -1,7 +1,2 @@
11# DO NOT HAND-EDIT THIS FILE
2−import ((import <nixpkgs> {}).fetchFromGitHub (
3− let json = builtins.fromJSON (builtins.readFile ./github.json);
4− in { inherit (json) owner repo rev sha256;
5− private = json.private or false;
6− }
7−))
2+import (import ./thunk.nix)
dep/reflex-platform/github.json+4−3
@@ -1,7 +1,8 @@
11{
22 "owner": "reflex-frp",
33 "repo": "reflex-platform",
4− "branch": "develop",
5− "rev": "f70d210a59a2817293d3b6c3d960b5710aae5c03",
6− "sha256": "0hm4im0865j1vxdqhy987dp2v0wcqy5xfx2nzxq625slnsf458p1"
4+ "branch": "release/0.7.0.0",
5+ "private": false,
6+ "rev": "27a7851a780ff21472d85f9a02fb84635ef9027a",
7+ "sha256": "1m4zlw91dpjlbdchjyxhvhv3k7lilm0qa17dhhww868xxc27sann"
78}
dep/reflex-platform/thunk.nixnew file+9
@@ -0,0 +1,9 @@
1+# DO NOT HAND-EDIT THIS FILE
2+let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }:
3+ if !fetchSubmodules && !private then builtins.fetchTarball {
4+ url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256;
5+ } else (import <nixpkgs> {}).fetchFromGitHub {
6+ inherit owner repo rev sha256 fetchSubmodules private;
7+ };
8+ json = builtins.fromJSON (builtins.readFile ./github.json);
9+in fetch json
dep/snap-core/default.nixnew file+8
@@ -0,0 +1,8 @@
1+# DO NOT HAND-EDIT THIS FILE
2+let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }:
3+ if !fetchSubmodules && !private then builtins.fetchTarball {
4+ url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256;
5+ } else (import <nixpkgs> {}).fetchFromGitHub {
6+ inherit owner repo rev sha256 fetchSubmodules private;
7+ };
8+in import (fetch (builtins.fromJSON (builtins.readFile ./github.json)))
dep/snap-core/github.jsonnew file+8
@@ -0,0 +1,8 @@
1+{
2+ "owner": "obsidiansystems",
3+ "repo": "snap-core",
4+ "branch": "ts-expose-fileserve-internals",
5+ "private": false,
6+ "rev": "e015fc484e38dd9389c58b277b1884395e553bdf",
7+ "sha256": "1793x1h4lw9vnrii5akhfxx1x9yrgxf3052jf6bs8f1mhaic6mxx"
8+}
docs/obelisk-logo-640.pngnew file

Binary file not shown.

ghcjs.externs.jsdeleted−12270
@@ -1,12270 +0,0 @@
1−/** @type {*} */
2−Object.d7;
3−
4−/** @type {*} */
5−Object.d8;
6−
7−/** @type {*} */
8−Object.d9;
9−
10−/** @type {*} */
11−Object.d10;
12−
13−/** @type {*} */
14−Object.d11;
15−
16−/** @type {*} */
17−Object.d12;
18−
19−/** @type {*} */
20−Object.d13;
21−
22−/** @type {*} */
23−Object.d14;
24−
25−/** @type {*} */
26−Object.d15;
27−
28−/** @type {*} */
29−Object.d16;
30−
31−/** @type {*} */
32−Object.d17;
33−
34−/** @type {*} */
35−Object.d18;
36−
37−/** @type {*} */
38−Object.d19;
39−
40−/** @type {*} */
41−Object.d20;
42−
43−/** @type {*} */
44−Object.d21;
45−
46−/** @type {*} */
47−Object.d22;
48−
49−/** @type {*} */
50−Object.d23;
51−
52−/** @type {*} */
53−Object.d24;
54−
55−/** @type {*} */
56−Object.d25;
57−
58−/** @type {*} */
59−Object.d26;
60−
61−/** @type {*} */
62−Object.d27;
63−
64−/** @type {*} */
65−Object.d28;
66−
67−/** @type {*} */
68−Object.d29;
69−
70−/** @type {*} */
71−Object.d30;
72−
73−/** @type {*} */
74−Object.d31;
75−
76−/** @type {*} */
77−Object.d32;
78−
79−/** @type {*} */
80−Object.d33;
81−
82−/** @type {*} */
83−Object.d34;
84−
85−/** @type {*} */
86−Object.d35;
87−
88−/** @type {*} */
89−Object.d36;
90−
91−/** @type {*} */
92−Object.d37;
93−
94−/** @type {*} */
95−Object.d38;
96−
97−/** @type {*} */
98−Object.d39;
99−
100−/** @type {*} */
101−Object.d40;
102−
103−/** @type {*} */
104−Object.d41;
105−
106−/** @type {*} */
107−Object.d42;
108−
109−/** @type {*} */
110−Object.d43;
111−
112−/** @type {*} */
113−Object.d44;
114−
115−/** @type {*} */
116−Object.d45;
117−
118−/** @type {*} */
119−Object.d46;
120−
121−/** @type {*} */
122−Object.d47;
123−
124−/** @type {*} */
125−Object.d48;
126−
127−/** @type {*} */
128−Object.d49;
129−
130−/** @type {*} */
131−Object.d50;
132−
133−/** @type {*} */
134−Object.d51;
135−
136−/** @type {*} */
137−Object.d52;
138−
139−/** @type {*} */
140−Object.d53;
141−
142−/** @type {*} */
143−Object.d54;
144−
145−/** @type {*} */
146−Object.d55;
147−
148−/** @type {*} */
149−Object.d56;
150−
151−/** @type {*} */
152−Object.d57;
153−
154−/** @type {*} */
155−Object.d58;
156−
157−/** @type {*} */
158−Object.d59;
159−
160−/** @type {*} */
161−Object.d60;
162−
163−/** @type {*} */
164−Object.d61;
165−
166−/** @type {*} */
167−Object.d62;
168−
169−/** @type {*} */
170−Object.d63;
171−
172−/** @type {*} */
173−Object.d64;
174−
175−/** @type {*} */
176−Object.d65;
177−
178−/** @type {*} */
179−Object.d66;
180−
181−/** @type {*} */
182−Object.d67;
183−
184−/** @type {*} */
185−Object.d68;
186−
187−/** @type {*} */
188−Object.d69;
189−
190−/** @type {*} */
191−Object.d70;
192−
193−/** @type {*} */
194−Object.d71;
195−
196−/** @type {*} */
197−Object.d72;
198−
199−/** @type {*} */
200−Object.d73;
201−
202−/** @type {*} */
203−Object.d74;
204−
205−/** @type {*} */
206−Object.d75;
207−
208−/** @type {*} */
209−Object.d76;
210−
211−/** @type {*} */
212−Object.d77;
213−
214−/** @type {*} */
215−Object.d78;
216−
217−/** @type {*} */
218−Object.d79;
219−
220−/** @type {*} */
221−Object.d80;
222−
223−/** @type {*} */
224−Object.d81;
225−
226−/** @type {*} */
227−Object.d82;
228−
229−/** @type {*} */
230−Object.d83;
231−
232−/** @type {*} */
233−Object.d84;
234−
235−/** @type {*} */
236−Object.d85;
237−
238−/** @type {*} */
239−Object.d86;
240−
241−/** @type {*} */
242−Object.d87;
243−
244−/** @type {*} */
245−Object.d88;
246−
247−/** @type {*} */
248−Object.d89;
249−
250−/** @type {*} */
251−Object.d90;
252−
253−/** @type {*} */
254−Object.d91;
255−
256−/** @type {*} */
257−Object.d92;
258−
259−/** @type {*} */
260−Object.d93;
261−
262−/** @type {*} */
263−Object.d94;
264−
265−/** @type {*} */
266−Object.d95;
267−
268−/** @type {*} */
269−Object.d96;
270−
271−/** @type {*} */
272−Object.d97;
273−
274−/** @type {*} */
275−Object.d98;
276−
277−/** @type {*} */
278−Object.d99;
279−
280−/** @type {*} */
281−Object.d100;
282−
283−/** @type {*} */
284−Object.d101;
285−
286−/** @type {*} */
287−Object.d102;
288−
289−/** @type {*} */
290−Object.d103;
291−
292−/** @type {*} */
293−Object.d104;
294−
295−/** @type {*} */
296−Object.d105;
297−
298−/** @type {*} */
299−Object.d106;
300−
301−/** @type {*} */
302−Object.d107;
303−
304−/** @type {*} */
305−Object.d108;
306−
307−/** @type {*} */
308−Object.d109;
309−
310−/** @type {*} */
311−Object.d110;
312−
313−/** @type {*} */
314−Object.d111;
315−
316−/** @type {*} */
317−Object.d112;
318−
319−/** @type {*} */
320−Object.d113;
321−
322−/** @type {*} */
323−Object.d114;
324−
325−/** @type {*} */
326−Object.d115;
327−
328−/** @type {*} */
329−Object.d116;
330−
331−/** @type {*} */
332−Object.d117;
333−
334−/** @type {*} */
335−Object.d118;
336−
337−/** @type {*} */
338−Object.d119;
339−
340−/** @type {*} */
341−Object.d120;
342−
343−/** @type {*} */
344−Object.d121;
345−
346−/** @type {*} */
347−Object.d122;
348−
349−/** @type {*} */
350−Object.d123;
351−
352−/** @type {*} */
353−Object.d124;
354−
355−/** @type {*} */
356−Object.d125;
357−
358−/** @type {*} */
359−Object.d126;
360−
361−/** @type {*} */
362−Object.d127;
363−
364−/** @type {*} */
365−Object.d128;
366−
367−/** @type {*} */
368−Object.d129;
369−
370−/** @type {*} */
371−Object.d130;
372−
373−/** @type {*} */
374−Object.d131;
375−
376−/** @type {*} */
377−Object.d132;
378−
379−/** @type {*} */
380−Object.d133;
381−
382−/** @type {*} */
383−Object.d134;
384−
385−/** @type {*} */
386−Object.d135;
387−
388−/** @type {*} */
389−Object.d136;
390−
391−/** @type {*} */
392−Object.d137;
393−
394−/** @type {*} */
395−Object.d138;
396−
397−/** @type {*} */
398−Object.d139;
399−
400−/** @type {*} */
401−Object.d140;
402−
403−/** @type {*} */
404−Object.d141;
405−
406−/** @type {*} */
407−Object.d142;
408−
409−/** @type {*} */
410−Object.d143;
411−
412−/** @type {*} */
413−Object.d144;
414−
415−/** @type {*} */
416−Object.d145;
417−
418−/** @type {*} */
419−Object.d146;
420−
421−/** @type {*} */
422−Object.d147;
423−
424−/** @type {*} */
425−Object.d148;
426−
427−/** @type {*} */
428−Object.d149;
429−
430−/** @type {*} */
431−Object.d150;
432−
433−/** @type {*} */
434−Object.d151;
435−
436−/** @type {*} */
437−Object.d152;
438−
439−/** @type {*} */
440−Object.d153;
441−
442−/** @type {*} */
443−Object.d154;
444−
445−/** @type {*} */
446−Object.d155;
447−
448−/** @type {*} */
449−Object.d156;
450−
451−/** @type {*} */
452−Object.d157;
453−
454−/** @type {*} */
455−Object.d158;
456−
457−/** @type {*} */
458−Object.d159;
459−
460−/** @type {*} */
461−Object.d160;
462−
463−/** @type {*} */
464−Object.d161;
465−
466−/** @type {*} */
467−Object.d162;
468−
469−/** @type {*} */
470−Object.d163;
471−
472−/** @type {*} */
473−Object.d164;
474−
475−/** @type {*} */
476−Object.d165;
477−
478−/** @type {*} */
479−Object.d166;
480−
481−/** @type {*} */
482−Object.d167;
483−
484−/** @type {*} */
485−Object.d168;
486−
487−/** @type {*} */
488−Object.d169;
489−
490−/** @type {*} */
491−Object.d170;
492−
493−/** @type {*} */
494−Object.d171;
495−
496−/** @type {*} */
497−Object.d172;
498−
499−/** @type {*} */
500−Object.d173;
501−
502−/** @type {*} */
503−Object.d174;
504−
505−/** @type {*} */
506−Object.d175;
507−
508−/** @type {*} */
509−Object.d176;
510−
511−/** @type {*} */
512−Object.d177;
513−
514−/** @type {*} */
515−Object.d178;
516−
517−/** @type {*} */
518−Object.d179;
519−
520−/** @type {*} */
521−Object.d180;
522−
523−/** @type {*} */
524−Object.d181;
525−
526−/** @type {*} */
527−Object.d182;
528−
529−/** @type {*} */
530−Object.d183;
531−
532−/** @type {*} */
533−Object.d184;
534−
535−/** @type {*} */
536−Object.d185;
537−
538−/** @type {*} */
539−Object.d186;
540−
541−/** @type {*} */
542−Object.d187;
543−
544−/** @type {*} */
545−Object.d188;
546−
547−/** @type {*} */
548−Object.d189;
549−
550−/** @type {*} */
551−Object.d190;
552−
553−/** @type {*} */
554−Object.d191;
555−
556−/** @type {*} */
557−Object.d192;
558−
559−/** @type {*} */
560−Object.d193;
561−
562−/** @type {*} */
563−Object.d194;
564−
565−/** @type {*} */
566−Object.d195;
567−
568−/** @type {*} */
569−Object.d196;
570−
571−/** @type {*} */
572−Object.d197;
573−
574−/** @type {*} */
575−Object.d198;
576−
577−/** @type {*} */
578−Object.d199;
579−
580−/** @type {*} */
581−Object.d200;
582−
583−/** @type {*} */
584−Object.d201;
585−
586−/** @type {*} */
587−Object.d202;
588−
589−/** @type {*} */
590−Object.d203;
591−
592−/** @type {*} */
593−Object.d204;
594−
595−/** @type {*} */
596−Object.d205;
597−
598−/** @type {*} */
599−Object.d206;
600−
601−/** @type {*} */
602−Object.d207;
603−
604−/** @type {*} */
605−Object.d208;
606−
607−/** @type {*} */
608−Object.d209;
609−
610−/** @type {*} */
611−Object.d210;
612−
613−/** @type {*} */
614−Object.d211;
615−
616−/** @type {*} */
617−Object.d212;
618−
619−/** @type {*} */
620−Object.d213;
621−
622−/** @type {*} */
623−Object.d214;
624−
625−/** @type {*} */
626−Object.d215;
627−
628−/** @type {*} */
629−Object.d216;
630−
631−/** @type {*} */
632−Object.d217;
633−
634−/** @type {*} */
635−Object.d218;
636−
637−/** @type {*} */
638−Object.d219;
639−
640−/** @type {*} */
641−Object.d220;
642−
643−/** @type {*} */
644−Object.d221;
645−
646−/** @type {*} */
647−Object.d222;
648−
649−/** @type {*} */
650−Object.d223;
651−
652−/** @type {*} */
653−Object.d224;
654−
655−/** @type {*} */
656−Object.d225;
657−
658−/** @type {*} */
659−Object.d226;
660−
661−/** @type {*} */
662−Object.d227;
663−
664−/** @type {*} */
665−Object.d228;
666−
667−/** @type {*} */
668−Object.d229;
669−
670−/** @type {*} */
671−Object.d230;
672−
673−/** @type {*} */
674−Object.d231;
675−
676−/** @type {*} */
677−Object.d232;
678−
679−/** @type {*} */
680−Object.d233;
681−
682−/** @type {*} */
683−Object.d234;
684−
685−/** @type {*} */
686−Object.d235;
687−
688−/** @type {*} */
689−Object.d236;
690−
691−/** @type {*} */
692−Object.d237;
693−
694−/** @type {*} */
695−Object.d238;
696−
697−/** @type {*} */
698−Object.d239;
699−
700−/** @type {*} */
701−Object.d240;
702−
703−/** @type {*} */
704−Object.d241;
705−
706−/** @type {*} */
707−Object.d242;
708−
709−/** @type {*} */
710−Object.d243;
711−
712−/** @type {*} */
713−Object.d244;
714−
715−/** @type {*} */
716−Object.d245;
717−
718−/** @type {*} */
719−Object.d246;
720−
721−/** @type {*} */
722−Object.d247;
723−
724−/** @type {*} */
725−Object.d248;
726−
727−/** @type {*} */
728−Object.d249;
729−
730−/** @type {*} */
731−Object.d250;
732−
733−/** @type {*} */
734−Object.d251;
735−
736−/** @type {*} */
737−Object.d252;
738−
739−/** @type {*} */
740−Object.d253;
741−
742−/** @type {*} */
743−Object.d254;
744−
745−/** @type {*} */
746−Object.d255;
747−
748−/** @type {*} */
749−Object.d256;
750−
751−/** @type {*} */
752−Object.d257;
753−
754−/** @type {*} */
755−Object.d258;
756−
757−/** @type {*} */
758−Object.d259;
759−
760−/** @type {*} */
761−Object.d260;
762−
763−/** @type {*} */
764−Object.d261;
765−
766−/** @type {*} */
767−Object.d262;
768−
769−/** @type {*} */
770−Object.d263;
771−
772−/** @type {*} */
773−Object.d264;
774−
775−/** @type {*} */
776−Object.d265;
777−
778−/** @type {*} */
779−Object.d266;
780−
781−/** @type {*} */
782−Object.d267;
783−
784−/** @type {*} */
785−Object.d268;
786−
787−/** @type {*} */
788−Object.d269;
789−
790−/** @type {*} */
791−Object.d270;
792−
793−/** @type {*} */
794−Object.d271;
795−
796−/** @type {*} */
797−Object.d272;
798−
799−/** @type {*} */
800−Object.d273;
801−
802−/** @type {*} */
803−Object.d274;
804−
805−/** @type {*} */
806−Object.d275;
807−
808−/** @type {*} */
809−Object.d276;
810−
811−/** @type {*} */
812−Object.d277;
813−
814−/** @type {*} */
815−Object.d278;
816−
817−/** @type {*} */
818−Object.d279;
819−
820−/** @type {*} */
821−Object.d280;
822−
823−/** @type {*} */
824−Object.d281;
825−
826−/** @type {*} */
827−Object.d282;
828−
829−/** @type {*} */
830−Object.d283;
831−
832−/** @type {*} */
833−Object.d284;
834−
835−/** @type {*} */
836−Object.d285;
837−
838−/** @type {*} */
839−Object.d286;
840−
841−/** @type {*} */
842−Object.d287;
843−
844−/** @type {*} */
845−Object.d288;
846−
847−/** @type {*} */
848−Object.d289;
849−
850−/** @type {*} */
851−Object.d290;
852−
853−/** @type {*} */
854−Object.d291;
855−
856−/** @type {*} */
857−Object.d292;
858−
859−/** @type {*} */
860−Object.d293;
861−
862−/** @type {*} */
863−Object.d294;
864−
865−/** @type {*} */
866−Object.d295;
867−
868−/** @type {*} */
869−Object.d296;
870−
871−/** @type {*} */
872−Object.d297;
873−
874−/** @type {*} */
875−Object.d298;
876−
877−/** @type {*} */
878−Object.d299;
879−
880−/** @type {*} */
881−Object.d300;
882−
883−/** @type {*} */
884−Object.d301;
885−
886−/** @type {*} */
887−Object.d302;
888−
889−/** @type {*} */
890−Object.d303;
891−
892−/** @type {*} */
893−Object.d304;
894−
895−/** @type {*} */
896−Object.d305;
897−
898−/** @type {*} */
899−Object.d306;
900−
901−/** @type {*} */
902−Object.d307;
903−
904−/** @type {*} */
905−Object.d308;
906−
907−/** @type {*} */
908−Object.d309;
909−
910−/** @type {*} */
911−Object.d310;
912−
913−/** @type {*} */
914−Object.d311;
915−
916−/** @type {*} */
917−Object.d312;
918−
919−/** @type {*} */
920−Object.d313;
921−
922−/** @type {*} */
923−Object.d314;
924−
925−/** @type {*} */
926−Object.d315;
927−
928−/** @type {*} */
929−Object.d316;
930−
931−/** @type {*} */
932−Object.d317;
933−
934−/** @type {*} */
935−Object.d318;
936−
937−/** @type {*} */
938−Object.d319;
939−
940−/** @type {*} */
941−Object.d320;
942−
943−/** @type {*} */
944−Object.d321;
945−
946−/** @type {*} */
947−Object.d322;
948−
949−/** @type {*} */
950−Object.d323;
951−
952−/** @type {*} */
953−Object.d324;
954−
955−/** @type {*} */
956−Object.d325;
957−
958−/** @type {*} */
959−Object.d326;
960−
961−/** @type {*} */
962−Object.d327;
963−
964−/** @type {*} */
965−Object.d328;
966−
967−/** @type {*} */
968−Object.d329;
969−
970−/** @type {*} */
971−Object.d330;
972−
973−/** @type {*} */
974−Object.d331;
975−
976−/** @type {*} */
977−Object.d332;
978−
979−/** @type {*} */
980−Object.d333;
981−
982−/** @type {*} */
983−Object.d334;
984−
985−/** @type {*} */
986−Object.d335;
987−
988−/** @type {*} */
989−Object.d336;
990−
991−/** @type {*} */
992−Object.d337;
993−
994−/** @type {*} */
995−Object.d338;
996−
997−/** @type {*} */
998−Object.d339;
999−
1000−/** @type {*} */
1001−Object.d340;
1002−
1003−/** @type {*} */
1004−Object.d341;
1005−
1006−/** @type {*} */
1007−Object.d342;
1008−
1009−/** @type {*} */
1010−Object.d343;
1011−
1012−/** @type {*} */
1013−Object.d344;
1014−
1015−/** @type {*} */
1016−Object.d345;
1017−
1018−/** @type {*} */
1019−Object.d346;
1020−
1021−/** @type {*} */
1022−Object.d347;
1023−
1024−/** @type {*} */
1025−Object.d348;
1026−
1027−/** @type {*} */
1028−Object.d349;
1029−
1030−/** @type {*} */
1031−Object.d350;
1032−
1033−/** @type {*} */
1034−Object.d351;
1035−
1036−/** @type {*} */
1037−Object.d352;
1038−
1039−/** @type {*} */
1040−Object.d353;
1041−
1042−/** @type {*} */
1043−Object.d354;
1044−
1045−/** @type {*} */
1046−Object.d355;
1047−
1048−/** @type {*} */
1049−Object.d356;
1050−
1051−/** @type {*} */
1052−Object.d357;
1053−
1054−/** @type {*} */
1055−Object.d358;
1056−
1057−/** @type {*} */
1058−Object.d359;
1059−
1060−/** @type {*} */
1061−Object.d360;
1062−
1063−/** @type {*} */
1064−Object.d361;
1065−
1066−/** @type {*} */
1067−Object.d362;
1068−
1069−/** @type {*} */
1070−Object.d363;
1071−
1072−/** @type {*} */
1073−Object.d364;
1074−
1075−/** @type {*} */
1076−Object.d365;
1077−
1078−/** @type {*} */
1079−Object.d366;
1080−
1081−/** @type {*} */
1082−Object.d367;
1083−
1084−/** @type {*} */
1085−Object.d368;
1086−
1087−/** @type {*} */
1088−Object.d369;
1089−
1090−/** @type {*} */
1091−Object.d370;
1092−
1093−/** @type {*} */
1094−Object.d371;
1095−
1096−/** @type {*} */
1097−Object.d372;
1098−
1099−/** @type {*} */
1100−Object.d373;
1101−
1102−/** @type {*} */
1103−Object.d374;
1104−
1105−/** @type {*} */
1106−Object.d375;
1107−
1108−/** @type {*} */
1109−Object.d376;
1110−
1111−/** @type {*} */
1112−Object.d377;
1113−
1114−/** @type {*} */
1115−Object.d378;
1116−
1117−/** @type {*} */
1118−Object.d379;
1119−
1120−/** @type {*} */
1121−Object.d380;
1122−
1123−/** @type {*} */
1124−Object.d381;
1125−
1126−/** @type {*} */
1127−Object.d382;
1128−
1129−/** @type {*} */
1130−Object.d383;
1131−
1132−/** @type {*} */
1133−Object.d384;
1134−
1135−/** @type {*} */
1136−Object.d385;
1137−
1138−/** @type {*} */
1139−Object.d386;
1140−
1141−/** @type {*} */
1142−Object.d387;
1143−
1144−/** @type {*} */
1145−Object.d388;
1146−
1147−/** @type {*} */
1148−Object.d389;
1149−
1150−/** @type {*} */
1151−Object.d390;
1152−
1153−/** @type {*} */
1154−Object.d391;
1155−
1156−/** @type {*} */
1157−Object.d392;
1158−
1159−/** @type {*} */
1160−Object.d393;
1161−
1162−/** @type {*} */
1163−Object.d394;
1164−
1165−/** @type {*} */
1166−Object.d395;
1167−
1168−/** @type {*} */
1169−Object.d396;
1170−
1171−/** @type {*} */
1172−Object.d397;
1173−
1174−/** @type {*} */
1175−Object.d398;
1176−
1177−/** @type {*} */
1178−Object.d399;
1179−
1180−/** @type {*} */
1181−Object.d400;
1182−
1183−/** @type {*} */
1184−Object.d401;
1185−
1186−/** @type {*} */
1187−Object.d402;
1188−
1189−/** @type {*} */
1190−Object.d403;
1191−
1192−/** @type {*} */
1193−Object.d404;
1194−
1195−/** @type {*} */
1196−Object.d405;
1197−
1198−/** @type {*} */
1199−Object.d406;
1200−
1201−/** @type {*} */
1202−Object.d407;
1203−
1204−/** @type {*} */
1205−Object.d408;
1206−
1207−/** @type {*} */
1208−Object.d409;
1209−
1210−/** @type {*} */
1211−Object.d410;
1212−
1213−/** @type {*} */
1214−Object.d411;
1215−
1216−/** @type {*} */
1217−Object.d412;
1218−
1219−/** @type {*} */
1220−Object.d413;
1221−
1222−/** @type {*} */
1223−Object.d414;
1224−
1225−/** @type {*} */
1226−Object.d415;
1227−
1228−/** @type {*} */
1229−Object.d416;
1230−
1231−/** @type {*} */
1232−Object.d417;
1233−
1234−/** @type {*} */
1235−Object.d418;
1236−
1237−/** @type {*} */
1238−Object.d419;
1239−
1240−/** @type {*} */
1241−Object.d420;
1242−
1243−/** @type {*} */
1244−Object.d421;
1245−
1246−/** @type {*} */
1247−Object.d422;
1248−
1249−/** @type {*} */
1250−Object.d423;
1251−
1252−/** @type {*} */
1253−Object.d424;
1254−
1255−/** @type {*} */
1256−Object.d425;
1257−
1258−/** @type {*} */
1259−Object.d426;
1260−
1261−/** @type {*} */
1262−Object.d427;
1263−
1264−/** @type {*} */
1265−Object.d428;
1266−
1267−/** @type {*} */
1268−Object.d429;
1269−
1270−/** @type {*} */
1271−Object.d430;
1272−
1273−/** @type {*} */
1274−Object.d431;
1275−
1276−/** @type {*} */
1277−Object.d432;
1278−
1279−/** @type {*} */
1280−Object.d433;
1281−
1282−/** @type {*} */
1283−Object.d434;
1284−
1285−/** @type {*} */
1286−Object.d435;
1287−
1288−/** @type {*} */
1289−Object.d436;
1290−
1291−/** @type {*} */
1292−Object.d437;
1293−
1294−/** @type {*} */
1295−Object.d438;
1296−
1297−/** @type {*} */
1298−Object.d439;
1299−
1300−/** @type {*} */
1301−Object.d440;
1302−
1303−/** @type {*} */
1304−Object.d441;
1305−
1306−/** @type {*} */
1307−Object.d442;
1308−
1309−/** @type {*} */
1310−Object.d443;
1311−
1312−/** @type {*} */
1313−Object.d444;
1314−
1315−/** @type {*} */
1316−Object.d445;
1317−
1318−/** @type {*} */
1319−Object.d446;
1320−
1321−/** @type {*} */
1322−Object.d447;
1323−
1324−/** @type {*} */
1325−Object.d448;
1326−
1327−/** @type {*} */
1328−Object.d449;
1329−
1330−/** @type {*} */
1331−Object.d450;
1332−
1333−/** @type {*} */
1334−Object.d451;
1335−
1336−/** @type {*} */
1337−Object.d452;
1338−
1339−/** @type {*} */
1340−Object.d453;
1341−
1342−/** @type {*} */
1343−Object.d454;
1344−
1345−/** @type {*} */
1346−Object.d455;
1347−
1348−/** @type {*} */
1349−Object.d456;
1350−
1351−/** @type {*} */
1352−Object.d457;
1353−
1354−/** @type {*} */
1355−Object.d458;
1356−
1357−/** @type {*} */
1358−Object.d459;
1359−
1360−/** @type {*} */
1361−Object.d460;
1362−
1363−/** @type {*} */
1364−Object.d461;
1365−
1366−/** @type {*} */
1367−Object.d462;
1368−
1369−/** @type {*} */
1370−Object.d463;
1371−
1372−/** @type {*} */
1373−Object.d464;
1374−
1375−/** @type {*} */
1376−Object.d465;
1377−
1378−/** @type {*} */
1379−Object.d466;
1380−
1381−/** @type {*} */
1382−Object.d467;
1383−
1384−/** @type {*} */
1385−Object.d468;
1386−
1387−/** @type {*} */
1388−Object.d469;
1389−
1390−/** @type {*} */
1391−Object.d470;
1392−
1393−/** @type {*} */
1394−Object.d471;
1395−
1396−/** @type {*} */
1397−Object.d472;
1398−
1399−/** @type {*} */
1400−Object.d473;
1401−
1402−/** @type {*} */
1403−Object.d474;
1404−
1405−/** @type {*} */
1406−Object.d475;
1407−
1408−/** @type {*} */
1409−Object.d476;
1410−
1411−/** @type {*} */
1412−Object.d477;
1413−
1414−/** @type {*} */
1415−Object.d478;
1416−
1417−/** @type {*} */
1418−Object.d479;
1419−
1420−/** @type {*} */
1421−Object.d480;
1422−
1423−/** @type {*} */
1424−Object.d481;
1425−
1426−/** @type {*} */
1427−Object.d482;
1428−
1429−/** @type {*} */
1430−Object.d483;
1431−
1432−/** @type {*} */
1433−Object.d484;
1434−
1435−/** @type {*} */
1436−Object.d485;
1437−
1438−/** @type {*} */
1439−Object.d486;
1440−
1441−/** @type {*} */
1442−Object.d487;
1443−
1444−/** @type {*} */
1445−Object.d488;
1446−
1447−/** @type {*} */
1448−Object.d489;
1449−
1450−/** @type {*} */
1451−Object.d490;
1452−
1453−/** @type {*} */
1454−Object.d491;
1455−
1456−/** @type {*} */
1457−Object.d492;
1458−
1459−/** @type {*} */
1460−Object.d493;
1461−
1462−/** @type {*} */
1463−Object.d494;
1464−
1465−/** @type {*} */
1466−Object.d495;
1467−
1468−/** @type {*} */
1469−Object.d496;
1470−
1471−/** @type {*} */
1472−Object.d497;
1473−
1474−/** @type {*} */
1475−Object.d498;
1476−
1477−/** @type {*} */
1478−Object.d499;
1479−
1480−/** @type {*} */
1481−Object.d500;
1482−
1483−/** @type {*} */
1484−Object.d501;
1485−
1486−/** @type {*} */
1487−Object.d502;
1488−
1489−/** @type {*} */
1490−Object.d503;
1491−
1492−/** @type {*} */
1493−Object.d504;
1494−
1495−/** @type {*} */
1496−Object.d505;
1497−
1498−/** @type {*} */
1499−Object.d506;
1500−
1501−/** @type {*} */
1502−Object.d507;
1503−
1504−/** @type {*} */
1505−Object.d508;
1506−
1507−/** @type {*} */
1508−Object.d509;
1509−
1510−/** @type {*} */
1511−Object.d510;
1512−
1513−/** @type {*} */
1514−Object.d511;
1515−
1516−/** @type {*} */
1517−Object.d512;
1518−
1519−/** @type {*} */
1520−Object.d513;
1521−
1522−/** @type {*} */
1523−Object.d514;
1524−
1525−/** @type {*} */
1526−Object.d515;
1527−
1528−/** @type {*} */
1529−Object.d516;
1530−
1531−/** @type {*} */
1532−Object.d517;
1533−
1534−/** @type {*} */
1535−Object.d518;
1536−
1537−/** @type {*} */
1538−Object.d519;
1539−
1540−/** @type {*} */
1541−Object.d520;
1542−
1543−/** @type {*} */
1544−Object.d521;
1545−
1546−/** @type {*} */
1547−Object.d522;
1548−
1549−/** @type {*} */
1550−Object.d523;
1551−
1552−/** @type {*} */
1553−Object.d524;
1554−
1555−/** @type {*} */
1556−Object.d525;
1557−
1558−/** @type {*} */
1559−Object.d526;
1560−
1561−/** @type {*} */
1562−Object.d527;
1563−
1564−/** @type {*} */
1565−Object.d528;
1566−
1567−/** @type {*} */
1568−Object.d529;
1569−
1570−/** @type {*} */
1571−Object.d530;
1572−
1573−/** @type {*} */
1574−Object.d531;
1575−
1576−/** @type {*} */
1577−Object.d532;
1578−
1579−/** @type {*} */
1580−Object.d533;
1581−
1582−/** @type {*} */
1583−Object.d534;
1584−
1585−/** @type {*} */
1586−Object.d535;
1587−
1588−/** @type {*} */
1589−Object.d536;
1590−
1591−/** @type {*} */
1592−Object.d537;
1593−
1594−/** @type {*} */
1595−Object.d538;
1596−
1597−/** @type {*} */
1598−Object.d539;
1599−
1600−/** @type {*} */
1601−Object.d540;
1602−
1603−/** @type {*} */
1604−Object.d541;
1605−
1606−/** @type {*} */
1607−Object.d542;
1608−
1609−/** @type {*} */
1610−Object.d543;
1611−
1612−/** @type {*} */
1613−Object.d544;
1614−
1615−/** @type {*} */
1616−Object.d545;
1617−
1618−/** @type {*} */
1619−Object.d546;
1620−
1621−/** @type {*} */
1622−Object.d547;
1623−
1624−/** @type {*} */
1625−Object.d548;
1626−
1627−/** @type {*} */
1628−Object.d549;
1629−
1630−/** @type {*} */
1631−Object.d550;
1632−
1633−/** @type {*} */
1634−Object.d551;
1635−
1636−/** @type {*} */
1637−Object.d552;
1638−
1639−/** @type {*} */
1640−Object.d553;
1641−
1642−/** @type {*} */
1643−Object.d554;
1644−
1645−/** @type {*} */
1646−Object.d555;
1647−
1648−/** @type {*} */
1649−Object.d556;
1650−
1651−/** @type {*} */
1652−Object.d557;
1653−
1654−/** @type {*} */
1655−Object.d558;
1656−
1657−/** @type {*} */
1658−Object.d559;
1659−
1660−/** @type {*} */
1661−Object.d560;
1662−
1663−/** @type {*} */
1664−Object.d561;
1665−
1666−/** @type {*} */
1667−Object.d562;
1668−
1669−/** @type {*} */
1670−Object.d563;
1671−
1672−/** @type {*} */
1673−Object.d564;
1674−
1675−/** @type {*} */
1676−Object.d565;
1677−
1678−/** @type {*} */
1679−Object.d566;
1680−
1681−/** @type {*} */
1682−Object.d567;
1683−
1684−/** @type {*} */
1685−Object.d568;
1686−
1687−/** @type {*} */
1688−Object.d569;
1689−
1690−/** @type {*} */
1691−Object.d570;
1692−
1693−/** @type {*} */
1694−Object.d571;
1695−
1696−/** @type {*} */
1697−Object.d572;
1698−
1699−/** @type {*} */
1700−Object.d573;
1701−
1702−/** @type {*} */
1703−Object.d574;
1704−
1705−/** @type {*} */
1706−Object.d575;
1707−
1708−/** @type {*} */
1709−Object.d576;
1710−
1711−/** @type {*} */
1712−Object.d577;
1713−
1714−/** @type {*} */
1715−Object.d578;
1716−
1717−/** @type {*} */
1718−Object.d579;
1719−
1720−/** @type {*} */
1721−Object.d580;
1722−
1723−/** @type {*} */
1724−Object.d581;
1725−
1726−/** @type {*} */
1727−Object.d582;
1728−
1729−/** @type {*} */
1730−Object.d583;
1731−
1732−/** @type {*} */
1733−Object.d584;
1734−
1735−/** @type {*} */
1736−Object.d585;
1737−
1738−/** @type {*} */
1739−Object.d586;
1740−
1741−/** @type {*} */
1742−Object.d587;
1743−
1744−/** @type {*} */
1745−Object.d588;
1746−
1747−/** @type {*} */
1748−Object.d589;
1749−
1750−/** @type {*} */
1751−Object.d590;
1752−
1753−/** @type {*} */
1754−Object.d591;
1755−
1756−/** @type {*} */
1757−Object.d592;
1758−
1759−/** @type {*} */
1760−Object.d593;
1761−
1762−/** @type {*} */
1763−Object.d594;
1764−
1765−/** @type {*} */
1766−Object.d595;
1767−
1768−/** @type {*} */
1769−Object.d596;
1770−
1771−/** @type {*} */
1772−Object.d597;
1773−
1774−/** @type {*} */
1775−Object.d598;
1776−
1777−/** @type {*} */
1778−Object.d599;
1779−
1780−/** @type {*} */
1781−Object.d600;
1782−
1783−/** @type {*} */
1784−Object.d601;
1785−
1786−/** @type {*} */
1787−Object.d602;
1788−
1789−/** @type {*} */
1790−Object.d603;
1791−
1792−/** @type {*} */
1793−Object.d604;
1794−
1795−/** @type {*} */
1796−Object.d605;
1797−
1798−/** @type {*} */
1799−Object.d606;
1800−
1801−/** @type {*} */
1802−Object.d607;
1803−
1804−/** @type {*} */
1805−Object.d608;
1806−
1807−/** @type {*} */
1808−Object.d609;
1809−
1810−/** @type {*} */
1811−Object.d610;
1812−
1813−/** @type {*} */
1814−Object.d611;
1815−
1816−/** @type {*} */
1817−Object.d612;
1818−
1819−/** @type {*} */
1820−Object.d613;
1821−
1822−/** @type {*} */
1823−Object.d614;
1824−
1825−/** @type {*} */
1826−Object.d615;
1827−
1828−/** @type {*} */
1829−Object.d616;
1830−
1831−/** @type {*} */
1832−Object.d617;
1833−
1834−/** @type {*} */
1835−Object.d618;
1836−
1837−/** @type {*} */
1838−Object.d619;
1839−
1840−/** @type {*} */
1841−Object.d620;
1842−
1843−/** @type {*} */
1844−Object.d621;
1845−
1846−/** @type {*} */
1847−Object.d622;
1848−
1849−/** @type {*} */
1850−Object.d623;
1851−
1852−/** @type {*} */
1853−Object.d624;
1854−
1855−/** @type {*} */
1856−Object.d625;
1857−
1858−/** @type {*} */
1859−Object.d626;
1860−
1861−/** @type {*} */
1862−Object.d627;
1863−
1864−/** @type {*} */
1865−Object.d628;
1866−
1867−/** @type {*} */
1868−Object.d629;
1869−
1870−/** @type {*} */
1871−Object.d630;
1872−
1873−/** @type {*} */
1874−Object.d631;
1875−
1876−/** @type {*} */
1877−Object.d632;
1878−
1879−/** @type {*} */
1880−Object.d633;
1881−
1882−/** @type {*} */
1883−Object.d634;
1884−
1885−/** @type {*} */
1886−Object.d635;
1887−
1888−/** @type {*} */
1889−Object.d636;
1890−
1891−/** @type {*} */
1892−Object.d637;
1893−
1894−/** @type {*} */
1895−Object.d638;
1896−
1897−/** @type {*} */
1898−Object.d639;
1899−
1900−/** @type {*} */
1901−Object.d640;
1902−
1903−/** @type {*} */
1904−Object.d641;
1905−
1906−/** @type {*} */
1907−Object.d642;
1908−
1909−/** @type {*} */
1910−Object.d643;
1911−
1912−/** @type {*} */
1913−Object.d644;
1914−
1915−/** @type {*} */
1916−Object.d645;
1917−
1918−/** @type {*} */
1919−Object.d646;
1920−
1921−/** @type {*} */
1922−Object.d647;
1923−
1924−/** @type {*} */
1925−Object.d648;
1926−
1927−/** @type {*} */
1928−Object.d649;
1929−
1930−/** @type {*} */
1931−Object.d650;
1932−
1933−/** @type {*} */
1934−Object.d651;
1935−
1936−/** @type {*} */
1937−Object.d652;
1938−
1939−/** @type {*} */
1940−Object.d653;
1941−
1942−/** @type {*} */
1943−Object.d654;
1944−
1945−/** @type {*} */
1946−Object.d655;
1947−
1948−/** @type {*} */
1949−Object.d656;
1950−
1951−/** @type {*} */
1952−Object.d657;
1953−
1954−/** @type {*} */
1955−Object.d658;
1956−
1957−/** @type {*} */
1958−Object.d659;
1959−
1960−/** @type {*} */
1961−Object.d660;
1962−
1963−/** @type {*} */
1964−Object.d661;
1965−
1966−/** @type {*} */
1967−Object.d662;
1968−
1969−/** @type {*} */
1970−Object.d663;
1971−
1972−/** @type {*} */
1973−Object.d664;
1974−
1975−/** @type {*} */
1976−Object.d665;
1977−
1978−/** @type {*} */
1979−Object.d666;
1980−
1981−/** @type {*} */
1982−Object.d667;
1983−
1984−/** @type {*} */
1985−Object.d668;
1986−
1987−/** @type {*} */
1988−Object.d669;
1989−
1990−/** @type {*} */
1991−Object.d670;
1992−
1993−/** @type {*} */
1994−Object.d671;
1995−
1996−/** @type {*} */
1997−Object.d672;
1998−
1999−/** @type {*} */
2000−Object.d673;
2001−
2002−/** @type {*} */
2003−Object.d674;
2004−
2005−/** @type {*} */
2006−Object.d675;
2007−
2008−/** @type {*} */
2009−Object.d676;
2010−
2011−/** @type {*} */
2012−Object.d677;
2013−
2014−/** @type {*} */
2015−Object.d678;
2016−
2017−/** @type {*} */
2018−Object.d679;
2019−
2020−/** @type {*} */
2021−Object.d680;
2022−
2023−/** @type {*} */
2024−Object.d681;
2025−
2026−/** @type {*} */
2027−Object.d682;
2028−
2029−/** @type {*} */
2030−Object.d683;
2031−
2032−/** @type {*} */
2033−Object.d684;
2034−
2035−/** @type {*} */
2036−Object.d685;
2037−
2038−/** @type {*} */
2039−Object.d686;
2040−
2041−/** @type {*} */
2042−Object.d687;
2043−
2044−/** @type {*} */
2045−Object.d688;
2046−
2047−/** @type {*} */
2048−Object.d689;
2049−
2050−/** @type {*} */
2051−Object.d690;
2052−
2053−/** @type {*} */
2054−Object.d691;
2055−
2056−/** @type {*} */
2057−Object.d692;
2058−
2059−/** @type {*} */
2060−Object.d693;
2061−
2062−/** @type {*} */
2063−Object.d694;
2064−
2065−/** @type {*} */
2066−Object.d695;
2067−
2068−/** @type {*} */
2069−Object.d696;
2070−
2071−/** @type {*} */
2072−Object.d697;
2073−
2074−/** @type {*} */
2075−Object.d698;
2076−
2077−/** @type {*} */
2078−Object.d699;
2079−
2080−/** @type {*} */
2081−Object.d700;
2082−
2083−/** @type {*} */
2084−Object.d701;
2085−
2086−/** @type {*} */
2087−Object.d702;
2088−
2089−/** @type {*} */
2090−Object.d703;
2091−
2092−/** @type {*} */
2093−Object.d704;
2094−
2095−/** @type {*} */
2096−Object.d705;
2097−
2098−/** @type {*} */
2099−Object.d706;
2100−
2101−/** @type {*} */
2102−Object.d707;
2103−
2104−/** @type {*} */
2105−Object.d708;
2106−
2107−/** @type {*} */
2108−Object.d709;
2109−
2110−/** @type {*} */
2111−Object.d710;
2112−
2113−/** @type {*} */
2114−Object.d711;
2115−
2116−/** @type {*} */
2117−Object.d712;
2118−
2119−/** @type {*} */
2120−Object.d713;
2121−
2122−/** @type {*} */
2123−Object.d714;
2124−
2125−/** @type {*} */
2126−Object.d715;
2127−
2128−/** @type {*} */
2129−Object.d716;
2130−
2131−/** @type {*} */
2132−Object.d717;
2133−
2134−/** @type {*} */
2135−Object.d718;
2136−
2137−/** @type {*} */
2138−Object.d719;
2139−
2140−/** @type {*} */
2141−Object.d720;
2142−
2143−/** @type {*} */
2144−Object.d721;
2145−
2146−/** @type {*} */
2147−Object.d722;
2148−
2149−/** @type {*} */
2150−Object.d723;
2151−
2152−/** @type {*} */
2153−Object.d724;
2154−
2155−/** @type {*} */
2156−Object.d725;
2157−
2158−/** @type {*} */
2159−Object.d726;
2160−
2161−/** @type {*} */
2162−Object.d727;
2163−
2164−/** @type {*} */
2165−Object.d728;
2166−
2167−/** @type {*} */
2168−Object.d729;
2169−
2170−/** @type {*} */
2171−Object.d730;
2172−
2173−/** @type {*} */
2174−Object.d731;
2175−
2176−/** @type {*} */
2177−Object.d732;
2178−
2179−/** @type {*} */
2180−Object.d733;
2181−
2182−/** @type {*} */
2183−Object.d734;
2184−
2185−/** @type {*} */
2186−Object.d735;
2187−
2188−/** @type {*} */
2189−Object.d736;
2190−
2191−/** @type {*} */
2192−Object.d737;
2193−
2194−/** @type {*} */
2195−Object.d738;
2196−
2197−/** @type {*} */
2198−Object.d739;
2199−
2200−/** @type {*} */
2201−Object.d740;
2202−
2203−/** @type {*} */
2204−Object.d741;
2205−
2206−/** @type {*} */
2207−Object.d742;
2208−
2209−/** @type {*} */
2210−Object.d743;
2211−
2212−/** @type {*} */
2213−Object.d744;
2214−
2215−/** @type {*} */
2216−Object.d745;
2217−
2218−/** @type {*} */
2219−Object.d746;
2220−
2221−/** @type {*} */
2222−Object.d747;
2223−
2224−/** @type {*} */
2225−Object.d748;
2226−
2227−/** @type {*} */
2228−Object.d749;
2229−
2230−/** @type {*} */
2231−Object.d750;
2232−
2233−/** @type {*} */
2234−Object.d751;
2235−
2236−/** @type {*} */
2237−Object.d752;
2238−
2239−/** @type {*} */
2240−Object.d753;
2241−
2242−/** @type {*} */
2243−Object.d754;
2244−
2245−/** @type {*} */
2246−Object.d755;
2247−
2248−/** @type {*} */
2249−Object.d756;
2250−
2251−/** @type {*} */
2252−Object.d757;
2253−
2254−/** @type {*} */
2255−Object.d758;
2256−
2257−/** @type {*} */
2258−Object.d759;
2259−
2260−/** @type {*} */
2261−Object.d760;
2262−
2263−/** @type {*} */
2264−Object.d761;
2265−
2266−/** @type {*} */
2267−Object.d762;
2268−
2269−/** @type {*} */
2270−Object.d763;
2271−
2272−/** @type {*} */
2273−Object.d764;
2274−
2275−/** @type {*} */
2276−Object.d765;
2277−
2278−/** @type {*} */
2279−Object.d766;
2280−
2281−/** @type {*} */
2282−Object.d767;
2283−
2284−/** @type {*} */
2285−Object.d768;
2286−
2287−/** @type {*} */
2288−Object.d769;
2289−
2290−/** @type {*} */
2291−Object.d770;
2292−
2293−/** @type {*} */
2294−Object.d771;
2295−
2296−/** @type {*} */
2297−Object.d772;
2298−
2299−/** @type {*} */
2300−Object.d773;
2301−
2302−/** @type {*} */
2303−Object.d774;
2304−
2305−/** @type {*} */
2306−Object.d775;
2307−
2308−/** @type {*} */
2309−Object.d776;
2310−
2311−/** @type {*} */
2312−Object.d777;
2313−
2314−/** @type {*} */
2315−Object.d778;
2316−
2317−/** @type {*} */
2318−Object.d779;
2319−
2320−/** @type {*} */
2321−Object.d780;
2322−
2323−/** @type {*} */
2324−Object.d781;
2325−
2326−/** @type {*} */
2327−Object.d782;
2328−
2329−/** @type {*} */
2330−Object.d783;
2331−
2332−/** @type {*} */
2333−Object.d784;
2334−
2335−/** @type {*} */
2336−Object.d785;
2337−
2338−/** @type {*} */
2339−Object.d786;
2340−
2341−/** @type {*} */
2342−Object.d787;
2343−
2344−/** @type {*} */
2345−Object.d788;
2346−
2347−/** @type {*} */
2348−Object.d789;
2349−
2350−/** @type {*} */
2351−Object.d790;
2352−
2353−/** @type {*} */
2354−Object.d791;
2355−
2356−/** @type {*} */
2357−Object.d792;
2358−
2359−/** @type {*} */
2360−Object.d793;
2361−
2362−/** @type {*} */
2363−Object.d794;
2364−
2365−/** @type {*} */
2366−Object.d795;
2367−
2368−/** @type {*} */
2369−Object.d796;
2370−
2371−/** @type {*} */
2372−Object.d797;
2373−
2374−/** @type {*} */
2375−Object.d798;
2376−
2377−/** @type {*} */
2378−Object.d799;
2379−
2380−/** @type {*} */
2381−Object.d800;
2382−
2383−/** @type {*} */
2384−Object.d801;
2385−
2386−/** @type {*} */
2387−Object.d802;
2388−
2389−/** @type {*} */
2390−Object.d803;
2391−
2392−/** @type {*} */
2393−Object.d804;
2394−
2395−/** @type {*} */
2396−Object.d805;
2397−
2398−/** @type {*} */
2399−Object.d806;
2400−
2401−/** @type {*} */
2402−Object.d807;
2403−
2404−/** @type {*} */
2405−Object.d808;
2406−
2407−/** @type {*} */
2408−Object.d809;
2409−
2410−/** @type {*} */
2411−Object.d810;
2412−
2413−/** @type {*} */
2414−Object.d811;
2415−
2416−/** @type {*} */
2417−Object.d812;
2418−
2419−/** @type {*} */
2420−Object.d813;
2421−
2422−/** @type {*} */
2423−Object.d814;
2424−
2425−/** @type {*} */
2426−Object.d815;
2427−
2428−/** @type {*} */
2429−Object.d816;
2430−
2431−/** @type {*} */
2432−Object.d817;
2433−
2434−/** @type {*} */
2435−Object.d818;
2436−
2437−/** @type {*} */
2438−Object.d819;
2439−
2440−/** @type {*} */
2441−Object.d820;
2442−
2443−/** @type {*} */
2444−Object.d821;
2445−
2446−/** @type {*} */
2447−Object.d822;
2448−
2449−/** @type {*} */
2450−Object.d823;
2451−
2452−/** @type {*} */
2453−Object.d824;
2454−
2455−/** @type {*} */
2456−Object.d825;
2457−
2458−/** @type {*} */
2459−Object.d826;
2460−
2461−/** @type {*} */
2462−Object.d827;
2463−
2464−/** @type {*} */
2465−Object.d828;
2466−
2467−/** @type {*} */
2468−Object.d829;
2469−
2470−/** @type {*} */
2471−Object.d830;
2472−
2473−/** @type {*} */
2474−Object.d831;
2475−
2476−/** @type {*} */
2477−Object.d832;
2478−
2479−/** @type {*} */
2480−Object.d833;
2481−
2482−/** @type {*} */
2483−Object.d834;
2484−
2485−/** @type {*} */
2486−Object.d835;
2487−
2488−/** @type {*} */
2489−Object.d836;
2490−
2491−/** @type {*} */
2492−Object.d837;
2493−
2494−/** @type {*} */
2495−Object.d838;
2496−
2497−/** @type {*} */
2498−Object.d839;
2499−
2500−/** @type {*} */
2501−Object.d840;
2502−
2503−/** @type {*} */
2504−Object.d841;
2505−
2506−/** @type {*} */
2507−Object.d842;
2508−
2509−/** @type {*} */
2510−Object.d843;
2511−
2512−/** @type {*} */
2513−Object.d844;
2514−
2515−/** @type {*} */
2516−Object.d845;
2517−
2518−/** @type {*} */
2519−Object.d846;
2520−
2521−/** @type {*} */
2522−Object.d847;
2523−
2524−/** @type {*} */
2525−Object.d848;
2526−
2527−/** @type {*} */
2528−Object.d849;
2529−
2530−/** @type {*} */
2531−Object.d850;
2532−
2533−/** @type {*} */
2534−Object.d851;
2535−
2536−/** @type {*} */
2537−Object.d852;
2538−
2539−/** @type {*} */
2540−Object.d853;
2541−
2542−/** @type {*} */
2543−Object.d854;
2544−
2545−/** @type {*} */
2546−Object.d855;
2547−
2548−/** @type {*} */
2549−Object.d856;
2550−
2551−/** @type {*} */
2552−Object.d857;
2553−
2554−/** @type {*} */
2555−Object.d858;
2556−
2557−/** @type {*} */
2558−Object.d859;
2559−
2560−/** @type {*} */
2561−Object.d860;
2562−
2563−/** @type {*} */
2564−Object.d861;
2565−
2566−/** @type {*} */
2567−Object.d862;
2568−
2569−/** @type {*} */
2570−Object.d863;
2571−
2572−/** @type {*} */
2573−Object.d864;
2574−
2575−/** @type {*} */
2576−Object.d865;
2577−
2578−/** @type {*} */
2579−Object.d866;
2580−
2581−/** @type {*} */
2582−Object.d867;
2583−
2584−/** @type {*} */
2585−Object.d868;
2586−
2587−/** @type {*} */
2588−Object.d869;
2589−
2590−/** @type {*} */
2591−Object.d870;
2592−
2593−/** @type {*} */
2594−Object.d871;
2595−
2596−/** @type {*} */
2597−Object.d872;
2598−
2599−/** @type {*} */
2600−Object.d873;
2601−
2602−/** @type {*} */
2603−Object.d874;
2604−
2605−/** @type {*} */
2606−Object.d875;
2607−
2608−/** @type {*} */
2609−Object.d876;
2610−
2611−/** @type {*} */
2612−Object.d877;
2613−
2614−/** @type {*} */
2615−Object.d878;
2616−
2617−/** @type {*} */
2618−Object.d879;
2619−
2620−/** @type {*} */
2621−Object.d880;
2622−
2623−/** @type {*} */
2624−Object.d881;
2625−
2626−/** @type {*} */
2627−Object.d882;
2628−
2629−/** @type {*} */
2630−Object.d883;
2631−
2632−/** @type {*} */
2633−Object.d884;
2634−
2635−/** @type {*} */
2636−Object.d885;
2637−
2638−/** @type {*} */
2639−Object.d886;
2640−
2641−/** @type {*} */
2642−Object.d887;
2643−
2644−/** @type {*} */
2645−Object.d888;
2646−
2647−/** @type {*} */
2648−Object.d889;
2649−
2650−/** @type {*} */
2651−Object.d890;
2652−
2653−/** @type {*} */
2654−Object.d891;
2655−
2656−/** @type {*} */
2657−Object.d892;
2658−
2659−/** @type {*} */
2660−Object.d893;
2661−
2662−/** @type {*} */
2663−Object.d894;
2664−
2665−/** @type {*} */
2666−Object.d895;
2667−
2668−/** @type {*} */
2669−Object.d896;
2670−
2671−/** @type {*} */
2672−Object.d897;
2673−
2674−/** @type {*} */
2675−Object.d898;
2676−
2677−/** @type {*} */
2678−Object.d899;
2679−
2680−/** @type {*} */
2681−Object.d900;
2682−
2683−/** @type {*} */
2684−Object.d901;
2685−
2686−/** @type {*} */
2687−Object.d902;
2688−
2689−/** @type {*} */
2690−Object.d903;
2691−
2692−/** @type {*} */
2693−Object.d904;
2694−
2695−/** @type {*} */
2696−Object.d905;
2697−
2698−/** @type {*} */
2699−Object.d906;
2700−
2701−/** @type {*} */
2702−Object.d907;
2703−
2704−/** @type {*} */
2705−Object.d908;
2706−
2707−/** @type {*} */
2708−Object.d909;
2709−
2710−/** @type {*} */
2711−Object.d910;
2712−
2713−/** @type {*} */
2714−Object.d911;
2715−
2716−/** @type {*} */
2717−Object.d912;
2718−
2719−/** @type {*} */
2720−Object.d913;
2721−
2722−/** @type {*} */
2723−Object.d914;
2724−
2725−/** @type {*} */
2726−Object.d915;
2727−
2728−/** @type {*} */
2729−Object.d916;
2730−
2731−/** @type {*} */
2732−Object.d917;
2733−
2734−/** @type {*} */
2735−Object.d918;
2736−
2737−/** @type {*} */
2738−Object.d919;
2739−
2740−/** @type {*} */
2741−Object.d920;
2742−
2743−/** @type {*} */
2744−Object.d921;
2745−
2746−/** @type {*} */
2747−Object.d922;
2748−
2749−/** @type {*} */
2750−Object.d923;
2751−
2752−/** @type {*} */
2753−Object.d924;
2754−
2755−/** @type {*} */
2756−Object.d925;
2757−
2758−/** @type {*} */
2759−Object.d926;
2760−
2761−/** @type {*} */
2762−Object.d927;
2763−
2764−/** @type {*} */
2765−Object.d928;
2766−
2767−/** @type {*} */
2768−Object.d929;
2769−
2770−/** @type {*} */
2771−Object.d930;
2772−
2773−/** @type {*} */
2774−Object.d931;
2775−
2776−/** @type {*} */
2777−Object.d932;
2778−
2779−/** @type {*} */
2780−Object.d933;
2781−
2782−/** @type {*} */
2783−Object.d934;
2784−
2785−/** @type {*} */
2786−Object.d935;
2787−
2788−/** @type {*} */
2789−Object.d936;
2790−
2791−/** @type {*} */
2792−Object.d937;
2793−
2794−/** @type {*} */
2795−Object.d938;
2796−
2797−/** @type {*} */
2798−Object.d939;
2799−
2800−/** @type {*} */
2801−Object.d940;
2802−
2803−/** @type {*} */
2804−Object.d941;
2805−
2806−/** @type {*} */
2807−Object.d942;
2808−
2809−/** @type {*} */
2810−Object.d943;
2811−
2812−/** @type {*} */
2813−Object.d944;
2814−
2815−/** @type {*} */
2816−Object.d945;
2817−
2818−/** @type {*} */
2819−Object.d946;
2820−
2821−/** @type {*} */
2822−Object.d947;
2823−
2824−/** @type {*} */
2825−Object.d948;
2826−
2827−/** @type {*} */
2828−Object.d949;
2829−
2830−/** @type {*} */
2831−Object.d950;
2832−
2833−/** @type {*} */
2834−Object.d951;
2835−
2836−/** @type {*} */
2837−Object.d952;
2838−
2839−/** @type {*} */
2840−Object.d953;
2841−
2842−/** @type {*} */
2843−Object.d954;
2844−
2845−/** @type {*} */
2846−Object.d955;
2847−
2848−/** @type {*} */
2849−Object.d956;
2850−
2851−/** @type {*} */
2852−Object.d957;
2853−
2854−/** @type {*} */
2855−Object.d958;
2856−
2857−/** @type {*} */
2858−Object.d959;
2859−
2860−/** @type {*} */
2861−Object.d960;
2862−
2863−/** @type {*} */
2864−Object.d961;
2865−
2866−/** @type {*} */
2867−Object.d962;
2868−
2869−/** @type {*} */
2870−Object.d963;
2871−
2872−/** @type {*} */
2873−Object.d964;
2874−
2875−/** @type {*} */
2876−Object.d965;
2877−
2878−/** @type {*} */
2879−Object.d966;
2880−
2881−/** @type {*} */
2882−Object.d967;
2883−
2884−/** @type {*} */
2885−Object.d968;
2886−
2887−/** @type {*} */
2888−Object.d969;
2889−
2890−/** @type {*} */
2891−Object.d970;
2892−
2893−/** @type {*} */
2894−Object.d971;
2895−
2896−/** @type {*} */
2897−Object.d972;
2898−
2899−/** @type {*} */
2900−Object.d973;
2901−
2902−/** @type {*} */
2903−Object.d974;
2904−
2905−/** @type {*} */
2906−Object.d975;
2907−
2908−/** @type {*} */
2909−Object.d976;
2910−
2911−/** @type {*} */
2912−Object.d977;
2913−
2914−/** @type {*} */
2915−Object.d978;
2916−
2917−/** @type {*} */
2918−Object.d979;
2919−
2920−/** @type {*} */
2921−Object.d980;
2922−
2923−/** @type {*} */
2924−Object.d981;
2925−
2926−/** @type {*} */
2927−Object.d982;
2928−
2929−/** @type {*} */
2930−Object.d983;
2931−
2932−/** @type {*} */
2933−Object.d984;
2934−
2935−/** @type {*} */
2936−Object.d985;
2937−
2938−/** @type {*} */
2939−Object.d986;
2940−
2941−/** @type {*} */
2942−Object.d987;
2943−
2944−/** @type {*} */
2945−Object.d988;
2946−
2947−/** @type {*} */
2948−Object.d989;
2949−
2950−/** @type {*} */
2951−Object.d990;
2952−
2953−/** @type {*} */
2954−Object.d991;
2955−
2956−/** @type {*} */
2957−Object.d992;
2958−
2959−/** @type {*} */
2960−Object.d993;
2961−
2962−/** @type {*} */
2963−Object.d994;
2964−
2965−/** @type {*} */
2966−Object.d995;
2967−
2968−/** @type {*} */
2969−Object.d996;
2970−
2971−/** @type {*} */
2972−Object.d997;
2973−
2974−/** @type {*} */
2975−Object.d998;
2976−
2977−/** @type {*} */
2978−Object.d999;
2979−
2980−/** @type {*} */
2981−Object.d1000;
2982−
2983−/** @type {*} */
2984−Object.d1001;
2985−
2986−/** @type {*} */
2987−Object.d1002;
2988−
2989−/** @type {*} */
2990−Object.d1003;
2991−
2992−/** @type {*} */
2993−Object.d1004;
2994−
2995−/** @type {*} */
2996−Object.d1005;
2997−
2998−/** @type {*} */
2999−Object.d1006;
3000−
3001−/** @type {*} */
3002−Object.d1007;
3003−
3004−/** @type {*} */
3005−Object.d1008;
3006−
3007−/** @type {*} */
3008−Object.d1009;
3009−
3010−/** @type {*} */
3011−Object.d1010;
3012−
3013−/** @type {*} */
3014−Object.d1011;
3015−
3016−/** @type {*} */
3017−Object.d1012;
3018−
3019−/** @type {*} */
3020−Object.d1013;
3021−
3022−/** @type {*} */
3023−Object.d1014;
3024−
3025−/** @type {*} */
3026−Object.d1015;
3027−
3028−/** @type {*} */
3029−Object.d1016;
3030−
3031−/** @type {*} */
3032−Object.d1017;
3033−
3034−/** @type {*} */
3035−Object.d1018;
3036−
3037−/** @type {*} */
3038−Object.d1019;
3039−
3040−/** @type {*} */
3041−Object.d1020;
3042−
3043−/** @type {*} */
3044−Object.d1021;
3045−
3046−/** @type {*} */
3047−Object.d1022;
3048−
3049−/** @type {*} */
3050−Object.d1023;
3051−
3052−/** @type {*} */
3053−Object.d1024;
3054−
3055−/** @type {*} */
3056−Object.d1025;
3057−
3058−/** @type {*} */
3059−Object.d1026;
3060−
3061−/** @type {*} */
3062−Object.d1027;
3063−
3064−/** @type {*} */
3065−Object.d1028;
3066−
3067−/** @type {*} */
3068−Object.d1029;
3069−
3070−/** @type {*} */
3071−Object.d1030;
3072−
3073−/** @type {*} */
3074−Object.d1031;
3075−
3076−/** @type {*} */
3077−Object.d1032;
3078−
3079−/** @type {*} */
3080−Object.d1033;
3081−
3082−/** @type {*} */
3083−Object.d1034;
3084−
3085−/** @type {*} */
3086−Object.d1035;
3087−
3088−/** @type {*} */
3089−Object.d1036;
3090−
3091−/** @type {*} */
3092−Object.d1037;
3093−
3094−/** @type {*} */
3095−Object.d1038;
3096−
3097−/** @type {*} */
3098−Object.d1039;
3099−
3100−/** @type {*} */
3101−Object.d1040;
3102−
3103−/** @type {*} */
3104−Object.d1041;
3105−
3106−/** @type {*} */
3107−Object.d1042;
3108−
3109−/** @type {*} */
3110−Object.d1043;
3111−
3112−/** @type {*} */
3113−Object.d1044;
3114−
3115−/** @type {*} */
3116−Object.d1045;
3117−
3118−/** @type {*} */
3119−Object.d1046;
3120−
3121−/** @type {*} */
3122−Object.d1047;
3123−
3124−/** @type {*} */
3125−Object.d1048;
3126−
3127−/** @type {*} */
3128−Object.d1049;
3129−
3130−/** @type {*} */
3131−Object.d1050;
3132−
3133−/** @type {*} */
3134−Object.d1051;
3135−
3136−/** @type {*} */
3137−Object.d1052;
3138−
3139−/** @type {*} */
3140−Object.d1053;
3141−
3142−/** @type {*} */
3143−Object.d1054;
3144−
3145−/** @type {*} */
3146−Object.d1055;
3147−
3148−/** @type {*} */
3149−Object.d1056;
3150−
3151−/** @type {*} */
3152−Object.d1057;
3153−
3154−/** @type {*} */
3155−Object.d1058;
3156−
3157−/** @type {*} */
3158−Object.d1059;
3159−
3160−/** @type {*} */
3161−Object.d1060;
3162−
3163−/** @type {*} */
3164−Object.d1061;
3165−
3166−/** @type {*} */
3167−Object.d1062;
3168−
3169−/** @type {*} */
3170−Object.d1063;
3171−
3172−/** @type {*} */
3173−Object.d1064;
3174−
3175−/** @type {*} */
3176−Object.d1065;
3177−
3178−/** @type {*} */
3179−Object.d1066;
3180−
3181−/** @type {*} */
3182−Object.d1067;
3183−
3184−/** @type {*} */
3185−Object.d1068;
3186−
3187−/** @type {*} */
3188−Object.d1069;
3189−
3190−/** @type {*} */
3191−Object.d1070;
3192−
3193−/** @type {*} */
3194−Object.d1071;
3195−
3196−/** @type {*} */
3197−Object.d1072;
3198−
3199−/** @type {*} */
3200−Object.d1073;
3201−
3202−/** @type {*} */
3203−Object.d1074;
3204−
3205−/** @type {*} */
3206−Object.d1075;
3207−
3208−/** @type {*} */
3209−Object.d1076;
3210−
3211−/** @type {*} */
3212−Object.d1077;
3213−
3214−/** @type {*} */
3215−Object.d1078;
3216−
3217−/** @type {*} */
3218−Object.d1079;
3219−
3220−/** @type {*} */
3221−Object.d1080;
3222−
3223−/** @type {*} */
3224−Object.d1081;
3225−
3226−/** @type {*} */
3227−Object.d1082;
3228−
3229−/** @type {*} */
3230−Object.d1083;
3231−
3232−/** @type {*} */
3233−Object.d1084;
3234−
3235−/** @type {*} */
3236−Object.d1085;
3237−
3238−/** @type {*} */
3239−Object.d1086;
3240−
3241−/** @type {*} */
3242−Object.d1087;
3243−
3244−/** @type {*} */
3245−Object.d1088;
3246−
3247−/** @type {*} */
3248−Object.d1089;
3249−
3250−/** @type {*} */
3251−Object.d1090;
3252−
3253−/** @type {*} */
3254−Object.d1091;
3255−
3256−/** @type {*} */
3257−Object.d1092;
3258−
3259−/** @type {*} */
3260−Object.d1093;
3261−
3262−/** @type {*} */
3263−Object.d1094;
3264−
3265−/** @type {*} */
3266−Object.d1095;
3267−
3268−/** @type {*} */
3269−Object.d1096;
3270−
3271−/** @type {*} */
3272−Object.d1097;
3273−
3274−/** @type {*} */
3275−Object.d1098;
3276−
3277−/** @type {*} */
3278−Object.d1099;
3279−
3280−/** @type {*} */
3281−Object.d1100;
3282−
3283−/** @type {*} */
3284−Object.d1101;
3285−
3286−/** @type {*} */
3287−Object.d1102;
3288−
3289−/** @type {*} */
3290−Object.d1103;
3291−
3292−/** @type {*} */
3293−Object.d1104;
3294−
3295−/** @type {*} */
3296−Object.d1105;
3297−
3298−/** @type {*} */
3299−Object.d1106;
3300−
3301−/** @type {*} */
3302−Object.d1107;
3303−
3304−/** @type {*} */
3305−Object.d1108;
3306−
3307−/** @type {*} */
3308−Object.d1109;
3309−
3310−/** @type {*} */
3311−Object.d1110;
3312−
3313−/** @type {*} */
3314−Object.d1111;
3315−
3316−/** @type {*} */
3317−Object.d1112;
3318−
3319−/** @type {*} */
3320−Object.d1113;
3321−
3322−/** @type {*} */
3323−Object.d1114;
3324−
3325−/** @type {*} */
3326−Object.d1115;
3327−
3328−/** @type {*} */
3329−Object.d1116;
3330−
3331−/** @type {*} */
3332−Object.d1117;
3333−
3334−/** @type {*} */
3335−Object.d1118;
3336−
3337−/** @type {*} */
3338−Object.d1119;
3339−
3340−/** @type {*} */
3341−Object.d1120;
3342−
3343−/** @type {*} */
3344−Object.d1121;
3345−
3346−/** @type {*} */
3347−Object.d1122;
3348−
3349−/** @type {*} */
3350−Object.d1123;
3351−
3352−/** @type {*} */
3353−Object.d1124;
3354−
3355−/** @type {*} */
3356−Object.d1125;
3357−
3358−/** @type {*} */
3359−Object.d1126;
3360−
3361−/** @type {*} */
3362−Object.d1127;
3363−
3364−/** @type {*} */
3365−Object.d1128;
3366−
3367−/** @type {*} */
3368−Object.d1129;
3369−
3370−/** @type {*} */
3371−Object.d1130;
3372−
3373−/** @type {*} */
3374−Object.d1131;
3375−
3376−/** @type {*} */
3377−Object.d1132;
3378−
3379−/** @type {*} */
3380−Object.d1133;
3381−
3382−/** @type {*} */
3383−Object.d1134;
3384−
3385−/** @type {*} */
3386−Object.d1135;
3387−
3388−/** @type {*} */
3389−Object.d1136;
3390−
3391−/** @type {*} */
3392−Object.d1137;
3393−
3394−/** @type {*} */
3395−Object.d1138;
3396−
3397−/** @type {*} */
3398−Object.d1139;
3399−
3400−/** @type {*} */
3401−Object.d1140;
3402−
3403−/** @type {*} */
3404−Object.d1141;
3405−
3406−/** @type {*} */
3407−Object.d1142;
3408−
3409−/** @type {*} */
3410−Object.d1143;
3411−
3412−/** @type {*} */
3413−Object.d1144;
3414−
3415−/** @type {*} */
3416−Object.d1145;
3417−
3418−/** @type {*} */
3419−Object.d1146;
3420−
3421−/** @type {*} */
3422−Object.d1147;
3423−
3424−/** @type {*} */
3425−Object.d1148;
3426−
3427−/** @type {*} */
3428−Object.d1149;
3429−
3430−/** @type {*} */
3431−Object.d1150;
3432−
3433−/** @type {*} */
3434−Object.d1151;
3435−
3436−/** @type {*} */
3437−Object.d1152;
3438−
3439−/** @type {*} */
3440−Object.d1153;
3441−
3442−/** @type {*} */
3443−Object.d1154;
3444−
3445−/** @type {*} */
3446−Object.d1155;
3447−
3448−/** @type {*} */
3449−Object.d1156;
3450−
3451−/** @type {*} */
3452−Object.d1157;
3453−
3454−/** @type {*} */
3455−Object.d1158;
3456−
3457−/** @type {*} */
3458−Object.d1159;
3459−
3460−/** @type {*} */
3461−Object.d1160;
3462−
3463−/** @type {*} */
3464−Object.d1161;
3465−
3466−/** @type {*} */
3467−Object.d1162;
3468−
3469−/** @type {*} */
3470−Object.d1163;
3471−
3472−/** @type {*} */
3473−Object.d1164;
3474−
3475−/** @type {*} */
3476−Object.d1165;
3477−
3478−/** @type {*} */
3479−Object.d1166;
3480−
3481−/** @type {*} */
3482−Object.d1167;
3483−
3484−/** @type {*} */
3485−Object.d1168;
3486−
3487−/** @type {*} */
3488−Object.d1169;
3489−
3490−/** @type {*} */
3491−Object.d1170;
3492−
3493−/** @type {*} */
3494−Object.d1171;
3495−
3496−/** @type {*} */
3497−Object.d1172;
3498−
3499−/** @type {*} */
3500−Object.d1173;
3501−
3502−/** @type {*} */
3503−Object.d1174;
3504−
3505−/** @type {*} */
3506−Object.d1175;
3507−
3508−/** @type {*} */
3509−Object.d1176;
3510−
3511−/** @type {*} */
3512−Object.d1177;
3513−
3514−/** @type {*} */
3515−Object.d1178;
3516−
3517−/** @type {*} */
3518−Object.d1179;
3519−
3520−/** @type {*} */
3521−Object.d1180;
3522−
3523−/** @type {*} */
3524−Object.d1181;
3525−
3526−/** @type {*} */
3527−Object.d1182;
3528−
3529−/** @type {*} */
3530−Object.d1183;
3531−
3532−/** @type {*} */
3533−Object.d1184;
3534−
3535−/** @type {*} */
3536−Object.d1185;
3537−
3538−/** @type {*} */
3539−Object.d1186;
3540−
3541−/** @type {*} */
3542−Object.d1187;
3543−
3544−/** @type {*} */
3545−Object.d1188;
3546−
3547−/** @type {*} */
3548−Object.d1189;
3549−
3550−/** @type {*} */
3551−Object.d1190;
3552−
3553−/** @type {*} */
3554−Object.d1191;
3555−
3556−/** @type {*} */
3557−Object.d1192;
3558−
3559−/** @type {*} */
3560−Object.d1193;
3561−
3562−/** @type {*} */
3563−Object.d1194;
3564−
3565−/** @type {*} */
3566−Object.d1195;
3567−
3568−/** @type {*} */
3569−Object.d1196;
3570−
3571−/** @type {*} */
3572−Object.d1197;
3573−
3574−/** @type {*} */
3575−Object.d1198;
3576−
3577−/** @type {*} */
3578−Object.d1199;
3579−
3580−/** @type {*} */
3581−Object.d1200;
3582−
3583−/** @type {*} */
3584−Object.d1201;
3585−
3586−/** @type {*} */
3587−Object.d1202;
3588−
3589−/** @type {*} */
3590−Object.d1203;
3591−
3592−/** @type {*} */
3593−Object.d1204;
3594−
3595−/** @type {*} */
3596−Object.d1205;
3597−
3598−/** @type {*} */
3599−Object.d1206;
3600−
3601−/** @type {*} */
3602−Object.d1207;
3603−
3604−/** @type {*} */
3605−Object.d1208;
3606−
3607−/** @type {*} */
3608−Object.d1209;
3609−
3610−/** @type {*} */
3611−Object.d1210;
3612−
3613−/** @type {*} */
3614−Object.d1211;
3615−
3616−/** @type {*} */
3617−Object.d1212;
3618−
3619−/** @type {*} */
3620−Object.d1213;
3621−
3622−/** @type {*} */
3623−Object.d1214;
3624−
3625−/** @type {*} */
3626−Object.d1215;
3627−
3628−/** @type {*} */
3629−Object.d1216;
3630−
3631−/** @type {*} */
3632−Object.d1217;
3633−
3634−/** @type {*} */
3635−Object.d1218;
3636−
3637−/** @type {*} */
3638−Object.d1219;
3639−
3640−/** @type {*} */
3641−Object.d1220;
3642−
3643−/** @type {*} */
3644−Object.d1221;
3645−
3646−/** @type {*} */
3647−Object.d1222;
3648−
3649−/** @type {*} */
3650−Object.d1223;
3651−
3652−/** @type {*} */
3653−Object.d1224;
3654−
3655−/** @type {*} */
3656−Object.d1225;
3657−
3658−/** @type {*} */
3659−Object.d1226;
3660−
3661−/** @type {*} */
3662−Object.d1227;
3663−
3664−/** @type {*} */
3665−Object.d1228;
3666−
3667−/** @type {*} */
3668−Object.d1229;
3669−
3670−/** @type {*} */
3671−Object.d1230;
3672−
3673−/** @type {*} */
3674−Object.d1231;
3675−
3676−/** @type {*} */
3677−Object.d1232;
3678−
3679−/** @type {*} */
3680−Object.d1233;
3681−
3682−/** @type {*} */
3683−Object.d1234;
3684−
3685−/** @type {*} */
3686−Object.d1235;
3687−
3688−/** @type {*} */
3689−Object.d1236;
3690−
3691−/** @type {*} */
3692−Object.d1237;
3693−
3694−/** @type {*} */
3695−Object.d1238;
3696−
3697−/** @type {*} */
3698−Object.d1239;
3699−
3700−/** @type {*} */
3701−Object.d1240;
3702−
3703−/** @type {*} */
3704−Object.d1241;
3705−
3706−/** @type {*} */
3707−Object.d1242;
3708−
3709−/** @type {*} */
3710−Object.d1243;
3711−
3712−/** @type {*} */
3713−Object.d1244;
3714−
3715−/** @type {*} */
3716−Object.d1245;
3717−
3718−/** @type {*} */
3719−Object.d1246;
3720−
3721−/** @type {*} */
3722−Object.d1247;
3723−
3724−/** @type {*} */
3725−Object.d1248;
3726−
3727−/** @type {*} */
3728−Object.d1249;
3729−
3730−/** @type {*} */
3731−Object.d1250;
3732−
3733−/** @type {*} */
3734−Object.d1251;
3735−
3736−/** @type {*} */
3737−Object.d1252;
3738−
3739−/** @type {*} */
3740−Object.d1253;
3741−
3742−/** @type {*} */
3743−Object.d1254;
3744−
3745−/** @type {*} */
3746−Object.d1255;
3747−
3748−/** @type {*} */
3749−Object.d1256;
3750−
3751−/** @type {*} */
3752−Object.d1257;
3753−
3754−/** @type {*} */
3755−Object.d1258;
3756−
3757−/** @type {*} */
3758−Object.d1259;
3759−
3760−/** @type {*} */
3761−Object.d1260;
3762−
3763−/** @type {*} */
3764−Object.d1261;
3765−
3766−/** @type {*} */
3767−Object.d1262;
3768−
3769−/** @type {*} */
3770−Object.d1263;
3771−
3772−/** @type {*} */
3773−Object.d1264;
3774−
3775−/** @type {*} */
3776−Object.d1265;
3777−
3778−/** @type {*} */
3779−Object.d1266;
3780−
3781−/** @type {*} */
3782−Object.d1267;
3783−
3784−/** @type {*} */
3785−Object.d1268;
3786−
3787−/** @type {*} */
3788−Object.d1269;
3789−
3790−/** @type {*} */
3791−Object.d1270;
3792−
3793−/** @type {*} */
3794−Object.d1271;
3795−
3796−/** @type {*} */
3797−Object.d1272;
3798−
3799−/** @type {*} */
3800−Object.d1273;
3801−
3802−/** @type {*} */
3803−Object.d1274;
3804−
3805−/** @type {*} */
3806−Object.d1275;
3807−
3808−/** @type {*} */
3809−Object.d1276;
3810−
3811−/** @type {*} */
3812−Object.d1277;
3813−
3814−/** @type {*} */
3815−Object.d1278;
3816−
3817−/** @type {*} */
3818−Object.d1279;
3819−
3820−/** @type {*} */
3821−Object.d1280;
3822−
3823−/** @type {*} */
3824−Object.d1281;
3825−
3826−/** @type {*} */
3827−Object.d1282;
3828−
3829−/** @type {*} */
3830−Object.d1283;
3831−
3832−/** @type {*} */
3833−Object.d1284;
3834−
3835−/** @type {*} */
3836−Object.d1285;
3837−
3838−/** @type {*} */
3839−Object.d1286;
3840−
3841−/** @type {*} */
3842−Object.d1287;
3843−
3844−/** @type {*} */
3845−Object.d1288;
3846−
3847−/** @type {*} */
3848−Object.d1289;
3849−
3850−/** @type {*} */
3851−Object.d1290;
3852−
3853−/** @type {*} */
3854−Object.d1291;
3855−
3856−/** @type {*} */
3857−Object.d1292;
3858−
3859−/** @type {*} */
3860−Object.d1293;
3861−
3862−/** @type {*} */
3863−Object.d1294;
3864−
3865−/** @type {*} */
3866−Object.d1295;
3867−
3868−/** @type {*} */
3869−Object.d1296;
3870−
3871−/** @type {*} */
3872−Object.d1297;
3873−
3874−/** @type {*} */
3875−Object.d1298;
3876−
3877−/** @type {*} */
3878−Object.d1299;
3879−
3880−/** @type {*} */
3881−Object.d1300;
3882−
3883−/** @type {*} */
3884−Object.d1301;
3885−
3886−/** @type {*} */
3887−Object.d1302;
3888−
3889−/** @type {*} */
3890−Object.d1303;
3891−
3892−/** @type {*} */
3893−Object.d1304;
3894−
3895−/** @type {*} */
3896−Object.d1305;
3897−
3898−/** @type {*} */
3899−Object.d1306;
3900−
3901−/** @type {*} */
3902−Object.d1307;
3903−
3904−/** @type {*} */
3905−Object.d1308;
3906−
3907−/** @type {*} */
3908−Object.d1309;
3909−
3910−/** @type {*} */
3911−Object.d1310;
3912−
3913−/** @type {*} */
3914−Object.d1311;
3915−
3916−/** @type {*} */
3917−Object.d1312;
3918−
3919−/** @type {*} */
3920−Object.d1313;
3921−
3922−/** @type {*} */
3923−Object.d1314;
3924−
3925−/** @type {*} */
3926−Object.d1315;
3927−
3928−/** @type {*} */
3929−Object.d1316;
3930−
3931−/** @type {*} */
3932−Object.d1317;
3933−
3934−/** @type {*} */
3935−Object.d1318;
3936−
3937−/** @type {*} */
3938−Object.d1319;
3939−
3940−/** @type {*} */
3941−Object.d1320;
3942−
3943−/** @type {*} */
3944−Object.d1321;
3945−
3946−/** @type {*} */
3947−Object.d1322;
3948−
3949−/** @type {*} */
3950−Object.d1323;
3951−
3952−/** @type {*} */
3953−Object.d1324;
3954−
3955−/** @type {*} */
3956−Object.d1325;
3957−
3958−/** @type {*} */
3959−Object.d1326;
3960−
3961−/** @type {*} */
3962−Object.d1327;
3963−
3964−/** @type {*} */
3965−Object.d1328;
3966−
3967−/** @type {*} */
3968−Object.d1329;
3969−
3970−/** @type {*} */
3971−Object.d1330;
3972−
3973−/** @type {*} */
3974−Object.d1331;
3975−
3976−/** @type {*} */
3977−Object.d1332;
3978−
3979−/** @type {*} */
3980−Object.d1333;
3981−
3982−/** @type {*} */
3983−Object.d1334;
3984−
3985−/** @type {*} */
3986−Object.d1335;
3987−
3988−/** @type {*} */
3989−Object.d1336;
3990−
3991−/** @type {*} */
3992−Object.d1337;
3993−
3994−/** @type {*} */
3995−Object.d1338;
3996−
3997−/** @type {*} */
3998−Object.d1339;
3999−
4000−/** @type {*} */
4001−Object.d1340;
4002−
4003−/** @type {*} */
4004−Object.d1341;
4005−
4006−/** @type {*} */
4007−Object.d1342;
4008−
4009−/** @type {*} */
4010−Object.d1343;
4011−
4012−/** @type {*} */
4013−Object.d1344;
4014−
4015−/** @type {*} */
4016−Object.d1345;
4017−
4018−/** @type {*} */
4019−Object.d1346;
4020−
4021−/** @type {*} */
4022−Object.d1347;
4023−
4024−/** @type {*} */
4025−Object.d1348;
4026−
4027−/** @type {*} */
4028−Object.d1349;
4029−
4030−/** @type {*} */
4031−Object.d1350;
4032−
4033−/** @type {*} */
4034−Object.d1351;
4035−
4036−/** @type {*} */
4037−Object.d1352;
4038−
4039−/** @type {*} */
4040−Object.d1353;
4041−
4042−/** @type {*} */
4043−Object.d1354;
4044−
4045−/** @type {*} */
4046−Object.d1355;
4047−
4048−/** @type {*} */
4049−Object.d1356;
4050−
4051−/** @type {*} */
4052−Object.d1357;
4053−
4054−/** @type {*} */
4055−Object.d1358;
4056−
4057−/** @type {*} */
4058−Object.d1359;
4059−
4060−/** @type {*} */
4061−Object.d1360;
4062−
4063−/** @type {*} */
4064−Object.d1361;
4065−
4066−/** @type {*} */
4067−Object.d1362;
4068−
4069−/** @type {*} */
4070−Object.d1363;
4071−
4072−/** @type {*} */
4073−Object.d1364;
4074−
4075−/** @type {*} */
4076−Object.d1365;
4077−
4078−/** @type {*} */
4079−Object.d1366;
4080−
4081−/** @type {*} */
4082−Object.d1367;
4083−
4084−/** @type {*} */
4085−Object.d1368;
4086−
4087−/** @type {*} */
4088−Object.d1369;
4089−
4090−/** @type {*} */
4091−Object.d1370;
4092−
4093−/** @type {*} */
4094−Object.d1371;
4095−
4096−/** @type {*} */
4097−Object.d1372;
4098−
4099−/** @type {*} */
4100−Object.d1373;
4101−
4102−/** @type {*} */
4103−Object.d1374;
4104−
4105−/** @type {*} */
4106−Object.d1375;
4107−
4108−/** @type {*} */
4109−Object.d1376;
4110−
4111−/** @type {*} */
4112−Object.d1377;
4113−
4114−/** @type {*} */
4115−Object.d1378;
4116−
4117−/** @type {*} */
4118−Object.d1379;
4119−
4120−/** @type {*} */
4121−Object.d1380;
4122−
4123−/** @type {*} */
4124−Object.d1381;
4125−
4126−/** @type {*} */
4127−Object.d1382;
4128−
4129−/** @type {*} */
4130−Object.d1383;
4131−
4132−/** @type {*} */
4133−Object.d1384;
4134−
4135−/** @type {*} */
4136−Object.d1385;
4137−
4138−/** @type {*} */
4139−Object.d1386;
4140−
4141−/** @type {*} */
4142−Object.d1387;
4143−
4144−/** @type {*} */
4145−Object.d1388;
4146−
4147−/** @type {*} */
4148−Object.d1389;
4149−
4150−/** @type {*} */
4151−Object.d1390;
4152−
4153−/** @type {*} */
4154−Object.d1391;
4155−
4156−/** @type {*} */
4157−Object.d1392;
4158−
4159−/** @type {*} */
4160−Object.d1393;
4161−
4162−/** @type {*} */
4163−Object.d1394;
4164−
4165−/** @type {*} */
4166−Object.d1395;
4167−
4168−/** @type {*} */
4169−Object.d1396;
4170−
4171−/** @type {*} */
4172−Object.d1397;
4173−
4174−/** @type {*} */
4175−Object.d1398;
4176−
4177−/** @type {*} */
4178−Object.d1399;
4179−
4180−/** @type {*} */
4181−Object.d1400;
4182−
4183−/** @type {*} */
4184−Object.d1401;
4185−
4186−/** @type {*} */
4187−Object.d1402;
4188−
4189−/** @type {*} */
4190−Object.d1403;
4191−
4192−/** @type {*} */
4193−Object.d1404;
4194−
4195−/** @type {*} */
4196−Object.d1405;
4197−
4198−/** @type {*} */
4199−Object.d1406;
4200−
4201−/** @type {*} */
4202−Object.d1407;
4203−
4204−/** @type {*} */
4205−Object.d1408;
4206−
4207−/** @type {*} */
4208−Object.d1409;
4209−
4210−/** @type {*} */
4211−Object.d1410;
4212−
4213−/** @type {*} */
4214−Object.d1411;
4215−
4216−/** @type {*} */
4217−Object.d1412;
4218−
4219−/** @type {*} */
4220−Object.d1413;
4221−
4222−/** @type {*} */
4223−Object.d1414;
4224−
4225−/** @type {*} */
4226−Object.d1415;
4227−
4228−/** @type {*} */
4229−Object.d1416;
4230−
4231−/** @type {*} */
4232−Object.d1417;
4233−
4234−/** @type {*} */
4235−Object.d1418;
4236−
4237−/** @type {*} */
4238−Object.d1419;
4239−
4240−/** @type {*} */
4241−Object.d1420;
4242−
4243−/** @type {*} */
4244−Object.d1421;
4245−
4246−/** @type {*} */
4247−Object.d1422;
4248−
4249−/** @type {*} */
4250−Object.d1423;
4251−
4252−/** @type {*} */
4253−Object.d1424;
4254−
4255−/** @type {*} */
4256−Object.d1425;
4257−
4258−/** @type {*} */
4259−Object.d1426;
4260−
4261−/** @type {*} */
4262−Object.d1427;
4263−
4264−/** @type {*} */
4265−Object.d1428;
4266−
4267−/** @type {*} */
4268−Object.d1429;
4269−
4270−/** @type {*} */
4271−Object.d1430;
4272−
4273−/** @type {*} */
4274−Object.d1431;
4275−
4276−/** @type {*} */
4277−Object.d1432;
4278−
4279−/** @type {*} */
4280−Object.d1433;
4281−
4282−/** @type {*} */
4283−Object.d1434;
4284−
4285−/** @type {*} */
4286−Object.d1435;
4287−
4288−/** @type {*} */
4289−Object.d1436;
4290−
4291−/** @type {*} */
4292−Object.d1437;
4293−
4294−/** @type {*} */
4295−Object.d1438;
4296−
4297−/** @type {*} */
4298−Object.d1439;
4299−
4300−/** @type {*} */
4301−Object.d1440;
4302−
4303−/** @type {*} */
4304−Object.d1441;
4305−
4306−/** @type {*} */
4307−Object.d1442;
4308−
4309−/** @type {*} */
4310−Object.d1443;
4311−
4312−/** @type {*} */
4313−Object.d1444;
4314−
4315−/** @type {*} */
4316−Object.d1445;
4317−
4318−/** @type {*} */
4319−Object.d1446;
4320−
4321−/** @type {*} */
4322−Object.d1447;
4323−
4324−/** @type {*} */
4325−Object.d1448;
4326−
4327−/** @type {*} */
4328−Object.d1449;
4329−
4330−/** @type {*} */
4331−Object.d1450;
4332−
4333−/** @type {*} */
4334−Object.d1451;
4335−
4336−/** @type {*} */
4337−Object.d1452;
4338−
4339−/** @type {*} */
4340−Object.d1453;
4341−
4342−/** @type {*} */
4343−Object.d1454;
4344−
4345−/** @type {*} */
4346−Object.d1455;
4347−
4348−/** @type {*} */
4349−Object.d1456;
4350−
4351−/** @type {*} */
4352−Object.d1457;
4353−
4354−/** @type {*} */
4355−Object.d1458;
4356−
4357−/** @type {*} */
4358−Object.d1459;
4359−
4360−/** @type {*} */
4361−Object.d1460;
4362−
4363−/** @type {*} */
4364−Object.d1461;
4365−
4366−/** @type {*} */
4367−Object.d1462;
4368−
4369−/** @type {*} */
4370−Object.d1463;
4371−
4372−/** @type {*} */
4373−Object.d1464;
4374−
4375−/** @type {*} */
4376−Object.d1465;
4377−
4378−/** @type {*} */
4379−Object.d1466;
4380−
4381−/** @type {*} */
4382−Object.d1467;
4383−
4384−/** @type {*} */
4385−Object.d1468;
4386−
4387−/** @type {*} */
4388−Object.d1469;
4389−
4390−/** @type {*} */
4391−Object.d1470;
4392−
4393−/** @type {*} */
4394−Object.d1471;
4395−
4396−/** @type {*} */
4397−Object.d1472;
4398−
4399−/** @type {*} */
4400−Object.d1473;
4401−
4402−/** @type {*} */
4403−Object.d1474;
4404−
4405−/** @type {*} */
4406−Object.d1475;
4407−
4408−/** @type {*} */
4409−Object.d1476;
4410−
4411−/** @type {*} */
4412−Object.d1477;
4413−
4414−/** @type {*} */
4415−Object.d1478;
4416−
4417−/** @type {*} */
4418−Object.d1479;
4419−
4420−/** @type {*} */
4421−Object.d1480;
4422−
4423−/** @type {*} */
4424−Object.d1481;
4425−
4426−/** @type {*} */
4427−Object.d1482;
4428−
4429−/** @type {*} */
4430−Object.d1483;
4431−
4432−/** @type {*} */
4433−Object.d1484;
4434−
4435−/** @type {*} */
4436−Object.d1485;
4437−
4438−/** @type {*} */
4439−Object.d1486;
4440−
4441−/** @type {*} */
4442−Object.d1487;
4443−
4444−/** @type {*} */
4445−Object.d1488;
4446−
4447−/** @type {*} */
4448−Object.d1489;
4449−
4450−/** @type {*} */
4451−Object.d1490;
4452−
4453−/** @type {*} */
4454−Object.d1491;
4455−
4456−/** @type {*} */
4457−Object.d1492;
4458−
4459−/** @type {*} */
4460−Object.d1493;
4461−
4462−/** @type {*} */
4463−Object.d1494;
4464−
4465−/** @type {*} */
4466−Object.d1495;
4467−
4468−/** @type {*} */
4469−Object.d1496;
4470−
4471−/** @type {*} */
4472−Object.d1497;
4473−
4474−/** @type {*} */
4475−Object.d1498;
4476−
4477−/** @type {*} */
4478−Object.d1499;
4479−
4480−/** @type {*} */
4481−Object.d1500;
4482−
4483−/** @type {*} */
4484−Object.d1501;
4485−
4486−/** @type {*} */
4487−Object.d1502;
4488−
4489−/** @type {*} */
4490−Object.d1503;
4491−
4492−/** @type {*} */
4493−Object.d1504;
4494−
4495−/** @type {*} */
4496−Object.d1505;
4497−
4498−/** @type {*} */
4499−Object.d1506;
4500−
4501−/** @type {*} */
4502−Object.d1507;
4503−
4504−/** @type {*} */
4505−Object.d1508;
4506−
4507−/** @type {*} */
4508−Object.d1509;
4509−
4510−/** @type {*} */
4511−Object.d1510;
4512−
4513−/** @type {*} */
4514−Object.d1511;
4515−
4516−/** @type {*} */
4517−Object.d1512;
4518−
4519−/** @type {*} */
4520−Object.d1513;
4521−
4522−/** @type {*} */
4523−Object.d1514;
4524−
4525−/** @type {*} */
4526−Object.d1515;
4527−
4528−/** @type {*} */
4529−Object.d1516;
4530−
4531−/** @type {*} */
4532−Object.d1517;
4533−
4534−/** @type {*} */
4535−Object.d1518;
4536−
4537−/** @type {*} */
4538−Object.d1519;
4539−
4540−/** @type {*} */
4541−Object.d1520;
4542−
4543−/** @type {*} */
4544−Object.d1521;
4545−
4546−/** @type {*} */
4547−Object.d1522;
4548−
4549−/** @type {*} */
4550−Object.d1523;
4551−
4552−/** @type {*} */
4553−Object.d1524;
4554−
4555−/** @type {*} */
4556−Object.d1525;
4557−
4558−/** @type {*} */
4559−Object.d1526;
4560−
4561−/** @type {*} */
4562−Object.d1527;
4563−
4564−/** @type {*} */
4565−Object.d1528;
4566−
4567−/** @type {*} */
4568−Object.d1529;
4569−
4570−/** @type {*} */
4571−Object.d1530;
4572−
4573−/** @type {*} */
4574−Object.d1531;
4575−
4576−/** @type {*} */
4577−Object.d1532;
4578−
4579−/** @type {*} */
4580−Object.d1533;
4581−
4582−/** @type {*} */
4583−Object.d1534;
4584−
4585−/** @type {*} */
4586−Object.d1535;
4587−
4588−/** @type {*} */
4589−Object.d1536;
4590−
4591−/** @type {*} */
4592−Object.d1537;
4593−
4594−/** @type {*} */
4595−Object.d1538;
4596−
4597−/** @type {*} */
4598−Object.d1539;
4599−
4600−/** @type {*} */
4601−Object.d1540;
4602−
4603−/** @type {*} */
4604−Object.d1541;
4605−
4606−/** @type {*} */
4607−Object.d1542;
4608−
4609−/** @type {*} */
4610−Object.d1543;
4611−
4612−/** @type {*} */
4613−Object.d1544;
4614−
4615−/** @type {*} */
4616−Object.d1545;
4617−
4618−/** @type {*} */
4619−Object.d1546;
4620−
4621−/** @type {*} */
4622−Object.d1547;
4623−
4624−/** @type {*} */
4625−Object.d1548;
4626−
4627−/** @type {*} */
4628−Object.d1549;
4629−
4630−/** @type {*} */
4631−Object.d1550;
4632−
4633−/** @type {*} */
4634−Object.d1551;
4635−
4636−/** @type {*} */
4637−Object.d1552;
4638−
4639−/** @type {*} */
4640−Object.d1553;
4641−
4642−/** @type {*} */
4643−Object.d1554;
4644−
4645−/** @type {*} */
4646−Object.d1555;
4647−
4648−/** @type {*} */
4649−Object.d1556;
4650−
4651−/** @type {*} */
4652−Object.d1557;
4653−
4654−/** @type {*} */
4655−Object.d1558;
4656−
4657−/** @type {*} */
4658−Object.d1559;
4659−
4660−/** @type {*} */
4661−Object.d1560;
4662−
4663−/** @type {*} */
4664−Object.d1561;
4665−
4666−/** @type {*} */
4667−Object.d1562;
4668−
4669−/** @type {*} */
4670−Object.d1563;
4671−
4672−/** @type {*} */
4673−Object.d1564;
4674−
4675−/** @type {*} */
4676−Object.d1565;
4677−
4678−/** @type {*} */
4679−Object.d1566;
4680−
4681−/** @type {*} */
4682−Object.d1567;
4683−
4684−/** @type {*} */
4685−Object.d1568;
4686−
4687−/** @type {*} */
4688−Object.d1569;
4689−
4690−/** @type {*} */
4691−Object.d1570;
4692−
4693−/** @type {*} */
4694−Object.d1571;
4695−
4696−/** @type {*} */
4697−Object.d1572;
4698−
4699−/** @type {*} */
4700−Object.d1573;
4701−
4702−/** @type {*} */
4703−Object.d1574;
4704−
4705−/** @type {*} */
4706−Object.d1575;
4707−
4708−/** @type {*} */
4709−Object.d1576;
4710−
4711−/** @type {*} */
4712−Object.d1577;
4713−
4714−/** @type {*} */
4715−Object.d1578;
4716−
4717−/** @type {*} */
4718−Object.d1579;
4719−
4720−/** @type {*} */
4721−Object.d1580;
4722−
4723−/** @type {*} */
4724−Object.d1581;
4725−
4726−/** @type {*} */
4727−Object.d1582;
4728−
4729−/** @type {*} */
4730−Object.d1583;
4731−
4732−/** @type {*} */
4733−Object.d1584;
4734−
4735−/** @type {*} */
4736−Object.d1585;
4737−
4738−/** @type {*} */
4739−Object.d1586;
4740−
4741−/** @type {*} */
4742−Object.d1587;
4743−
4744−/** @type {*} */
4745−Object.d1588;
4746−
4747−/** @type {*} */
4748−Object.d1589;
4749−
4750−/** @type {*} */
4751−Object.d1590;
4752−
4753−/** @type {*} */
4754−Object.d1591;
4755−
4756−/** @type {*} */
4757−Object.d1592;
4758−
4759−/** @type {*} */
4760−Object.d1593;
4761−
4762−/** @type {*} */
4763−Object.d1594;
4764−
4765−/** @type {*} */
4766−Object.d1595;
4767−
4768−/** @type {*} */
4769−Object.d1596;
4770−
4771−/** @type {*} */
4772−Object.d1597;
4773−
4774−/** @type {*} */
4775−Object.d1598;
4776−
4777−/** @type {*} */
4778−Object.d1599;
4779−
4780−/** @type {*} */
4781−Object.d1600;
4782−
4783−/** @type {*} */
4784−Object.d1601;
4785−
4786−/** @type {*} */
4787−Object.d1602;
4788−
4789−/** @type {*} */
4790−Object.d1603;
4791−
4792−/** @type {*} */
4793−Object.d1604;
4794−
4795−/** @type {*} */
4796−Object.d1605;
4797−
4798−/** @type {*} */
4799−Object.d1606;
4800−
4801−/** @type {*} */
4802−Object.d1607;
4803−
4804−/** @type {*} */
4805−Object.d1608;
4806−
4807−/** @type {*} */
4808−Object.d1609;
4809−
4810−/** @type {*} */
4811−Object.d1610;
4812−
4813−/** @type {*} */
4814−Object.d1611;
4815−
4816−/** @type {*} */
4817−Object.d1612;
4818−
4819−/** @type {*} */
4820−Object.d1613;
4821−
4822−/** @type {*} */
4823−Object.d1614;
4824−
4825−/** @type {*} */
4826−Object.d1615;
4827−
4828−/** @type {*} */
4829−Object.d1616;
4830−
4831−/** @type {*} */
4832−Object.d1617;
4833−
4834−/** @type {*} */
4835−Object.d1618;
4836−
4837−/** @type {*} */
4838−Object.d1619;
4839−
4840−/** @type {*} */
4841−Object.d1620;
4842−
4843−/** @type {*} */
4844−Object.d1621;
4845−
4846−/** @type {*} */
4847−Object.d1622;
4848−
4849−/** @type {*} */
4850−Object.d1623;
4851−
4852−/** @type {*} */
4853−Object.d1624;
4854−
4855−/** @type {*} */
4856−Object.d1625;
4857−
4858−/** @type {*} */
4859−Object.d1626;
4860−
4861−/** @type {*} */
4862−Object.d1627;
4863−
4864−/** @type {*} */
4865−Object.d1628;
4866−
4867−/** @type {*} */
4868−Object.d1629;
4869−
4870−/** @type {*} */
4871−Object.d1630;
4872−
4873−/** @type {*} */
4874−Object.d1631;
4875−
4876−/** @type {*} */
4877−Object.d1632;
4878−
4879−/** @type {*} */
4880−Object.d1633;
4881−
4882−/** @type {*} */
4883−Object.d1634;
4884−
4885−/** @type {*} */
4886−Object.d1635;
4887−
4888−/** @type {*} */
4889−Object.d1636;
4890−
4891−/** @type {*} */
4892−Object.d1637;
4893−
4894−/** @type {*} */
4895−Object.d1638;
4896−
4897−/** @type {*} */
4898−Object.d1639;
4899−
4900−/** @type {*} */
4901−Object.d1640;
4902−
4903−/** @type {*} */
4904−Object.d1641;
4905−
4906−/** @type {*} */
4907−Object.d1642;
4908−
4909−/** @type {*} */
4910−Object.d1643;
4911−
4912−/** @type {*} */
4913−Object.d1644;
4914−
4915−/** @type {*} */
4916−Object.d1645;
4917−
4918−/** @type {*} */
4919−Object.d1646;
4920−
4921−/** @type {*} */
4922−Object.d1647;
4923−
4924−/** @type {*} */
4925−Object.d1648;
4926−
4927−/** @type {*} */
4928−Object.d1649;
4929−
4930−/** @type {*} */
4931−Object.d1650;
4932−
4933−/** @type {*} */
4934−Object.d1651;
4935−
4936−/** @type {*} */
4937−Object.d1652;
4938−
4939−/** @type {*} */
4940−Object.d1653;
4941−
4942−/** @type {*} */
4943−Object.d1654;
4944−
4945−/** @type {*} */
4946−Object.d1655;
4947−
4948−/** @type {*} */
4949−Object.d1656;
4950−
4951−/** @type {*} */
4952−Object.d1657;
4953−
4954−/** @type {*} */
4955−Object.d1658;
4956−
4957−/** @type {*} */
4958−Object.d1659;
4959−
4960−/** @type {*} */
4961−Object.d1660;
4962−
4963−/** @type {*} */
4964−Object.d1661;
4965−
4966−/** @type {*} */
4967−Object.d1662;
4968−
4969−/** @type {*} */
4970−Object.d1663;
4971−
4972−/** @type {*} */
4973−Object.d1664;
4974−
4975−/** @type {*} */
4976−Object.d1665;
4977−
4978−/** @type {*} */
4979−Object.d1666;
4980−
4981−/** @type {*} */
4982−Object.d1667;
4983−
4984−/** @type {*} */
4985−Object.d1668;
4986−
4987−/** @type {*} */
4988−Object.d1669;
4989−
4990−/** @type {*} */
4991−Object.d1670;
4992−
4993−/** @type {*} */
4994−Object.d1671;
4995−
4996−/** @type {*} */
4997−Object.d1672;
4998−
4999−/** @type {*} */
5000−Object.d1673;
5001−
5002−/** @type {*} */
5003−Object.d1674;
5004−
5005−/** @type {*} */
5006−Object.d1675;
5007−
5008−/** @type {*} */
5009−Object.d1676;
5010−
5011−/** @type {*} */
5012−Object.d1677;
5013−
5014−/** @type {*} */
5015−Object.d1678;
5016−
5017−/** @type {*} */
5018−Object.d1679;
5019−
5020−/** @type {*} */
5021−Object.d1680;
5022−
5023−/** @type {*} */
5024−Object.d1681;
5025−
5026−/** @type {*} */
5027−Object.d1682;
5028−
5029−/** @type {*} */
5030−Object.d1683;
5031−
5032−/** @type {*} */
5033−Object.d1684;
5034−
5035−/** @type {*} */
5036−Object.d1685;
5037−
5038−/** @type {*} */
5039−Object.d1686;
5040−
5041−/** @type {*} */
5042−Object.d1687;
5043−
5044−/** @type {*} */
5045−Object.d1688;
5046−
5047−/** @type {*} */
5048−Object.d1689;
5049−
5050−/** @type {*} */
5051−Object.d1690;
5052−
5053−/** @type {*} */
5054−Object.d1691;
5055−
5056−/** @type {*} */
5057−Object.d1692;
5058−
5059−/** @type {*} */
5060−Object.d1693;
5061−
5062−/** @type {*} */
5063−Object.d1694;
5064−
5065−/** @type {*} */
5066−Object.d1695;
5067−
5068−/** @type {*} */
5069−Object.d1696;
5070−
5071−/** @type {*} */
5072−Object.d1697;
5073−
5074−/** @type {*} */
5075−Object.d1698;
5076−
5077−/** @type {*} */
5078−Object.d1699;
5079−
5080−/** @type {*} */
5081−Object.d1700;
5082−
5083−/** @type {*} */
5084−Object.d1701;
5085−
5086−/** @type {*} */
5087−Object.d1702;
5088−
5089−/** @type {*} */
5090−Object.d1703;
5091−
5092−/** @type {*} */
5093−Object.d1704;
5094−
5095−/** @type {*} */
5096−Object.d1705;
5097−
5098−/** @type {*} */
5099−Object.d1706;
5100−
5101−/** @type {*} */
5102−Object.d1707;
5103−
5104−/** @type {*} */
5105−Object.d1708;
5106−
5107−/** @type {*} */
5108−Object.d1709;
5109−
5110−/** @type {*} */
5111−Object.d1710;
5112−
5113−/** @type {*} */
5114−Object.d1711;
5115−
5116−/** @type {*} */
5117−Object.d1712;
5118−
5119−/** @type {*} */
5120−Object.d1713;
5121−
5122−/** @type {*} */
5123−Object.d1714;
5124−
5125−/** @type {*} */
5126−Object.d1715;
5127−
5128−/** @type {*} */
5129−Object.d1716;
5130−
5131−/** @type {*} */
5132−Object.d1717;
5133−
5134−/** @type {*} */
5135−Object.d1718;
5136−
5137−/** @type {*} */
5138−Object.d1719;
5139−
5140−/** @type {*} */
5141−Object.d1720;
5142−
5143−/** @type {*} */
5144−Object.d1721;
5145−
5146−/** @type {*} */
5147−Object.d1722;
5148−
5149−/** @type {*} */
5150−Object.d1723;
5151−
5152−/** @type {*} */
5153−Object.d1724;
5154−
5155−/** @type {*} */
5156−Object.d1725;
5157−
5158−/** @type {*} */
5159−Object.d1726;
5160−
5161−/** @type {*} */
5162−Object.d1727;
5163−
5164−/** @type {*} */
5165−Object.d1728;
5166−
5167−/** @type {*} */
5168−Object.d1729;
5169−
5170−/** @type {*} */
5171−Object.d1730;
5172−
5173−/** @type {*} */
5174−Object.d1731;
5175−
5176−/** @type {*} */
5177−Object.d1732;
5178−
5179−/** @type {*} */
5180−Object.d1733;
5181−
5182−/** @type {*} */
5183−Object.d1734;
5184−
5185−/** @type {*} */
5186−Object.d1735;
5187−
5188−/** @type {*} */
5189−Object.d1736;
5190−
5191−/** @type {*} */
5192−Object.d1737;
5193−
5194−/** @type {*} */
5195−Object.d1738;
5196−
5197−/** @type {*} */
5198−Object.d1739;
5199−
5200−/** @type {*} */
5201−Object.d1740;
5202−
5203−/** @type {*} */
5204−Object.d1741;
5205−
5206−/** @type {*} */
5207−Object.d1742;
5208−
5209−/** @type {*} */
5210−Object.d1743;
5211−
5212−/** @type {*} */
5213−Object.d1744;
5214−
5215−/** @type {*} */
5216−Object.d1745;
5217−
5218−/** @type {*} */
5219−Object.d1746;
5220−
5221−/** @type {*} */
5222−Object.d1747;
5223−
5224−/** @type {*} */
5225−Object.d1748;
5226−
5227−/** @type {*} */
5228−Object.d1749;
5229−
5230−/** @type {*} */
5231−Object.d1750;
5232−
5233−/** @type {*} */
5234−Object.d1751;
5235−
5236−/** @type {*} */
5237−Object.d1752;
5238−
5239−/** @type {*} */
5240−Object.d1753;
5241−
5242−/** @type {*} */
5243−Object.d1754;
5244−
5245−/** @type {*} */
5246−Object.d1755;
5247−
5248−/** @type {*} */
5249−Object.d1756;
5250−
5251−/** @type {*} */
5252−Object.d1757;
5253−
5254−/** @type {*} */
5255−Object.d1758;
5256−
5257−/** @type {*} */
5258−Object.d1759;
5259−
5260−/** @type {*} */
5261−Object.d1760;
5262−
5263−/** @type {*} */
5264−Object.d1761;
5265−
5266−/** @type {*} */
5267−Object.d1762;
5268−
5269−/** @type {*} */
5270−Object.d1763;
5271−
5272−/** @type {*} */
5273−Object.d1764;
5274−
5275−/** @type {*} */
5276−Object.d1765;
5277−
5278−/** @type {*} */
5279−Object.d1766;
5280−
5281−/** @type {*} */
5282−Object.d1767;
5283−
5284−/** @type {*} */
5285−Object.d1768;
5286−
5287−/** @type {*} */
5288−Object.d1769;
5289−
5290−/** @type {*} */
5291−Object.d1770;
5292−
5293−/** @type {*} */
5294−Object.d1771;
5295−
5296−/** @type {*} */
5297−Object.d1772;
5298−
5299−/** @type {*} */
5300−Object.d1773;
5301−
5302−/** @type {*} */
5303−Object.d1774;
5304−
5305−/** @type {*} */
5306−Object.d1775;
5307−
5308−/** @type {*} */
5309−Object.d1776;
5310−
5311−/** @type {*} */
5312−Object.d1777;
5313−
5314−/** @type {*} */
5315−Object.d1778;
5316−
5317−/** @type {*} */
5318−Object.d1779;
5319−
5320−/** @type {*} */
5321−Object.d1780;
5322−
5323−/** @type {*} */
5324−Object.d1781;
5325−
5326−/** @type {*} */
5327−Object.d1782;
5328−
5329−/** @type {*} */
5330−Object.d1783;
5331−
5332−/** @type {*} */
5333−Object.d1784;
5334−
5335−/** @type {*} */
5336−Object.d1785;
5337−
5338−/** @type {*} */
5339−Object.d1786;
5340−
5341−/** @type {*} */
5342−Object.d1787;
5343−
5344−/** @type {*} */
5345−Object.d1788;
5346−
5347−/** @type {*} */
5348−Object.d1789;
5349−
5350−/** @type {*} */
5351−Object.d1790;
5352−
5353−/** @type {*} */
5354−Object.d1791;
5355−
5356−/** @type {*} */
5357−Object.d1792;
5358−
5359−/** @type {*} */
5360−Object.d1793;
5361−
5362−/** @type {*} */
5363−Object.d1794;
5364−
5365−/** @type {*} */
5366−Object.d1795;
5367−
5368−/** @type {*} */
5369−Object.d1796;
5370−
5371−/** @type {*} */
5372−Object.d1797;
5373−
5374−/** @type {*} */
5375−Object.d1798;
5376−
5377−/** @type {*} */
5378−Object.d1799;
5379−
5380−/** @type {*} */
5381−Object.d1800;
5382−
5383−/** @type {*} */
5384−Object.d1801;
5385−
5386−/** @type {*} */
5387−Object.d1802;
5388−
5389−/** @type {*} */
5390−Object.d1803;
5391−
5392−/** @type {*} */
5393−Object.d1804;
5394−
5395−/** @type {*} */
5396−Object.d1805;
5397−
5398−/** @type {*} */
5399−Object.d1806;
5400−
5401−/** @type {*} */
5402−Object.d1807;
5403−
5404−/** @type {*} */
5405−Object.d1808;
5406−
5407−/** @type {*} */
5408−Object.d1809;
5409−
5410−/** @type {*} */
5411−Object.d1810;
5412−
5413−/** @type {*} */
5414−Object.d1811;
5415−
5416−/** @type {*} */
5417−Object.d1812;
5418−
5419−/** @type {*} */
5420−Object.d1813;
5421−
5422−/** @type {*} */
5423−Object.d1814;
5424−
5425−/** @type {*} */
5426−Object.d1815;
5427−
5428−/** @type {*} */
5429−Object.d1816;
5430−
5431−/** @type {*} */
5432−Object.d1817;
5433−
5434−/** @type {*} */
5435−Object.d1818;
5436−
5437−/** @type {*} */
5438−Object.d1819;
5439−
5440−/** @type {*} */
5441−Object.d1820;
5442−
5443−/** @type {*} */
5444−Object.d1821;
5445−
5446−/** @type {*} */
5447−Object.d1822;
5448−
5449−/** @type {*} */
5450−Object.d1823;
5451−
5452−/** @type {*} */
5453−Object.d1824;
5454−
5455−/** @type {*} */
5456−Object.d1825;
5457−
5458−/** @type {*} */
5459−Object.d1826;
5460−
5461−/** @type {*} */
5462−Object.d1827;
5463−
5464−/** @type {*} */
5465−Object.d1828;
5466−
5467−/** @type {*} */
5468−Object.d1829;
5469−
5470−/** @type {*} */
5471−Object.d1830;
5472−
5473−/** @type {*} */
5474−Object.d1831;
5475−
5476−/** @type {*} */
5477−Object.d1832;
5478−
5479−/** @type {*} */
5480−Object.d1833;
5481−
5482−/** @type {*} */
5483−Object.d1834;
5484−
5485−/** @type {*} */
5486−Object.d1835;
5487−
5488−/** @type {*} */
5489−Object.d1836;
5490−
5491−/** @type {*} */
5492−Object.d1837;
5493−
5494−/** @type {*} */
5495−Object.d1838;
5496−
5497−/** @type {*} */
5498−Object.d1839;
5499−
5500−/** @type {*} */
5501−Object.d1840;
5502−
5503−/** @type {*} */
5504−Object.d1841;
5505−
5506−/** @type {*} */
5507−Object.d1842;
5508−
5509−/** @type {*} */
5510−Object.d1843;
5511−
5512−/** @type {*} */
5513−Object.d1844;
5514−
5515−/** @type {*} */
5516−Object.d1845;
5517−
5518−/** @type {*} */
5519−Object.d1846;
5520−
5521−/** @type {*} */
5522−Object.d1847;
5523−
5524−/** @type {*} */
5525−Object.d1848;
5526−
5527−/** @type {*} */
5528−Object.d1849;
5529−
5530−/** @type {*} */
5531−Object.d1850;
5532−
5533−/** @type {*} */
5534−Object.d1851;
5535−
5536−/** @type {*} */
5537−Object.d1852;
5538−
5539−/** @type {*} */
5540−Object.d1853;
5541−
5542−/** @type {*} */
5543−Object.d1854;
5544−
5545−/** @type {*} */
5546−Object.d1855;
5547−
5548−/** @type {*} */
5549−Object.d1856;
5550−
5551−/** @type {*} */
5552−Object.d1857;
5553−
5554−/** @type {*} */
5555−Object.d1858;
5556−
5557−/** @type {*} */
5558−Object.d1859;
5559−
5560−/** @type {*} */
5561−Object.d1860;
5562−
5563−/** @type {*} */
5564−Object.d1861;
5565−
5566−/** @type {*} */
5567−Object.d1862;
5568−
5569−/** @type {*} */
5570−Object.d1863;
5571−
5572−/** @type {*} */
5573−Object.d1864;
5574−
5575−/** @type {*} */
5576−Object.d1865;
5577−
5578−/** @type {*} */
5579−Object.d1866;
5580−
5581−/** @type {*} */
5582−Object.d1867;
5583−
5584−/** @type {*} */
5585−Object.d1868;
5586−
5587−/** @type {*} */
5588−Object.d1869;
5589−
5590−/** @type {*} */
5591−Object.d1870;
5592−
5593−/** @type {*} */
5594−Object.d1871;
5595−
5596−/** @type {*} */
5597−Object.d1872;
5598−
5599−/** @type {*} */
5600−Object.d1873;
5601−
5602−/** @type {*} */
5603−Object.d1874;
5604−
5605−/** @type {*} */
5606−Object.d1875;
5607−
5608−/** @type {*} */
5609−Object.d1876;
5610−
5611−/** @type {*} */
5612−Object.d1877;
5613−
5614−/** @type {*} */
5615−Object.d1878;
5616−
5617−/** @type {*} */
5618−Object.d1879;
5619−
5620−/** @type {*} */
5621−Object.d1880;
5622−
5623−/** @type {*} */
5624−Object.d1881;
5625−
5626−/** @type {*} */
5627−Object.d1882;
5628−
5629−/** @type {*} */
5630−Object.d1883;
5631−
5632−/** @type {*} */
5633−Object.d1884;
5634−
5635−/** @type {*} */
5636−Object.d1885;
5637−
5638−/** @type {*} */
5639−Object.d1886;
5640−
5641−/** @type {*} */
5642−Object.d1887;
5643−
5644−/** @type {*} */
5645−Object.d1888;
5646−
5647−/** @type {*} */
5648−Object.d1889;
5649−
5650−/** @type {*} */
5651−Object.d1890;
5652−
5653−/** @type {*} */
5654−Object.d1891;
5655−
5656−/** @type {*} */
5657−Object.d1892;
5658−
5659−/** @type {*} */
5660−Object.d1893;
5661−
5662−/** @type {*} */
5663−Object.d1894;
5664−
5665−/** @type {*} */
5666−Object.d1895;
5667−
5668−/** @type {*} */
5669−Object.d1896;
5670−
5671−/** @type {*} */
5672−Object.d1897;
5673−
5674−/** @type {*} */
5675−Object.d1898;
5676−
5677−/** @type {*} */
5678−Object.d1899;
5679−
5680−/** @type {*} */
5681−Object.d1900;
5682−
5683−/** @type {*} */
5684−Object.d1901;
5685−
5686−/** @type {*} */
5687−Object.d1902;
5688−
5689−/** @type {*} */
5690−Object.d1903;
5691−
5692−/** @type {*} */
5693−Object.d1904;
5694−
5695−/** @type {*} */
5696−Object.d1905;
5697−
5698−/** @type {*} */
5699−Object.d1906;
5700−
5701−/** @type {*} */
5702−Object.d1907;
5703−
5704−/** @type {*} */
5705−Object.d1908;
5706−
5707−/** @type {*} */
5708−Object.d1909;
5709−
5710−/** @type {*} */
5711−Object.d1910;
5712−
5713−/** @type {*} */
5714−Object.d1911;
5715−
5716−/** @type {*} */
5717−Object.d1912;
5718−
5719−/** @type {*} */
5720−Object.d1913;
5721−
5722−/** @type {*} */
5723−Object.d1914;
5724−
5725−/** @type {*} */
5726−Object.d1915;
5727−
5728−/** @type {*} */
5729−Object.d1916;
5730−
5731−/** @type {*} */
5732−Object.d1917;
5733−
5734−/** @type {*} */
5735−Object.d1918;
5736−
5737−/** @type {*} */
5738−Object.d1919;
5739−
5740−/** @type {*} */
5741−Object.d1920;
5742−
5743−/** @type {*} */
5744−Object.d1921;
5745−
5746−/** @type {*} */
5747−Object.d1922;
5748−
5749−/** @type {*} */
5750−Object.d1923;
5751−
5752−/** @type {*} */
5753−Object.d1924;
5754−
5755−/** @type {*} */
5756−Object.d1925;
5757−
5758−/** @type {*} */
5759−Object.d1926;
5760−
5761−/** @type {*} */
5762−Object.d1927;
5763−
5764−/** @type {*} */
5765−Object.d1928;
5766−
5767−/** @type {*} */
5768−Object.d1929;
5769−
5770−/** @type {*} */
5771−Object.d1930;
5772−
5773−/** @type {*} */
5774−Object.d1931;
5775−
5776−/** @type {*} */
5777−Object.d1932;
5778−
5779−/** @type {*} */
5780−Object.d1933;
5781−
5782−/** @type {*} */
5783−Object.d1934;
5784−
5785−/** @type {*} */
5786−Object.d1935;
5787−
5788−/** @type {*} */
5789−Object.d1936;
5790−
5791−/** @type {*} */
5792−Object.d1937;
5793−
5794−/** @type {*} */
5795−Object.d1938;
5796−
5797−/** @type {*} */
5798−Object.d1939;
5799−
5800−/** @type {*} */
5801−Object.d1940;
5802−
5803−/** @type {*} */
5804−Object.d1941;
5805−
5806−/** @type {*} */
5807−Object.d1942;
5808−
5809−/** @type {*} */
5810−Object.d1943;
5811−
5812−/** @type {*} */
5813−Object.d1944;
5814−
5815−/** @type {*} */
5816−Object.d1945;
5817−
5818−/** @type {*} */
5819−Object.d1946;
5820−
5821−/** @type {*} */
5822−Object.d1947;
5823−
5824−/** @type {*} */
5825−Object.d1948;
5826−
5827−/** @type {*} */
5828−Object.d1949;
5829−
5830−/** @type {*} */
5831−Object.d1950;
5832−
5833−/** @type {*} */
5834−Object.d1951;
5835−
5836−/** @type {*} */
5837−Object.d1952;
5838−
5839−/** @type {*} */
5840−Object.d1953;
5841−
5842−/** @type {*} */
5843−Object.d1954;
5844−
5845−/** @type {*} */
5846−Object.d1955;
5847−
5848−/** @type {*} */
5849−Object.d1956;
5850−
5851−/** @type {*} */
5852−Object.d1957;
5853−
5854−/** @type {*} */
5855−Object.d1958;
5856−
5857−/** @type {*} */
5858−Object.d1959;
5859−
5860−/** @type {*} */
5861−Object.d1960;
5862−
5863−/** @type {*} */
5864−Object.d1961;
5865−
5866−/** @type {*} */
5867−Object.d1962;
5868−
5869−/** @type {*} */
5870−Object.d1963;
5871−
5872−/** @type {*} */
5873−Object.d1964;
5874−
5875−/** @type {*} */
5876−Object.d1965;
5877−
5878−/** @type {*} */
5879−Object.d1966;
5880−
5881−/** @type {*} */
5882−Object.d1967;
5883−
5884−/** @type {*} */
5885−Object.d1968;
5886−
5887−/** @type {*} */
5888−Object.d1969;
5889−
5890−/** @type {*} */
5891−Object.d1970;
5892−
5893−/** @type {*} */
5894−Object.d1971;
5895−
5896−/** @type {*} */
5897−Object.d1972;
5898−
5899−/** @type {*} */
5900−Object.d1973;
5901−
5902−/** @type {*} */
5903−Object.d1974;
5904−
5905−/** @type {*} */
5906−Object.d1975;
5907−
5908−/** @type {*} */
5909−Object.d1976;
5910−
5911−/** @type {*} */
5912−Object.d1977;
5913−
5914−/** @type {*} */
5915−Object.d1978;
5916−
5917−/** @type {*} */
5918−Object.d1979;
5919−
5920−/** @type {*} */
5921−Object.d1980;
5922−
5923−/** @type {*} */
5924−Object.d1981;
5925−
5926−/** @type {*} */
5927−Object.d1982;
5928−
5929−/** @type {*} */
5930−Object.d1983;
5931−
5932−/** @type {*} */
5933−Object.d1984;
5934−
5935−/** @type {*} */
5936−Object.d1985;
5937−
5938−/** @type {*} */
5939−Object.d1986;
5940−
5941−/** @type {*} */
5942−Object.d1987;
5943−
5944−/** @type {*} */
5945−Object.d1988;
5946−
5947−/** @type {*} */
5948−Object.d1989;
5949−
5950−/** @type {*} */
5951−Object.d1990;
5952−
5953−/** @type {*} */
5954−Object.d1991;
5955−
5956−/** @type {*} */
5957−Object.d1992;
5958−
5959−/** @type {*} */
5960−Object.d1993;
5961−
5962−/** @type {*} */
5963−Object.d1994;
5964−
5965−/** @type {*} */
5966−Object.d1995;
5967−
5968−/** @type {*} */
5969−Object.d1996;
5970−
5971−/** @type {*} */
5972−Object.d1997;
5973−
5974−/** @type {*} */
5975−Object.d1998;
5976−
5977−/** @type {*} */
5978−Object.d1999;
5979−
5980−/** @type {*} */
5981−Object.d2000;
5982−
5983−/** @type {*} */
5984−Object.d2001;
5985−
5986−/** @type {*} */
5987−Object.d2002;
5988−
5989−/** @type {*} */
5990−Object.d2003;
5991−
5992−/** @type {*} */
5993−Object.d2004;
5994−
5995−/** @type {*} */
5996−Object.d2005;
5997−
5998−/** @type {*} */
5999−Object.d2006;
6000−
6001−/** @type {*} */
6002−Object.d2007;
6003−
6004−/** @type {*} */
6005−Object.d2008;
6006−
6007−/** @type {*} */
6008−Object.d2009;
6009−
6010−/** @type {*} */
6011−Object.d2010;
6012−
6013−/** @type {*} */
6014−Object.d2011;
6015−
6016−/** @type {*} */
6017−Object.d2012;
6018−
6019−/** @type {*} */
6020−Object.d2013;
6021−
6022−/** @type {*} */
6023−Object.d2014;
6024−
6025−/** @type {*} */
6026−Object.d2015;
6027−
6028−/** @type {*} */
6029−Object.d2016;
6030−
6031−/** @type {*} */
6032−Object.d2017;
6033−
6034−/** @type {*} */
6035−Object.d2018;
6036−
6037−/** @type {*} */
6038−Object.d2019;
6039−
6040−/** @type {*} */
6041−Object.d2020;
6042−
6043−/** @type {*} */
6044−Object.d2021;
6045−
6046−/** @type {*} */
6047−Object.d2022;
6048−
6049−/** @type {*} */
6050−Object.d2023;
6051−
6052−/** @type {*} */
6053−Object.d2024;
6054−
6055−/** @type {*} */
6056−Object.d2025;
6057−
6058−/** @type {*} */
6059−Object.d2026;
6060−
6061−/** @type {*} */
6062−Object.d2027;
6063−
6064−/** @type {*} */
6065−Object.d2028;
6066−
6067−/** @type {*} */
6068−Object.d2029;
6069−
6070−/** @type {*} */
6071−Object.d2030;
6072−
6073−/** @type {*} */
6074−Object.d2031;
6075−
6076−/** @type {*} */
6077−Object.d2032;
6078−
6079−/** @type {*} */
6080−Object.d2033;
6081−
6082−/** @type {*} */
6083−Object.d2034;
6084−
6085−/** @type {*} */
6086−Object.d2035;
6087−
6088−/** @type {*} */
6089−Object.d2036;
6090−
6091−/** @type {*} */
6092−Object.d2037;
6093−
6094−/** @type {*} */
6095−Object.d2038;
6096−
6097−/** @type {*} */
6098−Object.d2039;
6099−
6100−/** @type {*} */
6101−Object.d2040;
6102−
6103−/** @type {*} */
6104−Object.d2041;
6105−
6106−/** @type {*} */
6107−Object.d2042;
6108−
6109−/** @type {*} */
6110−Object.d2043;
6111−
6112−/** @type {*} */
6113−Object.d2044;
6114−
6115−/** @type {*} */
6116−Object.d2045;
6117−
6118−/** @type {*} */
6119−Object.d2046;
6120−
6121−/** @type {*} */
6122−Object.d2047;
6123−
6124−/** @type {*} */
6125−Object.d2048;
6126−
6127−/** @type {*} */
6128−Object.d2049;
6129−
6130−/** @type {*} */
6131−Object.d2050;
6132−
6133−/** @type {*} */
6134−Object.d2051;
6135−
6136−/** @type {*} */
6137−Object.d2052;
6138−
6139−/** @type {*} */
6140−Object.d2053;
6141−
6142−/** @type {*} */
6143−Object.d2054;
6144−
6145−/** @type {*} */
6146−Object.d2055;
6147−
6148−/** @type {*} */
6149−Object.d2056;
6150−
6151−/** @type {*} */
6152−Object.d2057;
6153−
6154−/** @type {*} */
6155−Object.d2058;
6156−
6157−/** @type {*} */
6158−Object.d2059;
6159−
6160−/** @type {*} */
6161−Object.d2060;
6162−
6163−/** @type {*} */
6164−Object.d2061;
6165−
6166−/** @type {*} */
6167−Object.d2062;
6168−
6169−/** @type {*} */
6170−Object.d2063;
6171−
6172−/** @type {*} */
6173−Object.d2064;
6174−
6175−/** @type {*} */
6176−Object.d2065;
6177−
6178−/** @type {*} */
6179−Object.d2066;
6180−
6181−/** @type {*} */
6182−Object.d2067;
6183−
6184−/** @type {*} */
6185−Object.d2068;
6186−
6187−/** @type {*} */
6188−Object.d2069;
6189−
6190−/** @type {*} */
6191−Object.d2070;
6192−
6193−/** @type {*} */
6194−Object.d2071;
6195−
6196−/** @type {*} */
6197−Object.d2072;
6198−
6199−/** @type {*} */
6200−Object.d2073;
6201−
6202−/** @type {*} */
6203−Object.d2074;
6204−
6205−/** @type {*} */
6206−Object.d2075;
6207−
6208−/** @type {*} */
6209−Object.d2076;
6210−
6211−/** @type {*} */
6212−Object.d2077;
6213−
6214−/** @type {*} */
6215−Object.d2078;
6216−
6217−/** @type {*} */
6218−Object.d2079;
6219−
6220−/** @type {*} */
6221−Object.d2080;
6222−
6223−/** @type {*} */
6224−Object.d2081;
6225−
6226−/** @type {*} */
6227−Object.d2082;
6228−
6229−/** @type {*} */
6230−Object.d2083;
6231−
6232−/** @type {*} */
6233−Object.d2084;
6234−
6235−/** @type {*} */
6236−Object.d2085;
6237−
6238−/** @type {*} */
6239−Object.d2086;
6240−
6241−/** @type {*} */
6242−Object.d2087;
6243−
6244−/** @type {*} */
6245−Object.d2088;
6246−
6247−/** @type {*} */
6248−Object.d2089;
6249−
6250−/** @type {*} */
6251−Object.d2090;
6252−
6253−/** @type {*} */
6254−Object.d2091;
6255−
6256−/** @type {*} */
6257−Object.d2092;
6258−
6259−/** @type {*} */
6260−Object.d2093;
6261−
6262−/** @type {*} */
6263−Object.d2094;
6264−
6265−/** @type {*} */
6266−Object.d2095;
6267−
6268−/** @type {*} */
6269−Object.d2096;
6270−
6271−/** @type {*} */
6272−Object.d2097;
6273−
6274−/** @type {*} */
6275−Object.d2098;
6276−
6277−/** @type {*} */
6278−Object.d2099;
6279−
6280−/** @type {*} */
6281−Object.d2100;
6282−
6283−/** @type {*} */
6284−Object.d2101;
6285−
6286−/** @type {*} */
6287−Object.d2102;
6288−
6289−/** @type {*} */
6290−Object.d2103;
6291−
6292−/** @type {*} */
6293−Object.d2104;
6294−
6295−/** @type {*} */
6296−Object.d2105;
6297−
6298−/** @type {*} */
6299−Object.d2106;
6300−
6301−/** @type {*} */
6302−Object.d2107;
6303−
6304−/** @type {*} */
6305−Object.d2108;
6306−
6307−/** @type {*} */
6308−Object.d2109;
6309−
6310−/** @type {*} */
6311−Object.d2110;
6312−
6313−/** @type {*} */
6314−Object.d2111;
6315−
6316−/** @type {*} */
6317−Object.d2112;
6318−
6319−/** @type {*} */
6320−Object.d2113;
6321−
6322−/** @type {*} */
6323−Object.d2114;
6324−
6325−/** @type {*} */
6326−Object.d2115;
6327−
6328−/** @type {*} */
6329−Object.d2116;
6330−
6331−/** @type {*} */
6332−Object.d2117;
6333−
6334−/** @type {*} */
6335−Object.d2118;
6336−
6337−/** @type {*} */
6338−Object.d2119;
6339−
6340−/** @type {*} */
6341−Object.d2120;
6342−
6343−/** @type {*} */
6344−Object.d2121;
6345−
6346−/** @type {*} */
6347−Object.d2122;
6348−
6349−/** @type {*} */
6350−Object.d2123;
6351−
6352−/** @type {*} */
6353−Object.d2124;
6354−
6355−/** @type {*} */
6356−Object.d2125;
6357−
6358−/** @type {*} */
6359−Object.d2126;
6360−
6361−/** @type {*} */
6362−Object.d2127;
6363−
6364−/** @type {*} */
6365−Object.d2128;
6366−
6367−/** @type {*} */
6368−Object.d2129;
6369−
6370−/** @type {*} */
6371−Object.d2130;
6372−
6373−/** @type {*} */
6374−Object.d2131;
6375−
6376−/** @type {*} */
6377−Object.d2132;
6378−
6379−/** @type {*} */
6380−Object.d2133;
6381−
6382−/** @type {*} */
6383−Object.d2134;
6384−
6385−/** @type {*} */
6386−Object.d2135;
6387−
6388−/** @type {*} */
6389−Object.d2136;
6390−
6391−/** @type {*} */
6392−Object.d2137;
6393−
6394−/** @type {*} */
6395−Object.d2138;
6396−
6397−/** @type {*} */
6398−Object.d2139;
6399−
6400−/** @type {*} */
6401−Object.d2140;
6402−
6403−/** @type {*} */
6404−Object.d2141;
6405−
6406−/** @type {*} */
6407−Object.d2142;
6408−
6409−/** @type {*} */
6410−Object.d2143;
6411−
6412−/** @type {*} */
6413−Object.d2144;
6414−
6415−/** @type {*} */
6416−Object.d2145;
6417−
6418−/** @type {*} */
6419−Object.d2146;
6420−
6421−/** @type {*} */
6422−Object.d2147;
6423−
6424−/** @type {*} */
6425−Object.d2148;
6426−
6427−/** @type {*} */
6428−Object.d2149;
6429−
6430−/** @type {*} */
6431−Object.d2150;
6432−
6433−/** @type {*} */
6434−Object.d2151;
6435−
6436−/** @type {*} */
6437−Object.d2152;
6438−
6439−/** @type {*} */
6440−Object.d2153;
6441−
6442−/** @type {*} */
6443−Object.d2154;
6444−
6445−/** @type {*} */
6446−Object.d2155;
6447−
6448−/** @type {*} */
6449−Object.d2156;
6450−
6451−/** @type {*} */
6452−Object.d2157;
6453−
6454−/** @type {*} */
6455−Object.d2158;
6456−
6457−/** @type {*} */
6458−Object.d2159;
6459−
6460−/** @type {*} */
6461−Object.d2160;
6462−
6463−/** @type {*} */
6464−Object.d2161;
6465−
6466−/** @type {*} */
6467−Object.d2162;
6468−
6469−/** @type {*} */
6470−Object.d2163;
6471−
6472−/** @type {*} */
6473−Object.d2164;
6474−
6475−/** @type {*} */
6476−Object.d2165;
6477−
6478−/** @type {*} */
6479−Object.d2166;
6480−
6481−/** @type {*} */
6482−Object.d2167;
6483−
6484−/** @type {*} */
6485−Object.d2168;
6486−
6487−/** @type {*} */
6488−Object.d2169;
6489−
6490−/** @type {*} */
6491−Object.d2170;
6492−
6493−/** @type {*} */
6494−Object.d2171;
6495−
6496−/** @type {*} */
6497−Object.d2172;
6498−
6499−/** @type {*} */
6500−Object.d2173;
6501−
6502−/** @type {*} */
6503−Object.d2174;
6504−
6505−/** @type {*} */
6506−Object.d2175;
6507−
6508−/** @type {*} */
6509−Object.d2176;
6510−
6511−/** @type {*} */
6512−Object.d2177;
6513−
6514−/** @type {*} */
6515−Object.d2178;
6516−
6517−/** @type {*} */
6518−Object.d2179;
6519−
6520−/** @type {*} */
6521−Object.d2180;
6522−
6523−/** @type {*} */
6524−Object.d2181;
6525−
6526−/** @type {*} */
6527−Object.d2182;
6528−
6529−/** @type {*} */
6530−Object.d2183;
6531−
6532−/** @type {*} */
6533−Object.d2184;
6534−
6535−/** @type {*} */
6536−Object.d2185;
6537−
6538−/** @type {*} */
6539−Object.d2186;
6540−
6541−/** @type {*} */
6542−Object.d2187;
6543−
6544−/** @type {*} */
6545−Object.d2188;
6546−
6547−/** @type {*} */
6548−Object.d2189;
6549−
6550−/** @type {*} */
6551−Object.d2190;
6552−
6553−/** @type {*} */
6554−Object.d2191;
6555−
6556−/** @type {*} */
6557−Object.d2192;
6558−
6559−/** @type {*} */
6560−Object.d2193;
6561−
6562−/** @type {*} */
6563−Object.d2194;
6564−
6565−/** @type {*} */
6566−Object.d2195;
6567−
6568−/** @type {*} */
6569−Object.d2196;
6570−
6571−/** @type {*} */
6572−Object.d2197;
6573−
6574−/** @type {*} */
6575−Object.d2198;
6576−
6577−/** @type {*} */
6578−Object.d2199;
6579−
6580−/** @type {*} */
6581−Object.d2200;
6582−
6583−/** @type {*} */
6584−Object.d2201;
6585−
6586−/** @type {*} */
6587−Object.d2202;
6588−
6589−/** @type {*} */
6590−Object.d2203;
6591−
6592−/** @type {*} */
6593−Object.d2204;
6594−
6595−/** @type {*} */
6596−Object.d2205;
6597−
6598−/** @type {*} */
6599−Object.d2206;
6600−
6601−/** @type {*} */
6602−Object.d2207;
6603−
6604−/** @type {*} */
6605−Object.d2208;
6606−
6607−/** @type {*} */
6608−Object.d2209;
6609−
6610−/** @type {*} */
6611−Object.d2210;
6612−
6613−/** @type {*} */
6614−Object.d2211;
6615−
6616−/** @type {*} */
6617−Object.d2212;
6618−
6619−/** @type {*} */
6620−Object.d2213;
6621−
6622−/** @type {*} */
6623−Object.d2214;
6624−
6625−/** @type {*} */
6626−Object.d2215;
6627−
6628−/** @type {*} */
6629−Object.d2216;
6630−
6631−/** @type {*} */
6632−Object.d2217;
6633−
6634−/** @type {*} */
6635−Object.d2218;
6636−
6637−/** @type {*} */
6638−Object.d2219;
6639−
6640−/** @type {*} */
6641−Object.d2220;
6642−
6643−/** @type {*} */
6644−Object.d2221;
6645−
6646−/** @type {*} */
6647−Object.d2222;
6648−
6649−/** @type {*} */
6650−Object.d2223;
6651−
6652−/** @type {*} */
6653−Object.d2224;
6654−
6655−/** @type {*} */
6656−Object.d2225;
6657−
6658−/** @type {*} */
6659−Object.d2226;
6660−
6661−/** @type {*} */
6662−Object.d2227;
6663−
6664−/** @type {*} */
6665−Object.d2228;
6666−
6667−/** @type {*} */
6668−Object.d2229;
6669−
6670−/** @type {*} */
6671−Object.d2230;
6672−
6673−/** @type {*} */
6674−Object.d2231;
6675−
6676−/** @type {*} */
6677−Object.d2232;
6678−
6679−/** @type {*} */
6680−Object.d2233;
6681−
6682−/** @type {*} */
6683−Object.d2234;
6684−
6685−/** @type {*} */
6686−Object.d2235;
6687−
6688−/** @type {*} */
6689−Object.d2236;
6690−
6691−/** @type {*} */
6692−Object.d2237;
6693−
6694−/** @type {*} */
6695−Object.d2238;
6696−
6697−/** @type {*} */
6698−Object.d2239;
6699−
6700−/** @type {*} */
6701−Object.d2240;
6702−
6703−/** @type {*} */
6704−Object.d2241;
6705−
6706−/** @type {*} */
6707−Object.d2242;
6708−
6709−/** @type {*} */
6710−Object.d2243;
6711−
6712−/** @type {*} */
6713−Object.d2244;
6714−
6715−/** @type {*} */
6716−Object.d2245;
6717−
6718−/** @type {*} */
6719−Object.d2246;
6720−
6721−/** @type {*} */
6722−Object.d2247;
6723−
6724−/** @type {*} */
6725−Object.d2248;
6726−
6727−/** @type {*} */
6728−Object.d2249;
6729−
6730−/** @type {*} */
6731−Object.d2250;
6732−
6733−/** @type {*} */
6734−Object.d2251;
6735−
6736−/** @type {*} */
6737−Object.d2252;
6738−
6739−/** @type {*} */
6740−Object.d2253;
6741−
6742−/** @type {*} */
6743−Object.d2254;
6744−
6745−/** @type {*} */
6746−Object.d2255;
6747−
6748−/** @type {*} */
6749−Object.d2256;
6750−
6751−/** @type {*} */
6752−Object.d2257;
6753−
6754−/** @type {*} */
6755−Object.d2258;
6756−
6757−/** @type {*} */
6758−Object.d2259;
6759−
6760−/** @type {*} */
6761−Object.d2260;
6762−
6763−/** @type {*} */
6764−Object.d2261;
6765−
6766−/** @type {*} */
6767−Object.d2262;
6768−
6769−/** @type {*} */
6770−Object.d2263;
6771−
6772−/** @type {*} */
6773−Object.d2264;
6774−
6775−/** @type {*} */
6776−Object.d2265;
6777−
6778−/** @type {*} */
6779−Object.d2266;
6780−
6781−/** @type {*} */
6782−Object.d2267;
6783−
6784−/** @type {*} */
6785−Object.d2268;
6786−
6787−/** @type {*} */
6788−Object.d2269;
6789−
6790−/** @type {*} */
6791−Object.d2270;
6792−
6793−/** @type {*} */
6794−Object.d2271;
6795−
6796−/** @type {*} */
6797−Object.d2272;
6798−
6799−/** @type {*} */
6800−Object.d2273;
6801−
6802−/** @type {*} */
6803−Object.d2274;
6804−
6805−/** @type {*} */
6806−Object.d2275;
6807−
6808−/** @type {*} */
6809−Object.d2276;
6810−
6811−/** @type {*} */
6812−Object.d2277;
6813−
6814−/** @type {*} */
6815−Object.d2278;
6816−
6817−/** @type {*} */
6818−Object.d2279;
6819−
6820−/** @type {*} */
6821−Object.d2280;
6822−
6823−/** @type {*} */
6824−Object.d2281;
6825−
6826−/** @type {*} */
6827−Object.d2282;
6828−
6829−/** @type {*} */
6830−Object.d2283;
6831−
6832−/** @type {*} */
6833−Object.d2284;
6834−
6835−/** @type {*} */
6836−Object.d2285;
6837−
6838−/** @type {*} */
6839−Object.d2286;
6840−
6841−/** @type {*} */
6842−Object.d2287;
6843−
6844−/** @type {*} */
6845−Object.d2288;
6846−
6847−/** @type {*} */
6848−Object.d2289;
6849−
6850−/** @type {*} */
6851−Object.d2290;
6852−
6853−/** @type {*} */
6854−Object.d2291;
6855−
6856−/** @type {*} */
6857−Object.d2292;
6858−
6859−/** @type {*} */
6860−Object.d2293;
6861−
6862−/** @type {*} */
6863−Object.d2294;
6864−
6865−/** @type {*} */
6866−Object.d2295;
6867−
6868−/** @type {*} */
6869−Object.d2296;
6870−
6871−/** @type {*} */
6872−Object.d2297;
6873−
6874−/** @type {*} */
6875−Object.d2298;
6876−
6877−/** @type {*} */
6878−Object.d2299;
6879−
6880−/** @type {*} */
6881−Object.d2300;
6882−
6883−/** @type {*} */
6884−Object.d2301;
6885−
6886−/** @type {*} */
6887−Object.d2302;
6888−
6889−/** @type {*} */
6890−Object.d2303;
6891−
6892−/** @type {*} */
6893−Object.d2304;
6894−
6895−/** @type {*} */
6896−Object.d2305;
6897−
6898−/** @type {*} */
6899−Object.d2306;
6900−
6901−/** @type {*} */
6902−Object.d2307;
6903−
6904−/** @type {*} */
6905−Object.d2308;
6906−
6907−/** @type {*} */
6908−Object.d2309;
6909−
6910−/** @type {*} */
6911−Object.d2310;
6912−
6913−/** @type {*} */
6914−Object.d2311;
6915−
6916−/** @type {*} */
6917−Object.d2312;
6918−
6919−/** @type {*} */
6920−Object.d2313;
6921−
6922−/** @type {*} */
6923−Object.d2314;
6924−
6925−/** @type {*} */
6926−Object.d2315;
6927−
6928−/** @type {*} */
6929−Object.d2316;
6930−
6931−/** @type {*} */
6932−Object.d2317;
6933−
6934−/** @type {*} */
6935−Object.d2318;
6936−
6937−/** @type {*} */
6938−Object.d2319;
6939−
6940−/** @type {*} */
6941−Object.d2320;
6942−
6943−/** @type {*} */
6944−Object.d2321;
6945−
6946−/** @type {*} */
6947−Object.d2322;
6948−
6949−/** @type {*} */
6950−Object.d2323;
6951−
6952−/** @type {*} */
6953−Object.d2324;
6954−
6955−/** @type {*} */
6956−Object.d2325;
6957−
6958−/** @type {*} */
6959−Object.d2326;
6960−
6961−/** @type {*} */
6962−Object.d2327;
6963−
6964−/** @type {*} */
6965−Object.d2328;
6966−
6967−/** @type {*} */
6968−Object.d2329;
6969−
6970−/** @type {*} */
6971−Object.d2330;
6972−
6973−/** @type {*} */
6974−Object.d2331;
6975−
6976−/** @type {*} */
6977−Object.d2332;
6978−
6979−/** @type {*} */
6980−Object.d2333;
6981−
6982−/** @type {*} */
6983−Object.d2334;
6984−
6985−/** @type {*} */
6986−Object.d2335;
6987−
6988−/** @type {*} */
6989−Object.d2336;
6990−
6991−/** @type {*} */
6992−Object.d2337;
6993−
6994−/** @type {*} */
6995−Object.d2338;
6996−
6997−/** @type {*} */
6998−Object.d2339;
6999−
7000−/** @type {*} */
7001−Object.d2340;
7002−
7003−/** @type {*} */
7004−Object.d2341;
7005−
7006−/** @type {*} */
7007−Object.d2342;
7008−
7009−/** @type {*} */
7010−Object.d2343;
7011−
7012−/** @type {*} */
7013−Object.d2344;
7014−
7015−/** @type {*} */
7016−Object.d2345;
7017−
7018−/** @type {*} */
7019−Object.d2346;
7020−
7021−/** @type {*} */
7022−Object.d2347;
7023−
7024−/** @type {*} */
7025−Object.d2348;
7026−
7027−/** @type {*} */
7028−Object.d2349;
7029−
7030−/** @type {*} */
7031−Object.d2350;
7032−
7033−/** @type {*} */
7034−Object.d2351;
7035−
7036−/** @type {*} */
7037−Object.d2352;
7038−
7039−/** @type {*} */
7040−Object.d2353;
7041−
7042−/** @type {*} */
7043−Object.d2354;
7044−
7045−/** @type {*} */
7046−Object.d2355;
7047−
7048−/** @type {*} */
7049−Object.d2356;
7050−
7051−/** @type {*} */
7052−Object.d2357;
7053−
7054−/** @type {*} */
7055−Object.d2358;
7056−
7057−/** @type {*} */
7058−Object.d2359;
7059−
7060−/** @type {*} */
7061−Object.d2360;
7062−
7063−/** @type {*} */
7064−Object.d2361;
7065−
7066−/** @type {*} */
7067−Object.d2362;
7068−
7069−/** @type {*} */
7070−Object.d2363;
7071−
7072−/** @type {*} */
7073−Object.d2364;
7074−
7075−/** @type {*} */
7076−Object.d2365;
7077−
7078−/** @type {*} */
7079−Object.d2366;
7080−
7081−/** @type {*} */
7082−Object.d2367;
7083−
7084−/** @type {*} */
7085−Object.d2368;
7086−
7087−/** @type {*} */
7088−Object.d2369;
7089−
7090−/** @type {*} */
7091−Object.d2370;
7092−
7093−/** @type {*} */
7094−Object.d2371;
7095−
7096−/** @type {*} */
7097−Object.d2372;
7098−
7099−/** @type {*} */
7100−Object.d2373;
7101−
7102−/** @type {*} */
7103−Object.d2374;
7104−
7105−/** @type {*} */
7106−Object.d2375;
7107−
7108−/** @type {*} */
7109−Object.d2376;
7110−
7111−/** @type {*} */
7112−Object.d2377;
7113−
7114−/** @type {*} */
7115−Object.d2378;
7116−
7117−/** @type {*} */
7118−Object.d2379;
7119−
7120−/** @type {*} */
7121−Object.d2380;
7122−
7123−/** @type {*} */
7124−Object.d2381;
7125−
7126−/** @type {*} */
7127−Object.d2382;
7128−
7129−/** @type {*} */
7130−Object.d2383;
7131−
7132−/** @type {*} */
7133−Object.d2384;
7134−
7135−/** @type {*} */
7136−Object.d2385;
7137−
7138−/** @type {*} */
7139−Object.d2386;
7140−
7141−/** @type {*} */
7142−Object.d2387;
7143−
7144−/** @type {*} */
7145−Object.d2388;
7146−
7147−/** @type {*} */
7148−Object.d2389;
7149−
7150−/** @type {*} */
7151−Object.d2390;
7152−
7153−/** @type {*} */
7154−Object.d2391;
7155−
7156−/** @type {*} */
7157−Object.d2392;
7158−
7159−/** @type {*} */
7160−Object.d2393;
7161−
7162−/** @type {*} */
7163−Object.d2394;
7164−
7165−/** @type {*} */
7166−Object.d2395;
7167−
7168−/** @type {*} */
7169−Object.d2396;
7170−
7171−/** @type {*} */
7172−Object.d2397;
7173−
7174−/** @type {*} */
7175−Object.d2398;
7176−
7177−/** @type {*} */
7178−Object.d2399;
7179−
7180−/** @type {*} */
7181−Object.d2400;
7182−
7183−/** @type {*} */
7184−Object.d2401;
7185−
7186−/** @type {*} */
7187−Object.d2402;
7188−
7189−/** @type {*} */
7190−Object.d2403;
7191−
7192−/** @type {*} */
7193−Object.d2404;
7194−
7195−/** @type {*} */
7196−Object.d2405;
7197−
7198−/** @type {*} */
7199−Object.d2406;
7200−
7201−/** @type {*} */
7202−Object.d2407;
7203−
7204−/** @type {*} */
7205−Object.d2408;
7206−
7207−/** @type {*} */
7208−Object.d2409;
7209−
7210−/** @type {*} */
7211−Object.d2410;
7212−
7213−/** @type {*} */
7214−Object.d2411;
7215−
7216−/** @type {*} */
7217−Object.d2412;
7218−
7219−/** @type {*} */
7220−Object.d2413;
7221−
7222−/** @type {*} */
7223−Object.d2414;
7224−
7225−/** @type {*} */
7226−Object.d2415;
7227−
7228−/** @type {*} */
7229−Object.d2416;
7230−
7231−/** @type {*} */
7232−Object.d2417;
7233−
7234−/** @type {*} */
7235−Object.d2418;
7236−
7237−/** @type {*} */
7238−Object.d2419;
7239−
7240−/** @type {*} */
7241−Object.d2420;
7242−
7243−/** @type {*} */
7244−Object.d2421;
7245−
7246−/** @type {*} */
7247−Object.d2422;
7248−
7249−/** @type {*} */
7250−Object.d2423;
7251−
7252−/** @type {*} */
7253−Object.d2424;
7254−
7255−/** @type {*} */
7256−Object.d2425;
7257−
7258−/** @type {*} */
7259−Object.d2426;
7260−
7261−/** @type {*} */
7262−Object.d2427;
7263−
7264−/** @type {*} */
7265−Object.d2428;
7266−
7267−/** @type {*} */
7268−Object.d2429;
7269−
7270−/** @type {*} */
7271−Object.d2430;
7272−
7273−/** @type {*} */
7274−Object.d2431;
7275−
7276−/** @type {*} */
7277−Object.d2432;
7278−
7279−/** @type {*} */
7280−Object.d2433;
7281−
7282−/** @type {*} */
7283−Object.d2434;
7284−
7285−/** @type {*} */
7286−Object.d2435;
7287−
7288−/** @type {*} */
7289−Object.d2436;
7290−
7291−/** @type {*} */
7292−Object.d2437;
7293−
7294−/** @type {*} */
7295−Object.d2438;
7296−
7297−/** @type {*} */
7298−Object.d2439;
7299−
7300−/** @type {*} */
7301−Object.d2440;
7302−
7303−/** @type {*} */
7304−Object.d2441;
7305−
7306−/** @type {*} */
7307−Object.d2442;
7308−
7309−/** @type {*} */
7310−Object.d2443;
7311−
7312−/** @type {*} */
7313−Object.d2444;
7314−
7315−/** @type {*} */
7316−Object.d2445;
7317−
7318−/** @type {*} */
7319−Object.d2446;
7320−
7321−/** @type {*} */
7322−Object.d2447;
7323−
7324−/** @type {*} */
7325−Object.d2448;
7326−
7327−/** @type {*} */
7328−Object.d2449;
7329−
7330−/** @type {*} */
7331−Object.d2450;
7332−
7333−/** @type {*} */
7334−Object.d2451;
7335−
7336−/** @type {*} */
7337−Object.d2452;
7338−
7339−/** @type {*} */
7340−Object.d2453;
7341−
7342−/** @type {*} */
7343−Object.d2454;
7344−
7345−/** @type {*} */
7346−Object.d2455;
7347−
7348−/** @type {*} */
7349−Object.d2456;
7350−
7351−/** @type {*} */
7352−Object.d2457;
7353−
7354−/** @type {*} */
7355−Object.d2458;
7356−
7357−/** @type {*} */
7358−Object.d2459;
7359−
7360−/** @type {*} */
7361−Object.d2460;
7362−
7363−/** @type {*} */
7364−Object.d2461;
7365−
7366−/** @type {*} */
7367−Object.d2462;
7368−
7369−/** @type {*} */
7370−Object.d2463;
7371−
7372−/** @type {*} */
7373−Object.d2464;
7374−
7375−/** @type {*} */
7376−Object.d2465;
7377−
7378−/** @type {*} */
7379−Object.d2466;
7380−
7381−/** @type {*} */
7382−Object.d2467;
7383−
7384−/** @type {*} */
7385−Object.d2468;
7386−
7387−/** @type {*} */
7388−Object.d2469;
7389−
7390−/** @type {*} */
7391−Object.d2470;
7392−
7393−/** @type {*} */
7394−Object.d2471;
7395−
7396−/** @type {*} */
7397−Object.d2472;
7398−
7399−/** @type {*} */
7400−Object.d2473;
7401−
7402−/** @type {*} */
7403−Object.d2474;
7404−
7405−/** @type {*} */
7406−Object.d2475;
7407−
7408−/** @type {*} */
7409−Object.d2476;
7410−
7411−/** @type {*} */
7412−Object.d2477;
7413−
7414−/** @type {*} */
7415−Object.d2478;
7416−
7417−/** @type {*} */
7418−Object.d2479;
7419−
7420−/** @type {*} */
7421−Object.d2480;
7422−
7423−/** @type {*} */
7424−Object.d2481;
7425−
7426−/** @type {*} */
7427−Object.d2482;
7428−
7429−/** @type {*} */
7430−Object.d2483;
7431−
7432−/** @type {*} */
7433−Object.d2484;
7434−
7435−/** @type {*} */
7436−Object.d2485;
7437−
7438−/** @type {*} */
7439−Object.d2486;
7440−
7441−/** @type {*} */
7442−Object.d2487;
7443−
7444−/** @type {*} */
7445−Object.d2488;
7446−
7447−/** @type {*} */
7448−Object.d2489;
7449−
7450−/** @type {*} */
7451−Object.d2490;
7452−
7453−/** @type {*} */
7454−Object.d2491;
7455−
7456−/** @type {*} */
7457−Object.d2492;
7458−
7459−/** @type {*} */
7460−Object.d2493;
7461−
7462−/** @type {*} */
7463−Object.d2494;
7464−
7465−/** @type {*} */
7466−Object.d2495;
7467−
7468−/** @type {*} */
7469−Object.d2496;
7470−
7471−/** @type {*} */
7472−Object.d2497;
7473−
7474−/** @type {*} */
7475−Object.d2498;
7476−
7477−/** @type {*} */
7478−Object.d2499;
7479−
7480−/** @type {*} */
7481−Object.d2500;
7482−
7483−/** @type {*} */
7484−Object.d2501;
7485−
7486−/** @type {*} */
7487−Object.d2502;
7488−
7489−/** @type {*} */
7490−Object.d2503;
7491−
7492−/** @type {*} */
7493−Object.d2504;
7494−
7495−/** @type {*} */
7496−Object.d2505;
7497−
7498−/** @type {*} */
7499−Object.d2506;
7500−
7501−/** @type {*} */
7502−Object.d2507;
7503−
7504−/** @type {*} */
7505−Object.d2508;
7506−
7507−/** @type {*} */
7508−Object.d2509;
7509−
7510−/** @type {*} */
7511−Object.d2510;
7512−
7513−/** @type {*} */
7514−Object.d2511;
7515−
7516−/** @type {*} */
7517−Object.d2512;
7518−
7519−/** @type {*} */
7520−Object.d2513;
7521−
7522−/** @type {*} */
7523−Object.d2514;
7524−
7525−/** @type {*} */
7526−Object.d2515;
7527−
7528−/** @type {*} */
7529−Object.d2516;
7530−
7531−/** @type {*} */
7532−Object.d2517;
7533−
7534−/** @type {*} */
7535−Object.d2518;
7536−
7537−/** @type {*} */
7538−Object.d2519;
7539−
7540−/** @type {*} */
7541−Object.d2520;
7542−
7543−/** @type {*} */
7544−Object.d2521;
7545−
7546−/** @type {*} */
7547−Object.d2522;
7548−
7549−/** @type {*} */
7550−Object.d2523;
7551−
7552−/** @type {*} */
7553−Object.d2524;
7554−
7555−/** @type {*} */
7556−Object.d2525;
7557−
7558−/** @type {*} */
7559−Object.d2526;
7560−
7561−/** @type {*} */
7562−Object.d2527;
7563−
7564−/** @type {*} */
7565−Object.d2528;
7566−
7567−/** @type {*} */
7568−Object.d2529;
7569−
7570−/** @type {*} */
7571−Object.d2530;
7572−
7573−/** @type {*} */
7574−Object.d2531;
7575−
7576−/** @type {*} */
7577−Object.d2532;
7578−
7579−/** @type {*} */
7580−Object.d2533;
7581−
7582−/** @type {*} */
7583−Object.d2534;
7584−
7585−/** @type {*} */
7586−Object.d2535;
7587−
7588−/** @type {*} */
7589−Object.d2536;
7590−
7591−/** @type {*} */
7592−Object.d2537;
7593−
7594−/** @type {*} */
7595−Object.d2538;
7596−
7597−/** @type {*} */
7598−Object.d2539;
7599−
7600−/** @type {*} */
7601−Object.d2540;
7602−
7603−/** @type {*} */
7604−Object.d2541;
7605−
7606−/** @type {*} */
7607−Object.d2542;
7608−
7609−/** @type {*} */
7610−Object.d2543;
7611−
7612−/** @type {*} */
7613−Object.d2544;
7614−
7615−/** @type {*} */
7616−Object.d2545;
7617−
7618−/** @type {*} */
7619−Object.d2546;
7620−
7621−/** @type {*} */
7622−Object.d2547;
7623−
7624−/** @type {*} */
7625−Object.d2548;
7626−
7627−/** @type {*} */
7628−Object.d2549;
7629−
7630−/** @type {*} */
7631−Object.d2550;
7632−
7633−/** @type {*} */
7634−Object.d2551;
7635−
7636−/** @type {*} */
7637−Object.d2552;
7638−
7639−/** @type {*} */
7640−Object.d2553;
7641−
7642−/** @type {*} */
7643−Object.d2554;
7644−
7645−/** @type {*} */
7646−Object.d2555;
7647−
7648−/** @type {*} */
7649−Object.d2556;
7650−
7651−/** @type {*} */
7652−Object.d2557;
7653−
7654−/** @type {*} */
7655−Object.d2558;
7656−
7657−/** @type {*} */
7658−Object.d2559;
7659−
7660−/** @type {*} */
7661−Object.d2560;
7662−
7663−/** @type {*} */
7664−Object.d2561;
7665−
7666−/** @type {*} */
7667−Object.d2562;
7668−
7669−/** @type {*} */
7670−Object.d2563;
7671−
7672−/** @type {*} */
7673−Object.d2564;
7674−
7675−/** @type {*} */
7676−Object.d2565;
7677−
7678−/** @type {*} */
7679−Object.d2566;
7680−
7681−/** @type {*} */
7682−Object.d2567;
7683−
7684−/** @type {*} */
7685−Object.d2568;
7686−
7687−/** @type {*} */
7688−Object.d2569;
7689−
7690−/** @type {*} */
7691−Object.d2570;
7692−
7693−/** @type {*} */
7694−Object.d2571;
7695−
7696−/** @type {*} */
7697−Object.d2572;
7698−
7699−/** @type {*} */
7700−Object.d2573;
7701−
7702−/** @type {*} */
7703−Object.d2574;
7704−
7705−/** @type {*} */
7706−Object.d2575;
7707−
7708−/** @type {*} */
7709−Object.d2576;
7710−
7711−/** @type {*} */
7712−Object.d2577;
7713−
7714−/** @type {*} */
7715−Object.d2578;
7716−
7717−/** @type {*} */
7718−Object.d2579;
7719−
7720−/** @type {*} */
7721−Object.d2580;
7722−
7723−/** @type {*} */
7724−Object.d2581;
7725−
7726−/** @type {*} */
7727−Object.d2582;
7728−
7729−/** @type {*} */
7730−Object.d2583;
7731−
7732−/** @type {*} */
7733−Object.d2584;
7734−
7735−/** @type {*} */
7736−Object.d2585;
7737−
7738−/** @type {*} */
7739−Object.d2586;
7740−
7741−/** @type {*} */
7742−Object.d2587;
7743−
7744−/** @type {*} */
7745−Object.d2588;
7746−
7747−/** @type {*} */
7748−Object.d2589;
7749−
7750−/** @type {*} */
7751−Object.d2590;
7752−
7753−/** @type {*} */
7754−Object.d2591;
7755−
7756−/** @type {*} */
7757−Object.d2592;
7758−
7759−/** @type {*} */
7760−Object.d2593;
7761−
7762−/** @type {*} */
7763−Object.d2594;
7764−
7765−/** @type {*} */
7766−Object.d2595;
7767−
7768−/** @type {*} */
7769−Object.d2596;
7770−
7771−/** @type {*} */
7772−Object.d2597;
7773−
7774−/** @type {*} */
7775−Object.d2598;
7776−
7777−/** @type {*} */
7778−Object.d2599;
7779−
7780−/** @type {*} */
7781−Object.d2600;
7782−
7783−/** @type {*} */
7784−Object.d2601;
7785−
7786−/** @type {*} */
7787−Object.d2602;
7788−
7789−/** @type {*} */
7790−Object.d2603;
7791−
7792−/** @type {*} */
7793−Object.d2604;
7794−
7795−/** @type {*} */
7796−Object.d2605;
7797−
7798−/** @type {*} */
7799−Object.d2606;
7800−
7801−/** @type {*} */
7802−Object.d2607;
7803−
7804−/** @type {*} */
7805−Object.d2608;
7806−
7807−/** @type {*} */
7808−Object.d2609;
7809−
7810−/** @type {*} */
7811−Object.d2610;
7812−
7813−/** @type {*} */
7814−Object.d2611;
7815−
7816−/** @type {*} */
7817−Object.d2612;
7818−
7819−/** @type {*} */
7820−Object.d2613;
7821−
7822−/** @type {*} */
7823−Object.d2614;
7824−
7825−/** @type {*} */
7826−Object.d2615;
7827−
7828−/** @type {*} */
7829−Object.d2616;
7830−
7831−/** @type {*} */
7832−Object.d2617;
7833−
7834−/** @type {*} */
7835−Object.d2618;
7836−
7837−/** @type {*} */
7838−Object.d2619;
7839−
7840−/** @type {*} */
7841−Object.d2620;
7842−
7843−/** @type {*} */
7844−Object.d2621;
7845−
7846−/** @type {*} */
7847−Object.d2622;
7848−
7849−/** @type {*} */
7850−Object.d2623;
7851−
7852−/** @type {*} */
7853−Object.d2624;
7854−
7855−/** @type {*} */
7856−Object.d2625;
7857−
7858−/** @type {*} */
7859−Object.d2626;
7860−
7861−/** @type {*} */
7862−Object.d2627;
7863−
7864−/** @type {*} */
7865−Object.d2628;
7866−
7867−/** @type {*} */
7868−Object.d2629;
7869−
7870−/** @type {*} */
7871−Object.d2630;
7872−
7873−/** @type {*} */
7874−Object.d2631;
7875−
7876−/** @type {*} */
7877−Object.d2632;
7878−
7879−/** @type {*} */
7880−Object.d2633;
7881−
7882−/** @type {*} */
7883−Object.d2634;
7884−
7885−/** @type {*} */
7886−Object.d2635;
7887−
7888−/** @type {*} */
7889−Object.d2636;
7890−
7891−/** @type {*} */
7892−Object.d2637;
7893−
7894−/** @type {*} */
7895−Object.d2638;
7896−
7897−/** @type {*} */
7898−Object.d2639;
7899−
7900−/** @type {*} */
7901−Object.d2640;
7902−
7903−/** @type {*} */
7904−Object.d2641;
7905−
7906−/** @type {*} */
7907−Object.d2642;
7908−
7909−/** @type {*} */
7910−Object.d2643;
7911−
7912−/** @type {*} */
7913−Object.d2644;
7914−
7915−/** @type {*} */
7916−Object.d2645;
7917−
7918−/** @type {*} */
7919−Object.d2646;
7920−
7921−/** @type {*} */
7922−Object.d2647;
7923−
7924−/** @type {*} */
7925−Object.d2648;
7926−
7927−/** @type {*} */
7928−Object.d2649;
7929−
7930−/** @type {*} */
7931−Object.d2650;
7932−
7933−/** @type {*} */
7934−Object.d2651;
7935−
7936−/** @type {*} */
7937−Object.d2652;
7938−
7939−/** @type {*} */
7940−Object.d2653;
7941−
7942−/** @type {*} */
7943−Object.d2654;
7944−
7945−/** @type {*} */
7946−Object.d2655;
7947−
7948−/** @type {*} */
7949−Object.d2656;
7950−
7951−/** @type {*} */
7952−Object.d2657;
7953−
7954−/** @type {*} */
7955−Object.d2658;
7956−
7957−/** @type {*} */
7958−Object.d2659;
7959−
7960−/** @type {*} */
7961−Object.d2660;
7962−
7963−/** @type {*} */
7964−Object.d2661;
7965−
7966−/** @type {*} */
7967−Object.d2662;
7968−
7969−/** @type {*} */
7970−Object.d2663;
7971−
7972−/** @type {*} */
7973−Object.d2664;
7974−
7975−/** @type {*} */
7976−Object.d2665;
7977−
7978−/** @type {*} */
7979−Object.d2666;
7980−
7981−/** @type {*} */
7982−Object.d2667;
7983−
7984−/** @type {*} */
7985−Object.d2668;
7986−
7987−/** @type {*} */
7988−Object.d2669;
7989−
7990−/** @type {*} */
7991−Object.d2670;
7992−
7993−/** @type {*} */
7994−Object.d2671;
7995−
7996−/** @type {*} */
7997−Object.d2672;
7998−
7999−/** @type {*} */
8000−Object.d2673;
8001−
8002−/** @type {*} */
8003−Object.d2674;
8004−
8005−/** @type {*} */
8006−Object.d2675;
8007−
8008−/** @type {*} */
8009−Object.d2676;
8010−
8011−/** @type {*} */
8012−Object.d2677;
8013−
8014−/** @type {*} */
8015−Object.d2678;
8016−
8017−/** @type {*} */
8018−Object.d2679;
8019−
8020−/** @type {*} */
8021−Object.d2680;
8022−
8023−/** @type {*} */
8024−Object.d2681;
8025−
8026−/** @type {*} */
8027−Object.d2682;
8028−
8029−/** @type {*} */
8030−Object.d2683;
8031−
8032−/** @type {*} */
8033−Object.d2684;
8034−
8035−/** @type {*} */
8036−Object.d2685;
8037−
8038−/** @type {*} */
8039−Object.d2686;
8040−
8041−/** @type {*} */
8042−Object.d2687;
8043−
8044−/** @type {*} */
8045−Object.d2688;
8046−
8047−/** @type {*} */
8048−Object.d2689;
8049−
8050−/** @type {*} */
8051−Object.d2690;
8052−
8053−/** @type {*} */
8054−Object.d2691;
8055−
8056−/** @type {*} */
8057−Object.d2692;
8058−
8059−/** @type {*} */
8060−Object.d2693;
8061−
8062−/** @type {*} */
8063−Object.d2694;
8064−
8065−/** @type {*} */
8066−Object.d2695;
8067−
8068−/** @type {*} */
8069−Object.d2696;
8070−
8071−/** @type {*} */
8072−Object.d2697;
8073−
8074−/** @type {*} */
8075−Object.d2698;
8076−
8077−/** @type {*} */
8078−Object.d2699;
8079−
8080−/** @type {*} */
8081−Object.d2700;
8082−
8083−/** @type {*} */
8084−Object.d2701;
8085−
8086−/** @type {*} */
8087−Object.d2702;
8088−
8089−/** @type {*} */
8090−Object.d2703;
8091−
8092−/** @type {*} */
8093−Object.d2704;
8094−
8095−/** @type {*} */
8096−Object.d2705;
8097−
8098−/** @type {*} */
8099−Object.d2706;
8100−
8101−/** @type {*} */
8102−Object.d2707;
8103−
8104−/** @type {*} */
8105−Object.d2708;
8106−
8107−/** @type {*} */
8108−Object.d2709;
8109−
8110−/** @type {*} */
8111−Object.d2710;
8112−
8113−/** @type {*} */
8114−Object.d2711;
8115−
8116−/** @type {*} */
8117−Object.d2712;
8118−
8119−/** @type {*} */
8120−Object.d2713;
8121−
8122−/** @type {*} */
8123−Object.d2714;
8124−
8125−/** @type {*} */
8126−Object.d2715;
8127−
8128−/** @type {*} */
8129−Object.d2716;
8130−
8131−/** @type {*} */
8132−Object.d2717;
8133−
8134−/** @type {*} */
8135−Object.d2718;
8136−
8137−/** @type {*} */
8138−Object.d2719;
8139−
8140−/** @type {*} */
8141−Object.d2720;
8142−
8143−/** @type {*} */
8144−Object.d2721;
8145−
8146−/** @type {*} */
8147−Object.d2722;
8148−
8149−/** @type {*} */
8150−Object.d2723;
8151−
8152−/** @type {*} */
8153−Object.d2724;
8154−
8155−/** @type {*} */
8156−Object.d2725;
8157−
8158−/** @type {*} */
8159−Object.d2726;
8160−
8161−/** @type {*} */
8162−Object.d2727;
8163−
8164−/** @type {*} */
8165−Object.d2728;
8166−
8167−/** @type {*} */
8168−Object.d2729;
8169−
8170−/** @type {*} */
8171−Object.d2730;
8172−
8173−/** @type {*} */
8174−Object.d2731;
8175−
8176−/** @type {*} */
8177−Object.d2732;
8178−
8179−/** @type {*} */
8180−Object.d2733;
8181−
8182−/** @type {*} */
8183−Object.d2734;
8184−
8185−/** @type {*} */
8186−Object.d2735;
8187−
8188−/** @type {*} */
8189−Object.d2736;
8190−
8191−/** @type {*} */
8192−Object.d2737;
8193−
8194−/** @type {*} */
8195−Object.d2738;
8196−
8197−/** @type {*} */
8198−Object.d2739;
8199−
8200−/** @type {*} */
8201−Object.d2740;
8202−
8203−/** @type {*} */
8204−Object.d2741;
8205−
8206−/** @type {*} */
8207−Object.d2742;
8208−
8209−/** @type {*} */
8210−Object.d2743;
8211−
8212−/** @type {*} */
8213−Object.d2744;
8214−
8215−/** @type {*} */
8216−Object.d2745;
8217−
8218−/** @type {*} */
8219−Object.d2746;
8220−
8221−/** @type {*} */
8222−Object.d2747;
8223−
8224−/** @type {*} */
8225−Object.d2748;
8226−
8227−/** @type {*} */
8228−Object.d2749;
8229−
8230−/** @type {*} */
8231−Object.d2750;
8232−
8233−/** @type {*} */
8234−Object.d2751;
8235−
8236−/** @type {*} */
8237−Object.d2752;
8238−
8239−/** @type {*} */
8240−Object.d2753;
8241−
8242−/** @type {*} */
8243−Object.d2754;
8244−
8245−/** @type {*} */
8246−Object.d2755;
8247−
8248−/** @type {*} */
8249−Object.d2756;
8250−
8251−/** @type {*} */
8252−Object.d2757;
8253−
8254−/** @type {*} */
8255−Object.d2758;
8256−
8257−/** @type {*} */
8258−Object.d2759;
8259−
8260−/** @type {*} */
8261−Object.d2760;
8262−
8263−/** @type {*} */
8264−Object.d2761;
8265−
8266−/** @type {*} */
8267−Object.d2762;
8268−
8269−/** @type {*} */
8270−Object.d2763;
8271−
8272−/** @type {*} */
8273−Object.d2764;
8274−
8275−/** @type {*} */
8276−Object.d2765;
8277−
8278−/** @type {*} */
8279−Object.d2766;
8280−
8281−/** @type {*} */
8282−Object.d2767;
8283−
8284−/** @type {*} */
8285−Object.d2768;
8286−
8287−/** @type {*} */
8288−Object.d2769;
8289−
8290−/** @type {*} */
8291−Object.d2770;
8292−
8293−/** @type {*} */
8294−Object.d2771;
8295−
8296−/** @type {*} */
8297−Object.d2772;
8298−
8299−/** @type {*} */
8300−Object.d2773;
8301−
8302−/** @type {*} */
8303−Object.d2774;
8304−
8305−/** @type {*} */
8306−Object.d2775;
8307−
8308−/** @type {*} */
8309−Object.d2776;
8310−
8311−/** @type {*} */
8312−Object.d2777;
8313−
8314−/** @type {*} */
8315−Object.d2778;
8316−
8317−/** @type {*} */
8318−Object.d2779;
8319−
8320−/** @type {*} */
8321−Object.d2780;
8322−
8323−/** @type {*} */
8324−Object.d2781;
8325−
8326−/** @type {*} */
8327−Object.d2782;
8328−
8329−/** @type {*} */
8330−Object.d2783;
8331−
8332−/** @type {*} */
8333−Object.d2784;
8334−
8335−/** @type {*} */
8336−Object.d2785;
8337−
8338−/** @type {*} */
8339−Object.d2786;
8340−
8341−/** @type {*} */
8342−Object.d2787;
8343−
8344−/** @type {*} */
8345−Object.d2788;
8346−
8347−/** @type {*} */
8348−Object.d2789;
8349−
8350−/** @type {*} */
8351−Object.d2790;
8352−
8353−/** @type {*} */
8354−Object.d2791;
8355−
8356−/** @type {*} */
8357−Object.d2792;
8358−
8359−/** @type {*} */
8360−Object.d2793;
8361−
8362−/** @type {*} */
8363−Object.d2794;
8364−
8365−/** @type {*} */
8366−Object.d2795;
8367−
8368−/** @type {*} */
8369−Object.d2796;
8370−
8371−/** @type {*} */
8372−Object.d2797;
8373−
8374−/** @type {*} */
8375−Object.d2798;
8376−
8377−/** @type {*} */
8378−Object.d2799;
8379−
8380−/** @type {*} */
8381−Object.d2800;
8382−
8383−/** @type {*} */
8384−Object.d2801;
8385−
8386−/** @type {*} */
8387−Object.d2802;
8388−
8389−/** @type {*} */
8390−Object.d2803;
8391−
8392−/** @type {*} */
8393−Object.d2804;
8394−
8395−/** @type {*} */
8396−Object.d2805;
8397−
8398−/** @type {*} */
8399−Object.d2806;
8400−
8401−/** @type {*} */
8402−Object.d2807;
8403−
8404−/** @type {*} */
8405−Object.d2808;
8406−
8407−/** @type {*} */
8408−Object.d2809;
8409−
8410−/** @type {*} */
8411−Object.d2810;
8412−
8413−/** @type {*} */
8414−Object.d2811;
8415−
8416−/** @type {*} */
8417−Object.d2812;
8418−
8419−/** @type {*} */
8420−Object.d2813;
8421−
8422−/** @type {*} */
8423−Object.d2814;
8424−
8425−/** @type {*} */
8426−Object.d2815;
8427−
8428−/** @type {*} */
8429−Object.d2816;
8430−
8431−/** @type {*} */
8432−Object.d2817;
8433−
8434−/** @type {*} */
8435−Object.d2818;
8436−
8437−/** @type {*} */
8438−Object.d2819;
8439−
8440−/** @type {*} */
8441−Object.d2820;
8442−
8443−/** @type {*} */
8444−Object.d2821;
8445−
8446−/** @type {*} */
8447−Object.d2822;
8448−
8449−/** @type {*} */
8450−Object.d2823;
8451−
8452−/** @type {*} */
8453−Object.d2824;
8454−
8455−/** @type {*} */
8456−Object.d2825;
8457−
8458−/** @type {*} */
8459−Object.d2826;
8460−
8461−/** @type {*} */
8462−Object.d2827;
8463−
8464−/** @type {*} */
8465−Object.d2828;
8466−
8467−/** @type {*} */
8468−Object.d2829;
8469−
8470−/** @type {*} */
8471−Object.d2830;
8472−
8473−/** @type {*} */
8474−Object.d2831;
8475−
8476−/** @type {*} */
8477−Object.d2832;
8478−
8479−/** @type {*} */
8480−Object.d2833;
8481−
8482−/** @type {*} */
8483−Object.d2834;
8484−
8485−/** @type {*} */
8486−Object.d2835;
8487−
8488−/** @type {*} */
8489−Object.d2836;
8490−
8491−/** @type {*} */
8492−Object.d2837;
8493−
8494−/** @type {*} */
8495−Object.d2838;
8496−
8497−/** @type {*} */
8498−Object.d2839;
8499−
8500−/** @type {*} */
8501−Object.d2840;
8502−
8503−/** @type {*} */
8504−Object.d2841;
8505−
8506−/** @type {*} */
8507−Object.d2842;
8508−
8509−/** @type {*} */
8510−Object.d2843;
8511−
8512−/** @type {*} */
8513−Object.d2844;
8514−
8515−/** @type {*} */
8516−Object.d2845;
8517−
8518−/** @type {*} */
8519−Object.d2846;
8520−
8521−/** @type {*} */
8522−Object.d2847;
8523−
8524−/** @type {*} */
8525−Object.d2848;
8526−
8527−/** @type {*} */
8528−Object.d2849;
8529−
8530−/** @type {*} */
8531−Object.d2850;
8532−
8533−/** @type {*} */
8534−Object.d2851;
8535−
8536−/** @type {*} */
8537−Object.d2852;
8538−
8539−/** @type {*} */
8540−Object.d2853;
8541−
8542−/** @type {*} */
8543−Object.d2854;
8544−
8545−/** @type {*} */
8546−Object.d2855;
8547−
8548−/** @type {*} */
8549−Object.d2856;
8550−
8551−/** @type {*} */
8552−Object.d2857;
8553−
8554−/** @type {*} */
8555−Object.d2858;
8556−
8557−/** @type {*} */
8558−Object.d2859;
8559−
8560−/** @type {*} */
8561−Object.d2860;
8562−
8563−/** @type {*} */
8564−Object.d2861;
8565−
8566−/** @type {*} */
8567−Object.d2862;
8568−
8569−/** @type {*} */
8570−Object.d2863;
8571−
8572−/** @type {*} */
8573−Object.d2864;
8574−
8575−/** @type {*} */
8576−Object.d2865;
8577−
8578−/** @type {*} */
8579−Object.d2866;
8580−
8581−/** @type {*} */
8582−Object.d2867;
8583−
8584−/** @type {*} */
8585−Object.d2868;
8586−
8587−/** @type {*} */
8588−Object.d2869;
8589−
8590−/** @type {*} */
8591−Object.d2870;
8592−
8593−/** @type {*} */
8594−Object.d2871;
8595−
8596−/** @type {*} */
8597−Object.d2872;
8598−
8599−/** @type {*} */
8600−Object.d2873;
8601−
8602−/** @type {*} */
8603−Object.d2874;
8604−
8605−/** @type {*} */
8606−Object.d2875;
8607−
8608−/** @type {*} */
8609−Object.d2876;
8610−
8611−/** @type {*} */
8612−Object.d2877;
8613−
8614−/** @type {*} */
8615−Object.d2878;
8616−
8617−/** @type {*} */
8618−Object.d2879;
8619−
8620−/** @type {*} */
8621−Object.d2880;
8622−
8623−/** @type {*} */
8624−Object.d2881;
8625−
8626−/** @type {*} */
8627−Object.d2882;
8628−
8629−/** @type {*} */
8630−Object.d2883;
8631−
8632−/** @type {*} */
8633−Object.d2884;
8634−
8635−/** @type {*} */
8636−Object.d2885;
8637−
8638−/** @type {*} */
8639−Object.d2886;
8640−
8641−/** @type {*} */
8642−Object.d2887;
8643−
8644−/** @type {*} */
8645−Object.d2888;
8646−
8647−/** @type {*} */
8648−Object.d2889;
8649−
8650−/** @type {*} */
8651−Object.d2890;
8652−
8653−/** @type {*} */
8654−Object.d2891;
8655−
8656−/** @type {*} */
8657−Object.d2892;
8658−
8659−/** @type {*} */
8660−Object.d2893;
8661−
8662−/** @type {*} */
8663−Object.d2894;
8664−
8665−/** @type {*} */
8666−Object.d2895;
8667−
8668−/** @type {*} */
8669−Object.d2896;
8670−
8671−/** @type {*} */
8672−Object.d2897;
8673−
8674−/** @type {*} */
8675−Object.d2898;
8676−
8677−/** @type {*} */
8678−Object.d2899;
8679−
8680−/** @type {*} */
8681−Object.d2900;
8682−
8683−/** @type {*} */
8684−Object.d2901;
8685−
8686−/** @type {*} */
8687−Object.d2902;
8688−
8689−/** @type {*} */
8690−Object.d2903;
8691−
8692−/** @type {*} */
8693−Object.d2904;
8694−
8695−/** @type {*} */
8696−Object.d2905;
8697−
8698−/** @type {*} */
8699−Object.d2906;
8700−
8701−/** @type {*} */
8702−Object.d2907;
8703−
8704−/** @type {*} */
8705−Object.d2908;
8706−
8707−/** @type {*} */
8708−Object.d2909;
8709−
8710−/** @type {*} */
8711−Object.d2910;
8712−
8713−/** @type {*} */
8714−Object.d2911;
8715−
8716−/** @type {*} */
8717−Object.d2912;
8718−
8719−/** @type {*} */
8720−Object.d2913;
8721−
8722−/** @type {*} */
8723−Object.d2914;
8724−
8725−/** @type {*} */
8726−Object.d2915;
8727−
8728−/** @type {*} */
8729−Object.d2916;
8730−
8731−/** @type {*} */
8732−Object.d2917;
8733−
8734−/** @type {*} */
8735−Object.d2918;
8736−
8737−/** @type {*} */
8738−Object.d2919;
8739−
8740−/** @type {*} */
8741−Object.d2920;
8742−
8743−/** @type {*} */
8744−Object.d2921;
8745−
8746−/** @type {*} */
8747−Object.d2922;
8748−
8749−/** @type {*} */
8750−Object.d2923;
8751−
8752−/** @type {*} */
8753−Object.d2924;
8754−
8755−/** @type {*} */
8756−Object.d2925;
8757−
8758−/** @type {*} */
8759−Object.d2926;
8760−
8761−/** @type {*} */
8762−Object.d2927;
8763−
8764−/** @type {*} */
8765−Object.d2928;
8766−
8767−/** @type {*} */
8768−Object.d2929;
8769−
8770−/** @type {*} */
8771−Object.d2930;
8772−
8773−/** @type {*} */
8774−Object.d2931;
8775−
8776−/** @type {*} */
8777−Object.d2932;
8778−
8779−/** @type {*} */
8780−Object.d2933;
8781−
8782−/** @type {*} */
8783−Object.d2934;
8784−
8785−/** @type {*} */
8786−Object.d2935;
8787−
8788−/** @type {*} */
8789−Object.d2936;
8790−
8791−/** @type {*} */
8792−Object.d2937;
8793−
8794−/** @type {*} */
8795−Object.d2938;
8796−
8797−/** @type {*} */
8798−Object.d2939;
8799−
8800−/** @type {*} */
8801−Object.d2940;
8802−
8803−/** @type {*} */
8804−Object.d2941;
8805−
8806−/** @type {*} */
8807−Object.d2942;
8808−
8809−/** @type {*} */
8810−Object.d2943;
8811−
8812−/** @type {*} */
8813−Object.d2944;
8814−
8815−/** @type {*} */
8816−Object.d2945;
8817−
8818−/** @type {*} */
8819−Object.d2946;
8820−
8821−/** @type {*} */
8822−Object.d2947;
8823−
8824−/** @type {*} */
8825−Object.d2948;
8826−
8827−/** @type {*} */
8828−Object.d2949;
8829−
8830−/** @type {*} */
8831−Object.d2950;
8832−
8833−/** @type {*} */
8834−Object.d2951;
8835−
8836−/** @type {*} */
8837−Object.d2952;
8838−
8839−/** @type {*} */
8840−Object.d2953;
8841−
8842−/** @type {*} */
8843−Object.d2954;
8844−
8845−/** @type {*} */
8846−Object.d2955;
8847−
8848−/** @type {*} */
8849−Object.d2956;
8850−
8851−/** @type {*} */
8852−Object.d2957;
8853−
8854−/** @type {*} */
8855−Object.d2958;
8856−
8857−/** @type {*} */
8858−Object.d2959;
8859−
8860−/** @type {*} */
8861−Object.d2960;
8862−
8863−/** @type {*} */
8864−Object.d2961;
8865−
8866−/** @type {*} */
8867−Object.d2962;
8868−
8869−/** @type {*} */
8870−Object.d2963;
8871−
8872−/** @type {*} */
8873−Object.d2964;
8874−
8875−/** @type {*} */
8876−Object.d2965;
8877−
8878−/** @type {*} */
8879−Object.d2966;
8880−
8881−/** @type {*} */
8882−Object.d2967;
8883−
8884−/** @type {*} */
8885−Object.d2968;
8886−
8887−/** @type {*} */
8888−Object.d2969;
8889−
8890−/** @type {*} */
8891−Object.d2970;
8892−
8893−/** @type {*} */
8894−Object.d2971;
8895−
8896−/** @type {*} */
8897−Object.d2972;
8898−
8899−/** @type {*} */
8900−Object.d2973;
8901−
8902−/** @type {*} */
8903−Object.d2974;
8904−
8905−/** @type {*} */
8906−Object.d2975;
8907−
8908−/** @type {*} */
8909−Object.d2976;
8910−
8911−/** @type {*} */
8912−Object.d2977;
8913−
8914−/** @type {*} */
8915−Object.d2978;
8916−
8917−/** @type {*} */
8918−Object.d2979;
8919−
8920−/** @type {*} */
8921−Object.d2980;
8922−
8923−/** @type {*} */
8924−Object.d2981;
8925−
8926−/** @type {*} */
8927−Object.d2982;
8928−
8929−/** @type {*} */
8930−Object.d2983;
8931−
8932−/** @type {*} */
8933−Object.d2984;
8934−
8935−/** @type {*} */
8936−Object.d2985;
8937−
8938−/** @type {*} */
8939−Object.d2986;
8940−
8941−/** @type {*} */
8942−Object.d2987;
8943−
8944−/** @type {*} */
8945−Object.d2988;
8946−
8947−/** @type {*} */
8948−Object.d2989;
8949−
8950−/** @type {*} */
8951−Object.d2990;
8952−
8953−/** @type {*} */
8954−Object.d2991;
8955−
8956−/** @type {*} */
8957−Object.d2992;
8958−
8959−/** @type {*} */
8960−Object.d2993;
8961−
8962−/** @type {*} */
8963−Object.d2994;
8964−
8965−/** @type {*} */
8966−Object.d2995;
8967−
8968−/** @type {*} */
8969−Object.d2996;
8970−
8971−/** @type {*} */
8972−Object.d2997;
8973−
8974−/** @type {*} */
8975−Object.d2998;
8976−
8977−/** @type {*} */
8978−Object.d2999;
8979−
8980−/** @type {*} */
8981−Object.d3000;
8982−
8983−/** @type {*} */
8984−Object.d3001;
8985−
8986−/** @type {*} */
8987−Object.d3002;
8988−
8989−/** @type {*} */
8990−Object.d3003;
8991−
8992−/** @type {*} */
8993−Object.d3004;
8994−
8995−/** @type {*} */
8996−Object.d3005;
8997−
8998−/** @type {*} */
8999−Object.d3006;
9000−
9001−/** @type {*} */
9002−Object.d3007;
9003−
9004−/** @type {*} */
9005−Object.d3008;
9006−
9007−/** @type {*} */
9008−Object.d3009;
9009−
9010−/** @type {*} */
9011−Object.d3010;
9012−
9013−/** @type {*} */
9014−Object.d3011;
9015−
9016−/** @type {*} */
9017−Object.d3012;
9018−
9019−/** @type {*} */
9020−Object.d3013;
9021−
9022−/** @type {*} */
9023−Object.d3014;
9024−
9025−/** @type {*} */
9026−Object.d3015;
9027−
9028−/** @type {*} */
9029−Object.d3016;
9030−
9031−/** @type {*} */
9032−Object.d3017;
9033−
9034−/** @type {*} */
9035−Object.d3018;
9036−
9037−/** @type {*} */
9038−Object.d3019;
9039−
9040−/** @type {*} */
9041−Object.d3020;
9042−
9043−/** @type {*} */
9044−Object.d3021;
9045−
9046−/** @type {*} */
9047−Object.d3022;
9048−
9049−/** @type {*} */
9050−Object.d3023;
9051−
9052−/** @type {*} */
9053−Object.d3024;
9054−
9055−/** @type {*} */
9056−Object.d3025;
9057−
9058−/** @type {*} */
9059−Object.d3026;
9060−
9061−/** @type {*} */
9062−Object.d3027;
9063−
9064−/** @type {*} */
9065−Object.d3028;
9066−
9067−/** @type {*} */
9068−Object.d3029;
9069−
9070−/** @type {*} */
9071−Object.d3030;
9072−
9073−/** @type {*} */
9074−Object.d3031;
9075−
9076−/** @type {*} */
9077−Object.d3032;
9078−
9079−/** @type {*} */
9080−Object.d3033;
9081−
9082−/** @type {*} */
9083−Object.d3034;
9084−
9085−/** @type {*} */
9086−Object.d3035;
9087−
9088−/** @type {*} */
9089−Object.d3036;
9090−
9091−/** @type {*} */
9092−Object.d3037;
9093−
9094−/** @type {*} */
9095−Object.d3038;
9096−
9097−/** @type {*} */
9098−Object.d3039;
9099−
9100−/** @type {*} */
9101−Object.d3040;
9102−
9103−/** @type {*} */
9104−Object.d3041;
9105−
9106−/** @type {*} */
9107−Object.d3042;
9108−
9109−/** @type {*} */
9110−Object.d3043;
9111−
9112−/** @type {*} */
9113−Object.d3044;
9114−
9115−/** @type {*} */
9116−Object.d3045;
9117−
9118−/** @type {*} */
9119−Object.d3046;
9120−
9121−/** @type {*} */
9122−Object.d3047;
9123−
9124−/** @type {*} */
9125−Object.d3048;
9126−
9127−/** @type {*} */
9128−Object.d3049;
9129−
9130−/** @type {*} */
9131−Object.d3050;
9132−
9133−/** @type {*} */
9134−Object.d3051;
9135−
9136−/** @type {*} */
9137−Object.d3052;
9138−
9139−/** @type {*} */
9140−Object.d3053;
9141−
9142−/** @type {*} */
9143−Object.d3054;
9144−
9145−/** @type {*} */
9146−Object.d3055;
9147−
9148−/** @type {*} */
9149−Object.d3056;
9150−
9151−/** @type {*} */
9152−Object.d3057;
9153−
9154−/** @type {*} */
9155−Object.d3058;
9156−
9157−/** @type {*} */
9158−Object.d3059;
9159−
9160−/** @type {*} */
9161−Object.d3060;
9162−
9163−/** @type {*} */
9164−Object.d3061;
9165−
9166−/** @type {*} */
9167−Object.d3062;
9168−
9169−/** @type {*} */
9170−Object.d3063;
9171−
9172−/** @type {*} */
9173−Object.d3064;
9174−
9175−/** @type {*} */
9176−Object.d3065;
9177−
9178−/** @type {*} */
9179−Object.d3066;
9180−
9181−/** @type {*} */
9182−Object.d3067;
9183−
9184−/** @type {*} */
9185−Object.d3068;
9186−
9187−/** @type {*} */
9188−Object.d3069;
9189−
9190−/** @type {*} */
9191−Object.d3070;
9192−
9193−/** @type {*} */
9194−Object.d3071;
9195−
9196−/** @type {*} */
9197−Object.d3072;
9198−
9199−/** @type {*} */
9200−Object.d3073;
9201−
9202−/** @type {*} */
9203−Object.d3074;
9204−
9205−/** @type {*} */
9206−Object.d3075;
9207−
9208−/** @type {*} */
9209−Object.d3076;
9210−
9211−/** @type {*} */
9212−Object.d3077;
9213−
9214−/** @type {*} */
9215−Object.d3078;
9216−
9217−/** @type {*} */
9218−Object.d3079;
9219−
9220−/** @type {*} */
9221−Object.d3080;
9222−
9223−/** @type {*} */
9224−Object.d3081;
9225−
9226−/** @type {*} */
9227−Object.d3082;
9228−
9229−/** @type {*} */
9230−Object.d3083;
9231−
9232−/** @type {*} */
9233−Object.d3084;
9234−
9235−/** @type {*} */
9236−Object.d3085;
9237−
9238−/** @type {*} */
9239−Object.d3086;
9240−
9241−/** @type {*} */
9242−Object.d3087;
9243−
9244−/** @type {*} */
9245−Object.d3088;
9246−
9247−/** @type {*} */
9248−Object.d3089;
9249−
9250−/** @type {*} */
9251−Object.d3090;
9252−
9253−/** @type {*} */
9254−Object.d3091;
9255−
9256−/** @type {*} */
9257−Object.d3092;
9258−
9259−/** @type {*} */
9260−Object.d3093;
9261−
9262−/** @type {*} */
9263−Object.d3094;
9264−
9265−/** @type {*} */
9266−Object.d3095;
9267−
9268−/** @type {*} */
9269−Object.d3096;
9270−
9271−/** @type {*} */
9272−Object.d3097;
9273−
9274−/** @type {*} */
9275−Object.d3098;
9276−
9277−/** @type {*} */
9278−Object.d3099;
9279−
9280−/** @type {*} */
9281−Object.d3100;
9282−
9283−/** @type {*} */
9284−Object.d3101;
9285−
9286−/** @type {*} */
9287−Object.d3102;
9288−
9289−/** @type {*} */
9290−Object.d3103;
9291−
9292−/** @type {*} */
9293−Object.d3104;
9294−
9295−/** @type {*} */
9296−Object.d3105;
9297−
9298−/** @type {*} */
9299−Object.d3106;
9300−
9301−/** @type {*} */
9302−Object.d3107;
9303−
9304−/** @type {*} */
9305−Object.d3108;
9306−
9307−/** @type {*} */
9308−Object.d3109;
9309−
9310−/** @type {*} */
9311−Object.d3110;
9312−
9313−/** @type {*} */
9314−Object.d3111;
9315−
9316−/** @type {*} */
9317−Object.d3112;
9318−
9319−/** @type {*} */
9320−Object.d3113;
9321−
9322−/** @type {*} */
9323−Object.d3114;
9324−
9325−/** @type {*} */
9326−Object.d3115;
9327−
9328−/** @type {*} */
9329−Object.d3116;
9330−
9331−/** @type {*} */
9332−Object.d3117;
9333−
9334−/** @type {*} */
9335−Object.d3118;
9336−
9337−/** @type {*} */
9338−Object.d3119;
9339−
9340−/** @type {*} */
9341−Object.d3120;
9342−
9343−/** @type {*} */
9344−Object.d3121;
9345−
9346−/** @type {*} */
9347−Object.d3122;
9348−
9349−/** @type {*} */
9350−Object.d3123;
9351−
9352−/** @type {*} */
9353−Object.d3124;
9354−
9355−/** @type {*} */
9356−Object.d3125;
9357−
9358−/** @type {*} */
9359−Object.d3126;
9360−
9361−/** @type {*} */
9362−Object.d3127;
9363−
9364−/** @type {*} */
9365−Object.d3128;
9366−
9367−/** @type {*} */
9368−Object.d3129;
9369−
9370−/** @type {*} */
9371−Object.d3130;
9372−
9373−/** @type {*} */
9374−Object.d3131;
9375−
9376−/** @type {*} */
9377−Object.d3132;
9378−
9379−/** @type {*} */
9380−Object.d3133;
9381−
9382−/** @type {*} */
9383−Object.d3134;
9384−
9385−/** @type {*} */
9386−Object.d3135;
9387−
9388−/** @type {*} */
9389−Object.d3136;
9390−
9391−/** @type {*} */
9392−Object.d3137;
9393−
9394−/** @type {*} */
9395−Object.d3138;
9396−
9397−/** @type {*} */
9398−Object.d3139;
9399−
9400−/** @type {*} */
9401−Object.d3140;
9402−
9403−/** @type {*} */
9404−Object.d3141;
9405−
9406−/** @type {*} */
9407−Object.d3142;
9408−
9409−/** @type {*} */
9410−Object.d3143;
9411−
9412−/** @type {*} */
9413−Object.d3144;
9414−
9415−/** @type {*} */
9416−Object.d3145;
9417−
9418−/** @type {*} */
9419−Object.d3146;
9420−
9421−/** @type {*} */
9422−Object.d3147;
9423−
9424−/** @type {*} */
9425−Object.d3148;
9426−
9427−/** @type {*} */
9428−Object.d3149;
9429−
9430−/** @type {*} */
9431−Object.d3150;
9432−
9433−/** @type {*} */
9434−Object.d3151;
9435−
9436−/** @type {*} */
9437−Object.d3152;
9438−
9439−/** @type {*} */
9440−Object.d3153;
9441−
9442−/** @type {*} */
9443−Object.d3154;
9444−
9445−/** @type {*} */
9446−Object.d3155;
9447−
9448−/** @type {*} */
9449−Object.d3156;
9450−
9451−/** @type {*} */
9452−Object.d3157;
9453−
9454−/** @type {*} */
9455−Object.d3158;
9456−
9457−/** @type {*} */
9458−Object.d3159;
9459−
9460−/** @type {*} */
9461−Object.d3160;
9462−
9463−/** @type {*} */
9464−Object.d3161;
9465−
9466−/** @type {*} */
9467−Object.d3162;
9468−
9469−/** @type {*} */
9470−Object.d3163;
9471−
9472−/** @type {*} */
9473−Object.d3164;
9474−
9475−/** @type {*} */
9476−Object.d3165;
9477−
9478−/** @type {*} */
9479−Object.d3166;
9480−
9481−/** @type {*} */
9482−Object.d3167;
9483−
9484−/** @type {*} */
9485−Object.d3168;
9486−
9487−/** @type {*} */
9488−Object.d3169;
9489−
9490−/** @type {*} */
9491−Object.d3170;
9492−
9493−/** @type {*} */
9494−Object.d3171;
9495−
9496−/** @type {*} */
9497−Object.d3172;
9498−
9499−/** @type {*} */
9500−Object.d3173;
9501−
9502−/** @type {*} */
9503−Object.d3174;
9504−
9505−/** @type {*} */
9506−Object.d3175;
9507−
9508−/** @type {*} */
9509−Object.d3176;
9510−
9511−/** @type {*} */
9512−Object.d3177;
9513−
9514−/** @type {*} */
9515−Object.d3178;
9516−
9517−/** @type {*} */
9518−Object.d3179;
9519−
9520−/** @type {*} */
9521−Object.d3180;
9522−
9523−/** @type {*} */
9524−Object.d3181;
9525−
9526−/** @type {*} */
9527−Object.d3182;
9528−
9529−/** @type {*} */
9530−Object.d3183;
9531−
9532−/** @type {*} */
9533−Object.d3184;
9534−
9535−/** @type {*} */
9536−Object.d3185;
9537−
9538−/** @type {*} */
9539−Object.d3186;
9540−
9541−/** @type {*} */
9542−Object.d3187;
9543−
9544−/** @type {*} */
9545−Object.d3188;
9546−
9547−/** @type {*} */
9548−Object.d3189;
9549−
9550−/** @type {*} */
9551−Object.d3190;
9552−
9553−/** @type {*} */
9554−Object.d3191;
9555−
9556−/** @type {*} */
9557−Object.d3192;
9558−
9559−/** @type {*} */
9560−Object.d3193;
9561−
9562−/** @type {*} */
9563−Object.d3194;
9564−
9565−/** @type {*} */
9566−Object.d3195;
9567−
9568−/** @type {*} */
9569−Object.d3196;
9570−
9571−/** @type {*} */
9572−Object.d3197;
9573−
9574−/** @type {*} */
9575−Object.d3198;
9576−
9577−/** @type {*} */
9578−Object.d3199;
9579−
9580−/** @type {*} */
9581−Object.d3200;
9582−
9583−/** @type {*} */
9584−Object.d3201;
9585−
9586−/** @type {*} */
9587−Object.d3202;
9588−
9589−/** @type {*} */
9590−Object.d3203;
9591−
9592−/** @type {*} */
9593−Object.d3204;
9594−
9595−/** @type {*} */
9596−Object.d3205;
9597−
9598−/** @type {*} */
9599−Object.d3206;
9600−
9601−/** @type {*} */
9602−Object.d3207;
9603−
9604−/** @type {*} */
9605−Object.d3208;
9606−
9607−/** @type {*} */
9608−Object.d3209;
9609−
9610−/** @type {*} */
9611−Object.d3210;
9612−
9613−/** @type {*} */
9614−Object.d3211;
9615−
9616−/** @type {*} */
9617−Object.d3212;
9618−
9619−/** @type {*} */
9620−Object.d3213;
9621−
9622−/** @type {*} */
9623−Object.d3214;
9624−
9625−/** @type {*} */
9626−Object.d3215;
9627−
9628−/** @type {*} */
9629−Object.d3216;
9630−
9631−/** @type {*} */
9632−Object.d3217;
9633−
9634−/** @type {*} */
9635−Object.d3218;
9636−
9637−/** @type {*} */
9638−Object.d3219;
9639−
9640−/** @type {*} */
9641−Object.d3220;
9642−
9643−/** @type {*} */
9644−Object.d3221;
9645−
9646−/** @type {*} */
9647−Object.d3222;
9648−
9649−/** @type {*} */
9650−Object.d3223;
9651−
9652−/** @type {*} */
9653−Object.d3224;
9654−
9655−/** @type {*} */
9656−Object.d3225;
9657−
9658−/** @type {*} */
9659−Object.d3226;
9660−
9661−/** @type {*} */
9662−Object.d3227;
9663−
9664−/** @type {*} */
9665−Object.d3228;
9666−
9667−/** @type {*} */
9668−Object.d3229;
9669−
9670−/** @type {*} */
9671−Object.d3230;
9672−
9673−/** @type {*} */
9674−Object.d3231;
9675−
9676−/** @type {*} */
9677−Object.d3232;
9678−
9679−/** @type {*} */
9680−Object.d3233;
9681−
9682−/** @type {*} */
9683−Object.d3234;
9684−
9685−/** @type {*} */
9686−Object.d3235;
9687−
9688−/** @type {*} */
9689−Object.d3236;
9690−
9691−/** @type {*} */
9692−Object.d3237;
9693−
9694−/** @type {*} */
9695−Object.d3238;
9696−
9697−/** @type {*} */
9698−Object.d3239;
9699−
9700−/** @type {*} */
9701−Object.d3240;
9702−
9703−/** @type {*} */
9704−Object.d3241;
9705−
9706−/** @type {*} */
9707−Object.d3242;
9708−
9709−/** @type {*} */
9710−Object.d3243;
9711−
9712−/** @type {*} */
9713−Object.d3244;
9714−
9715−/** @type {*} */
9716−Object.d3245;
9717−
9718−/** @type {*} */
9719−Object.d3246;
9720−
9721−/** @type {*} */
9722−Object.d3247;
9723−
9724−/** @type {*} */
9725−Object.d3248;
9726−
9727−/** @type {*} */
9728−Object.d3249;
9729−
9730−/** @type {*} */
9731−Object.d3250;
9732−
9733−/** @type {*} */
9734−Object.d3251;
9735−
9736−/** @type {*} */
9737−Object.d3252;
9738−
9739−/** @type {*} */
9740−Object.d3253;
9741−
9742−/** @type {*} */
9743−Object.d3254;
9744−
9745−/** @type {*} */
9746−Object.d3255;
9747−
9748−/** @type {*} */
9749−Object.d3256;
9750−
9751−/** @type {*} */
9752−Object.d3257;
9753−
9754−/** @type {*} */
9755−Object.d3258;
9756−
9757−/** @type {*} */
9758−Object.d3259;
9759−
9760−/** @type {*} */
9761−Object.d3260;
9762−
9763−/** @type {*} */
9764−Object.d3261;
9765−
9766−/** @type {*} */
9767−Object.d3262;
9768−
9769−/** @type {*} */
9770−Object.d3263;
9771−
9772−/** @type {*} */
9773−Object.d3264;
9774−
9775−/** @type {*} */
9776−Object.d3265;
9777−
9778−/** @type {*} */
9779−Object.d3266;
9780−
9781−/** @type {*} */
9782−Object.d3267;
9783−
9784−/** @type {*} */
9785−Object.d3268;
9786−
9787−/** @type {*} */
9788−Object.d3269;
9789−
9790−/** @type {*} */
9791−Object.d3270;
9792−
9793−/** @type {*} */
9794−Object.d3271;
9795−
9796−/** @type {*} */
9797−Object.d3272;
9798−
9799−/** @type {*} */
9800−Object.d3273;
9801−
9802−/** @type {*} */
9803−Object.d3274;
9804−
9805−/** @type {*} */
9806−Object.d3275;
9807−
9808−/** @type {*} */
9809−Object.d3276;
9810−
9811−/** @type {*} */
9812−Object.d3277;
9813−
9814−/** @type {*} */
9815−Object.d3278;
9816−
9817−/** @type {*} */
9818−Object.d3279;
9819−
9820−/** @type {*} */
9821−Object.d3280;
9822−
9823−/** @type {*} */
9824−Object.d3281;
9825−
9826−/** @type {*} */
9827−Object.d3282;
9828−
9829−/** @type {*} */
9830−Object.d3283;
9831−
9832−/** @type {*} */
9833−Object.d3284;
9834−
9835−/** @type {*} */
9836−Object.d3285;
9837−
9838−/** @type {*} */
9839−Object.d3286;
9840−
9841−/** @type {*} */
9842−Object.d3287;
9843−
9844−/** @type {*} */
9845−Object.d3288;
9846−
9847−/** @type {*} */
9848−Object.d3289;
9849−
9850−/** @type {*} */
9851−Object.d3290;
9852−
9853−/** @type {*} */
9854−Object.d3291;
9855−
9856−/** @type {*} */
9857−Object.d3292;
9858−
9859−/** @type {*} */
9860−Object.d3293;
9861−
9862−/** @type {*} */
9863−Object.d3294;
9864−
9865−/** @type {*} */
9866−Object.d3295;
9867−
9868−/** @type {*} */
9869−Object.d3296;
9870−
9871−/** @type {*} */
9872−Object.d3297;
9873−
9874−/** @type {*} */
9875−Object.d3298;
9876−
9877−/** @type {*} */
9878−Object.d3299;
9879−
9880−/** @type {*} */
9881−Object.d3300;
9882−
9883−/** @type {*} */
9884−Object.d3301;
9885−
9886−/** @type {*} */
9887−Object.d3302;
9888−
9889−/** @type {*} */
9890−Object.d3303;
9891−
9892−/** @type {*} */
9893−Object.d3304;
9894−
9895−/** @type {*} */
9896−Object.d3305;
9897−
9898−/** @type {*} */
9899−Object.d3306;
9900−
9901−/** @type {*} */
9902−Object.d3307;
9903−
9904−/** @type {*} */
9905−Object.d3308;
9906−
9907−/** @type {*} */
9908−Object.d3309;
9909−
9910−/** @type {*} */
9911−Object.d3310;
9912−
9913−/** @type {*} */
9914−Object.d3311;
9915−
9916−/** @type {*} */
9917−Object.d3312;
9918−
9919−/** @type {*} */
9920−Object.d3313;
9921−
9922−/** @type {*} */
9923−Object.d3314;
9924−
9925−/** @type {*} */
9926−Object.d3315;
9927−
9928−/** @type {*} */
9929−Object.d3316;
9930−
9931−/** @type {*} */
9932−Object.d3317;
9933−
9934−/** @type {*} */
9935−Object.d3318;
9936−
9937−/** @type {*} */
9938−Object.d3319;
9939−
9940−/** @type {*} */
9941−Object.d3320;
9942−
9943−/** @type {*} */
9944−Object.d3321;
9945−
9946−/** @type {*} */
9947−Object.d3322;
9948−
9949−/** @type {*} */
9950−Object.d3323;
9951−
9952−/** @type {*} */
9953−Object.d3324;
9954−
9955−/** @type {*} */
9956−Object.d3325;
9957−
9958−/** @type {*} */
9959−Object.d3326;
9960−
9961−/** @type {*} */
9962−Object.d3327;
9963−
9964−/** @type {*} */
9965−Object.d3328;
9966−
9967−/** @type {*} */
9968−Object.d3329;
9969−
9970−/** @type {*} */
9971−Object.d3330;
9972−
9973−/** @type {*} */
9974−Object.d3331;
9975−
9976−/** @type {*} */
9977−Object.d3332;
9978−
9979−/** @type {*} */
9980−Object.d3333;
9981−
9982−/** @type {*} */
9983−Object.d3334;
9984−
9985−/** @type {*} */
9986−Object.d3335;
9987−
9988−/** @type {*} */
9989−Object.d3336;
9990−
9991−/** @type {*} */
9992−Object.d3337;
9993−
9994−/** @type {*} */
9995−Object.d3338;
9996−
9997−/** @type {*} */
9998−Object.d3339;
9999−
10000−/** @type {*} */
10001−Object.d3340;
10002−
10003−/** @type {*} */
10004−Object.d3341;
10005−
10006−/** @type {*} */
10007−Object.d3342;
10008−
10009−/** @type {*} */
10010−Object.d3343;
10011−
10012−/** @type {*} */
10013−Object.d3344;
10014−
10015−/** @type {*} */
10016−Object.d3345;
10017−
10018−/** @type {*} */
10019−Object.d3346;
10020−
10021−/** @type {*} */
10022−Object.d3347;
10023−
10024−/** @type {*} */
10025−Object.d3348;
10026−
10027−/** @type {*} */
10028−Object.d3349;
10029−
10030−/** @type {*} */
10031−Object.d3350;
10032−
10033−/** @type {*} */
10034−Object.d3351;
10035−
10036−/** @type {*} */
10037−Object.d3352;
10038−
10039−/** @type {*} */
10040−Object.d3353;
10041−
10042−/** @type {*} */
10043−Object.d3354;
10044−
10045−/** @type {*} */
10046−Object.d3355;
10047−
10048−/** @type {*} */
10049−Object.d3356;
10050−
10051−/** @type {*} */
10052−Object.d3357;
10053−
10054−/** @type {*} */
10055−Object.d3358;
10056−
10057−/** @type {*} */
10058−Object.d3359;
10059−
10060−/** @type {*} */
10061−Object.d3360;
10062−
10063−/** @type {*} */
10064−Object.d3361;
10065−
10066−/** @type {*} */
10067−Object.d3362;
10068−
10069−/** @type {*} */
10070−Object.d3363;
10071−
10072−/** @type {*} */
10073−Object.d3364;
10074−
10075−/** @type {*} */
10076−Object.d3365;
10077−
10078−/** @type {*} */
10079−Object.d3366;
10080−
10081−/** @type {*} */
10082−Object.d3367;
10083−
10084−/** @type {*} */
10085−Object.d3368;
10086−
10087−/** @type {*} */
10088−Object.d3369;
10089−
10090−/** @type {*} */
10091−Object.d3370;
10092−
10093−/** @type {*} */
10094−Object.d3371;
10095−
10096−/** @type {*} */
10097−Object.d3372;
10098−
10099−/** @type {*} */
10100−Object.d3373;
10101−
10102−/** @type {*} */
10103−Object.d3374;
10104−
10105−/** @type {*} */
10106−Object.d3375;
10107−
10108−/** @type {*} */
10109−Object.d3376;
10110−
10111−/** @type {*} */
10112−Object.d3377;
10113−
10114−/** @type {*} */
10115−Object.d3378;
10116−
10117−/** @type {*} */
10118−Object.d3379;
10119−
10120−/** @type {*} */
10121−Object.d3380;
10122−
10123−/** @type {*} */
10124−Object.d3381;
10125−
10126−/** @type {*} */
10127−Object.d3382;
10128−
10129−/** @type {*} */
10130−Object.d3383;
10131−
10132−/** @type {*} */
10133−Object.d3384;
10134−
10135−/** @type {*} */
10136−Object.d3385;
10137−
10138−/** @type {*} */
10139−Object.d3386;
10140−
10141−/** @type {*} */
10142−Object.d3387;
10143−
10144−/** @type {*} */
10145−Object.d3388;
10146−
10147−/** @type {*} */
10148−Object.d3389;
10149−
10150−/** @type {*} */
10151−Object.d3390;
10152−
10153−/** @type {*} */
10154−Object.d3391;
10155−
10156−/** @type {*} */
10157−Object.d3392;
10158−
10159−/** @type {*} */
10160−Object.d3393;
10161−
10162−/** @type {*} */
10163−Object.d3394;
10164−
10165−/** @type {*} */
10166−Object.d3395;
10167−
10168−/** @type {*} */
10169−Object.d3396;
10170−
10171−/** @type {*} */
10172−Object.d3397;
10173−
10174−/** @type {*} */
10175−Object.d3398;
10176−
10177−/** @type {*} */
10178−Object.d3399;
10179−
10180−/** @type {*} */
10181−Object.d3400;
10182−
10183−/** @type {*} */
10184−Object.d3401;
10185−
10186−/** @type {*} */
10187−Object.d3402;
10188−
10189−/** @type {*} */
10190−Object.d3403;
10191−
10192−/** @type {*} */
10193−Object.d3404;
10194−
10195−/** @type {*} */
10196−Object.d3405;
10197−
10198−/** @type {*} */
10199−Object.d3406;
10200−
10201−/** @type {*} */
10202−Object.d3407;
10203−
10204−/** @type {*} */
10205−Object.d3408;
10206−
10207−/** @type {*} */
10208−Object.d3409;
10209−
10210−/** @type {*} */
10211−Object.d3410;
10212−
10213−/** @type {*} */
10214−Object.d3411;
10215−
10216−/** @type {*} */
10217−Object.d3412;
10218−
10219−/** @type {*} */
10220−Object.d3413;
10221−
10222−/** @type {*} */
10223−Object.d3414;
10224−
10225−/** @type {*} */
10226−Object.d3415;
10227−
10228−/** @type {*} */
10229−Object.d3416;
10230−
10231−/** @type {*} */
10232−Object.d3417;
10233−
10234−/** @type {*} */
10235−Object.d3418;
10236−
10237−/** @type {*} */
10238−Object.d3419;
10239−
10240−/** @type {*} */
10241−Object.d3420;
10242−
10243−/** @type {*} */
10244−Object.d3421;
10245−
10246−/** @type {*} */
10247−Object.d3422;
10248−
10249−/** @type {*} */
10250−Object.d3423;
10251−
10252−/** @type {*} */
10253−Object.d3424;
10254−
10255−/** @type {*} */
10256−Object.d3425;
10257−
10258−/** @type {*} */
10259−Object.d3426;
10260−
10261−/** @type {*} */
10262−Object.d3427;
10263−
10264−/** @type {*} */
10265−Object.d3428;
10266−
10267−/** @type {*} */
10268−Object.d3429;
10269−
10270−/** @type {*} */
10271−Object.d3430;
10272−
10273−/** @type {*} */
10274−Object.d3431;
10275−
10276−/** @type {*} */
10277−Object.d3432;
10278−
10279−/** @type {*} */
10280−Object.d3433;
10281−
10282−/** @type {*} */
10283−Object.d3434;
10284−
10285−/** @type {*} */
10286−Object.d3435;
10287−
10288−/** @type {*} */
10289−Object.d3436;
10290−
10291−/** @type {*} */
10292−Object.d3437;
10293−
10294−/** @type {*} */
10295−Object.d3438;
10296−
10297−/** @type {*} */
10298−Object.d3439;
10299−
10300−/** @type {*} */
10301−Object.d3440;
10302−
10303−/** @type {*} */
10304−Object.d3441;
10305−
10306−/** @type {*} */
10307−Object.d3442;
10308−
10309−/** @type {*} */
10310−Object.d3443;
10311−
10312−/** @type {*} */
10313−Object.d3444;
10314−
10315−/** @type {*} */
10316−Object.d3445;
10317−
10318−/** @type {*} */
10319−Object.d3446;
10320−
10321−/** @type {*} */
10322−Object.d3447;
10323−
10324−/** @type {*} */
10325−Object.d3448;
10326−
10327−/** @type {*} */
10328−Object.d3449;
10329−
10330−/** @type {*} */
10331−Object.d3450;
10332−
10333−/** @type {*} */
10334−Object.d3451;
10335−
10336−/** @type {*} */
10337−Object.d3452;
10338−
10339−/** @type {*} */
10340−Object.d3453;
10341−
10342−/** @type {*} */
10343−Object.d3454;
10344−
10345−/** @type {*} */
10346−Object.d3455;
10347−
10348−/** @type {*} */
10349−Object.d3456;
10350−
10351−/** @type {*} */
10352−Object.d3457;
10353−
10354−/** @type {*} */
10355−Object.d3458;
10356−
10357−/** @type {*} */
10358−Object.d3459;
10359−
10360−/** @type {*} */
10361−Object.d3460;
10362−
10363−/** @type {*} */
10364−Object.d3461;
10365−
10366−/** @type {*} */
10367−Object.d3462;
10368−
10369−/** @type {*} */
10370−Object.d3463;
10371−
10372−/** @type {*} */
10373−Object.d3464;
10374−
10375−/** @type {*} */
10376−Object.d3465;
10377−
10378−/** @type {*} */
10379−Object.d3466;
10380−
10381−/** @type {*} */
10382−Object.d3467;
10383−
10384−/** @type {*} */
10385−Object.d3468;
10386−
10387−/** @type {*} */
10388−Object.d3469;
10389−
10390−/** @type {*} */
10391−Object.d3470;
10392−
10393−/** @type {*} */
10394−Object.d3471;
10395−
10396−/** @type {*} */
10397−Object.d3472;
10398−
10399−/** @type {*} */
10400−Object.d3473;
10401−
10402−/** @type {*} */
10403−Object.d3474;
10404−
10405−/** @type {*} */
10406−Object.d3475;
10407−
10408−/** @type {*} */
10409−Object.d3476;
10410−
10411−/** @type {*} */
10412−Object.d3477;
10413−
10414−/** @type {*} */
10415−Object.d3478;
10416−
10417−/** @type {*} */
10418−Object.d3479;
10419−
10420−/** @type {*} */
10421−Object.d3480;
10422−
10423−/** @type {*} */
10424−Object.d3481;
10425−
10426−/** @type {*} */
10427−Object.d3482;
10428−
10429−/** @type {*} */
10430−Object.d3483;
10431−
10432−/** @type {*} */
10433−Object.d3484;
10434−
10435−/** @type {*} */
10436−Object.d3485;
10437−
10438−/** @type {*} */
10439−Object.d3486;
10440−
10441−/** @type {*} */
10442−Object.d3487;
10443−
10444−/** @type {*} */
10445−Object.d3488;
10446−
10447−/** @type {*} */
10448−Object.d3489;
10449−
10450−/** @type {*} */
10451−Object.d3490;
10452−
10453−/** @type {*} */
10454−Object.d3491;
10455−
10456−/** @type {*} */
10457−Object.d3492;
10458−
10459−/** @type {*} */
10460−Object.d3493;
10461−
10462−/** @type {*} */
10463−Object.d3494;
10464−
10465−/** @type {*} */
10466−Object.d3495;
10467−
10468−/** @type {*} */
10469−Object.d3496;
10470−
10471−/** @type {*} */
10472−Object.d3497;
10473−
10474−/** @type {*} */
10475−Object.d3498;
10476−
10477−/** @type {*} */
10478−Object.d3499;
10479−
10480−/** @type {*} */
10481−Object.d3500;
10482−
10483−/** @type {*} */
10484−Object.d3501;
10485−
10486−/** @type {*} */
10487−Object.d3502;
10488−
10489−/** @type {*} */
10490−Object.d3503;
10491−
10492−/** @type {*} */
10493−Object.d3504;
10494−
10495−/** @type {*} */
10496−Object.d3505;
10497−
10498−/** @type {*} */
10499−Object.d3506;
10500−
10501−/** @type {*} */
10502−Object.d3507;
10503−
10504−/** @type {*} */
10505−Object.d3508;
10506−
10507−/** @type {*} */
10508−Object.d3509;
10509−
10510−/** @type {*} */
10511−Object.d3510;
10512−
10513−/** @type {*} */
10514−Object.d3511;
10515−
10516−/** @type {*} */
10517−Object.d3512;
10518−
10519−/** @type {*} */
10520−Object.d3513;
10521−
10522−/** @type {*} */
10523−Object.d3514;
10524−
10525−/** @type {*} */
10526−Object.d3515;
10527−
10528−/** @type {*} */
10529−Object.d3516;
10530−
10531−/** @type {*} */
10532−Object.d3517;
10533−
10534−/** @type {*} */
10535−Object.d3518;
10536−
10537−/** @type {*} */
10538−Object.d3519;
10539−
10540−/** @type {*} */
10541−Object.d3520;
10542−
10543−/** @type {*} */
10544−Object.d3521;
10545−
10546−/** @type {*} */
10547−Object.d3522;
10548−
10549−/** @type {*} */
10550−Object.d3523;
10551−
10552−/** @type {*} */
10553−Object.d3524;
10554−
10555−/** @type {*} */
10556−Object.d3525;
10557−
10558−/** @type {*} */
10559−Object.d3526;
10560−
10561−/** @type {*} */
10562−Object.d3527;
10563−
10564−/** @type {*} */
10565−Object.d3528;
10566−
10567−/** @type {*} */
10568−Object.d3529;
10569−
10570−/** @type {*} */
10571−Object.d3530;
10572−
10573−/** @type {*} */
10574−Object.d3531;
10575−
10576−/** @type {*} */
10577−Object.d3532;
10578−
10579−/** @type {*} */
10580−Object.d3533;
10581−
10582−/** @type {*} */
10583−Object.d3534;
10584−
10585−/** @type {*} */
10586−Object.d3535;
10587−
10588−/** @type {*} */
10589−Object.d3536;
10590−
10591−/** @type {*} */
10592−Object.d3537;
10593−
10594−/** @type {*} */
10595−Object.d3538;
10596−
10597−/** @type {*} */
10598−Object.d3539;
10599−
10600−/** @type {*} */
10601−Object.d3540;
10602−
10603−/** @type {*} */
10604−Object.d3541;
10605−
10606−/** @type {*} */
10607−Object.d3542;
10608−
10609−/** @type {*} */
10610−Object.d3543;
10611−
10612−/** @type {*} */
10613−Object.d3544;
10614−
10615−/** @type {*} */
10616−Object.d3545;
10617−
10618−/** @type {*} */
10619−Object.d3546;
10620−
10621−/** @type {*} */
10622−Object.d3547;
10623−
10624−/** @type {*} */
10625−Object.d3548;
10626−
10627−/** @type {*} */
10628−Object.d3549;
10629−
10630−/** @type {*} */
10631−Object.d3550;
10632−
10633−/** @type {*} */
10634−Object.d3551;
10635−
10636−/** @type {*} */
10637−Object.d3552;
10638−
10639−/** @type {*} */
10640−Object.d3553;
10641−
10642−/** @type {*} */
10643−Object.d3554;
10644−
10645−/** @type {*} */
10646−Object.d3555;
10647−
10648−/** @type {*} */
10649−Object.d3556;
10650−
10651−/** @type {*} */
10652−Object.d3557;
10653−
10654−/** @type {*} */
10655−Object.d3558;
10656−
10657−/** @type {*} */
10658−Object.d3559;
10659−
10660−/** @type {*} */
10661−Object.d3560;
10662−
10663−/** @type {*} */
10664−Object.d3561;
10665−
10666−/** @type {*} */
10667−Object.d3562;
10668−
10669−/** @type {*} */
10670−Object.d3563;
10671−
10672−/** @type {*} */
10673−Object.d3564;
10674−
10675−/** @type {*} */
10676−Object.d3565;
10677−
10678−/** @type {*} */
10679−Object.d3566;
10680−
10681−/** @type {*} */
10682−Object.d3567;
10683−
10684−/** @type {*} */
10685−Object.d3568;
10686−
10687−/** @type {*} */
10688−Object.d3569;
10689−
10690−/** @type {*} */
10691−Object.d3570;
10692−
10693−/** @type {*} */
10694−Object.d3571;
10695−
10696−/** @type {*} */
10697−Object.d3572;
10698−
10699−/** @type {*} */
10700−Object.d3573;
10701−
10702−/** @type {*} */
10703−Object.d3574;
10704−
10705−/** @type {*} */
10706−Object.d3575;
10707−
10708−/** @type {*} */
10709−Object.d3576;
10710−
10711−/** @type {*} */
10712−Object.d3577;
10713−
10714−/** @type {*} */
10715−Object.d3578;
10716−
10717−/** @type {*} */
10718−Object.d3579;
10719−
10720−/** @type {*} */
10721−Object.d3580;
10722−
10723−/** @type {*} */
10724−Object.d3581;
10725−
10726−/** @type {*} */
10727−Object.d3582;
10728−
10729−/** @type {*} */
10730−Object.d3583;
10731−
10732−/** @type {*} */
10733−Object.d3584;
10734−
10735−/** @type {*} */
10736−Object.d3585;
10737−
10738−/** @type {*} */
10739−Object.d3586;
10740−
10741−/** @type {*} */
10742−Object.d3587;
10743−
10744−/** @type {*} */
10745−Object.d3588;
10746−
10747−/** @type {*} */
10748−Object.d3589;
10749−
10750−/** @type {*} */
10751−Object.d3590;
10752−
10753−/** @type {*} */
10754−Object.d3591;
10755−
10756−/** @type {*} */
10757−Object.d3592;
10758−
10759−/** @type {*} */
10760−Object.d3593;
10761−
10762−/** @type {*} */
10763−Object.d3594;
10764−
10765−/** @type {*} */
10766−Object.d3595;
10767−
10768−/** @type {*} */
10769−Object.d3596;
10770−
10771−/** @type {*} */
10772−Object.d3597;
10773−
10774−/** @type {*} */
10775−Object.d3598;
10776−
10777−/** @type {*} */
10778−Object.d3599;
10779−
10780−/** @type {*} */
10781−Object.d3600;
10782−
10783−/** @type {*} */
10784−Object.d3601;
10785−
10786−/** @type {*} */
10787−Object.d3602;
10788−
10789−/** @type {*} */
10790−Object.d3603;
10791−
10792−/** @type {*} */
10793−Object.d3604;
10794−
10795−/** @type {*} */
10796−Object.d3605;
10797−
10798−/** @type {*} */
10799−Object.d3606;
10800−
10801−/** @type {*} */
10802−Object.d3607;
10803−
10804−/** @type {*} */
10805−Object.d3608;
10806−
10807−/** @type {*} */
10808−Object.d3609;
10809−
10810−/** @type {*} */
10811−Object.d3610;
10812−
10813−/** @type {*} */
10814−Object.d3611;
10815−
10816−/** @type {*} */
10817−Object.d3612;
10818−
10819−/** @type {*} */
10820−Object.d3613;
10821−
10822−/** @type {*} */
10823−Object.d3614;
10824−
10825−/** @type {*} */
10826−Object.d3615;
10827−
10828−/** @type {*} */
10829−Object.d3616;
10830−
10831−/** @type {*} */
10832−Object.d3617;
10833−
10834−/** @type {*} */
10835−Object.d3618;
10836−
10837−/** @type {*} */
10838−Object.d3619;
10839−
10840−/** @type {*} */
10841−Object.d3620;
10842−
10843−/** @type {*} */
10844−Object.d3621;
10845−
10846−/** @type {*} */
10847−Object.d3622;
10848−
10849−/** @type {*} */
10850−Object.d3623;
10851−
10852−/** @type {*} */
10853−Object.d3624;
10854−
10855−/** @type {*} */
10856−Object.d3625;
10857−
10858−/** @type {*} */
10859−Object.d3626;
10860−
10861−/** @type {*} */
10862−Object.d3627;
10863−
10864−/** @type {*} */
10865−Object.d3628;
10866−
10867−/** @type {*} */
10868−Object.d3629;
10869−
10870−/** @type {*} */
10871−Object.d3630;
10872−
10873−/** @type {*} */
10874−Object.d3631;
10875−
10876−/** @type {*} */
10877−Object.d3632;
10878−
10879−/** @type {*} */
10880−Object.d3633;
10881−
10882−/** @type {*} */
10883−Object.d3634;
10884−
10885−/** @type {*} */
10886−Object.d3635;
10887−
10888−/** @type {*} */
10889−Object.d3636;
10890−
10891−/** @type {*} */
10892−Object.d3637;
10893−
10894−/** @type {*} */
10895−Object.d3638;
10896−
10897−/** @type {*} */
10898−Object.d3639;
10899−
10900−/** @type {*} */
10901−Object.d3640;
10902−
10903−/** @type {*} */
10904−Object.d3641;
10905−
10906−/** @type {*} */
10907−Object.d3642;
10908−
10909−/** @type {*} */
10910−Object.d3643;
10911−
10912−/** @type {*} */
10913−Object.d3644;
10914−
10915−/** @type {*} */
10916−Object.d3645;
10917−
10918−/** @type {*} */
10919−Object.d3646;
10920−
10921−/** @type {*} */
10922−Object.d3647;
10923−
10924−/** @type {*} */
10925−Object.d3648;
10926−
10927−/** @type {*} */
10928−Object.d3649;
10929−
10930−/** @type {*} */
10931−Object.d3650;
10932−
10933−/** @type {*} */
10934−Object.d3651;
10935−
10936−/** @type {*} */
10937−Object.d3652;
10938−
10939−/** @type {*} */
10940−Object.d3653;
10941−
10942−/** @type {*} */
10943−Object.d3654;
10944−
10945−/** @type {*} */
10946−Object.d3655;
10947−
10948−/** @type {*} */
10949−Object.d3656;
10950−
10951−/** @type {*} */
10952−Object.d3657;
10953−
10954−/** @type {*} */
10955−Object.d3658;
10956−
10957−/** @type {*} */
10958−Object.d3659;
10959−
10960−/** @type {*} */
10961−Object.d3660;
10962−
10963−/** @type {*} */
10964−Object.d3661;
10965−
10966−/** @type {*} */
10967−Object.d3662;
10968−
10969−/** @type {*} */
10970−Object.d3663;
10971−
10972−/** @type {*} */
10973−Object.d3664;
10974−
10975−/** @type {*} */
10976−Object.d3665;
10977−
10978−/** @type {*} */
10979−Object.d3666;
10980−
10981−/** @type {*} */
10982−Object.d3667;
10983−
10984−/** @type {*} */
10985−Object.d3668;
10986−
10987−/** @type {*} */
10988−Object.d3669;
10989−
10990−/** @type {*} */
10991−Object.d3670;
10992−
10993−/** @type {*} */
10994−Object.d3671;
10995−
10996−/** @type {*} */
10997−Object.d3672;
10998−
10999−/** @type {*} */
11000−Object.d3673;
11001−
11002−/** @type {*} */
11003−Object.d3674;
11004−
11005−/** @type {*} */
11006−Object.d3675;
11007−
11008−/** @type {*} */
11009−Object.d3676;
11010−
11011−/** @type {*} */
11012−Object.d3677;
11013−
11014−/** @type {*} */
11015−Object.d3678;
11016−
11017−/** @type {*} */
11018−Object.d3679;
11019−
11020−/** @type {*} */
11021−Object.d3680;
11022−
11023−/** @type {*} */
11024−Object.d3681;
11025−
11026−/** @type {*} */
11027−Object.d3682;
11028−
11029−/** @type {*} */
11030−Object.d3683;
11031−
11032−/** @type {*} */
11033−Object.d3684;
11034−
11035−/** @type {*} */
11036−Object.d3685;
11037−
11038−/** @type {*} */
11039−Object.d3686;
11040−
11041−/** @type {*} */
11042−Object.d3687;
11043−
11044−/** @type {*} */
11045−Object.d3688;
11046−
11047−/** @type {*} */
11048−Object.d3689;
11049−
11050−/** @type {*} */
11051−Object.d3690;
11052−
11053−/** @type {*} */
11054−Object.d3691;
11055−
11056−/** @type {*} */
11057−Object.d3692;
11058−
11059−/** @type {*} */
11060−Object.d3693;
11061−
11062−/** @type {*} */
11063−Object.d3694;
11064−
11065−/** @type {*} */
11066−Object.d3695;
11067−
11068−/** @type {*} */
11069−Object.d3696;
11070−
11071−/** @type {*} */
11072−Object.d3697;
11073−
11074−/** @type {*} */
11075−Object.d3698;
11076−
11077−/** @type {*} */
11078−Object.d3699;
11079−
11080−/** @type {*} */
11081−Object.d3700;
11082−
11083−/** @type {*} */
11084−Object.d3701;
11085−
11086−/** @type {*} */
11087−Object.d3702;
11088−
11089−/** @type {*} */
11090−Object.d3703;
11091−
11092−/** @type {*} */
11093−Object.d3704;
11094−
11095−/** @type {*} */
11096−Object.d3705;
11097−
11098−/** @type {*} */
11099−Object.d3706;
11100−
11101−/** @type {*} */
11102−Object.d3707;
11103−
11104−/** @type {*} */
11105−Object.d3708;
11106−
11107−/** @type {*} */
11108−Object.d3709;
11109−
11110−/** @type {*} */
11111−Object.d3710;
11112−
11113−/** @type {*} */
11114−Object.d3711;
11115−
11116−/** @type {*} */
11117−Object.d3712;
11118−
11119−/** @type {*} */
11120−Object.d3713;
11121−
11122−/** @type {*} */
11123−Object.d3714;
11124−
11125−/** @type {*} */
11126−Object.d3715;
11127−
11128−/** @type {*} */
11129−Object.d3716;
11130−
11131−/** @type {*} */
11132−Object.d3717;
11133−
11134−/** @type {*} */
11135−Object.d3718;
11136−
11137−/** @type {*} */
11138−Object.d3719;
11139−
11140−/** @type {*} */
11141−Object.d3720;
11142−
11143−/** @type {*} */
11144−Object.d3721;
11145−
11146−/** @type {*} */
11147−Object.d3722;
11148−
11149−/** @type {*} */
11150−Object.d3723;
11151−
11152−/** @type {*} */
11153−Object.d3724;
11154−
11155−/** @type {*} */
11156−Object.d3725;
11157−
11158−/** @type {*} */
11159−Object.d3726;
11160−
11161−/** @type {*} */
11162−Object.d3727;
11163−
11164−/** @type {*} */
11165−Object.d3728;
11166−
11167−/** @type {*} */
11168−Object.d3729;
11169−
11170−/** @type {*} */
11171−Object.d3730;
11172−
11173−/** @type {*} */
11174−Object.d3731;
11175−
11176−/** @type {*} */
11177−Object.d3732;
11178−
11179−/** @type {*} */
11180−Object.d3733;
11181−
11182−/** @type {*} */
11183−Object.d3734;
11184−
11185−/** @type {*} */
11186−Object.d3735;
11187−
11188−/** @type {*} */
11189−Object.d3736;
11190−
11191−/** @type {*} */
11192−Object.d3737;
11193−
11194−/** @type {*} */
11195−Object.d3738;
11196−
11197−/** @type {*} */
11198−Object.d3739;
11199−
11200−/** @type {*} */
11201−Object.d3740;
11202−
11203−/** @type {*} */
11204−Object.d3741;
11205−
11206−/** @type {*} */
11207−Object.d3742;
11208−
11209−/** @type {*} */
11210−Object.d3743;
11211−
11212−/** @type {*} */
11213−Object.d3744;
11214−
11215−/** @type {*} */
11216−Object.d3745;
11217−
11218−/** @type {*} */
11219−Object.d3746;
11220−
11221−/** @type {*} */
11222−Object.d3747;
11223−
11224−/** @type {*} */
11225−Object.d3748;
11226−
11227−/** @type {*} */
11228−Object.d3749;
11229−
11230−/** @type {*} */
11231−Object.d3750;
11232−
11233−/** @type {*} */
11234−Object.d3751;
11235−
11236−/** @type {*} */
11237−Object.d3752;
11238−
11239−/** @type {*} */
11240−Object.d3753;
11241−
11242−/** @type {*} */
11243−Object.d3754;
11244−
11245−/** @type {*} */
11246−Object.d3755;
11247−
11248−/** @type {*} */
11249−Object.d3756;
11250−
11251−/** @type {*} */
11252−Object.d3757;
11253−
11254−/** @type {*} */
11255−Object.d3758;
11256−
11257−/** @type {*} */
11258−Object.d3759;
11259−
11260−/** @type {*} */
11261−Object.d3760;
11262−
11263−/** @type {*} */
11264−Object.d3761;
11265−
11266−/** @type {*} */
11267−Object.d3762;
11268−
11269−/** @type {*} */
11270−Object.d3763;
11271−
11272−/** @type {*} */
11273−Object.d3764;
11274−
11275−/** @type {*} */
11276−Object.d3765;
11277−
11278−/** @type {*} */
11279−Object.d3766;
11280−
11281−/** @type {*} */
11282−Object.d3767;
11283−
11284−/** @type {*} */
11285−Object.d3768;
11286−
11287−/** @type {*} */
11288−Object.d3769;
11289−
11290−/** @type {*} */
11291−Object.d3770;
11292−
11293−/** @type {*} */
11294−Object.d3771;
11295−
11296−/** @type {*} */
11297−Object.d3772;
11298−
11299−/** @type {*} */
11300−Object.d3773;
11301−
11302−/** @type {*} */
11303−Object.d3774;
11304−
11305−/** @type {*} */
11306−Object.d3775;
11307−
11308−/** @type {*} */
11309−Object.d3776;
11310−
11311−/** @type {*} */
11312−Object.d3777;
11313−
11314−/** @type {*} */
11315−Object.d3778;
11316−
11317−/** @type {*} */
11318−Object.d3779;
11319−
11320−/** @type {*} */
11321−Object.d3780;
11322−
11323−/** @type {*} */
11324−Object.d3781;
11325−
11326−/** @type {*} */
11327−Object.d3782;
11328−
11329−/** @type {*} */
11330−Object.d3783;
11331−
11332−/** @type {*} */
11333−Object.d3784;
11334−
11335−/** @type {*} */
11336−Object.d3785;
11337−
11338−/** @type {*} */
11339−Object.d3786;
11340−
11341−/** @type {*} */
11342−Object.d3787;
11343−
11344−/** @type {*} */
11345−Object.d3788;
11346−
11347−/** @type {*} */
11348−Object.d3789;
11349−
11350−/** @type {*} */
11351−Object.d3790;
11352−
11353−/** @type {*} */
11354−Object.d3791;
11355−
11356−/** @type {*} */
11357−Object.d3792;
11358−
11359−/** @type {*} */
11360−Object.d3793;
11361−
11362−/** @type {*} */
11363−Object.d3794;
11364−
11365−/** @type {*} */
11366−Object.d3795;
11367−
11368−/** @type {*} */
11369−Object.d3796;
11370−
11371−/** @type {*} */
11372−Object.d3797;
11373−
11374−/** @type {*} */
11375−Object.d3798;
11376−
11377−/** @type {*} */
11378−Object.d3799;
11379−
11380−/** @type {*} */
11381−Object.d3800;
11382−
11383−/** @type {*} */
11384−Object.d3801;
11385−
11386−/** @type {*} */
11387−Object.d3802;
11388−
11389−/** @type {*} */
11390−Object.d3803;
11391−
11392−/** @type {*} */
11393−Object.d3804;
11394−
11395−/** @type {*} */
11396−Object.d3805;
11397−
11398−/** @type {*} */
11399−Object.d3806;
11400−
11401−/** @type {*} */
11402−Object.d3807;
11403−
11404−/** @type {*} */
11405−Object.d3808;
11406−
11407−/** @type {*} */
11408−Object.d3809;
11409−
11410−/** @type {*} */
11411−Object.d3810;
11412−
11413−/** @type {*} */
11414−Object.d3811;
11415−
11416−/** @type {*} */
11417−Object.d3812;
11418−
11419−/** @type {*} */
11420−Object.d3813;
11421−
11422−/** @type {*} */
11423−Object.d3814;
11424−
11425−/** @type {*} */
11426−Object.d3815;
11427−
11428−/** @type {*} */
11429−Object.d3816;
11430−
11431−/** @type {*} */
11432−Object.d3817;
11433−
11434−/** @type {*} */
11435−Object.d3818;
11436−
11437−/** @type {*} */
11438−Object.d3819;
11439−
11440−/** @type {*} */
11441−Object.d3820;
11442−
11443−/** @type {*} */
11444−Object.d3821;
11445−
11446−/** @type {*} */
11447−Object.d3822;
11448−
11449−/** @type {*} */
11450−Object.d3823;
11451−
11452−/** @type {*} */
11453−Object.d3824;
11454−
11455−/** @type {*} */
11456−Object.d3825;
11457−
11458−/** @type {*} */
11459−Object.d3826;
11460−
11461−/** @type {*} */
11462−Object.d3827;
11463−
11464−/** @type {*} */
11465−Object.d3828;
11466−
11467−/** @type {*} */
11468−Object.d3829;
11469−
11470−/** @type {*} */
11471−Object.d3830;
11472−
11473−/** @type {*} */
11474−Object.d3831;
11475−
11476−/** @type {*} */
11477−Object.d3832;
11478−
11479−/** @type {*} */
11480−Object.d3833;
11481−
11482−/** @type {*} */
11483−Object.d3834;
11484−
11485−/** @type {*} */
11486−Object.d3835;
11487−
11488−/** @type {*} */
11489−Object.d3836;
11490−
11491−/** @type {*} */
11492−Object.d3837;
11493−
11494−/** @type {*} */
11495−Object.d3838;
11496−
11497−/** @type {*} */
11498−Object.d3839;
11499−
11500−/** @type {*} */
11501−Object.d3840;
11502−
11503−/** @type {*} */
11504−Object.d3841;
11505−
11506−/** @type {*} */
11507−Object.d3842;
11508−
11509−/** @type {*} */
11510−Object.d3843;
11511−
11512−/** @type {*} */
11513−Object.d3844;
11514−
11515−/** @type {*} */
11516−Object.d3845;
11517−
11518−/** @type {*} */
11519−Object.d3846;
11520−
11521−/** @type {*} */
11522−Object.d3847;
11523−
11524−/** @type {*} */
11525−Object.d3848;
11526−
11527−/** @type {*} */
11528−Object.d3849;
11529−
11530−/** @type {*} */
11531−Object.d3850;
11532−
11533−/** @type {*} */
11534−Object.d3851;
11535−
11536−/** @type {*} */
11537−Object.d3852;
11538−
11539−/** @type {*} */
11540−Object.d3853;
11541−
11542−/** @type {*} */
11543−Object.d3854;
11544−
11545−/** @type {*} */
11546−Object.d3855;
11547−
11548−/** @type {*} */
11549−Object.d3856;
11550−
11551−/** @type {*} */
11552−Object.d3857;
11553−
11554−/** @type {*} */
11555−Object.d3858;
11556−
11557−/** @type {*} */
11558−Object.d3859;
11559−
11560−/** @type {*} */
11561−Object.d3860;
11562−
11563−/** @type {*} */
11564−Object.d3861;
11565−
11566−/** @type {*} */
11567−Object.d3862;
11568−
11569−/** @type {*} */
11570−Object.d3863;
11571−
11572−/** @type {*} */
11573−Object.d3864;
11574−
11575−/** @type {*} */
11576−Object.d3865;
11577−
11578−/** @type {*} */
11579−Object.d3866;
11580−
11581−/** @type {*} */
11582−Object.d3867;
11583−
11584−/** @type {*} */
11585−Object.d3868;
11586−
11587−/** @type {*} */
11588−Object.d3869;
11589−
11590−/** @type {*} */
11591−Object.d3870;
11592−
11593−/** @type {*} */
11594−Object.d3871;
11595−
11596−/** @type {*} */
11597−Object.d3872;
11598−
11599−/** @type {*} */
11600−Object.d3873;
11601−
11602−/** @type {*} */
11603−Object.d3874;
11604−
11605−/** @type {*} */
11606−Object.d3875;
11607−
11608−/** @type {*} */
11609−Object.d3876;
11610−
11611−/** @type {*} */
11612−Object.d3877;
11613−
11614−/** @type {*} */
11615−Object.d3878;
11616−
11617−/** @type {*} */
11618−Object.d3879;
11619−
11620−/** @type {*} */
11621−Object.d3880;
11622−
11623−/** @type {*} */
11624−Object.d3881;
11625−
11626−/** @type {*} */
11627−Object.d3882;
11628−
11629−/** @type {*} */
11630−Object.d3883;
11631−
11632−/** @type {*} */
11633−Object.d3884;
11634−
11635−/** @type {*} */
11636−Object.d3885;
11637−
11638−/** @type {*} */
11639−Object.d3886;
11640−
11641−/** @type {*} */
11642−Object.d3887;
11643−
11644−/** @type {*} */
11645−Object.d3888;
11646−
11647−/** @type {*} */
11648−Object.d3889;
11649−
11650−/** @type {*} */
11651−Object.d3890;
11652−
11653−/** @type {*} */
11654−Object.d3891;
11655−
11656−/** @type {*} */
11657−Object.d3892;
11658−
11659−/** @type {*} */
11660−Object.d3893;
11661−
11662−/** @type {*} */
11663−Object.d3894;
11664−
11665−/** @type {*} */
11666−Object.d3895;
11667−
11668−/** @type {*} */
11669−Object.d3896;
11670−
11671−/** @type {*} */
11672−Object.d3897;
11673−
11674−/** @type {*} */
11675−Object.d3898;
11676−
11677−/** @type {*} */
11678−Object.d3899;
11679−
11680−/** @type {*} */
11681−Object.d3900;
11682−
11683−/** @type {*} */
11684−Object.d3901;
11685−
11686−/** @type {*} */
11687−Object.d3902;
11688−
11689−/** @type {*} */
11690−Object.d3903;
11691−
11692−/** @type {*} */
11693−Object.d3904;
11694−
11695−/** @type {*} */
11696−Object.d3905;
11697−
11698−/** @type {*} */
11699−Object.d3906;
11700−
11701−/** @type {*} */
11702−Object.d3907;
11703−
11704−/** @type {*} */
11705−Object.d3908;
11706−
11707−/** @type {*} */
11708−Object.d3909;
11709−
11710−/** @type {*} */
11711−Object.d3910;
11712−
11713−/** @type {*} */
11714−Object.d3911;
11715−
11716−/** @type {*} */
11717−Object.d3912;
11718−
11719−/** @type {*} */
11720−Object.d3913;
11721−
11722−/** @type {*} */
11723−Object.d3914;
11724−
11725−/** @type {*} */
11726−Object.d3915;
11727−
11728−/** @type {*} */
11729−Object.d3916;
11730−
11731−/** @type {*} */
11732−Object.d3917;
11733−
11734−/** @type {*} */
11735−Object.d3918;
11736−
11737−/** @type {*} */
11738−Object.d3919;
11739−
11740−/** @type {*} */
11741−Object.d3920;
11742−
11743−/** @type {*} */
11744−Object.d3921;
11745−
11746−/** @type {*} */
11747−Object.d3922;
11748−
11749−/** @type {*} */
11750−Object.d3923;
11751−
11752−/** @type {*} */
11753−Object.d3924;
11754−
11755−/** @type {*} */
11756−Object.d3925;
11757−
11758−/** @type {*} */
11759−Object.d3926;
11760−
11761−/** @type {*} */
11762−Object.d3927;
11763−
11764−/** @type {*} */
11765−Object.d3928;
11766−
11767−/** @type {*} */
11768−Object.d3929;
11769−
11770−/** @type {*} */
11771−Object.d3930;
11772−
11773−/** @type {*} */
11774−Object.d3931;
11775−
11776−/** @type {*} */
11777−Object.d3932;
11778−
11779−/** @type {*} */
11780−Object.d3933;
11781−
11782−/** @type {*} */
11783−Object.d3934;
11784−
11785−/** @type {*} */
11786−Object.d3935;
11787−
11788−/** @type {*} */
11789−Object.d3936;
11790−
11791−/** @type {*} */
11792−Object.d3937;
11793−
11794−/** @type {*} */
11795−Object.d3938;
11796−
11797−/** @type {*} */
11798−Object.d3939;
11799−
11800−/** @type {*} */
11801−Object.d3940;
11802−
11803−/** @type {*} */
11804−Object.d3941;
11805−
11806−/** @type {*} */
11807−Object.d3942;
11808−
11809−/** @type {*} */
11810−Object.d3943;
11811−
11812−/** @type {*} */
11813−Object.d3944;
11814−
11815−/** @type {*} */
11816−Object.d3945;
11817−
11818−/** @type {*} */
11819−Object.d3946;
11820−
11821−/** @type {*} */
11822−Object.d3947;
11823−
11824−/** @type {*} */
11825−Object.d3948;
11826−
11827−/** @type {*} */
11828−Object.d3949;
11829−
11830−/** @type {*} */
11831−Object.d3950;
11832−
11833−/** @type {*} */
11834−Object.d3951;
11835−
11836−/** @type {*} */
11837−Object.d3952;
11838−
11839−/** @type {*} */
11840−Object.d3953;
11841−
11842−/** @type {*} */
11843−Object.d3954;
11844−
11845−/** @type {*} */
11846−Object.d3955;
11847−
11848−/** @type {*} */
11849−Object.d3956;
11850−
11851−/** @type {*} */
11852−Object.d3957;
11853−
11854−/** @type {*} */
11855−Object.d3958;
11856−
11857−/** @type {*} */
11858−Object.d3959;
11859−
11860−/** @type {*} */
11861−Object.d3960;
11862−
11863−/** @type {*} */
11864−Object.d3961;
11865−
11866−/** @type {*} */
11867−Object.d3962;
11868−
11869−/** @type {*} */
11870−Object.d3963;
11871−
11872−/** @type {*} */
11873−Object.d3964;
11874−
11875−/** @type {*} */
11876−Object.d3965;
11877−
11878−/** @type {*} */
11879−Object.d3966;
11880−
11881−/** @type {*} */
11882−Object.d3967;
11883−
11884−/** @type {*} */
11885−Object.d3968;
11886−
11887−/** @type {*} */
11888−Object.d3969;
11889−
11890−/** @type {*} */
11891−Object.d3970;
11892−
11893−/** @type {*} */
11894−Object.d3971;
11895−
11896−/** @type {*} */
11897−Object.d3972;
11898−
11899−/** @type {*} */
11900−Object.d3973;
11901−
11902−/** @type {*} */
11903−Object.d3974;
11904−
11905−/** @type {*} */
11906−Object.d3975;
11907−
11908−/** @type {*} */
11909−Object.d3976;
11910−
11911−/** @type {*} */
11912−Object.d3977;
11913−
11914−/** @type {*} */
11915−Object.d3978;
11916−
11917−/** @type {*} */
11918−Object.d3979;
11919−
11920−/** @type {*} */
11921−Object.d3980;
11922−
11923−/** @type {*} */
11924−Object.d3981;
11925−
11926−/** @type {*} */
11927−Object.d3982;
11928−
11929−/** @type {*} */
11930−Object.d3983;
11931−
11932−/** @type {*} */
11933−Object.d3984;
11934−
11935−/** @type {*} */
11936−Object.d3985;
11937−
11938−/** @type {*} */
11939−Object.d3986;
11940−
11941−/** @type {*} */
11942−Object.d3987;
11943−
11944−/** @type {*} */
11945−Object.d3988;
11946−
11947−/** @type {*} */
11948−Object.d3989;
11949−
11950−/** @type {*} */
11951−Object.d3990;
11952−
11953−/** @type {*} */
11954−Object.d3991;
11955−
11956−/** @type {*} */
11957−Object.d3992;
11958−
11959−/** @type {*} */
11960−Object.d3993;
11961−
11962−/** @type {*} */
11963−Object.d3994;
11964−
11965−/** @type {*} */
11966−Object.d3995;
11967−
11968−/** @type {*} */
11969−Object.d3996;
11970−
11971−/** @type {*} */
11972−Object.d3997;
11973−
11974−/** @type {*} */
11975−Object.d3998;
11976−
11977−/** @type {*} */
11978−Object.d3999;
11979−
11980−/** @type {*} */
11981−Object.d4000;
11982−
11983−/** @type {*} */
11984−Object.d4001;
11985−
11986−/** @type {*} */
11987−Object.d4002;
11988−
11989−/** @type {*} */
11990−Object.d4003;
11991−
11992−/** @type {*} */
11993−Object.d4004;
11994−
11995−/** @type {*} */
11996−Object.d4005;
11997−
11998−/** @type {*} */
11999−Object.d4006;
12000−
12001−/** @type {*} */
12002−Object.d4007;
12003−
12004−/** @type {*} */
12005−Object.d4008;
12006−
12007−/** @type {*} */
12008−Object.d4009;
12009−
12010−/** @type {*} */
12011−Object.d4010;
12012−
12013−/** @type {*} */
12014−Object.d4011;
12015−
12016−/** @type {*} */
12017−Object.d4012;
12018−
12019−/** @type {*} */
12020−Object.d4013;
12021−
12022−/** @type {*} */
12023−Object.d4014;
12024−
12025−/** @type {*} */
12026−Object.d4015;
12027−
12028−/** @type {*} */
12029−Object.d4016;
12030−
12031−/** @type {*} */
12032−Object.d4017;
12033−
12034−/** @type {*} */
12035−Object.d4018;
12036−
12037−/** @type {*} */
12038−Object.d4019;
12039−
12040−/** @type {*} */
12041−Object.d4020;
12042−
12043−/** @type {*} */
12044−Object.d4021;
12045−
12046−/** @type {*} */
12047−Object.d4022;
12048−
12049−/** @type {*} */
12050−Object.d4023;
12051−
12052−/** @type {*} */
12053−Object.d4024;
12054−
12055−/** @type {*} */
12056−Object.d4025;
12057−
12058−/** @type {*} */
12059−Object.d4026;
12060−
12061−/** @type {*} */
12062−Object.d4027;
12063−
12064−/** @type {*} */
12065−Object.d4028;
12066−
12067−/** @type {*} */
12068−Object.d4029;
12069−
12070−/** @type {*} */
12071−Object.d4030;
12072−
12073−/** @type {*} */
12074−Object.d4031;
12075−
12076−/** @type {*} */
12077−Object.d4032;
12078−
12079−/** @type {*} */
12080−Object.d4033;
12081−
12082−/** @type {*} */
12083−Object.d4034;
12084−
12085−/** @type {*} */
12086−Object.d4035;
12087−
12088−/** @type {*} */
12089−Object.d4036;
12090−
12091−/** @type {*} */
12092−Object.d4037;
12093−
12094−/** @type {*} */
12095−Object.d4038;
12096−
12097−/** @type {*} */
12098−Object.d4039;
12099−
12100−/** @type {*} */
12101−Object.d4040;
12102−
12103−/** @type {*} */
12104−Object.d4041;
12105−
12106−/** @type {*} */
12107−Object.d4042;
12108−
12109−/** @type {*} */
12110−Object.d4043;
12111−
12112−/** @type {*} */
12113−Object.d4044;
12114−
12115−/** @type {*} */
12116−Object.d4045;
12117−
12118−/** @type {*} */
12119−Object.d4046;
12120−
12121−/** @type {*} */
12122−Object.d4047;
12123−
12124−/** @type {*} */
12125−Object.d4048;
12126−
12127−/** @type {*} */
12128−Object.d4049;
12129−
12130−/** @type {*} */
12131−Object.d4050;
12132−
12133−/** @type {*} */
12134−Object.d4051;
12135−
12136−/** @type {*} */
12137−Object.d4052;
12138−
12139−/** @type {*} */
12140−Object.d4053;
12141−
12142−/** @type {*} */
12143−Object.d4054;
12144−
12145−/** @type {*} */
12146−Object.d4055;
12147−
12148−/** @type {*} */
12149−Object.d4056;
12150−
12151−/** @type {*} */
12152−Object.d4057;
12153−
12154−/** @type {*} */
12155−Object.d4058;
12156−
12157−/** @type {*} */
12158−Object.d4059;
12159−
12160−/** @type {*} */
12161−Object.d4060;
12162−
12163−/** @type {*} */
12164−Object.d4061;
12165−
12166−/** @type {*} */
12167−Object.d4062;
12168−
12169−/** @type {*} */
12170−Object.d4063;
12171−
12172−/** @type {*} */
12173−Object.d4064;
12174−
12175−/** @type {*} */
12176−Object.d4065;
12177−
12178−/** @type {*} */
12179−Object.d4066;
12180−
12181−/** @type {*} */
12182−Object.d4067;
12183−
12184−/** @type {*} */
12185−Object.d4068;
12186−
12187−/** @type {*} */
12188−Object.d4069;
12189−
12190−/** @type {*} */
12191−Object.d4070;
12192−
12193−/** @type {*} */
12194−Object.d4071;
12195−
12196−/** @type {*} */
12197−Object.d4072;
12198−
12199−/** @type {*} */
12200−Object.d4073;
12201−
12202−/** @type {*} */
12203−Object.d4074;
12204−
12205−/** @type {*} */
12206−Object.d4075;
12207−
12208−/** @type {*} */
12209−Object.d4076;
12210−
12211−/** @type {*} */
12212−Object.d4077;
12213−
12214−/** @type {*} */
12215−Object.d4078;
12216−
12217−/** @type {*} */
12218−Object.d4079;
12219−
12220−/** @type {*} */
12221−Object.d4080;
12222−
12223−/** @type {*} */
12224−Object.d4081;
12225−
12226−/** @type {*} */
12227−Object.d4082;
12228−
12229−/** @type {*} */
12230−Object.d4083;
12231−
12232−/** @type {*} */
12233−Object.d4084;
12234−
12235−/** @type {*} */
12236−Object.d4085;
12237−
12238−/** @type {*} */
12239−Object.d4086;
12240−
12241−/** @type {*} */
12242−Object.d4087;
12243−
12244−/** @type {*} */
12245−Object.d4088;
12246−
12247−/** @type {*} */
12248−Object.d4089;
12249−
12250−/** @type {*} */
12251−Object.d4090;
12252−
12253−/** @type {*} */
12254−Object.d4091;
12255−
12256−/** @type {*} */
12257−Object.d4092;
12258−
12259−/** @type {*} */
12260−Object.d4093;
12261−
12262−/** @type {*} */
12263−Object.d4094;
12264−
12265−/** @type {*} */
12266−Object.d4095;
12267−
12268−/** @type {*} */
12269−Object.d4096;
12270−
guides/app-deploy/README.mdnew file+324
@@ -0,0 +1,324 @@
1+# Obelisk Application Deployment Guide
2+
3+This document serves two purposes, the first one is to guide new users that want to deploy Obelisk/Reflex apps and the second one to provide a walk-through for test driving Obelisk releases.
4+
5+> **Note:** This guide can be completed on a Linux host with Nix installed or a macOS host with Nix installed. Each section is labeled regarding which operating system hosts it supports. When going through the guide, start at the beginning and go through all sections that are supported on your host and merely skip sections that are not supported. The sections for iOS deployments require an iPhone or iPad device and the sections for Android deployments require an Android device. This guide assumes that you have Nix correctly set up and that your system is configured to fetch from binary caches instead of building everything on your machine. If you notice any of the commands below takes more than 5 minutes, then caches are not likely enabled.
6+>
7+> Refer to the [Obelisk Installation Documentation](https://github.com/obsidiansystems/obelisk#installing-obelisk) for instructions on configuring the binary caches for any Nix-compatible setup.
8+
9+## a) Get Obelisk (Linux, Mac)
10+
11+There are several ways to install Obelisk, but the one we are going to use here allows us to test a single version of Obelisk in different ways. The approach is to clone Obelisk from its GitHub repository and start a project that uses that local check out.
12+
13+Open a terminal and run the following:
14+
15+```bash
16+export WORKDIR=~/obelisk-guide
17+mkdir -p "$WORKDIR"
18+```
19+
20+Then let's get Obelisk from GitHub using a specific branch:
21+
22+```bash
23+export OBELISK_BRANCH=develop
24+git clone https://github.com/obsidiansystems/obelisk.git -b "$OBELISK_BRANCH" "$WORKDIR/obelisk"
25+```
26+
27+Once you have an Obelisk check out, you can build it using Nix and make a shortcut (alias) for the rest of the terminal session. With this you will be able to type `ob` anywhere as long as you do not close the terminal.
28+
29+```bash
30+alias ob=$(nix-build "$WORKDIR/obelisk" -A command --no-out-link)/bin/ob
31+```
32+
33+In order to start an Obelisk project, we need initialize it in a new directory. Let's call it `myapp`:
34+
35+```bash
36+mkdir -p "$WORKDIR/myapp"
37+cd "$WORKDIR/myapp"
38+ob init --branch "$OBELISK_BRANCH"
39+```
40+
41+> **Note:** If the `--branch` parameter is not used, then Obelisk sets your project up to look at the `master` branch from GitHub. This is quite handy for real life projects but distracting for our test drive since we want to make sure any changes we do to the Obelisk codebase (like testing a pull request) are immediately picked up.
42+
43+## b) Run the Obelisk app on localhost (Linux, Mac)
44+
45+Let's test that we can run a server on localhost. This is quite easy:
46+
47+```bash
48+cd "$WORKDIR/myapp"
49+ob run
50+```
51+
52+Now open a browser and point it to http://localhost:8000 (or just click on this link). You should see the following:
53+
54+![](assets/app-deploy.png)
55+
56+## c) Prepare a VirtualBox deploy target (Linux, Mac)
57+
58+### Import the NixOS VirtualBox appliance
59+
60+Install [VirtualBox](https://www.virtualbox.org/) on your machine.
61+
62+On NixOS, do this by adding the following line to your `/etc/nixos/configuration.nix` before the last line containing `}`:
63+
64+```nix
65+ virtualisation.virtualbox.host.enable = true;
66+```
67+
68+then `sudo nixos-rebuild switch`.
69+
70+The NixOS [download page](https://nixos.org/nixos/download.html) has a section called "VirtualBox appliances". Download that as the target system. The author used the 19.09 `.ova` file.
71+
72+With the downloaded file, open VirtualBox and import the `.ova` file:
73+
74+![](assets/virtualbox-appliance-import.png)
75+
76+Leave the default settings and finish the import. That will take a few minutes:
77+
78+![](assets/virtualbox-appliance-import-loading.png)
79+
80+You should now see a NixOS machine in the dashboard:
81+
82+![](assets/virtualbox-dashboard-nixos.png)
83+
84+If you are on a network with DHCP on your wireless or network card then right-click on the "NixOS" image and click "Settings". Go to the "Network" section and make "Attached to:" set to "Bridged Adapter".
85+
86+![](assets/virtualbox-image-settings-network.png)
87+
88+Finally, double-click on the "NixOS" machine and wait for it boot up. If it asks for a password, use `demo`.
89+
90+![](assets/virtualbox-nioxs-after-boot.png)
91+
92+### Configure the virtual machine for SSH
93+
94+Inside the virtual machine open up "Konsole" by clicking on the start menu in the bottom left corner and typing in "Konsole" until you see it as an option in the menu. Then click on it to open it.
95+
96+Change the system configuration using `sudo` to enable SSH access:
97+
98+```bash
99+sudo nano /etc/nixos/configuration.nix
100+```
101+
102+This will ask you to enter your password. Enter `demo`.
103+
104+![](assets/nano-edit-nixos-configuration.png)
105+
106+You need to add the following snippet right before the final line containing `}`.
107+
108+```nix
109+ services.openssh.enable = true;
110+ services.openssh.permitRootLogin = "yes";
111+```
112+
113+Save and close the editor by typing <kbd>Ctrl</kbd>+<kbd>O</kbd>, <kbd>Enter</kbd>, and then <kbd>Ctrl</kbd>+<kbd>X</kbd>.
114+
115+Now run `sudo nixos-rebuild switch` (if it asks for a password, again use `demo`) and then set the root password using `sudo passwd root`. Pick a simple password like `root`. You'll need to use it again.
116+
117+To get the virtual machine's IP address go back to the terminal on your *host* machine (not the virtual machine) and run:
118+
119+```bash
120+export VM_ID=$(VBoxManage list runningvms | grep "NixOS" | awk -F'[{}]' '{print $2}')
121+echo "$VM_ID"
122+```
123+
124+You should see a single identifier that looks like `388bbbe5-e0a2-4b20-9c76-bbaa5746682e`. If you see anything else then you likely you have multiple NixOS machines running. Stop any other machines and run this command again. (Of course, if you're a power user, just change the `grep` to pick out right VM.)
125+
126+Now get the IP address for that machine:
127+
128+```bash
129+export VM_IP=$(VBoxManage guestproperty enumerate "$VM_ID" | grep /V4/IP | awk '{print $4}' | sed 's/,//')
130+echo "$VM_IP"
131+```
132+
133+You should see an IP like `192.168.7.86`.
134+
135+With that you will be able to SSH into that machine from a terminal, using the username `root`.
136+
137+```bash
138+ssh root@$VM_IP echo "Access granted"
139+```
140+
141+This may ask if you want to trust the fingerprint for this server. Answer `yes`. It will ask you for a password. Enter the one you specified above. You should see `Access granted` printed after you type your password and hit <kbd>Enter</kbd>.
142+
143+> **Note:** If instead you see an error like this
144+>
145+> ```
146+> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
147+> @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
148+> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
149+> IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
150+> Someone could be eavesdropping on you right now (man-in-the-middle attack)!
151+> It is also possible that a host key has just been changed.
152+> ```
153+>
154+> you need to remove the old fingerprint for this IP. Run the following:
155+>
156+> ```bash
157+> sed -i "/^$VM_IP /d" ~/.ssh/known_hosts
158+> ```
159+>
160+> and then try the previous `ssh` command again.
161+
162+Now we'll allow access with an SSH key instead of a password. Create a new SSH key with `ssh-keygen`:
163+
164+```bash
165+ssh-keygen -t ed25519 -f "$WORKDIR/obkey" -P ""
166+```
167+
168+Now copy your local SSH key to the server:
169+
170+```bash
171+ssh-copy-id -i "$WORKDIR/obkey.pub" root@$VM_IP
172+```
173+
174+This will ask you for your password again.
175+
176+Now test login with your key instead:
177+
178+```bash
179+ssh -i "$WORKDIR/obkey" root@$VM_IP echo "Access granted"
180+```
181+
182+This should print `Access granted` *without* asking for a password.
183+
184+### Configure the git remote
185+
186+Before the project can be deployed, it needs to be a valid `git` repository.
187+
188+> **Note:** You need `git` installed and configured. You can do that with:
189+>
190+> ```bash
191+> nix-env -i git
192+> git config --global user.name "John Doe"
193+> git config --global user.email johndoe@example.com
194+> ```
195+
196+```bash
197+git init --bare "$WORKDIR/myapp-git-remote"
198+cd "$WORKDIR/myapp"
199+git init
200+git add --all
201+git commit -m "initial commit"
202+git remote add origin "$WORKDIR/myapp-git-remote"
203+git push -u origin master
204+```
205+
206+### Initialize deployment directory
207+
208+With that, we can come back to the Obelisk app and initialize the deployment:
209+
210+```bash
211+cd "$WORKDIR/myapp"
212+ob deploy init --ssh-key "$WORKDIR/obkey" --admin-email a@a.a --hostname $VM_IP --route https://$VM_IP "$WORKDIR/myappdeploy" --disable-https
213+```
214+
215+Then configure the deployment for VirtualBox:
216+
217+```bash
218+echo '{nixosPkgs, ...}: {...}: { imports = [ (nixosPkgs.path + /nixos/modules/virtualisation/virtualbox-image.nix) ]; }' > "$WORKDIR/myappdeploy/module.nix"
219+```
220+
221+## d) Deploy to VirtualBox target (Linux only)
222+
223+> Deploying requires a Linux host in order to build the Linux binaries.
224+
225+Now we can deploy to the VirtualBox VM.
226+
227+```bash
228+cd "$WORKDIR/myappdeploy"
229+ob deploy push -v
230+```
231+
232+Once that is complete, open the webpage with
233+
234+```bash
235+xdg-open http://$VM_IP
236+```
237+
238+If that fails, just get the URL by running
239+
240+```bash
241+echo http://$VM_IP
242+```
243+
244+and copy/paste that URL into your browser navigation input.
245+
246+It should look like this:
247+
248+![](assets/app-deploy-2.png)
249+
250+Congratulations! You have deployed an Obelisk application to a remote server via SSH.
251+
252+## e) Deploy an Android app (Linux only)
253+
254+> **Note:** This section requires that you be running a Linux *host*.
255+
256+Modify `$WORKDIR/myapp/default.nix` to set `config.android_sdk.accept_license = true;` and then update your app.
257+
258+```bash
259+cd "$WORKDIR/myapp"
260+sed -i 's/# config.android_sdk.accept_license = false;/config.android_sdk.accept_license = true;/g' default.nix
261+git add default.nix
262+git commit -m"Accept license"
263+git push
264+```
265+
266+Make sure *USB debugging* is enabled in your Android device ([instructions here](https://developer.android.com/studio/debug/dev-options)) and connect the device using USB. Be sure to confirm any security prompts on the device.
267+
268+Now update your deployment and deploy to Android:
269+
270+```bash
271+cd "$WORKDIR/myappdeploy"
272+ob deploy update
273+ob deploy test android -v
274+```
275+
276+This deployment will ask you to create a password (at least 6 characters long) and then ask you a series of questions. You can pick arbitrary answers. When you are presented with prompt like:
277+
278+```
279+Is CN=a, OU=b, O=c, L=d, ST=e, C=f correct?
280+ [no]:
281+```
282+
283+You can enter `yes` to continue. If the deployment fails, try using different USB ports on your computer and running `ob deploy test android -v` again. The USB cable you use can also make a difference.
284+
285+When connecting your Android device you may be asked to "Allow USB debugging". You need to allow it.
286+![](assets/android-confirm-usb-debugging.jpg)
287+
288+
289+When the deployment is complete opening the app should look something like
290+
291+![](assets/android-app.jpg)
292+
293+Congratulations! You have deployed an Obelisk Android app via USB.
294+
295+## f) Deploy an iOS app (Mac only)
296+
297+> **Note:** This section requires that you be running a macOS *host*.
298+
299+Verify that you can see the device from XCode and you have installed a Provisioning profile that links your Apple Developer Id and the Device identifier. The workflow depends on whether or not you are an independent developer or part of an organization and is out of scope for this manual.
300+
301+![](assets/xcode-devices.png)
302+
303+Find your `Team ID` at the following URL (Apple Developer Membership details): https://developer.apple.com/account/#/membership/
304+
305+It will be something like `5B445B3WY1`. With that, you can start the deployment workflow after plugging in an iPhone or iPad via USB and setting it to trust the computer:
306+
307+```bash
308+cd "$WORKDIR/myappdeploy"
309+ob deploy test ios <TEAM-ID> # Use your Team ID here
310+```
311+
312+![](assets/ios-deploy-keychain.png)
313+
314+![](assets/ios-deploy-example.png)
315+
316+If there are no errors and the last line says `100% Installed Package` you can open the device and look for the Obelisk app:
317+
318+![](assets/ios-obelisk-app-icon.jpg)
319+
320+![](assets/ios-obelisk-app-open.jpg)
321+
322+Congratulations, you have deployed an Obelisk app on an iOS device.
323+
324+You are now ready to create your own multi-platform application using Obelisk!
guides/app-deploy/assets/android-app.jpgnew file

Binary file not shown.

guides/app-deploy/assets/android-confirm-usb-debugging.jpgnew file

Binary file not shown.

guides/app-deploy/assets/app-deploy-2.pngnew file

Binary file not shown.

guides/app-deploy/assets/app-deploy.pngnew file

Binary file not shown.

guides/app-deploy/assets/ios-deploy-example.pngnew file

Binary file not shown.

guides/app-deploy/assets/ios-deploy-keychain.pngnew file

Binary file not shown.

guides/app-deploy/assets/ios-obelisk-app-icon.jpgnew file

Binary file not shown.

guides/app-deploy/assets/ios-obelisk-app-open.jpgnew file

Binary file not shown.

guides/app-deploy/assets/nano-edit-nixos-configuration.pngnew file

Binary file not shown.

guides/app-deploy/assets/virtualbox-appliance-import-loading.pngnew file

Binary file not shown.

guides/app-deploy/assets/virtualbox-appliance-import.pngnew file

Binary file not shown.

guides/app-deploy/assets/virtualbox-dashboard-nixos.pngnew file

Binary file not shown.

guides/app-deploy/assets/virtualbox-image-settings-network.pngnew file

Binary file not shown.

guides/app-deploy/assets/virtualbox-nioxs-after-boot.pngnew file

Binary file not shown.

guides/app-deploy/assets/xcode-devices.pngnew file

Binary file not shown.

haskell-overlays/ghcide.nixnew file+40
@@ -0,0 +1,40 @@
1+self: super:
2+let
3+ pkgs = self.callPackage ({ pkgs }: pkgs) { };
4+ inherit (pkgs.haskell.lib) dontCheck justStaticExecutables;
5+ inherit (pkgs.haskellPackages) callHackageDirect callHackage;
6+
7+in {
8+ ghcide = justStaticExecutables (dontCheck (callHackageDirect {
9+ pkg = "ghcide";
10+ ver = "0.2.0";
11+ sha256 = "199l4qzrghhz6wbfkgqdl4gll4wvgpr190kinzhv88idnn9pxm96";
12+ } rec {
13+ ghc-check = callHackageDirect {
14+ pkg = "ghc-check";
15+ ver = "0.3.0.1";
16+ sha256 = "1dj909m09m24315x51vxvcl28936ahsw4mavbc53danif3wy09ns";
17+ } { };
18+ lsp-test = dontCheck (callHackage "lsp-test" "0.6.1.0" { });
19+ haddock-library = dontCheck (callHackage "haddock-library" "1.8.0" { });
20+ haskell-lsp = dontCheck (callHackageDirect {
21+ pkg = "haskell-lsp";
22+ ver = "0.22.0.0";
23+ sha256 = "1q3w46qcvzraxgmw75s7bl0qvb2fvff242r5vfx95sqska566b4m";
24+ } { inherit haskell-lsp-types; });
25+ haskell-lsp-types = dontCheck (callHackageDirect {
26+ pkg = "haskell-lsp-types";
27+ ver = "0.22.0.0";
28+ sha256 = "1apjclphi2v6ggrdnbc0azxbb1gkfj3x1vkwpc8qd6lsrbyaf0n8";
29+ } { });
30+ regex-tdfa = dontCheck (callHackage "regex-tdfa" "1.3.1.0" {
31+ regex-base = dontCheck (callHackage "regex-base" "0.94.0.0" { });
32+ });
33+ shake = dontCheck (callHackage "shake" "0.18.4" { });
34+ hie-bios = dontCheck (callHackageDirect {
35+ pkg = "hie-bios";
36+ ver = "0.5.0";
37+ sha256 = "116nmpva5jmlgc2dgy8cm5wv6cinhzmga1l0432p305074w720r2";
38+ } { });
39+ }));
40+}
haskell-overlays/misc-deps.nixnew file+26
@@ -0,0 +1,26 @@
1+{ hackGet }:
2+
3+# Fix misc upstream packages
4+self: super:
5+
6+let
7+ pkgs = self.callPackage ({ pkgs }: pkgs) {};
8+ haskellLib = pkgs.haskell.lib;
9+in
10+
11+{
12+ regex-base = self.callHackage "regex-base" "0.94.0.0" {};
13+ regex-posix = self.callHackage "regex-posix" "0.96.0.0" {};
14+ regex-tdfa = self.callHackage "regex-tdfa" "1.3.1.0" {};
15+ test-framework = haskellLib.dontCheck (self.callHackage "test-framework" "0.8.2.0" {});
16+ hnix = haskellLib.dontCheck (self.callHackage "hnix" "0.8.0" {});
17+ hnix-store-core = self.callHackage "hnix-store-core" "0.2.0.0" {};
18+
19+ aeson-gadt-th = self.callHackage "aeson-gadt-th" "0.2.4" {};
20+
21+ ghcid = self.callCabal2nix "ghcid" (hackGet ../dep/ghcid) {};
22+ # Exports more internals
23+ snap-core = haskellLib.dontCheck (self.callCabal2nix "snap-core" (hackGet ../dep/snap-core) {});
24+
25+ shelly = self.callHackage "shelly" "1.9.0" {};
26+}
haskell-overlays/obelisk.nixnew file+48
@@ -0,0 +1,48 @@
1+# Add obelisk packages
2+
3+self: super:
4+
5+let
6+ pkgs = self.callPackage ({ pkgs }: pkgs) {};
7+ inherit (pkgs) obeliskCleanSource;
8+ haskellLib = pkgs.haskell.lib;
9+ onLinux = pkg: f: if pkgs.stdenv.isLinux then f pkg else pkg;
10+in
11+
12+{
13+ obelisk-executable-config-inject = pkgs.obeliskExecutableConfig.platforms.web.inject self;
14+
15+ obelisk-asset-manifest = self.callCabal2nix "obelisk-asset-manifest" (obeliskCleanSource ../lib/asset/manifest) {};
16+ obelisk-asset-serve-snap = self.callCabal2nix "obelisk-asset-serve-snap" (obeliskCleanSource ../lib/asset/serve-snap) {};
17+ obelisk-backend = self.callCabal2nix "obelisk-backend" (obeliskCleanSource ../lib/backend) {};
18+ obelisk-cliapp = self.callCabal2nix "obelisk-cliapp" (obeliskCleanSource ../lib/cliapp) {};
19+ obelisk-command = haskellLib.overrideCabal (self.callCabal2nix "obelisk-command" (obeliskCleanSource ../lib/command) {}) {
20+ librarySystemDepends = [
21+ pkgs.jre
22+ pkgs.git
23+ pkgs.nix
24+ pkgs.nix-prefetch-git
25+ pkgs.openssh
26+ pkgs.rsync
27+ pkgs.which
28+ (haskellLib.justStaticExecutables self.ghcid)
29+ ];
30+ };
31+ obelisk-frontend = self.callCabal2nix "obelisk-frontend" (obeliskCleanSource ../lib/frontend) {};
32+ obelisk-run = onLinux (self.callCabal2nix "obelisk-run" (obeliskCleanSource ../lib/run) {}) (pkg:
33+ haskellLib.overrideCabal pkg (drv: { librarySystemDepends = [ pkgs.iproute ]; })
34+ );
35+ obelisk-route = self.callCabal2nix "obelisk-route" (obeliskCleanSource ../lib/route) {};
36+ obelisk-selftest = haskellLib.overrideCabal (self.callCabal2nix "obelisk-selftest" (obeliskCleanSource ../lib/selftest) {}) {
37+ librarySystemDepends = [
38+ pkgs.cabal-install
39+ pkgs.coreutils
40+ pkgs.git
41+ pkgs.nix
42+ pkgs.nix-prefetch-git
43+ pkgs.rsync
44+ ];
45+ };
46+ obelisk-snap-extras = self.callCabal2nix "obelisk-snap-extras" (obeliskCleanSource ../lib/snap-extras) {};
47+ tabulation = self.callCabal2nix "tabulation" (obeliskCleanSource ../lib/tabulation) {};
48+}
haskell-overlays/tighten-ob-exes.nixnew file+32
@@ -0,0 +1,32 @@
1+self: super:
2+
3+let
4+ pkgs = self.callPackage ({ pkgs }: pkgs) {};
5+ haskellLib = pkgs.haskell.lib;
6+
7+ commandRuntimeDeps = with pkgs; [
8+ coreutils
9+ git
10+ nix-prefetch-git
11+ openssh
12+ ];
13+in
14+
15+{
16+ # Dynamic linking with split objects dramatically increases startup time (about
17+ # 0.5 seconds on a decent machine with SSD), so we do `justStaticExecutables`.
18+ obelisk-command = haskellLib.overrideCabal
19+ (haskellLib.generateOptparseApplicativeCompletion "ob"
20+ (haskellLib.justStaticExecutables super.obelisk-command))
21+ (drv: {
22+ buildTools = (drv.buildTools or []) ++ [ pkgs.buildPackages.makeWrapper ];
23+ postFixup = ''
24+ ${drv.postFixup or ""}
25+ # Make `ob` reference its runtime dependencies.
26+ wrapProgram "$out"/bin/ob --prefix PATH : ${pkgs.lib.makeBinPath commandRuntimeDeps}
27+ '';
28+ passthru = { inherit commandRuntimeDeps; };
29+ });
30+
31+ obelisk-selftest = haskellLib.justStaticExecutables super.obelisk-selftest;
32+}
hydra.jsonnew file+29
@@ -0,0 +1,29 @@
1+{
2+ "enabled": 1,
3+ "hidden": true,
4+ "description": "Jobsets",
5+ "nixexprinput": "src",
6+ "nixexprpath": "jobsets.nix",
7+ "checkinterval": 300,
8+ "schedulingshares": 100,
9+ "enableemail": false,
10+ "emailoverride": "",
11+ "keepnr": 10,
12+ "inputs": {
13+ "src": {
14+ "type": "git",
15+ "value": "https://github.com/obsidiansystems/obelisk.git master",
16+ "emailresponsible": false
17+ },
18+ "nixpkgs": {
19+ "type": "git",
20+ "value": "https://github.com/NixOS/nixpkgs-channels nixos-unstable",
21+ "emailresponsible": false
22+ },
23+ "prs": {
24+ "type": "githubpulls",
25+ "value": "obsidiansystems obelisk",
26+ "emailresponsible": false
27+ }
28+ }
29+}
lib/README.md+3−1
@@ -1 +1,3 @@
1−Libraries provided by obelisk
1+# Obelisk libraries
2+
3+This directory contains libraries provided by obelisk. By convention they are prefixed with `obelisk-` and their module exports all lie within the `Obelisk` import namespace. For example, to include `cliapp` as a dependency you would add `obelisk-cliapp` to your cabal dependencies, and import `Obelisk.CliApp...` in the source files.
lib/asset/README.md+17−20
@@ -1,29 +1,26 @@
1−## obelisk-asset
1+# obelisk-asset
22
3−The 'assets.nix' file contains nix expressions that are a mutually
4−recursive set of attributes used to create static asset directories
5−with hashable file encodings. This file should be incorporated within
6−your project's 'default.nix' file. (See ./example/default.nix , line 2)
7−```
8−{assets ? import ./../assets.nix { inherit nixpkgs; }
9−}:
10−```
3+[![Haskell Programming Language](https://img.shields.io/badge/language-Haskell-blue.svg)](http://www.haskell.org)
4+[![BSD3 License](http://img.shields.io/badge/license-BSD3-brightgreen.svg)](https://github.com/obsidiansystems/obelisk/blob/master/LICENSE)
115
12−The 'mkAssets' and 'mkAssetsWith' functions within 'assets.nix' only
13−need to be passed an encoding('zopfliEncodings', 'gzipEncodings',
14−'noEncodings') and a static directory of your choice as arguments.
6+**Efficiently served, aggressively cached static web resources.**
157
16−In this example, 'mkAssets' is used on a directory that has a .png
17−file inside of it. (See ./example/default.nix, line 11)
8+The `assets.nix` file contains nix expressions that are a mutually recursive set of attributes used to create static asset directories with hashable file encodings. This file should be incorporated within your project's `default.nix` file. (See `example/default.nix`, line 2)
9+
10+```nix
11+{ assets ? import ./../assets.nix { inherit nixpkgs; } }:
1812```
19−myAssets = assets.mkAssets ./static;
13+
14+The `mkAssets` and `mkAssetsWith` functions within `assets.nix` only need to be passed an `encoding("zopfliEncodings", "gzipEncodings", "noEncodings")` and a static directory of your choice as arguments.
15+
16+In this example, `mkAssets` is used on a directory that has a `.png` file inside of it. (See `example/default.nix`, line 11)
17+
18+```nix
19+myAssets = assets.mkAssets ./static;
2020```
2121
22−Once you have successfully incorporated 'assets.nix' into your
23−project's nix file(s), use nix-build to generate a symlink of
24−your 'mkAssets' expression. The following command from
25−example/run-example (line 3) will generate an immutable symlink
26−that holds hashed static assets.
22+Once you have successfully incorporated `assets.nix` into your project's nix file(s), use `nix-build` to generate a symlink of your `mkAssets` expression. The following command from `example/run-example` (line 3) will generate an immutable symlink that holds hashed static assets.
23+
2724```bash
2825nix-build -o static.assets -A myAssets
2926```
lib/asset/assets.nix+28−5
@@ -20,7 +20,7 @@ zopfliEncodings = file:
2020 nixpkgs.stdenv.mkDerivation {
2121 name = "encodings";
2222
23− input = file;
23+ input = mkPath file;
2424
2525 builder = builtins.toFile "builder.sh" ''
2626 source "$stdenv/setup"
@@ -46,7 +46,7 @@ gzipEncodings = file:
4646 nixpkgs.stdenv.mkDerivation {
4747 name = "encodings";
4848
49− input = file;
49+ input = mkPath file;
5050
5151 builder = builtins.toFile "builder.sh" ''
5252 source "$stdenv/setup"
@@ -70,7 +70,7 @@ noEncodings = file:
7070 nixpkgs.stdenv.mkDerivation {
7171 name = "encodings";
7272
73− input = file;
73+ input = mkPath file;
7474
7575 builder = builtins.toFile "builder.sh" ''
7676 source "$stdenv/setup"
@@ -203,7 +203,7 @@ hashFile = path:
203203 nixpkgs.nix
204204 ];
205205 preferLocalBuild = true;
206− inherit path;
206+ path = mkPath path;
207207 } ''
208208 nix-hash --flat --base32 --type sha256 "$path" | tr -d '\n' >"$out"
209209 '');
@@ -224,7 +224,30 @@ symlink = path: {
224224 inherit path;
225225};
226226
227−# Given a encoding generation function and a file entry resulting from readDirRecursive in the form { name :: String, value: { path :: String } },
227+# Tests if a given character (string of length 1) is valid for a derivation path name.
228+# Passing a string of length other than 1 is undefined.
229+# :: Char -> Bool
230+isValidDrvNameChar = c: "a" <= c && c <= "z" || "A" <= c && c <= "Z" || "0" <= c && c <= "9" || c == "+" || c == "-" || c == "_" || c == "?" || c == "=" || c == ".";
231+
232+# Convert a string into a string that could be used in a derivation name.
233+# replacement lets you choose how to replace invalid characters. It may be any length.
234+# If it contains invalid characters then the result will also be invalid.
235+# :: { str :: String, replacement :: String } -> String
236+mkValidDrvName = { str, replacement ? "?" }:
237+ let
238+ newName = stringAsChars (c: if isValidDrvNameChar c then c else replacement) str;
239+ in if builtins.substring 0 1 newName == "." then "_" + newName else newName;
240+
241+# Like builtins.path but always ensures the name is valid.
242+mkPath = path:
243+ if builtins.typeOf path == "path" # Don't mess with non-paths
244+ then builtins.path {
245+ inherit path;
246+ name = mkValidDrvName { str = builtins.baseNameOf path; };
247+ }
248+ else path;
249+
250+# Given an encoding generation function and a file entry resulting from readDirRecursive in the form { name :: String, value: { path :: String } },
228251# build a DirEntry for dirToPath with the various encodings of the asset for dirToPath to build into a final directory tree.
229252mkAsset = encodings: {name, value}:
230253 let nameWithHash = "${hashFile value.path}-${name}";
lib/asset/manifest/obelisk-asset-manifest.cabal+5−2
@@ -17,13 +17,14 @@ library
1717 base
1818 , bytestring
1919 , containers
20+ , deepseq
2021 , directory
2122 , SHA
2223 , filepath
2324 , template-haskell
2425 , text
2526 , transformers
26− , unix
27+ , unix-compat
2728 , vector
2829 exposed-modules:
2930 Obelisk.Asset.Gather
@@ -32,7 +33,9 @@ library
3233 Obelisk.Asset.TH
3334
3435 other-extensions: TemplateHaskell
35− ghc-options: -Wall -Werror -fno-warn-unused-do-bind -fwarn-tabs -funbox-strict-fields -O2 -fprof-auto-calls
36+ ghc-options:
37+ -Wall -Werror -Wredundant-constraints -Wincomplete-uni-patterns -Wincomplete-record-updates -O2
38+ -fno-warn-unused-do-bind -funbox-strict-fields -fprof-auto-calls
3639
3740executable obelisk-asset-manifest-generate
3841 hs-source-dirs: src-bin
lib/asset/manifest/src/Obelisk/Asset/Gather.hs+5−3
@@ -1,10 +1,12 @@
11{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE BangPatterns #-}
23-- | Functions for collecting up files to be processed by the asset pipeline
34module Obelisk.Asset.Gather
45 ( gatherHashedPaths
56 , toHashedPath
67 ) where
78
9+import Control.DeepSeq
810import Control.Monad (forM)
911import Data.Bits
1012import qualified Data.ByteString.Lazy as LBS
@@ -13,7 +15,6 @@ import Data.Char
1315import Data.Digest.Pure.SHA
1416import Data.Map (Map)
1517import qualified Data.Map as Map
16−import Data.Monoid
1718import qualified Data.Text as T
1819import Data.Text.Encoding
1920import qualified Data.Vector.Unboxed as UV
@@ -34,7 +35,7 @@ gatherHashedPaths root = go ""
3435 let relativePath = subdir </> sub
3536 isFile <- doesFileExist $ root </> relativePath
3637 if isFile
37− then do hashedRelativePath <- toHashedPath root relativePath
38+ then do !hashedRelativePath <- force <$> toHashedPath root relativePath
3839 return $ Map.singleton relativePath hashedRelativePath
3940 else go relativePath
4041
@@ -48,7 +49,8 @@ toHashedPath root relativePath = do
4849 contents <- LBS.readFile path
4950 let hashPrefix = T.unpack $ decodeUtf8 $ LBS.toStrict $ toNixBase32 $ bytestringDigest $ sha256 contents
5051 (dir, filename) = splitFileName relativePath
51− return $ normalise $ dir </> (hashPrefix <> "-" <> filename)
52+ !hashedRelativePath = force $ normalise $ dir </> (hashPrefix <> "-" <> filename)
53+ return hashedRelativePath
5254
5355-- | Convert a ByteString to base 32 in the way that Nix does
5456toNixBase32 :: LBS.ByteString -> LBS.ByteString
lib/asset/manifest/src/Obelisk/Asset/Promoted.hs+15−5
@@ -10,6 +10,7 @@ module Obelisk.Asset.Promoted
1010import Obelisk.Asset.Gather
1111
1212import Data.Foldable
13+import qualified Data.List as L
1314import Language.Haskell.TH (runQ, pprint)
1415import Language.Haskell.TH.Syntax hiding (lift)
1516import GHC.TypeLits
@@ -18,7 +19,6 @@ import qualified Data.Sequence as Seq
1819import Control.Monad.Trans.Writer
1920import System.FilePath
2021import System.Directory
21−import Data.Monoid
2222import Data.Text (Text)
2323import qualified Data.Text as T
2424import qualified Data.Text.IO as T
@@ -32,11 +32,15 @@ data StaticConfig = StaticConfig
3232
3333writeStaticProject :: Map FilePath FilePath -> FilePath -> StaticConfig -> IO ()
3434writeStaticProject paths target cfg = do
35− createDirectoryIfMissing True $ target </> "src"
35+ createDirectoryIfMissing True target
3636 T.writeFile (target </> T.unpack (_staticConfig_packageName cfg) <.> "cabal") $ staticCabalFile cfg
3737 let modName = _staticConfig_moduleName cfg
38+ (modName', moduleDirPath) = case L.uncons (reverse $ T.splitOn "." modName) of
39+ Nothing -> error $ "writeStaticProject: invalid module name " <> T.unpack modName
40+ Just (name, parents) -> (name, target </> "src" </> T.unpack (T.intercalate "/" $ reverse parents))
41+ createDirectoryIfMissing True moduleDirPath
3842 modContents <- staticModuleFile modName paths
39− T.writeFile (target </> "src" </> T.unpack modName <.> "hs") modContents
43+ T.writeFile (moduleDirPath </> T.unpack modName' <.> "hs") modContents
4044
4145staticCabalFile :: StaticConfig -> Text
4246staticCabalFile cfg = T.unlines
@@ -63,11 +67,17 @@ staticModuleFile moduleName paths = do
6367 , "{-# LANGUAGE FlexibleInstances #-}"
6468 , "{-# LANGUAGE KindSignatures #-}"
6569 , "{-# LANGUAGE OverloadedStrings #-}"
70+ , "{-# LANGUAGE ScopedTypeVariables #-}"
71+ , "{-# LANGUAGE TypeApplications #-}"
6672 , "module " <> moduleName <> " where"
6773 , ""
6874 , "import qualified GHC.Types"
69− , "import Data.Text ()"
75+ , "import Data.Text (Text)"
7076 , "import qualified Data.Text.Internal"
77+ , "import Data.Monoid ((<>))"
78+ , ""
79+ , "static :: forall a. StaticFile a => Text"
80+ , "static = \"static/\" <> hashedPath @a" --TODO: Use obelisk-route to generate this in a more consistent way
7181 , ""
7282 , T.pack $ pprint decs
7383 ]
@@ -96,7 +106,7 @@ staticClass :: WriterT (Seq Dec) Q StaticContext
96106staticClass = do
97107 let n x = Name (OccName x) NameS
98108 className = n "StaticFile"
99− methodName = n "static"
109+ methodName = n "hashedPath"
100110 cls = ClassD [] className [KindedTV (n "s") (ConT ''Symbol)] [] [SigD methodName (ConT ''Text)]
101111 tell $ Seq.singleton cls
102112 return $ StaticContext
lib/asset/manifest/src/Obelisk/Asset/Symlink.hs+1−1
@@ -7,7 +7,7 @@ import Data.Map (Map)
77import qualified Data.Map as Map
88import System.Directory
99import System.FilePath.Posix
10−import System.Posix.Files
10+import System.PosixCompat.Files
1111
1212-- | Copy the given hashed files from one location to hashed paths in another
1313-- location, and symlink the unhashed paths to the hashed ones
lib/asset/serve-snap/obelisk-asset-serve.cabal → lib/asset/serve-snap/obelisk-asset-serve-snap.cabalrenamed+4−2
@@ -23,10 +23,12 @@ library
2323 , obelisk-snap-extras
2424 , text
2525 , transformers
26− , unix
26+ , unix-compat
2727 exposed-modules:
2828 Obelisk.Asset.Accept
2929 Obelisk.Asset.Serve.Snap
3030
3131 other-extensions: TemplateHaskell
32− ghc-options: -Wall -Werror -fno-warn-unused-do-bind -fwarn-tabs -funbox-strict-fields -O2 -fprof-auto-calls
32+ ghc-options:
33+ -Wall -Werror -Wredundant-constraints -Wincomplete-uni-patterns -Wincomplete-record-updates -O2
34+ -fno-warn-unused-do-bind -funbox-strict-fields -fprof-auto-calls
lib/asset/serve-snap/src/Obelisk/Asset/Accept.hs+6−6
@@ -136,16 +136,16 @@ qvalue = do
136136 skipMany lws
137137 q0 <|> q1
138138 where q0 = do
139− char '0'
139+ _ <- char '0'
140140 decimals <- option [] $ do
141− char '.'
141+ _ <- char '.'
142142 starRule (Just 0) (Just numAllowedDigits) digit
143143 return $ QValue $ MkFixed $ fromIntegral $ (read ('0' : decimals) :: Int) * 10 ^ (numAllowedDigits - length decimals)
144144 q1 = do
145− char '1'
145+ _ <- char '1'
146146 option () $ do
147− char '.'
148− starRule (Just 0) (Just numAllowedDigits) $ char '0'
147+ _ <- char '.'
148+ _ <- starRule (Just 0) (Just numAllowedDigits) $ char '0'
149149 return ()
150150 return $ QValue 1
151151 numAllowedDigits :: Int
@@ -232,7 +232,7 @@ hashRule minNum maxNum element = do
232232lws :: Parser ()
233233lws = do
234234 option () $ cr >> lf
235− starRule (Just 1) Nothing $ sp <|> ht
235+ _ <- starRule (Just 1) Nothing $ sp <|> ht
236236 return ()
237237
238238-- | See http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2
lib/asset/serve-snap/src/Obelisk/Asset/Serve/Snap.hs+22−11
@@ -12,13 +12,15 @@ import Obelisk.Asset.Accept (Encoding (..), acceptEncodingBody, chooseEncoding,
1212import Obelisk.Snap.Extras
1313
1414import Snap
15− (MonadSnap, getHeader, getsRequest, modifyResponse, pass, redirect, sendFile, setContentLength, setContentType, setHeader, setResponseCode)
15+ (MonadSnap, getHeader, getRequest, getsRequest, modifyResponse, pass, redirect, sendFile, setContentLength, setContentType, setHeader, setResponseCode)
1616import Snap.Util.FileServe (defaultMimeTypes, fileType, getSafePath, serveFile)
17+import Snap.Internal.Util.FileServe (checkRangeReq)
1718
1819import Control.Applicative ((<|>))
1920import Control.Exception (handleJust, try, throwIO)
20−import Control.Monad (forM, liftM)
21+import Control.Monad (forM, liftM, unless)
2122import Control.Monad.IO.Class (liftIO)
23+import Control.Monad.Fail (MonadFail)
2224import Data.Attoparsec.ByteString (parseOnly, endOfInput)
2325import Data.ByteString (ByteString)
2426import qualified Data.ByteString as BS
@@ -29,7 +31,7 @@ import Data.Text.Encoding (decodeUtf8, encodeUtf8)
2931import System.Directory (getDirectoryContents)
3032import System.FilePath ((</>), splitFileName, takeDirectory)
3133import System.IO.Error (isDoesNotExistError)
32−import System.Posix (getFileStatus, fileSize)
34+import System.PosixCompat.Files (getFileStatus, fileSize)
3335
3436-- | Serve static assets from an asset directory generated via @assets.nix@ or, failing that, from a regular directory.
3537--
@@ -38,7 +40,7 @@ import System.Posix (getFileStatus, fileSize)
3840-- current version of the asset
3941-- (e.g. @0rx5yvkkgkig2pcqf4ngi1l7vh89qqajdzc6aiayaibyhvj0d853-test.png@). Hashed
4042-- asset names will be sent with permanent caching headers.
41−serveAssets :: MonadSnap m => FilePath -> FilePath -> m ()
43+serveAssets :: (MonadSnap m, MonadFail m) => FilePath -> FilePath -> m ()
4244serveAssets = serveAssets' True
4345
4446-- | Serve static assets from an asset directory generated via @assets.nix@ or, failing that, from a regular directory.
@@ -47,15 +49,15 @@ serveAssets = serveAssets' True
4749-- browser for the logical asset name (e.g. @test.png@) but instead the current
4850-- version of the asset with to point the browser at the unique filename for the
4951-- current version of the asset.
50−serveAssetsInPlace :: MonadSnap m => FilePath -> FilePath -> m ()
52+serveAssetsInPlace :: (MonadSnap m, MonadFail m) => FilePath -> FilePath -> m ()
5153serveAssetsInPlace = serveAssets' False
5254
5355-- | Like 'serveAssets', but only serves a single specified asset
54−serveAsset :: MonadSnap m => FilePath -> FilePath -> FilePath -> m ()
56+serveAsset :: (MonadSnap m, MonadFail m) => FilePath -> FilePath -> FilePath -> m ()
5557serveAsset = serveAsset' True
5658
5759-- | Like 'serveAssetsInPlace', but only serves a single specified asset
58−serveAssetInPlace :: MonadSnap m => FilePath -> FilePath -> FilePath -> m ()
60+serveAssetInPlace :: (MonadSnap m, MonadFail m) => FilePath -> FilePath -> FilePath -> m ()
5961serveAssetInPlace = serveAsset' False
6062
6163-- | Serve static assets from an asset directory generated via @assets.nix@ or, failing that, from a regular directory.
@@ -63,13 +65,13 @@ serveAssetInPlace = serveAsset' False
6365-- For assets generated from @assets.nix@, the @Bool@ argument @doRedirect@ controls whether redirects will be sent to the browser if a request is made for
6466-- an unhashed asset name, e.g. @test.png@. For @True@, a redirect will be sent, yielding more round trips to the server but better caching behavior if the
6567-- asset doesn't change often. Conversely for @False@, the asset will be served "in place" but made uncacheable.
66−serveAssets' :: MonadSnap m => Bool -> FilePath -> FilePath -> m ()
68+serveAssets' :: (MonadSnap m, MonadFail m) => Bool -> FilePath -> FilePath -> m ()
6769serveAssets' doRedirect base fallback = do
6870 pRaw <- getSafePath
6971 serveAsset' doRedirect base fallback $ if "/" `isSuffixOf` pRaw || pRaw == "" then pRaw <> "index.html" else pRaw
7072
7173-- | Serve a single static asset from an asset directory generated via @assets.nix@ or, failing that, from a regular directory.
72−serveAsset' :: MonadSnap m => Bool -> FilePath -> FilePath -> FilePath -> m ()
74+serveAsset' :: (MonadFail m, MonadSnap m) => Bool -> FilePath -> FilePath -> FilePath -> m ()
7375serveAsset' doRedirect base fallback p = do
7476 assetType <- liftIO $ try $ BS.readFile $ base </> p </> "type"
7577 case assetType of
@@ -93,8 +95,17 @@ serveAsset' doRedirect base fallback p = do
9395 let finalFilename = base </> p </> "encodings" </> T.unpack (decodeUtf8 e)
9496 stat <- liftIO $ getFileStatus finalFilename
9597 modifyResponse $ setHeader "Last-Modified" "Thu, 1 Jan 1970 00:00:00 GMT"
96− modifyResponse $ setResponseCode 200 . setContentLength (fromIntegral $ fileSize stat) . setContentType (fileType defaultMimeTypes p)
97− sendFile finalFilename
98+ . setHeader "Accept-Ranges" "bytes"
99+ . setContentType (fileType defaultMimeTypes p)
100+ let size = fromIntegral $ fileSize stat
101+ req <- getRequest
102+ -- Despite the name, this function actually does all of the work for
103+ -- responding to range requests. We only need to handle *none* range
104+ -- requests ourselves.
105+ wasRange <- checkRangeReq req finalFilename size
106+ unless wasRange $ do
107+ modifyResponse $ setResponseCode 200 . setContentLength size
108+ sendFile finalFilename
98109 Just _ -> cachePermanently >> modifyResponse (setResponseCode 304)
99110 Right "redirect" -> do
100111 mtarget <- liftIO $ getAssetTarget $ base </> p
lib/backend/obelisk-backend.cabal+19−3
@@ -6,9 +6,25 @@ build-type: Simple
66library
77 hs-source-dirs: src
88 build-depends: base,
9− snap,
10− snap-server,
9+ bytestring,
10+ categories,
11+ containers,
12+ cookie,
1113 data-default,
14+ dependent-sum,
15+ dependent-sum-template,
16+ lens,
17+ mtl,
1218 obelisk-asset-serve-snap,
13− bytestring
19+ obelisk-executable-config-inject,
20+ obelisk-executable-config-lookup,
21+ obelisk-frontend,
22+ obelisk-route,
23+ obelisk-snap-extras,
24+ reflex-dom-core,
25+ snap,
26+ snap-server,
27+ text,
28+ universe
1429 exposed-modules: Obelisk.Backend
30+ ghc-options: -Wall -Werror -Wredundant-constraints -Wincomplete-uni-patterns -Wincomplete-record-updates -O
lib/backend/src/Obelisk/Backend.hs+278−21
@@ -1,41 +1,298 @@
1+{-# LANGUAGE DeriveFunctor #-}
2+{-# LANGUAGE DeriveGeneric #-}
3+{-# LANGUAGE FlexibleContexts #-}
4+{-# LANGUAGE FlexibleInstances #-}
5+{-# LANGUAGE GADTs #-}
6+{-# LANGUAGE KindSignatures #-}
7+{-# LANGUAGE LambdaCase #-}
8+{-# LANGUAGE MultiParamTypeClasses #-}
19{-# LANGUAGE OverloadedStrings #-}
10+{-# LANGUAGE ScopedTypeVariables #-}
11+{-# OPTIONS_GHC -fno-warn-orphans #-}
212module Obelisk.Backend
3− ( backend
4− , BackendConfig
13+ ( Backend (..)
14+ , BackendConfig (..)
15+ , defaultBackendConfig
16+ , StaticAssets (..)
17+ , defaultStaticAssets
18+ -- * Running a backend
19+ , runBackend
20+ , runBackendWith
21+ -- * Configuration of backend
22+ , GhcjsWidgets(..)
23+ , defaultGhcjsWidgets
24+ -- * all.js script loading functions
25+ , deferredGhcjsScript
26+ , delayedGhcjsScript
27+ -- * all.js preload functions
28+ , preloadGhcjs
29+ , renderAllJsPath
530 -- * Re-exports
631 , Default (def)
32+ , getPageName
33+ , getRouteWith
34+ , runSnapWithCommandLineArgs
35+ , runSnapWithConfig
36+ , serveDefaultObeliskApp
37+ , prettifyOutput
38+ , staticRenderContentType
39+ , getPublicConfigs
740 ) where
841
42+import Control.Monad
43+import Control.Monad.Except
44+import Control.Monad.Fail (MonadFail)
45+import Data.ByteString (ByteString)
946import qualified Data.ByteString.Char8 as BSC8
1047import Data.Default (Default (..))
11−import Obelisk.Asset.Serve.Snap (serveAssets)
12−import System.IO (hSetBuffering, stderr, BufferMode (..))
13−import Snap (httpServe, defaultConfig, commandLineConfig, route)
48+import Data.Dependent.Sum
49+import Data.Functor.Identity
50+import Data.Map (Map)
51+import qualified Data.Map as Map
52+import Data.Monoid ((<>))
53+import Data.Text (Text)
54+import qualified Data.Text as T
55+import GHC.Generics (Generic)
56+import Obelisk.Asset.Serve.Snap (serveAsset)
57+import qualified Obelisk.ExecutableConfig.Lookup as Lookup
58+import Obelisk.Frontend
59+import Obelisk.Route
60+import Obelisk.Snap.Extras (doNotCache, serveFileIfExistsAs)
61+import Reflex.Dom.Core
62+import Snap (MonadSnap, Snap, commandLineConfig, defaultConfig, getsRequest, httpServe, modifyResponse
63+ , rqPathInfo, rqQueryString, setContentType, writeBS, writeText
64+ , rqCookies, Cookie(..) , setHeader)
1465import Snap.Internal.Http.Server.Config (Config (accessLog, errorLog), ConfigLog (ConfigIoLog))
66+import System.IO (BufferMode (..), hSetBuffering, stderr, stdout)
1567
16−--TODO: Add a link to a large explanation of the idea of using 'def'
17−-- | Configure the operation of the Obelisk backend. For reasonable defaults,
18−-- use 'def'.
19−data BackendConfig = BackendConfig
68+data Backend backendRoute frontendRoute = Backend
69+ { _backend_routeEncoder :: Encoder (Either Text) Identity (R (FullRoute backendRoute frontendRoute)) PageName
70+ , _backend_run :: ((R backendRoute -> Snap ()) -> IO ()) -> IO ()
71+ } deriving (Generic)
2072
21−instance Default BackendConfig where
22− def = BackendConfig
73+data BackendConfig frontendRoute = BackendConfig
74+ { _backendConfig_runSnap :: !(Snap () -> IO ()) -- ^ Function to run the snap server
75+ , _backendConfig_staticAssets :: !StaticAssets -- ^ Static assets
76+ , _backendConfig_ghcjsWidgets :: !(GhcjsWidgets (Text -> FrontendWidgetT (R frontendRoute) ()))
77+ -- ^ Given the URL of all.js, return the widgets which are responsible for
78+ -- loading the script.
79+ } deriving (Generic)
2380
24−-- | Start an Obelisk backend
25−backend :: BackendConfig -> IO ()
26−backend _ = do
81+-- | The static assets provided must contain a compiled GHCJS app that corresponds exactly to the Frontend provided
82+data GhcjsApp route = GhcjsApp
83+ { _ghcjsApp_compiled :: !StaticAssets
84+ , _ghcjsApp_value :: !(Frontend route)
85+ } deriving (Generic)
86+
87+-- | Widgets used to load all.js on the frontend
88+data GhcjsWidgets a = GhcjsWidgets
89+ { _ghcjsWidgets_preload :: a
90+ -- ^ A preload widget, placed in the document head
91+ , _ghcjsWidgets_script :: a
92+ -- ^ A script widget, placed in the document body
93+ } deriving (Functor, Generic)
94+
95+
96+-- | Given the URL of all.js, return the widgets which are responsible for
97+-- loading the script. Defaults to 'preloadGhcjs' and 'deferredGhcjsScript'.
98+defaultGhcjsWidgets :: GhcjsWidgets (Text -> FrontendWidgetT r ())
99+defaultGhcjsWidgets = GhcjsWidgets
100+ { _ghcjsWidgets_preload = preloadGhcjs
101+ , _ghcjsWidgets_script = deferredGhcjsScript
102+ }
103+
104+-- | Serve a frontend, which must be the same frontend that Obelisk has built and placed in the default location
105+--TODO: The frontend should be provided together with the asset paths so that this isn't so easily breakable; that will probably make this function obsolete
106+serveDefaultObeliskApp
107+ :: (MonadSnap m, HasCookies m, MonadFail m)
108+ => (R appRoute -> Text)
109+ -> GhcjsWidgets (FrontendWidgetT (R appRoute) ())
110+ -> ([Text] -> m ())
111+ -> Frontend (R appRoute)
112+ -> Map Text ByteString
113+ -> R (ObeliskRoute appRoute)
114+ -> m ()
115+serveDefaultObeliskApp urlEnc ghcjsWidgets serveStaticAsset frontend =
116+ serveObeliskApp urlEnc ghcjsWidgets serveStaticAsset frontendApp
117+ where frontendApp = GhcjsApp
118+ { _ghcjsApp_compiled = defaultFrontendGhcjsAssets
119+ , _ghcjsApp_value = frontend
120+ }
121+
122+prettifyOutput :: IO ()
123+prettifyOutput = do
27124 -- Make output more legible by decreasing the likelihood of output from
28125 -- multiple threads being interleaved
126+ hSetBuffering stdout LineBuffering
29127 hSetBuffering stderr LineBuffering
30128
31− -- Get the web server configuration from the command line
32− cmdLineConf <- commandLineConfig defaultConfig
33− let httpConf = cmdLineConf
129+defaultStaticAssets :: StaticAssets
130+defaultStaticAssets = StaticAssets
131+ { _staticAssets_processed = "static.assets"
132+ , _staticAssets_unprocessed = "static"
133+ }
134+
135+defaultFrontendGhcjsAssets :: StaticAssets
136+defaultFrontendGhcjsAssets = StaticAssets
137+ { _staticAssets_processed = "frontend.jsexe.assets"
138+ , _staticAssets_unprocessed = "frontend.jsexe"
139+ }
140+
141+runSnapWithConfig :: MonadIO m => Config Snap a -> Snap () -> m ()
142+runSnapWithConfig conf a = do
143+ let httpConf = conf
34144 { accessLog = Just $ ConfigIoLog BSC8.putStrLn
35145 , errorLog = Just $ ConfigIoLog BSC8.putStrLn
36146 }
37147 -- Start the web server
38− httpServe httpConf $ route
39− [ ("", serveAssets "frontend.jsexe.assets" "frontend.jsexe") --TODO: Can we prevent naming conflicts between frontend.jsexe and static?
40− , ("", serveAssets "static.assets" "static")
41− ]
148+ liftIO $ httpServe httpConf a
149+
150+-- Get the web server configuration from the command line
151+runSnapWithCommandLineArgs :: MonadIO m => Snap () -> m ()
152+runSnapWithCommandLineArgs s = liftIO (commandLineConfig defaultConfig) >>= \c ->
153+ runSnapWithConfig c s
154+
155+getPageName :: (MonadSnap m) => m PageName
156+getPageName = do
157+ p <- getsRequest rqPathInfo
158+ q <- getsRequest rqQueryString
159+ return $ byteStringsToPageName p q
160+
161+getRouteWith :: (MonadSnap m) => Encoder Identity parse route PageName -> m (parse route)
162+getRouteWith e = do
163+ pageName <- getPageName
164+ return $ tryDecode e pageName
165+
166+renderAllJsPath :: Encoder Identity Identity (R (FullRoute a b)) PageName -> Text
167+renderAllJsPath validFullEncoder =
168+ renderObeliskRoute validFullEncoder $ FullRoute_Frontend (ObeliskRoute_Resource ResourceRoute_Ghcjs) :/ ["all.js"]
169+
170+serveObeliskApp
171+ :: (MonadSnap m, HasCookies m, MonadFail m)
172+ => (R appRoute -> Text)
173+ -> GhcjsWidgets (FrontendWidgetT (R appRoute) ())
174+ -> ([Text] -> m ())
175+ -> GhcjsApp (R appRoute)
176+ -> Map Text ByteString
177+ -> R (ObeliskRoute appRoute)
178+ -> m ()
179+serveObeliskApp urlEnc ghcjsWidgets serveStaticAsset frontendApp config = \case
180+ ObeliskRoute_App appRouteComponent :=> Identity appRouteRest -> serveGhcjsApp urlEnc ghcjsWidgets frontendApp config $ GhcjsAppRoute_App appRouteComponent :/ appRouteRest
181+ ObeliskRoute_Resource resComponent :=> Identity resRest -> case resComponent :=> Identity resRest of
182+ ResourceRoute_Static :=> Identity pathSegments -> serveStaticAsset pathSegments
183+ ResourceRoute_Ghcjs :=> Identity pathSegments -> serveGhcjsApp urlEnc ghcjsWidgets frontendApp config $ GhcjsAppRoute_Resource :/ pathSegments
184+ ResourceRoute_JSaddleWarp :=> Identity _ -> do
185+ let msg = "Error: Obelisk.Backend received jsaddle request"
186+ liftIO $ putStrLn $ T.unpack msg
187+ writeText msg
188+ ResourceRoute_Version :=> Identity () -> doNotCache >> serveFileIfExistsAs "text/plain" "version"
189+
190+serveStaticAssets :: (MonadSnap m, MonadFail m) => StaticAssets -> [Text] -> m ()
191+serveStaticAssets assets pathSegments = serveAsset (_staticAssets_processed assets) (_staticAssets_unprocessed assets) $ T.unpack $ T.intercalate "/" pathSegments
192+
193+data StaticAssets = StaticAssets
194+ { _staticAssets_processed :: !FilePath
195+ , _staticAssets_unprocessed :: !FilePath
196+ }
197+ deriving (Show, Read, Eq, Ord)
198+
199+data GhcjsAppRoute :: (* -> *) -> * -> * where
200+ GhcjsAppRoute_App :: appRouteComponent a -> GhcjsAppRoute appRouteComponent a
201+ GhcjsAppRoute_Resource :: GhcjsAppRoute appRouteComponent [Text]
202+
203+staticRenderContentType :: ByteString
204+staticRenderContentType = "text/html; charset=utf-8"
205+
206+--TODO: Don't assume we're being served at "/"
207+serveGhcjsApp
208+ :: (MonadSnap m, HasCookies m, MonadFail m)
209+ => (R appRouteComponent -> Text)
210+ -> GhcjsWidgets (FrontendWidgetT (R appRouteComponent) ())
211+ -> GhcjsApp (R appRouteComponent)
212+ -> Map Text ByteString
213+ -> R (GhcjsAppRoute appRouteComponent)
214+ -> m ()
215+serveGhcjsApp urlEnc ghcjsWidgets app config = \case
216+ GhcjsAppRoute_App appRouteComponent :=> Identity appRouteRest -> do
217+ modifyResponse $ setContentType staticRenderContentType
218+ modifyResponse $ setHeader "Cache-Control" "no-store private"
219+ writeBS <=< renderGhcjsFrontend urlEnc ghcjsWidgets (appRouteComponent :/ appRouteRest) config $ _ghcjsApp_value app
220+ GhcjsAppRoute_Resource :=> Identity pathSegments -> serveStaticAssets (_ghcjsApp_compiled app) pathSegments
221+
222+-- | Default obelisk backend configuration.
223+defaultBackendConfig :: BackendConfig frontendRoute
224+defaultBackendConfig = BackendConfig runSnapWithCommandLineArgs defaultStaticAssets defaultGhcjsWidgets
225+
226+-- | Run an obelisk backend with the default configuration.
227+runBackend :: Backend backendRoute frontendRoute -> Frontend (R frontendRoute) -> IO ()
228+runBackend = runBackendWith defaultBackendConfig
229+
230+-- | Run an obelisk backend with the given configuration.
231+runBackendWith
232+ :: BackendConfig frontendRoute
233+ -> Backend backendRoute frontendRoute
234+ -> Frontend (R frontendRoute)
235+ -> IO ()
236+runBackendWith (BackendConfig runSnap staticAssets ghcjsWidgets) backend frontend = case checkEncoder $ _backend_routeEncoder backend of
237+ Left e -> fail $ "backend error:\n" <> T.unpack e
238+ Right validFullEncoder -> do
239+ publicConfigs <- getPublicConfigs
240+ _backend_run backend $ \serveRoute ->
241+ runSnap $
242+ getRouteWith validFullEncoder >>= \case
243+ Identity r -> case r of
244+ FullRoute_Backend backendRoute :/ a -> serveRoute $ backendRoute :/ a
245+ FullRoute_Frontend obeliskRoute :/ a ->
246+ serveDefaultObeliskApp routeToUrl (($ allJsUrl) <$> ghcjsWidgets) (serveStaticAssets staticAssets) frontend publicConfigs $
247+ obeliskRoute :/ a
248+ where
249+ routeToUrl (k :/ v) = renderObeliskRoute validFullEncoder $ FullRoute_Frontend (ObeliskRoute_App k) :/ v
250+ allJsUrl = renderAllJsPath validFullEncoder
251+
252+renderGhcjsFrontend
253+ :: (MonadSnap m, HasCookies m)
254+ => (route -> Text)
255+ -> GhcjsWidgets (FrontendWidgetT route ())
256+ -> route
257+ -> Map Text ByteString
258+ -> Frontend route
259+ -> m ByteString
260+renderGhcjsFrontend urlEnc ghcjsWidgets route configs f = do
261+ cookies <- askCookies
262+ renderFrontendHtml configs cookies urlEnc route f (_ghcjsWidgets_preload ghcjsWidgets) (_ghcjsWidgets_script ghcjsWidgets)
263+
264+-- | Preload all.js in a link tag.
265+-- This is the default preload method.
266+preloadGhcjs :: Text -> FrontendWidgetT r ()
267+preloadGhcjs allJsUrl = elAttr "link" ("rel" =: "preload" <> "as" =: "script" <> "href" =: allJsUrl) blank
268+
269+-- | Load the script from the given URL in a deferred script tag.
270+-- This is the default method.
271+deferredGhcjsScript :: Text -> FrontendWidgetT r ()
272+deferredGhcjsScript allJsUrl = elAttr "script" ("type" =: "text/javascript" <> "src" =: allJsUrl <> "defer" =: "defer") blank
273+
274+-- | An all.js script which is loaded after waiting for some time to pass. This
275+-- is useful to ensure any CSS animations on the page can play smoothly before
276+-- blocking the UI thread by running all.js.
277+delayedGhcjsScript
278+ :: Int -- ^ The number of milliseconds to delay loading by
279+ -> Text -- ^ URL to GHCJS app JavaScript
280+ -> FrontendWidgetT r ()
281+delayedGhcjsScript n allJsUrl = elAttr "script" ("type" =: "text/javascript") $ text $ T.unlines
282+ [ "setTimeout(function() {"
283+ , " var all_js_script = document.createElement('script');"
284+ , " all_js_script.type = 'text/javascript';"
285+ , " all_js_script.src = '" <> allJsUrl <> "';"
286+ , " document.body.appendChild(all_js_script);"
287+ , "}, " <> T.pack (show n) <> ");"
288+ ]
289+
290+instance HasCookies Snap where
291+ askCookies = map (\c -> (cookieName c, cookieValue c)) <$> getsRequest rqCookies
292+
293+-- | Get configs from the canonical "public" locations (i.e., locations that obelisk expects to make available
294+-- to frontend applications, and hence visible to end users).
295+getPublicConfigs :: IO (Map Text ByteString)
296+getPublicConfigs = Map.filterWithKey (\k _ -> isMemberOf k ["common", "frontend"]) <$> Lookup.getConfigs
297+ where
298+ isMemberOf k = any (`T.isPrefixOf` k)
lib/cliapp/obelisk-cliapp.cabalnew file+37
@@ -0,0 +1,37 @@
1+name: obelisk-cliapp
2+version: 0.1
3+license: BSD3
4+build-type: Simple
5+cabal-version: >=1.2
6+
7+library
8+ hs-source-dirs: src
9+ build-depends:
10+ aeson
11+ , ansi-terminal
12+ , base
13+ , bytestring
14+ , containers
15+ , exceptions
16+ , io-streams
17+ , lens
18+ , logging-effect
19+ , monad-loops
20+ , mtl
21+ , process
22+ , shell-escape
23+ , terminal-size
24+ , text
25+ , time
26+ , transformers
27+ , utf8-string
28+ exposed-modules:
29+ Obelisk.CliApp
30+ other-modules:
31+ Obelisk.CliApp.Logging
32+ Obelisk.CliApp.Process
33+ Obelisk.CliApp.Spinner
34+ Obelisk.CliApp.TerminalString
35+ Obelisk.CliApp.Theme
36+ Obelisk.CliApp.Types
37+ ghc-options: -Wall -Werror -Wredundant-constraints -Wincomplete-uni-patterns -Wincomplete-record-updates -O
lib/cliapp/src/Obelisk/CliApp.hsnew file+65
@@ -0,0 +1,65 @@
1+-- | Package for writing great CLI apps.
2+--
3+-- See Demo.hs for an example
4+--
5+-- This package should eventually be made its own library.
6+module Obelisk.CliApp
7+ (
8+ -- .Types
9+ CliLog
10+ , CliThrow
11+ , CliT(..)
12+ , runCli
13+ , CliConfig
14+ , HasCliConfig
15+ , getCliConfig
16+ , Output
17+
18+ -- .Spinner
19+ , withSpinner
20+ , withSpinnerNoTrail
21+ , withSpinner'
22+
23+ -- .Logging
24+ , AsUnstructuredError (..)
25+ , newCliConfig
26+ , getLogLevel
27+ , putLog
28+ , failWith
29+ , errorToWarning
30+ , withExitFailMessage
31+
32+ -- Control.Monad.Log
33+ , Severity (..)
34+
35+ -- .Process
36+ , AsProcessFailure (..)
37+ , ProcessFailure (..)
38+ , ProcessSpec (..)
39+ , callCommand
40+ , callProcess
41+ , callProcessAndLogOutput
42+ , createProcess
43+ , createProcess_
44+ , exitCodeToException
45+ , overCreateProcess
46+ , proc
47+ , readCreateProcessWithExitCode
48+ , readProcessAndLogOutput
49+ , readProcessAndLogStderr
50+ , readProcessJSONAndLogStderr
51+ , reconstructCommand
52+ , runProcess_
53+ , setCwd
54+ , setDelegateCtlc
55+ , setEnvOverride
56+ , shell
57+ , waitForProcess
58+ ) where
59+
60+import Control.Monad.Log (Severity (..))
61+
62+import Obelisk.CliApp.Logging
63+import Obelisk.CliApp.Process
64+import Obelisk.CliApp.Spinner
65+import Obelisk.CliApp.Types
lib/cliapp/src/Obelisk/CliApp/Logging.hsnew file+253
@@ -0,0 +1,253 @@
1+{-# LANGUAGE ConstraintKinds #-}
2+{-# LANGUAGE FlexibleContexts #-}
3+{-# LANGUAGE FlexibleInstances #-}
4+{-# LANGUAGE LambdaCase #-}
5+{-# LANGUAGE MultiParamTypeClasses #-}
6+{-# LANGUAGE OverloadedStrings #-}
7+{-# LANGUAGE RankNTypes #-}
8+{-# LANGUAGE ScopedTypeVariables #-}
9+-- | Provides a logging handler that facilitates safe ouputting to terminal using MVar based locking.
10+-- | Spinner.hs and Process.hs work on this guarantee.
11+module Obelisk.CliApp.Logging
12+ ( AsUnstructuredError (..)
13+ , newCliConfig
14+ , runCli
15+ , verboseLogLevel
16+ , isOverwrite
17+ , getSeverity
18+ , getLogLevel
19+ , setLogLevel
20+ , putLog
21+ , putLogRaw
22+ , failWith
23+ , errorToWarning
24+ , withExitFailMessage
25+ , writeLog
26+ , allowUserToMakeLoggingVerbose
27+ , getChars
28+ , fork
29+ ) where
30+
31+import Control.Concurrent (ThreadId, forkIO, killThread, threadDelay)
32+import Control.Concurrent.MVar (modifyMVar_, newMVar)
33+import Control.Lens (Prism', review)
34+import Control.Monad (unless, void, when)
35+import Control.Monad.Catch (MonadCatch, MonadMask, bracket, catch, throwM)
36+import Control.Monad.Except (throwError)
37+import Control.Monad.IO.Class (liftIO)
38+import Control.Monad.Log (Severity (..), WithSeverity (..), logMessage, runLoggingT)
39+import Control.Monad.Loops (iterateUntil)
40+import Control.Monad.Reader (MonadIO, ReaderT (..))
41+import Data.IORef (atomicModifyIORef', newIORef, readIORef, writeIORef)
42+import Data.Semigroup ((<>))
43+import Data.Text (Text)
44+import qualified Data.Text as T
45+import qualified Data.Text.IO as T
46+import GHC.IO.Encoding.Types
47+import System.Console.ANSI (Color (Red, Yellow), ColorIntensity (Vivid),
48+ ConsoleIntensity (FaintIntensity), ConsoleLayer (Foreground),
49+ SGR (SetColor, SetConsoleIntensity), clearLine)
50+import System.Exit (ExitCode (..))
51+import System.IO
52+
53+import qualified Obelisk.CliApp.TerminalString as TS
54+import Obelisk.CliApp.Theme
55+import Obelisk.CliApp.Types
56+
57+newCliConfig
58+ :: Severity
59+ -> Bool
60+ -> Bool
61+ -> (e -> (Text, Int))
62+ -> IO (CliConfig e)
63+newCliConfig sev noColor noSpinner errorLogExitCode = do
64+ level <- newIORef sev
65+ lock <- newMVar False
66+ tipDisplayed <- newIORef False
67+ stack <- newIORef ([], [])
68+ textEncoding <- hGetEncoding stdout
69+ let theme = if maybe False supportsUnicode textEncoding
70+ then unicodeTheme
71+ else noUnicodeTheme
72+ return $ CliConfig level noColor noSpinner lock tipDisplayed stack errorLogExitCode theme
73+
74+runCli :: MonadIO m => CliConfig e -> CliT e m a -> m a
75+runCli c =
76+ flip runLoggingT (handleLog c)
77+ . flip runReaderT (_cliConfig_errorLogExitCode c)
78+ . unDieT
79+ . flip runReaderT c
80+ . unCliT
81+
82+verboseLogLevel :: Severity
83+verboseLogLevel = Debug
84+
85+isOverwrite :: Output -> Bool
86+isOverwrite = \case
87+ Output_Overwrite _ -> True
88+ _ -> False
89+
90+getSeverity :: Output -> Maybe Severity
91+getSeverity = \case
92+ Output_Log (WithSeverity sev _) -> Just sev
93+ Output_LogRaw (WithSeverity sev _) -> Just sev
94+ _ -> Nothing
95+
96+getLogLevel :: (MonadIO m, HasCliConfig e m) => m Severity
97+getLogLevel = getLogLevel' =<< getCliConfig
98+
99+getLogLevel' :: MonadIO m => CliConfig e -> m Severity
100+getLogLevel' = liftIO . readIORef . _cliConfig_logLevel
101+
102+setLogLevel :: (MonadIO m, HasCliConfig e m) => Severity -> m ()
103+setLogLevel sev = do
104+ l <- _cliConfig_logLevel <$> getCliConfig
105+ liftIO $ writeIORef l sev
106+
107+handleLog :: MonadIO m => CliConfig e -> Output -> m ()
108+handleLog conf output = do
109+ level <- getLogLevel' conf
110+ liftIO $ modifyMVar_ (_cliConfig_lock conf) $ \wasOverwriting -> do
111+ let noColor = _cliConfig_noColor conf
112+ case getSeverity output of
113+ Nothing -> handleLog' noColor output
114+ Just sev -> if sev > level
115+ then return wasOverwriting -- Discard if sev is above configured log level
116+ else do
117+ -- If the last output was an overwrite (with cursor on same line), ...
118+ when wasOverwriting $
119+ void $ handleLog' noColor Output_ClearLine -- first clear it,
120+ handleLog' noColor output -- then, actually write the msg.
121+
122+handleLog' :: MonadIO m => Bool -> Output -> m Bool
123+handleLog' noColor output = do
124+ case output of
125+ Output_Log m -> liftIO $ do
126+ writeLog True noColor m
127+ Output_LogRaw m -> liftIO $ do
128+ writeLog False noColor m
129+ hFlush stdout -- Explicitly flush, as there is no newline
130+ Output_Write ts -> liftIO $ do
131+ T.putStrLn $ TS.render (not noColor) Nothing ts
132+ hFlush stdout
133+ Output_Overwrite ts -> liftIO $ do
134+ width <- TS.getTerminalWidth
135+ T.putStr $ "\r" <> TS.render (not noColor) width ts
136+ hFlush stdout
137+ Output_ClearLine -> liftIO $ do
138+ -- Go to the first column and clear the whole line
139+ putStr "\r"
140+ clearLine
141+ hFlush stdout
142+ return $ isOverwrite output
143+
144+-- | Like `putLog` but without the implicit newline added.
145+putLogRaw :: CliLog m => Severity -> Text -> m ()
146+putLogRaw sev = logMessage . Output_LogRaw . WithSeverity sev
147+
148+-- | Indicates unstructured errors form one variant (or conceptual projection)
149+-- of the error type.
150+--
151+-- Shouldn't really use this, but who has time to clean up that much!
152+class AsUnstructuredError e where
153+ asUnstructuredError :: Prism' e Text
154+
155+instance AsUnstructuredError Text where
156+ asUnstructuredError = id
157+
158+-- | Like `putLog Alert` but also abrupts the program.
159+failWith :: (CliThrow e m, AsUnstructuredError e) => Text -> m a
160+failWith = throwError . review asUnstructuredError
161+
162+errorToWarning
163+ :: (HasCliConfig e m, CliLog m)
164+ => e -> m ()
165+errorToWarning e = do
166+ c <- getCliConfig
167+ putLog Warning $ fst $ _cliConfig_errorLogExitCode c e
168+
169+-- | Intercept ExitFailure exceptions and log the given alert before exiting.
170+--
171+-- This is useful when you want to provide contextual information to a deeper failure.
172+withExitFailMessage :: (CliLog m, MonadCatch m) => Text -> m a -> m a
173+withExitFailMessage msg f = f `catch` \(e :: ExitCode) -> do
174+ case e of
175+ ExitFailure _ -> putLog Alert msg
176+ ExitSuccess -> pure ()
177+ throwM e
178+
179+-- | Write log to stdout, with colors (unless `noColor`)
180+writeLog :: (MonadIO m) => Bool -> Bool -> WithSeverity Text -> m ()
181+writeLog withNewLine noColor (WithSeverity severity s) = if T.null s then pure () else write
182+ where
183+ write
184+ | noColor && severity <= Warning = liftIO $ putFn $ T.pack (show severity) <> ": " <> s
185+ | not noColor && severity <= Error = TS.putStrWithSGR errorColors h withNewLine s
186+ | not noColor && severity <= Warning = TS.putStrWithSGR warningColors h withNewLine s
187+ | not noColor && severity >= Debug = TS.putStrWithSGR debugColors h withNewLine s
188+ | otherwise = liftIO $ putFn s
189+
190+ putFn = if withNewLine then T.hPutStrLn h else T.hPutStr h
191+ h = if severity <= Error then stderr else stdout
192+ errorColors = [SetColor Foreground Vivid Red]
193+ warningColors = [SetColor Foreground Vivid Yellow]
194+ debugColors = [SetConsoleIntensity FaintIntensity]
195+
196+-- | Allow the user to immediately switch to verbose logging upon pressing a particular key.
197+--
198+-- Call this function in a thread, and kill it to turn off keystroke monitoring.
199+allowUserToMakeLoggingVerbose
200+ :: (MonadIO m, MonadMask m, CliLog m, HasCliConfig e m)
201+ => String -- ^ The key to press in order to make logging verbose
202+ -> m ()
203+allowUserToMakeLoggingVerbose keyCode = bracket showTip (liftIO . killThread) $ \_ -> do
204+ unlessVerbose $ do
205+ liftIO $ hSetBuffering stdin NoBuffering
206+ _ <- iterateUntil (== keyCode) $ liftIO getChars
207+ putLog Warning "Ctrl+e pressed; making output verbose (-v)"
208+ setLogLevel verboseLogLevel
209+ where
210+ showTip = fork $ unlessVerbose $ do
211+ conf <- getCliConfig
212+ liftIO $ threadDelay $ 10*1000000 -- Only show tip for actions taking too long (10 seconds or more)
213+ tipDisplayed <- liftIO $ atomicModifyIORef' (_cliConfig_tipDisplayed conf) $ (,) True
214+ unless tipDisplayed $ unlessVerbose $ do -- Check again in case the user had pressed Ctrl+e recently
215+ putLog Notice "Tip: Press Ctrl+e to display full output"
216+ unlessVerbose f = do
217+ l <- getLogLevel
218+ unless (l == verboseLogLevel) f
219+
220+-- | Like `getChar` but also retrieves the subsequently pressed keys.
221+--
222+-- Allowing, for example, the ↑ key, which consists of the three characters
223+-- ['\ESC','[','A'] to be distinguished from an actual \ESC character input.
224+getChars :: IO String
225+getChars = reverse <$> f mempty
226+ where
227+ f xs = do
228+ x <- getChar
229+ hReady stdin >>= \case
230+ True -> f (x:xs)
231+ False -> return (x:xs)
232+
233+fork :: (HasCliConfig e m, MonadIO m) => CliT e IO () -> m ThreadId
234+fork f = do
235+ c <- getCliConfig
236+ liftIO $ forkIO $ runCli c f
237+
238+-- | Conservatively determines whether the encoding supports Unicode.
239+--
240+-- Currently this uses a whitelist of known-to-work encodings. In principle it
241+-- could test dynamically by opening a file with this encoding, but it doesn't
242+-- look like base exposes any way to determine this in a pure fashion.
243+supportsUnicode :: TextEncoding -> Bool
244+supportsUnicode enc = any ((textEncodingName enc ==) . textEncodingName)
245+ [ utf8
246+ , utf8_bom
247+ , utf16
248+ , utf16be
249+ , utf16le
250+ , utf32
251+ , utf32be
252+ , utf32le
253+ ]
lib/cliapp/src/Obelisk/CliApp/Process.hsnew file+272
@@ -0,0 +1,272 @@
1+{-# LANGUAGE FlexibleContexts #-}
2+{-# LANGUAGE LambdaCase #-}
3+{-# LANGUAGE MultiParamTypeClasses #-}
4+{-# LANGUAGE OverloadedStrings #-}
5+{-# LANGUAGE ScopedTypeVariables #-}
6+{-# LANGUAGE TupleSections #-}
7+
8+-- | An extension of `System.Process` that integrates with logging (`Obelisk.CLI.Logging`)
9+-- and is thus spinner friendly.
10+module Obelisk.CliApp.Process
11+ ( AsProcessFailure (..)
12+ , ProcessFailure (..)
13+ , ProcessSpec (..)
14+ , callCommand
15+ , callProcess
16+ , callProcessAndLogOutput
17+ , createProcess
18+ , createProcess_
19+ , exitCodeToException
20+ , overCreateProcess
21+ , proc
22+ , readCreateProcessWithExitCode
23+ , readProcessAndLogOutput
24+ , readProcessAndLogStderr
25+ , readProcessJSONAndLogStderr
26+ , reconstructCommand
27+ , runProcess_
28+ , setCwd
29+ , setDelegateCtlc
30+ , setEnvOverride
31+ , shell
32+ , waitForProcess
33+ ) where
34+
35+import Control.Monad ((<=<), join, void)
36+import Control.Monad.Catch (MonadMask, bracketOnError)
37+import Control.Monad.Except (throwError)
38+import Control.Monad.Fail
39+import Control.Monad.IO.Class (MonadIO, liftIO)
40+import Control.Lens (Prism', review)
41+import qualified Data.ByteString as BS
42+import qualified Data.ByteString.Char8 as BSC
43+import qualified Data.ByteString.UTF8 as BSU
44+import Data.Function (fix)
45+import Data.Map (Map)
46+import qualified Data.Map as Map
47+import Data.Monoid ((<>))
48+import Data.Text (Text)
49+import qualified Data.Text as T
50+import qualified Data.Text.Encoding as T
51+import Data.Text.Encoding.Error (lenientDecode)
52+import System.Environment (getEnvironment)
53+import System.Exit (ExitCode (..))
54+import System.IO (Handle)
55+import System.IO.Streams (InputStream, handleToInputStream)
56+import qualified System.IO.Streams as Streams
57+import System.IO.Streams.Concurrent (concurrentMerge)
58+import System.Process (CreateProcess, ProcessHandle, StdStream (CreatePipe), std_err, std_out)
59+import qualified System.Process as Process
60+import Text.ShellEscape (bash, bytes)
61+import qualified Data.Aeson as Aeson
62+
63+import Control.Monad.Log (Severity (..))
64+import Obelisk.CliApp.Logging (putLog, putLogRaw)
65+import Obelisk.CliApp.Types (CliLog, CliThrow)
66+
67+data ProcessSpec = ProcessSpec
68+ { _processSpec_createProcess :: !CreateProcess
69+ , _processSpec_overrideEnv :: !(Maybe (Map String String -> Map String String))
70+ }
71+
72+proc :: FilePath -> [String] -> ProcessSpec
73+proc cmd args = ProcessSpec (Process.proc cmd args) Nothing
74+
75+shell :: String -> ProcessSpec
76+shell cmd = ProcessSpec (Process.shell cmd) Nothing
77+
78+setEnvOverride :: (Map String String -> Map String String) -> ProcessSpec -> ProcessSpec
79+setEnvOverride f p = p { _processSpec_overrideEnv = Just f }
80+
81+overCreateProcess :: (CreateProcess -> CreateProcess) -> ProcessSpec -> ProcessSpec
82+overCreateProcess f (ProcessSpec p x) = ProcessSpec (f p) x
83+
84+setDelegateCtlc :: Bool -> ProcessSpec -> ProcessSpec
85+setDelegateCtlc b = overCreateProcess (\p -> p { Process.delegate_ctlc = b })
86+
87+setCwd :: Maybe FilePath -> ProcessSpec -> ProcessSpec
88+setCwd fp = overCreateProcess (\p -> p { Process.cwd = fp })
89+
90+
91+-- TODO put back in `Obelisk.CliApp.Process` and use prisms for extensible exceptions
92+data ProcessFailure = ProcessFailure Process.CmdSpec Int -- exit code
93+ deriving Show
94+
95+-- | Indicates arbitrary process failures form one variant (or conceptual projection) of
96+-- the error type.
97+class AsProcessFailure e where
98+ asProcessFailure :: Prism' e ProcessFailure
99+
100+instance AsProcessFailure ProcessFailure where
101+ asProcessFailure = id
102+
103+readProcessAndLogStderr
104+ :: (MonadIO m, CliLog m, CliThrow e m, AsProcessFailure e, MonadMask m)
105+ => Severity -> ProcessSpec -> m Text
106+readProcessAndLogStderr sev process = do
107+ (out, _err) <- withProcess process $ \_out err -> do
108+ streamToLog =<< liftIO (streamHandle sev err)
109+ liftIO $ T.decodeUtf8With lenientDecode <$> BS.hGetContents out
110+
111+readProcessJSONAndLogStderr
112+ :: (Aeson.FromJSON a, MonadIO m, CliLog m, CliThrow e m, AsProcessFailure e, MonadMask m)
113+ => Severity -> ProcessSpec -> m a
114+readProcessJSONAndLogStderr sev process = do
115+ (out, _err) <- withProcess process $ \_out err -> do
116+ streamToLog =<< liftIO (streamHandle sev err)
117+ json <- liftIO $ BS.hGetContents out
118+ case Aeson.eitherDecodeStrict json of
119+ Right a -> pure a
120+ Left err -> do
121+ putLog Error $ "Could not decode process output as JSON: " <> T.pack err
122+ throwError $ review asProcessFailure $ ProcessFailure (Process.cmdspec $ _processSpec_createProcess process) 0
123+
124+readCreateProcessWithExitCode
125+ :: (MonadIO m, CliLog m)
126+ => ProcessSpec -> m (ExitCode, String, String)
127+readCreateProcessWithExitCode procSpec = do
128+ process <- mkCreateProcess procSpec
129+ putLog Debug $ "Creating process: " <> reconstructProcSpec procSpec
130+ liftIO $ Process.readCreateProcessWithExitCode process ""
131+
132+-- | Like `System.Process.readProcess` but logs the combined output (stdout and stderr)
133+-- with the corresponding severity.
134+--
135+-- Usually this function is called as `readProcessAndLogOutput (Debug, Error)`. However
136+-- some processes are known to spit out diagnostic or informative messages in stderr, in
137+-- which case it is advisable to call it with a non-Error severity for stderr, like
138+-- `readProcessAndLogOutput (Debug, Debug)`.
139+readProcessAndLogOutput
140+ :: (MonadIO m, CliLog m, CliThrow e m, AsProcessFailure e, MonadFail m)
141+ => (Severity, Severity) -> ProcessSpec -> m Text
142+readProcessAndLogOutput (sev_out, sev_err) process = do
143+ (_, Just out, Just err, p) <- createProcess $ overCreateProcess
144+ (\p -> p { std_out = CreatePipe , std_err = CreatePipe }) process
145+
146+ -- TODO interleave stdout and stderr in log correctly
147+ streamToLog =<< liftIO (streamHandle sev_err err)
148+ outText <- liftIO $ T.decodeUtf8With lenientDecode <$> BS.hGetContents out
149+ putLogRaw sev_out outText
150+
151+ outText <$ (exitCodeToException process =<< waitForProcess p)
152+
153+-- | Like 'System.Process.callProcess' but logs the combined output (stdout and stderr)
154+-- with the corresponding severity.
155+--
156+-- Usually this function is called as `callProcessAndLogOutput (Debug, Error)`. However
157+-- some processes are known to spit out diagnostic or informative messages in stderr, in
158+-- which case it is advisable to call it with a non-Error severity for stderr, like
159+-- `callProcessAndLogOutput (Debug, Debug)`.
160+callProcessAndLogOutput
161+ :: (MonadIO m, CliLog m, CliThrow e m, AsProcessFailure e, MonadMask m)
162+ => (Severity, Severity) -> ProcessSpec -> m ()
163+callProcessAndLogOutput (sev_out, sev_err) process =
164+ void $ withProcess process $ \out err -> do
165+ stream <- liftIO $ join $ combineStream
166+ <$> streamHandle sev_out out
167+ <*> streamHandle sev_err err
168+ streamToLog stream
169+ where
170+ combineStream s1 s2 = concurrentMerge [s1, s2]
171+
172+-- | Like 'System.Process.createProcess' but also logs (debug) the process being run
173+createProcess
174+ :: (MonadIO m, CliLog m)
175+ => ProcessSpec -> m (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
176+createProcess procSpec = do
177+ p <- mkCreateProcess procSpec
178+ putLog Debug $ "Creating process: " <> reconstructProcSpec procSpec
179+ liftIO $ Process.createProcess p
180+
181+-- | Like `System.Process.createProcess_` but also logs (debug) the process being run
182+createProcess_
183+ :: (MonadIO m, CliLog m)
184+ => String -> ProcessSpec -> m (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
185+createProcess_ name procSpec = do
186+ p <- mkCreateProcess procSpec
187+ putLog Debug $ "Creating process " <> T.pack name <> ": " <> reconstructProcSpec procSpec
188+ liftIO $ Process.createProcess_ name p
189+
190+mkCreateProcess :: MonadIO m => ProcessSpec -> m Process.CreateProcess
191+mkCreateProcess (ProcessSpec p override') = case override' of
192+ Nothing -> pure p
193+ Just override -> do
194+ procEnv <- Map.fromList <$> maybe (liftIO getEnvironment) pure (Process.env p)
195+ pure $ p { Process.env = Just $ Map.toAscList (override procEnv) }
196+
197+-- | Like `System.Process.callProcess` but also logs (debug) the process being run
198+callProcess
199+ :: (MonadIO m, CliLog m)
200+ => String -> [String] -> m ()
201+callProcess exe args = do
202+ putLog Debug $ "Calling process " <> T.pack exe <> " with args: " <> T.pack (show args)
203+ liftIO $ Process.callProcess exe args
204+
205+-- | Like `System.Process.callCommand` but also logs (debug) the command being run
206+callCommand
207+ :: (MonadIO m, CliLog m)
208+ => String -> m ()
209+callCommand cmd = do
210+ putLog Debug $ "Calling command " <> T.pack cmd
211+ liftIO $ Process.callCommand cmd
212+
213+withProcess
214+ :: (MonadIO m, CliLog m, CliThrow e m, AsProcessFailure e, MonadMask m)
215+ => ProcessSpec -> (Handle -> Handle -> m ()) -> m (Handle, Handle)
216+withProcess process f =
217+ bracketOnError
218+ (createProcess $ overCreateProcess
219+ (\x -> x { std_out = CreatePipe , std_err = CreatePipe }) process
220+ )
221+ (liftIO . Process.cleanupProcess)
222+ (\case
223+ (_, Just out, Just err, p) -> do
224+ f out err
225+ (out, err) <$ (exitCodeToException process =<< waitForProcess p)
226+ _ -> error "withProcess: createProcess did not provide handles for CreatePipe as expected"
227+ )
228+
229+-- | Runs a process to completion failing if it does not exit cleanly.
230+runProcess_
231+ :: (MonadIO m, CliLog m, CliThrow e m, MonadMask m, AsProcessFailure e)
232+ => ProcessSpec -> m ()
233+runProcess_ process =
234+ bracketOnError
235+ (createProcess process)
236+ (liftIO . Process.cleanupProcess)
237+ (\(_, _, _, ph) -> exitCodeToException process =<< waitForProcess ph)
238+
239+-- Create an input stream from the file handle, associating each item with the given severity.
240+streamHandle :: Severity -> Handle -> IO (InputStream (Severity, BSC.ByteString))
241+streamHandle sev = Streams.map (sev,) <=< handleToInputStream
242+
243+-- | Read from an input stream and log its contents
244+streamToLog
245+ :: (MonadIO m, CliLog m)
246+ => InputStream (Severity, BSC.ByteString) -> m ()
247+streamToLog stream = fix $ \loop -> do
248+ liftIO (Streams.read stream) >>= \case
249+ Nothing -> return ()
250+ Just (sev, line) -> putLogRaw sev (T.decodeUtf8With lenientDecode line) >> loop
251+
252+-- | Wrapper around `System.Process.waitForProcess`
253+waitForProcess :: MonadIO m => ProcessHandle -> m ExitCode
254+waitForProcess = liftIO . Process.waitForProcess
255+
256+-- | Converts an 'ExitCode' to an exception when it's non-zero.
257+exitCodeToException :: (CliThrow e m, AsProcessFailure e) => ProcessSpec -> ExitCode -> m ()
258+exitCodeToException spec = \case
259+ ExitSuccess -> pure ()
260+ ExitFailure code -> throwError $ review asProcessFailure $ ProcessFailure (Process.cmdspec $ _processSpec_createProcess spec) code
261+
262+-- | Pretty print a 'CmdSpec'
263+reconstructCommand :: Process.CmdSpec -> Text
264+reconstructCommand p = case p of
265+ Process.ShellCommand str -> T.pack str
266+ Process.RawCommand c as -> processToShellString c as
267+ where
268+ processToShellString cmd args = T.pack $ unwords $
269+ map (BSU.toString . bytes . bash . BSU.fromString) (cmd : args)
270+
271+reconstructProcSpec :: ProcessSpec -> Text
272+reconstructProcSpec = reconstructCommand . Process.cmdspec . _processSpec_createProcess
lib/cliapp/src/Obelisk/CliApp/Spinner.hsnew file+145
@@ -0,0 +1,145 @@
1+{-# LANGUAGE FlexibleContexts #-}
2+{-# LANGUAGE LambdaCase #-}
3+{-# LANGUAGE MultiParamTypeClasses #-}
4+{-# LANGUAGE OverloadedStrings #-}
5+{-# LANGUAGE ScopedTypeVariables #-}
6+-- | Provides a simple CLI spinner that interoperates cleanly with the rest of the logging output.
7+module Obelisk.CliApp.Spinner
8+ ( withSpinner
9+ , withSpinnerNoTrail
10+ , withSpinner'
11+ ) where
12+
13+import Control.Concurrent (killThread, threadDelay)
14+import Control.Monad (forM_, (>=>))
15+import Control.Monad.Catch (MonadMask, mask, onException)
16+import Control.Monad.IO.Class
17+import Control.Monad.Log (Severity (..), logMessage)
18+import Data.IORef
19+import qualified Data.List as L
20+import Data.Maybe (isNothing)
21+import Data.Text (Text)
22+import System.Console.ANSI (Color (Blue, Cyan, Green, Red))
23+
24+import Obelisk.CliApp.Logging (allowUserToMakeLoggingVerbose, fork, putLog)
25+import Obelisk.CliApp.TerminalString (TerminalString (..), enquiryCode)
26+import Obelisk.CliApp.Theme
27+import Obelisk.CliApp.Types (CliLog, CliConfig (..), HasCliConfig, Output (..), getCliConfig)
28+
29+-- | Run an action with a CLI spinner.
30+withSpinner
31+ :: (MonadIO m, MonadMask m, CliLog m, HasCliConfig e m)
32+ => Text -> m a -> m a
33+withSpinner s = withSpinner' s $ Just $ const s
34+
35+-- | A spinner that leaves no trail after a successful run.
36+--
37+-- Use if you wish the spinner to be ephemerally visible to the user.
38+--
39+-- The 'no trail' property automatically carries over to sub-spinners (in that
40+-- they won't leave a trail either).
41+withSpinnerNoTrail
42+ :: (MonadIO m, MonadMask m, CliLog m, HasCliConfig e m)
43+ => Text -> m a -> m a
44+withSpinnerNoTrail s = withSpinner' s Nothing
45+
46+-- | Advanced version that controls the display and content of the trail message.
47+withSpinner'
48+ :: (MonadIO m, MonadMask m, CliLog m, HasCliConfig e m)
49+ => Text
50+ -> Maybe (a -> Text) -- ^ Leave an optional trail with the given message creator
51+ -> m a
52+ -> m a
53+withSpinner' msg mkTrail action = do
54+ cliConf <- getCliConfig
55+ let noSpinner = _cliConfig_noSpinner cliConf
56+ if noSpinner
57+ then putLog Notice msg >> action
58+ else bracket' run cleanup $ const action
59+ where
60+ run = do
61+ -- Add this log to the spinner stack, and start a spinner if it is top-level.
62+ modifyStack pushSpinner >>= \case
63+ True -> do -- Top-level spinner; fork a thread to manage output of anything on the stack
64+ ctrleThread <- fork $ allowUserToMakeLoggingVerbose enquiryCode
65+ cliConf <- getCliConfig
66+ let theme = _cliConfig_theme cliConf
67+ spinner = coloredSpinner $ _cliTheme_spinner theme
68+ spinnerThread <- fork $ runSpinner spinner $ \c -> do
69+ logs <- renderSpinnerStack theme c . snd <$> readStack
70+ logMessage $ Output_Overwrite logs
71+ pure [ctrleThread, spinnerThread]
72+ False -> -- Sub-spinner; nothing to do.
73+ pure []
74+ cleanup tids resultM = do
75+ liftIO $ mapM_ killThread tids
76+ logMessage Output_ClearLine
77+ cliConf <- getCliConfig
78+ let theme = _cliConfig_theme cliConf
79+ logsM <- modifyStack $ (popSpinner theme) $ case resultM of
80+ Nothing ->
81+ ( TerminalString_Colorized Red $ _cliTheme_failed $ _cliConfig_theme cliConf
82+ , Just msg -- Always display final message if there was an exception.
83+ )
84+ Just result ->
85+ ( TerminalString_Colorized Green $ _cliTheme_done $ _cliConfig_theme cliConf
86+ , mkTrail <*> pure result
87+ )
88+ -- Last message, finish off with newline.
89+ forM_ logsM $ logMessage . Output_Write
90+ pushSpinner (flag, old) =
91+ ( (isTemporary : flag, TerminalString_Normal msg : old)
92+ , null old -- Is empty?
93+ )
94+ where
95+ isTemporary = isNothing mkTrail
96+ popSpinner theme (mark, trailMsgM) (flag, old) =
97+ ( (newFlag, new)
98+ -- With final trail spinner message to render
99+ , renderSpinnerStack theme mark . (: new) . TerminalString_Normal <$> (
100+ if inTemporarySpinner then Nothing else trailMsgM
101+ )
102+ )
103+ where
104+ inTemporarySpinner = or newFlag -- One of our parent spinners is temporary
105+ newFlag = drop 1 flag
106+ new = L.delete (TerminalString_Normal msg) old
107+ readStack = liftIO . readIORef
108+ =<< fmap _cliConfig_spinnerStack getCliConfig
109+ modifyStack f = liftIO . flip atomicModifyIORef' f
110+ =<< fmap _cliConfig_spinnerStack getCliConfig
111+
112+-- | How nested spinner logs should be displayed
113+renderSpinnerStack
114+ :: CliTheme
115+ -> TerminalString -- ^ That which comes before the final element in stack
116+ -> [TerminalString] -- ^ Spinner elements in reverse order
117+ -> [TerminalString]
118+renderSpinnerStack theme mark = L.intersperse space . go . L.reverse
119+ where
120+ go [] = []
121+ go (x:[]) = mark : [x]
122+ go (x:xs) = arrow : x : go xs
123+ arrow = TerminalString_Colorized Blue $ _cliTheme_arrow theme
124+ space = TerminalString_Normal " "
125+
126+-- | A spinner is simply an infinite list of strings that supplant each other in a delayed loop, creating the
127+-- animation of a "spinner".
128+type Spinner = [TerminalString]
129+
130+coloredSpinner :: SpinnerTheme -> Spinner
131+coloredSpinner = cycle . fmap (TerminalString_Colorized Cyan)
132+
133+-- | Run a spinner with a monadic function that defines how to represent the individual spinner characters.
134+runSpinner :: MonadIO m => Spinner -> (TerminalString -> m ()) -> m ()
135+runSpinner spinner f = forM_ spinner $ f >=> const delay
136+ where
137+ delay = liftIO $ threadDelay 100000 -- A shorter delay ensures that we update promptly.
138+
139+-- | Like `bracket` but the `release` function can know whether an exception was raised
140+bracket' :: MonadMask m => m a -> (a -> Maybe c -> m b) -> (a -> m c) -> m c
141+bracket' acquire release use = mask $ \unmasked -> do
142+ resource <- acquire
143+ result <- unmasked (use resource) `onException` release resource Nothing
144+ _ <- release resource $ Just result
145+ return result
lib/cliapp/src/Obelisk/CliApp/TerminalString.hsnew file+84
@@ -0,0 +1,84 @@
1+{-# LANGUAGE LambdaCase #-}
2+{-# LANGUAGE MultiParamTypeClasses #-}
3+{-# LANGUAGE OverloadedStrings #-}
4+-- | Types and functions dealing with strings to be printed on terminal.
5+module Obelisk.CliApp.TerminalString
6+ ( TerminalString(..)
7+ , render
8+ , putStrWithSGR
9+ , getTerminalWidth
10+ , enquiryCode
11+ ) where
12+
13+import Control.Monad (when)
14+import Control.Monad.Catch (bracket_)
15+import Control.Monad.IO.Class (liftIO)
16+import Control.Monad.Reader (MonadIO)
17+import Data.Semigroup ((<>))
18+import Data.Text (Text)
19+import qualified Data.Text as T
20+import qualified Data.Text.IO as T
21+import System.Console.ANSI
22+import qualified System.Console.Terminal.Size as TerminalSize
23+import System.IO (Handle)
24+
25+-- | Printable text on terminals
26+--
27+-- Represents text with an optional color code.
28+data TerminalString
29+ = TerminalString_Normal Text
30+ | TerminalString_Colorized Color Text
31+ deriving (Eq, Show, Ord)
32+
33+printableLength :: [TerminalString] -> Int
34+printableLength = T.length . toText False
35+
36+-- Render a list of TerminalString as Text that can be directly putStr'ed.
37+render
38+ :: Bool -- ^ with color
39+ -> Maybe Int -- ^ optionally, trim to maximum width
40+ -> [TerminalString]
41+ -> Text
42+render withColor w ts = trim w $ toText withColor ts
43+ where
44+ trim = \case
45+ Nothing -> id
46+ Just n -> \s -> if printableLength ts > n
47+ then T.take (n-3) s <> "..." <> T.pack resetCode
48+ else s
49+
50+toText :: Bool -> [TerminalString] -> Text
51+toText withColor = mconcat . map (toText' withColor)
52+
53+-- | Convert to Text, controlling whether colorization should happen.
54+toText' :: Bool -> TerminalString -> Text
55+toText' withColor = \case
56+ TerminalString_Normal s -> s
57+ TerminalString_Colorized c s -> if withColor then colorizeText c s else s
58+
59+-- | Colorize the given text so that it is printed in color when using putStr.
60+colorizeText :: Color -> Text -> Text
61+colorizeText color s = mconcat
62+ [ T.pack $ setSGRCode [SetColor Foreground Vivid color]
63+ , s
64+ , T.pack resetCode
65+ ]
66+
67+-- | Safely print the string with the given ANSI control codes, resetting in the end.
68+putStrWithSGR :: MonadIO m => [SGR] -> Handle -> Bool -> Text -> m ()
69+putStrWithSGR sgr h withNewLine s = liftIO $ bracket_ (hSetSGR h sgr) reset $ T.hPutStr h s
70+ where
71+ reset = hSetSGR h [Reset] >> newline -- New line should come *after* reset (to reset cursor color).
72+ newline = when withNewLine $ T.hPutStrLn h ""
73+
74+-- | Code for https://en.wikipedia.org/wiki/Enquiry_character
75+enquiryCode :: String
76+enquiryCode = "\ENQ"
77+
78+-- | Code to reset ANSI colors
79+resetCode :: String
80+resetCode = setSGRCode [Reset]
81+
82+getTerminalWidth :: IO (Maybe Int)
83+getTerminalWidth = fmap TerminalSize.width <$> TerminalSize.size
84+
lib/cliapp/src/Obelisk/CliApp/Theme.hsnew file+29
@@ -0,0 +1,29 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+module Obelisk.CliApp.Theme where
3+
4+import Data.Text (Text)
5+
6+data CliTheme = CliTheme
7+ { _cliTheme_done :: Text
8+ , _cliTheme_failed :: Text
9+ , _cliTheme_arrow :: Text
10+ , _cliTheme_spinner :: SpinnerTheme
11+ }
12+
13+type SpinnerTheme = [Text]
14+
15+unicodeTheme :: CliTheme
16+unicodeTheme = CliTheme
17+ { _cliTheme_done = "✔"
18+ , _cliTheme_failed = "✖"
19+ , _cliTheme_arrow = "⇾"
20+ , _cliTheme_spinner = ["◐", "◓", "◑", "◒"]
21+ }
22+
23+noUnicodeTheme :: CliTheme
24+noUnicodeTheme = CliTheme
25+ { _cliTheme_done = "DONE"
26+ , _cliTheme_failed = "FAILED"
27+ , _cliTheme_arrow = "->"
28+ , _cliTheme_spinner = ["|", "/", "-", "\\"]
29+ }
lib/cliapp/src/Obelisk/CliApp/Types.hsnew file+132
@@ -0,0 +1,132 @@
1+{-# LANGUAGE ConstraintKinds #-}
2+{-# LANGUAGE FlexibleContexts #-}
3+{-# LANGUAGE FlexibleInstances #-}
4+{-# LANGUAGE FunctionalDependencies #-}
5+{-# LANGUAGE LambdaCase #-}
6+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
7+{-# LANGUAGE MultiParamTypeClasses #-}
8+{-# LANGUAGE OverloadedStrings #-}
9+{-# LANGUAGE StandaloneDeriving #-}
10+{-# LANGUAGE UndecidableInstances #-}
11+module Obelisk.CliApp.Types where
12+
13+import Control.Concurrent.MVar (MVar)
14+import Control.Monad.Catch (MonadCatch, MonadMask, MonadThrow)
15+import Control.Monad.Fail (MonadFail)
16+import Control.Monad.Log (LoggingT(..), MonadLog, Severity (..), WithSeverity (..), logMessage)
17+import Control.Monad.Reader (MonadIO, ReaderT (..), MonadReader (..), ask, mapReaderT)
18+import Control.Monad.Writer (WriterT)
19+import Control.Monad.State (StateT)
20+import Control.Monad.Except (ExceptT, MonadError (..))
21+import Control.Monad.IO.Class (liftIO)
22+import Control.Monad.Trans (MonadTrans, lift)
23+import Data.IORef (IORef)
24+import Data.Text (Text)
25+import System.Exit (ExitCode (..), exitWith)
26+
27+import Obelisk.CliApp.TerminalString (TerminalString)
28+import Obelisk.CliApp.Theme (CliTheme)
29+
30+--------------------------------------------------------------------------------
31+
32+data Output
33+ = Output_Log (WithSeverity Text) -- Regular logging message (with colors and newlines)
34+ | Output_LogRaw (WithSeverity Text) -- Like `Output_Log` but without the implicit newline added.
35+ | Output_Write [TerminalString] -- Render and write a TerminalString using putstrLn
36+ | Output_Overwrite [TerminalString] -- Overwrite the current line (i.e. \r followed by `putStr`)
37+ | Output_ClearLine -- Clear the line
38+ deriving (Eq, Show, Ord)
39+
40+type CliLog m = MonadLog Output m
41+
42+type CliThrow e m = MonadError e m
43+
44+-- | Log a message to the console.
45+--
46+-- Logs safely even if there are ongoing spinners.
47+putLog :: CliLog m => Severity -> Text -> m ()
48+putLog sev = logMessage . Output_Log . WithSeverity sev
49+
50+deriving instance MonadFail m => MonadFail (LoggingT Output m)
51+
52+newtype DieT e m a = DieT { unDieT :: ReaderT (e -> (Text, Int)) (LoggingT Output m) a }
53+ deriving
54+ ( Functor, Applicative, Monad, MonadIO, MonadFail
55+ , MonadThrow, MonadCatch, MonadMask
56+ , MonadLog Output
57+ )
58+
59+instance MonadTrans (DieT e) where
60+ lift = DieT . lift . lift
61+
62+-- | Error printer is private to DieT
63+instance MonadReader r m => MonadReader r (DieT e m) where
64+ ask = DieT $ lift $ ask
65+ local = (\f (DieT a) -> DieT $ f a) . mapReaderT . local
66+ reader = DieT . lift . lift . reader
67+
68+-- TODO generalize to bigger error types
69+instance MonadIO m => MonadError e (DieT e m) where
70+ throwError e = do
71+ handler <- DieT ask
72+ let (output, exitCode) = handler e
73+ putLog Alert output
74+ liftIO $ exitWith $ ExitFailure exitCode
75+
76+ -- Cannot catch
77+ catchError m _ = m
78+
79+--------------------------------------------------------------------------------
80+
81+data CliConfig e = CliConfig
82+ { -- | We are capable of changing the log level at runtime
83+ _cliConfig_logLevel :: IORef Severity
84+ , -- | Disallow coloured output
85+ _cliConfig_noColor :: Bool
86+ , -- | Disallow spinners
87+ _cliConfig_noSpinner :: Bool
88+ , -- | Whether the last message was an Overwrite output
89+ _cliConfig_lock :: MVar Bool
90+ , -- | Whether the user tip (to make verbose) was already displayed
91+ _cliConfig_tipDisplayed :: IORef Bool
92+ , -- | Stack of logs from nested spinners
93+ _cliConfig_spinnerStack :: IORef ([Bool], [TerminalString])
94+ , -- | Failure handler. How to log error and what exit status to use.
95+ _cliConfig_errorLogExitCode :: e -> (Text, Int)
96+ , -- | Theme strings for spinners
97+ _cliConfig_theme :: CliTheme
98+ }
99+
100+class Monad m => HasCliConfig e m | m -> e where
101+ getCliConfig :: m (CliConfig e)
102+
103+instance HasCliConfig e m => HasCliConfig e (ReaderT r m) where
104+ getCliConfig = lift getCliConfig
105+
106+instance (Monoid w, HasCliConfig e m) => HasCliConfig e (WriterT w m) where
107+ getCliConfig = lift getCliConfig
108+
109+instance HasCliConfig e m => HasCliConfig e (StateT s m) where
110+ getCliConfig = lift getCliConfig
111+
112+instance HasCliConfig e m => HasCliConfig e (ExceptT e m) where
113+ getCliConfig = lift getCliConfig
114+
115+--------------------------------------------------------------------------------
116+
117+newtype CliT e m a = CliT
118+ { unCliT :: ReaderT (CliConfig e) (DieT e m) a
119+ }
120+ deriving
121+ ( Functor, Applicative, Monad, MonadIO, MonadFail
122+ , MonadThrow, MonadCatch, MonadMask
123+ , MonadLog Output -- CliLog
124+ , MonadError e -- CliThrow
125+ , MonadReader (CliConfig e) -- HasCliConfig
126+ )
127+
128+instance MonadTrans (CliT e) where
129+ lift = CliT . lift . lift
130+
131+instance Monad m => HasCliConfig e (CliT e m)where
132+ getCliConfig = ask
lib/command/obelisk-command.cabal+27−17
@@ -1,5 +1,5 @@
11name: obelisk-command
2−version: 0.1
2+version: 0.9.0.1
33cabal-version: >= 1.8
44build-type: Simple
55
@@ -7,53 +7,63 @@ library
77 hs-source-dirs: src
88 build-depends:
99 aeson
10− , ansi-terminal
11− , Cabal
1210 , aeson-pretty
13− , attoparsec
11+ , ansi-terminal
1412 , base
15− , base16-bytestring
16− , binary
1713 , bytestring
14+ , Cabal
1815 , containers
1916 , data-default
2017 , directory
18+ , either
19+ , errors
20+ , exceptions
21+ , extra
2122 , filepath
23+ , git
2224 , github
23− , hit
25+ , here
26+ , hnix
27+ , hpack
2428 , io-streams
25− , exceptions
29+ , lens
2630 , logging-effect
31+ , megaparsec
32+ , modern-uri
33+ , monad-loops
34+ , monoidal-containers
2735 , mtl
2836 , network
2937 , network-uri
38+ , obelisk-cliapp
3039 , optparse-applicative
3140 , placeholders
3241 , process
42+ , shell-escape
3343 , temporary
44+ , terminal-size
3445 , text
3546 , time
3647 , transformers
37− , unix
48+ , unix-compat
49+ , unordered-containers
50+ , utf8-string
51+ , which
3852 , yaml
3953 exposed-modules:
4054 Obelisk.App
41− Obelisk.CLI
42− Obelisk.CLI.Logging
43− Obelisk.CLI.Process
44− Obelisk.CLI.Spinner
4555 Obelisk.Command
4656 Obelisk.Command.Deploy
4757 Obelisk.Command.Nix
4858 Obelisk.Command.Project
49− Obelisk.Command.Repl
5059 Obelisk.Command.Run
5160 Obelisk.Command.Thunk
5261 Obelisk.Command.Utils
53− -- -fobject-code is so that the StaticPointers extension can work in ghci
54− ghc-options: -Wall -fobject-code
62+ Obelisk.Command.VmBuilder
63+ Obelisk.Command.Preprocessor
64+ ghc-options: -Wall
5565
5666executable ob
5767 main-is: src-bin/ob.hs
5868 build-depends: base, obelisk-command
59− ghc-options: -Wall -O2 -threaded
69+ ghc-options: -Wall -Werror -Wredundant-constraints -Wincomplete-uni-patterns -Wincomplete-record-updates -O -threaded
lib/command/src/Obelisk/App.hs+94−12
@@ -1,31 +1,113 @@
11{-# LANGUAGE ConstraintKinds #-}
22{-# LANGUAGE FlexibleContexts #-}
3+{-# LANGUAGE FlexibleInstances #-}
34{-# LANGUAGE GeneralizedNewtypeDeriving #-}
5+{-# LANGUAGE LambdaCase #-}
46{-# LANGUAGE MultiParamTypeClasses #-}
7+{-# LANGUAGE ScopedTypeVariables #-}
8+{-# LANGUAGE StandaloneDeriving #-}
9+{-# LANGUAGE TemplateHaskell #-}
10+{-# LANGUAGE TupleSections #-}
511module Obelisk.App where
612
13+import Control.Lens
714import Control.Monad.Catch (MonadCatch, MonadMask, MonadThrow)
8−import Control.Monad.Log (LoggingT, MonadLog, runLoggingT)
9−import Control.Monad.Reader (MonadIO, MonadReader, ReaderT, runReaderT)
15+import Control.Monad.Fail (MonadFail)
16+import Control.Monad.Reader (MonadIO, ReaderT (..), ask, runReaderT)
17+import Control.Monad.Writer (WriterT)
18+import Control.Monad.State (StateT)
19+import Control.Monad.Except (ExceptT, MonadError)
20+import Control.Monad.Trans.Class (MonadTrans, lift)
21+import Data.Text (Text)
22+import System.Directory (XdgDirectory (XdgData), getXdgDirectory)
23+import Control.Monad.Log (MonadLog)
1024
11−import Obelisk.CLI.Logging (LoggingConfig, Output, handleLog)
25+import Obelisk.CliApp
26+ ( CliConfig
27+ , CliLog
28+ , CliThrow
29+ , CliT (..)
30+ , ProcessFailure
31+ , AsProcessFailure (..)
32+ , AsUnstructuredError (..)
33+ , HasCliConfig
34+ , Output
35+ , runCli
36+ )
1237
13−data Obelisk = Obelisk
14− { _obelisk_noSpinner :: Bool -- Used to disable the spinner.
15− , _obelisk_logging :: LoggingConfig
38+data ObeliskError
39+ = ObeliskError_ProcessError
40+ { obeliskError_err :: ProcessFailure
41+ , obeliskError_mAnn :: Maybe Text
42+ }
43+ | ObeliskError_Unstructured Text
44+
45+makePrisms ''ObeliskError
46+
47+instance AsUnstructuredError ObeliskError where
48+ asUnstructuredError = _ObeliskError_Unstructured
49+
50+-- Only project when the other field is null, otherwise we are not law abiding.
51+instance AsProcessFailure ObeliskError where
52+ asProcessFailure = _ObeliskError_ProcessError . prism (, Nothing) f
53+ where f = \case
54+ (pf, Nothing) -> Right pf
55+ pann@(_, Just _) -> Left pann
56+
57+newtype Obelisk = Obelisk
58+ { _obelisk_cliConfig :: CliConfig ObeliskError
1659 }
1760
1861newtype ObeliskT m a = ObeliskT
19− { unObeliskT :: ReaderT Obelisk (LoggingT Output m) a
62+ { unObeliskT :: ReaderT Obelisk (CliT ObeliskError m) a
2063 }
21− deriving (Functor, Applicative, Monad, MonadIO, MonadThrow, MonadCatch, MonadMask)
64+ deriving
65+ ( Functor, Applicative, Monad, MonadIO, MonadThrow, MonadCatch, MonadMask, MonadFail
66+ , MonadLog Output -- CliLog
67+ , MonadError ObeliskError -- CliThrow ObeliskError
68+ , HasCliConfig ObeliskError
69+ )
70+
71+instance MonadTrans ObeliskT where
72+ lift = ObeliskT . lift . lift
73+
74+class Monad m => HasObelisk m where
75+ getObelisk :: m Obelisk
76+
77+instance Monad m => HasObelisk (ObeliskT m) where
78+ getObelisk = ObeliskT ask
79+
80+instance HasObelisk m => HasObelisk (ReaderT r m) where
81+ getObelisk = lift getObelisk
82+
83+instance (Monoid w, HasObelisk m) => HasObelisk (WriterT w m) where
84+ getObelisk = lift getObelisk
85+
86+instance HasObelisk m => HasObelisk (StateT r m) where
87+ getObelisk = lift getObelisk
88+
89+instance HasObelisk m => HasObelisk (ExceptT e m) where
90+ getObelisk = lift getObelisk
2291
2392runObelisk :: MonadIO m => Obelisk -> ObeliskT m a -> m a
2493runObelisk c =
25− flip runLoggingT loggingConfig
94+ runCli (_obelisk_cliConfig c)
2695 . flip runReaderT c
2796 . unObeliskT
28− where
29− loggingConfig = handleLog $ _obelisk_logging c
3097
31−type MonadObelisk m = (MonadReader Obelisk m, MonadIO m, MonadMask m, MonadLog Output m)
98+type MonadInfallibleObelisk m =
99+ ( CliLog m
100+ , HasCliConfig ObeliskError m
101+ , HasObelisk m
102+ , MonadIO m
103+ , MonadMask m
104+ )
105+
106+type MonadObelisk m =
107+ ( MonadInfallibleObelisk m
108+ , CliThrow ObeliskError m
109+ , MonadFail m
110+ )
111+
112+getObeliskUserStateDir :: IO FilePath
113+getObeliskUserStateDir = getXdgDirectory XdgData "obelisk"
lib/command/src/Obelisk/CLI.hsdeleted−55
@@ -1,55 +0,0 @@
1−{-# LANGUAGE FlexibleContexts #-}
2−{-# LANGUAGE OverloadedStrings #-}
3−-- | Package for writing great CLI apps.
4−module Obelisk.CLI
5− ( withSpinner
6− , cliDemo
7− , module Obelisk.CLI.Logging
8− , module Obelisk.CLI.Process
9− ) where
10−
11−import Control.Concurrent (threadDelay)
12−import Control.Monad.IO.Class (liftIO)
13−import Control.Monad.Reader (ask)
14−import Data.Monoid ((<>))
15−import Data.Text (Text)
16−import qualified Data.Text as T
17−import System.Process (proc)
18−
19−import Obelisk.CLI.Logging
20−import Obelisk.CLI.Process
21−import Obelisk.CLI.Spinner
22−
23−import Obelisk.App (MonadObelisk, _obelisk_logging, _obelisk_noSpinner)
24−
25−-- NOTE: Everything under `Obelisk.CLI` is independent of the rest of Obelisk, with the exception of the
26−-- below functions, as they read the obelisk cli config using MonadReader.
27−
28−withSpinner :: MonadObelisk m => Text -> m a -> m a
29−withSpinner s action = do
30− conf <- ask
31− case _obelisk_noSpinner conf of
32− True -> putLog Notice s >> action
33− False -> withSpinner' (_obelisk_logging conf) s action
34−
35−cliDemo :: MonadObelisk m => m ()
36−cliDemo = do
37− putLog Notice "This demo will showcase the CLI library functionality"
38− withSpinner "Running some long-running task" $ do
39− delay
40− putLog Error "Some user error while spinning"
41− delay
42− putLog Notice "This is some info mesage"
43− putLog Warning "And now a warning as well"
44− delay
45− putLog Notice "Now we start a 2nd spinner, run a couple of process, the last of which fails:"
46− withSpinner "Looking around" $ do
47− delay
48− output <- readProcessAndLogStderr Notice $ proc "ls" ["-l", "/"]
49− putLog Notice $ "Output was: " <> T.pack output
50− delay
51− callProcessAndLogOutput (Notice, Error) $ proc "ls" ["-l", "/does-not-exist"]
52− delay
53− failWith "Something dangerous happened"
54− where
55− delay = liftIO $ threadDelay 1000000
lib/command/src/Obelisk/CLI/Logging.hsdeleted−115
@@ -1,115 +0,0 @@
1−{-# LANGUAGE FlexibleContexts #-}
2−{-# LANGUAGE LambdaCase #-}
3−{-# LANGUAGE MultiParamTypeClasses #-}
4−{-# LANGUAGE MultiWayIf #-}
5−{-# LANGUAGE OverloadedStrings #-}
6−-- | Provides a logging handler that facilitates safe ouputting to terminal using MVar based locking.
7−-- | Spinner.hs and Process.hs work on this guarantee.
8−module Obelisk.CLI.Logging
9− ( Severity (Error, Warning, Notice, Debug)
10− , LoggingConfig (..)
11− , Output (..)
12− , failWith
13− , putLog
14− , putLogRaw
15− , handleLog
16− ) where
17−
18−import Control.Concurrent.MVar (MVar, modifyMVar_)
19−import Control.Monad (void, when)
20−import Control.Monad.Catch (MonadMask, bracket_)
21−import Control.Monad.IO.Class (liftIO)
22−import Control.Monad.Reader (MonadIO)
23−import Data.Text (Text)
24−import qualified Data.Text.IO as T
25−import System.Console.ANSI (Color (Red, White, Yellow), ColorIntensity (Vivid),
26− ConsoleIntensity (FaintIntensity), ConsoleLayer (Foreground),
27− SGR (Reset, SetColor, SetConsoleIntensity), clearLine, setSGR)
28−import System.Exit (ExitCode (ExitFailure), exitWith)
29−import System.IO (hFlush, stdout)
30−
31−import Control.Monad.Log (MonadLog, Severity (..), WithSeverity (..), logMessage)
32−
33−data LoggingConfig = LoggingConfig
34− { _loggingConfig_level :: Severity
35− , _loggingConfig_noColor :: Bool -- Disallow coloured output
36− , _loggingConfig_lock :: MVar Bool -- Whether the last message was an Overwrite output
37− }
38−
39−data Output
40− = Output_Log (WithSeverity Text) -- Regular logging message (with colors and newlines)
41− | Output_LogRaw (WithSeverity Text) -- Like `Output_Log` but without the implicit newline added.
42− | Output_Overwrite [String] -- Overwrites the current line (i.e. \r followed by `putStr`)
43− | Output_ClearLine -- Clears the line
44− deriving (Eq, Show, Ord)
45−
46−isOverwrite :: Output -> Bool
47−isOverwrite = \case
48− Output_Overwrite _ -> True
49− _ -> False
50−
51−getSeverity :: Output -> Maybe Severity
52−getSeverity = \case
53− Output_Log (WithSeverity sev _) -> Just sev
54− Output_LogRaw (WithSeverity sev _) -> Just sev
55− _ -> Nothing
56−
57−handleLog :: MonadIO m => LoggingConfig -> Output -> m ()
58−handleLog (LoggingConfig level noColor lock) output = do
59− liftIO $ modifyMVar_ lock $ \wasOverwriting -> do
60− case getSeverity output of
61− Nothing -> handleLog' noColor output
62− Just sev -> case sev > level of
63− True -> return wasOverwriting -- Discard if sev is above configured log level
64− False -> do
65− -- If the last output was an overwrite (with cursor on same line), ...
66− when wasOverwriting $
67− void $ handleLog' noColor Output_ClearLine -- first clear it,
68− handleLog' noColor output -- then, actually write the msg.
69−
70−handleLog' :: MonadIO m => Bool -> Output -> m Bool
71−handleLog' noColor output = do
72− case output of
73− Output_Log m -> liftIO $ do
74− writeLogWith T.putStrLn noColor m
75− Output_LogRaw m -> liftIO $ do
76− writeLogWith T.putStr noColor m
77− hFlush stdout -- Explicitly flush, as there is no newline
78− Output_Overwrite xs -> liftIO $ do
79− mapM_ putStr $ "\r" : xs
80− hFlush stdout
81− Output_ClearLine -> liftIO $ do
82− -- Go to the first column and clear the whole line
83− putStr "\r"
84− clearLine
85− hFlush stdout
86− return $ isOverwrite output
87−
88−-- | Safely log a message to the console. This is what we should use.
89−putLog :: MonadLog Output m => Severity -> Text -> m ()
90−putLog sev = logMessage . Output_Log . WithSeverity sev
91−
92−-- | Like `putLog` but without the implicit newline added.
93−putLogRaw :: MonadLog Output m => Severity -> Text -> m ()
94−putLogRaw sev = logMessage . Output_LogRaw . WithSeverity sev
95−
96−-- | Like `putLog Error` but also abrupts the program.
97−failWith :: (MonadIO m, MonadLog Output m) => Text -> m a
98−failWith s = do
99− putLog Alert s
100− liftIO $ exitWith $ ExitFailure 2
101−
102−-- | Write log to stdout, with colors (unless `noColor`)
103−writeLogWith :: (MonadIO m, MonadMask m) => (Text -> IO ()) -> Bool -> WithSeverity Text -> m ()
104−writeLogWith f noColor (WithSeverity severity s) = case sevColor severity of
105− Just setColor -> bracket_ setColor reset $ liftIO (T.putStr s)
106− Nothing -> liftIO $ f s
107− where
108− -- We must reset *before* outputting the newline (if any), otherwise the cursor won't be reset.
109− reset = liftIO $ setSGR [Reset] >> f ""
110− sevColor sev = if
111− | noColor -> Nothing
112− | sev <= Error -> Just $ liftIO $ setSGR [SetColor Foreground Vivid Red]
113− | sev <= Warning -> Just $ liftIO $ setSGR [SetColor Foreground Vivid Yellow]
114− | sev >= Debug -> Just $ liftIO $ setSGR [SetColor Foreground Vivid White, SetConsoleIntensity FaintIntensity]
115− | otherwise -> Nothing
lib/command/src/Obelisk/CLI/Process.hsdeleted−94
@@ -1,94 +0,0 @@
1−{-# LANGUAGE FlexibleContexts #-}
2−{-# LANGUAGE LambdaCase #-}
3−{-# LANGUAGE MultiParamTypeClasses #-}
4−{-# LANGUAGE MultiWayIf #-}
5−{-# LANGUAGE OverloadedStrings #-}
6−{-# LANGUAGE ScopedTypeVariables #-}
7−{-# LANGUAGE TupleSections #-}
8−
9−-- | An extension of `System.Process` that integrates with logging (`Obelisk.CLI.Logging`)
10−-- and is thus spinner friendly.
11−module Obelisk.CLI.Process
12− ( readProcessAndLogStderr
13− , callProcessAndLogOutput
14− ) where
15−
16−import Control.Applicative (liftA2)
17−import Control.Monad (void, (<=<))
18−import Control.Monad.Catch (MonadMask)
19−import Control.Monad.IO.Class (liftIO)
20−import Control.Monad.Log (MonadLog)
21−import Control.Monad.Reader (MonadIO)
22−import qualified Data.ByteString.Char8 as BSC
23−import Data.Function (fix)
24−import Data.Monoid ((<>))
25−import qualified Data.Text as T
26−import Data.Text.Encoding (decodeUtf8)
27−import qualified Data.Text.IO as T
28−import System.Exit (ExitCode (..))
29−import System.IO (Handle)
30−import System.IO.Streams (InputStream, handleToInputStream)
31−import qualified System.IO.Streams as Streams
32−import System.IO.Streams.Concurrent (concurrentMerge)
33−import System.Process (CreateProcess, StdStream (CreatePipe), cmdspec, createProcess, std_err, std_out,
34− waitForProcess)
35−
36−import Obelisk.CLI.Logging (Output, Severity (..), failWith, putLog, putLogRaw)
37−
38−-- | Like `System.Process.readProcess` but logs the stderr instead of letting the external process inherit it.
39−readProcessAndLogStderr
40− :: (MonadIO m, MonadMask m, MonadLog Output m)
41− => Severity -> CreateProcess -> m String
42−readProcessAndLogStderr sev process = do
43− (out, _err) <- withProcess process $ \_out err -> do
44− streamToLog =<< liftIO (streamHandle sev err)
45− -- TODO: Why are we using Text here?
46− liftIO $ T.unpack . T.strip <$> T.hGetContents out
47−
48−-- | Like `System.Process.callProcess` but logs the combined output--stdout and stderr with the corresponding
49−-- severity.
50−--
51−-- Usually this function is called as `callProcessAndLogOutput (Debug, Error)`. However some processes
52−-- are known to spit out diagnostic or informative messages in stderr, in which case it is advisable to call
53−-- it with a non-Error severity for stderr, like `callProcessAndLogOutput (Debug, Debug)`.
54−callProcessAndLogOutput
55− :: (MonadIO m, MonadMask m, MonadLog Output m)
56− => (Severity, Severity) -> CreateProcess -> m ()
57−callProcessAndLogOutput (sev_out, sev_err) process = do
58− void $ withProcess process $ \out err -> do
59− stream <- liftIO $ do
60− uncurry combineStream =<< liftA2 (,) (streamHandle sev_out out) (streamHandle sev_err err)
61− streamToLog stream
62− where
63− combineStream s1 s2 = concurrentMerge [s1, s2]
64−
65−withProcess
66− :: (MonadIO m, MonadMask m, MonadLog Output m)
67− => CreateProcess -> (Handle -> Handle -> m ()) -> m (Handle, Handle)
68−withProcess process f = do
69− let procTitle = T.pack $ show $ cmdspec process
70− putLog Debug $ "Starting process: " <> procTitle
71− (_, Just out, Just err, p) <- liftIO $ createProcess $ process
72− { std_out = CreatePipe
73− , std_err = CreatePipe
74− }
75− f out err -- Pass the handles to the passed function
76− liftIO (waitForProcess p) >>= \case
77− ExitSuccess -> return ()
78− ExitFailure code -> do
79− -- Log an error. We also fail immediately; however we should probably let the caller control that.
80− failWith $ procTitle <> " failed with exit code: " <> T.pack (show code)
81− return (out, err) -- Return the handles
82−
83−-- Create an input stream from the file handle, associating each item with the given severity.
84−streamHandle :: Severity -> Handle -> IO (InputStream (Severity, BSC.ByteString))
85−streamHandle sev = Streams.map (sev,) <=< handleToInputStream
86−
87−-- | Read from an input stream and log its contents
88−streamToLog
89− :: (MonadIO m, MonadMask m, MonadLog Output m)
90− => InputStream (Severity, BSC.ByteString) -> m ()
91−streamToLog stream = fix $ \loop -> do
92− liftIO (Streams.read stream) >>= \case
93− Nothing -> return ()
94− Just (sev, line) -> putLogRaw sev (decodeUtf8 line) >> loop
lib/command/src/Obelisk/CLI/Spinner.hsdeleted−77
@@ -1,77 +0,0 @@
1−{-# LANGUAGE FlexibleContexts #-}
2−{-# LANGUAGE MultiParamTypeClasses #-}
3−{-# LANGUAGE OverloadedStrings #-}
4−-- | Provides a simple CLI spinner that interoperates cleanly with the rest of the logging output.
5−module Obelisk.CLI.Spinner (withSpinner') where
6−
7−import Control.Concurrent (forkIO, killThread, threadDelay)
8−import Control.Monad (forM_, (>=>))
9−import Control.Monad.Catch (MonadMask, mask, onException)
10−import Control.Monad.IO.Class (liftIO)
11−import Control.Monad.Log (MonadLog, logMessage, runLoggingT)
12−import Control.Monad.Reader (MonadIO)
13−import Data.Text (Text)
14−import qualified Data.Text as T
15−import System.Console.ANSI (Color (Cyan, Green, Red), ColorIntensity (Vivid), ConsoleLayer (Foreground),
16− SGR (Reset, SetColor), setSGRCode)
17−
18−import Obelisk.CLI.Logging (LoggingConfig, Output (..), handleLog)
19−
20−-- | Run an action with a CLI spinner.
21−withSpinner'
22− :: (MonadIO m, MonadMask m, MonadLog Output m)
23− => LoggingConfig -> Text -> m a -> m a
24−withSpinner' conf s = bracket' run cleanup . const
25− where
26− -- TODO: Can we obviate passing LoggingConfig just to use forkIO?
27− run = liftIO $ forkIO $ flip runLoggingT (handleLog conf) $ do
28− runSpinner (coloredSpinner defaultSpinnerTheme) $ \c -> do
29− logMessage $ Output_Overwrite [c, " ", T.unpack s]
30− cleanup failed tid = do
31− liftIO $ killThread tid
32− logMessage Output_ClearLine
33− let mark = if failed
34− then withColor Red "✖"
35− else withColor Green "✔"
36− logMessage $ Output_Overwrite [mark, " ", T.unpack s, "\n"]
37−
38−-- | A spinner is simply an infinite list of strings that supplant each other in a delayed loop, creating the
39−-- animation of a "spinner".
40−type Spinner = [String]
41−
42−defaultSpinner :: SpinnerTheme -> Spinner
43−defaultSpinner = cycle
44−
45−coloredSpinner :: SpinnerTheme -> Spinner
46−coloredSpinner = defaultSpinner . fmap (withColor Cyan)
47−
48−-- | Run a spinner with a monadic function that defines how to represent the individual spinner characters.
49−runSpinner :: MonadIO m => Spinner -> (String -> m ()) -> m ()
50−runSpinner spinner f = forM_ spinner $ f >=> const delay
51− where
52− delay = liftIO $ threadDelay 100000 -- A shorter delay ensures that we update promptly.
53−
54−type SpinnerTheme = [String]
55−
56−-- Find more spinners at https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json
57−spinnerCircleHalves :: SpinnerTheme
58−spinnerCircleHalves = ["◐", "◓", "◑", "◒"]
59−
60−defaultSpinnerTheme :: SpinnerTheme
61−defaultSpinnerTheme = spinnerCircleHalves
62−
63−-- | Like `bracket` but the `release` function can know whether an exception was raised
64−bracket' :: MonadMask m => m a -> (Bool -> a -> m b) -> (a -> m c) -> m c
65−bracket' acquire release use = mask $ \unmasked -> do
66− resource <- acquire
67− result <- unmasked (use resource) `onException` release True resource
68− _ <- release False resource
69− return result
70−
71−withColor :: Color -> String -> String
72−withColor color s = mconcat
73− [ setSGRCode [SetColor Foreground Vivid color]
74− , s
75− , setSGRCode [Reset]
76− ]
77−
lib/command/src/Obelisk/Command.hs+328−177
@@ -3,38 +3,36 @@
33{-# LANGUAGE MultiParamTypeClasses #-}
44{-# LANGUAGE OverloadedStrings #-}
55{-# LANGUAGE ScopedTypeVariables #-}
6−{-# LANGUAGE StaticPointers #-}
7−{-# LANGUAGE TypeApplications #-}
6+{-# LANGUAGE TupleSections #-}
87module Obelisk.Command where
98
10−import Control.Concurrent (newMVar)
11−import Control.Monad
12−import Control.Monad.IO.Class (liftIO)
13−import Control.Monad.Reader (ask)
14−import qualified Data.Binary as Binary
9+import Control.Monad.IO.Class (MonadIO, liftIO)
1510import Data.Bool (bool)
16−import qualified Data.ByteString.Base16 as Base16
17−import qualified Data.ByteString.Lazy as LBS
18−import Data.List
19−import Data.Maybe (catMaybes)
20−import Data.Monoid
11+import Data.Foldable (for_)
12+import Data.List (isInfixOf, isPrefixOf)
13+import Data.List.NonEmpty (NonEmpty, nonEmpty)
14+import qualified Data.List.NonEmpty as NonEmpty
15+import qualified Data.Map as Map
2116import qualified Data.Text as T
22−import Data.Text.Encoding
23−import GHC.StaticPtr
17+import Data.Traversable (for)
2418import Options.Applicative
19+import Options.Applicative.Help.Pretty (text, (<$$>))
20+import System.Directory
2521import System.Environment
2622import System.FilePath
23+import qualified System.Info
2724import System.IO (hIsTerminalDevice, stdout)
28−import System.Posix.Process (executeFile)
25+import System.Process (rawSystem)
2926
3027import Obelisk.App
31−import Obelisk.CLI (LoggingConfig (LoggingConfig, _loggingConfig_level), Severity (..), cliDemo, failWith,
32− putLog)
28+import Obelisk.CliApp
3329import Obelisk.Command.Deploy
3430import Obelisk.Command.Project
35−import Obelisk.Command.Repl
3631import Obelisk.Command.Run
3732import Obelisk.Command.Thunk
33+import qualified Obelisk.Command.VmBuilder as VmBuilder
34+import qualified Obelisk.Command.Preprocessor as Preprocessor
35+
3836
3937data Args = Args
4038 { _args_noHandOffPassed :: Bool
@@ -46,8 +44,12 @@ data Args = Args
4644 }
4745 deriving Show
4846
49−args :: Parser Args
50−args = Args <$> noHandoff <*> verbose <*> obCommand
47+newtype ArgsConfig = ArgsConfig
48+ { _argsConfig_enableVmBuilderByDefault :: Bool
49+ }
50+
51+args :: ArgsConfig -> Parser Args
52+args cfg = Args <$> noHandoff <*> verbose <*> obCommand cfg
5153
5254noHandoff :: Parser Bool
5355noHandoff = flag False True $ mconcat
@@ -63,8 +65,8 @@ verbose = flag False True $ mconcat
6365 , help "Be more verbose"
6466 ]
6567
66−argsInfo :: ParserInfo Args
67−argsInfo = info (args <**> helper) $ mconcat
68+argsInfo :: ArgsConfig -> ParserInfo Args
69+argsInfo cfg = info (args cfg <**> helper) $ mconcat
6870 [ fullDesc
6971 , progDesc "Manage Obelisk projects"
7072 ]
@@ -72,174 +74,289 @@ argsInfo = info (args <**> helper) $ mconcat
7274initSource :: Parser InitSource
7375initSource = foldl1 (<|>)
7476 [ pure InitSource_Default
75− , InitSource_Branch <$> strOption (long "branch" <> metavar "BRANCH")
76− , InitSource_Symlink <$> strOption (long "symlink" <> metavar "PATH")
77+ , InitSource_Branch <$> strOption (long "branch" <> metavar "BRANCH" <> help "Initialize the project using the given BRANCH of Obelisk's official repository")
78+ , InitSource_Symlink <$> strOption (long "symlink" <> action "directory" <> metavar "PATH" <> help "(Use with caution) Initialize the project using the copy of Obelisk found at the given PATH")
7779 ]
7880
81+initForce :: Parser Bool
82+initForce = switch (long "force" <> help "Allow ob init to overwrite files")
83+
7984data ObCommand
80− = ObCommand_Init InitSource
85+ = ObCommand_Init InitSource Bool
8186 | ObCommand_Deploy DeployCommand
82− | ObCommand_Run
83− | ObCommand_Thunk ThunkCommand
84− | ObCommand_Repl FilePath
85− | ObCommand_Watch FilePath
87+ | ObCommand_Run [(FilePath, Interpret)]
88+ | ObCommand_Profile String [String]
89+ | ObCommand_Thunk ThunkOption
90+ | ObCommand_Repl [(FilePath, Interpret)]
91+ | ObCommand_Watch [(FilePath, Interpret)]
92+ | ObCommand_Shell ShellOpts
93+ | ObCommand_Doc String [String] -- shell and list of packages
94+ | ObCommand_Hoogle String Int -- shell and port
8695 | ObCommand_Internal ObInternal
8796 deriving Show
8897
8998data ObInternal
90− = ObInternal_RunStaticIO StaticKey
91− | ObInternal_CLIDemo
99+ -- the preprocessor argument syntax is also handled outside
100+ -- optparse-applicative, but it shouldn't ever conflict with another syntax
101+ = ObInternal_ApplyPackages String String String [String]
102+ | ObInternal_ExportGhciConfig
103+ [(FilePath, Interpret)]
104+ Bool -- ^ Use relative paths
92105 deriving Show
93106
94−inNixShell' :: MonadObelisk m => StaticPtr (IO ()) -> m ()
95−inNixShell' p = withProjectRoot "." $ \root -> do
96− cmd <- liftIO $ unwords <$> mkCmd -- TODO: shell escape instead of unwords
97− projectShell root False "ghc" cmd
107+obCommand :: ArgsConfig -> Parser ObCommand
108+obCommand cfg = hsubparser
109+ (mconcat
110+ [ command "init" $ info (ObCommand_Init <$> initSource <*> initForce) $ progDesc "Initialize an Obelisk project"
111+ , command "deploy" $ info (ObCommand_Deploy <$> deployCommand cfg) $ progDesc "Prepare a deployment for an Obelisk project"
112+ , command "run" $ info (ObCommand_Run <$> interpretOpts) $ progDesc "Run current project in development mode"
113+ , command "profile" $ info (uncurry ObCommand_Profile <$> profileCommand) $ progDesc "Run current project with profiling enabled"
114+ , command "thunk" $ info (ObCommand_Thunk <$> thunkOption) $ progDesc "Manipulate thunk directories"
115+ , command "repl" $ info (ObCommand_Repl <$> interpretOpts) $ progDesc "Open an interactive interpreter"
116+ , command "watch" $ info (ObCommand_Watch <$> interpretOpts) $ progDesc "Watch current project for errors and warnings"
117+ , command "shell" $ info (ObCommand_Shell <$> shellOpts) $ progDesc "Enter a shell with project dependencies or run a command in such a shell. E.g. ob shell -- ghc-pkg list"
118+ , command "doc" $ info (ObCommand_Doc <$> shellFlags <*> packageNames) $
119+ progDesc "List paths to haddock documentation for specified packages"
120+ <> footerDoc (Just $
121+ text "Hint: To open the documentation you can pipe the output of this command like"
122+ <$$> text "ob doc reflex reflex-dom-core | xargs -n1 xdg-open")
123+ , command "hoogle" $ info (ObCommand_Hoogle <$> shellFlags <*> portOpt 8080) $ progDesc "Run a hoogle server locally for your project's dependency tree"
124+ , command "internal" $ info (ObCommand_Internal <$> internalCommand) $ progDesc "Internal Obelisk commands with unstable APIs"
125+ ])
126+
127+internalCommand :: Parser ObInternal
128+internalCommand = hsubparser $ mconcat
129+ [ command "export-ghci-configuration" $ info (ObInternal_ExportGhciConfig <$> interpretOpts <*> useRelativePathsFlag)
130+ $ progDesc "Export the GHCi configuration used by ob run, etc.; useful for IDE integration"
131+ ]
98132 where
99− mkCmd = do
100− obArgs <- getObArgs
101− progName <- getExecutablePath
102− return $ progName : catMaybes
103− [ Just "--no-handoff"
104− , bool Nothing (Just "--verbose") $ _args_verbose obArgs
105− , Just "internal"
106− , Just "run-static-io"
107− , Just $ encodeStaticKey $ staticKey p
108− ]
109−
110−obCommand :: Parser ObCommand
111−obCommand = hsubparser
112− (mconcat
113− [ command "init" $ info (ObCommand_Init <$> initSource) $ progDesc "Initialize an Obelisk project"
114− , command "deploy" $ info (ObCommand_Deploy <$> deployCommand) $ progDesc "Prepare a deployment for an Obelisk project"
115− , command "run" $ info (pure ObCommand_Run) $ progDesc "Run current project in development mode"
116− , command "thunk" $ info (ObCommand_Thunk <$> thunkCommand) $ progDesc "Manipulate thunk directories"
117− , command "repl" $ info (ObCommand_Repl <$> strArgument (action "directory")) $ progDesc "Open an interactive interpreter"
118− , command "watch" $ info (ObCommand_Watch <$> strArgument (action "directory"))$ progDesc "Watch directory for changes and update interactive interpreter"
119− ])
120− <|> subparser
121− (mconcat
122− [ internal
123− , command "internal" (info (ObCommand_Internal <$> internalCommand) mempty)
124− ])
125−
126−deployCommand :: Parser DeployCommand
127−deployCommand = hsubparser $ mconcat
128− [ command "init" $ info deployInitCommand $ progDesc "Initialize a deployment configuration directory"
129− , command "push" $ info (pure DeployCommand_Push) mempty
133+ useRelativePathsFlag = switch (long "use-relative-paths" <> help "Use relative paths")
134+
135+packageNames :: Parser [String]
136+packageNames = some (strArgument (metavar "PACKAGE-NAME..."))
137+
138+deployCommand :: ArgsConfig -> Parser DeployCommand
139+deployCommand cfg = hsubparser $ mconcat
140+ [ command "init" $ info (DeployCommand_Init <$> deployInitOpts) $ progDesc "Initialize a deployment configuration directory"
141+ , command "push" $ info (DeployCommand_Push <$> remoteBuilderParser) mempty
142+ , command "test" $ info (DeployCommand_Test <$> platformP) $ progDesc "Test your obelisk project from a mobile platform."
130143 , command "update" $ info (pure DeployCommand_Update) $ progDesc "Update the deployment's src thunk to latest"
131144 ]
132−
133−deployInitCommand :: Parser DeployCommand
134−deployInitCommand = fmap DeployCommand_Init $ DeployInitOpts
135− <$> strArgument (action "directory" <> metavar "DEPLOYDIR" <> help "Path to a directory that it will create")
136− <*> strOption (long "ssh-key" <> action "file" <> metavar "SSHKEY" <> help "Path to an ssh key that it will symlink to")
145+ where
146+ platformP = hsubparser $ mconcat
147+ [ command "android" $ info (pure (Android, [])) mempty
148+ , command "ios" $ info ((,) <$> pure IOS <*> fmap pure (strArgument (metavar "TEAMID" <> help "Your Team ID - found in the Apple developer portal"))) mempty
149+ ]
150+
151+ remoteBuilderParser :: Parser (Maybe RemoteBuilder)
152+ remoteBuilderParser =
153+ flag (if enabledByDefault then enabled else Nothing) enabled (mconcat
154+ [ long $ "enable-" <> flagBase
155+ , help $ "Enable " <> flagDesc <> (if enabledByDefault then " (default)" else "")
156+ ])
157+ <|> flag enabled Nothing (mconcat
158+ [ long $ "disable-" <> flagBase
159+ , help $ "Disable a " <> flagDesc <> (if not enabledByDefault then " (default)" else "")
160+ ])
161+ where
162+ enabledByDefault = _argsConfig_enableVmBuilderByDefault cfg
163+ enabled = Just RemoteBuilder_ObeliskVM
164+ flagBase = "vm-builder"
165+ flagDesc = "managed Linux virtual machine as a Nix remote builder (requires Docker)"
166+
167+
168+deployInitOpts :: Parser DeployInitOpts
169+deployInitOpts = DeployInitOpts
170+ <$> strArgument (action "directory" <> metavar "DEPLOYDIR" <> help "Path to a directory where the deployment repository will be initialized")
171+ <*> strOption (long "ssh-key" <> action "file" <> metavar "SSHKEY" <> help "Path to an SSH key that will be *copied* to the deployment repository")
137172 <*> some (strOption (long "hostname" <> metavar "HOSTNAME" <> help "hostname of the deployment target"))
138− <*> strOption (long "upstream" <> value "origin" <> metavar "REMOTE" <> help "git remote to use for the src thunk" <> showDefault)
173+ <*> strOption (long "route" <> metavar "PUBLICROUTE" <> help "Publicly accessible URL of your app")
174+ <*> strOption (long "admin-email" <> metavar "ADMINEMAIL" <> help "Email address where administrative alerts will be sent")
175+ <*> flag True False (long "disable-https" <> help "Disable automatic https configuration for the backend")
176+
177+type TeamID = String
178+data RemoteBuilder = RemoteBuilder_ObeliskVM
179+ deriving (Eq, Show)
139180
140181data DeployCommand
141182 = DeployCommand_Init DeployInitOpts
142− | DeployCommand_Push
183+ | DeployCommand_Push (Maybe RemoteBuilder)
184+ | DeployCommand_Test (PlatformDeployment, [String])
143185 | DeployCommand_Update
144186 deriving Show
145187
146−data DeployInitOpts = DeployInitOpts
147− { _deployInitOpts_outputDir :: FilePath
148− , _deployInitOpts_sshKey :: FilePath
149− , _deployInitOpts_hostname :: [String]
150− , _deployInitOpts_remote :: String
151− }
152− deriving Show
188+profileCommand :: Parser (String, [String])
189+profileCommand = (,)
190+ <$> strOption
191+ ( long "output"
192+ <> short 'o'
193+ <> help "Base output to use for profiling output. Suffixes are added to this based on the profiling type. Defaults to a timestamped path in the profile/ directory in the project's root."
194+ <> metavar "PATH"
195+ <> value "profile/%Y-%m-%dT%H:%M:%S"
196+ <> showDefault
197+ )
198+ <*> (words <$> strOption
199+ ( long "rts-flags"
200+ <> help "RTS Flags to pass to the executable."
201+ <> value "-p -hc"
202+ <> metavar "FLAGS"
203+ <> showDefault
204+ ))
205+
206+thunkConfig :: Parser ThunkConfig
207+thunkConfig = ThunkConfig
208+ <$>
209+ ( flag' (Just True) (long "private" <> help "Mark thunks as pointing to a private repository")
210+ <|> flag' (Just False) (long "public" <> help "Mark thunks as pointing to a public repository")
211+ <|> pure Nothing
212+ )
213+
214+thunkUpdateConfig :: Parser ThunkUpdateConfig
215+thunkUpdateConfig = ThunkUpdateConfig
216+ <$> optional (strOption (long "branch" <> metavar "BRANCH" <> help "Use the given branch when looking for the latest revision"))
217+ <*> thunkConfig
218+
219+thunkPackConfig :: Parser ThunkPackConfig
220+thunkPackConfig = ThunkPackConfig
221+ <$> switch (long "force" <> short 'f' <> help "Force packing thunks even if there are branches not pushed upstream, uncommitted changes, stashes. This will cause changes that have not been pushed upstream to be lost; use with care.")
222+ <*> thunkConfig
223+
224+data ThunkOption = ThunkOption
225+ { _thunkOption_thunks :: NonEmpty FilePath
226+ , _thunkOption_command :: ThunkCommand
227+ } deriving Show
153228
154−internalCommand :: Parser ObInternal
155−internalCommand = subparser $ mconcat
156− [ command "run-static-io" $ info (ObInternal_RunStaticIO <$> argument (eitherReader decodeStaticKey) (action "static-key")) mempty
157− , command "clidemo" $ info (pure ObInternal_CLIDemo) mempty
158− ]
229+data ThunkCommand
230+ = ThunkCommand_Update ThunkUpdateConfig
231+ | ThunkCommand_Unpack
232+ | ThunkCommand_Pack ThunkPackConfig
233+ deriving Show
159234
160−--TODO: Result should provide normalised path and also original user input for error reporting.
161−thunkDirectoryParser :: Parser FilePath
162−thunkDirectoryParser = fmap (dropTrailingPathSeparator . normalise) . strArgument $ mconcat
163− [ action "directory"
164− , metavar "THUNKDIR"
165− , help "Path to directory containing thunk data"
235+thunkOption :: Parser ThunkOption
236+thunkOption = hsubparser $ mconcat
237+ [ command "update" $ info (thunkOptionWith $ ThunkCommand_Update <$> thunkUpdateConfig) $ progDesc "Update packed thunk to latest revision available on the tracked branch"
238+ , command "unpack" $ info (thunkOptionWith $ pure ThunkCommand_Unpack) $ progDesc "Unpack thunk into git checkout of revision it points to"
239+ , command "pack" $ info (thunkOptionWith $ ThunkCommand_Pack <$> thunkPackConfig) $ progDesc "Pack git checkout or unpacked thunk into thunk that points at the current branch's upstream"
166240 ]
167−
168−data ThunkPackOpts = ThunkPackOpts
169− { _thunkPackOpts_directory :: FilePath
170− , _thunkPackOpts_upstream :: String
171− }
241+ where
242+ thunkOptionWith f = ThunkOption
243+ <$> ((NonEmpty.:|)
244+ <$> thunkDirArg (metavar "THUNKDIRS..." <> help "Paths to directories containing thunk data")
245+ <*> many (thunkDirArg mempty)
246+ )
247+ <*> f
248+ thunkDirArg opts = fmap (dropTrailingPathSeparator . normalise) $ strArgument $ action "directory" <> opts
249+
250+data ShellOpts
251+ = ShellOpts
252+ { _shellOpts_shell :: String
253+ , _shellOpts_interpretPaths :: [(FilePath, Interpret)]
254+ , _shellOpts_command :: Maybe String
255+ }
172256 deriving Show
173257
174−data ThunkCommand
175− = ThunkCommand_Update [FilePath]
176− | ThunkCommand_Unpack [FilePath]
177− | ThunkCommand_Pack [ThunkPackOpts]
178− deriving Show
258+shellFlags :: Parser String
259+shellFlags =
260+ flag' "ghc" (long "ghc" <> help "Enter a shell environment having ghc (default)")
261+ <|> flag "ghc" "ghcjs" (long "ghcjs" <> help "Enter a shell having ghcjs rather than ghc")
262+ <|> strOption (short 'A' <> long "argument" <> metavar "NIXARG" <> help "Use the environment specified by the given nix argument of `shells'")
263+
264+interpretOpts :: Parser [(FilePath, Interpret)]
265+interpretOpts = many
266+ ( (, Interpret_Interpret) <$>
267+ strOption (common <> long "interpret" <> help
268+ "Don't pre-build packages found in DIR when constructing the package database. The default behavior is \
269+ \'--interpret <project-root>', which will load everything which is unpacked into GHCi. \
270+ \ Use --interpret and --no-interpret multiple times to add or remove multiple trees \
271+ \ from the environment. Settings for right-most directories will \
272+ \ override settings for any identical directories given earlier."
273+ )
274+ <|> (, Interpret_NoInterpret) <$>
275+ strOption (common <> long "no-interpret" <> help
276+ "Make packages found in DIR available in the package database (but only when they are used dependencies). \
277+ \ This will build the packages in DIR before loading GHCi. \
278+ \See help for --interpret for how the two options are related."
279+ )
280+ )
281+ where
282+ common = action "directory" <> metavar "DIR"
179283
180−thunkPackOpts :: Parser ThunkPackOpts
181−thunkPackOpts = (ThunkPackOpts <$> thunkDirectoryParser <*>) . strOption $ mconcat
182− [ long "upstream"
183− , value "origin"
184− , metavar "REMOTE"
185− , help "Git remote that packed thunk will point to"
186− , showDefault
187− ]
284+shellOpts :: Parser ShellOpts
285+shellOpts = ShellOpts
286+ <$> shellFlags
287+ <*> interpretOpts
288+ -- This funny construction is used to support optparse-applicative's @--@ parsing.
289+ -- All arguments after @--@ are left unparsed and instead provided to the last positional parser
290+ -- which must therefore be 'many' in order to consume the rest of the input.
291+ <*> ((\xs -> if null xs then Nothing else Just $ unwords xs) <$> many (strArgument (metavar "COMMAND")))
188292
189−thunkCommand :: Parser ThunkCommand
190−thunkCommand = hsubparser $ mconcat
191− [ command "update" $ info (ThunkCommand_Update <$> some thunkDirectoryParser) $ progDesc "Update thunk to latest revision available"
192− , command "unpack" $ info (ThunkCommand_Unpack <$> some thunkDirectoryParser) $ progDesc "Unpack thunk into git checkout of revision it points to"
193− , command "pack" $ info (ThunkCommand_Pack <$> some thunkPackOpts) $ progDesc "Pack git checkout into thunk that points at given upstream"
194− ]
293+portOpt :: Int -> Parser Int
294+portOpt dfault = option auto (long "port" <> short 'p' <> help "Port number for server" <> showDefault <> value dfault <> metavar "INT")
195295
196296parserPrefs :: ParserPrefs
197297parserPrefs = defaultPrefs
198298 { prefShowHelpOnEmpty = True
199299 }
200300
201−-- | Are we on a terminal with active user interaction?
202−isInteractiveTerm :: IO Bool
203−isInteractiveTerm = do
204− isTerm <- hIsTerminalDevice stdout
205− -- Running in bash/fish/zsh completion
206− inShellCompletion <- liftIO $ isInfixOf "completion" . unwords <$> getArgs
207− return $ isTerm && not inShellCompletion
208−
301+-- | Create an Obelisk config for the current process.
209302mkObeliskConfig :: IO Obelisk
210303mkObeliskConfig = do
211− logLevel <- getLogLevel <$> getObArgs
304+ cliArgs <- getArgs
305+ -- This function should not use argument parser (full argument parsing happens post handoff)
306+ -- TODO: See if we can use the argument parser with a subset of the parsers to get logging level out.
307+ let logLevel = toLogLevel $ any (`elem` ["-v", "--verbose"]) cliArgs
212308 notInteractive <- not <$> isInteractiveTerm
213− loggingConfig <- LoggingConfig logLevel notInteractive <$> newMVar False
214− return $ Obelisk notInteractive loggingConfig
309+ cliConf <- newCliConfig logLevel notInteractive notInteractive $ \case
310+ ObeliskError_ProcessError (ProcessFailure p code) ann ->
311+ ( "Process exited with code " <> T.pack (show code) <> "; " <> reconstructCommand p
312+ <> maybe "" ("\n" <>) ann
313+ , 2
314+ )
315+ ObeliskError_Unstructured msg -> (msg, 2)
316+
317+ return $ Obelisk cliConf
215318 where
216− getLogLevel = bool Notice Debug . _args_verbose
217−
218−getObArgs :: IO Args
219−getObArgs = getArgs >>= handleParseResult . execParserPure parserPrefs argsInfo
319+ toLogLevel = bool Notice Debug
320+ isInteractiveTerm = do
321+ isTerm <- hIsTerminalDevice stdout
322+ -- Running in bash/fish/zsh completion
323+ inShellCompletion <- liftIO $ isInfixOf "completion" . unwords <$> getArgs
324+
325+ -- Respect the user’s TERM environment variable. Dumb terminals
326+ -- like Eshell cannot handle lots of control sequences that the
327+ -- spinner uses.
328+ termEnv <- lookupEnv "TERM"
329+ let isDumb = termEnv == Just "dumb"
330+
331+ return $ isTerm && not inShellCompletion && not isDumb
332+
333+-- | For use from development obelisk repls
334+--
335+-- Example:
336+-- > runCommand $ someFuncInMonadObelisk ...
337+runCommand :: ObeliskT IO a -> IO a
338+runCommand f = flip runObelisk f =<< mkObeliskConfig
220339
221340main :: IO ()
222−main = mkObeliskConfig >>= (`runObelisk` ObeliskT main')
341+main = runCommand . main' =<< getArgsConfig
223342
224−main' :: MonadObelisk m => m ()
225−main' = do
226− c <- ask
343+main' :: MonadObelisk m => ArgsConfig -> m ()
344+main' argsCfg = do
227345 obPath <- liftIO getExecutablePath
228− obArgs <- liftIO getObArgs
346+ myArgs <- liftIO getArgs
347+ logLevel <- getLogLevel
229348 putLog Debug $ T.pack $ unwords
230349 [ "Starting Obelisk <" <> obPath <> ">"
231− , "args=" <> show obArgs
232− , "noSpinner=" <> show (_obelisk_noSpinner c)
233− , "logging-level=" <> show (_loggingConfig_level $ _obelisk_logging c)
350+ , "args=" <> show myArgs
351+ , "logging-level=" <> show logLevel
234352 ]
235353
236354 --TODO: We'd like to actually use the parser to determine whether to hand off,
237355 --but in the case where this implementation of 'ob' doesn't support all
238356 --arguments being passed along, this could fail. For now, we don't bother
239357 --with optparse-applicative until we've done the handoff.
240− myArgs <- liftIO getArgs
241358 let go as = do
242− args' <- liftIO $ handleParseResult (execParserPure parserPrefs argsInfo as)
359+ args' <- liftIO $ handleParseResult (execParserPure parserPrefs (argsInfo argsCfg) as)
243360 case _args_noHandOffPassed args' of
244361 False -> return ()
245362 True -> putLog Warning "--no-handoff should only be passed once and as the first argument; ignoring"
@@ -249,9 +366,13 @@ main' = do
249366 Just impl -> do
250367 -- Invoke the real implementation, using --no-handoff to prevent infinite recursion
251368 putLog Debug $ "Handing off to " <> T.pack impl
252− liftIO $ executeFile impl False ("--no-handoff" : myArgs) Nothing
369+ _ <- liftIO $ rawSystem impl ("--no-handoff" : myArgs)
370+ return ()
253371 case myArgs of
254372 "--no-handoff" : as -> go as -- If we've been told not to hand off, don't hand off
373+ origPath:inPath:outPath:preprocessorName:packagePaths
374+ | preprocessorName == preprocessorIdentifier && any (\c -> c == '.' || c == pathSeparator) origPath ->
375+ ob $ ObCommand_Internal $ ObInternal_ApplyPackages origPath inPath outPath packagePaths
255376 a:as -- Otherwise bash completion would always hand-off even if the user isn't trying to
256377 | "--bash-completion" `isPrefixOf` a
257378 && "--no-handoff" `elem` as -> go (a:as)
@@ -260,45 +381,75 @@ main' = do
260381
261382ob :: MonadObelisk m => ObCommand -> m ()
262383ob = \case
263− ObCommand_Init source -> initProject source
384+ ObCommand_Init source force -> initProject source force
264385 ObCommand_Deploy dc -> case dc of
265− DeployCommand_Init deployOpts -> withProjectRoot "." $ \root -> do
266− thunkPtr <- readThunk root >>= \case
267− Left err -> failWith $ T.pack $ "thunk pack: " <> show err
268− Right (ThunkData_Packed ptr) -> return ptr
269− Right (ThunkData_Checkout (Just ptr)) -> return ptr
270− Right (ThunkData_Checkout Nothing) ->
271− getThunkPtr root (_deployInitOpts_remote deployOpts)
272− let deployDir = _deployInitOpts_outputDir deployOpts
273− sshKeyPath = _deployInitOpts_sshKey deployOpts
274− hostname = _deployInitOpts_hostname deployOpts
275− deployInit thunkPtr (root </> "config") deployDir sshKeyPath hostname
276− DeployCommand_Push -> deployPush "."
386+ DeployCommand_Init deployOpts -> withProjectRoot "." $ \root -> deployInit deployOpts root
387+ DeployCommand_Push remoteBuilder -> do
388+ deployPath <- liftIO $ canonicalizePath "."
389+ deployPush deployPath $ case remoteBuilder of
390+ Nothing -> pure []
391+ Just RemoteBuilder_ObeliskVM -> (:[]) <$> VmBuilder.getNixBuildersArg
277392 DeployCommand_Update -> deployUpdate "."
278− ObCommand_Run -> inNixShell' $ static run
279− -- inNixShell ($(mkClosure 'ghcidAction) ())
280− ObCommand_Thunk tc -> case tc of
281− ThunkCommand_Update thunks -> mapM_ updateThunkToLatest thunks
282− ThunkCommand_Unpack thunks -> mapM_ unpackThunk thunks
283− ThunkCommand_Pack thunks -> forM_ thunks $ \(ThunkPackOpts dir upstream) -> packThunk dir upstream
284− ObCommand_Repl component -> runRepl component
285− ObCommand_Watch component -> watch component
393+ DeployCommand_Test (platform, extraArgs) -> deployMobile platform extraArgs
394+ ObCommand_Run interpretPathsList -> withInterpretPaths interpretPathsList run
395+ ObCommand_Profile basePath rtsFlags -> profile basePath rtsFlags
396+ ObCommand_Thunk to -> case _thunkOption_command to of
397+ ThunkCommand_Update config -> for_ thunks (updateThunkToLatest config)
398+ ThunkCommand_Unpack -> for_ thunks unpackThunk
399+ ThunkCommand_Pack config -> for_ thunks (packThunk config)
400+ where
401+ thunks = _thunkOption_thunks to
402+ ObCommand_Repl interpretPathsList -> withInterpretPaths interpretPathsList runRepl
403+ ObCommand_Watch interpretPathsList -> withInterpretPaths interpretPathsList runWatch
404+ ObCommand_Shell (ShellOpts shellAttr interpretPathsList cmd) -> withInterpretPaths interpretPathsList $ \root interpretPaths ->
405+ nixShellForInterpretPaths False shellAttr root interpretPaths cmd -- N.B. We do NOT bash escape here; we want to run the command as-is
406+ ObCommand_Doc shellAttr pkgs -> withInterpretPaths [] $ \root interpretPaths ->
407+ nixShellForInterpretPaths True shellAttr root interpretPaths $ Just $ haddockCommand pkgs
408+ ObCommand_Hoogle shell' port -> withProjectRoot "." $ \root -> do
409+ nixShellWithHoogle root True shell' $ Just $ "hoogle server -p" <> show port <> " --local"
286410 ObCommand_Internal icmd -> case icmd of
287− ObInternal_RunStaticIO k -> liftIO (unsafeLookupStaticPtr @(IO ()) k) >>= \case
288− Nothing -> failWith $ "ObInternal_RunStaticIO: no such StaticKey: " <> T.pack (show k)
289− Just p -> liftIO $ deRefStaticPtr p
290− ObInternal_CLIDemo -> cliDemo
411+ ObInternal_ApplyPackages origPath inPath outPath packagePaths -> do
412+ liftIO $ Preprocessor.applyPackages origPath inPath outPath packagePaths
413+ ObInternal_ExportGhciConfig interpretPathsList useRelativePaths ->
414+ liftIO . putStrLn . unlines =<< withInterpretPaths interpretPathsList (exportGhciConfig useRelativePaths)
415+
416+-- | A helper for the common case that the command you want to run needs the project root and a resolved
417+-- set of interpret paths.
418+withInterpretPaths :: MonadObelisk m => [(FilePath, Interpret)] -> (FilePath -> PathTree Interpret -> m a) -> m a
419+withInterpretPaths interpretPathsList f = withProjectRoot "." $ \root -> do
420+ interpretPaths' <- resolveInterpretPaths $ (root, Interpret_Interpret) : interpretPathsList
421+ case interpretPaths' of
422+ Nothing -> failWith "No paths provided for finding packages"
423+ Just interpretPaths -> f root interpretPaths
424+
425+haddockCommand :: [String] -> String
426+haddockCommand pkgs = unwords
427+ [ "for p in"
428+ , unwords [getHaddockPath p ++ "/index.html" | p <- pkgs]
429+ , "; do echo $p; done"
430+ ]
431+ where getHaddockPath p = "$(ghc-pkg field " ++ p ++ " haddock-html --simple-output)"
291432
292433--TODO: Clean up all the magic strings throughout this codebase
293434
294−encodeStaticKey :: StaticKey -> String
295−encodeStaticKey = T.unpack . decodeUtf8 . Base16.encode . LBS.toStrict . Binary.encode
296−
297−-- TODO: Use failWith in place of fail to be consistent.
298−decodeStaticKey :: String -> Either String StaticKey
299−decodeStaticKey s = case Base16.decode $ encodeUtf8 $ T.pack s of
300− (b, "") -> case Binary.decodeOrFail $ LBS.fromStrict b of
301− Right ("", _, a) -> pure a
302− Right _ -> fail "decodeStaticKey: Binary.decodeOrFail didn't consume all input"
303− Left (_, _, e) -> fail $ "decodeStaticKey: Binary.decodeOrFail failed: " <> show e
304− _ -> fail $ "decodeStaticKey: could not decode hex string: " <> show s
435+getArgsConfig :: IO ArgsConfig
436+getArgsConfig = pure $ ArgsConfig { _argsConfig_enableVmBuilderByDefault = System.Info.os == "darwin" }
437+
438+-- | Resolves an ordered list of paths for use with @--interpret@/@--no-interpret@ by coalescing
439+-- paths into a non-ambiguous set of paths. Ambiguity is resolved by choosing right-most paths
440+-- over any preceeding identical paths.
441+--
442+-- For example: @a/b=ON a/b/c=OFF@ and @a/b/c=OFF a/b=ON@ are the same.
443+-- @a/b=ON a/b=OFF@ is reduced to @a/b=OFF@. We prefer right-biased choice to increase
444+-- scriptability.
445+--
446+-- N.B. All the paths in the result will be canonicalized. It's impossible to determine path
447+-- overlap otherwise.
448+resolveInterpretPaths :: MonadIO m => [(FilePath, a)] -> m (Maybe (PathTree a))
449+resolveInterpretPaths ps = do
450+ trees <- liftIO $ for ps $ \(p, a) -> pathToTree a <$> canonicalizePath p
451+ pure $ foldr1 mergeTrees <$> nonEmpty trees
452+ where
453+ -- | Merge two 'PathTree's preferring leaves on the right in as much as they overlap with paths on the left.
454+ mergeTrees :: PathTree a -> PathTree a -> PathTree a
455+ mergeTrees (PathTree_Node ax x) (PathTree_Node ay y) = PathTree_Node (ay <|> ax) $ Map.unionWith mergeTrees x y
lib/command/src/Obelisk/Command/Deploy.hs+357−90
@@ -1,119 +1,386 @@
1+{-# LANGUAGE DeriveGeneric #-}
12{-# LANGUAGE FlexibleContexts #-}
23{-# LANGUAGE LambdaCase #-}
34{-# LANGUAGE OverloadedStrings #-}
5+{-# LANGUAGE QuasiQuotes #-}
46{-# LANGUAGE ScopedTypeVariables #-}
7+{-# LANGUAGE ViewPatterns #-}
58module Obelisk.Command.Deploy where
69
7−import Control.Applicative
10+import Control.Applicative (liftA2)
11+import Control.Lens
812import Control.Monad
9−import Control.Monad.Catch (finally)
10−import Control.Monad.IO.Class (liftIO)
11−import Data.Attoparsec.ByteString.Char8 as A
12−import qualified Data.ByteString.Char8 as BC8
13+import Control.Monad.Catch (Exception (displayException), MonadThrow, bracket, throwM, try)
14+import Control.Monad.IO.Class (MonadIO, liftIO)
15+import Data.Aeson (FromJSON, ToJSON, encode, eitherDecode)
16+import Data.Bits
17+import qualified Data.ByteString.Lazy as BSL
1318import Data.Default
14−import Data.Maybe
15−import Data.Monoid
19+import qualified Data.Map as Map
20+import qualified Data.Set as Set
21+import Data.String.Here.Interpolated (i)
1622import qualified Data.Text as T
1723import qualified Data.Text.IO as T
24+import GHC.Generics
1825import System.Directory
19−import System.Exit (ExitCode (..))
2026import System.FilePath
21−import System.Process
27+import System.IO
28+import System.PosixCompat.Files
29+import Text.URI (URI)
30+import qualified Text.URI as URI
31+import Text.URI.Lens
2232
2333import Obelisk.App (MonadObelisk)
24−import Obelisk.CLI (Severity (..), callProcessAndLogOutput, failWith)
34+import Obelisk.CliApp (
35+ Severity (..), callProcessAndLogOutput, failWith, proc, putLog,
36+ setCwd, setDelegateCtlc, setEnvOverride, withSpinner)
2537import Obelisk.Command.Nix
38+import Obelisk.Command.Project
2639import Obelisk.Command.Thunk
2740import Obelisk.Command.Utils
2841
29−deployInit :: MonadObelisk m => ThunkPtr -> FilePath -> FilePath -> FilePath -> [String] -> m ()
30−deployInit thunkPtr configDir deployDir sshKeyPath hostnames = do
31− hasConfigDir <- liftIO $ do
32− createDirectoryIfMissing True deployDir
33− doesDirectoryExist configDir
34− when hasConfigDir $ do
35− callProcessAndLogOutput (Notice, Error) $
36− cp
37− [ "-r"
38− , "-T"
39− , configDir
40− , deployDir </> "config"
41− ]
42− keyExists <- liftIO $ doesFileExist sshKeyPath
43− when keyExists $ do
44− let localKey = deployDir </> "ssh_key"
42+data DeployInitOpts = DeployInitOpts
43+ { _deployInitOpts_outputDir :: FilePath
44+ , _deployInitOpts_sshKey :: FilePath
45+ , _deployInitOpts_hostname :: [String]
46+ , _deployInitOpts_route :: String
47+ , _deployInitOpts_adminEmail :: String
48+ , _deployInitOpts_enableHttps :: Bool
49+ } deriving Show
50+
51+deployInit :: MonadObelisk m => DeployInitOpts -> FilePath -> m ()
52+deployInit deployOpts root = do
53+ let deployDir = _deployInitOpts_outputDir deployOpts
54+ rootEqualsTarget <- liftIO $ liftA2 equalFilePath (canonicalizePath root) (canonicalizePath deployDir)
55+ when rootEqualsTarget $
56+ failWith [i|Deploy directory ${deployDir} should not be the same as project root.|]
57+ thunkPtr <- readThunk root >>= \case
58+ Right (ThunkData_Packed _ ptr) -> return ptr
59+ _ -> getThunkPtr CheckClean_NotIgnored root Nothing
60+ deployInit' thunkPtr deployOpts
61+
62+deployInit'
63+ :: MonadObelisk m
64+ => ThunkPtr
65+ -> DeployInitOpts
66+ -> m ()
67+deployInit' thunkPtr (DeployInitOpts deployDir sshKeyPath hostnames route adminEmail enableHttps) = do
68+ liftIO $ createDirectoryIfMissing True deployDir
69+ localKey <- withSpinner ("Preparing " <> T.pack deployDir) $ do
70+ localKey <- liftIO (doesFileExist sshKeyPath) >>= \case
71+ False -> failWith $ T.pack $ "ob deploy init: file does not exist: " <> sshKeyPath
72+ True -> pure $ deployDir </> "ssh_key"
4573 callProcessAndLogOutput (Notice, Error) $
46− cp [sshKeyPath, localKey]
47− liftIO $ setPermissions localKey $ setOwnerWritable True $ setOwnerReadable True emptyPermissions
48− liftIO $ do
49− createThunk (deployDir </> "src") thunkPtr
50− writeFile (deployDir </> "backend_hosts") $ unlines hostnames
74+ proc cp [sshKeyPath, localKey]
75+ liftIO $ setFileMode localKey $ ownerReadMode .|. ownerWriteMode
76+ return localKey
77+ withSpinner "Validating configuration" $ do
78+ void $ getHostFromRoute enableHttps route -- make sure that hostname is present
79+ forM_ hostnames $ \hostname -> do
80+ putLog Notice $ "Verifying host keys (" <> T.pack hostname <> ")"
81+ -- Note: we can't use a spinner here as this function will prompt the user.
82+ verifyHostKey (deployDir </> "backend_known_hosts") localKey hostname
83+ --IMPORTANT: We cannot copy config directory from the development project to
84+ --the deployment directory. If we do, it's very likely someone will
85+ --accidentally create a production deployment that uses development
86+ --credentials to connect to some resources. This could result in, e.g.,
87+ --production data backed up to a dev environment.
88+ withSpinner "Creating project configuration directories" $ liftIO $ do
89+ mapM_ (createDirectoryIfMissing True)
90+ [ deployDir </> "config" </> "backend"
91+ , deployDir </> "config" </> "common"
92+ , deployDir </> "config" </> "frontend"
93+ ]
94+
95+ let srcDir = deployDir </> "src"
96+ withSpinner ("Creating source thunk (" <> T.pack (makeRelative deployDir srcDir) <> ")") $ do
97+ createThunk srcDir $ Right thunkPtr
98+ setupObeliskImpl deployDir
99+
100+ withSpinner "Writing deployment configuration" $ do
101+ writeDeployConfig deployDir "backend_hosts" $ unlines hostnames
102+ writeDeployConfig deployDir "enable_https" $ show enableHttps
103+ writeDeployConfig deployDir "admin_email" adminEmail
104+ writeDeployConfig deployDir ("config" </> "common" </> "route") route
105+ writeDeployConfig deployDir "module.nix" $
106+ "(import " <> toNixPath (makeRelative deployDir srcDir) <> " {}).obelisk.serverModules.mkBaseEc2"
107+
108+ withSpinner ("Initializing git repository (" <> T.pack deployDir <> ")") $
51109 initGit deployDir
52110
53−deployPush :: MonadObelisk m => FilePath -> m ()
54−deployPush deployPath = do
55− host <- liftIO $ fmap (T.unpack . T.strip) $ T.readFile $ deployPath </> "backend_hosts"
111+setupObeliskImpl :: MonadIO m => FilePath -> m ()
112+setupObeliskImpl deployDir = liftIO $ do
113+ let
114+ implDir = toImplDir deployDir
115+ goBackUp = foldr (</>) "" $ (".." <$) $ splitPath $ makeRelative deployDir implDir
116+ createDirectoryIfMissing True implDir
117+ writeFile (implDir </> "default.nix") $ "(import " <> toNixPath (goBackUp </> "src") <> " {}).obelisk"
118+
119+deployPush :: MonadObelisk m => FilePath -> m [String] -> m ()
120+deployPush deployPath getNixBuilders = do
121+ hosts <- Set.fromList . filter (/= mempty) . lines <$> readDeployConfig deployPath "backend_hosts"
122+ adminEmail <- readDeployConfig deployPath "admin_email"
123+ enableHttps <- read <$> readDeployConfig deployPath "enable_https"
124+ route <- readDeployConfig deployPath $ "config" </> "common" </> "route"
125+ routeHost <- getHostFromRoute enableHttps route
56126 let srcPath = deployPath </> "src"
57− build = do
58− buildOutput <- nixBuild $ def
59− { _nixBuildConfig_target = Target
60− { _target_path = srcPath
61− , _target_attr = Just "server"
62− }
63− , _nixBuildConfig_outLink = OutLink_None
64− , _nixBuildConfig_args = pure $ Arg "hostName" host
65− }
66− return $ listToMaybe $ lines buildOutput
67− result <- readThunk srcPath >>= \case
68− Right (ThunkData_Packed _) ->
69− build
70− Right (ThunkData_Checkout _) -> do
71− liftIO (checkGitCleanStatus srcPath) >>= \case
72− True -> do
73− result <- build
74− packThunk srcPath "origin" -- get upstream
75− return result
76− False -> do
77− _ <- failWith $ T.pack $ "ob deploy push: ensure " <> srcPath <> " has no pending changes and latest is pushed upstream."
78− return Nothing
79− _ -> return Nothing
80− liftIO $ forM_ result $ \res -> do
81− let deployAndSwitch outputPath sshAgentEnv = do
82− callProcess' (Just sshAgentEnv) "ssh-add" [deployPath </> "ssh_key"]
83− callProcess' (Just sshAgentEnv) "nix-copy-closure" ["-v", "--to", "root@" <> host, "--gzip", outputPath]
84− callProcess' (Just sshAgentEnv) "ssh"
85− [ "root@" <> host
86− , unwords
87− [ "nix-env -p /nix/var/nix/profiles/system --set " <> outputPath
88− , "&&"
89− , "/nix/var/nix/profiles/system/bin/switch-to-configuration switch"
90− ]
127+ thunkPtr <- readThunk srcPath >>= \case
128+ Right (ThunkData_Packed _ ptr) -> return ptr
129+ Right ThunkData_Checkout -> do
130+ checkGitCleanStatus srcPath True >>= \case
131+ True -> packThunk (ThunkPackConfig False (ThunkConfig Nothing)) srcPath
132+ False -> failWith $ T.pack $ "ob deploy push: ensure " <> srcPath <> " has no pending changes and latest is pushed upstream."
133+ Left err -> failWith $ "ob deploy push: couldn't read src thunk: " <> T.pack (show err)
134+ let version = show . _thunkRev_commit $ _thunkPtr_rev thunkPtr
135+ builders <- getNixBuilders
136+ let moduleFile = deployPath </> "module.nix"
137+ moduleFileExists <- liftIO $ doesFileExist moduleFile
138+ buildOutputByHost <- ifor (Map.fromSet (const ()) hosts) $ \host () -> do
139+ --TODO: What does it mean if this returns more or less than 1 line of output?
140+ [result] <- fmap lines $ nixCmd $ NixCmd_Build $ def
141+ & nixCmdConfig_target .~ Target
142+ { _target_path = Just srcPath
143+ , _target_attr = Just "server.system"
144+ , _target_expr = Nothing
145+ }
146+ & nixBuildConfig_outLink .~ OutLink_None
147+ & nixCmdConfig_args .~ (
148+ [ strArg "hostName" host
149+ , strArg "adminEmail" adminEmail
150+ , strArg "routeHost" routeHost
151+ , strArg "version" version
152+ , boolArg "enableHttps" enableHttps
153+ ] <> [rawArg "module" ("import " <> toNixPath moduleFile) | moduleFileExists ])
154+ & nixCmdConfig_builders .~ builders
155+ pure result
156+ let knownHostsPath = deployPath </> "backend_known_hosts"
157+ sshOpts = sshArgs knownHostsPath (deployPath </> "ssh_key") False
158+ withSpinner "Uploading closures" $ ifor_ buildOutputByHost $ \host outputPath -> do
159+ callProcess'
160+ (Map.fromList [("NIX_SSHOPTS", unwords sshOpts)])
161+ "nix-copy-closure" ["-v", "--to", "--use-substitutes", "root@" <> host, "--gzip", outputPath]
162+ withSpinner "Uploading config" $ ifor_ buildOutputByHost $ \host _ -> do
163+ callProcessAndLogOutput (Notice, Warning) $
164+ proc rsyncPath
165+ [ "-e " <> sshPath <> " " <> unwords sshOpts
166+ , "-qarvz"
167+ , deployPath </> "config"
168+ , "root@" <> host <> ":/var/lib/backend"
169+ ]
170+ --TODO: Create GC root so we're sure our closure won't go away during this time period
171+ withSpinner "Switching to new configuration" $ ifor_ buildOutputByHost $ \host outputPath -> do
172+ callProcessAndLogOutput (Notice, Warning) $
173+ proc sshPath $ sshOpts <>
174+ [ "root@" <> host
175+ , unwords
176+ -- Note that we don't want to $(staticWhich "nix-env") here, because this is executing on a remote machine
177+ [ "nix-env -p /nix/var/nix/profiles/system --set " <> outputPath
178+ , "&&"
179+ , "/nix/var/nix/profiles/system/bin/switch-to-configuration switch"
91180 ]
92− sshAgentEnv <- sshAgent
93− deployAndSwitch res sshAgentEnv `finally` callProcess' (Just sshAgentEnv) "ssh-agent" ["-k"]
94− isClean <- checkGitCleanStatus deployPath
95− when (not isClean) $ do
96− callProcess "git" ["-C", deployPath, "add", "--update"]
97− callProcess "git" ["-C", deployPath, "commit", "-m", "New deployment"]
181+ ]
182+ isClean <- checkGitCleanStatus deployPath True
183+ when (not isClean) $ do
184+ withSpinner "Committing changes to Git" $ do
185+ callProcessAndLogOutput (Debug, Error) $
186+ gitProc deployPath ["add", "."]
187+ callProcessAndLogOutput (Debug, Error) $
188+ gitProc deployPath ["commit", "-m", "New deployment"]
189+ putLog Notice $ "Deployed => " <> T.pack route
98190 where
99− callProcess' e cmd args = do
100− let p = (proc cmd args) { delegate_ctlc = True, env = e }
101− exit_code <- withCreateProcess p $ \_ _ _ ph -> waitForProcess ph
102− case exit_code of
103− ExitSuccess -> return ()
104− ExitFailure r -> fail $ "callProcess'" <> "(exit: " <> show r <> ")"
191+ callProcess' envMap cmd args = do
192+ let p = setEnvOverride (envMap <>) $ setDelegateCtlc True $ proc cmd args
193+ callProcessAndLogOutput (Notice, Notice) p
105194
106195deployUpdate :: MonadObelisk m => FilePath -> m ()
107−deployUpdate deployPath = updateThunkToLatest $ deployPath </> "src"
196+deployUpdate deployPath = updateThunkToLatest (ThunkUpdateConfig Nothing (ThunkConfig Nothing)) (deployPath </> "src")
108197
109−sshAgent :: IO [(String, String)]
110−sshAgent = do
111− output <- BC8.pack <$> readProcess "ssh-agent" ["-c"] mempty
112− return $ fromMaybe mempty $ A.maybeResult $ A.parse (A.many' p) output
198+data PlatformDeployment = Android | IOS
199+ deriving (Show, Eq)
200+
201+renderPlatformDeployment :: PlatformDeployment -> String
202+renderPlatformDeployment = \case
203+ Android -> "android"
204+ IOS -> "ios"
205+
206+deployMobile :: forall m. MonadObelisk m => PlatformDeployment -> [String] -> m ()
207+deployMobile platform mobileArgs = withProjectRoot "." $ \root -> do
208+ let srcDir = root </> "src"
209+ configDir = root </> "config"
210+ exists <- liftIO $ doesDirectoryExist srcDir
211+ unless exists $ failWith "ob test should be run inside of a deploy directory"
212+ (nixBuildTarget, extraArgs) <- case platform of
213+ Android -> do
214+ let keystorePath = root </> "android_keystore.jks"
215+ keytoolConfPath = root </> "android_keytool_config.json"
216+ hasKeystore <- liftIO $ doesFileExist keystorePath
217+ when (not hasKeystore) $ do
218+ -- TODO log instructions for how to modify the keystore
219+ putLog Notice $ "Creating keystore: " <> T.pack keystorePath
220+ putLog Notice "Enter a keystore password: "
221+ keyStorePassword <- liftIO $ withEcho False getLine
222+ putLog Notice "Re-enter the keystore password: "
223+ keyStorePassword' <- liftIO $ withEcho False getLine
224+ unless (keyStorePassword' == keyStorePassword) $ failWith "passwords do not match"
225+ let keyToolConf = KeytoolConfig
226+ { _keytoolConfig_keystore = keystorePath
227+ , _keytoolConfig_alias = "obelisk"
228+ , _keytoolConfig_storepass = keyStorePassword
229+ , _keytoolConfig_keypass = keyStorePassword
230+ }
231+ createKeystore root keyToolConf
232+ liftIO $ BSL.writeFile keytoolConfPath $ encode keyToolConf
233+ checkKeytoolConfExist <- liftIO $ doesFileExist keytoolConfPath
234+ unless checkKeytoolConfExist $ failWith "Missing android KeytoolConfig"
235+ keytoolConfContents <- liftIO $ BSL.readFile keytoolConfPath
236+ keyArgs <- case eitherDecode keytoolConfContents :: Either String KeytoolConfig of
237+ Left err -> failWith $ T.pack err
238+ Right conf -> pure
239+ [ "--sign"
240+ , "--store-file", _keytoolConfig_keystore conf
241+ , "--store-password", _keytoolConfig_storepass conf
242+ , "--key-alias", _keytoolConfig_alias conf
243+ , "--key-password", _keytoolConfig_keypass conf
244+ ]
245+ let expr = mconcat
246+ [ "with (import ", toNixPath srcDir, " {});"
247+ , "android.frontend.override (drv: {"
248+ , "isRelease = true;"
249+ , "staticSrc = (passthru.__androidWithConfig ", configDir, ").frontend.staticSrc;"
250+ , "assets = (passthru.__androidWithConfig ", configDir, ").frontend.assets;"
251+ , "})"
252+ ]
253+ return (Target
254+ { _target_path = Nothing
255+ , _target_attr = Nothing
256+ , _target_expr = Just expr
257+ }, keyArgs)
258+ IOS -> do
259+ let expr = mconcat
260+ [ "with (import ", toNixPath srcDir, " {});"
261+ , "ios.frontend.override (_: { staticSrc = (passthru.__iosWithConfig ", toNixPath configDir, ").frontend.staticSrc; })"
262+ ]
263+ return (Target
264+ { _target_path = Nothing
265+ , _target_attr = Nothing
266+ , _target_expr = Just expr
267+ }, [])
268+ result <- nixCmd $ NixCmd_Build $ def
269+ & nixBuildConfig_outLink .~ OutLink_None
270+ & nixCmdConfig_target .~ nixBuildTarget
271+ let mobileArtifact = case platform of
272+ IOS -> "iOS App"
273+ Android -> "Android APK"
274+ putLog Notice $ T.pack $ unwords ["Your recently built", mobileArtifact, "can be found at the following path:", show result]
275+ callProcessAndLogOutput (Notice, Error) $ proc (result </> "bin" </> "deploy") (mobileArgs ++ extraArgs)
113276 where
114− p = do
115− key <- A.string "setenv" >> A.skipSpace >> A.takeWhile (not . isSpace)
116− val <- A.skipSpace >> A.takeWhile (/= ';')
117− _ <- A.string ";" >> A.endOfLine <|> void (A.string ";")
118− return (BC8.unpack key, BC8.unpack val)
277+ withEcho showEcho f = bracket
278+ (do
279+ prevEcho <- hGetEcho stdin
280+ hSetEcho stdin showEcho
281+ pure prevEcho
282+ )
283+ (hSetEcho stdin)
284+ (const f)
285+
286+data KeytoolConfig = KeytoolConfig
287+ { _keytoolConfig_keystore :: FilePath
288+ , _keytoolConfig_alias :: String
289+ , _keytoolConfig_storepass :: String
290+ , _keytoolConfig_keypass :: String
291+ } deriving (Show, Generic)
292+
293+instance FromJSON KeytoolConfig
294+instance ToJSON KeytoolConfig
295+
296+createKeystore :: MonadObelisk m => FilePath -> KeytoolConfig -> m ()
297+createKeystore root config =
298+ callProcessAndLogOutput (Notice, Notice) $ setCwd (Just root) $ proc jreKeyToolPath
299+ [ "-genkeypair", "-noprompt"
300+ , "-keystore", _keytoolConfig_keystore config
301+ , "-keyalg", "RSA", "-keysize", "2048"
302+ , "-validity", "1000000"
303+ , "-storepass", _keytoolConfig_storepass config
304+ , "-alias", _keytoolConfig_alias config
305+ , "-keypass", _keytoolConfig_keypass config
306+ ]
307+
308+-- | Simplified deployment configuration mechanism. At one point we may revisit this.
309+writeDeployConfig :: MonadObelisk m => FilePath -> FilePath -> String -> m ()
310+writeDeployConfig deployDir fname = liftIO . writeFile (deployDir </> fname)
311+
312+readDeployConfig :: MonadObelisk m => FilePath -> FilePath -> m String
313+readDeployConfig deployDir fname = liftIO $ do
314+ fmap (T.unpack . T.strip) $ T.readFile $ deployDir </> fname
315+
316+verifyHostKey :: MonadObelisk m => FilePath -> FilePath -> String -> m ()
317+verifyHostKey knownHostsPath keyPath hostName =
318+ callProcessAndLogOutput (Notice, Warning) $ proc sshPath $
319+ sshArgs knownHostsPath keyPath True <>
320+ [ "root@" <> hostName
321+ , "-o", "NumberOfPasswordPrompts=0"
322+ , "exit"
323+ ]
324+
325+sshArgs :: FilePath -> FilePath -> Bool -> [String]
326+sshArgs knownHostsPath keyPath askHostKeyCheck =
327+ [ "-o", "UserKnownHostsFile=" <> knownHostsPath
328+ , "-o", "StrictHostKeyChecking=" <> if askHostKeyCheck then "ask" else "yes"
329+ , "-i", keyPath
330+ ]
331+
332+-- common/route validation
333+-- TODO: move these to executable-config once the typed-config stuff is done.
334+
335+data InvalidRoute
336+ = InvalidRoute_NotHttps URI
337+ | InvalidRoute_MissingScheme URI
338+ | InvalidRoute_MissingHost URI
339+ | InvalidRoute_HasPort URI
340+ | InvalidRoute_HasPath URI
341+ deriving Show
342+
343+instance Exception InvalidRoute where
344+ displayException = \case
345+ InvalidRoute_MissingScheme uri -> route uri "must have an URI scheme"
346+ InvalidRoute_NotHttps uri -> route uri "must be HTTPS"
347+ InvalidRoute_MissingHost uri -> route uri "must contain a hostname"
348+ InvalidRoute_HasPort uri -> route uri "cannot specify port"
349+ InvalidRoute_HasPath uri -> route uri "cannot contain path"
350+ where
351+ route uri err = T.unpack $ "Route (" <> URI.render uri <> ") " <> err
352+
353+-- | Get the hostname from a https route
354+--
355+-- Fail if the route is invalid (i.e, no host present or scheme is not https)
356+getHostFromRoute
357+ :: MonadObelisk m
358+ => Bool -- ^ Ensure https?
359+ -> String
360+ -> m String
361+getHostFromRoute mustBeHttps route = do
362+ result :: Either InvalidRoute String <- try $ do
363+ validateCommonRouteAndGetHost mustBeHttps =<< URI.mkURI (T.strip $ T.pack route)
364+ either (failWith . T.pack . displayException) pure result
119365
366+validateCommonRouteAndGetHost
367+ :: (MonadThrow m, MonadObelisk m)
368+ => Bool -- ^ Ensure https?
369+ -> URI
370+ -> m String
371+validateCommonRouteAndGetHost mustBeHttps uri = do
372+ case uri ^? uriScheme of
373+ Just (Just (URI.unRText -> s)) -> case (mustBeHttps, s) of
374+ (False, _) -> pure ()
375+ (True, "https") -> pure ()
376+ _ -> throwM $ InvalidRoute_NotHttps uri
377+ _ -> throwM $ InvalidRoute_MissingScheme uri
378+ case uri ^. uriPath of
379+ [] -> pure ()
380+ _path -> throwM $ InvalidRoute_HasPath uri
381+ case uri ^? uriAuthority . _Right . authPort of
382+ Just (Just _port) -> throwM $ InvalidRoute_HasPort uri
383+ _ -> pure ()
384+ case uri ^? uriAuthority . _Right . authHost of
385+ Nothing -> throwM $ InvalidRoute_MissingHost uri
386+ Just sslHost -> return $ T.unpack $ URI.unRText sslHost
lib/command/src/Obelisk/Command/Nix.hs+192−39
@@ -1,71 +1,224 @@
1+{-# LANGUAGE AllowAmbiguousTypes #-}
2+{-# LANGUAGE ConstraintKinds #-}
13{-# LANGUAGE FlexibleContexts #-}
4+{-# LANGUAGE LambdaCase #-}
25{-# LANGUAGE MultiParamTypeClasses #-}
36{-# LANGUAGE OverloadedStrings #-}
7+{-# LANGUAGE Rank2Types #-}
48{-# LANGUAGE ScopedTypeVariables #-}
9+{-# LANGUAGE TemplateHaskell #-}
10+{-# LANGUAGE TypeApplications #-}
511module Obelisk.Command.Nix
6− ( nixBuild
12+ ( Arg (..)
713 , NixBuildConfig (..)
8− , Target (..)
14+ , nixBuildConfig_common
15+ , nixBuildConfig_outLink
16+ , NixCmd (..)
17+ , nixCmdConfig_args
18+ , nixCmdConfig_builders
19+ , nixCmdConfig_target
20+ , NixCommonConfig (..)
21+ , NixInstantiateConfig (..)
22+ , nixInstantiateConfig_eval
23+ , NixShellConfig (..)
24+ , nixShellConfig_common
25+ , nixShellConfig_pure
26+ , nixShellConfig_run
927 , OutLink (..)
10− , Arg (..)
28+ , Target (..)
29+ , target_attr
30+ , target_expr
31+ , target_path
32+
33+ , boolArg
34+ , nixCmd
35+ , nixCmdProc
36+ , nixCmdProc'
37+ , rawArg
38+ , runNixShellConfig
39+ , strArg
1140 ) where
1241
42+import Control.Monad (guard)
43+import Control.Lens
44+
45+import Data.Bool (bool)
1346import Data.Default
47+import Data.List (intercalate)
48+import Data.Maybe
1449import Data.Monoid ((<>))
1550import qualified Data.Text as T
16−import System.Process (proc)
1751
1852import Obelisk.App (MonadObelisk)
19−import Obelisk.CLI (Severity (..), readProcessAndLogStderr, withSpinner)
20−
21−-- | Where to put nix-build output
22−data OutLink
23− = OutLink_Default
24− | OutLink_None
25− | OutLink_IndirectRoot FilePath
26−
27−instance Default OutLink where
28− def = OutLink_Default
53+import Obelisk.CliApp
2954
3055-- | What to build
3156data Target = Target
32− { _target_path :: FilePath
57+ { _target_path :: Maybe FilePath
3358 , _target_attr :: Maybe String
59+ , _target_expr :: Maybe String
3460 }
61+makeClassy ''Target
3562
3663instance Default Target where
3764 def = Target
38− { _target_path = "."
65+ { _target_path = Just "."
3966 , _target_attr = Nothing
67+ , _target_expr = Nothing
4068 }
4169
42−data Arg = Arg
43− { _arg_key :: String
44− , _arg_value :: String
70+data Arg
71+ = Arg_Str String String
72+ | Arg_Expr String String
73+ deriving (Eq, Show)
74+
75+strArg :: String -> String -> Arg
76+strArg = Arg_Str
77+
78+rawArg :: String -> String -> Arg
79+rawArg = Arg_Expr
80+
81+boolArg :: String -> Bool -> Arg
82+boolArg k = Arg_Expr k . bool "false" "true"
83+
84+cliFromArgs :: [Arg] -> [String]
85+cliFromArgs = concatMap $ \case
86+ Arg_Str k v -> ["--argstr", k, v]
87+ Arg_Expr k v -> ["--arg", k, v]
88+
89+data NixCommonConfig = NixCommonConfig
90+ { _nixCmdConfig_target :: Target
91+ , _nixCmdConfig_args :: [Arg]
92+ , _nixCmdConfig_builders :: [String]
4593 }
94+makeClassy ''NixCommonConfig
95+
96+instance Default NixCommonConfig where
97+ def = NixCommonConfig def mempty mempty
98+
99+runNixCommonConfig :: NixCommonConfig -> [String]
100+runNixCommonConfig cfg = mconcat [maybeToList path, attrArg, exprArg, args, buildersArg]
101+ where
102+ path = _target_path $ _nixCmdConfig_target cfg
103+ attr = _target_attr $ _nixCmdConfig_target cfg
104+ expr = _target_expr $ _nixCmdConfig_target cfg
105+ attrArg = case attr of
106+ Nothing -> []
107+ Just a -> ["-A", a]
108+ exprArg = case expr of
109+ Nothing -> []
110+ Just a -> ["-E", a]
111+ args = cliFromArgs $ _nixCmdConfig_args cfg
112+ buildersArg = case _nixCmdConfig_builders cfg of
113+ [] -> []
114+ builders -> ["--builders", intercalate ";" builders]
115+
116+-- | Where to put nix-build output
117+data OutLink
118+ = OutLink_Default
119+ | OutLink_None
120+ | OutLink_IndirectRoot FilePath
121+
122+instance Default OutLink where
123+ def = OutLink_Default
46124
47125data NixBuildConfig = NixBuildConfig
48− { _nixBuildConfig_target :: Target
126+ { _nixBuildConfig_common :: NixCommonConfig
49127 , _nixBuildConfig_outLink :: OutLink
50− , _nixBuildConfig_args :: [Arg]
51128 }
129+makeLenses ''NixBuildConfig
130+
131+instance HasNixCommonConfig NixBuildConfig where
132+ nixCommonConfig = nixBuildConfig_common
52133
53134instance Default NixBuildConfig where
54− def = NixBuildConfig def def mempty
55−
56−nixBuild :: MonadObelisk m => NixBuildConfig -> m FilePath
57−nixBuild cfg = do
58− let args = mconcat
59− [ [_target_path $ _nixBuildConfig_target cfg]
60− , case _target_attr $ _nixBuildConfig_target cfg of
61− Nothing -> []
62− Just attr -> ["-A", attr]
63− , mconcat [["--argstr", k, v] | Arg k v <- _nixBuildConfig_args cfg]
64− , case _nixBuildConfig_outLink cfg of
65− OutLink_Default -> []
66− OutLink_None -> ["--no-out-link"]
67− OutLink_IndirectRoot outLink -> ["--out-link", outLink]
68− ]
69− let msg = T.pack $ "Running nix-build (" <> _target_path (_nixBuildConfig_target cfg) <> ")"
70− withSpinner msg $ do
71− readProcessAndLogStderr Debug (proc "nix-build" args)
135+ def = NixBuildConfig def def
136+
137+runNixBuildConfig :: NixBuildConfig -> [String]
138+runNixBuildConfig cfg = mconcat
139+ [ runNixCommonConfig $ cfg ^. nixCommonConfig
140+ , case _nixBuildConfig_outLink cfg of
141+ OutLink_Default -> []
142+ OutLink_None -> ["--no-out-link"]
143+ OutLink_IndirectRoot l -> ["--out-link", l]
144+ ]
145+
146+data NixInstantiateConfig = NixInstantiateConfig
147+ { _nixInstantiateConfig_common :: NixCommonConfig
148+ , _nixInstantiateConfig_eval :: Bool
149+ }
150+makeLenses ''NixInstantiateConfig
151+
152+instance HasNixCommonConfig NixInstantiateConfig where
153+ nixCommonConfig = nixInstantiateConfig_common
154+
155+instance Default NixInstantiateConfig where
156+ def = NixInstantiateConfig def False
157+
158+runNixInstantiateConfig :: NixInstantiateConfig -> [String]
159+runNixInstantiateConfig cfg = mconcat
160+ [ runNixCommonConfig $ cfg ^. nixCommonConfig
161+ , "--eval" <$ guard (_nixInstantiateConfig_eval cfg)
162+ ]
163+
164+data NixShellConfig = NixShellConfig
165+ { _nixShellConfig_common :: NixCommonConfig
166+ , _nixShellConfig_pure :: Bool
167+ , _nixShellConfig_run :: Maybe String
168+ }
169+
170+makeLenses ''NixShellConfig
171+
172+instance HasNixCommonConfig NixShellConfig where
173+ nixCommonConfig = nixShellConfig_common
174+
175+instance Default NixShellConfig where
176+ def = NixShellConfig def False Nothing
177+
178+data NixCmd
179+ = NixCmd_Build NixBuildConfig
180+ | NixCmd_Instantiate NixInstantiateConfig
181+
182+instance Default NixCmd where
183+ def = NixCmd_Build def
184+
185+runNixShellConfig :: NixShellConfig -> [String]
186+runNixShellConfig cfg = mconcat
187+ [ runNixCommonConfig $ cfg ^. nixCommonConfig
188+ , [ "--pure" | cfg ^. nixShellConfig_pure ]
189+ ] ++ mconcat [
190+ ["--run", run] | run <- maybeToList $ cfg ^. nixShellConfig_run
191+ ]
192+
193+nixCmdProc :: NixCmd -> ProcessSpec
194+nixCmdProc = fst . nixCmdProc'
195+
196+nixCmdProc' :: NixCmd -> (ProcessSpec, T.Text)
197+nixCmdProc' cmdCfg = (proc (T.unpack cmd) options, cmd)
198+ where
199+ (cmd, options) = case cmdCfg of
200+ NixCmd_Build cfg' ->
201+ ( "nix-build"
202+ , runNixBuildConfig cfg'
203+ )
204+ NixCmd_Instantiate cfg' ->
205+ ( "nix-instantiate"
206+ , runNixInstantiateConfig cfg'
207+ )
208+
209+nixCmd :: MonadObelisk m => NixCmd -> m FilePath
210+nixCmd cmdCfg = withSpinner' (T.unwords $ "Running" : cmd : desc) (Just $ const $ T.unwords $ "Built" : desc) $ do
211+ output <- readProcessAndLogStderr Debug cmdProc
212+ -- Remove final newline that Nix appends
213+ Just (outPath, '\n') <- pure $ T.unsnoc output
214+ pure $ T.unpack outPath
215+ where
216+ (cmdProc, cmd) = nixCmdProc' cmdCfg
217+ commonCfg = case cmdCfg of
218+ NixCmd_Build cfg' -> cfg' ^. nixCommonConfig
219+ NixCmd_Instantiate cfg' -> cfg' ^. nixCommonConfig
220+ path = commonCfg ^. nixCmdConfig_target . target_path
221+ desc = concat $ catMaybes
222+ [ (\x -> ["on", T.pack x]) <$> path
223+ , (\a -> ["[" <> T.pack a <> "]"]) <$> (commonCfg ^. nixCmdConfig_target . target_attr)
224+ ]
lib/command/src/Obelisk/Command/Preprocessor.hsnew file+100
@@ -0,0 +1,100 @@
1+{-# LANGUAGE LambdaCase #-}
2+{-# LANGUAGE OverloadedStrings #-}
3+
4+module Obelisk.Command.Preprocessor where
5+
6+import qualified Data.ByteString.Lazy as BL
7+import qualified Data.ByteString.Lazy.Builder as BU
8+import Data.Foldable (for_)
9+import Data.List (intersperse, isPrefixOf, sortOn)
10+import Data.Maybe (fromMaybe)
11+import qualified Data.Text.Lazy.Builder as TL
12+import qualified Data.Text.Lazy.Encoding as TL
13+import Distribution.Compiler (CompilerFlavor (..))
14+import Language.Haskell.Extension (Extension (..), Language(..))
15+import System.Directory (canonicalizePath)
16+import System.IO (IOMode (..), hPutStrLn, stderr, withFile)
17+import System.FilePath (hasTrailingPathSeparator, joinPath, splitPath)
18+
19+import Obelisk.Command.Run (CabalPackageInfo (..), parseCabalPackage')
20+
21+-- | This code is intended to be executed via ghci's -pgmF preprocessor option.
22+-- The command line arguments are passed in via ghc, which dictates the first three options and meanings
23+-- In order for this code to execute, origPath must contain either a '.' character or a '/' character.
24+-- (This is to avoid the possibility of the command line syntax conflicting with another ob command)
25+-- We do have control over the remaining arguments, but they must be the same for all files.
26+-- Thus, the fourth command line argument must be "apply-packages", which has already been handled.
27+-- We assume all the remaining arguments passed in are paths to cabal or hpack package specifications.
28+-- Thus we must select among the packagePaths for the file we are going to parse.
29+applyPackages :: FilePath -> FilePath -> FilePath -> [FilePath] -> IO ()
30+applyPackages origPath inPath outPath packagePaths' = do
31+ origPathCanonical <- canonicalizePath origPath
32+ packagePaths <- traverse canonicalizePath packagePaths'
33+
34+ let
35+ takeDirs = takeWhile hasTrailingPathSeparator
36+ packageDirs = sortOn (negate . length . takeDirs) $ map splitPath packagePaths
37+ origDir = splitPath origPathCanonical
38+ matches = [ joinPath d | d <- packageDirs, takeDirs d `isPrefixOf` origDir ]
39+
40+ -- The first element of matches is going to be the deepest path to a package spec that contains
41+ -- our file as a subdirectory.
42+ packageInfo' <- case matches of
43+ [] -> do
44+ hPutStrLn stderr $ "Error: Unable to find cabal information for " <> origPath <> "; Skipping preprocessor."
45+ pure Nothing
46+ packagePath:_ -> parseCabalPackage' packagePath >>= \case
47+ Left err -> do
48+ hPutStrLn stderr $ "Error: Unable to parse cabal package " <> packagePath <> "; Skipping preprocessor on " <> origPath <> ". Error: " <> show err
49+ pure Nothing
50+ Right (Just (_, packageInfo)) -> pure $ Just packageInfo
51+ Right Nothing -> pure Nothing
52+
53+ writeOutput packageInfo' inPath outPath
54+
55+writeOutput :: Maybe CabalPackageInfo -> FilePath -> FilePath -> IO ()
56+writeOutput packageInfo' origPath outPath = withFile outPath WriteMode $ \hOut -> do
57+ for_ packageInfo' $ \packageInfo -> hPutTextBuilder hOut (generateHeader origPath packageInfo)
58+ BL.readFile origPath >>= BL.hPut hOut
59+ where
60+ hPutTextBuilder h = BU.hPutBuilder h . TL.encodeUtf8Builder . TL.toLazyText
61+
62+generateHeader :: FilePath -> CabalPackageInfo -> TL.Builder
63+generateHeader origPath packageInfo =
64+ hsExtensions <> ghcOptions <> lineNumberPragma origPath
65+ where
66+ hsExtensions =
67+ if null extList
68+ then mempty
69+ else pragma $ TL.fromText "LANGUAGE " <> mconcat (intersperse (TL.fromText ", ") extList)
70+ extList = addDefaultLanguage $ concatMap showExt $ _cabalPackageInfo_defaultExtensions packageInfo
71+ addDefaultLanguage =
72+ case _cabalPackageInfo_defaultLanguage packageInfo of
73+ Nothing -> id
74+ Just x -> case x of
75+ UnknownLanguage ext -> (TL.fromString ext :)
76+ ext -> (TL.fromString (show ext) :)
77+ showExt = \case
78+ EnableExtension ext -> [TL.fromString (show ext)]
79+ DisableExtension ext -> ["No" <> TL.fromString (show ext)]
80+ UnknownExtension ext -> [TL.fromString ext]
81+
82+ ghcOptions =
83+ if null optList
84+ then mempty
85+ else pragma $
86+ TL.fromText "OPTIONS_GHC " <> mconcat (intersperse (TL.fromText " ") (map TL.fromString optList))
87+ ghcOptList
88+ = filter (not . isPrefixOf "-O")
89+ $ fromMaybe []
90+ $ lookup GHC (_cabalPackageInfo_compilerOptions packageInfo)
91+ optList = _cabalPackageInfo_cppOptions packageInfo <> ghcOptList
92+
93+lineNumberPragma :: FilePath -> TL.Builder
94+lineNumberPragma origPath = pragma $ TL.fromText "LINE 1 " <> quoted '"' (TL.fromString origPath)
95+
96+pragma :: TL.Builder -> TL.Builder
97+pragma x = TL.fromText "{-# " <> x <> TL.fromText " #-}\n"
98+
99+quoted :: Char -> TL.Builder -> TL.Builder
100+quoted char x = TL.singleton char <> x <> TL.singleton char
lib/command/src/Obelisk/Command/Project.hs+232−76
@@ -3,35 +3,56 @@
33{-# LANGUAGE OverloadedStrings #-}
44module Obelisk.Command.Project
55 ( InitSource (..)
6− , initProject
76 , findProjectObeliskCommand
87 , findProjectRoot
8+ , findProjectAssets
9+ , initProject
10+ , nixShellRunConfig
11+ , nixShellRunProc
12+ , nixShellWithHoogle
13+ , nixShellWithoutPkgs
14+ , obeliskDirName
15+ , toImplDir
16+ , toObeliskDir
917 , withProjectRoot
10− , inProjectShell
11− , inImpureProjectShell
12− , projectShell
18+ , bashEscape
1319 ) where
1420
21+import Control.Concurrent.MVar (MVar, newMVar, withMVarMasked)
22+import Control.Lens ((.~), (?~), (<&>))
1523import Control.Monad
1624import Control.Monad.IO.Class (liftIO)
1725import Control.Monad.State
26+import qualified Data.Aeson as Json
27+import qualified Data.ByteString.UTF8 as BSU
1828import Data.Bits
19−import Data.Function (on)
20−import Data.Monoid
29+import qualified Data.ByteString.Lazy as BSL
30+import Data.Default (def)
31+import Data.Function ((&), on)
32+import Data.Map (Map)
33+import Data.Text (Text)
2134import qualified Data.Text as T
35+import Data.Text.Encoding (decodeUtf8, encodeUtf8)
36+import Data.Traversable (for)
2237import System.Directory
38+import System.Environment (lookupEnv)
2339import System.FilePath
24−import System.Posix (FileStatus, UserID, deviceID, fileID, fileMode, fileOwner, getFileStatus, getRealUserID)
25−import System.Posix.Files
26−import System.Process (CreateProcess, createProcess_, cwd, proc, waitForProcess)
40+import System.IO.Temp
41+import System.IO.Unsafe (unsafePerformIO)
42+import System.PosixCompat.Files
43+import System.PosixCompat.Types
44+import System.PosixCompat.User
45+import Text.ShellEscape (bash, bytes)
2746
2847import GitHub.Data.GitData (Branch)
2948import GitHub.Data.Name (Name)
3049
3150import Obelisk.App (MonadObelisk)
32−import Obelisk.CLI (Severity (..), callProcessAndLogOutput, failWith, putLog, withSpinner)
51+import Obelisk.CliApp
52+import Obelisk.Command.Nix
3353import Obelisk.Command.Thunk
34−import Obelisk.Command.Utils (cp)
54+import Obelisk.Command.Utils (nixBuildExePath, nixExePath, toNixPath, cp, nixShellPath)
55+
3556--TODO: Make this module resilient to random exceptions
3657
3758--TODO: Don't hardcode this
@@ -45,42 +66,67 @@ obeliskSourceWithBranch branch = ThunkSource_GitHub $ GitHubSource
4566 { _gitHubSource_owner = "obsidiansystems"
4667 , _gitHubSource_repo = "obelisk"
4768 , _gitHubSource_branch = Just branch
48− , _gitHubSource_private = True
69+ , _gitHubSource_private = False
4970 }
5071
5172data InitSource
52− = InitSource_Default
53− | InitSource_Branch (Name Branch)
54− | InitSource_Symlink FilePath
55− deriving Show
73+ = InitSource_Default
74+ | InitSource_Branch (Name Branch)
75+ | InitSource_Symlink FilePath
76+ deriving Show
77+
78+obeliskDirName :: FilePath
79+obeliskDirName = ".obelisk"
5680
5781-- | Path to obelisk directory in given path
5882toObeliskDir :: FilePath -> FilePath
59−toObeliskDir p = p </> ".obelisk"
83+toObeliskDir p = p </> obeliskDirName
6084
6185-- | Path to impl file in given path
6286toImplDir :: FilePath -> FilePath
6387toImplDir p = toObeliskDir p </> "impl"
6488
6589-- | Create a new project rooted in the current directory
66−initProject :: MonadObelisk m => InitSource -> m ()
67−initProject source = do
68− let implDir = toImplDir "."
69− liftIO $ createDirectory $ toObeliskDir "."
70− case source of
71− InitSource_Default -> liftIO $ createThunkWithLatest implDir obeliskSource
72− InitSource_Branch branch -> liftIO $ createThunkWithLatest implDir $ obeliskSourceWithBranch branch
73− InitSource_Symlink path -> do
74− let symlinkPath = if isAbsolute path
75− then path
76− else ".." </> path
77− liftIO $ createSymbolicLink symlinkPath implDir
78− _ <- nixBuildAttrWithCache implDir "command"
79− --TODO: We should probably handoff to the impl here
80− skeleton <- nixBuildAttrWithCache implDir "skeleton" --TODO: I don't think there's actually any reason to cache this
90+initProject :: MonadObelisk m => InitSource -> Bool -> m ()
91+initProject source force = withSystemTempDirectory "ob-init" $ \tmpDir -> do
92+ let implDir = toImplDir tmpDir
93+ obDir = toObeliskDir tmpDir
94+ liftIO (listDirectory ".") >>= \case
95+ [] -> pure ()
96+ _ | force -> putLog Warning "Initializing in non-empty directory"
97+ | otherwise -> failWith "ob init requires an empty directory. Use the flag --force to init anyway, potentially overwriting files."
98+ skeleton <- withSpinner "Setting up obelisk" $ do
99+ liftIO $ createDirectory obDir
100+ -- Clone the git source and repack it with the init source obelisk
101+ -- The purpose of this is to ensure we use the correct thunk spec.
102+ let cloneAndRepack src = do
103+ putLog Debug $ "Cloning obelisk into " <> T.pack implDir <> " and repacking using itself"
104+ commit <- getLatestRev src
105+ gitCloneForThunkUnpack (thunkSourceToGitSource src) (_thunkRev_commit commit) implDir
106+ callHandoffOb implDir ["thunk", "pack", implDir]
107+ case source of
108+ InitSource_Default -> cloneAndRepack obeliskSource
109+ InitSource_Branch branch -> cloneAndRepack $ obeliskSourceWithBranch branch
110+ InitSource_Symlink path -> do
111+ let symlinkPath = if isAbsolute path
112+ then path
113+ else ".." </> path
114+ liftIO $ createSymbolicLink symlinkPath implDir
115+ _ <- nixBuildAttrWithCache implDir "command"
116+ skel <- nixBuildAttrWithCache implDir "skeleton" --TODO: I don't think there's actually any reason to cache this
117+
118+ callProcessAndLogOutput (Notice, Error) $
119+ proc cp
120+ [ "-r"
121+ , "--preserve=links"
122+ , obDir
123+ , toObeliskDir "."
124+ ]
125+ pure skel
126+
81127 withSpinner "Copying project skeleton" $ do
82128 callProcessAndLogOutput (Notice, Error) $
83− cp --TODO: Make this package depend on nix-prefetch-url properly
129+ proc cp
84130 [ "-r"
85131 , "--no-preserve=mode"
86132 , "-T"
@@ -91,21 +137,46 @@ initProject source = do
91137 let configDir = "config"
92138 createDirectoryIfMissing False configDir
93139 mapM_ (createDirectoryIfMissing False . (configDir </>)) ["backend", "common", "frontend"]
140+ putLog Notice $ T.intercalate "\n"
141+ [ "An obelisk project has been successfully initialized. Next steps:"
142+ , " 'ob run': Start a development server"
143+ , " 'ob watch': Watch for changes without starting a server"
144+ , " 'ob repl': Load your project into GHCi"
145+ ]
146+
147+callHandoffOb
148+ :: MonadObelisk m
149+ => FilePath -- ^ Directory of the obelisk we want to handoff to
150+ -> [String] -- ^ Arguments to pass to ob
151+ -> m ()
152+callHandoffOb dir args = do
153+ obeliskCommandPkg <- nixCmd $ NixCmd_Build $ def
154+ & nixBuildConfig_outLink .~ OutLink_None
155+ & nixCmdConfig_target .~ Target
156+ { _target_path = Just dir
157+ , _target_attr = Just "command"
158+ , _target_expr = Nothing
159+ }
160+ let impl = obeliskCommandPkg </> "bin" </> "ob"
161+ -- Invoke the real implementation, using --no-handoff to prevent infinite recursion
162+ putLog Debug $ "Running '" <> T.pack (unwords args) <> "' with " <> T.pack impl
163+ callProcessAndLogOutput (Debug, Warning) (proc impl ("--no-handoff" : args))
94164
95165--TODO: Allow the user to ignore our security concerns
96166-- | Find the Obelisk implementation for the project at the given path
97167findProjectObeliskCommand :: MonadObelisk m => FilePath -> m (Maybe FilePath)
98168findProjectObeliskCommand target = do
99169 myUid <- liftIO getRealUserID
170+ processUmask <- liftIO getUmask
100171 targetStat <- liftIO $ getFileStatus target
101− (result, insecurePaths) <- flip runStateT [] $ walkToProjectRoot target targetStat myUid >>= \case
172+ (result, insecurePaths) <- flip runStateT [] $ walkToProjectRoot target targetStat processUmask myUid >>= \case
102173 Nothing -> pure Nothing
103174 Just projectRoot -> liftIO (doesDirectoryExist $ toImplDir projectRoot) >>= \case
104175 False -> do
105176 putLog Warning $ "Found obelisk directory in " <> T.pack projectRoot <> " but the implementation (impl) file is missing"
106177 pure Nothing
107178 True -> do
108− walkToImplDir projectRoot myUid -- For security check
179+ walkToImplDir projectRoot myUid processUmask -- For security check
109180 return $ Just projectRoot
110181 case (result, insecurePaths) of
111182 (Just projDir, []) -> do
@@ -116,19 +187,39 @@ findProjectObeliskCommand target = do
116187 putLog Error $ T.unlines
117188 [ "Error: Found a project at " <> T.pack (normalise projDir) <> ", but had to traverse one or more insecure directories to get there:"
118189 , T.unlines $ fmap (T.pack . normalise) insecurePaths
119− , "Please ensure that all of these directories are owned by you and are not writable by anyone else."
190+ , "Please ensure that all of these directories are owned by you, not world-writable, and no more group-writable than permitted by your umask."
120191 ]
121192 return Nothing
122193
194+-- | Get the umask for the Obelisk process.
195+--
196+-- Because of
197+-- http://man7.org/linux/man-pages/man2/umask.2.html#NOTES we have to set the
198+-- umask to read it. We are using 'withMVarMasked' to guarantee that setting and
199+-- reading isn't interrupted by any exception or interleaved with another thread.
200+getUmask :: IO FileMode
201+getUmask = withMVarMasked globalUmaskLock $ \() -> do
202+ initialMask <- setFileCreationMask safeUmask
203+ void (setFileCreationMask initialMask)
204+ pure initialMask
205+ where
206+ safeUmask :: FileMode
207+ safeUmask = CMode 0o22
208+
209+{-# NOINLINE globalUmaskLock #-}
210+globalUmaskLock :: MVar ()
211+globalUmaskLock = unsafePerformIO (newMVar ())
212+
123213-- | Get the FilePath to the containing project directory, if there is one
124214findProjectRoot :: MonadObelisk m => FilePath -> m (Maybe FilePath)
125215findProjectRoot target = do
126216 myUid <- liftIO getRealUserID
127217 targetStat <- liftIO $ getFileStatus target
128− (result, _) <- liftIO $ runStateT (walkToProjectRoot target targetStat myUid) []
129− return result
218+ umask <- liftIO getUmask
219+ (result, _) <- liftIO $ runStateT (walkToProjectRoot target targetStat umask myUid) []
220+ return $ makeRelative "." <$> result
130221
131−withProjectRoot :: MonadObelisk m => FilePath -> (FilePath -> m ()) -> m ()
222+withProjectRoot :: MonadObelisk m => FilePath -> (FilePath -> m a) -> m a
132223withProjectRoot target f = findProjectRoot target >>= \case
133224 Nothing -> failWith "Must be used inside of an Obelisk project"
134225 Just root -> f root
@@ -138,15 +229,15 @@ withProjectRoot target f = findProjectRoot target >>= \case
138229-- traversed in the process. Return the project root directory, if found.
139230walkToProjectRoot
140231 :: (MonadState [FilePath] m, MonadIO m)
141− => FilePath -> FileStatus -> UserID -> m (Maybe FilePath)
142−walkToProjectRoot this thisStat myUid = liftIO (doesDirectoryExist this) >>= \case
232+ => FilePath -> FileStatus -> FileMode -> UserID -> m (Maybe FilePath)
233+walkToProjectRoot this thisStat desiredUmask myUid = liftIO (doesDirectoryExist this) >>= \case
143234 -- It's not a directory, so it can't be a project
144235 False -> do
145236 let dir = takeDirectory this
146237 dirStat <- liftIO $ getFileStatus dir
147− walkToProjectRoot dir dirStat myUid
238+ walkToProjectRoot dir dirStat desiredUmask myUid
148239 True -> do
149− when (not $ isWritableOnlyBy thisStat myUid) $ modify (this:)
240+ when (not $ isWellOwnedAndWellPermissioned thisStat myUid desiredUmask) $ modify (this:)
150241 liftIO (doesDirectoryExist $ toObeliskDir this) >>= \case
151242 True -> return $ Just this
152243 False -> do
@@ -156,44 +247,109 @@ walkToProjectRoot this thisStat myUid = liftIO (doesDirectoryExist this) >>= \ca
156247 isSameFileAs = (==) `on` fileIdentity
157248 if thisStat `isSameFileAs` nextStat
158249 then return Nothing -- Found a cycle; probably hit root directory
159− else walkToProjectRoot next nextStat myUid
250+ else walkToProjectRoot next nextStat desiredUmask myUid
160251
161252-- | Walk from the given project root directory to its Obelisk implementation
162253-- directory, accumulating potentially insecure directories that were traversed
163254-- in the process.
164−walkToImplDir :: (MonadState [FilePath] m, MonadIO m) => FilePath -> UserID -> m ()
165−walkToImplDir projectRoot myUid = do
255+walkToImplDir :: (MonadState [FilePath] m, MonadIO m) => FilePath -> UserID -> FileMode -> m ()
256+walkToImplDir projectRoot myUid umask = do
166257 let obDir = toObeliskDir projectRoot
167258 obDirStat <- liftIO $ getFileStatus obDir
168− when (not $ isWritableOnlyBy obDirStat myUid) $ modify (obDir:)
259+ when (not $ isWellOwnedAndWellPermissioned obDirStat myUid umask) $ modify (obDir:)
169260 let implThunk = obDir </> "impl"
170261 implThunkStat <- liftIO $ getFileStatus implThunk
171− when (not $ isWritableOnlyBy implThunkStat myUid) $ modify (implThunk:)
172−
173−--TODO: Is there a better way to ask if anyone else can write things?
174−--E.g. what about ACLs?
175−-- | Check to see if directory is only writable by a user whose User ID matches the second argument provided
176−isWritableOnlyBy :: FileStatus -> UserID -> Bool
177−isWritableOnlyBy s uid = fileOwner s == uid && fileMode s .&. 0o22 == 0
178−
179−-- | Run a command in the given shell for the current project
180−inProjectShell :: MonadObelisk m => String -> String -> m ()
181−inProjectShell shellName command = withProjectRoot "." $ \root ->
182− projectShell root True shellName command
183−
184−inImpureProjectShell :: MonadObelisk m => String -> String -> m ()
185−inImpureProjectShell shellName command = withProjectRoot "." $ \root ->
186− projectShell root False shellName command
187−
188−projectShell :: MonadObelisk m => FilePath -> Bool -> String -> String -> m ()
189−projectShell root isPure shellName command = do
190− (_, _, _, ph) <- liftIO $ createProcess_ "runNixShellAttr" $ setCwd (Just root) $ proc "nix-shell" $
191− [ "--pure" | isPure ] <>
192− [ "-A"
193− , "shells." <> shellName
194− , "--run", command
195− ]
196− void $ liftIO $ waitForProcess ph
197−
198−setCwd :: Maybe FilePath -> CreateProcess -> CreateProcess
199−setCwd fp cfg = cfg { cwd = fp }
262+ when (not $ isWellOwnedAndWellPermissioned implThunkStat myUid umask) $ modify (implThunk:)
263+
264+-- | Check to see if directory is writable by a user whose User ID matches the
265+-- second argument provided, and if the fact that other people can write to that
266+-- directory is in accordance with the umask of the system, passed as the third
267+-- argument.
268+isWellOwnedAndWellPermissioned :: FileStatus -> UserID -> FileMode -> Bool
269+isWellOwnedAndWellPermissioned s uid umask = isOwnedBy s uid && filePermissionIsSafe s umask
270+
271+isOwnedBy :: FileStatus -> UserID -> Bool
272+isOwnedBy s uid = fileOwner s == uid
273+
274+-- | Check to see if a directory respect the umask, but check explicitly that
275+-- it's not world writable in any case.
276+filePermissionIsSafe :: FileStatus -> FileMode -> Bool
277+filePermissionIsSafe s umask = not fileWorldWritable && fileGroupWritable <= umaskGroupWritable
278+ where
279+ fileWorldWritable = fileMode s .&. 0o002 == 0o002
280+ fileGroupWritable = fileMode s .&. 0o020 == 0o020
281+ umaskGroupWritable = umask .&. 0o020 == 0
282+
283+nixShellRunConfig :: MonadObelisk m => FilePath -> Bool -> Maybe String -> m NixShellConfig
284+nixShellRunConfig root isPure command = do
285+ nixpkgsPath <- fmap T.strip $ readProcessAndLogStderr Debug $ setCwd (Just root) $
286+ proc nixExePath ["eval", "(import .obelisk/impl {}).nixpkgs.path"]
287+ nixRemote <- liftIO $ lookupEnv "NIX_REMOTE"
288+ pure $ def
289+ & nixShellConfig_pure .~ isPure
290+ & nixShellConfig_common . nixCmdConfig_target .~ (def & target_path .~ Nothing)
291+ & nixShellConfig_run .~ (command <&> \cs -> unwords $ concat
292+ [ ["export", BSU.toString . bytes . bash $ "NIX_PATH=nixpkgs=" <> encodeUtf8 nixpkgsPath, ";"]
293+ , maybe [] (\v -> ["export", BSU.toString . bytes . bash $ "NIX_REMOTE=" <> encodeUtf8 (T.pack v), ";"]) nixRemote
294+ , [cs]
295+ ])
296+
297+bashEscape :: String -> String
298+bashEscape = BSU.toString . bytes . bash . BSU.fromString
299+
300+nixShellRunProc :: NixShellConfig -> ProcessSpec
301+nixShellRunProc cfg = setDelegateCtlc True $ proc nixShellPath $ runNixShellConfig cfg
302+
303+nixShellWithoutPkgs
304+ :: MonadObelisk m
305+ => FilePath -- ^ Path to project root
306+ -> Bool -- ^ Should this be a pure shell?
307+ -> Bool -- ^ Should we chdir to the package root in the shell?
308+ -> Map Text FilePath -- ^ Package names mapped to their paths
309+ -> String -- ^ Shell attribute to use (e.g. @"ghc"@, @"ghcjs"@, etc.)
310+ -> Maybe String -- ^ If 'Just' run the given command; otherwise just open the interactive shell
311+ -> m ()
312+nixShellWithoutPkgs root isPure chdirToRoot packageNamesAndPaths shellAttr command = do
313+ packageNamesAndAbsPaths <- liftIO $ for packageNamesAndPaths makeAbsolute
314+ defShellConfig <- nixShellRunConfig root isPure command
315+ let setCwd_ = if chdirToRoot then setCwd (Just root) else id
316+ runProcess_ $ setCwd_ $ nixShellRunProc $ defShellConfig
317+ & nixShellConfig_common . nixCmdConfig_target . target_expr ?~
318+ "{root, pkgs, shell}: ((import root {}).passthru.__unstable__.self.extend (_: _: {\
319+ \shellPackages = builtins.fromJSON pkgs;\
320+ \})).project.shells.${shell}"
321+ & nixShellConfig_common . nixCmdConfig_args .~
322+ [ rawArg "root" $ toNixPath $ if chdirToRoot then "." else root
323+ , strArg "pkgs" (T.unpack $ decodeUtf8 $ BSL.toStrict $ Json.encode packageNamesAndAbsPaths)
324+ , strArg "shell" shellAttr
325+ ]
326+
327+nixShellWithHoogle :: MonadObelisk m => FilePath -> Bool -> String -> Maybe String -> m ()
328+nixShellWithHoogle root isPure shell' command = do
329+ defShellConfig <- nixShellRunConfig root isPure command
330+ runProcess_ $ setCwd (Just root) $ nixShellRunProc $ defShellConfig
331+ & nixShellConfig_common . nixCmdConfig_target . target_expr ?~
332+ "{shell}: ((import ./. {}).passthru.__unstable__.self.extend (_: super: {\
333+ \userSettings = super.userSettings // { withHoogle = true; };\
334+ \})).project.shells.${shell}"
335+ & nixShellConfig_common . nixCmdConfig_args .~ [ strArg "shell" shell' ]
336+
337+findProjectAssets :: MonadObelisk m => FilePath -> m Text
338+findProjectAssets root = do
339+ isDerivation <- readProcessAndLogStderr Debug $ setCwd (Just root) $
340+ proc nixExePath
341+ [ "eval"
342+ , "(let a = import ./. {}; in toString (a.reflex.nixpkgs.lib.isDerivation a.passthru.staticFilesImpure))"
343+ , "--raw"
344+ -- `--raw` is not available with old nix-instantiate. It drops quotation
345+ -- marks and trailing newline, so is very convenient for shelling out.
346+ ]
347+ -- Check whether the impure static files are a derivation (and so must be built)
348+ if isDerivation == "1"
349+ then fmap T.strip $ readProcessAndLogStderr Debug $ setCwd (Just root) $ -- Strip whitespace here because nix-build has no --raw option
350+ proc nixBuildExePath
351+ [ "--no-out-link"
352+ , "-E", "(import ./. {}).passthru.staticFilesImpure"
353+ ]
354+ else readProcessAndLogStderr Debug $ setCwd (Just root) $
355+ proc nixExePath ["eval", "-f", ".", "passthru.staticFilesImpure", "--raw"]
lib/command/src/Obelisk/Command/Repl.hsdeleted−20
@@ -1,20 +0,0 @@
1−{-# LANGUAGE FlexibleContexts #-}
2−{-# LANGUAGE OverloadedStrings #-}
3−module Obelisk.Command.Repl
4− ( runRepl
5− , watch
6− ) where
7−
8−import Data.Monoid ((<>))
9−
10−import Obelisk.App (MonadObelisk)
11−import Obelisk.Command.Project
12−
13−-- | Run an interactive repl within a given path
14−runRepl :: MonadObelisk m => FilePath -> m ()
15−runRepl dir = inProjectShell "ghc" $ "cd " <> dir <> "; cabal new-repl"
16−
17−-- | Watch the given directory for errors and warnings
18−watch :: MonadObelisk m => FilePath -> m ()
19−watch dir = inProjectShell "ghc" $ "cd " <> dir <> "; ghcid -W --command='cabal new-repl'"
20−
lib/command/src/Obelisk/Command/Run.hs+540−80
@@ -1,94 +1,554 @@
1+{-# LANGUAGE DeriveFoldable #-}
2+{-# LANGUAGE DeriveFunctor #-}
3+{-# LANGUAGE DeriveTraversable #-}
4+{-# LANGUAGE FlexibleContexts #-}
5+{-# LANGUAGE LambdaCase #-}
6+{-# LANGUAGE MultiParamTypeClasses #-}
17{-# LANGUAGE OverloadedStrings #-}
8+{-# LANGUAGE QuasiQuotes #-}
9+{-# LANGUAGE ScopedTypeVariables #-}
10+{-# LANGUAGE TupleSections #-}
11+{-# LANGUAGE ViewPatterns #-}
212module Obelisk.Command.Run where
313
4−import qualified Control.Exception as E
5−import Control.Monad
6−import Data.Either
7−import Data.List
8−import Data.Maybe
9−import Data.Monoid
10−import Data.List.NonEmpty as NE
11−import Distribution.Utils.Generic (withUTF8FileContents)
12−import Distribution.PackageDescription.Parse (parseGenericPackageDescription, ParseResult(..))
13−import Distribution.Types.BuildInfo
14−import Distribution.Types.CondTree
15−import Distribution.Types.Library
16−import Distribution.Types.GenericPackageDescription
17−import Network.Socket
14+import Control.Arrow ((&&&))
15+import Control.Exception (Exception, bracket)
16+import Control.Lens (ifor, (.~), (&))
17+import Control.Monad (filterM)
18+import Control.Monad.Except (runExceptT, throwError)
19+import Control.Monad.IO.Class (liftIO)
20+import Control.Monad.Reader (MonadIO)
21+import Data.Bifoldable (bifoldr1)
22+import Data.Bifunctor (bimap)
23+import Data.Coerce (coerce)
24+import Data.Default (def)
25+import Data.Either (partitionEithers)
26+import Data.Foldable (fold, for_, toList)
27+import Data.Functor.Identity (runIdentity)
28+import Data.List (intercalate)
29+import Data.List.NonEmpty (NonEmpty)
30+import qualified Data.List.NonEmpty as NE
31+import Data.Map (Map)
32+import qualified Data.Map as Map
33+import qualified Data.Map.Monoidal as MMap
34+import Data.Maybe (catMaybes, fromMaybe, mapMaybe)
35+import Data.Ord (comparing)
36+import Data.Set (Set)
37+import qualified Data.Set as Set
38+import Data.String.Here.Interpolated (i)
39+import Data.Text (Text)
40+import qualified Data.Text as T
41+import Data.Time.Clock (getCurrentTime)
42+import Data.Time.Format (formatTime, defaultTimeLocale)
43+import Data.Traversable (for)
44+import Debug.Trace (trace)
45+import Distribution.Compiler (CompilerFlavor(..))
46+import Distribution.PackageDescription.Parsec (parseGenericPackageDescription)
47+import Distribution.Parsec.ParseResult (runParseResult)
48+import qualified Distribution.System as Dist
49+import Distribution.Types.BuildInfo (buildable, cppOptions, defaultExtensions, defaultLanguage, hsSourceDirs, options)
50+import Distribution.Types.CondTree (simplifyCondTree)
51+import Distribution.Types.GenericPackageDescription (ConfVar (Arch, Impl, OS), condLibrary)
52+import Distribution.Types.Library (libBuildInfo)
53+import Distribution.Utils.Generic (toUTF8BS, readUTF8File)
54+import qualified Distribution.Parsec.Common as Dist
55+import qualified Hpack.Config as Hpack
56+import qualified Hpack.Render as Hpack
57+import qualified Hpack.Yaml as Hpack
58+import Language.Haskell.Extension (Extension, Language)
59+import qualified Network.Socket as Socket
1860import System.Directory
61+import System.Environment (getExecutablePath)
1962import System.FilePath
63+import qualified System.Info
2064import System.IO.Temp (withSystemTempDirectory)
21−import System.Process (callCommand)
2265
23−run :: IO ()
24−run = do
66+import Obelisk.App (MonadObelisk)
67+import Obelisk.CliApp (
68+ Severity (..),
69+ failWith,
70+ proc,
71+ putLog,
72+ readCreateProcessWithExitCode,
73+ readProcessAndLogStderr,
74+ runProcess_,
75+ setCwd,
76+ setDelegateCtlc,
77+ withSpinner,
78+ )
79+import Obelisk.Command.Nix
80+import Obelisk.Command.Project (nixShellWithoutPkgs, withProjectRoot, findProjectAssets, bashEscape)
81+import Obelisk.Command.Thunk (attrCacheFileName)
82+import Obelisk.Command.Utils (findExePath, ghcidExePath)
83+
84+data CabalPackageInfo = CabalPackageInfo
85+ { _cabalPackageInfo_packageFile :: FilePath
86+ , _cabalPackageInfo_packageName :: T.Text
87+ , _cabalPackageInfo_packageRoot :: FilePath
88+ , _cabalPackageInfo_buildable :: Bool
89+ , _cabalPackageInfo_sourceDirs :: NE.NonEmpty FilePath
90+ -- ^ List of hs src dirs of the library component
91+ , _cabalPackageInfo_defaultExtensions :: [Extension]
92+ -- ^ List of globally enable extensions of the library component
93+ , _cabalPackageInfo_defaultLanguage :: Maybe Language
94+ -- ^ List of globally set languages of the library component
95+ , _cabalPackageInfo_compilerOptions :: [(CompilerFlavor, [String])]
96+ -- ^ List of compiler-specific options (e.g., the "ghc-options" field of the cabal file)
97+ , _cabalPackageInfo_cppOptions :: [String]
98+ -- ^ List of CPP (C Preprocessor) options (e.g. the "cpp-options" field of the cabal file)
99+ }
100+
101+-- | 'Bool' with a better name for its purpose.
102+data Interpret = Interpret_Interpret | Interpret_NoInterpret deriving (Eq, Ord, Show)
103+
104+textInterpret :: Interpret -> Text
105+textInterpret = \case
106+ Interpret_Interpret -> "Interpret"
107+ Interpret_NoInterpret -> "NoInterpret"
108+
109+-- | Describe a set of 'FilePath's as a tree to facilitate merging them in a convenient way.
110+data PathTree a = PathTree_Node
111+ (Maybe a) -- An optional leaf at this point in the tree
112+ (Map FilePath (PathTree a)) -- Branches to deeper leaves
113+ deriving (Eq, Ord, Show, Functor, Foldable, Traversable)
114+
115+-- | 2D ASCII drawing of a 'PathTree'. Adapted from Data.Tree.draw.
116+drawPathTree :: (a -> Text) -> PathTree a -> Text
117+drawPathTree showA (PathTree_Node _ ts0) = T.intercalate "\n" $ goForest (Map.toList ts0)
118+ where
119+ annotated ma = maybe id (\a b -> b <> " [" <> showA a <> "]") ma . T.pack
120+ goTree (fp, PathTree_Node ma forest) = annotated ma fp : goForest (Map.toList forest)
121+ goForest [] = []
122+ goForest [tree] = shift "└─ " " " (goTree tree)
123+ goForest (tree:forest) = shift "├─ " "│ " (goTree tree) <> goForest forest
124+ shift first other = zipWith (<>) (first : repeat other)
125+
126+-- | Used to signal to obelisk that it's being invoked as a preprocessor
127+preprocessorIdentifier :: String
128+preprocessorIdentifier = "__preprocessor-apply-packages"
129+
130+profile
131+ :: MonadObelisk m
132+ => String
133+ -> [String]
134+ -> m ()
135+profile profileBasePattern rtsFlags = withProjectRoot "." $ \root -> do
136+ putLog Debug "Using profiled build of project."
137+
138+ outPath <- withSpinner "Building profiled executable" $
139+ fmap (T.unpack . T.strip) $ readProcessAndLogStderr Debug $ setCwd (Just root) $ nixCmdProc $
140+ NixCmd_Build $ def
141+ & nixBuildConfig_outLink .~ OutLink_None
142+ & nixCmdConfig_target .~ Target
143+ { _target_path = Just "."
144+ , _target_attr = Just "__unstable__.profiledObRun"
145+ , _target_expr = Nothing
146+ }
147+ assets <- findProjectAssets root
148+ putLog Debug $ "Assets impurely loaded from: " <> assets
149+ time <- liftIO getCurrentTime
150+ let profileBaseName = formatTime defaultTimeLocale profileBasePattern time
151+ liftIO $ createDirectoryIfMissing True $ takeDirectory $ root </> profileBaseName
152+ putLog Debug $ "Storing profiled data under base name of " <> T.pack (root </> profileBaseName)
153+ freePort <- getFreePort
154+ runProcess_ $ setCwd (Just root) $ setDelegateCtlc True $ proc (outPath </> "bin" </> "ob-run") $
155+ [ show freePort
156+ , T.unpack assets
157+ , profileBaseName
158+ , "+RTS"
159+ , "-po" <> profileBaseName
160+ ] <> rtsFlags
161+ <> [ "-RTS" ]
162+
163+run :: MonadObelisk m => FilePath -> PathTree Interpret -> m ()
164+run root interpretPaths = do
165+ pkgs <- getParsedLocalPkgs root interpretPaths
166+ assets <- findProjectAssets root
167+ putLog Debug $ "Assets impurely loaded from: " <> assets
168+ ghciArgs <- getGhciSessionSettings pkgs root True
25169 freePort <- getFreePort
26− pkgs <- getLocalPkgs
27− (pkgDirErrs, hsSrcDirs) <- fmap partitionEithers $ forM pkgs $ \pkg -> do
28− let cabalFp = pkg </> pkg <.> "cabal"
29− xs <- parseHsSrcDir cabalFp
30− return $ case xs of
31− Nothing -> Left pkg
32− Just hsSrcDirs -> Right $ toList $ fmap (pkg </>) hsSrcDirs
33− when (null hsSrcDirs) $
34− fail $ "No valid pkgs found in " <> intercalate ", " pkgs
35− when (not (null pkgDirErrs)) $
36− putStrLn $ "Failed to find pkgs in " <> intercalate ", " pkgDirErrs
37− let dotGhci = unlines
38− [ ":set args --quiet --port " <> show freePort
39− , ":set -i" <> intercalate ":" (mconcat hsSrcDirs)
40− , ":set -XScopedTypeVariables"
41− , ":add Backend Frontend"
42− , ":module + System.IO Control.Exception Control.Concurrent Obelisk.Widget.Run Frontend Backend"
43− ]
44− testCmd = unlines
45− [ "let handleBackendErr (_ :: SomeException) = hPutStrLn stderr \"backend stopped; make a change to your code to reload\""
46− , "backendTid <- forkIO $ handle handleBackendErr backend"
47− , "let conf = defRunConfig { _runConfig_redirectPort = " <> show freePort <> "}"
48− , "runWidget conf frontend"
49− , "killThread backendTid"
50− ]
170+ withGhciScriptArgs pkgs $ \dotGhciArgs -> do
171+ runGhcid root True (ghciArgs <> dotGhciArgs) pkgs $ Just $ unwords
172+ [ "Obelisk.Run.run"
173+ , show freePort
174+ , "(Obelisk.Run.runServeAsset " ++ show assets ++ ")"
175+ , "Backend.backend"
176+ , "Frontend.frontend"
177+ ]
178+
179+runRepl :: MonadObelisk m => FilePath -> PathTree Interpret -> m ()
180+runRepl root interpretPaths = do
181+ pkgs <- getParsedLocalPkgs root interpretPaths
182+ ghciArgs <- getGhciSessionSettings pkgs "." True
183+ withGhciScriptArgs pkgs $ \dotGhciArgs ->
184+ runGhciRepl root pkgs (ghciArgs <> dotGhciArgs)
185+
186+runWatch :: MonadObelisk m => FilePath -> PathTree Interpret -> m ()
187+runWatch root interpretPaths = do
188+ pkgs <- getParsedLocalPkgs root interpretPaths
189+ ghciArgs <- getGhciSessionSettings pkgs root True
190+ withGhciScriptArgs pkgs $ \dotGhciArgs ->
191+ runGhcid root True (ghciArgs <> dotGhciArgs) pkgs Nothing
192+
193+exportGhciConfig :: MonadObelisk m => Bool -> FilePath -> PathTree Interpret -> m [String]
194+exportGhciConfig useRelativePaths root interpretPaths = do
195+ pkgs <- getParsedLocalPkgs root interpretPaths
196+ getGhciSessionSettings pkgs "." useRelativePaths
197+
198+nixShellForInterpretPaths :: MonadObelisk m => Bool -> String -> FilePath -> PathTree Interpret -> Maybe String -> m ()
199+nixShellForInterpretPaths isPure shell root interpretPaths cmd = do
200+ pkgs <- getParsedLocalPkgs root interpretPaths
201+ nixShellWithoutPkgs root isPure False (packageInfoToNamePathMap pkgs) shell cmd
202+
203+-- | Like 'getLocalPkgs' but also parses them and fails if any of them can't be parsed.
204+getParsedLocalPkgs :: MonadObelisk m => FilePath -> PathTree Interpret -> m (NonEmpty CabalPackageInfo)
205+getParsedLocalPkgs root interpretPaths = parsePackagesOrFail =<< getLocalPkgs root interpretPaths
206+
207+-- | Relative paths to local packages of an obelisk project.
208+--
209+-- These are a combination of the obelisk predefined local packages,
210+-- and any packages that the user has set with the @packages@ argument
211+-- to the Nix @project@ function.
212+getLocalPkgs :: forall m. MonadObelisk m => FilePath -> PathTree Interpret -> m (Set FilePath)
213+getLocalPkgs root interpretPaths = do
214+ putLog Debug $ [i|Finding packages with root ${root} and interpret paths:|] <> "\n" <> drawPathTree textInterpret interpretPaths
215+ obeliskPackagePaths <- runFind ["-L", root, "-name", ".obelisk", "-type", "d"]
216+
217+ -- We do not want to find packages that are embedded inside other obelisk projects, unless that
218+ -- obelisk project is our own.
219+ obeliskPackageExclusions <- liftIO $ fmap Set.fromList $ traverse canonicalizePath $
220+ filter (/= root) $ map takeDirectory obeliskPackagePaths
221+ putLog Debug [i|Excluding obelisk packages: ${T.pack $ unwords $ Set.toList obeliskPackageExclusions}|]
222+ let rootsAndExclusions = calcIntepretFinds "" interpretPaths
223+
224+ fmap fold $ for (MMap.toAscList rootsAndExclusions) $ \(interpretPathRoot, exclusions) ->
225+ let allExclusions = obeliskPackageExclusions <> exclusions <> Set.singleton ("*" </> attrCacheFileName)
226+ in fmap (Set.fromList . map normalise) $ runFind $
227+ ["-L", interpretPathRoot, "(", "-name", "*.cabal", "-o", "-name", Hpack.packageConfig, ")", "-a", "-type", "f"]
228+ <> concat [["-not", "-path", p </> "*"] | p <- toList allExclusions]
229+ where
230+ runFind args = do
231+ (_exitCode, out, err) <- readCreateProcessWithExitCode $ proc findExePath args
232+ putLog Debug $ T.strip $ T.pack err
233+ pure $ map T.unpack $ T.lines $ T.strip $ T.pack out
234+
235+-- | Calculates a set of root 'FilePath's along with each one's corresponding set of exclusions.
236+-- This is used when constructing a set of @find@ commands to run to produce a set of packages
237+-- that matches the user's @--interpret@/@--no-interpret@ settings.
238+calcIntepretFinds :: FilePath -> PathTree Interpret -> MMap.MonoidalMap FilePath (Set FilePath)
239+calcIntepretFinds treeRoot0 tree0 = runIdentity $ go treeRoot0 tree0
240+ where
241+ go treeRoot tree = foldPathTreeFor (== Interpret_Interpret) treeRoot tree $ \parent children -> do
242+ exclusions <- foldPathTreeFor (== Interpret_NoInterpret) parent children $ \parent' children' ->
243+ pure $ Map.singleton parent' children'
244+ deeperFinds <- Map.traverseWithKey go exclusions
245+ pure $ MMap.singleton parent (Map.keysSet exclusions) <> fold (MMap.MonoidalMap deeperFinds)
246+
247+-- | Traverses a 'PathTree' and folds all leaves matching a given predicate.
248+foldPathTreeFor
249+ :: forall m a b. (Applicative m, Monoid b)
250+ => (a -> Bool)
251+ -> FilePath
252+ -> PathTree a
253+ -> (FilePath -> PathTree a -> m b)
254+ -> m b
255+foldPathTreeFor predicate parent children f = case children of
256+ PathTree_Node (Just x) children' | predicate x -> f parent (PathTree_Node Nothing children')
257+ PathTree_Node _ children' -> fmap fold $ flip Map.traverseWithKey children' $ \k children'' ->
258+ foldPathTreeFor predicate (parent </> k) children'' f
259+
260+data GuessPackageFileError = GuessPackageFileError_Ambiguous [FilePath] | GuessPackageFileError_NotFound
261+ deriving (Eq, Ord, Show)
262+instance Exception GuessPackageFileError
263+
264+newtype HPackFilePath = HPackFilePath { unHPackFilePath :: FilePath } deriving (Eq, Ord, Show)
265+newtype CabalFilePath = CabalFilePath { unCabalFilePath :: FilePath } deriving (Eq, Ord, Show)
266+
267+-- | Given a directory, try to guess what the appropriate @.cabal@ or @package.yaml@ file is for the package.
268+guessCabalPackageFile
269+ :: (MonadIO m)
270+ => FilePath -- ^ Directory or path to search for cabal package
271+ -> m (Either GuessPackageFileError (Either CabalFilePath HPackFilePath))
272+guessCabalPackageFile pkg = do
273+ liftIO (doesDirectoryExist pkg) >>= \case
274+ False -> case cabalOrHpackFile pkg of
275+ (Just hpack@(Right _)) -> pure $ Right hpack
276+ (Just cabal@(Left (CabalFilePath cabalFilePath))) -> do
277+ -- If the cabal file has a sibling hpack file, we use that instead
278+ -- since running hpack often generates a sibling cabal file
279+ let possibleHpackSibling = takeDirectory cabalFilePath </> Hpack.packageConfig
280+ hasHpackSibling <- liftIO $ doesFileExist possibleHpackSibling
281+ pure $ Right $ if hasHpackSibling then Right (HPackFilePath possibleHpackSibling) else cabal
282+ Nothing -> pure $ Left GuessPackageFileError_NotFound
283+ True -> do
284+ candidates <- liftIO $
285+ filterM (doesFileExist . either unCabalFilePath unHPackFilePath)
286+ =<< mapMaybe (cabalOrHpackFile . (pkg </>)) <$> listDirectory pkg
287+ pure $ case partitionEithers candidates of
288+ ([hpack], _) -> Right $ Left hpack
289+ ([], [cabal]) -> Right $ Right cabal
290+ ([], []) -> Left GuessPackageFileError_NotFound
291+ (hpacks, cabals) -> Left $ GuessPackageFileError_Ambiguous $ coerce hpacks <> coerce cabals
292+
293+cabalOrHpackFile :: FilePath -> Maybe (Either CabalFilePath HPackFilePath)
294+cabalOrHpackFile = \case
295+ x | takeExtension x == ".cabal" -> Just (Left $ CabalFilePath x)
296+ | takeFileName x == Hpack.packageConfig -> Just (Right $ HPackFilePath x)
297+ | otherwise -> Nothing
298+
299+-- | Parses the cabal package in a given directory.
300+-- This automatically figures out which .cabal file or package.yaml (hpack) file to use in the given directory.
301+parseCabalPackage
302+ :: MonadObelisk m
303+ => FilePath -- ^ Package directory
304+ -> m (Maybe CabalPackageInfo)
305+parseCabalPackage dir = parseCabalPackage' dir >>= \case
306+ Left err -> Nothing <$ putLog Error err
307+ Right (Just (warnings, pkgInfo)) -> do
308+ for_ warnings $ putLog Warning . T.pack . show
309+ pure $ Just pkgInfo
310+ Right Nothing -> pure Nothing
311+
312+-- | Like 'parseCabalPackage' but returns errors and warnings directly so as to avoid 'MonadObelisk'.
313+parseCabalPackage'
314+ :: (MonadIO m)
315+ => FilePath -- ^ Package directory
316+ -> m (Either T.Text (Maybe ([Dist.PWarning], CabalPackageInfo)))
317+parseCabalPackage' pkg = runExceptT $ do
318+ (cabalContents, packageFile, packageName) <- guessCabalPackageFile pkg >>= \case
319+ Left GuessPackageFileError_NotFound -> throwError $ "No .cabal or package.yaml file found in " <> T.pack pkg
320+ Left (GuessPackageFileError_Ambiguous _) -> throwError $ "Unable to determine which .cabal file to use in " <> T.pack pkg
321+ Right (Left (CabalFilePath file)) -> (, file, takeBaseName file) <$> liftIO (readUTF8File file)
322+ Right (Right (HPackFilePath file)) -> do
323+ let
324+ decodeOptions = Hpack.DecodeOptions (Hpack.ProgramName "ob") file Nothing Hpack.decodeYaml
325+ liftIO (Hpack.readPackageConfig decodeOptions) >>= \case
326+ Left err -> throwError $ T.pack $ "Failed to parse " <> file <> ": " <> err
327+ Right (Hpack.DecodeResult hpackPackage _ _ _) -> pure (Hpack.renderPackage [] hpackPackage, file, Hpack.packageName hpackPackage)
328+
329+ let
330+ (warnings, result) = runParseResult $ parseGenericPackageDescription $ toUTF8BS cabalContents
331+ osConfVar = case System.Info.os of
332+ "linux" -> Just Dist.Linux
333+ "darwin" -> Just Dist.OSX
334+ _ -> trace "Unrecgonized System.Info.os" Nothing
335+ archConfVar = Just Dist.X86_64 -- TODO: Actually infer this
336+ evalConfVar v = Right $ case v of
337+ OS osVar -> Just osVar == osConfVar
338+ Arch archVar -> Just archVar == archConfVar
339+ Impl GHC _ -> True -- TODO: Actually check version range
340+ _ -> False
341+ case condLibrary <$> result of
342+ Right (Just condLib) -> do
343+ let (_, lib) = simplifyCondTree evalConfVar condLib
344+ pure $ Just $ (warnings,) $ CabalPackageInfo
345+ { _cabalPackageInfo_packageName = T.pack packageName
346+ , _cabalPackageInfo_packageFile = packageFile
347+ , _cabalPackageInfo_packageRoot = takeDirectory packageFile
348+ , _cabalPackageInfo_buildable = buildable $ libBuildInfo lib
349+ , _cabalPackageInfo_sourceDirs =
350+ fromMaybe (pure ".") $ NE.nonEmpty $ hsSourceDirs $ libBuildInfo lib
351+ , _cabalPackageInfo_defaultExtensions =
352+ defaultExtensions $ libBuildInfo lib
353+ , _cabalPackageInfo_defaultLanguage =
354+ defaultLanguage $ libBuildInfo lib
355+ , _cabalPackageInfo_compilerOptions = options $ libBuildInfo lib
356+ , _cabalPackageInfo_cppOptions = cppOptions $ libBuildInfo lib
357+ }
358+ Right Nothing -> pure Nothing
359+ Left (_, errors) ->
360+ throwError $ T.pack $ "Failed to parse " <> packageFile <> ":\n" <> unlines (map show errors)
361+
362+parsePackagesOrFail :: (MonadObelisk m, Foldable f) => f FilePath -> m (NE.NonEmpty CabalPackageInfo)
363+parsePackagesOrFail dirs' = do
364+ packageInfos' <- fmap catMaybes $ for dirs $ \dir -> do
365+ flip fmap (parseCabalPackage dir) $ \case
366+ Just packageInfo
367+ | _cabalPackageInfo_buildable packageInfo -> Just packageInfo
368+ _ -> Nothing
369+
370+ -- Sort duplicate packages such that we prefer shorter paths, but fall back to alphabetical ordering.
371+ let packagesByName = Map.map (NE.sortBy $ comparing $ \p -> let n = _cabalPackageInfo_packageFile p in (length n, n))
372+ $ Map.fromListWith (<>) [(_cabalPackageInfo_packageName p, p NE.:| []) | p <- packageInfos']
373+ unambiguous <- ifor packagesByName $ \packageName ps -> case ps of
374+ p NE.:| [] -> pure p -- No ambiguity here
375+ p NE.:| _ -> do
376+ let chosenText = " [Chosen] "
377+ prefix p'
378+ | _cabalPackageInfo_packageFile p' == _cabalPackageInfo_packageFile p = chosenText
379+ | otherwise = T.map (const ' ') chosenText
380+ putLog Warning $ T.unlines $
381+ "Packages named '" <> packageName <> "' appear in " <> T.pack (show $ length ps) <> " different locations: "
382+ : map (\p' -> prefix p' <> T.pack (_cabalPackageInfo_packageFile p')) (toList ps)
383+ pure p
384+
385+ packageInfos <- case NE.nonEmpty $ toList unambiguous of
386+ Nothing -> failWith $ T.pack $
387+ "No valid, buildable packages found" <> (if null dirs then "" else " in " <> intercalate ", " dirs)
388+ Just xs -> pure xs
389+
390+ pure packageInfos
391+ where
392+ dirs = toList dirs'
393+
394+packageInfoToNamePathMap :: Foldable f => f CabalPackageInfo -> Map Text FilePath
395+packageInfoToNamePathMap = Map.fromList . map (_cabalPackageInfo_packageName &&& _cabalPackageInfo_packageRoot) . toList
396+
397+-- Like 'withGhciScript' but provides the precise ghci arguments to add to a ghci session
398+withGhciScriptArgs
399+ :: (MonadObelisk m, Foldable f)
400+ => f CabalPackageInfo -- ^ List of packages to load into ghci
401+ -> ([String] -> m ()) -- ^ Action to run with the extra ghci arguments
402+ -> m ()
403+withGhciScriptArgs packageInfos f = withGhciScript loadPreludeManually packageInfos $ \fp -> f ["-XNoImplicitPrelude", "-ghci-script", fp]
404+ where
405+ -- These lines must be first and allow the session to support a custom Prelude when @-XNoImplicitPrelude@
406+ -- is passed to the ghci session.
407+ loadPreludeManually =
408+ [ ":add Prelude" -- @:add@ is used because it's less noisy when there is no custom Prelude
409+ , ":set -XImplicitPrelude" -- Turn the default setting on
410+ ]
411+
412+-- | Create ghci configuration to load the given packages
413+withGhciScript
414+ :: (MonadObelisk m, Foldable f)
415+ => [String] -- ^ Commands to prefix to file
416+ -> f CabalPackageInfo -- ^ List of packages to load into ghci
417+ -> (FilePath -> m ()) -- ^ Action to run with the path to generated temporary .ghci
418+ -> m ()
419+withGhciScript preCommands (toList -> packageInfos) f =
51420 withSystemTempDirectory "ob-ghci" $ \fp -> do
52421 let dotGhciPath = fp </> ".ghci"
53− writeFile dotGhciPath dotGhci
54− runDev dotGhciPath $ Just testCmd
55−
56−-- | Relative paths to local packages of an obelisk project
57−-- TODO a way to query this
58−getLocalPkgs :: IO [FilePath]
59−getLocalPkgs = return ["backend", "common", "frontend"]
60−
61−parseHsSrcDir :: FilePath -- ^ package cabal file path
62− -> IO (Maybe (NE.NonEmpty FilePath)) -- ^ List of hs src dirs of the library component
63−parseHsSrcDir cabalFp = do
64− exists <- doesFileExist cabalFp
65− if exists
66− then do
67− withUTF8FileContents cabalFp $ \cabal -> do
68− case parseGenericPackageDescription cabal of
69− ParseOk warnings gpkg -> do
70− mapM_ print warnings
71− return $ do
72− (_, lib) <- simplifyCondTree (const $ pure True) <$> condLibrary gpkg
73− pure $ fromMaybe (pure ".") $ NE.nonEmpty $ hsSourceDirs $ libBuildInfo lib
74− ParseFailed _ -> return Nothing
75− else return Nothing
76−
77−-- | Dev
78−runDev :: FilePath -> Maybe String -> IO ()
79−runDev dotGhci mcmd = callCommand $ unwords $ "ghcid" : ghcidOpts
422+ liftIO $ writeFile dotGhciPath dotGhci
423+ f dotGhciPath
424+ where
425+ packageNames = Set.fromList $ map _cabalPackageInfo_packageName packageInfos
426+ modulesToLoad = mconcat
427+ [ [ "Obelisk.Run" | "obelisk-run" `Set.member` packageNames ]
428+ , [ "Backend" | "backend" `Set.member` packageNames ]
429+ , [ "Frontend" | "frontend" `Set.member` packageNames ]
430+ ]
431+ dotGhci = unlines $
432+ preCommands <>
433+ [ if null modulesToLoad then "" else ":load " <> unwords modulesToLoad
434+ , "import qualified Obelisk.Run"
435+ , "import qualified Frontend"
436+ , "import qualified Backend"
437+ ]
438+
439+-- | Builds a list of options to pass to ghci or set in .ghci file that configures
440+-- the preprocessor and source includes.
441+getGhciSessionSettings
442+ :: (MonadObelisk m, Foldable f)
443+ => f CabalPackageInfo -- ^ List of packages to load into ghci
444+ -> FilePath -- ^ All paths will be relative to this path
445+ -> Bool -- ^ Use relative paths
446+ -> m [String]
447+getGhciSessionSettings (toList -> packageInfos) pathBase useRelativePaths = do
448+ -- N.B. ghci settings do NOT support escaping in any way. To minimize the likelihood that
449+ -- paths-with-spaces ruin our day, we first canonicalize everything, and then relativize
450+ -- all paths to 'pathBase'.
451+ selfExe <- liftIO $ canonicalizePath =<< getExecutablePath
452+ canonicalPathBase <- liftIO $ canonicalizePath pathBase
453+
454+ (pkgFiles, pkgSrcPaths :: [NonEmpty FilePath]) <- fmap unzip $ liftIO $ for packageInfos $ \pkg -> do
455+ canonicalSrcDirs <- traverse canonicalizePath $ (_cabalPackageInfo_packageRoot pkg </>) <$> _cabalPackageInfo_sourceDirs pkg
456+ canonicalPkgFile <- canonicalizePath $ _cabalPackageInfo_packageFile pkg
457+ pure (canonicalPkgFile `relativeTo'` canonicalPathBase, (`relativeTo'` canonicalPathBase) <$> canonicalSrcDirs)
458+
459+ pure
460+ $ baseGhciOptions
461+ <> ["-F", "-pgmF", selfExe, "-optF", preprocessorIdentifier]
462+ <> concatMap (\p -> ["-optF", p]) pkgFiles
463+ <> [ "-i" <> intercalate ":" (concatMap toList pkgSrcPaths) ]
80464 where
81− ghcidOpts =
82− [ "-W"
83− , "--command='ghci -ghci-script " <> dotGhci <> "' "
84− ] <> maybeToList (flip fmap mcmd $ \cmd -> " --test=$'" <> cmd <> "'")
85−
86−getFreePort :: IO PortNumber
87−getFreePort = withSocketsDo $ do
88− addr:_ <- getAddrInfo (Just defaultHints) (Just "127.0.0.1") (Just "0")
89− E.bracket (open addr) close socketPort
465+ relativeTo' = if useRelativePaths then relativeTo else const
466+
467+baseGhciOptions :: [String]
468+baseGhciOptions =
469+ [ "-ignore-dot-ghci"
470+ , "-no-user-package-db"
471+ , "-package-env", "-"
472+ ]
473+
474+-- | Run ghci repl
475+runGhciRepl
476+ :: (MonadObelisk m, Foldable f)
477+ => FilePath -- ^ Path to project root
478+ -> f CabalPackageInfo -- ^ Packages to keep unbuilt
479+ -> [String] -- ^ GHCi arguments
480+ -> m ()
481+runGhciRepl root (toList -> packages) ghciArgs =
482+ -- NOTE: We do *not* want to use $(staticWhich "ghci") here because we need the
483+ -- ghc that is provided by the shell in the user's project.
484+ nixShellWithoutPkgs root True False (packageInfoToNamePathMap packages) "ghc" $
485+ Just $ unwords $ fmap bashEscape $ "ghci" : ghciArgs
486+
487+-- | Run ghcid
488+runGhcid
489+ :: (MonadObelisk m, Foldable f)
490+ => FilePath -- ^ Path to project root
491+ -> Bool -- ^ Should we chdir to root when running this process?
492+ -> [String] -- ^ GHCi arguments
493+ -> f CabalPackageInfo -- ^ Packages to keep unbuilt
494+ -> Maybe String -- ^ Optional command to run at every reload
495+ -> m ()
496+runGhcid root chdirToRoot ghciArgs (toList -> packages) mcmd =
497+ nixShellWithoutPkgs root True chdirToRoot (packageInfoToNamePathMap packages) "ghc" $
498+ Just $ unwords $ fmap bashEscape $ ghcidExePath : opts
499+ where
500+ opts = concat
501+ [ ["-W"]
502+ , ["--outputfile=ghcid-output.txt"]
503+ , map (\x -> "--reload=" <> x) reloadFiles
504+ , map (\x -> "--restart=" <> x) restartFiles
505+ , maybe [] (\cmd -> ["--test=" <> cmd]) mcmd
506+ , ["--command=" <> unwords ("ghci" : ghciArgs)]
507+ ]
508+ adjustRoot x = if chdirToRoot then makeRelative root x else x
509+ reloadFiles = map adjustRoot [root </> "config"]
510+ restartFiles = map (adjustRoot . _cabalPackageInfo_packageFile) packages
511+
512+getFreePort :: MonadIO m => m Socket.PortNumber
513+getFreePort = liftIO $ Socket.withSocketsDo $ do
514+ addr:_ <- Socket.getAddrInfo (Just Socket.defaultHints) (Just "127.0.0.1") (Just "0")
515+ bracket (open addr) Socket.close Socket.socketPort
90516 where
91517 open addr = do
92− sock <- socket (addrFamily addr) (addrSocketType addr) (addrProtocol addr)
93− bind sock (addrAddress addr)
518+ sock <- Socket.socket (Socket.addrFamily addr) (Socket.addrSocketType addr) (Socket.addrProtocol addr)
519+ Socket.bind sock (Socket.addrAddress addr)
94520 return sock
521+
522+
523+-- | Convert a 'FilePath' into a 'PathTree'.
524+pathToTree :: a -> FilePath -> PathTree a
525+pathToTree a p = go $ splitDirectories p
526+ where
527+ go [] = PathTree_Node (Just a) mempty
528+ go (x : xs) = PathTree_Node Nothing $ Map.singleton x $ go xs
529+
530+-- | Like 'zipWith' but pads with a padding value instead of stopping on the shortest list.
531+zipDefaultWith :: a -> b -> (a -> b -> c) -> [a] -> [b] -> [c]
532+zipDefaultWith _da _db _f [] [] = []
533+zipDefaultWith da db f (a:as) [] = f a db : zipDefaultWith da db f as []
534+zipDefaultWith da db f [] (b:bs) = f da b : zipDefaultWith da db f [] bs
535+zipDefaultWith da db f (a:as) (b:bs) = f a b : zipDefaultWith da db f as bs
536+
537+-- | Makes the first absolute path relative to the second absolute path.
538+--
539+-- Both input paths MUST be absolute.
540+--
541+-- Unlike 'makeRelative' this does not merely strip prefixes. It will introduce
542+-- enough @..@ paths to make the resulting path truly relative in virtually every
543+-- case. The only exception is on Windows when the two paths are on different
544+-- drives. In this case the resulting path may be absolute.
545+relativeTo :: FilePath -> FilePath -> FilePath
546+relativeTo dir base
547+ = bifoldr1 (</>)
548+ $ bimap (collapse . (".." <$) . catMaybes) (collapse . catMaybes)
549+ $ unzip
550+ $ dropWhile (\(a,b) -> a == b)
551+ $ zipDefaultWith Nothing Nothing (,)
552+ (map Just $ splitDirectories base)
553+ (map Just $ splitDirectories dir)
554+ where collapse = foldr (</>) ""
lib/command/src/Obelisk/Command/Thunk.hs+992−456

This diff is too big to show here.

lib/command/src/Obelisk/Command/Utils.hs+247−20

This diff is too big to show here.

lib/command/src/Obelisk/Command/VmBuilder.hsnew file+202

This diff is too big to show here.

lib/executable-config/README.md+2−7

This diff is too big to show here.

lib/executable-config/default.nix+38−15

This diff is too big to show here.

lib/executable-config/inject/obelisk-executable-config-inject.cabal+6−5

This diff is too big to show here.

lib/executable-config/inject/src/Obelisk/ExecutableConfig/Inject.hs+18−10

This diff is too big to show here.

lib/executable-config/lookup/default.nixdeleted−24

This diff is too big to show here.

lib/executable-config/lookup/obelisk-executable-config-lookup.cabalnew file+48

This diff is too big to show here.

lib/executable-config/lookup/obelisk-executable-config.cabaldeleted−30

This diff is too big to show here.

lib/executable-config/lookup/src-android/Obelisk/ExecutableConfig.hsdeleted−27

This diff is too big to show here.

lib/executable-config/lookup/src-android/Obelisk/ExecutableConfig/Lookup.hsnew file+60

This diff is too big to show here.

lib/executable-config/lookup/src-ghcjs/Obelisk/ExecutableConfig.hsdeleted−17

This diff is too big to show here.

lib/executable-config/lookup/src-ghcjs/Obelisk/ExecutableConfig/Lookup.hsnew file+51

This diff is too big to show here.

lib/executable-config/lookup/src-ios/Obelisk/ExecutableConfig.hsdeleted−22

This diff is too big to show here.

lib/executable-config/lookup/src-ios/Obelisk/ExecutableConfig/Lookup.hsnew file+17

This diff is too big to show here.

lib/executable-config/lookup/src-other/Obelisk/ExecutableConfig/Lookup.hsnew file+11

This diff is too big to show here.

lib/executable-config/lookup/src/Obelisk/Configs.hsnew file+148

This diff is too big to show here.

lib/executable-config/lookup/src/Obelisk/Configs/Internal/Directory.hsnew file+24

This diff is too big to show here.

lib/executable-config/lookup/src/Obelisk/ExecutableConfig.hsdeleted−13

This diff is too big to show here.

lib/frontend/obelisk-frontend.cabalnew file+29

This diff is too big to show here.

lib/frontend/src/Obelisk/Frontend.hsnew file+254

This diff is too big to show here.

lib/frontend/src/Obelisk/Frontend/Cookie.hsnew file+103

This diff is too big to show here.

lib/https/github.jsondeleted−7

This diff is too big to show here.

lib/route/README.mdnew file+6

This diff is too big to show here.

lib/route/obelisk-route.cabalnew file+42

This diff is too big to show here.

lib/route/src/Obelisk/Route.hsnew file+1228

This diff is too big to show here.

lib/route/src/Obelisk/Route/Frontend.hsnew file+662

This diff is too big to show here.

lib/route/src/Obelisk/Route/TH.hsnew file+17

This diff is too big to show here.

lib/run-frontend/obelisk-run-frontend.cabaldeleted−28

This diff is too big to show here.

lib/run-frontend/src/Obelisk/Widget/Run.hsdeleted−95

This diff is too big to show here.

lib/run/obelisk-run.cabalnew file+53

This diff is too big to show here.

lib/run/src/Obelisk/Run.hsnew file+268

This diff is too big to show here.

lib/selftest/obelisk-selftest.cabal+17−3

This diff is too big to show here.

lib/selftest/src/Obelisk/SelfTest.hs+613−12

This diff is too big to show here.

lib/snap-extras/obelisk-snap-extras.cabal+2−3

This diff is too big to show here.

lib/snap-extras/src/Obelisk/Snap/Extras.hs+2−2

This diff is too big to show here.

lib/snap/default.nixdeleted−17

This diff is too big to show here.

lib/snap/obelisk-snap.cabaldeleted−39

This diff is too big to show here.

lib/snap/src/Obelisk/Snap.hsdeleted−158

This diff is too big to show here.

lib/tabulation/CHANGELOG.mdnew file+5

This diff is too big to show here.

lib/tabulation/LICENSEnew file+30

This diff is too big to show here.

lib/tabulation/Setup.hsnew file+2

This diff is too big to show here.

lib/tabulation/src/Data/Tabulation.hsnew file+21

This diff is too big to show here.

lib/tabulation/tabulation.cabalnew file+26

This diff is too big to show here.

nixpkgs-overlays/default.nixnew file+15

This diff is too big to show here.

release.nix+7−18

This diff is too big to show here.

skeleton/.gitignore+14−1

This diff is too big to show here.

skeleton/.obelisk/.gitignorenew file+3

This diff is too big to show here.

skeleton/backend/backend.cabal+10−2

This diff is too big to show here.

skeleton/backend/frontendJs/frontend.jsexenew file+1

This diff is too big to show here.

skeleton/backend/src-bin/main.hsnew file+6

This diff is too big to show here.

skeleton/backend/src/Backend.hs+7−4

This diff is too big to show here.

skeleton/backend/src/main.hsdeleted−5

This diff is too big to show here.

skeleton/cabal.project+1

This diff is too big to show here.

skeleton/common/common.cabal+5−1

This diff is too big to show here.

skeleton/common/src/Common/Api.hs+1−1

This diff is too big to show here.

skeleton/common/src/Common/Route.hsnew file+47

This diff is too big to show here.

skeleton/config/common/examplenew file+1

This diff is too big to show here.

skeleton/config/common/routenew file+1

This diff is too big to show here.

skeleton/default.nix+17−2

This diff is too big to show here.

skeleton/frontend/frontend.cabal+16−10

This diff is too big to show here.

skeleton/frontend/src-bin/main.hsnew file+10

This diff is too big to show here.

skeleton/frontend/src/Frontend.hs+39−9

This diff is too big to show here.

skeleton/frontend/src/main.hsdeleted−5

This diff is too big to show here.

skeleton/static/main.cssnew file+3

This diff is too big to show here.