sliccy 6.88.0 → 6.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ui/.vite/manifest.json +173 -163
- package/dist/ui/assets/{SKILL-i1NMDKwT.js → SKILL-D4YtbN6n.js} +1 -1
- package/dist/ui/assets/{account-store-l8BmmoRx.js → account-store-Bo-yhxpr.js} +1 -1
- package/dist/ui/assets/{account-store-BLu0_ipL.js → account-store-CYz2dZdk.js} +1 -1
- package/dist/ui/assets/{adobe-Cj2iYsHq.js → adobe-BABx4YQD.js} +1 -1
- package/dist/ui/assets/{adobe-Caluo3Vg.js → adobe-DFu35kBc.js} +1 -1
- package/dist/ui/assets/{apply-layout-lJ2Uyc3p.js → apply-layout-DtjqLMjP.js} +1 -1
- package/dist/ui/assets/{apps-BRi5S2KV.js → apps-CvbmIZii.js} +1 -1
- package/dist/ui/assets/{azure-openai-xFuHu_hU.js → azure-openai-C47c28Th.js} +1 -1
- package/dist/ui/assets/{azure-openai-DtPDwGAY.js → azure-openai-Dn30Odmd.js} +1 -1
- package/dist/ui/assets/{cerebras-BKhMaWSl.js → cerebras-B2bBHcWG.js} +1 -1
- package/dist/ui/assets/{cerebras-CCLa0xVH.js → cerebras-DWI7o4tY.js} +1 -1
- package/dist/ui/assets/{connect-surface-T7iCJFeB.js → connect-surface-Dd462OJJ.js} +1 -1
- package/dist/ui/assets/db-DSIYsBgP.js +1 -0
- package/dist/ui/assets/db-cKsBsMMN.js +1 -0
- package/dist/ui/assets/{fs-1btyYJVn.js → fs-BHEdp-e-.js} +1 -1
- package/dist/ui/assets/{fs-BYtJQhvh.js → fs-MCOH5KUJ.js} +2 -2
- package/dist/ui/assets/{github-BHL_hKU_.js → github-BbQO4O_c.js} +2 -2
- package/dist/ui/assets/{github-fX2kuECo.js → github-C-f5ThxJ.js} +1 -1
- package/dist/ui/assets/{github-copilot-CZorsYUj.js → github-copilot-DXrDbEzB.js} +1 -1
- package/dist/ui/assets/{github-copilot-DVmzgGYz.js → github-copilot-Du-Z6Dmn.js} +1 -1
- package/dist/ui/assets/{github-install-DVzD1asQ.js → github-install-DbrQX7SM.js} +1 -1
- package/dist/ui/assets/{github-zip-5ekKl7Z0.js → github-zip-BRYnSLKK.js} +1 -1
- package/dist/ui/assets/host-command-zx0pt9Np.js +1 -0
- package/dist/ui/assets/{js-realm-worker-iDrigwwJ.js → js-realm-worker-BZhHEqbx.js} +1 -1
- package/dist/ui/assets/{kernel-worker-BdKtpNzV.js → kernel-worker-CwFqaikq.js} +167 -167
- package/dist/ui/assets/{lick-manager-BJhAu_iX.js → lick-manager-DFmMezV-.js} +1 -1
- package/dist/ui/assets/{lick-ws-bridge-DOJW_mZp.js → lick-ws-bridge-yklVm5en.js} +1 -1
- package/dist/ui/assets/{local-llm-aZ3BO7wK.js → local-llm-D4MgnlBK.js} +1 -1
- package/dist/ui/assets/{local-llm-BoLsVU6D.js → local-llm-HluX94rS.js} +1 -1
- package/dist/ui/assets/{main-CSh1z5qo.js → main-BmpPeikS.js} +3 -3
- package/dist/ui/assets/{mount-ICXjya6b.js → mount-B_Yysj_W.js} +2 -2
- package/dist/ui/assets/{mount-BCaA8NF3.js → mount-kkSADJkJ.js} +1 -1
- package/dist/ui/assets/{mount-recovery-CtadSXiq.js → mount-recovery-xQgEe0_O.js} +1 -1
- package/dist/ui/assets/{new-session-CCcPVim0.js → new-session-CEfChDqS.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-CJ7pyk8I.js → oauth-bootstrap-C9bBExq6.js} +2 -2
- package/dist/ui/assets/{onboarding-orchestrator-CaLdds3m.js → onboarding-orchestrator-CnKr0yBW.js} +1 -1
- package/dist/ui/assets/{openai-codex-DJHh6O0O.js → openai-codex-Cs4FnQBb.js} +1 -1
- package/dist/ui/assets/{openai-codex-C7WXAsyq.js → openai-codex-QVbVkjdj.js} +1 -1
- package/dist/ui/assets/{openrouter-CIXJV3ar.js → openrouter-CKoiUQKB.js} +1 -1
- package/dist/ui/assets/{openrouter-CbIgawBs.js → openrouter-D1wpkLTj.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-ZehYXklO.js → openrouter-oauth-Df_lWai3.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-CfwEmxEv.js → openrouter-oauth-jvPojBWW.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-Bg0_q2j9.js → panel-rpc-handlers-Dwk2fvsL.js} +2 -2
- package/dist/ui/assets/{provider-1dH_J0Ky.js → provider-Dq-ruSoi.js} +2 -2
- package/dist/ui/assets/{provider-CCer_iKN.js → provider-Y9RlYumW.js} +1 -1
- package/dist/ui/assets/{provider-settings-DKXi1uSi.js → provider-settings-CR96H2hU.js} +1 -1
- package/dist/ui/assets/{provider-settings-DZxqnVAO.js → provider-settings-DNJS-V3F.js} +1 -1
- package/dist/ui/assets/{provider-store-access-BthQZUzO.js → provider-store-access-BIdOJknd.js} +2 -2
- package/dist/ui/assets/provider-store-access-HarlSCPD.js +1 -0
- package/dist/ui/assets/{providers-D8GPTe3s.js → providers-BS5_Cp-0.js} +2 -2
- package/dist/ui/assets/{providers-DdfpdKUf.js → providers-DRiRdLO1.js} +1 -1
- package/dist/ui/assets/{quick-llm-DscHMm6M.js → quick-llm-9w6VrHaQ.js} +1 -1
- package/dist/ui/assets/record-Cy655bTh.js +1 -0
- package/dist/ui/assets/{recovery-screen-CmxX9RlA.js → recovery-screen-ClVBOtr7.js} +1 -1
- package/dist/ui/assets/{redirect-uri-CSXbRzUU.js → redirect-uri-B16gkDfI.js} +1 -1
- package/dist/ui/assets/{remote-terminal-view-Dc-DMywu.js → remote-terminal-view-DSUnPeXp.js} +1 -1
- package/dist/ui/assets/{session-freezer-cQJKe1j_.js → session-freezer-BcGQ4XGx.js} +3 -3
- package/dist/ui/assets/{setup-feature-flags-remote-BxfewGbb.js → setup-feature-flags-remote-8Rvw554i.js} +1 -1
- package/dist/ui/assets/{setup-standalone-prelude-Bv9X4-V2.js → setup-standalone-prelude-NNpe-m64.js} +2 -2
- package/dist/ui/assets/{setup-sudo-B3tWN6O2.js → setup-sudo-CbAhwltm.js} +2 -2
- package/dist/ui/assets/{skills-C8Ojzeu6.js → skills-CDnSEmr6.js} +1 -1
- package/dist/ui/assets/slicc-version-2zGA6xjX.js +1 -0
- package/dist/ui/assets/{store-CGgqI527.js → store-BKV5dm_L.js} +1 -1
- package/dist/ui/assets/{store-BPyCiwPs.js → store-Bl3OB-Qs.js} +1 -1
- package/dist/ui/assets/{sudo-1gsx4XWx.js → sudo-Bnq6X0me.js} +1 -1
- package/dist/ui/assets/{tray-leader-CP11I609.js → tray-leader-iVJTGwuf.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-DHKcwE9c.js → upgrade-detection-BC1ILaMz.js} +1 -1
- package/dist/ui/assets/{wc-extension-vZctlNTg.js → wc-extension-pWBTulcf.js} +2 -2
- package/dist/ui/assets/{wc-follower-BgCWId1J.js → wc-follower-TQacOT97.js} +3 -3
- package/dist/ui/assets/wc-live-DlayGhwI.js +8 -0
- package/dist/ui/assets/wc-nav-Co62IQ9D.js +2 -0
- package/dist/ui/assets/{wc-onboarding-B4o-Pdiq.js → wc-onboarding-CqIwr35s.js} +2 -2
- package/dist/ui/assets/{wc-permissions-gFKCQht9.js → wc-permissions-Oq3nX_59.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-BTbGc9bq.js → wc-placeholder-CRVvrH3X.js} +2 -2
- package/dist/ui/assets/{wc-scoop-color-CByZNEJo.js → wc-scoop-color-ShF3p7L9.js} +1 -1
- package/dist/ui/assets/{wc-settings-B4hsC2Um.js → wc-settings-Bh5hIzNc.js} +2 -2
- package/dist/ui/assets/{wc-shell-B9UbR2P2.js → wc-shell-7mtD7TN_.js} +3 -3
- package/dist/ui/assets/wc-sprinkles-wT8iHdRT.js +2 -0
- package/dist/ui/assets/wc-tray-DxDD8gsB.js +2 -0
- package/dist/ui/assets/wc-tray-scoops-B7RY-1VN.js +5 -0
- package/dist/ui/assets/wc-unit-context-C0EqsYUD.js +1 -0
- package/dist/ui/assets/{welcome-detection-C2MvJDW4.js → welcome-detection-DjomEbCT.js} +1 -1
- package/dist/ui/assets/{xai-grok-kLSQtmUi.js → xai-grok-CcoDiPUW.js} +1 -1
- package/dist/ui/assets/{xai-grok-DzMkuuG4.js → xai-grok-DO4be7QU.js} +1 -1
- package/dist/ui/index.html +6 -6
- package/dist/ui/packages/webapp/index.html +6 -6
- package/package.json +3 -4
- package/dist/ui/assets/db-DATxPCUz.js +0 -1
- package/dist/ui/assets/db-DIbBClfy.js +0 -1
- package/dist/ui/assets/host-command-C3cIKdbE.js +0 -1
- package/dist/ui/assets/provider-store-access-NzVfMvPw.js +0 -1
- package/dist/ui/assets/record-Z5ZWTUPJ.js +0 -1
- package/dist/ui/assets/slicc-version-CaunkoU5.js +0 -1
- package/dist/ui/assets/wc-live-leqS7MUz.js +0 -8
- package/dist/ui/assets/wc-nav-CO_N4L3V.js +0 -2
- package/dist/ui/assets/wc-sprinkles-Ds-rd0k7.js +0 -2
- package/dist/ui/assets/wc-tray-BQls_HTm.js +0 -2
- package/dist/ui/assets/wc-tray-scoops-D8qwcovR.js +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
var e='---\nname: mount\ndescription: |\n Use this whenever the user asks to mount anything — local folders, S3\n buckets, S3-compatible services (Cloudflare R2, MinIO), or Adobe da.live\n / AEM Document Authoring repos. Read this skill BEFORE deciding which\n backend to use; do NOT default to a local file picker when the user\n names a remote service. Covers credential setup with profile-namespaced\n `secret set` keys (e.g. `s3.aws.access_key_id`) or the extension Options\n page, the right `mount --source` invocation per intent, and common errors\n (EACCES on missing credentials, EBUSY on concurrent edits, EFBIG on\n oversized files).\nallowed-tools: bash, read_file, write_file, edit_file\n---\n\n# Mount\n\nThe `mount` shell command bridges remote storage into the VFS. After mounting, `read_file`, `write_file`, `edit_file`, and `bash` (with `cat`, `ls`, etc.) all work against the remote source as if it were a local directory. Four backends:\n\n| Backend | Source URI | Auth |\n| ------- | ----------------------------- | ------------------------------------------------------ |\n| Local | (no `--source`) | OS file picker — cone-only, fails in scoops |\n| S3 | `s3://<bucket>[/<prefix>]` | Profile-namespaced secrets (`s3.<profile>.*`) |\n| DA | `da://<org>/<repo>[/<path>]` | Adobe IMS bearer (reuses the Adobe LLM provider login) |\n| AEM | `aem://<org>/<site>[/<path>]` | Adobe IMS bearer (same login as DA) |\n\n## Choosing a backend from user intent\n\nWhen the user asks to "mount X", read the request literally before defaulting to local:\n\n| User says | Use this backend |\n| -------------------------------------------------- | ------------------------------------------------------- |\n| "mount my Documents folder" / "mount /tmp" | Local — `mount /mnt/documents` |\n| "mount this S3 bucket: s3://my-bucket/foo" | S3 — `mount --source s3://my-bucket/foo /mnt/s3` |\n| "mount this R2 bucket" | S3 with a custom-endpoint profile (R2 is S3-compatible) |\n| "mount the AEM DA repo for org/site" | DA — `mount --source da://<org>/<site> /mnt/da` |\n| "mount this Adobe DA project" / "mount da.live" | DA |\n| "mount this Helix 6 site" / "mount the Source Bus" | AEM — `mount --source aem://<org>/<site> /mnt/aem` |\n| "mount this S3-compatible storage" (MinIO, etc.) | S3 with a custom-endpoint profile |\n\nIf the URL scheme is `s3://`, `da://`, or `aem://`, the choice is unambiguous — don\'t ask. If the user gives a hostname or describes a service without a URL, ask one specific clarifying question (e.g. "Is this the AEM Document Authoring service at da.live, or a different system?") rather than offering a menu of generic options.\n\n**Don\'t default to local when the user mentions a remote service name.**\n\n### DA or AEM? You don\'t have to know — but read the mount output\n\nA site upgraded to the Helix 6 architecture keeps its `da.live` authoring UI and its `<org>/<site>` name, but its content moves to the Source Bus on `api.aem.live`. `da://` handles this for you: it probes the site config before mounting and re-routes to the Source Bus when that is where the content lives, printing a note on stderr. So `mount --source da://<org>/<site>` is always safe to reach for.\n\nTwo things follow:\n\n- **Read the stderr note.** `mount: <org>/<site> is on Helix 6 …` means the mount landed on `aem://` — that is correct, not a warning to work around.\n- **A `da://` mount can now fail with `could not determine the content source`.** That means the site config was unreadable (usually: no Adobe login), not that the site is missing. Fix the login, or pass `--backend da` / `--backend aem` if you already know which store holds the content. Don\'t retry the same command hoping for a different answer.\n\n## Setting up credentials before the first mount\n\n### S3 / R2 / MinIO\n\nS3 mounts read credentials from profile-namespaced secrets. Set them via the `secret` command before mounting. The agent never sees real secret values; only the server-side sign-and-forward handler does.\n\n```bash\n# AWS S3 (default profile)\nsecret set s3.default.access_key_id AKIA... --domain "*.amazonaws.com"\nsecret set s3.default.secret_access_key ... --domain "*.amazonaws.com"\nsecret set s3.default.region us-east-1 --domain "*.amazonaws.com"\n\n# Cloudflare R2 (uses a custom endpoint, requires path-style addressing for some setups)\nsecret set s3.r2.access_key_id ... --domain "*.r2.cloudflarestorage.com"\nsecret set s3.r2.secret_access_key ... --domain "*.r2.cloudflarestorage.com"\nsecret set s3.r2.endpoint https://<account>.r2.cloudflarestorage.com --domain "*.r2.cloudflarestorage.com"\n# Optional — only set this if R2 returns "Bucket name was not in expected format" at first read:\nsecret set s3.r2.path_style true --domain "*.r2.cloudflarestorage.com"\n```\n\nPer-profile keys: `access_key_id` and `secret_access_key` are required; `region` (default `us-east-1`), `endpoint` (custom host for R2/MinIO), `session_token` (for STS), and `path_style` (`"true"` for path-style addressing) are optional.\n\nIn **CLI / Electron mode** secrets live in `~/.slicc/secrets.env` (or macOS Keychain via swift-server). In **extension mode** they live in `chrome.storage.local` and the `secret` command writes to it directly.\n\n### Adobe da.live and AEM Source Bus\n\nDA and AEM mounts both use the Adobe IMS bearer token from the existing Adobe LLM provider — there are no DA-specific secrets to set. **If the user has not logged into the Adobe LLM provider yet, the first mount will fail with `EACCES`. Tell them to log in via Settings → Providers → Adobe (or run `oauth-token adobe`) first.**\n\n## Mounting\n\n```bash\n# Local (interactive picker, cone only)\nmount /mnt/local\n\n# S3 — bucket + optional prefix\nmount --source s3://my-bucket /mnt/s3\nmount --source s3://my-bucket/site --profile aws /mnt/aws\n\n# Cloudflare R2 — same s3:// scheme, different profile (custom endpoint)\nmount --source s3://my-r2-bucket/path --profile r2 /mnt/r2\n\n# Adobe da.live — org + repo (probes the site config, re-routes if Helix 6)\nmount --source da://my-org/my-repo /mnt/da\n\n# AEM Helix 6 Source Bus — org + site, no probe needed\nmount --source aem://my-org/my-site /mnt/aem\n```\n\nUseful flags:\n\n- `--profile <name>` — selects which `s3.<profile>.*` keys to use (S3 only). Defaults to `default`.\n- `--backend <da|aem>` — force the Adobe backend instead of probing the site config. Reach for it only when the probe fails or you know it is wrong.\n- `--no-probe` — skip the mount-time `HEAD bucket` / `GET /list` probe. Use when you want the mount to land even if the source is temporarily unreachable; first read/write will surface any auth errors instead. It does **not** skip the `da://` content-source probe.\n- `--max-body-mb <n>` — override the per-mount body-size limit. Defaults: S3 25 MB, DA/AEM 5 MB. Files exceeding this throw `EFBIG` before bytes flow.\n\n## Lifecycle\n\n```bash\nmount list # show all active mounts\nmount unmount /mnt/r2 # tear down (cache stays for next mount within TTL)\nmount unmount --clear-cache /mnt/r2 # tear down + drop cached listings/bodies\nmount refresh /mnt/r2 # re-walk the source and diff against cache\nmount refresh --bodies /mnt/r2 # also conditionally re-fetch changed bodies\n```\n\n`mount refresh` prints a structured summary: `Refreshed /mnt/r2: +2 -1 ~3 (47 unchanged, 0 errors)`. Use it after you know the remote changed externally and you want the local view to catch up before the 30 s TTL expires.\n\n## Index state and bounds (`mount list`)\n\nEach mount is indexed in the background for fast file discovery and listings; `mount list` shows each mount\'s index state. The walk is bounded — defaults (raised 10×): max directory depth **400**, max total entries **2,000,000**. Two env vars override them: `SLICC_MOUNT_INDEX_MAX_DEPTH` and `SLICC_MOUNT_INDEX_MAX_ENTRIES` (an invalid value falls back to the default with a warning).\n\nWhen a bound is hit the index is **skipped** (reads still work via the slow fallback) and `mount list` shows a distinct cause, so advise the right remedy:\n\n- `directory nesting exceeded the depth limit` → raise `SLICC_MOUNT_INDEX_MAX_DEPTH` or unmount.\n- `mounted tree is too large` → raise `SLICC_MOUNT_INDEX_MAX_ENTRIES` or unmount (this is **not** a cycle).\n- `self-referential mount cycle detected` → a real, confirmed cycle; unmount it.\n- `index error: <message>` → any other indexing failure.\n\nDon\'t call a large or deep mount "cyclic" — only `self-referential mount cycle detected` means a true self-reference.\n\n## Reading and writing once mounted\n\nTreat the mount path like any other VFS directory:\n\n```bash\nls /mnt/da\nread_file /mnt/da/index.html\nwrite_file /mnt/da/new-page.html "<html>..."\nedit_file /mnt/da/index.html # via the standard edit_file tool\nrm /mnt/da/old.html\n```\n\nReads and writes use TTL + ETag caching (30 s default). Reads are zero-RTT within TTL. Writes use `If-Match` / `If-None-Match: *` for conflict detection.\n\nOn an AEM (Source Bus) mount there are no ETags — the API exposes only `last-modified` — so conflict detection uses modification time and only covers files you read first. A blind `write_file` to a path you never read will overwrite whatever is there. Read before you write on `aem://` mounts.\n\n## Common error patterns\n\n| Error | What it means |\n| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `mount: probe failed for s3://… — profile \'aws\' missing required field \'access_key_id\'.` | The user hasn\'t set credentials yet. Walk them through `secret set s3.<profile>.*`. |\n| `EACCES: s3 access denied` | Wrong credentials, wrong region, or the bucket policy denies the user. |\n| `EACCES: da access denied` / `EACCES: aem access denied` | IMS token expired or user not authed against the Adobe provider. |\n| `mount: could not determine the content source for da://…` | The site config probe failed — usually no Adobe login. Fix the login, or pass `--backend da` / `--backend aem`. Don\'t just retry. |\n| `EBUSY: remote modified since last read — re-read and retry` | Concurrent writer changed the file. Re-read with `read_file` and retry the edit. |\n| `EFBIG: body exceeds maxBodyBytes` | File is over the per-mount size limit (S3 25 MB, DA/AEM 5 MB). Use shell tools (`aws s3 cp`) for very large files instead, or pass `--max-body-mb <n>` at mount time. |\n| `mount: cannot mount local directories from a scoop (no UI).` | Local mounts need a user gesture. Either ask the cone to mount, or use S3/DA which work in scoops. |\n\n## When asked to "explore" a mounted DA or S3 source\n\nAfter mounting, prefer `bash: ls` over `read_file` for navigation — it\'s instant within the TTL window because the listing is cached. Only `read_file` files you actually intend to read; every read is a network round-trip on the first call.\n\nFor DA specifically: the `/list` endpoint doesn\'t include file sizes, so `ls -l` triggers one HEAD per file the first time, then caches. Subsequent `ls -l` within 30 s is free.\n\nFor AEM: listings _do_ carry size and mtime, so `ls -l` costs one listing and no per-file round-trips. The size shown is the stored (compressed) size until the file has been read, so it can be well under what `read_file` returns. Empty folders don\'t exist on the Source Bus — a directory disappears when its last file is deleted.\n\n## Don\'t\n\n- Don\'t suggest the user install a separate AWS CLI / da.live SDK — `mount` is the integration point.\n- Don\'t try to `cd` into a remote mount before mounting; `bash`\'s working directory is independent of mount setup.\n- Don\'t ask "do you have credentials" if the user has already named a service — try the mount first, surface the actionable error from the probe, and walk them through the specific `secret set` commands.\n- Don\'t work around a `could not determine the content source` failure by switching to `--no-probe` — that flag doesn\'t skip the content-source probe, and the failure is telling you the login is missing.\n- Don\'t fall back to a local mount if the user mentioned a remote service. Default to clarifying which remote backend, not which directory to pick.\n';export{e as default};
|
|
1
|
+
var e='---\nname: mount\ndescription: |\n Use this whenever the user asks to mount anything — local folders, S3\n buckets, S3-compatible services (Cloudflare R2, MinIO), or Adobe da.live\n / AEM Document Authoring repos. Read this skill BEFORE deciding which\n backend to use; do NOT default to a local file picker when the user\n names a remote service. Covers credential setup with profile-namespaced\n `secret set` keys (e.g. `s3.aws.access_key_id`) or the extension Options\n page, the right `mount --source` invocation per intent, and common errors\n (EACCES on missing credentials, EBUSY on concurrent edits, EFBIG on\n oversized files).\nallowed-tools: bash, read_file, write_file, edit_file\n---\n\n# Mount\n\nThe `mount` shell command bridges remote storage into the VFS. After mounting, `read_file`, `write_file`, `edit_file`, and `bash` (with `cat`, `ls`, etc.) all work against the remote source as if it were a local directory. Four backends:\n\n| Backend | Source URI | Auth |\n| ------- | ----------------------------- | ------------------------------------------------------ |\n| Local | (no `--source`) | OS file picker — cone-only, fails in scoops |\n| S3 | `s3://<bucket>[/<prefix>]` | Profile-namespaced secrets (`s3.<profile>.*`) |\n| DA | `da://<org>/<repo>[/<path>]` | Adobe IMS bearer (reuses the Adobe LLM provider login) |\n| AEM | `aem://<org>/<site>[/<path>]` | Adobe IMS bearer (same login as DA) |\n\n## Choosing a backend from user intent\n\nWhen the user asks to "mount X", read the request literally before defaulting to local:\n\n| User says | Use this backend |\n| -------------------------------------------------- | ------------------------------------------------------- |\n| "mount my Documents folder" / "mount /tmp" | Local — `mount /mnt/documents` |\n| "mount this S3 bucket: s3://my-bucket/foo" | S3 — `mount --source s3://my-bucket/foo /mnt/s3` |\n| "mount this R2 bucket" | S3 with a custom-endpoint profile (R2 is S3-compatible) |\n| "mount the AEM DA repo for org/site" | DA — `mount --source da://<org>/<site> /mnt/da` |\n| "mount this Adobe DA project" / "mount da.live" | DA |\n| "mount this Helix 6 site" / "mount the Source Bus" | AEM — `mount --source aem://<org>/<site> /mnt/aem` |\n| "mount this S3-compatible storage" (MinIO, etc.) | S3 with a custom-endpoint profile |\n\nIf the URL scheme is `s3://`, `da://`, or `aem://`, the choice is unambiguous — don\'t ask. If the user gives a hostname or describes a service without a URL, ask one specific clarifying question (e.g. "Is this the AEM Document Authoring service at da.live, or a different system?") rather than offering a menu of generic options.\n\n**Don\'t default to local when the user mentions a remote service name.**\n\n### DA or AEM? You don\'t have to know — but read the mount output\n\nA site upgraded to the Helix 6 architecture keeps its `da.live` authoring UI and its `<org>/<site>` name, but its content moves to the Source Bus on `api.aem.live`. `da://` handles this for you: it probes the site config before mounting and re-routes to the Source Bus when that is where the content lives, printing a note on stderr. So `mount --source da://<org>/<site>` is always safe to reach for.\n\nTwo things follow:\n\n- **Read the stderr note.** `mount: <org>/<site> is on Helix 6 …` means the mount landed on `aem://` — that is correct, not a warning to work around.\n- **A `da://` mount can now fail with `could not determine the content source`.** That means the site config was unreadable (usually: no Adobe login), not that the site is missing. Fix the login, or pass `--backend da` / `--backend aem` if you already know which store holds the content. Don\'t retry the same command hoping for a different answer.\n\n## Setting up credentials before the first mount\n\n### S3 / R2 / MinIO\n\nS3 mounts read credentials from profile-namespaced secrets. Set them via the `secret` command before mounting. The agent never sees real secret values; only the server-side sign-and-forward handler does.\n\n```bash\n# AWS S3 (default profile)\nsecret set s3.default.access_key_id AKIA... --domain "*.amazonaws.com"\nsecret set s3.default.secret_access_key ... --domain "*.amazonaws.com"\nsecret set s3.default.region us-east-1 --domain "*.amazonaws.com"\n\n# Cloudflare R2 (uses a custom endpoint, requires path-style addressing for some setups)\nsecret set s3.r2.access_key_id ... --domain "*.r2.cloudflarestorage.com"\nsecret set s3.r2.secret_access_key ... --domain "*.r2.cloudflarestorage.com"\nsecret set s3.r2.endpoint https://<account>.r2.cloudflarestorage.com --domain "*.r2.cloudflarestorage.com"\n# Optional — only set this if R2 returns "Bucket name was not in expected format" at first read:\nsecret set s3.r2.path_style true --domain "*.r2.cloudflarestorage.com"\n```\n\nPer-profile keys: `access_key_id` and `secret_access_key` are required; `region` (default `us-east-1`), `endpoint` (custom host for R2/MinIO), `session_token` (for STS), and `path_style` (`"true"` for path-style addressing) are optional.\n\nIn **CLI / Electron mode** secrets live in `~/.slicc/secrets.env` (or macOS Keychain via swift-server). In **extension mode** they live in `chrome.storage.local` and the `secret` command writes to it directly.\n\n### Adobe da.live and AEM Source Bus\n\nDA and AEM mounts both use the Adobe IMS bearer token from the existing Adobe LLM provider — there are no DA-specific secrets to set. **If the user has not logged into the Adobe LLM provider yet, the first mount will fail with `EACCES`. Tell them to log in via Settings → Providers → Adobe (or run `oauth-token adobe`) first.**\n\n## Mounting\n\n```bash\n# Local (interactive picker, cone only)\nmount /mnt/local\n\n# S3 — bucket + optional prefix\nmount --source s3://my-bucket /mnt/s3\nmount --source s3://my-bucket/site --profile aws /mnt/aws\n\n# Cloudflare R2 — same s3:// scheme, different profile (custom endpoint)\nmount --source s3://my-r2-bucket/path --profile r2 /mnt/r2\n\n# Adobe da.live — org + repo (probes the site config, re-routes if Helix 6)\nmount --source da://my-org/my-repo /mnt/da\n\n# AEM Helix 6 Source Bus — org + site, no probe needed\nmount --source aem://my-org/my-site /mnt/aem\n```\n\nUseful flags:\n\n- `--profile <name>` — selects which `s3.<profile>.*` keys to use (S3 only). Defaults to `default`.\n- `--backend <da|aem>` — force the Adobe backend instead of probing the site config. Reach for it only when the probe fails or you know it is wrong.\n- `--no-probe` — skip the mount-time `HEAD bucket` / `GET /list` probe. Use when you want the mount to land even if the source is temporarily unreachable; first read/write will surface any auth errors instead. It does **not** skip the `da://` content-source probe.\n- `--max-body-mb <n>` — override the per-mount body-size limit. Defaults: S3 25 MB, DA/AEM 5 MB. Files exceeding this throw `EFBIG` before bytes flow.\n\n## Lifecycle\n\n```bash\nmount list # show all active mounts\nmount --list # same as `mount list` (`-l` also works)\nmount unmount /mnt/r2 # tear down (cache stays for next mount within TTL)\nmount unmount --clear-cache /mnt/r2 # tear down + drop cached listings/bodies\nmount refresh /mnt/r2 # re-walk the source and diff against cache\nmount refresh --bodies /mnt/r2 # also conditionally re-fetch changed bodies\n```\n\n`mount refresh` prints a structured summary: `Refreshed /mnt/r2: +2 -1 ~3 (47 unchanged, 0 errors)`. Use it after you know the remote changed externally and you want the local view to catch up before the 30 s TTL expires.\n\n## Index state and bounds (`mount list`)\n\nEach mount is indexed in the background for fast file discovery and listings; `mount list` shows each mount\'s index state. The walk is bounded — defaults (raised 10×): max directory depth **400**, max total entries **2,000,000**. Two env vars override them: `SLICC_MOUNT_INDEX_MAX_DEPTH` and `SLICC_MOUNT_INDEX_MAX_ENTRIES` (an invalid value falls back to the default with a warning).\n\nWhen a bound is hit the index is **skipped** (reads still work via the slow fallback) and `mount list` shows a distinct cause, so advise the right remedy:\n\n- `directory nesting exceeded the depth limit` → raise `SLICC_MOUNT_INDEX_MAX_DEPTH` or unmount.\n- `mounted tree is too large` → raise `SLICC_MOUNT_INDEX_MAX_ENTRIES` or unmount (this is **not** a cycle).\n- `self-referential mount cycle detected` → a real, confirmed cycle; unmount it.\n- `index error: <message>` → any other indexing failure.\n\nDon\'t call a large or deep mount "cyclic" — only `self-referential mount cycle detected` means a true self-reference.\n\n## Reading and writing once mounted\n\nTreat the mount path like any other VFS directory:\n\n```bash\nls /mnt/da\nread_file /mnt/da/index.html\nwrite_file /mnt/da/new-page.html "<html>..."\nedit_file /mnt/da/index.html # via the standard edit_file tool\nrm /mnt/da/old.html\n```\n\nReads and writes use TTL + ETag caching (30 s default). Reads are zero-RTT within TTL. Writes use `If-Match` / `If-None-Match: *` for conflict detection.\n\nOn an AEM (Source Bus) mount there are no ETags — the API exposes only `last-modified` — so conflict detection uses modification time and only covers files you read first. A blind `write_file` to a path you never read will overwrite whatever is there. Read before you write on `aem://` mounts.\n\n## Common error patterns\n\n| Error | What it means |\n| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `mount: probe failed for s3://… — profile \'aws\' missing required field \'access_key_id\'.` | The user hasn\'t set credentials yet. Walk them through `secret set s3.<profile>.*`. |\n| `EACCES: s3 access denied` | Wrong credentials, wrong region, or the bucket policy denies the user. |\n| `EACCES: da access denied` / `EACCES: aem access denied` | IMS token expired or user not authed against the Adobe provider. |\n| `mount: could not determine the content source for da://…` | The site config probe failed — usually no Adobe login. Fix the login, or pass `--backend da` / `--backend aem`. Don\'t just retry. |\n| `EBUSY: remote modified since last read — re-read and retry` | Concurrent writer changed the file. Re-read with `read_file` and retry the edit. |\n| `EFBIG: body exceeds maxBodyBytes` | File is over the per-mount size limit (S3 25 MB, DA/AEM 5 MB). Use shell tools (`aws s3 cp`) for very large files instead, or pass `--max-body-mb <n>` at mount time. |\n| `mount: cannot mount local directories from a scoop (no UI).` | Local mounts need a user gesture. Either ask the cone to mount, or use S3/DA which work in scoops. |\n\n## When asked to "explore" a mounted DA or S3 source\n\nAfter mounting, prefer `bash: ls` over `read_file` for navigation — it\'s instant within the TTL window because the listing is cached. Only `read_file` files you actually intend to read; every read is a network round-trip on the first call.\n\nFor DA specifically: the `/list` endpoint doesn\'t include file sizes, so `ls -l` triggers one HEAD per file the first time, then caches. Subsequent `ls -l` within 30 s is free.\n\nFor AEM: listings _do_ carry size and mtime, so `ls -l` costs one listing and no per-file round-trips. The size shown is the stored (compressed) size until the file has been read, so it can be well under what `read_file` returns. Empty folders don\'t exist on the Source Bus — a directory disappears when its last file is deleted.\n\n## Don\'t\n\n- Don\'t suggest the user install a separate AWS CLI / da.live SDK — `mount` is the integration point.\n- Don\'t try to `cd` into a remote mount before mounting; `bash`\'s working directory is independent of mount setup.\n- Don\'t ask "do you have credentials" if the user has already named a service — try the mount first, surface the actionable error from the probe, and walk them through the specific `secret set` commands.\n- Don\'t work around a `could not determine the content source` failure by switching to `--no-probe` — that flag doesn\'t skip the content-source probe, and the failure is telling you the login is missing.\n- Don\'t fall back to a local mount if the user mentioned a remote service. Default to clarifying which remote backend, not which directory to pick.\n';export{e as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/oauth-service-Uk8UIb05.js","assets/preload-helper-Czpn1I53.js","assets/proxied-fetch-BGeNrvQ4.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/base64-DpPqYZJF.js","assets/src-CAWTvdAa.js","assets/runtime-env-Dlaokqg1.js","assets/fetch-body-D2PwksUW.js","assets/api-endpoint-GRCyib6X.js","assets/runtime-env-CgsZ7LTp.js","assets/runtime-env-E-i2SW1s.js","assets/panel-rpc-B3MSVImO.js","assets/permissions-surface-registry-CilCRwhh.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{t as n}from"./preload-helper-Czpn1I53.js";import{a as r,c as i,l as a,o,s}from"./claude-model-version-DoVrYsKi.js";import"./libesm-BI4UHVqp.js";import{t as c}from"./logger-DDBAeTLF.js";import"./src-CAWTvdAa.js";import"./proxied-fetch-BGeNrvQ4.js";import{i as l,t as u}from"./api-endpoint-GRCyib6X.js";import{n as d}from"./float-topology-DiK91BlA.js";import"./secret-topology-0AWfFTh5.js";import{t as f}from"./secrets-bridge-client-DCQ44RyR.js";import"./image-markers-BXtVm4og.js";import"./tool-ui-DfXu6quJ.js";import{n as p,o as m,t as h}from"./providers-D8GPTe3s.js";import{n as g,t as _}from"./panel-rpc-B3MSVImO.js";import{r as v,t as y}from"./bedrock-camp-compat-CgBMwna8.js";var b={assign:0,create:0,clone:0,discard:0,update:0};function x(e){return Array.isArray(e)}function S(e){return w(e,null)}function C(e){return w(typeof e,`object`)&&!S(e)}function w(e,t){return e===t}function ee(e){if(!C(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!S(t)&&w(typeof t.constructor,`function`)&&!(w(t.constructor,globalThis.Object)||w(t.constructor.name,`Object`))}function te(e){return w(e,`__proto__`)||w(e,`constructor`)||w(e,`prototype`)}function ne(e,t){return te(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function re(e){return Object.getOwnPropertyNames(e)}function ie(e){return Object.getOwnPropertySymbols(e)}function T(e){return globalThis.ArrayBuffer.isView(e)}function ae(e){return e instanceof globalThis.RegExp}function oe(e){return e instanceof globalThis.Set}function se(e){return e instanceof globalThis.Map}function ce(e){return e}function le(e){return ne(e,`~kind`)||ne(e,`~unsafe`)}function ue(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let e of Object.keys(n)){if(te(e))continue;let r=n[e];ne(r,`value`)&&Object.defineProperty(t,e,{...r,value:E(r.value)})}return t}function de(e){let t={};for(let n of re(e))te(n)||(t[n]=E(e[n]));for(let n of ie(e))t[n]=E(e[n]);return t}function fe(e){return ee(e)?ce(e):le(e)?ue(e):de(e)}function pe(e){return e.map(e=>E(e))}function me(e){return e.slice()}function he(e){return new RegExp(e.source,e.flags)}function ge(e){return new Map(E([...e.entries()]))}function _e(e){return new Set(E([...e.values()]))}function E(e){return T(e)?me(e):ae(e)?he(e):se(e)?ge(e):oe(e)?_e(e):x(e)?pe(e):C(e)?fe(e):e}function ve(e){return b.clone+=1,E(e)}var ye={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function be(){return ye}function xe(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function Se(e,t){return{...e,...t}}function Ce(e,t,n={}){b.create+=1;let r=be(),i=Se(t,n),a=r.enumerableKind?Se(i,e):xe(i,e);return r.immutableTypes?Object.freeze(a):a}function we(e,t,n){b.update+=1;let r=be(),i=ve(e);for(let e of Object.keys(t))Object.defineProperty(i,e,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[e]});for(let e of Object.keys(n))Object.defineProperty(i,e,{configurable:!0,enumerable:!0,writable:!0,value:n[e]});return i}function Te(e){return C(e)}function Ee(e){return we(e,{"~optional":!0},{})}function De(e,t){return we(Ee(e),{},t)}function Oe(e,t){return Ce({"~kind":`Array`},{type:`array`,items:e},t)}function ke(e,t={}){return De(e,t)}function Ae(e){return ke(e)}function je(e){return Te(e)&&ne(e,`~optional`)}function Me(e){return re(e).filter(t=>!je(e[t]))}function Ne(e,t={}){let n=Me(e);return Ce({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}var Pe;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(Pe||={}),Array.from({length:256}).map((e,t)=>BigInt(t));var Fe=new Float64Array(1);new DataView(Fe.buffer),new Uint8Array(Fe.buffer),new TextEncoder;var Ie=`-?(?:0|[1-9][0-9]*)`,Le=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function Re(e){return Ce({"~kind":`Number`},{type:`number`},e)}function D(e){return Ce({"~kind":`String`},{type:`string`},e)}var ze=`^${Ie}$`;`${Le}`;function Be(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}var Ve=[...Be(97,122),...Be(65,90)],He=[`0`,...Be(49,57)];[...He],[...Ve,...He],[...He],new RegExp(ze);function Ue(e,t){try{return Promise.resolve(t(We))}catch(e){return Promise.reject(e)}}var We={startSpan:Ue,addEvent:()=>{},setAttributes:()=>{},setStatus:()=>{}};Object.freeze(We);var Ge=Symbol.for(`yaml.alias`),Ke=Symbol.for(`yaml.document`),O=Symbol.for(`yaml.map`),qe=Symbol.for(`yaml.pair`),Je=Symbol.for(`yaml.scalar`),Ye=Symbol.for(`yaml.seq`),k=Symbol.for(`yaml.node.type`),A=e=>!!e&&typeof e==`object`&&e[k]===Ge,Xe=e=>!!e&&typeof e==`object`&&e[k]===Ke,Ze=e=>!!e&&typeof e==`object`&&e[k]===O,j=e=>!!e&&typeof e==`object`&&e[k]===qe,M=e=>!!e&&typeof e==`object`&&e[k]===Je,Qe=e=>!!e&&typeof e==`object`&&e[k]===Ye;function N(e){if(e&&typeof e==`object`)switch(e[k]){case O:case Ye:return!0}return!1}function P(e){if(e&&typeof e==`object`)switch(e[k]){case Ge:case O:case Je:case Ye:return!0}return!1}var $e=e=>(M(e)||N(e))&&!!e.anchor,F=Symbol(`break visit`),et=Symbol(`skip children`),tt=Symbol(`remove node`);function nt(e,t){let n=rt(t);Xe(e)?I(null,e.contents,n,Object.freeze([e]))===tt&&(e.contents=null):I(null,e,n,Object.freeze([]))}nt.BREAK=F,nt.SKIP=et,nt.REMOVE=tt;function I(e,t,n,r){let i=it(e,t,n,r);if(P(i)||j(i))return at(e,r,i),I(e,i,n,r);if(typeof i!=`symbol`){if(N(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=I(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===F)return F;else i===tt&&(t.items.splice(e,1),--e)}}else if(j(t)){r=Object.freeze(r.concat(t));let e=I(`key`,t.key,n,r);if(e===F)return F;e===tt&&(t.key=null);let i=I(`value`,t.value,n,r);if(i===F)return F;i===tt&&(t.value=null)}}return i}function rt(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function it(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Ze(t))return n.Map?.(e,t,r);if(Qe(t))return n.Seq?.(e,t,r);if(j(t))return n.Pair?.(e,t,r);if(M(t))return n.Scalar?.(e,t,r);if(A(t))return n.Alias?.(e,t,r)}function at(e,t,n){let r=t[t.length-1];if(N(r))r.items[e]=n;else if(j(r))e===`key`?r.key=n:r.value=n;else if(Xe(r))r.contents=n;else{let e=A(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function ot(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function st(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=st(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=st(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=st(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=st(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function L(e,t,n){if(Array.isArray(e))return e.map((e,t)=>L(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!$e(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var ct=class{constructor(e){Object.defineProperty(this,k,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Xe(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=L(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?st(i,{"":o},``,o):o}},lt=class extends ct{constructor(e){super(Ge),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],nt(e,{Node:(e,t)=>{(A(t)||$e(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(L(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=ut(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(ot(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function ut(e,t,n){if(A(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(N(t)){let r=0;for(let i of t.items){let t=ut(e,i,n);t>r&&(r=t)}return r}if(j(t)){let r=ut(e,t.key,n),i=ut(e,t.value,n);return Math.max(r,i)}return 1}var dt=e=>!e||typeof e!=`function`&&typeof e!=`object`,R=class extends ct{constructor(e){super(Je),this.value=e}toJSON(e,t){return t?.keep?this.value:L(this.value,e,t)}toString(){return String(this.value)}};R.BLOCK_FOLDED=`BLOCK_FOLDED`,R.BLOCK_LITERAL=`BLOCK_LITERAL`,R.PLAIN=`PLAIN`,R.QUOTE_DOUBLE=`QUOTE_DOUBLE`,R.QUOTE_SINGLE=`QUOTE_SINGLE`;var ft=`tag:yaml.org,2002:`;function pt(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function mt(e,t,n){if(Xe(e)&&(e=e.contents),P(e))return e;if(j(e)){let t=n.schema[O].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new lt(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=ft+t.slice(2));let l=pt(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new R(e);return c&&(c.node=t),t}l=e instanceof Map?o[O]:Symbol.iterator in Object(e)?o[Ye]:o[O]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new R(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function ht(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return mt(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var gt=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,_t=class extends ct{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>P(t)||j(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(gt(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(N(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,ht(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(N(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&M(i)?i.value:i:N(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!j(t))return!1;let n=t.value;return n==null||e&&M(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return N(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(N(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,ht(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},vt=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function yt(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var z=(e,t,n)=>e.endsWith(`
|
|
2
|
+
import{n as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{t as n}from"./preload-helper-Czpn1I53.js";import{a as r,c as i,l as a,o,s}from"./claude-model-version-DoVrYsKi.js";import"./libesm-BI4UHVqp.js";import{t as c}from"./logger-DDBAeTLF.js";import"./src-CAWTvdAa.js";import"./proxied-fetch-BGeNrvQ4.js";import{i as l,t as u}from"./api-endpoint-GRCyib6X.js";import{n as d}from"./float-topology-DiK91BlA.js";import"./secret-topology-0AWfFTh5.js";import{t as f}from"./secrets-bridge-client-DCQ44RyR.js";import"./image-markers-BXtVm4og.js";import"./tool-ui-DfXu6quJ.js";import{n as p,o as m,t as h}from"./providers-BS5_Cp-0.js";import{n as g,t as _}from"./panel-rpc-B3MSVImO.js";import{r as v,t as y}from"./bedrock-camp-compat-CgBMwna8.js";var b={assign:0,create:0,clone:0,discard:0,update:0};function x(e){return Array.isArray(e)}function S(e){return w(e,null)}function C(e){return w(typeof e,`object`)&&!S(e)}function w(e,t){return e===t}function ee(e){if(!C(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!S(t)&&w(typeof t.constructor,`function`)&&!(w(t.constructor,globalThis.Object)||w(t.constructor.name,`Object`))}function te(e){return w(e,`__proto__`)||w(e,`constructor`)||w(e,`prototype`)}function ne(e,t){return te(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function re(e){return Object.getOwnPropertyNames(e)}function ie(e){return Object.getOwnPropertySymbols(e)}function T(e){return globalThis.ArrayBuffer.isView(e)}function ae(e){return e instanceof globalThis.RegExp}function oe(e){return e instanceof globalThis.Set}function se(e){return e instanceof globalThis.Map}function ce(e){return e}function le(e){return ne(e,`~kind`)||ne(e,`~unsafe`)}function ue(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let e of Object.keys(n)){if(te(e))continue;let r=n[e];ne(r,`value`)&&Object.defineProperty(t,e,{...r,value:E(r.value)})}return t}function de(e){let t={};for(let n of re(e))te(n)||(t[n]=E(e[n]));for(let n of ie(e))t[n]=E(e[n]);return t}function fe(e){return ee(e)?ce(e):le(e)?ue(e):de(e)}function pe(e){return e.map(e=>E(e))}function me(e){return e.slice()}function he(e){return new RegExp(e.source,e.flags)}function ge(e){return new Map(E([...e.entries()]))}function _e(e){return new Set(E([...e.values()]))}function E(e){return T(e)?me(e):ae(e)?he(e):se(e)?ge(e):oe(e)?_e(e):x(e)?pe(e):C(e)?fe(e):e}function ve(e){return b.clone+=1,E(e)}var ye={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function be(){return ye}function xe(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function Se(e,t){return{...e,...t}}function Ce(e,t,n={}){b.create+=1;let r=be(),i=Se(t,n),a=r.enumerableKind?Se(i,e):xe(i,e);return r.immutableTypes?Object.freeze(a):a}function we(e,t,n){b.update+=1;let r=be(),i=ve(e);for(let e of Object.keys(t))Object.defineProperty(i,e,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[e]});for(let e of Object.keys(n))Object.defineProperty(i,e,{configurable:!0,enumerable:!0,writable:!0,value:n[e]});return i}function Te(e){return C(e)}function Ee(e){return we(e,{"~optional":!0},{})}function De(e,t){return we(Ee(e),{},t)}function Oe(e,t){return Ce({"~kind":`Array`},{type:`array`,items:e},t)}function ke(e,t={}){return De(e,t)}function Ae(e){return ke(e)}function je(e){return Te(e)&&ne(e,`~optional`)}function Me(e){return re(e).filter(t=>!je(e[t]))}function Ne(e,t={}){let n=Me(e);return Ce({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}var Pe;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(Pe||={}),Array.from({length:256}).map((e,t)=>BigInt(t));var Fe=new Float64Array(1);new DataView(Fe.buffer),new Uint8Array(Fe.buffer),new TextEncoder;var Ie=`-?(?:0|[1-9][0-9]*)`,Le=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function Re(e){return Ce({"~kind":`Number`},{type:`number`},e)}function D(e){return Ce({"~kind":`String`},{type:`string`},e)}var ze=`^${Ie}$`;`${Le}`;function Be(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}var Ve=[...Be(97,122),...Be(65,90)],He=[`0`,...Be(49,57)];[...He],[...Ve,...He],[...He],new RegExp(ze);function Ue(e,t){try{return Promise.resolve(t(We))}catch(e){return Promise.reject(e)}}var We={startSpan:Ue,addEvent:()=>{},setAttributes:()=>{},setStatus:()=>{}};Object.freeze(We);var Ge=Symbol.for(`yaml.alias`),Ke=Symbol.for(`yaml.document`),O=Symbol.for(`yaml.map`),qe=Symbol.for(`yaml.pair`),Je=Symbol.for(`yaml.scalar`),Ye=Symbol.for(`yaml.seq`),k=Symbol.for(`yaml.node.type`),A=e=>!!e&&typeof e==`object`&&e[k]===Ge,Xe=e=>!!e&&typeof e==`object`&&e[k]===Ke,Ze=e=>!!e&&typeof e==`object`&&e[k]===O,j=e=>!!e&&typeof e==`object`&&e[k]===qe,M=e=>!!e&&typeof e==`object`&&e[k]===Je,Qe=e=>!!e&&typeof e==`object`&&e[k]===Ye;function N(e){if(e&&typeof e==`object`)switch(e[k]){case O:case Ye:return!0}return!1}function P(e){if(e&&typeof e==`object`)switch(e[k]){case Ge:case O:case Je:case Ye:return!0}return!1}var $e=e=>(M(e)||N(e))&&!!e.anchor,F=Symbol(`break visit`),et=Symbol(`skip children`),tt=Symbol(`remove node`);function nt(e,t){let n=rt(t);Xe(e)?I(null,e.contents,n,Object.freeze([e]))===tt&&(e.contents=null):I(null,e,n,Object.freeze([]))}nt.BREAK=F,nt.SKIP=et,nt.REMOVE=tt;function I(e,t,n,r){let i=it(e,t,n,r);if(P(i)||j(i))return at(e,r,i),I(e,i,n,r);if(typeof i!=`symbol`){if(N(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=I(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===F)return F;else i===tt&&(t.items.splice(e,1),--e)}}else if(j(t)){r=Object.freeze(r.concat(t));let e=I(`key`,t.key,n,r);if(e===F)return F;e===tt&&(t.key=null);let i=I(`value`,t.value,n,r);if(i===F)return F;i===tt&&(t.value=null)}}return i}function rt(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function it(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Ze(t))return n.Map?.(e,t,r);if(Qe(t))return n.Seq?.(e,t,r);if(j(t))return n.Pair?.(e,t,r);if(M(t))return n.Scalar?.(e,t,r);if(A(t))return n.Alias?.(e,t,r)}function at(e,t,n){let r=t[t.length-1];if(N(r))r.items[e]=n;else if(j(r))e===`key`?r.key=n:r.value=n;else if(Xe(r))r.contents=n;else{let e=A(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function ot(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function st(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=st(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=st(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=st(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=st(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function L(e,t,n){if(Array.isArray(e))return e.map((e,t)=>L(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!$e(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var ct=class{constructor(e){Object.defineProperty(this,k,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Xe(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=L(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?st(i,{"":o},``,o):o}},lt=class extends ct{constructor(e){super(Ge),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],nt(e,{Node:(e,t)=>{(A(t)||$e(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(L(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=ut(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(ot(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function ut(e,t,n){if(A(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(N(t)){let r=0;for(let i of t.items){let t=ut(e,i,n);t>r&&(r=t)}return r}if(j(t)){let r=ut(e,t.key,n),i=ut(e,t.value,n);return Math.max(r,i)}return 1}var dt=e=>!e||typeof e!=`function`&&typeof e!=`object`,R=class extends ct{constructor(e){super(Je),this.value=e}toJSON(e,t){return t?.keep?this.value:L(this.value,e,t)}toString(){return String(this.value)}};R.BLOCK_FOLDED=`BLOCK_FOLDED`,R.BLOCK_LITERAL=`BLOCK_LITERAL`,R.PLAIN=`PLAIN`,R.QUOTE_DOUBLE=`QUOTE_DOUBLE`,R.QUOTE_SINGLE=`QUOTE_SINGLE`;var ft=`tag:yaml.org,2002:`;function pt(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function mt(e,t,n){if(Xe(e)&&(e=e.contents),P(e))return e;if(j(e)){let t=n.schema[O].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new lt(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=ft+t.slice(2));let l=pt(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new R(e);return c&&(c.node=t),t}l=e instanceof Map?o[O]:Symbol.iterator in Object(e)?o[Ye]:o[O]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new R(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function ht(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return mt(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var gt=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,_t=class extends ct{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>P(t)||j(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(gt(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(N(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,ht(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(N(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&M(i)?i.value:i:N(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!j(t))return!1;let n=t.value;return n==null||e&&M(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return N(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(N(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,ht(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},vt=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function yt(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var z=(e,t,n)=>e.endsWith(`
|
|
3
3
|
`)?yt(n,t):n.includes(`
|
|
4
4
|
`)?`
|
|
5
5
|
`+yt(n,t):(e.endsWith(` `)?``:` `)+n,bt=`flow`,xt=`block`,St=`quoted`;function Ct(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=wt(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{t as n}from"./logger-LESFN7Hj.js";import{n as r,r as i}from"./panel-rpc-BPwAqRch.js";import{n as a,o,t as s}from"./providers-DdfpdKUf.js";import{a as c,o as l}from"./proxied-fetch-Co-pb0x0.js";import"./src-CcFD5QfS.js";import{t as u}from"./runtime-env-DadgceZk.js";import{i as d,n as f,t as p}from"./api-endpoint-C00IT5T9.js";import{a as m,c as h,l as g,o as ee,s as _}from"./claude-model-version-Csn7RPVg.js";import"./libesm-zfj8k-QN.js";import"./runtime-env-Dtj99aNH.js";import{t as te}from"./port-bridge-client-Bz2N1tvn.js";import{r as ne,t as re}from"./image-markers-CdcIBWOf.js";import{o as ie,s as ae}from"./tool-ui-DRnUkp2g.js";import{r as oe,t as se}from"./bedrock-camp-compat-CYnC9BQI.js";const ce=`slicc_oauth_extra_domains`;function le(e){try{let t=e.getItem(ce);if(!t)return{};let n=JSON.parse(t);if(typeof n!=`object`||!n||Array.isArray(n))return{};let r={};for(let[e,t]of Object.entries(n)){if(typeof e!=`string`||!Array.isArray(t))continue;let n=t.filter(e=>typeof e==`string`&&e.length>0);n.length>0&&(r[e]=n)}return r}catch{return{}}}function ue(e,t){try{e.setItem(ce,JSON.stringify(t))}catch(e){throw Error(`Failed to persist OAuth extras (localStorage quota exceeded?): ${e instanceof Error?e.message:String(e)}`)}}const de={assign:0,create:0,clone:0,discard:0,update:0};function v(e,t){return de.assign+=1,{...e,...t}}function fe(e,t,n){return e>=t&&e<=n}function pe(e){return e===8205}function me(e){return fe(e,55296,56319)}function he(e){return fe(e,127462,127487)}function ge(e){return fe(e,65024,65039)}function _e(e){return fe(e,768,879)||fe(e,6832,6911)||fe(e,7616,7679)||fe(e,65056,65071)}function ve(e){return e>65535?2:1}function ye(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(_e(n)||ge(n))t+=ve(n);else break}return t}function be(e,t){let n=e.codePointAt(t),r=t+ve(n);for(r=ye(e,r);r<e.length-1&&e[r]===``;){let t=e.codePointAt(r+1);r+=1+ve(t),r=ye(e,r)}return he(n)&&r<e.length&&he(e.codePointAt(r))&&(r+=ve(e.codePointAt(r))),r}function xe(e){return me(e)||_e(e)||ge(e)||pe(e)}function Se(e){let t=0,n=0;for(;n<e.length;)n=be(e,n),t++;return t}function Ce(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=be(e,r),n++,n>=t)return!0;return!1}function we(e,t){let n=0,r=0;for(;r<e.length;)if(r=be(e,r),n++,n>t)return!1;return!0}function Te(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(xe(e.charCodeAt(n)))return Ce(e,t);if(n++,n>=t)return!0}return!1}function Ee(e,t){let n=0;for(;n<e.length;){if(xe(e.charCodeAt(n)))return we(e,t);if(n++,n>t)return!1}return!0}var De=e({Entries:()=>et,EntriesRegExp:()=>$e,Every:()=>Xe,EveryAll:()=>Ze,GraphemeCount:()=>qe,HasPropertyKey:()=>S,IsArray:()=>Oe,IsBigInt:()=>ke,IsBoolean:()=>Ae,IsClassInstance:()=>Ge,IsConstructor:()=>je,IsDeepEqual:()=>at,IsEqual:()=>b,IsFunction:()=>Me,IsGreaterEqualThan:()=>Ue,IsGreaterThan:()=>Be,IsInteger:()=>Ne,IsLessEqualThan:()=>He,IsLessThan:()=>Ve,IsMaxLength:()=>Je,IsMinLength:()=>Ye,IsMultipleOf:()=>We,IsNull:()=>Pe,IsNumber:()=>Fe,IsObject:()=>y,IsObjectNotArray:()=>Ie,IsString:()=>Le,IsSymbol:()=>Re,IsUndefined:()=>ze,IsUnsafePropertyKey:()=>Qe,IsValueLike:()=>Ke,Keys:()=>C,ShiftLeft:()=>x,Symbols:()=>tt,Values:()=>nt});function Oe(e){return Array.isArray(e)}function ke(e){return b(typeof e,`bigint`)}function Ae(e){return b(typeof e,`boolean`)}function je(e){if(ze(e)||!Me(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Me(e){return b(typeof e,`function`)}function Ne(e){return Number.isInteger(e)}function Pe(e){return b(e,null)}function Fe(e){return Number.isFinite(e)}function Ie(e){return y(e)&&!Oe(e)}function y(e){return b(typeof e,`object`)&&!Pe(e)}function Le(e){return b(typeof e,`string`)}function Re(e){return b(typeof e,`symbol`)}function ze(e){return b(e,void 0)}function b(e,t){return e===t}function Be(e,t){return e>t}function Ve(e,t){return e<t}function He(e,t){return e<=t}function Ue(e,t){return e>=t}function We(e,t){if(ke(e)||ke(t))return BigInt(e)%BigInt(t)===0n;if(!Fe(e)||Ne(e)&&1/t%1==0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t),Math.abs(n+t))<1e-10}function Ge(e){if(!y(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!Pe(t)&&b(typeof t.constructor,`function`)&&!(b(t.constructor,globalThis.Object)||b(t.constructor.name,`Object`))}function Ke(e){return ke(e)||Ae(e)||Pe(e)||Fe(e)||Le(e)||ze(e)}function qe(e){return Se(e)}function Je(e,t){return Ee(e,t)}function Ye(e,t){return Te(e,t)}function Xe(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function Ze(e,t,n){let r=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(r=!1);return r}function x(e,t,n){return b(e.length,0)?n():t(e[0],e.slice(1))}function Qe(e){return b(e,`__proto__`)||b(e,`constructor`)||b(e,`prototype`)}function S(e,t){return Qe(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function $e(e){return C(e).map(t=>[RegExp(`^${t}$`),e[t]])}function et(e){return Object.entries(e)}function C(e){return Object.getOwnPropertyNames(e)}function tt(e){return Object.getOwnPropertySymbols(e)}function nt(e){return Object.values(e)}function rt(e,t){if(!y(t))return!1;let n=C(e);return b(n.length,C(t).length)&&n.every(n=>at(e[n],t[n]))}function it(e,t){return Oe(t)&&b(e.length,t.length)&&e.every((n,r)=>at(e[r],t[r]))}function at(e,t){return Oe(e)?it(e,t):y(e)?rt(e,t):b(e,t)}function ot(e){return e instanceof Boolean}function st(e){return e instanceof Number}function ct(e){return e instanceof String}function lt(e){return globalThis.ArrayBuffer.isView(e)}function ut(e){return e instanceof globalThis.RegExp}function dt(e){return e instanceof globalThis.Date}function ft(e){return e instanceof globalThis.Set}function pt(e){return e instanceof globalThis.Map}function mt(e){return e}function ht(e){return S(e,`~kind`)||S(e,`~unsafe`)}function gt(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let e of Object.keys(n)){if(Qe(e))continue;let r=n[e];S(r,`value`)&&Object.defineProperty(t,e,{...r,value:wt(r.value)})}return t}function _t(e){let t={};for(let n of C(e))Qe(n)||(t[n]=wt(e[n]));for(let n of tt(e))t[n]=wt(e[n]);return t}function vt(e){return Ge(e)?mt(e):ht(e)?gt(e):_t(e)}function yt(e){return e.map(e=>wt(e))}function bt(e){return e.slice()}function xt(e){return new RegExp(e.source,e.flags)}function St(e){return new Map(wt([...e.entries()]))}function Ct(e){return new Set(wt([...e.values()]))}function wt(e){return lt(e)?bt(e):ut(e)?xt(e):pt(e)?St(e):ft(e)?Ct(e):Oe(e)?yt(e):y(e)?vt(e):e}function Tt(e){return de.clone+=1,wt(e)}const Et={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Dt(){return Et}function Ot(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function kt(e,t){return{...e,...t}}function w(e,t,n={}){de.create+=1;let r=Dt(),i=kt(t,n),a=r.enumerableKind?kt(i,e):Ot(i,e);return r.immutableTypes?Object.freeze(a):a}function At(e,t){de.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(Tt(e)),i=new Set(t);for(let e of Object.keys(r))i.has(e)||Object.defineProperty(n,e,r[e]);return n}function T(e,t,n){de.update+=1;let r=Dt(),i=Tt(e);for(let e of Object.keys(t))Object.defineProperty(i,e,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[e]});for(let e of Object.keys(n))Object.defineProperty(i,e,{configurable:!0,enumerable:!0,writable:!0,value:n[e]});return i}function E(e,t){return y(e)&&S(e,`~kind`)&&b(e[`~kind`],t)}function jt(e){return y(e)}function D(e,t,n){return w({"~kind":`Deferred`},{type:`deferred`,action:e,parameters:t,options:n},{})}function Mt(e){return E(e,`Deferred`)}function Nt(e){return T(e,{"~readonly":!0},{})}function Pt(e,t){return T(Nt(e),{},t)}function Ft(e,t,n,r){return Pt(K(e,t,n),r)}function It(e){return T(e,{"~optional":!0},{})}function Lt(e,t){return T(It(e),{},t)}function Rt(e,t,n,r){return Lt(K(e,t,n),r)}function zt(e,t){return w({"~kind":`Array`},{type:`array`,items:e},t)}function Bt(e){return E(e,`Array`)}function Vt(e){return At(e,[`~kind`,`type`,`items`])}function Ht(e,t,n={}){return w({"~kind":`Constructor`},{type:`constructor`,parameters:e,instanceType:t},n)}function Ut(e){return E(e,`Constructor`)}function Wt(e){return At(e,[`~kind`,`type`,`parameters`,`instanceType`])}function Gt(e,t,n={}){return w({"~kind":`Function`},{type:`function`,parameters:e,returnType:t},n)}function Kt(e){return E(e,`Function`)}function qt(e){return At(e,[`~kind`,`type`,`parameters`,`returnType`])}function Jt(e,t){return w({"~kind":`Ref`},{$ref:e},t)}function Yt(e){return E(e,`Ref`)}function Xt(e,t){return w({"~kind":`Generic`},{type:`generic`,parameters:e,expression:t})}function Zt(e){return E(e,`Generic`)}function Qt(e){return w({"~kind":`Any`},{},e)}function $t(e){return E(e,`Any`)}function O(e){return w({"~kind":`Never`},{not:{}},e)}function en(e){return E(e,`Never`)}function tn(e,t={}){return Lt(e,t)}function nn(e){return tn(e)}function rn(e){return jt(e)&&S(e,`~optional`)}function an(e){return C(e).filter(t=>!rn(e[t]))}function on(e){return C(e)}function sn(e){return nt(e)}function k(e,t={}){let n=an(e);return w({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}function A(e){return E(e,`Object`)}function cn(e){return At(e,[`~kind`,`type`,`properties`,`required`])}function ln(e){return w({"~kind":`Unknown`},{},e)}function un(e){return E(e,`Unknown`)}function dn(e,t,n){return w({"~kind":`Cyclic`},{$defs:C(e).reduce((t,n)=>({...t,[n]:T(e[n],{},{$id:n})}),{}),$ref:t},n)}function fn(e){return E(e,`Cyclic`)}function pn(e){return Ie(e)&&S(e,`~unsafe`)&&Pe(e[`~unsafe`])}function mn(e){return E(e,`Infer`)}function hn(e,t,n,r={}){return w({"~kind":`Dependent`},{if:e,then:t,else:n},r)}function gn(e){return E(e,`Dependent`)}function _n(e){return At(e,[`~kind`,`if`,`then`,`else`])}function vn(e){return E(e,`Enum`)}function yn(e,t={}){return w({"~kind":`Intersect`},{allOf:e},t)}function j(e){return E(e,`Intersect`)}function bn(e){return At(e,[`~kind`,`allOf`])}function xn(){throw Error(`Unreachable`)}var Sn=e({Hash:()=>Yn,HashCode:()=>Jn});function Cn(e){let t=new Set,n=e;for(;n&&n!==Object.prototype;){for(let e of Reflect.ownKeys(n))e!==`constructor`&&typeof e!=`symbol`&&t.add(e);n=Object.getPrototypeOf(n)}return[...t]}function wn(e){return typeof e==`number`}var M;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(M||={});let Tn=BigInt(`14695981039346656037`);const[En,Dn]=[BigInt(`1099511628211`),BigInt(`18446744073709551616`)],On=Array.from({length:256}).map((e,t)=>BigInt(t)),kn=new Float64Array(1),An=new DataView(kn.buffer),jn=new Uint8Array(kn.buffer);function N(e){Tn^=On[e],Tn=Tn*En%Dn}function Mn(e){N(M.Array);for(let t of e)qn(t)}function Nn(e){N(M.BigInt),An.setBigInt64(0,e);for(let e of jn)N(e)}function Pn(e){N(M.Boolean),N(+!!e)}function Fn(e){N(M.Constructor),qn(e.toString())}function In(e){N(M.Date),qn(e.getTime())}function Ln(e){N(M.Function),qn(e.toString())}function Rn(e){N(M.Null)}function zn(e){N(M.Number),An.setFloat64(0,e,!0);for(let e of jn)N(e)}function Bn(e){N(M.Object);for(let t of Cn(e).sort())qn(t),qn(e[t])}function Vn(e){N(M.RegExp),Un(e.toString())}const Hn=new TextEncoder;function Un(e){N(M.String);for(let t of Hn.encode(e))N(t)}function Wn(e){N(M.Symbol),qn(e.toString())}function Gn(e){N(M.TypeArray);let t=new Uint8Array(e.buffer);for(let e=0;e<t.length;e++)N(t[e])}function Kn(e){return N(M.Undefined)}function qn(e){return lt(e)?Gn(e):dt(e)?In(e):ut(e)?Vn(e):ot(e)?Pn(e.valueOf()):ct(e)?Un(e.valueOf()):st(e)?zn(e.valueOf()):wn(e)?zn(e):Oe(e)?Mn(e):Ae(e)?Pn(e):ke(e)?Nn(e):je(e)?Fn(e):Pe(e)?Rn(e):y(e)?Bn(e):Le(e)?Un(e):Re(e)?Wn(e):ze(e)?Kn(e):Me(e)?Ln(e):xn()}function Jn(e){return Tn=BigInt(`14695981039346656037`),qn(e),Tn}function Yn(e){return Jn(e).toString(16).padStart(16,`0`)}function Xn(e){return jt(e)&&S(e,`~codec`)&&y(e[`~codec`])&&S(e[`~codec`],`encode`)&&S(e[`~codec`],`decode`)}function Zn(e){return jt(e)&&S(e,`~immutable`)}function Qn(e,t={}){return Pt(e,t)}function $n(e){return jt(e)&&S(e,`~readonly`)}function er(e){return w({"~kind":`BigInt`},{type:`bigint`},e)}function tr(e){return E(e,`BigInt`)}function nr(e){return E(e,`Boolean`)}const rr=`-?(?:0|[1-9][0-9]*)`;function ir(e){return w({"~kind":`Integer`},{type:`integer`},e)}function ar(e){return E(e,`Integer`)}var or=class extends Error{constructor(e){super(`Invalid Literal value`),Object.defineProperty(this,"cause",{value:{value:e},writable:!1,configurable:!1,enumerable:!1})}};function sr(e){return ke(e)?`bigint`:Ae(e)?`boolean`:Fe(e)?`number`:Le(e)?`string`:(()=>{throw new or(e)})()}function P(e,t){return w({"~kind":`Literal`},{type:sr(e),const:e},t)}function cr(e){return ke(e)||Ae(e)||Fe(e)||Le(e)}function lr(e){return F(e)&&ke(e.const)}function ur(e){return F(e)&&Ae(e.const)}function dr(e){return F(e)&&Fe(e.const)}function fr(e){return F(e)&&Le(e.const)}function F(e){return E(e,`Literal`)}function pr(e){return w({"~kind":`Null`},{type:`null`},e)}function mr(e){return E(e,`Null`)}const hr=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function gr(e){return w({"~kind":`Number`},{type:`number`},e)}function _r(e){return E(e,`Number`)}function vr(e){return w({"~kind":`Symbol`},{type:`symbol`},e)}function yr(e){return E(e,`Symbol`)}function br(e){return w({"~kind":`String`},{type:`string`},e)}function xr(e){return E(e,`String`)}function I(e,t={}){return w({"~kind":`Union`},{anyOf:e},t)}function L(e){return E(e,`Union`)}function Sr(e){return At(e,[`~kind`,`anyOf`])}function Cr(e){let t=Ka(e);return b(t.length,2)?t[0]:[]}function wr(e){return!0}function Tr(e){return x(e,(e,t)=>Dr(e)?Tr(t):!1,()=>!0)}function Er(e){return!b(e.length,0)&&Tr(e)}function Dr(e){return L(e)?Er(e.anyOf):F(e)?wr(e.const):!1}function Or(e){return Er(e)}function kr(e){return w({"~kind":`TemplateLiteral`},{type:`string`,pattern:e},{})}function Ar(e,t,n=[]){return x(e,(e,r)=>Ar(r,t,[...n,`${e}${t}`]),()=>n)}function jr(e,t){return b(e.length,0)?[`${t}`]:Ar(e,t)}function Mr(e,t,n=[]){return x(t,(t,r)=>Mr(e,r,[...n,...Nr(e,t)]),()=>n)}function Nr(e,t){return L(t)?Mr(e,t.anyOf):F(t)?jr(e,t.const):xn()}function Pr(e,t){return x(t,(t,n)=>Pr(Nr(e,t),n),()=>e)}function Fr(e){return e.map(e=>P(e))}function Ir(e){return I(Fr(Pr([],e)))}function Lr(e){return b(e.length,0)?xn():b(e.length,1)&&F(e[0])?e[0]:Ir(e)}function Rr(e){let t=Cr(e);return b(t.length,0)?br():Or(t)?Lr(t):kr(e)}function zr(e){let t=Rr(e);return mo(t)?br():t}function Br(e,t){return w({"~kind":`Record`},{type:`object`,patternProperties:{[e]:t}})}function Vr(e){return Br(Wi,e)}function Hr(e){return k({true:e,false:e})}function Ur(e,t={}){let[n,r,i]=[e,e.length,!1];return w({"~kind":`Tuple`},{type:`array`,additionalItems:i,items:n,minItems:r},t)}function R(e){return E(e,`Tuple`)}function Wr(e){return At(e,[`~kind`,`type`,`items`,`minItems`,`additionalItems`])}function Gr(e){return At(e,[`~readonly`])}function Kr(e,t){return T(Gr(e),{},t)}function qr(e,t,n,r){return Kr(K(e,t,n),r)}function Jr(e,t={}){return Kr(e,t)}function Yr(e){return At(e,[`~optional`])}function Xr(e,t){return T(Yr(e),{},t)}function Zr(e,t,n,r){return Xr(K(e,t,n),r)}function Qr(e,t={}){return Xr(e,t)}function $r(e){return e.reduceRight((e,t,n)=>({[n]:t,...e}),{})}function ei(e){return k($r(e.items))}function ti(e,t){return $n(e)?!!$n(t):!1}function ni(e,t){return rn(e)?!!rn(t):!1}function ri(e,t){let n=ti(e,t),r=ni(e,t),i=Jr(Qr(bi([e,t])));return n&&r?Qn(tn(i)):n&&!r?Qn(i):!n&&r?tn(i):i}function ii(e,t,n){return n in e?n in t?ri(e[n],t[n]):e[n]:n in t?t[n]:O()}function ai(e,t){return[...new Set([...C(t),...C(e)])].reduce((n,r)=>({...n,[r]:ii(e,t,r)}),{})}function oi(e){return A(e)?e.properties:R(e)?$r(e.items):xn()}function si(e,t){return k(ai(oi(e),oi(t)))}function ci(e,t){let n=pc(e,t);return b(n,`left-inside`)?e:b(n,`right-inside`)||b(n,`equal`)?t:O()}function li(e){return A(e)||R(e)}function ui(e,t){let n=L(e),r=L(t);return n||r}function di(e,t){let n=Ci(e),r=Ci(t),i=ui(n,r),a=li(n),o=li(r);return i?bi([n,r]):a&&o?si(n,r):a&&!o?n:!a&&o?r:ci(n,r)}function fi(e,t,n=[]){return x(t,(t,r)=>fi(e,r,[...n,di(e,t)]),()=>b(n.length,0)?[e]:n)}function pi(e,t,n=[]){return x(e,(e,r)=>pi(r,t,[...n,...mi([e],t)]),()=>n)}function mi(e,t=[]){return x(e,(e,n)=>L(e)?mi(n,pi(e.anyOf,t)):mi(n,fi(e,t)),()=>t)}function hi(e,t){return yo(fc({},e,t))?[]:[e]}function gi(e,t){return e.reduce((e,n)=>[...e,...hi(n,t)],[])}function _i(e,t){let n=Ci(e);return Si(gi(L(n)?n.anyOf:[n],t))}function vi(e,t,n){return Si([yn([e,t]),_i(n,e)])}function yi(e){return Si(e.map(e=>P(e)))}function bi(e){return wi(vc(mi(e)))}function xi(e){return Ci(zr(e))}function Si(e){return wi(vc(e))}function Ci(e){return gn(e)?vi(e.if,e.then,e.else):vn(e)?yi(e.enum):j(e)?bi(e.allOf):mo(e)?xi(e.pattern):L(e)?Si(e.anyOf):e}function wi(e){return b(e.length,1)?e[0]:b(e.length,0)?O():I(e)}function Ti(e,t){return zi(yi(e),t)}function Ei(e,t){return Br(Hi,t)}function Di(e,t){return zi(bi(e),t)}function Oi(e,t){return Le(e)||Fe(e)?k({[e]:t}):b(e,!1)?k({false:t}):b(e,!0)?k({true:t}):k({})}function ki(e,t){return Br(Ui,t)}function Ai(e,t){return S(e,`pattern`)&&(Le(e.pattern)||e.pattern instanceof RegExp)?Br(e.pattern.toString(),t):Br(Wi,t)}function ji(e,t){return Or(Cr(e))?zi(xi(e),t):Br(e,t)}function Mi(e){return L(e)?Ni(e.anyOf):[e]}function Ni(e){return e.reduce((e,t)=>[...e,...Mi(t)],[])}function Pi(e){return e.some(e=>xr(e)||_r(e)||ar(e))}function Fi(e,t){return b(Pi(e),!0)?Br(Wi,t):void 0}function Ii(e,t){return e.reduce((e,n)=>F(n)&&(Le(n.const)||Fe(n.const))?{...e,[n.const]:t}:e,{})}function Li(e,t){return k(Ii(e,t))}function Ri(e,t){let n=Ni(e),r=Fi(n,t);return jt(r)?r:Li(n,t)}function zi(e,t){return $t(e)?Vr(t):nr(e)?Hr(t):vn(e)?Ti(e.enum,t):ar(e)?Ei(e,t):j(e)?Di(e.allOf,t):F(e)?Oi(e.const,t):_r(e)?ki(e,t):L(e)?Ri(e.anyOf,t):xr(e)?Ai(e,t):mo(e)?ji(e.pattern,t):k({})}function Bi(e,t,n){return G([e])?T(zi(e,t),{},n):Gi(e,t,n)}function Vi(e,t,n,r,i){return Bi(K(e,t,n),K(e,t,r),i)}const Hi=`^${rr}$`,Ui=`^${hr}$`,Wi=`^.*$`;function Gi(e,t,n={}){return D(`Record`,[e,t],n)}function Ki(e,t,n={}){return Bi(e,t,n)}function qi(e,t){return Br(e,t)}function Ji(e){return b(e,Wi)?br():b(e,Hi)?ir():b(e,Ui)?gr():Rr(e)}function Yi(e){return C(e.patternProperties)[0]}function Xi(e){return Ji(Yi(e))}function Zi(e){return e.patternProperties[Yi(e)]}function Qi(e){return E(e,`Record`)}function $i(e){return w({"~kind":`Rest`},{type:`rest`,items:e},{})}function ea(e){return E(e,`Rest`)}function ta(e){return E(e,`This`)}function na(e){return w({"~kind":`Undefined`},{type:`undefined`},e)}function ra(e){return E(e,`Undefined`)}function ia(e){return E(e,`Void`)}function aa(e){return er()}function oa(e){return br()}function sa(e){return gr()}function ca(e){return ir()}function la(e){return O()}function ua(e){return P(e)}function da(e){return e}function fa(e){return I(e[1])}function pa(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function ma(e){return[e[0],...e[1]]}function ha(e){return e}function ga(e){return e[1]}function _a(e){return b(e.length,2)}function va(e,t,n){return _a(e)?t(e[0],e[1]):n()}function ya(e,t){return b(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function ba(e,t){for(let n=0;n<e.length;n++){let r=ya(e[n],t);if(_a(r))return r}return[]}function xa(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}const Sa=[...xa(97,122),...xa(65,90)],Ca=[`0`,...xa(49,57)];function wa(e){let t=e.indexOf(`*/`);return b(t,-1)?``:e.slice(t+2)}function Ta(e){let t=e.indexOf(`
|
|
1
|
+
import{n as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{t as n}from"./logger-LESFN7Hj.js";import{n as r,r as i}from"./panel-rpc-BPwAqRch.js";import{n as a,o,t as s}from"./providers-DRiRdLO1.js";import{a as c,o as l}from"./proxied-fetch-Co-pb0x0.js";import"./src-CcFD5QfS.js";import{t as u}from"./runtime-env-DadgceZk.js";import{i as d,n as f,t as p}from"./api-endpoint-C00IT5T9.js";import{a as m,c as h,l as g,o as ee,s as _}from"./claude-model-version-Csn7RPVg.js";import"./libesm-zfj8k-QN.js";import"./runtime-env-Dtj99aNH.js";import{t as te}from"./port-bridge-client-Bz2N1tvn.js";import{r as ne,t as re}from"./image-markers-CdcIBWOf.js";import{o as ie,s as ae}from"./tool-ui-DRnUkp2g.js";import{r as oe,t as se}from"./bedrock-camp-compat-CYnC9BQI.js";const ce=`slicc_oauth_extra_domains`;function le(e){try{let t=e.getItem(ce);if(!t)return{};let n=JSON.parse(t);if(typeof n!=`object`||!n||Array.isArray(n))return{};let r={};for(let[e,t]of Object.entries(n)){if(typeof e!=`string`||!Array.isArray(t))continue;let n=t.filter(e=>typeof e==`string`&&e.length>0);n.length>0&&(r[e]=n)}return r}catch{return{}}}function ue(e,t){try{e.setItem(ce,JSON.stringify(t))}catch(e){throw Error(`Failed to persist OAuth extras (localStorage quota exceeded?): ${e instanceof Error?e.message:String(e)}`)}}const de={assign:0,create:0,clone:0,discard:0,update:0};function v(e,t){return de.assign+=1,{...e,...t}}function fe(e,t,n){return e>=t&&e<=n}function pe(e){return e===8205}function me(e){return fe(e,55296,56319)}function he(e){return fe(e,127462,127487)}function ge(e){return fe(e,65024,65039)}function _e(e){return fe(e,768,879)||fe(e,6832,6911)||fe(e,7616,7679)||fe(e,65056,65071)}function ve(e){return e>65535?2:1}function ye(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(_e(n)||ge(n))t+=ve(n);else break}return t}function be(e,t){let n=e.codePointAt(t),r=t+ve(n);for(r=ye(e,r);r<e.length-1&&e[r]===``;){let t=e.codePointAt(r+1);r+=1+ve(t),r=ye(e,r)}return he(n)&&r<e.length&&he(e.codePointAt(r))&&(r+=ve(e.codePointAt(r))),r}function xe(e){return me(e)||_e(e)||ge(e)||pe(e)}function Se(e){let t=0,n=0;for(;n<e.length;)n=be(e,n),t++;return t}function Ce(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=be(e,r),n++,n>=t)return!0;return!1}function we(e,t){let n=0,r=0;for(;r<e.length;)if(r=be(e,r),n++,n>t)return!1;return!0}function Te(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(xe(e.charCodeAt(n)))return Ce(e,t);if(n++,n>=t)return!0}return!1}function Ee(e,t){let n=0;for(;n<e.length;){if(xe(e.charCodeAt(n)))return we(e,t);if(n++,n>t)return!1}return!0}var De=e({Entries:()=>et,EntriesRegExp:()=>$e,Every:()=>Xe,EveryAll:()=>Ze,GraphemeCount:()=>qe,HasPropertyKey:()=>S,IsArray:()=>Oe,IsBigInt:()=>ke,IsBoolean:()=>Ae,IsClassInstance:()=>Ge,IsConstructor:()=>je,IsDeepEqual:()=>at,IsEqual:()=>b,IsFunction:()=>Me,IsGreaterEqualThan:()=>Ue,IsGreaterThan:()=>Be,IsInteger:()=>Ne,IsLessEqualThan:()=>He,IsLessThan:()=>Ve,IsMaxLength:()=>Je,IsMinLength:()=>Ye,IsMultipleOf:()=>We,IsNull:()=>Pe,IsNumber:()=>Fe,IsObject:()=>y,IsObjectNotArray:()=>Ie,IsString:()=>Le,IsSymbol:()=>Re,IsUndefined:()=>ze,IsUnsafePropertyKey:()=>Qe,IsValueLike:()=>Ke,Keys:()=>C,ShiftLeft:()=>x,Symbols:()=>tt,Values:()=>nt});function Oe(e){return Array.isArray(e)}function ke(e){return b(typeof e,`bigint`)}function Ae(e){return b(typeof e,`boolean`)}function je(e){if(ze(e)||!Me(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Me(e){return b(typeof e,`function`)}function Ne(e){return Number.isInteger(e)}function Pe(e){return b(e,null)}function Fe(e){return Number.isFinite(e)}function Ie(e){return y(e)&&!Oe(e)}function y(e){return b(typeof e,`object`)&&!Pe(e)}function Le(e){return b(typeof e,`string`)}function Re(e){return b(typeof e,`symbol`)}function ze(e){return b(e,void 0)}function b(e,t){return e===t}function Be(e,t){return e>t}function Ve(e,t){return e<t}function He(e,t){return e<=t}function Ue(e,t){return e>=t}function We(e,t){if(ke(e)||ke(t))return BigInt(e)%BigInt(t)===0n;if(!Fe(e)||Ne(e)&&1/t%1==0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t),Math.abs(n+t))<1e-10}function Ge(e){if(!y(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!Pe(t)&&b(typeof t.constructor,`function`)&&!(b(t.constructor,globalThis.Object)||b(t.constructor.name,`Object`))}function Ke(e){return ke(e)||Ae(e)||Pe(e)||Fe(e)||Le(e)||ze(e)}function qe(e){return Se(e)}function Je(e,t){return Ee(e,t)}function Ye(e,t){return Te(e,t)}function Xe(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function Ze(e,t,n){let r=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(r=!1);return r}function x(e,t,n){return b(e.length,0)?n():t(e[0],e.slice(1))}function Qe(e){return b(e,`__proto__`)||b(e,`constructor`)||b(e,`prototype`)}function S(e,t){return Qe(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function $e(e){return C(e).map(t=>[RegExp(`^${t}$`),e[t]])}function et(e){return Object.entries(e)}function C(e){return Object.getOwnPropertyNames(e)}function tt(e){return Object.getOwnPropertySymbols(e)}function nt(e){return Object.values(e)}function rt(e,t){if(!y(t))return!1;let n=C(e);return b(n.length,C(t).length)&&n.every(n=>at(e[n],t[n]))}function it(e,t){return Oe(t)&&b(e.length,t.length)&&e.every((n,r)=>at(e[r],t[r]))}function at(e,t){return Oe(e)?it(e,t):y(e)?rt(e,t):b(e,t)}function ot(e){return e instanceof Boolean}function st(e){return e instanceof Number}function ct(e){return e instanceof String}function lt(e){return globalThis.ArrayBuffer.isView(e)}function ut(e){return e instanceof globalThis.RegExp}function dt(e){return e instanceof globalThis.Date}function ft(e){return e instanceof globalThis.Set}function pt(e){return e instanceof globalThis.Map}function mt(e){return e}function ht(e){return S(e,`~kind`)||S(e,`~unsafe`)}function gt(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let e of Object.keys(n)){if(Qe(e))continue;let r=n[e];S(r,`value`)&&Object.defineProperty(t,e,{...r,value:wt(r.value)})}return t}function _t(e){let t={};for(let n of C(e))Qe(n)||(t[n]=wt(e[n]));for(let n of tt(e))t[n]=wt(e[n]);return t}function vt(e){return Ge(e)?mt(e):ht(e)?gt(e):_t(e)}function yt(e){return e.map(e=>wt(e))}function bt(e){return e.slice()}function xt(e){return new RegExp(e.source,e.flags)}function St(e){return new Map(wt([...e.entries()]))}function Ct(e){return new Set(wt([...e.values()]))}function wt(e){return lt(e)?bt(e):ut(e)?xt(e):pt(e)?St(e):ft(e)?Ct(e):Oe(e)?yt(e):y(e)?vt(e):e}function Tt(e){return de.clone+=1,wt(e)}const Et={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Dt(){return Et}function Ot(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function kt(e,t){return{...e,...t}}function w(e,t,n={}){de.create+=1;let r=Dt(),i=kt(t,n),a=r.enumerableKind?kt(i,e):Ot(i,e);return r.immutableTypes?Object.freeze(a):a}function At(e,t){de.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(Tt(e)),i=new Set(t);for(let e of Object.keys(r))i.has(e)||Object.defineProperty(n,e,r[e]);return n}function T(e,t,n){de.update+=1;let r=Dt(),i=Tt(e);for(let e of Object.keys(t))Object.defineProperty(i,e,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[e]});for(let e of Object.keys(n))Object.defineProperty(i,e,{configurable:!0,enumerable:!0,writable:!0,value:n[e]});return i}function E(e,t){return y(e)&&S(e,`~kind`)&&b(e[`~kind`],t)}function jt(e){return y(e)}function D(e,t,n){return w({"~kind":`Deferred`},{type:`deferred`,action:e,parameters:t,options:n},{})}function Mt(e){return E(e,`Deferred`)}function Nt(e){return T(e,{"~readonly":!0},{})}function Pt(e,t){return T(Nt(e),{},t)}function Ft(e,t,n,r){return Pt(K(e,t,n),r)}function It(e){return T(e,{"~optional":!0},{})}function Lt(e,t){return T(It(e),{},t)}function Rt(e,t,n,r){return Lt(K(e,t,n),r)}function zt(e,t){return w({"~kind":`Array`},{type:`array`,items:e},t)}function Bt(e){return E(e,`Array`)}function Vt(e){return At(e,[`~kind`,`type`,`items`])}function Ht(e,t,n={}){return w({"~kind":`Constructor`},{type:`constructor`,parameters:e,instanceType:t},n)}function Ut(e){return E(e,`Constructor`)}function Wt(e){return At(e,[`~kind`,`type`,`parameters`,`instanceType`])}function Gt(e,t,n={}){return w({"~kind":`Function`},{type:`function`,parameters:e,returnType:t},n)}function Kt(e){return E(e,`Function`)}function qt(e){return At(e,[`~kind`,`type`,`parameters`,`returnType`])}function Jt(e,t){return w({"~kind":`Ref`},{$ref:e},t)}function Yt(e){return E(e,`Ref`)}function Xt(e,t){return w({"~kind":`Generic`},{type:`generic`,parameters:e,expression:t})}function Zt(e){return E(e,`Generic`)}function Qt(e){return w({"~kind":`Any`},{},e)}function $t(e){return E(e,`Any`)}function O(e){return w({"~kind":`Never`},{not:{}},e)}function en(e){return E(e,`Never`)}function tn(e,t={}){return Lt(e,t)}function nn(e){return tn(e)}function rn(e){return jt(e)&&S(e,`~optional`)}function an(e){return C(e).filter(t=>!rn(e[t]))}function on(e){return C(e)}function sn(e){return nt(e)}function k(e,t={}){let n=an(e);return w({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}function A(e){return E(e,`Object`)}function cn(e){return At(e,[`~kind`,`type`,`properties`,`required`])}function ln(e){return w({"~kind":`Unknown`},{},e)}function un(e){return E(e,`Unknown`)}function dn(e,t,n){return w({"~kind":`Cyclic`},{$defs:C(e).reduce((t,n)=>({...t,[n]:T(e[n],{},{$id:n})}),{}),$ref:t},n)}function fn(e){return E(e,`Cyclic`)}function pn(e){return Ie(e)&&S(e,`~unsafe`)&&Pe(e[`~unsafe`])}function mn(e){return E(e,`Infer`)}function hn(e,t,n,r={}){return w({"~kind":`Dependent`},{if:e,then:t,else:n},r)}function gn(e){return E(e,`Dependent`)}function _n(e){return At(e,[`~kind`,`if`,`then`,`else`])}function vn(e){return E(e,`Enum`)}function yn(e,t={}){return w({"~kind":`Intersect`},{allOf:e},t)}function j(e){return E(e,`Intersect`)}function bn(e){return At(e,[`~kind`,`allOf`])}function xn(){throw Error(`Unreachable`)}var Sn=e({Hash:()=>Yn,HashCode:()=>Jn});function Cn(e){let t=new Set,n=e;for(;n&&n!==Object.prototype;){for(let e of Reflect.ownKeys(n))e!==`constructor`&&typeof e!=`symbol`&&t.add(e);n=Object.getPrototypeOf(n)}return[...t]}function wn(e){return typeof e==`number`}var M;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(M||={});let Tn=BigInt(`14695981039346656037`);const[En,Dn]=[BigInt(`1099511628211`),BigInt(`18446744073709551616`)],On=Array.from({length:256}).map((e,t)=>BigInt(t)),kn=new Float64Array(1),An=new DataView(kn.buffer),jn=new Uint8Array(kn.buffer);function N(e){Tn^=On[e],Tn=Tn*En%Dn}function Mn(e){N(M.Array);for(let t of e)qn(t)}function Nn(e){N(M.BigInt),An.setBigInt64(0,e);for(let e of jn)N(e)}function Pn(e){N(M.Boolean),N(+!!e)}function Fn(e){N(M.Constructor),qn(e.toString())}function In(e){N(M.Date),qn(e.getTime())}function Ln(e){N(M.Function),qn(e.toString())}function Rn(e){N(M.Null)}function zn(e){N(M.Number),An.setFloat64(0,e,!0);for(let e of jn)N(e)}function Bn(e){N(M.Object);for(let t of Cn(e).sort())qn(t),qn(e[t])}function Vn(e){N(M.RegExp),Un(e.toString())}const Hn=new TextEncoder;function Un(e){N(M.String);for(let t of Hn.encode(e))N(t)}function Wn(e){N(M.Symbol),qn(e.toString())}function Gn(e){N(M.TypeArray);let t=new Uint8Array(e.buffer);for(let e=0;e<t.length;e++)N(t[e])}function Kn(e){return N(M.Undefined)}function qn(e){return lt(e)?Gn(e):dt(e)?In(e):ut(e)?Vn(e):ot(e)?Pn(e.valueOf()):ct(e)?Un(e.valueOf()):st(e)?zn(e.valueOf()):wn(e)?zn(e):Oe(e)?Mn(e):Ae(e)?Pn(e):ke(e)?Nn(e):je(e)?Fn(e):Pe(e)?Rn(e):y(e)?Bn(e):Le(e)?Un(e):Re(e)?Wn(e):ze(e)?Kn(e):Me(e)?Ln(e):xn()}function Jn(e){return Tn=BigInt(`14695981039346656037`),qn(e),Tn}function Yn(e){return Jn(e).toString(16).padStart(16,`0`)}function Xn(e){return jt(e)&&S(e,`~codec`)&&y(e[`~codec`])&&S(e[`~codec`],`encode`)&&S(e[`~codec`],`decode`)}function Zn(e){return jt(e)&&S(e,`~immutable`)}function Qn(e,t={}){return Pt(e,t)}function $n(e){return jt(e)&&S(e,`~readonly`)}function er(e){return w({"~kind":`BigInt`},{type:`bigint`},e)}function tr(e){return E(e,`BigInt`)}function nr(e){return E(e,`Boolean`)}const rr=`-?(?:0|[1-9][0-9]*)`;function ir(e){return w({"~kind":`Integer`},{type:`integer`},e)}function ar(e){return E(e,`Integer`)}var or=class extends Error{constructor(e){super(`Invalid Literal value`),Object.defineProperty(this,"cause",{value:{value:e},writable:!1,configurable:!1,enumerable:!1})}};function sr(e){return ke(e)?`bigint`:Ae(e)?`boolean`:Fe(e)?`number`:Le(e)?`string`:(()=>{throw new or(e)})()}function P(e,t){return w({"~kind":`Literal`},{type:sr(e),const:e},t)}function cr(e){return ke(e)||Ae(e)||Fe(e)||Le(e)}function lr(e){return F(e)&&ke(e.const)}function ur(e){return F(e)&&Ae(e.const)}function dr(e){return F(e)&&Fe(e.const)}function fr(e){return F(e)&&Le(e.const)}function F(e){return E(e,`Literal`)}function pr(e){return w({"~kind":`Null`},{type:`null`},e)}function mr(e){return E(e,`Null`)}const hr=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function gr(e){return w({"~kind":`Number`},{type:`number`},e)}function _r(e){return E(e,`Number`)}function vr(e){return w({"~kind":`Symbol`},{type:`symbol`},e)}function yr(e){return E(e,`Symbol`)}function br(e){return w({"~kind":`String`},{type:`string`},e)}function xr(e){return E(e,`String`)}function I(e,t={}){return w({"~kind":`Union`},{anyOf:e},t)}function L(e){return E(e,`Union`)}function Sr(e){return At(e,[`~kind`,`anyOf`])}function Cr(e){let t=Ka(e);return b(t.length,2)?t[0]:[]}function wr(e){return!0}function Tr(e){return x(e,(e,t)=>Dr(e)?Tr(t):!1,()=>!0)}function Er(e){return!b(e.length,0)&&Tr(e)}function Dr(e){return L(e)?Er(e.anyOf):F(e)?wr(e.const):!1}function Or(e){return Er(e)}function kr(e){return w({"~kind":`TemplateLiteral`},{type:`string`,pattern:e},{})}function Ar(e,t,n=[]){return x(e,(e,r)=>Ar(r,t,[...n,`${e}${t}`]),()=>n)}function jr(e,t){return b(e.length,0)?[`${t}`]:Ar(e,t)}function Mr(e,t,n=[]){return x(t,(t,r)=>Mr(e,r,[...n,...Nr(e,t)]),()=>n)}function Nr(e,t){return L(t)?Mr(e,t.anyOf):F(t)?jr(e,t.const):xn()}function Pr(e,t){return x(t,(t,n)=>Pr(Nr(e,t),n),()=>e)}function Fr(e){return e.map(e=>P(e))}function Ir(e){return I(Fr(Pr([],e)))}function Lr(e){return b(e.length,0)?xn():b(e.length,1)&&F(e[0])?e[0]:Ir(e)}function Rr(e){let t=Cr(e);return b(t.length,0)?br():Or(t)?Lr(t):kr(e)}function zr(e){let t=Rr(e);return mo(t)?br():t}function Br(e,t){return w({"~kind":`Record`},{type:`object`,patternProperties:{[e]:t}})}function Vr(e){return Br(Wi,e)}function Hr(e){return k({true:e,false:e})}function Ur(e,t={}){let[n,r,i]=[e,e.length,!1];return w({"~kind":`Tuple`},{type:`array`,additionalItems:i,items:n,minItems:r},t)}function R(e){return E(e,`Tuple`)}function Wr(e){return At(e,[`~kind`,`type`,`items`,`minItems`,`additionalItems`])}function Gr(e){return At(e,[`~readonly`])}function Kr(e,t){return T(Gr(e),{},t)}function qr(e,t,n,r){return Kr(K(e,t,n),r)}function Jr(e,t={}){return Kr(e,t)}function Yr(e){return At(e,[`~optional`])}function Xr(e,t){return T(Yr(e),{},t)}function Zr(e,t,n,r){return Xr(K(e,t,n),r)}function Qr(e,t={}){return Xr(e,t)}function $r(e){return e.reduceRight((e,t,n)=>({[n]:t,...e}),{})}function ei(e){return k($r(e.items))}function ti(e,t){return $n(e)?!!$n(t):!1}function ni(e,t){return rn(e)?!!rn(t):!1}function ri(e,t){let n=ti(e,t),r=ni(e,t),i=Jr(Qr(bi([e,t])));return n&&r?Qn(tn(i)):n&&!r?Qn(i):!n&&r?tn(i):i}function ii(e,t,n){return n in e?n in t?ri(e[n],t[n]):e[n]:n in t?t[n]:O()}function ai(e,t){return[...new Set([...C(t),...C(e)])].reduce((n,r)=>({...n,[r]:ii(e,t,r)}),{})}function oi(e){return A(e)?e.properties:R(e)?$r(e.items):xn()}function si(e,t){return k(ai(oi(e),oi(t)))}function ci(e,t){let n=pc(e,t);return b(n,`left-inside`)?e:b(n,`right-inside`)||b(n,`equal`)?t:O()}function li(e){return A(e)||R(e)}function ui(e,t){let n=L(e),r=L(t);return n||r}function di(e,t){let n=Ci(e),r=Ci(t),i=ui(n,r),a=li(n),o=li(r);return i?bi([n,r]):a&&o?si(n,r):a&&!o?n:!a&&o?r:ci(n,r)}function fi(e,t,n=[]){return x(t,(t,r)=>fi(e,r,[...n,di(e,t)]),()=>b(n.length,0)?[e]:n)}function pi(e,t,n=[]){return x(e,(e,r)=>pi(r,t,[...n,...mi([e],t)]),()=>n)}function mi(e,t=[]){return x(e,(e,n)=>L(e)?mi(n,pi(e.anyOf,t)):mi(n,fi(e,t)),()=>t)}function hi(e,t){return yo(fc({},e,t))?[]:[e]}function gi(e,t){return e.reduce((e,n)=>[...e,...hi(n,t)],[])}function _i(e,t){let n=Ci(e);return Si(gi(L(n)?n.anyOf:[n],t))}function vi(e,t,n){return Si([yn([e,t]),_i(n,e)])}function yi(e){return Si(e.map(e=>P(e)))}function bi(e){return wi(vc(mi(e)))}function xi(e){return Ci(zr(e))}function Si(e){return wi(vc(e))}function Ci(e){return gn(e)?vi(e.if,e.then,e.else):vn(e)?yi(e.enum):j(e)?bi(e.allOf):mo(e)?xi(e.pattern):L(e)?Si(e.anyOf):e}function wi(e){return b(e.length,1)?e[0]:b(e.length,0)?O():I(e)}function Ti(e,t){return zi(yi(e),t)}function Ei(e,t){return Br(Hi,t)}function Di(e,t){return zi(bi(e),t)}function Oi(e,t){return Le(e)||Fe(e)?k({[e]:t}):b(e,!1)?k({false:t}):b(e,!0)?k({true:t}):k({})}function ki(e,t){return Br(Ui,t)}function Ai(e,t){return S(e,`pattern`)&&(Le(e.pattern)||e.pattern instanceof RegExp)?Br(e.pattern.toString(),t):Br(Wi,t)}function ji(e,t){return Or(Cr(e))?zi(xi(e),t):Br(e,t)}function Mi(e){return L(e)?Ni(e.anyOf):[e]}function Ni(e){return e.reduce((e,t)=>[...e,...Mi(t)],[])}function Pi(e){return e.some(e=>xr(e)||_r(e)||ar(e))}function Fi(e,t){return b(Pi(e),!0)?Br(Wi,t):void 0}function Ii(e,t){return e.reduce((e,n)=>F(n)&&(Le(n.const)||Fe(n.const))?{...e,[n.const]:t}:e,{})}function Li(e,t){return k(Ii(e,t))}function Ri(e,t){let n=Ni(e),r=Fi(n,t);return jt(r)?r:Li(n,t)}function zi(e,t){return $t(e)?Vr(t):nr(e)?Hr(t):vn(e)?Ti(e.enum,t):ar(e)?Ei(e,t):j(e)?Di(e.allOf,t):F(e)?Oi(e.const,t):_r(e)?ki(e,t):L(e)?Ri(e.anyOf,t):xr(e)?Ai(e,t):mo(e)?ji(e.pattern,t):k({})}function Bi(e,t,n){return G([e])?T(zi(e,t),{},n):Gi(e,t,n)}function Vi(e,t,n,r,i){return Bi(K(e,t,n),K(e,t,r),i)}const Hi=`^${rr}$`,Ui=`^${hr}$`,Wi=`^.*$`;function Gi(e,t,n={}){return D(`Record`,[e,t],n)}function Ki(e,t,n={}){return Bi(e,t,n)}function qi(e,t){return Br(e,t)}function Ji(e){return b(e,Wi)?br():b(e,Hi)?ir():b(e,Ui)?gr():Rr(e)}function Yi(e){return C(e.patternProperties)[0]}function Xi(e){return Ji(Yi(e))}function Zi(e){return e.patternProperties[Yi(e)]}function Qi(e){return E(e,`Record`)}function $i(e){return w({"~kind":`Rest`},{type:`rest`,items:e},{})}function ea(e){return E(e,`Rest`)}function ta(e){return E(e,`This`)}function na(e){return w({"~kind":`Undefined`},{type:`undefined`},e)}function ra(e){return E(e,`Undefined`)}function ia(e){return E(e,`Void`)}function aa(e){return er()}function oa(e){return br()}function sa(e){return gr()}function ca(e){return ir()}function la(e){return O()}function ua(e){return P(e)}function da(e){return e}function fa(e){return I(e[1])}function pa(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function ma(e){return[e[0],...e[1]]}function ha(e){return e}function ga(e){return e[1]}function _a(e){return b(e.length,2)}function va(e,t,n){return _a(e)?t(e[0],e[1]):n()}function ya(e,t){return b(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function ba(e,t){for(let n=0;n<e.length;n++){let r=ya(e[n],t);if(_a(r))return r}return[]}function xa(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}const Sa=[...xa(97,122),...xa(65,90)],Ca=[`0`,...xa(49,57)];function wa(e){let t=e.indexOf(`*/`);return b(t,-1)?``:e.slice(t+2)}function Ta(e){let t=e.indexOf(`
|
|
2
2
|
`);return b(t,-1)?``:e.slice(t)}function Ea(e){return e.replace(/^[ \t\r\f\v]+/,``)}function Da(e){let t=Ea(e);return t.startsWith(`/*`)?Da(wa(t.slice(2))):t.startsWith(`//`)?Da(Ta(t.slice(2))):t}function Oa(e){let t=e.trimStart();return t.startsWith(`/*`)?Oa(wa(t.slice(2))):t.startsWith(`//`)?Oa(Ta(t.slice(2))):t}[...Ca];function ka(e,t){return ba([e],t)}function Aa(e,t){return b(e,``)?[``,t]:e.startsWith(`
|
|
3
3
|
`)?ka(e,Da(t)):e.startsWith(` `)?ka(e,t):ka(e,Oa(t))}[...Sa,...Ca],[...Ca];function ja(e){return b(e,``)?[]:[e.slice(0,1),e.slice(1)]}function Ma(e,t){return x(e,(e,n)=>t.startsWith(e)?!0:Ma(n,t),()=>!1)}function Na(e,t,n=``){return va(ja(t),(r,i)=>Ma(e,t)?[n,t]:Na(e,i,`${n}${r}`),()=>[])}function Pa(e,t){return va(Na(e,t),(e,t)=>b(e,``)?[]:[e,t],()=>[])}const z=(e,t,n=()=>[])=>e.length===2?t(e):n(),Fa=e=>z(Aa(`-?(?:0|[1-9][0-9]*)n`,e),([e,t])=>[aa(e),t]),Ia=e=>z(Aa(`.*`,e),([e,t])=>[oa(e),t]),La=e=>z(Aa(`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`,e),([e,t])=>[sa(e),t]),Ra=e=>z(Aa(`-?(?:0|[1-9][0-9]*)`,e),([e,t])=>[ca(e),t]),za=e=>z(Aa(`(?!)`,e),([e,t])=>[la(e),t]),Ba=e=>z(Pa([`-?(?:0|[1-9][0-9]*)n`,`.*`,`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`,`-?(?:0|[1-9][0-9]*)`,`(?!)`,`(`,`)`,`$`,`|`],e),([e,t])=>[ua(e),t]),Va=e=>z(z(Fa(e),([e,t])=>[e,t],()=>z(Ia(e),([e,t])=>[e,t],()=>z(La(e),([e,t])=>[e,t],()=>z(Ra(e),([e,t])=>[e,t],()=>z(za(e),([e,t])=>[e,t],()=>z(Ha(e),([e,t])=>[e,t],()=>z(Ba(e),([e,t])=>[e,t],()=>[]))))))),([e,t])=>[da(e),t]),Ha=e=>z(z(Aa(`(`,e),([e,t])=>z(Ga(t),([t,n])=>z(Aa(`)`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[fa(e),t]),Ua=e=>z(z(z(Wa(e),([e,t])=>z(Aa(`|`,t),([t,n])=>z(Ua(n),([n,r])=>[[e,t,n],r]))),([e,t])=>[e,t],()=>z(z(Wa(e),([e,t])=>[[e],t]),([e,t])=>[e,t],()=>z([[],e],([e,t])=>[e,t],()=>[]))),([e,t])=>[pa(e),t]),Wa=e=>z(z(Va(e),([e,t])=>z(Ga(t),([t,n])=>[[e,t],n])),([e,t])=>[ma(e),t]),Ga=e=>z(z(Ua(e),([e,t])=>[e,t],()=>z(Wa(e),([e,t])=>[e,t],()=>[])),([e,t])=>[ha(e),t]),Ka=e=>z(z(Aa(`^`,e),([e,t])=>z(Ga(t),([t,n])=>z(Aa(`$`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[ga(e),t]);function qa(e){return e.join(`|`)}function Ja(e){return e.slice(1,e.length-1)}function Ya(e,t,n){return oo(t,`${n}${e}`)}function Xa(e,t){return oo(e,`${t}-?(?:0|[1-9][0-9]*)n`)}function Za(e,t){return oo(e,`${t}${rr}`)}function Qa(e,t){return oo(e,`${t}${hr}`)}function $a(e,t){return ao(I([P(`false`),P(`true`)]),e,t)}function eo(e,t){return oo(e,`${t}.*`)}function to(e,t,n){return oo(t,`${n}${Ja(e)}`)}function no(e,t,n){return ao(lo(e,{}),t,n)}function ro(e,t,n){return ao(yi(e),t,n)}function io(e,t,n,r=[]){return x(e,(e,i)=>io(i,t,n,[...r,ao(e,[],``)]),()=>oo(t,`${n}(${qa(r)})`))}function ao(e,t,n){return vn(e)?ro(e.enum,t,n):ar(e)?Za(t,n):F(e)?Ya(e.const,t,n):tr(e)?Xa(t,n):nr(e)?$a(t,n):_r(e)?Qa(t,n):xr(e)?eo(t,n):mo(e)?to(e.pattern,t,n):po(e)?no(e.parameters[0],t,n):L(e)?io(e.anyOf,t,n):`(?!)`}function oo(e,t){return x(e,(e,n)=>ao(e,n,t),()=>t)}function so(e){return`^${oo(e,``)}$`}function co(e){return kr(so(e))}function lo(e,t){return G(e)?T(co(e),{},t):fo(e,t)}function uo(e,t,n,r){return lo(_f(e,t,n),r)}function fo(e,t={}){return D(`TemplateLiteral`,[e],t)}function po(e){return jt(e)&&S(e,`action`)&&b(e.action,`TemplateLiteral`)}function mo(e){return E(e,`TemplateLiteral`)}function ho(e){return w({"~kind":`ExtendsUnion`},{inferred:e})}function go(e){return y(e)&&S(e,`~kind`)&&S(e,`inferred`)&&b(e[`~kind`],`ExtendsUnion`)&&y(e.inferred)}function B(e){return w({"~kind":`ExtendsTrue`},{inferred:e})}function _o(e){return y(e)&&S(e,`~kind`)&&S(e,`inferred`)&&b(e[`~kind`],`ExtendsTrue`)&&y(e.inferred)}function V(){return w({"~kind":`ExtendsFalse`},{})}function vo(e){return y(e)&&S(e,`~kind`)&&b(e[`~kind`],`ExtendsFalse`)}function yo(e){return go(e)||_o(e)}function H(e,t,n){return yo(e)?t(e.inferred):n()}function bo(e,t,n,r){return H(W(e,n,r),r=>B(v(v(e,r),{[t]:n})),()=>V())}function xo(e,t){return B(e)}function So(e,t,n,r,i){return H(W(e,t,n),e=>H(W(e,t,r),e=>B(e),()=>V()),()=>H(W(e,t,i),e=>B(e),()=>V()))}function Co(e,t,n){return W(e,t,yi(n))}function wo(e,t,n){return x(n,(n,r)=>H(W(e,t,n),e=>wo(e,t,r),()=>V()),()=>B(e))}function To(e,t,n){return W(e,t,xi(n))}function Eo(e,t,n){return x(n,(n,r)=>H(W(e,t,n),e=>B(e),()=>Eo(e,t,r)),()=>V())}function U(e,t,n){return $t(n)?xo(e,t):gn(n)?So(e,t,n.if,n.then,n.else):vn(n)?Co(e,t,n.enum):mn(n)?bo(e,n.name,t,n.extends):j(n)?wo(e,t,n.allOf):mo(n)?To(e,t,n.pattern):L(n)?Eo(e,t,n.anyOf):un(n)?B(e):V()}function Do(e,t,n){return mn(n)?U(e,t,n):$t(n)||un(n)?B(e):ho(e)}function Oo(e,t){let n=Zn(e),r=Zn(t);return n&&r||!n&&r?!0:!(n&&!r)}function ko(e,t,n,r){return Bt(r)?Oo(t,r)?W(e,n,r.items):V():U(e,t,r)}function Ao(e,t,n){return tr(n)?B(e):U(e,t,n)}function jo(e,t,n){return nr(n)?B(e):U(e,t,n)}function Mo(e,t,n,r,i){let a=mn(r)?t:r,o=mn(r)?r:t,s=rn(t),c=rn(r);return!s&&c?V():H(W(e,a,o),e=>Fo(e,n,i),()=>V())}function No(e,t,n,r){return x(r,(r,i)=>Mo(e,t,n,r,i),()=>rn(t)?B(e):V())}function Po(e,t,n){return x(t,(t,r)=>No(e,t,r,n),()=>B(e))}function Fo(e,t,n){return Po(e,t,n)}function Io(e,t,n){return ia(n)?B(e):W(e,t,n)}function Lo(e,t,n,r){return $t(r)||un(r)?B(e):Ut(r)?H(Fo(e,t,r.parameters),e=>Io(e,n,r.instanceType),()=>V()):V()}function Ro(e,t,n,r,i){return H(W(e,t,i),()=>W(e,n,i),()=>W(e,r,i))}function zo(e,t,n){return W(e,yi(t),n)}function Bo(e,t,n,r){return $t(r)||un(r)?B(e):Kt(r)?H(Fo(e,t,r.parameters),e=>Io(e,n,r.returnType),()=>V()):V()}function Vo(e,t,n){return ar(n)||_r(n)?B(e):U(e,t,n)}function Ho(e,t,n){return W(e,bi(t),n)}function Uo(e,t,n){return t===n?B(e):V()}function Wo(e,t,n){return F(n)?Uo(e,t,n.const):tr(n)?B(e):U(e,P(t),n)}function Go(e,t,n){return F(n)?Uo(e,t,n.const):nr(n)?B(e):U(e,P(t),n)}function Ko(e,t,n){return F(n)?Uo(e,t,n.const):_r(n)?B(e):U(e,P(t),n)}function qo(e,t,n){return F(n)?Uo(e,t,n.const):xr(n)?B(e):U(e,P(t),n)}function Jo(e,t,n){return ke(t.const)?Wo(e,t.const,n):Ae(t.const)?Go(e,t.const,n):Fe(t.const)?Ko(e,t.const,n):Le(t.const)?qo(e,t.const,n):xn()}function Yo(e,t,n){return mn(n)?U(e,t,n):B(e)}function Xo(e,t,n){return mr(n)?B(e):U(e,t,n)}function Zo(e,t,n){return _r(n)?B(e):U(e,t,n)}function Qo(e,t,n){return rn(t)?rn(n)?B(e):V():B(e)}function $o(e,t,n){return mn(n)&&en(n.extends)?V():H(W(e,t,n),e=>Qo(e,t,n),()=>V())}function es(e,t){return e.reduce((e,n)=>n in t&&yo(t[n])?{...e,...t[n].inferred}:xn(),{})}function ts(e,t,n){let r={};for(let i of C(n))r[i]=i in t?$o({},t[i],n[i]):rn(n[i])?mn(n[i])?B(v(e,{[n[i].name]:n[i].extends})):B(e):V();let i=nt(r).every(e=>yo(e)),a=i?es(C(r),r):{};return i?B(a):V()}function ns(e,t,n){let r=ts(e,t,n);return yo(r)?B(v(e,r.inferred)):V()}function rs(e,t,n){return ns(e,t,n)}function is(e,t){return C(t).reduce((n,r)=>({...n,[r]:S(e,r)?L(n[r])?I([...n[r].anyOf,t[r]]):I([e[r],t[r]]):t[r]}),e)}function as(e,t,n,r){return x(t,(t,i)=>H(W({},e[t],n),t=>as(e,i,n,is(r,t)),()=>V()),()=>B(r))}function os(e,t,n,r){return as(t,C(t),r,e)}function ss(e,t,n){return Qi(n)?os(e,t,Yi(n),Zi(n)):A(n)?rs(e,t,n.properties):U(e,k(t),n)}function cs(e,t){return b(C(t).length,0)?B(e):V()}function ls(e,t,n,r,i){return W(e,n,i)}function us(e,t,n,r){return Qi(r)?ls(e,Ji(t),n,Ji(Yi(r)),Zi(r)):A(r)?cs(e,r.properties):$t(r)||un(r)?B(e):V()}function ds(e,t,n){return xr(n)?B(e):U(e,t,n)}function fs(e,t,n){return yr(n)?B(e):U(e,t,n)}function ps(e,t,n){return W(e,xi(t),n)}function ms(e,t){return w({"~kind":`Inferrable`},{name:e,type:t},{})}function hs(e){return y(e)&&S(e,`~kind`)&&S(e,`name`)&&S(e,`type`)&&b(e[`~kind`],`Inferrable`)&&Le(e.name)&&y(e.type)}function gs(e){return ea(e)?mn(e.items)?Bt(e.items.extends)?ms(e.items.name,e.items.extends.items):un(e.items.extends)?ms(e.items.name,e.items.extends):void 0:xn():void 0}function _s(e){return mn(e)?ms(e.name,e.extends):void 0}function vs(e,t,n=[]){return x(e,(e,r)=>H(W({},e,t),()=>vs(r,t,[...n,e]),()=>void 0),()=>n)}function ys(e,t,n,r){let i=vs(n,r);return Oe(i)?B(v(e,{[t]:Ur(i)})):V()}function bs(e,t,n,r){let i=vs(n,r);return Oe(i)?B(v(e,{[t]:I(i)})):V()}function xs(e){return[...e].reverse()}function Ss(e,t){return t?xs(e):e}function Cs(e){let t=e.length>0?e[0]:void 0;return jt(jt(t)?gs(t):void 0)}function ws(e,t,n,r,i,a){return H(W(e,n,i),e=>Ds(e,t,r,a),()=>V())}function Ts(e,t,n,r,i){let a=gs(r);return hs(a)?ys(e,a.name,Ss(n,t),a.type):x(n,(n,a)=>ws(e,t,n,a,r,i),()=>V())}function Es(e,t,n,r){return x(r,(r,i)=>Ts(e,t,n,r,i),()=>b(n.length,0)?B(e):V())}function Ds(e,t,n,r){return Es(e,t,n,r)}function Os(e,t,n){let r=gf(e,mf([],[]),n),i=Cs(r);return Ds(e,i,Ss(t,i),Ss(r,i))}function ks(e,t,n){let r=_s(n);return hs(r)?bs(e,r.name,t,r.type):x(t,(t,r)=>H(W(e,t,n),e=>ks(e,r,n),()=>V()),()=>B(e))}function As(e,t,n){let r=gf(e,mf([],[]),t);return R(n)?Os(e,r,n.items):Bt(n)?ks(e,r,n.items):U(e,Ur(r),n)}function js(e,t,n){return ia(n)||ra(n)?B(e):U(e,t,n)}function Ms(e,t,n){return x(n,(n,r)=>H(W(e,t,n),e=>B(e),()=>Ms(e,t,r)),()=>V())}function Ns(e,t,n){return x(t,(t,r)=>H(Ms(e,t,n),e=>Ns(e,r,n),()=>V()),()=>B(e))}function Ps(e,t,n){let r=_s(n);return hs(r)?bs(e,r.name,t,r.type):L(n)?Ns(e,t,n.anyOf):Ns(e,t,[n])}function Fs(e,t,n){return mn(n)?U(e,t,n):$t(n)||un(n)?B(e):V()}function Is(e,t,n){return ia(n)?B(e):U(e,t,n)}function W(e,t,n){return $t(t)?Do(e,t,n):Bt(t)?ko(e,t,t.items,n):tr(t)?Ao(e,t,n):nr(t)?jo(e,t,n):Ut(t)?Lo(e,t.parameters,t.instanceType,n):gn(t)?Ro(e,t.if,t.then,t.else,n):vn(t)?zo(e,t.enum,n):Kt(t)?Bo(e,t.parameters,t.returnType,n):ar(t)?Vo(e,t,n):j(t)?Ho(e,t.allOf,n):F(t)?Jo(e,t,n):en(t)?Yo(e,t,n):mr(t)?Xo(e,t,n):_r(t)?Zo(e,t,n):A(t)?ss(e,t.properties,n):Qi(t)?us(e,Yi(t),Zi(t),n):xr(t)?ds(e,t,n):yr(t)?fs(e,t,n):mo(t)?ps(e,t.pattern,n):R(t)?As(e,t.items,n):ra(t)?js(e,t,n):L(t)?Ps(e,t.anyOf,n):un(t)?Fs(e,t,n):ia(t)?Is(e,t,n):V()}function Ls(e,t){return bi([...e,k(t)])}function Rs(e,t,n){return G(e)?T(Ls(e,t),{},n):Bs(e,t,n)}function zs(e,t,n,r,i){return Rs(_f(e,t,n),hf(e,t,r),i)}function Bs(e,t,n={}){return D(`Interface`,[e,t],n)}function Vs(e){return jt(e)&&S(e,`action`)&&b(e.action,`Interface`)}function Hs(e,t,n){return e.includes(n)?!0:Gs([...e,n],t,t[n])}function Us(e,t,n){return Ws(e,t,sn(n))}function Ws(e,t,n){return x(n,(n,r)=>Gs(e,t,n)?!0:Ws(e,t,r),()=>!1)}function Gs(e,t,n){return Yt(n)?Hs(e,t,n.$ref):Bt(n)?Gs(e,t,n.items):Ut(n)?Ws(e,t,[...n.parameters,n.instanceType]):Kt(n)?Ws(e,t,[...n.parameters,n.returnType]):Vs(n)?Us(e,t,n.parameters[1]):j(n)?Ws(e,t,n.allOf):A(n)?Us(e,t,n.properties):L(n)?Ws(e,t,n.anyOf):R(n)?Ws(e,t,n.items):Qi(n)?Gs(e,t,Zi(n)):!1}function Ks(e,t,n){return Gs(e,t,n)}function qs(e,t){return t.reduce((t,n)=>Ks([n],e,e[n])?[...t,n]:t,[])}function Js(e){return qs(e,on(e))}function Ys(e,t,n){return n.includes(t)?n:t in e?Qs(e,e[t],[...n,t]):xn()}function Xs(e,t,n){return Zs(e,sn(t),n)}function Zs(e,t,n){return t.reduce((t,n)=>Qs(e,n,t),n)}function Qs(e,t,n){return Yt(t)?Ys(e,t.$ref,n):Bt(t)?Qs(e,t.items,n):Ut(t)?Zs(e,[...t.parameters,t.instanceType],n):Kt(t)?Zs(e,[...t.parameters,t.returnType],n):Vs(t)?Xs(e,t.parameters[1],n):j(t)?Zs(e,t.allOf,n):A(t)?Xs(e,t.properties,n):L(t)?Zs(e,t.anyOf,n):R(t)?Zs(e,t.items,n):Qi(t)?Qs(e,Zi(t),n):n}function $s(e,t,n){return Qs(e,n,[t])}function ec(e){return Qt()}function tc(e){return C(e).reduce((t,n)=>({...t,[n]:rc(e[n])}),{})}function nc(e){return e.reduce((e,t)=>[...e,rc(t)],[])}function rc(e){return Yt(e)?ec(e.$ref):Bt(e)?zt(rc(e.items),Vt(e)):Ut(e)?Ht(nc(e.parameters),rc(e.instanceType)):Kt(e)?Gt(nc(e.parameters),rc(e.returnType)):j(e)?yn(nc(e.allOf)):A(e)?k(tc(e.properties)):Qi(e)?Ki(Xi(e),rc(Zi(e))):L(e)?I(nc(e.anyOf)):R(e)?Ur(nc(e.items)):e}function ic(e,t){return t in e?rc(e[t]):ln()}function ac(e){return ic(e.$defs,e.$ref)}function oc(e,t,n){let r=_f(e,mf([],[]),t),i=hf({},mf([],[]),n);return bi([...r,k(i)])}function sc(e,t){return C(e).filter(e=>t.includes(e)).reduce((t,n)=>{let r=e[n],i=Vs(r)?oc(e,r.parameters[0],r.parameters[1]):r;return{...t,[n]:i}},{})}function cc(e,t,n){return dn(sc(e,$s(e,t,n)),t)}function lc(e,t){return t in e?Yt(e[t])?lc(e,e[t].$ref):e[t]:O()}function uc(e,t){return lc(e,t)}function dc(e){return fn(e)?ac(e):pn(e)?ln():e}function fc(e,t,n){return W(e,dc(t),dc(n))}function pc(e,t){let n=[un(e)?V():fc({},e,t),un(e)?B({}):fc({},t,e)];return yo(n[0])&&yo(n[1])?`equal`:yo(n[0])&&vo(n[1])?`left-inside`:vo(n[0])&&yo(n[1])?`right-inside`:`disjoint`}function mc(e,t){return t.filter(t=>pc(e,t)!==`right-inside`)}function hc(e,t){return b(t.some(t=>{let n=pc(e,t);return b(n,`left-inside`)||b(n,`equal`)}),!1)}function gc(e,t){let n=Ci(e);return $t(n)?[n]:hc(n,t)?[...mc(n,t),n]:t}function _c(e){return e.reduce((e,t)=>A(t)?[...e,t]:en(t)?e:gc(t,e),[])}function vc(e){return Ni(_c(e))}function yc(e,t){return T(Ci(e),{},t)}function bc(e,t,n,r){return yc(K(e,t,n),r)}function xc(e,t=[]){return Mt(e)&&b(e.action,`Conditional`)?Yt(e.parameters[0])?xc(e.parameters[2],xc(e.parameters[3],[...t,e.parameters[0].$ref])):xc(e.parameters[2],xc(e.parameters[3],t)):Mt(e)&&b(e.action,`Mapped`)&&Mt(e.parameters[1])&&b(e.parameters[1].action,`KeyOf`)&&Yt(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function Sc(e,t){return e.reduce((e,n)=>[...e,t.includes(n.name)],[])}function Cc(e,t,n=[]){return x(e,(e,r)=>x(t,(t,i)=>Cc(r,i,[...n,[t,e]]),()=>n),()=>n)}function wc(e){return L(e)?[...e.anyOf]:[e]}function Tc(e,t){return e.reduce((e,n)=>[...e,[...n,t]],[])}function Ec(e,t){return t.reduce((t,n)=>[...t,...Tc(e,n)],[])}function Dc(e){return e.reduce((e,t)=>b(t[0],!0)?Ec(e,wc(t[1])):Ec(e,[t[1]]),[[]])}function Oc(e,t,n){let r=Cc(t,Sc(e,xc(n)));return Mt(n)&&b(n.action,`Conditional`)||Mt(n)&&b(n.action,`Mapped`)?Dc(r):[t]}function kc(){return[`(not-resolvable)`,O()]}function Ac(){return[`(not-generic)`,O()]}function jc(e,t,n){return[e,Xt(t,n)]}function Mc(e,t,n){return t in e?Nc(e,t,e[t],n):kc()}function Nc(e,t,n,r){return Zt(n)?jc(t,n.parameters,n.expression):Yt(n)?Mc(e,n.$ref,r):Ac()}function Pc(e,t,n){return Nc(e,`(anonymous)`,t,n)}function Fc(e,t,n){if(mn(t)||qc(t)||yo(fc({},t,n)))return;let r={parameter:e,expect:n,actual:t};throw Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function Ic(e,t,n,r,i){let a=K(e,t,i);return Fc(n,a,r),v(e,{[n]:a})}function Lc(e,t,n,r,i){let a=K(e,t,n.extends),o=K(e,t,n.equals);return x(i,(i,o)=>Rc(Ic(e,t,n.name,a,i),t,r,o),()=>Rc(Ic(e,t,n.name,a,o),t,r,[]))}function Rc(e,t,n,r){return x(n,(n,i)=>Lc(e,t,n,i,r),()=>e)}function zc(e,t,n,r){return Rc(e,t,n,r)}function Bc(e){return Be(e.callstack.length,0)?e.callstack[e.callstack.length-1]:``}function Vc(e,t){return b(Bc(e),t)}function Hc(e,t,n,r,i,a){let o=zc(e,t,r,a),s=K(o,mf([...t.callstack,n.$ref],t.visited),i);return K(o,mf([],[]),s)}function Uc(e,t,n,r,i,a){return a.reduce((a,o)=>[...a,Hc(e,t,n,r,i,o)],[])}function Wc(e,t,n,r,i,a){let o=Uc(e,t,n,r,i,Oc(r,a,i));return b(o.length,1)?o[0]:Si(o)}function Gc(e,t,n,r){let i=_f(e,t,r),a=Pc(e,n,r),o=a[0],s=a[1];return Zt(s)?Vc(t,o)?Kc(Jt(o),i):Wc(e,t,Jt(o),s.parameters,s.expression,i):Kc(n,i)}function Kc(e,t){return w({"~kind":`Call`},{type:`call`,target:e,arguments:t},{})}function qc(e){return E(e,`Call`)}function Jc(e){return At(e,[`~immutable`])}function Yc(e,t){return T(Jc(e),{},t)}function Xc(e,t,n,r){return Yc(K(e,t,n),r)}function Zc(e,t){return e(t)}function Qc(e,t){return Le(t)?P(Zc(e,t)):P(t)}function $c(e,t){return tl(e,xi(t))}function el(e,t){return I(t.map(t=>tl(e,t)))}function tl(e,t){return F(t)?Qc(e,t.const):mo(t)?$c(e,t.pattern):L(t)?el(e,t.anyOf):t}function nl(e,t={}){return D(`Capitalize`,[e],t)}function rl(e,t={}){return D(`Lowercase`,[e],t)}function il(e,t={}){return D(`Uncapitalize`,[e],t)}function al(e,t={}){return D(`Uppercase`,[e],t)}const ol=e=>e[0].toUpperCase()+e.slice(1),sl=e=>e.toLowerCase(),cl=e=>e[0].toLowerCase()+e.slice(1),ll=e=>e.toUpperCase();function ul(e,t){return G([e])?T(tl(ol,e),{},t):nl(e,t)}function dl(e,t){return G([e])?T(tl(sl,e),{},t):rl(e,t)}function fl(e,t){return G([e])?T(tl(cl,e),{},t):il(e,t)}function pl(e,t){return G([e])?T(tl(ll,e),{},t):al(e,t)}function ml(e,t,n,r){return ul(K(e,t,n),r)}function hl(e,t,n,r){return dl(K(e,t,n),r)}function gl(e,t,n,r){return fl(K(e,t,n),r)}function _l(e,t,n,r){return pl(K(e,t,n),r)}function vl(e,t,n,r,i={}){return D(`Conditional`,[e,t,n,r],i)}function yl(e,t,n,r,i,a){let o=fc(e,n,r);return go(o)?I([K(o.inferred,t,i),K(e,t,a)]):_o(o)?K(o.inferred,t,i):K(e,t,a)}function bl(e,t,n,r,i,a,o){return G([n,r])?T(yl(e,t,n,r,i,a),{},o):vl(n,r,i,a,o)}function xl(e,t,n,r,i,a,o){return bl(e,t,K(e,t,n),K(e,t,r),i,a,o)}function Sl(e,t={}){return D(`ConstructorParameters`,[e],t)}function Cl(e){let t=Ut(e)?e.parameters:[];return Ur(gf({},mf([],[]),t))}function wl(e,t){return G([e])?T(Cl(e),{},t):Sl(e,t)}function Tl(e,t,n,r){return wl(K(e,t,n),r)}function El(e,t,n={}){return D(`Exclude`,[e,t],n)}function Dl(e,t,n){return G([e,t])?T(_i(e,t),{},n):El(e,t,n)}function Ol(e,t,n,r,i){return Dl(K(e,t,n),K(e,t,r),i)}function kl(e,t,n={}){return D(`Extract`,[e,t],n)}function Al(e,t){return yo(fc({},e,t))?[e]:[]}function jl(e,t){return e.reduce((e,n)=>[...e,...Al(n,t)],[])}function Ml(e,t){let n=Ci(e);return Si(jl(L(n)?n.anyOf:[n],t))}function Nl(e,t,n){return G([e,t])?T(Ml(e,t),{},n):kl(e,t,n)}function Pl(e,t,n,r,i){return Nl(K(e,t,n),K(e,t,r),i)}function Fl(e,t,n={}){return D(`Index`,[e,t],n)}function Il(e,t){return Gl(uc(e,t))}function Ll(e,t,n){return Gl(vi(e,t,n))}function Rl(e,t){let n=C(e).filter(e=>!S(t,e)),r=C(t).filter(t=>!S(e,t)),i=C(e).filter(e=>S(t,e)),a=n.reduce((t,n)=>({...t,[n]:e[n]}),{}),o=r.reduce((e,n)=>({...e,[n]:t[n]}),{}),s=i.reduce((n,r)=>({...n,[r]:bi([e[r],t[r]])}),{});return v(v(a,o),s)}function zl(e){return e.reduce((e,t)=>Rl(e,Gl(t)),{})}function Bl(e){return e}function Vl(e){return Gl(ei(Ur(e)))}function Hl(e,t){return C(e).filter(e=>e in t).reduce((n,r)=>({...n,[r]:Si([e[r],t[r]])}),{})}function Ul(e,t){return x(e,(e,n)=>Ul(n,Hl(t,Gl(e))),()=>t)}function Wl(e){return x(e,(e,t)=>Ul(t,Gl(e)),()=>xn())}function Gl(e){return fn(e)?Il(e.$defs,e.$ref):gn(e)?Ll(e.if,e.then,e.else):j(e)?zl(e.allOf):L(e)?Wl(e.anyOf):R(e)?Vl(e.items):A(e)?Bl(e.properties):{}}function Kl(e){return k(Gl(e))}const ql=RegExp(`^(?:0|[1-9][0-9]*)$`);function Jl(e){let t=`${e}`;return ql.test(t)?parseInt(t):e}function Yl(e){return P(Jl(e))}function Xl(e){return e.map(e=>Zl(e))}function Zl(e){return j(e)?yn(Xl(e.allOf)):L(e)?I(Xl(e.anyOf)):F(e)?Yl(e.const):e}function Ql(e,t){return yo(fc({},Zl(t),gr()))?e:F(t)&&b(t.const,`length`)?gr():O()}function $l(e,t){return ou(uc(e,t))}function eu(e,t,n){return ou(vi(e,t,n))}function tu(e){return ou(yi(e))}function nu(e){return ou(bi(e))}function ru(e){return[`${e}`]}function iu(e){return ou(xi(e))}function au(e){return e.reduce((e,t)=>[...e,...ou(t)],[])}function ou(e){return fn(e)?$l(e.$defs,e.$ref):gn(e)?eu(e.if,e.then,e.else):vn(e)?tu(e.enum):j(e)?nu(e.allOf):F(e)?ru(e.const):mo(e)?iu(e.pattern):L(e)?au(e.anyOf):[]}function su(e){return ou(e)}function cu(e,t){return t.map(t=>lu(e,t))}function lu(e,t){return Bt(t)?zt(lu(e,t.items)):Ut(t)?Ht(cu(e,t.parameters),lu(e,t.instanceType)):Kt(t)?Gt(cu(e,t.parameters),lu(e,t.returnType)):R(t)?Ur(cu(e,t.items)):L(t)?I(cu(e,t.anyOf)):j(t)?yn(cu(e,t.allOf)):ta(t)?k(e):t}function uu(e,t){return lu(e,t)}function du(e,t){return uu(e,t in e?e[t]:O())}function fu(e,t){return t.reduce((t,n)=>[...t,du(e,n)],[])}function pu(e,t){return Si(fu(e,su(t)))}const mu=new RegExp(Hi);function hu(e){return e.filter(e=>mu.test(e))}function gu(e){return Si(fu(e,hu(on(e))))}function _u(e,t){return _r(t)?gu(e):pu(e,t)}function vu(e){return P(Jl(e))}function yu(e){return e.map(e=>bu(e))}function bu(e){return j(e)?yn(yu(e.allOf)):L(e)?I(yu(e.anyOf)):F(e)?vu(e.const):e}function xu(e,t){return e.reduceRight((e,n,r)=>yo(fc({},P(r),t))?[n,...e]:e,[])}function Su(e,t){return wi(xu(e,bu(t)))}function Cu(e){return wi(e)}function wu(e,t){return F(t)&&b(t.const,`length`)?P(e.length):_r(t)||ar(t)?Cu(e):Su(e,t)}function Tu(e,t){return Bt(e)?Ql(e.items,t):A(e)?_u(e.properties,t):R(e)?wu(e.items,t):O()}function Eu(e){return fn(e)||gn(e)||j(e)||L(e)?Kl(e):e}function Du(e,t,n){return G([e,t])?T(Tu(Eu(e),t),{},n):Fl(e,t,n)}function Ou(e,t,n,r,i){return Du(K(e,t,n),K(e,t,r),i)}function ku(e,t={}){return D(`InstanceType`,[e],t)}function Au(e){return Ut(e)?e.instanceType:O()}function ju(e,t){return G([e])?T(Au(e),{},t):ku(e,t)}function Mu(e,t,n,r={}){return ju(K(e,t,n),r)}function Nu(e,t={}){return D(`KeyOf`,[e],t)}function Pu(){return I([gr(),br(),vr()])}function Fu(e){return gr()}function Iu(e){return e.reduce((e,t)=>cr(t)?[...e,P(Jl(t))]:xn(),[])}function Lu(e){return wi(Iu(C(e)))}function Ru(e){return Xi(e)}function zu(e){return wi(e.map((e,t)=>P(t)))}function Bu(e){return $t(e)?Pu():Bt(e)?Fu(e.items):A(e)?Lu(e.properties):Qi(e)?Ru(e):R(e)?zu(e.items):O()}function Vu(e){return fn(e)||gn(e)||j(e)||L(e)?Kl(e):e}function Hu(e,t){return G([e])?T(Bu(Vu(e)),{},t):Nu(e,t)}function Uu(e,t,n,r){return Hu(K(e,t,n),r)}function Wu(e,t,n,r,i={}){return D(`Mapped`,[e,t,n,r],i)}function Gu(e){return Yu(xi(e))}function Ku(e){return e.reduce((e,t)=>[...e,...Yu(t)],[])}function qu(e){return Yu(yi(e))}function Ju(e){return Fe(e)?[P(`${e}`)]:[P(e)]}function Yu(e){return vn(e)?qu(e.enum):F(e)?Ju(e.const):mo(e)?Gu(e.pattern):L(e)?Ku(e.anyOf):[e]}function Xu(e){return Yu(e)}function Zu(e){return mo(e)?xi(e.pattern):e}function Qu(e,t,n,r,i,a){let o=v(e,{[n.name]:r}),s=Zu(K(o,t,i)),c=K(o,t,a);return dr(s)||fr(s)?{[s.const]:c}:{}}function $u(e,t,n,r,i,a){return r.reduce((r,o)=>[...r,Qu(e,t,n,o,i,a)],[])}function ed(e){return e.reduce((e,t)=>[...e,k(t)],[])}function td(e,t,n,r,i,a){return bi(ed($u(e,t,n,Xu(r),i,a)))}function nd(e,t,n,r,i,a,o){return G([r])?T(td(e,t,n,r,i,a),{},o):Wu(n,r,i,a,o)}function rd(e,t,n,r,i,a,o){return nd(e,t,n,K(e,t,r),i,a,o)}function id(e,t,n){let r=v(e,t);return C(t).filter(e=>n.includes(e)).reduce((e,n)=>({...e,[n]:cc(r,n,t[n])}),{})}function ad(e,t,n){let r=v(e,t);return C(t).filter(e=>!n.includes(e)).reduce((e,n)=>({...e,[n]:K(r,mf([],[]),t[n])}),{})}function od(e,t,n){let r=Js(t),i=id(e,t,r),a=ad(e,t,r);return T({...i,...a},{},n)}function sd(e,t,n,r){return od(e,n,r)}function cd(e,t={}){return D(`NonNullable`,[e],t)}function ld(e){return Dl(e,I([pr(),na()]),{})}function ud(e,t){return G([e])?T(ld(e),{},t):cd(e,t)}function dd(e,t,n,r){return ud(K(e,t,n),r)}function fd(e,t,n={}){return D(`Omit`,[e,t],n)}function pd(e){let t=Kl(e);return A(t)?t.properties:xn()}function md(e,t){return C(e).reduce((n,r)=>t.includes(r)?n:{...n,[r]:e[r]},{})}function hd(e,t){return k(md(pd(e),su(t)))}function gd(e,t,n){return G([e,t])?T(hd(e,t),{},n):fd(e,t,n)}function _d(e,t,n,r,i){return gd(K(e,t,n),K(e,t,r),i)}function vd(e,t={}){return D(`Parameters`,[e],t)}function yd(e){let t=Kt(e)?e.parameters:[];return Ur(gf({},mf([],[]),t))}function bd(e,t){return G([e])?T(yd(e),{},t):vd(e,t)}function xd(e,t,n,r){return bd(K(e,t,n),r)}function Sd(e,t={}){return D(`Partial`,[e],t)}function Cd(e,t){let n=Od(uc(e,t));return dn(v(e,{[t]:n}),t)}function wd(e,t,n){return Od(vi(e,t,n))}function Td(e){return Od(bi(e))}function Ed(e){return I(e.map(e=>Od(e)))}function Dd(e){return k(C(e).reduce((t,n)=>({...t,[n]:tn(e[n])}),{}))}function Od(e){return fn(e)?Cd(e.$defs,e.$ref):gn(e)?wd(e.if,e.then,e.else):j(e)?Td(e.allOf):L(e)?Ed(e.anyOf):A(e)?Dd(e.properties):k({})}function kd(e,t){return G([e])?T(Od(e),{},t):Sd(e,t)}function Ad(e,t,n,r){return kd(K(e,t,n),r)}function jd(e,t,n={}){return D(`Pick`,[e,t],n)}function Md(e,t){return C(e).reduce((n,r)=>t.includes(r)?v(n,{[r]:e[r]}):n,{})}function Nd(e,t){return k(Md(pd(e),su(t)))}function Pd(e,t,n){return G([e,t])?T(Nd(e,t),{},n):jd(e,t,n)}function Fd(e,t,n,r,i){return Pd(K(e,t,n),K(e,t,r),i)}function Id(e,t={}){return D(`ReadonlyObject`,[e],t)}function Ld(e){return Tf(zt(e))}function Rd(e,t){let n=Wd(uc(e,t));return dn(v(e,{[t]:n}),t)}function zd(e,t,n){return Wd(vi(e,t,n))}function Bd(e){return Wd(bi(e))}function Vd(e){return k(C(e).reduce((t,n)=>({...t,[n]:Qn(e[n])}),{}))}function Hd(e){return Tf(Ur(e))}function Ud(e){return I(e.map(e=>Wd(e)))}function Wd(e){return Bt(e)?Ld(e.items):fn(e)?Rd(e.$defs,e.$ref):gn(e)?zd(e.if,e.then,e.else):j(e)?Bd(e.allOf):A(e)?Vd(e.properties):R(e)?Hd(e.items):L(e)?Ud(e.anyOf):e}function Gd(e,t){return G([e])?T(Wd(e),{},t):Id(e)}function Kd(e,t,n,r){return Gd(K(e,t,n),r)}function qd(e,t,n,r){return t.visited.includes(r)?n:r in e?K(e,mf(t.callstack,[...t.visited,r]),e[r]):n}function Jd(e,t){let n=$d(uc(e,t));return dn(v(e,{[t]:n}),t)}function Yd(e,t,n){return $d(vi(e,t,n))}function Xd(e){return $d(bi(e))}function Zd(e){return I(e.map(e=>$d(e)))}function Qd(e){return k(C(e).reduce((t,n)=>({...t,[n]:Qr(e[n])}),{}))}function $d(e){return fn(e)?Jd(e.$defs,e.$ref):gn(e)?Yd(e.if,e.then,e.else):j(e)?Xd(e.allOf):L(e)?Zd(e.anyOf):A(e)?Qd(e.properties):k({})}function ef(e,t={}){return D(`Required`,[e],t)}function tf(e,t){return G([e])?T($d(e),{},t):ef(e,t)}function nf(e,t,n,r){return tf(K(e,t,n),r)}function rf(e,t={}){return D(`ReturnType`,[e],t)}function af(e){return Kt(e)?e.returnType:O()}function of(e,t){return G([e])?T(af(e),{},t):rf(e,t)}function sf(e,t,n,r={}){return of(K(e,t,n),r)}function cf(e,t){return D(`With`,[e,t],{})}function lf(e,t){return uf(e,t)}function uf(e,t){return G([e])?T(e,{},t):cf(e,t)}function df(e,t,n,r){return uf(K(e,t,n),r)}function ff(e){return ea(e)?R(e.items)?pf(e.items.items):mn(e.items)||Yt(e.items)?[e]:[O()]:[e]}function pf(e){return e.reduce((e,t)=>[...e,...ff(t)],[])}function mf(e,t){return{callstack:e,visited:t}}function G(e){return x(e,(e,t)=>!Yt(e)&&G(t),()=>!0)}function hf(e,t,n){return C(n).reduce((r,i)=>({...r,[i]:K(e,t,n[i])}),{})}function gf(e,t,n){return pf(_f(e,t,n))}function _f(e,t,n){return n.map(n=>K(e,t,n))}function vf(e,t){let n=rn(e)?Lt(t,{}):t,r=$n(e)?Pt(n,{}):n;return Zn(e)?Cf(r,{}):r}function yf(e,t,n,r,i){return b(n,`AddImmutable`)?wf(e,t,r[0],i):b(n,`RemoveImmutable`)?Xc(e,t,r[0],i):b(n,`AddReadonly`)?Ft(e,t,r[0],i):b(n,`RemoveReadonly`)?qr(e,t,r[0],i):b(n,`AddOptional`)?Rt(e,t,r[0],i):b(n,`RemoveOptional`)?Zr(e,t,r[0],i):b(n,`Capitalize`)?ml(e,t,r[0],i):b(n,`Conditional`)?xl(e,t,r[0],r[1],r[2],r[3],i):b(n,`ConstructorParameters`)?Tl(e,t,r[0],i):b(n,`Evaluate`)?bc(e,t,r[0],i):b(n,`Exclude`)?Ol(e,t,r[0],r[1],i):b(n,`Extract`)?Pl(e,t,r[0],r[1],i):b(n,`Index`)?Ou(e,t,r[0],r[1],i):b(n,`InstanceType`)?Mu(e,t,r[0],i):b(n,`Interface`)?zs(e,t,r[0],r[1],i):b(n,`KeyOf`)?Uu(e,t,r[0],i):b(n,`Lowercase`)?hl(e,t,r[0],i):b(n,`Mapped`)?rd(e,t,r[0],r[1],r[2],r[3],i):b(n,`Module`)?sd(e,t,r[0],i):b(n,`NonNullable`)?dd(e,t,r[0],i):b(n,`Pick`)?Fd(e,t,r[0],r[1],i):b(n,`Parameters`)?xd(e,t,r[0],i):b(n,`Partial`)?Ad(e,t,r[0],i):b(n,`Omit`)?_d(e,t,r[0],r[1],i):b(n,`ReadonlyObject`)?Kd(e,t,r[0],i):b(n,`Record`)?Vi(e,t,r[0],r[1],i):b(n,`Required`)?nf(e,t,r[0],i):b(n,`ReturnType`)?sf(e,t,r[0],i):b(n,`TemplateLiteral`)?uo(e,t,r[0],i):b(n,`Uncapitalize`)?gl(e,t,r[0],i):b(n,`Uppercase`)?_l(e,t,r[0],i):b(n,`With`)?df(e,t,r[0],r[1]):D(n,r,i)}function bf(e,t,n){return vf(n,Yt(n)?qd(e,t,n,n.$ref):Bt(n)?zt(K(e,t,n.items),Vt(n)):qc(n)?Gc(e,t,n.target,n.arguments):Ut(n)?Ht(_f(e,t,n.parameters),K(e,t,n.instanceType),Wt(n)):Kt(n)?Gt(_f(e,t,n.parameters),K(e,t,n.returnType),qt(n)):gn(n)?hn(K(e,t,n.if),K(e,t,n.then),K(e,t,n.else),_n(n)):j(n)?yn(_f(e,t,n.allOf),bn(n)):A(n)?k(hf(e,t,n.properties),cn(n)):Qi(n)?qi(Yi(n),K(e,t,Zi(n))):ea(n)?$i(K(e,t,n.items)):R(n)?Ur(gf(e,t,n.items),Wr(n)):L(n)?I(_f(e,t,n.anyOf),Sr(n)):n)}function K(e,t,n){return Mt(n)?yf(e,t,n.action,n.parameters,n.options):bf(e,t,n)}function xf(e,t){return K(e,mf([],[]),t)}function Sf(e){return T(e,{"~immutable":!0},{})}function Cf(e,t){return T(Sf(e),{},t)}function wf(e,t,n,r){return Cf(K(e,t,n),r)}function Tf(e,t={}){return Cf(e,t)}function Ef(e,t={}){return yc(e,t)}function Df(e,t){let n=pc(e,t);return b(n,`right-inside`)?1:+!!b(n,`disjoint`)}function Of(e,t,n=[]){return x(t,(r,i)=>b(Df(e,r),1)?Of(e,i,[...n,r]):[...n,e,...t],()=>[...n,e])}function kf(e,t=[]){return x(e,(e,n)=>kf(n,Of(e,t)),()=>t)}function Af(e){return kf(e)}function jf(e,t){try{return Promise.resolve(t(Mf))}catch(e){return Promise.reject(e)}}const Mf={startSpan:jf,addEvent:()=>{},setAttributes:()=>{},setStatus:()=>{}};Object.freeze(Mf);const Nf=Symbol.for(`yaml.alias`),Pf=Symbol.for(`yaml.document`),Ff=Symbol.for(`yaml.map`),If=Symbol.for(`yaml.pair`),Lf=Symbol.for(`yaml.scalar`),Rf=Symbol.for(`yaml.seq`),zf=Symbol.for(`yaml.node.type`),Bf=e=>!!e&&typeof e==`object`&&e[zf]===Nf,Vf=e=>!!e&&typeof e==`object`&&e[zf]===Pf,Hf=e=>!!e&&typeof e==`object`&&e[zf]===Ff,q=e=>!!e&&typeof e==`object`&&e[zf]===If,J=e=>!!e&&typeof e==`object`&&e[zf]===Lf,Uf=e=>!!e&&typeof e==`object`&&e[zf]===Rf;function Wf(e){if(e&&typeof e==`object`)switch(e[zf]){case Ff:case Rf:return!0}return!1}function Y(e){if(e&&typeof e==`object`)switch(e[zf]){case Nf:case Ff:case Lf:case Rf:return!0}return!1}const Gf=e=>(J(e)||Wf(e))&&!!e.anchor,Kf=Symbol(`break visit`),qf=Symbol(`skip children`),Jf=Symbol(`remove node`);function Yf(e,t){let n=Zf(t);Vf(e)?Xf(null,e.contents,n,Object.freeze([e]))===Jf&&(e.contents=null):Xf(null,e,n,Object.freeze([]))}Yf.BREAK=Kf,Yf.SKIP=qf,Yf.REMOVE=Jf;function Xf(e,t,n,r){let i=Qf(e,t,n,r);if(Y(i)||q(i))return $f(e,r,i),Xf(e,i,n,r);if(typeof i!=`symbol`){if(Wf(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Xf(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Kf)return Kf;else i===Jf&&(t.items.splice(e,1),--e)}}else if(q(t)){r=Object.freeze(r.concat(t));let e=Xf(`key`,t.key,n,r);if(e===Kf)return Kf;e===Jf&&(t.key=null);let i=Xf(`value`,t.value,n,r);if(i===Kf)return Kf;i===Jf&&(t.value=null)}}return i}function Zf(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Qf(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Hf(t))return n.Map?.(e,t,r);if(Uf(t))return n.Seq?.(e,t,r);if(q(t))return n.Pair?.(e,t,r);if(J(t))return n.Scalar?.(e,t,r);if(Bf(t))return n.Alias?.(e,t,r)}function $f(e,t,n){let r=t[t.length-1];if(Wf(r))r.items[e]=n;else if(q(r))e===`key`?r.key=n:r.value=n;else if(Vf(r))r.contents=n;else{let e=Bf(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function ep(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function tp(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=tp(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=tp(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=tp(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=tp(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function np(e,t,n){if(Array.isArray(e))return e.map((e,t)=>np(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Gf(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var rp=class{constructor(e){Object.defineProperty(this,zf,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Vf(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=np(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?tp(i,{"":o},``,o):o}},ip=class extends rp{constructor(e){super(Nf),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Yf(e,{Node:(e,t)=>{(Bf(t)||Gf(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(np(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=ap(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(ep(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function ap(e,t,n){if(Bf(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Wf(t)){let r=0;for(let i of t.items){let t=ap(e,i,n);t>r&&(r=t)}return r}if(q(t)){let r=ap(e,t.key,n),i=ap(e,t.value,n);return Math.max(r,i)}return 1}const op=e=>!e||typeof e!=`function`&&typeof e!=`object`;var X=class extends rp{constructor(e){super(Lf),this.value=e}toJSON(e,t){return t?.keep?this.value:np(this.value,e,t)}toString(){return String(this.value)}};X.BLOCK_FOLDED=`BLOCK_FOLDED`,X.BLOCK_LITERAL=`BLOCK_LITERAL`,X.PLAIN=`PLAIN`,X.QUOTE_DOUBLE=`QUOTE_DOUBLE`,X.QUOTE_SINGLE=`QUOTE_SINGLE`;function sp(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function cp(e,t,n){if(Vf(e)&&(e=e.contents),Y(e))return e;if(q(e)){let t=n.schema[Ff].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new ip(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=`tag:yaml.org,2002:`+t.slice(2));let l=sp(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new X(e);return c&&(c.node=t),t}l=e instanceof Map?o[Ff]:Symbol.iterator in Object(e)?o[Rf]:o[Ff]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new X(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function lp(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return cp(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}const up=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;var dp=class extends rp{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>Y(t)||q(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(up(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(Wf(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,lp(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(Wf(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&J(i)?i.value:i:Wf(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!q(t))return!1;let n=t.value;return n==null||e&&J(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return Wf(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(Wf(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,lp(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};const fp=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function pp(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const mp=(e,t,n)=>e.endsWith(`
|
|
4
4
|
`)?pp(n,t):n.includes(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./panel-rpc-BPwAqRch.js";import{$ as t,H as n,d as r,y as i}from"./account-store-BLu0_ipL.js";import{a}from"./diagnostics-DN_idNHx.js";import{c as o,i as s,l as c,n as l,r as u,u as d}from"./claude-model-version-Csn7RPVg.js";import{a as f,r as p,s as m,t as h}from"./legacy-api-aliases-oJPAvhVV.js";import{n as g}from"./llm-session-id-BZyXP_j2.js";import{n as _,t as v}from"./silent-renew-backoff-C_Iv54ZG.js";import{getOAuthPageOrigin as ee}from"./oauth-service-CTntqv0R.js";import{n as y}from"./temperature-support-B4x2xaWY.js";import"./provider-settings-DKXi1uSi.js";var te={proxyEndpoint:`https://adobe-llm-proxy.paolo-moz.workers.dev`,redirectUri:`https://www.sliccy.ai/auth/callback`,extensionRedirectUri:`https://akjjllgokmbgpbdbmafpiefnhidlmbgf.chromiumapp.org/adobe`};function ne(e,t){return l(e,t)}function b(e,t,n){return e!==`xhigh`||!t?e:s(t,n)?`xhigh`:u(t,n)?`max`:`high`}function re(e,t){let n=e?t?.thinkingLevelMap?.[e]:void 0;return b((()=>{if(typeof n==`string`)return n;switch(e){case`minimal`:case`low`:return`low`;case`medium`:return`medium`;case`xhigh`:return`xhigh`;default:return`high`}})(),t?.id,t?.name)}function ie(e,t){return async(n,r)=>{let i=t?await t(n,r)??n:n,a=i.thinking;return a&&a.type===`enabled`&&(i.thinking={type:`adaptive`,...a.display===void 0?{}:{display:a.display}},i.output_config={...i.output_config??{},effort:e}),i}}function x(e,t){if(!ne(e.id,e.name))return t;let n=t,r=b(n.effort??re(n.reasoning,e),e.id,e.name);return{...t,onPayload:ie(r,n.onPayload)}}function ae(e,t){let n={id:e.id,name:e.name??e.id},r=t?.api??e.api,i=t?.context_window??e.context_window,a=t?.max_tokens??e.max_tokens,o=t?.reasoning??e.reasoning,s=t?.input??e.input;r&&(n.api=r),i!==void 0&&(n.context_window=i),a!==void 0&&(n.max_tokens=a),o!==void 0&&(n.reasoning=o),s&&(n.input=s);let c=t?.cost??e.cost;return c&&(n.cost=c),/haiku/i.test(e.id)&&(n.compat={supportsEagerToolInputStreaming:!1}),/sonnet-5\b/i.test(e.id)&&!n.thinkingLevelMap&&(n.thinkingLevelMap={xhigh:`xhigh`}),n}const S=Object.assign({"/packages/webapp/providers/adobe-config.json":te})[`/packages/webapp/providers/adobe-config.json`]??{clientId:``,proxyEndpoint:``,scopes:`openid,profile,email`};function C(){let e=i(`adobe`);if(e)return e.replace(/\/$/,``);if(S.proxyEndpoint)return S.proxyEndpoint.replace(/\/$/,``);throw Error(`Adobe proxy endpoint not configured — set it in Settings or adobe-config.json`)}const w=new Map,T=new Map,E=`slicc-adobe-models`;function D(e){try{localStorage.setItem(E,JSON.stringify(e))}catch{}}async function O(e){let t=w.get(e);if(t)return t;try{let t=await fetch(`${e}/v1/config`,{headers:{[W]:`6.88.0`}});if(t.ok){let n=await t.json();return w.set(e,n),n}console.warn(`[adobe] Proxy /v1/config returned ${t.status}, falling back to build-time config`)}catch(e){console.warn(`[adobe] Failed to fetch proxy config:`,e instanceof Error?e.message:String(e))}return{}}function k(e){let t=e.clientId||S.clientId;if(!t)throw Error(`Could not determine IMS client ID — proxy /v1/config did not return one and adobe-config.json is empty`);return t}function A(e){return e.scopes||S.scopes}function j(e){return e.imsEnvironment||S.imsEnvironment||`prod`}const M={prod:`https://ims-na1.adobelogin.com`,stg1:`https://ims-na1-stg1.adobelogin.com`};function N(e){return M[e??S.imsEnvironment??`prod`]??M.prod}const P=typeof chrome<`u`&&!!chrome?.runtime?.id;function F(){return r().find(e=>e.providerId===`adobe`)}async function oe(e,t){try{let n=await fetch(`${N(t)}/ims/userinfo/v2`,{headers:{Authorization:`Bearer ${e}`}});if(n.ok){let e=await n.json();return{name:e.displayName||e.name||e.email,avatar:e.picture||e.avatar_url}}console.warn(`[adobe] User profile fetch returned ${n.status}, account will have no display name`)}catch(e){console.warn(`[adobe] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function I(e){let t=e.indexOf(`#`);if(t<0)return null;let n=new URLSearchParams(e.slice(t+1)),r=n.get(`access_token`);return r?{accessToken:r,expiresIn:parseInt(n.get(`expires_in`)??`86400`,10),scope:n.get(`scope`)??void 0}:null}const L={id:`adobe`,name:`Adobe`,description:`Claude via Adobe — login with your Adobe ID`,requiresApiKey:!1,requiresBaseUrl:!S.proxyEndpoint,baseUrlPlaceholder:`https://your-proxy.example.com`,baseUrlDescription:`Anthropic-compatible proxy endpoint`,isOAuth:!0,defaultModelId:`sonnet`,oauthTokenDomains:[`ims-na1.adobelogin.com`,`ims-na1-stg1.adobelogin.com`,`*.adobelogin.com`,`*.adobe.io`,`firefall.adobe.io`,`admin.hlx.page`,`admin.hlx.live`,`admin.aem.page`,`admin.aem.live`],getModelIds:()=>{let e=e=>ae(e,T.get(e.id));for(let t of Q.values())if(t.length){let n=t.map(t=>e({id:t.id,name:t.name??t.id,reasoning:t.reasoning,input:t.input,cost:t.cost}));return D(n),n}for(let t of w.values())if(t.models?.length)return t.models.map(t=>e(t));try{let e=localStorage.getItem(E);if(e){let t=JSON.parse(e);if(t.length)return t}}catch{}return[{id:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`}]},onOAuthLogin:async(e,t,r)=>{let i=C(),a=await O(i),o=k(a),s=A(a),c=j(a),l=P?null:await ee(),u=P?null:_({pageHref:l.href,pageOrigin:l.origin,configuredRedirectUri:S.redirectUri},()=>crypto.randomUUID()),d=P?S.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:u.redirectUri,f=u?.oauthState,p=u?.expectedNonce??null,m=new URLSearchParams({client_id:o,scope:s,response_type:`token`,redirect_uri:d});f&&m.set(`state`,f),r?.forceReauth&&m.set(`prompt`,`login`);let h=await e(`${N(c)}/ims/authorize/v2?${m}`);if(!h)return;if(p&&h)try{if(new URL(h).searchParams.get(`nonce`)!==p){console.error(`[adobe] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let g=I(h);if(!g){console.error(`[adobe] Could not extract token from redirect URL`);return}let v=await oe(g.accessToken,c);await n({providerId:`adobe`,accessToken:g.accessToken,tokenExpiresAt:Date.now()+g.expiresIn*1e3,userName:v.name,userAvatar:v.avatar,scopes:g.scope,baseUrl:S.proxyEndpoint?void 0:i}),await $().catch(e=>console.warn(`[adobe] Failed to fetch models after login:`,e instanceof Error?e.message:String(e))),t()},onOAuthLogout:async()=>{let e=F();if(e?.accessToken)try{let t=w.values().next().value??{},n=t.clientId||S.clientId,r=j(t);if(n){let t=await fetch(`${N(r)}/ims/revoke`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({token:e.accessToken,token_type_hint:`access_token`,client_id:n})});t.ok||console.warn(`[adobe] Token revocation returned ${t.status}, token may still be valid server-side`)}}catch(e){console.warn(`[adobe] Failed to revoke token:`,e instanceof Error?e.message:String(e))}await n({providerId:`adobe`,accessToken:``})},onSilentRenew:async()=>F()?.accessToken?B():null,refreshModels:async e=>{await $(e);let t=L.getModelIds?.();t?.length&&D(t)}};let R=null;const se=v();async function z(){let e=F();if(!e?.accessToken)throw Error(`Not logged in to Adobe — please log in first`);if((e.tokenExpiresAt??0)-Date.now()>6e4)return e.accessToken;console.log(`[adobe] Token expired or expiring soon, attempting silent renewal...`);let t=await se.run(()=>B());if(t)return t;let n=F();if((n?.tokenExpiresAt??0)-Date.now()>0&&n?.accessToken)return n.accessToken;throw Error(`Adobe session expired — please log in again`)}function ce(){let e=F();return!e?.tokenExpiresAt||Date.now()>e.tokenExpiresAt-6e4}async function B(){if(typeof window>`u`){let t=e();if(!t)return null;try{let{accessToken:e}=await t.call(`silent-renew`,{providerId:`adobe`},{timeoutMs:13e4});return e}catch(e){return console.warn(`[adobe] worker→page silent-renew bridge failed:`,e instanceof Error?e.message:String(e)),null}}return R||(R=U().finally(()=>{R=null}),R)}function le(e,t){let n=k(t),r=A(t),i=j(t),a=P?null:_({pageHref:window.location.href,pageOrigin:window.location.origin,configuredRedirectUri:S.redirectUri},()=>crypto.randomUUID()),o=P?S.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:a.redirectUri,s=a?.oauthState,c=a?.expectedNonce??null,l=new URLSearchParams({client_id:n,scope:r,response_type:`token`,redirect_uri:o,prompt:`none`});return s&&l.set(`state`,s),{authorizeUrl:`${N(i)}/ims/authorize/v2?${l}`,expectedNonce:c,proxyEndpoint:e}}function V(e,t){if(!t)return!0;try{if(new URL(e).searchParams.get(`nonce`)!==t)return console.error(`[adobe] OAuth nonce mismatch — possible CSRF`),!1}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}return!0}async function H(e,t){let r=F();await n({providerId:`adobe`,accessToken:e.accessToken,tokenExpiresAt:Date.now()+e.expiresIn*1e3,userName:r?.userName,userAvatar:r?.userAvatar,scopes:e.scope,baseUrl:S.proxyEndpoint?void 0:t})}async function U(){try{let e=C(),{authorizeUrl:t,expectedNonce:n}=le(e,await O(e)),{createOAuthLauncher:r}=await import(`./oauth-service-CTntqv0R.js`),i=await r()(t,{interactive:!1});if(!i||!V(i,n))return null;let a=I(i);return a?(await H(a,e),console.log(`[adobe] Token renewed silently`),await $().catch(e=>console.warn(`[adobe] Failed to refresh models after silent renewal:`,e instanceof Error?e.message:String(e))),a.accessToken):null}catch(e){return console.warn(`[adobe] Silent renewal error:`,e instanceof Error?e.message:String(e)),null}}const W=`X-Slicc-Version`;function G(e){let t={};if(e.headers)for(let[n,r]of Object.entries(e.headers))n.toLowerCase()!==`x-slicc-version`&&(t[n]=r);return t[W]=`6.88.0`,{...e,headers:t}}const K=new Set;function q(e,t){if(e.headers){for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()===`x-session-id`&&n!=null)return e}return K.has(t)||(K.add(t),console.warn(`[adobe] Missing X-Session-Id from ${t} — using daily fallback. Attach an X-Session-Id header at the call site (see scoop-context.ts streamWithSessionId or docs/pitfalls.md).`)),{...e,headers:{...e.headers??{},"X-Session-Id":g(`adobe-provider-fallback`)}}}function ue(){K.clear()}function J(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:`adobe-anthropic`,provider:`adobe`,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}const Y=(e,t,n={})=>{let r=a();return(async()=>{try{let i=await z();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${C()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=p(a,t,G(q({...n,apiKey:i},`streamAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:C(),api:`anthropic-messages`},o=h(a,t,G(q(x(e,y(e.id,e.name,{...n,apiKey:i})),`streamAdobe[anthropic]`)));for await(let e of o)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(J(e,t)),r.end()}})(),r},X=(e,t,n)=>{let r=a();return(async()=>{try{let i=await z();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${C()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=m(a,t,G(q({...n,apiKey:i},`streamSimpleAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:C(),api:`anthropic-messages`},o=f(a,t,G(q(x(e,y(e.id,e.name,{...n,apiKey:i})),`streamSimpleAdobe[anthropic]`)));for await(let e of o)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(J(e,t)),r.end()}})(),r};function de(e){let t={id:e.id,name:e.name};return e.api!==void 0&&(t.api=e.api),e.context_window!==void 0&&(t.context_window=e.context_window),e.max_tokens!==void 0&&(t.max_tokens=e.max_tokens),e.reasoning!==void 0&&(t.reasoning=e.reasoning),e.input!==void 0&&(t.input=e.input),t}function Z(){let e=new Map;for(let t of c())try{for(let n of o(t))e.set(n.id,n)}catch{}return e}function fe(e,n,r){let i=`adobe-${e.api===`openai`?`openai`:`anthropic`}`,a=r.get(e.id);if(a)return{...a,provider:`adobe`,api:i};let o=t(e.id,r);return{id:e.id,name:e.name??e.id,provider:`adobe`,api:i,baseUrl:n,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:o,inputCost:o.input,outputCost:o.output,cacheReadCost:o.cacheRead,cacheWriteCost:o.cacheWrite,reasoning:!0}}function pe(e,t){for(let t of e)T.set(t.id,de(t));let n=Z();return e.map(e=>fe(e,t,n))}async function me(e){try{let t=e??await z(),n=C(),r=await fetch(`${n}/v1/models`,{headers:{Authorization:`Bearer ${t}`,[W]:`6.88.0`}});if(!r.ok)console.warn(`[adobe] Proxy /v1/models returned ${r.status}, falling back to Anthropic models`);else{let e=await r.json();if(e.data?.length)return pe(e.data,n)}}catch(e){console.warn(`[adobe] Failed to fetch proxy models:`,e instanceof Error?e.message:String(e))}return null}const Q=new Map;function he(){return o(`anthropic`).map(e=>({...e,provider:`adobe`,api:`adobe-anthropic`}))}async function $(e){let t=C(),n=Q.get(t);if(n)return n;let r=await me(e);return r?(Q.set(t,r),r):he()}function ge(){d({api:`adobe-anthropic`,stream:Y,streamSimple:X}),d({api:`adobe-openai`,stream:Y,streamSimple:X})}export{ue as __resetAdobeSessionIdWarningCacheForTests,L as config,I as extractTokenFromUrl,$ as getAdobeModels,z as getValidAccessToken,ce as isTokenExpired,ge as register};
|
|
1
|
+
import{n as e}from"./panel-rpc-BPwAqRch.js";import{$ as t,H as n,d as r,y as i}from"./account-store-CYz2dZdk.js";import{a}from"./diagnostics-DN_idNHx.js";import{c as o,i as s,l as c,n as l,r as u,u as d}from"./claude-model-version-Csn7RPVg.js";import{a as f,r as p,s as m,t as h}from"./legacy-api-aliases-oJPAvhVV.js";import{n as g}from"./llm-session-id-BZyXP_j2.js";import{n as _,t as v}from"./silent-renew-backoff-C_Iv54ZG.js";import{getOAuthPageOrigin as ee}from"./oauth-service-CTntqv0R.js";import{n as y}from"./temperature-support-B4x2xaWY.js";import"./provider-settings-CR96H2hU.js";var te={proxyEndpoint:`https://adobe-llm-proxy.paolo-moz.workers.dev`,redirectUri:`https://www.sliccy.ai/auth/callback`,extensionRedirectUri:`https://akjjllgokmbgpbdbmafpiefnhidlmbgf.chromiumapp.org/adobe`};function ne(e,t){return l(e,t)}function b(e,t,n){return e!==`xhigh`||!t?e:s(t,n)?`xhigh`:u(t,n)?`max`:`high`}function re(e,t){let n=e?t?.thinkingLevelMap?.[e]:void 0;return b((()=>{if(typeof n==`string`)return n;switch(e){case`minimal`:case`low`:return`low`;case`medium`:return`medium`;case`xhigh`:return`xhigh`;default:return`high`}})(),t?.id,t?.name)}function ie(e,t){return async(n,r)=>{let i=t?await t(n,r)??n:n,a=i.thinking;return a&&a.type===`enabled`&&(i.thinking={type:`adaptive`,...a.display===void 0?{}:{display:a.display}},i.output_config={...i.output_config??{},effort:e}),i}}function x(e,t){if(!ne(e.id,e.name))return t;let n=t,r=b(n.effort??re(n.reasoning,e),e.id,e.name);return{...t,onPayload:ie(r,n.onPayload)}}function ae(e,t){let n={id:e.id,name:e.name??e.id},r=t?.api??e.api,i=t?.context_window??e.context_window,a=t?.max_tokens??e.max_tokens,o=t?.reasoning??e.reasoning,s=t?.input??e.input;r&&(n.api=r),i!==void 0&&(n.context_window=i),a!==void 0&&(n.max_tokens=a),o!==void 0&&(n.reasoning=o),s&&(n.input=s);let c=t?.cost??e.cost;return c&&(n.cost=c),/haiku/i.test(e.id)&&(n.compat={supportsEagerToolInputStreaming:!1}),/sonnet-5\b/i.test(e.id)&&!n.thinkingLevelMap&&(n.thinkingLevelMap={xhigh:`xhigh`}),n}const S=Object.assign({"/packages/webapp/providers/adobe-config.json":te})[`/packages/webapp/providers/adobe-config.json`]??{clientId:``,proxyEndpoint:``,scopes:`openid,profile,email`};function C(){let e=i(`adobe`);if(e)return e.replace(/\/$/,``);if(S.proxyEndpoint)return S.proxyEndpoint.replace(/\/$/,``);throw Error(`Adobe proxy endpoint not configured — set it in Settings or adobe-config.json`)}const w=new Map,T=new Map,E=`slicc-adobe-models`;function D(e){try{localStorage.setItem(E,JSON.stringify(e))}catch{}}async function O(e){let t=w.get(e);if(t)return t;try{let t=await fetch(`${e}/v1/config`,{headers:{[W]:`6.89.0`}});if(t.ok){let n=await t.json();return w.set(e,n),n}console.warn(`[adobe] Proxy /v1/config returned ${t.status}, falling back to build-time config`)}catch(e){console.warn(`[adobe] Failed to fetch proxy config:`,e instanceof Error?e.message:String(e))}return{}}function k(e){let t=e.clientId||S.clientId;if(!t)throw Error(`Could not determine IMS client ID — proxy /v1/config did not return one and adobe-config.json is empty`);return t}function A(e){return e.scopes||S.scopes}function j(e){return e.imsEnvironment||S.imsEnvironment||`prod`}const M={prod:`https://ims-na1.adobelogin.com`,stg1:`https://ims-na1-stg1.adobelogin.com`};function N(e){return M[e??S.imsEnvironment??`prod`]??M.prod}const P=typeof chrome<`u`&&!!chrome?.runtime?.id;function F(){return r().find(e=>e.providerId===`adobe`)}async function oe(e,t){try{let n=await fetch(`${N(t)}/ims/userinfo/v2`,{headers:{Authorization:`Bearer ${e}`}});if(n.ok){let e=await n.json();return{name:e.displayName||e.name||e.email,avatar:e.picture||e.avatar_url}}console.warn(`[adobe] User profile fetch returned ${n.status}, account will have no display name`)}catch(e){console.warn(`[adobe] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function I(e){let t=e.indexOf(`#`);if(t<0)return null;let n=new URLSearchParams(e.slice(t+1)),r=n.get(`access_token`);return r?{accessToken:r,expiresIn:parseInt(n.get(`expires_in`)??`86400`,10),scope:n.get(`scope`)??void 0}:null}const L={id:`adobe`,name:`Adobe`,description:`Claude via Adobe — login with your Adobe ID`,requiresApiKey:!1,requiresBaseUrl:!S.proxyEndpoint,baseUrlPlaceholder:`https://your-proxy.example.com`,baseUrlDescription:`Anthropic-compatible proxy endpoint`,isOAuth:!0,defaultModelId:`sonnet`,oauthTokenDomains:[`ims-na1.adobelogin.com`,`ims-na1-stg1.adobelogin.com`,`*.adobelogin.com`,`*.adobe.io`,`firefall.adobe.io`,`admin.hlx.page`,`admin.hlx.live`,`admin.aem.page`,`admin.aem.live`],getModelIds:()=>{let e=e=>ae(e,T.get(e.id));for(let t of Q.values())if(t.length){let n=t.map(t=>e({id:t.id,name:t.name??t.id,reasoning:t.reasoning,input:t.input,cost:t.cost}));return D(n),n}for(let t of w.values())if(t.models?.length)return t.models.map(t=>e(t));try{let e=localStorage.getItem(E);if(e){let t=JSON.parse(e);if(t.length)return t}}catch{}return[{id:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`}]},onOAuthLogin:async(e,t,r)=>{let i=C(),a=await O(i),o=k(a),s=A(a),c=j(a),l=P?null:await ee(),u=P?null:_({pageHref:l.href,pageOrigin:l.origin,configuredRedirectUri:S.redirectUri},()=>crypto.randomUUID()),d=P?S.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:u.redirectUri,f=u?.oauthState,p=u?.expectedNonce??null,m=new URLSearchParams({client_id:o,scope:s,response_type:`token`,redirect_uri:d});f&&m.set(`state`,f),r?.forceReauth&&m.set(`prompt`,`login`);let h=await e(`${N(c)}/ims/authorize/v2?${m}`);if(!h)return;if(p&&h)try{if(new URL(h).searchParams.get(`nonce`)!==p){console.error(`[adobe] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let g=I(h);if(!g){console.error(`[adobe] Could not extract token from redirect URL`);return}let v=await oe(g.accessToken,c);await n({providerId:`adobe`,accessToken:g.accessToken,tokenExpiresAt:Date.now()+g.expiresIn*1e3,userName:v.name,userAvatar:v.avatar,scopes:g.scope,baseUrl:S.proxyEndpoint?void 0:i}),await $().catch(e=>console.warn(`[adobe] Failed to fetch models after login:`,e instanceof Error?e.message:String(e))),t()},onOAuthLogout:async()=>{let e=F();if(e?.accessToken)try{let t=w.values().next().value??{},n=t.clientId||S.clientId,r=j(t);if(n){let t=await fetch(`${N(r)}/ims/revoke`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({token:e.accessToken,token_type_hint:`access_token`,client_id:n})});t.ok||console.warn(`[adobe] Token revocation returned ${t.status}, token may still be valid server-side`)}}catch(e){console.warn(`[adobe] Failed to revoke token:`,e instanceof Error?e.message:String(e))}await n({providerId:`adobe`,accessToken:``})},onSilentRenew:async()=>F()?.accessToken?B():null,refreshModels:async e=>{await $(e);let t=L.getModelIds?.();t?.length&&D(t)}};let R=null;const se=v();async function z(){let e=F();if(!e?.accessToken)throw Error(`Not logged in to Adobe — please log in first`);if((e.tokenExpiresAt??0)-Date.now()>6e4)return e.accessToken;console.log(`[adobe] Token expired or expiring soon, attempting silent renewal...`);let t=await se.run(()=>B());if(t)return t;let n=F();if((n?.tokenExpiresAt??0)-Date.now()>0&&n?.accessToken)return n.accessToken;throw Error(`Adobe session expired — please log in again`)}function ce(){let e=F();return!e?.tokenExpiresAt||Date.now()>e.tokenExpiresAt-6e4}async function B(){if(typeof window>`u`){let t=e();if(!t)return null;try{let{accessToken:e}=await t.call(`silent-renew`,{providerId:`adobe`},{timeoutMs:13e4});return e}catch(e){return console.warn(`[adobe] worker→page silent-renew bridge failed:`,e instanceof Error?e.message:String(e)),null}}return R||(R=U().finally(()=>{R=null}),R)}function le(e,t){let n=k(t),r=A(t),i=j(t),a=P?null:_({pageHref:window.location.href,pageOrigin:window.location.origin,configuredRedirectUri:S.redirectUri},()=>crypto.randomUUID()),o=P?S.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:a.redirectUri,s=a?.oauthState,c=a?.expectedNonce??null,l=new URLSearchParams({client_id:n,scope:r,response_type:`token`,redirect_uri:o,prompt:`none`});return s&&l.set(`state`,s),{authorizeUrl:`${N(i)}/ims/authorize/v2?${l}`,expectedNonce:c,proxyEndpoint:e}}function V(e,t){if(!t)return!0;try{if(new URL(e).searchParams.get(`nonce`)!==t)return console.error(`[adobe] OAuth nonce mismatch — possible CSRF`),!1}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}return!0}async function H(e,t){let r=F();await n({providerId:`adobe`,accessToken:e.accessToken,tokenExpiresAt:Date.now()+e.expiresIn*1e3,userName:r?.userName,userAvatar:r?.userAvatar,scopes:e.scope,baseUrl:S.proxyEndpoint?void 0:t})}async function U(){try{let e=C(),{authorizeUrl:t,expectedNonce:n}=le(e,await O(e)),{createOAuthLauncher:r}=await import(`./oauth-service-CTntqv0R.js`),i=await r()(t,{interactive:!1});if(!i||!V(i,n))return null;let a=I(i);return a?(await H(a,e),console.log(`[adobe] Token renewed silently`),await $().catch(e=>console.warn(`[adobe] Failed to refresh models after silent renewal:`,e instanceof Error?e.message:String(e))),a.accessToken):null}catch(e){return console.warn(`[adobe] Silent renewal error:`,e instanceof Error?e.message:String(e)),null}}const W=`X-Slicc-Version`;function G(e){let t={};if(e.headers)for(let[n,r]of Object.entries(e.headers))n.toLowerCase()!==`x-slicc-version`&&(t[n]=r);return t[W]=`6.89.0`,{...e,headers:t}}const K=new Set;function q(e,t){if(e.headers){for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()===`x-session-id`&&n!=null)return e}return K.has(t)||(K.add(t),console.warn(`[adobe] Missing X-Session-Id from ${t} — using daily fallback. Attach an X-Session-Id header at the call site (see scoop-context.ts streamWithSessionId or docs/pitfalls.md).`)),{...e,headers:{...e.headers??{},"X-Session-Id":g(`adobe-provider-fallback`)}}}function ue(){K.clear()}function J(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:`adobe-anthropic`,provider:`adobe`,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}const Y=(e,t,n={})=>{let r=a();return(async()=>{try{let i=await z();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${C()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=p(a,t,G(q({...n,apiKey:i},`streamAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:C(),api:`anthropic-messages`},o=h(a,t,G(q(x(e,y(e.id,e.name,{...n,apiKey:i})),`streamAdobe[anthropic]`)));for await(let e of o)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(J(e,t)),r.end()}})(),r},X=(e,t,n)=>{let r=a();return(async()=>{try{let i=await z();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${C()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=m(a,t,G(q({...n,apiKey:i},`streamSimpleAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:C(),api:`anthropic-messages`},o=f(a,t,G(q(x(e,y(e.id,e.name,{...n,apiKey:i})),`streamSimpleAdobe[anthropic]`)));for await(let e of o)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(J(e,t)),r.end()}})(),r};function de(e){let t={id:e.id,name:e.name};return e.api!==void 0&&(t.api=e.api),e.context_window!==void 0&&(t.context_window=e.context_window),e.max_tokens!==void 0&&(t.max_tokens=e.max_tokens),e.reasoning!==void 0&&(t.reasoning=e.reasoning),e.input!==void 0&&(t.input=e.input),t}function Z(){let e=new Map;for(let t of c())try{for(let n of o(t))e.set(n.id,n)}catch{}return e}function fe(e,n,r){let i=`adobe-${e.api===`openai`?`openai`:`anthropic`}`,a=r.get(e.id);if(a)return{...a,provider:`adobe`,api:i};let o=t(e.id,r);return{id:e.id,name:e.name??e.id,provider:`adobe`,api:i,baseUrl:n,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:o,inputCost:o.input,outputCost:o.output,cacheReadCost:o.cacheRead,cacheWriteCost:o.cacheWrite,reasoning:!0}}function pe(e,t){for(let t of e)T.set(t.id,de(t));let n=Z();return e.map(e=>fe(e,t,n))}async function me(e){try{let t=e??await z(),n=C(),r=await fetch(`${n}/v1/models`,{headers:{Authorization:`Bearer ${t}`,[W]:`6.89.0`}});if(!r.ok)console.warn(`[adobe] Proxy /v1/models returned ${r.status}, falling back to Anthropic models`);else{let e=await r.json();if(e.data?.length)return pe(e.data,n)}}catch(e){console.warn(`[adobe] Failed to fetch proxy models:`,e instanceof Error?e.message:String(e))}return null}const Q=new Map;function he(){return o(`anthropic`).map(e=>({...e,provider:`adobe`,api:`adobe-anthropic`}))}async function $(e){let t=C(),n=Q.get(t);if(n)return n;let r=await me(e);return r?(Q.set(t,r),r):he()}function ge(){d({api:`adobe-anthropic`,stream:Y,streamSimple:X}),d({api:`adobe-openai`,stream:Y,streamSimple:X})}export{ue as __resetAdobeSessionIdWarningCacheForTests,L as config,I as extractTokenFromUrl,$ as getAdobeModels,z as getValidAccessToken,ce as isTokenExpired,ge as register};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/oauth-service-Uk8UIb05.js","assets/preload-helper-Czpn1I53.js","assets/proxied-fetch-BGeNrvQ4.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/base64-DpPqYZJF.js","assets/src-CAWTvdAa.js","assets/runtime-env-Dlaokqg1.js","assets/fetch-body-D2PwksUW.js","assets/api-endpoint-GRCyib6X.js","assets/runtime-env-CgsZ7LTp.js","assets/runtime-env-E-i2SW1s.js","assets/panel-rpc-B3MSVImO.js","assets/permissions-surface-registry-CilCRwhh.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{H as e,Y as t,d as n,y as r}from"./account-store-l8BmmoRx.js";import{a as i}from"./diagnostics-DN_idNHx.js";import{t as a}from"./preload-helper-Czpn1I53.js";import{c as o,i as s,l as c,n as l,r as u,u as d}from"./claude-model-version-DoVrYsKi.js";import{a as f,r as p,s as m,t as h}from"./legacy-api-aliases-BnRqMAef.js";import{n as g,t as _}from"./silent-renew-backoff-t_Cd4Zw7.js";import{t as v}from"./panel-rpc-B3MSVImO.js";import"./provider-settings-DZxqnVAO.js";import{getOAuthPageOrigin as ee}from"./oauth-service-Uk8UIb05.js";import{n as y}from"./temperature-support-Cpml9LfI.js";import{t as b}from"./llm-session-id-bZQs6gBN.js";var te={proxyEndpoint:`https://adobe-llm-proxy.paolo-moz.workers.dev`,redirectUri:`https://www.sliccy.ai/auth/callback`,extensionRedirectUri:`https://akjjllgokmbgpbdbmafpiefnhidlmbgf.chromiumapp.org/adobe`};function ne(e,t){return l(e,t)}function x(e,t,n){return e!==`xhigh`||!t?e:s(t,n)?`xhigh`:u(t,n)?`max`:`high`}function re(e,t){let n=e?t?.thinkingLevelMap?.[e]:void 0;return x((()=>{if(typeof n==`string`)return n;switch(e){case`minimal`:case`low`:return`low`;case`medium`:return`medium`;case`xhigh`:return`xhigh`;default:return`high`}})(),t?.id,t?.name)}function ie(e,t){return async(n,r)=>{let i=t?await t(n,r)??n:n,a=i.thinking;return a&&a.type===`enabled`&&(i.thinking={type:`adaptive`,...a.display===void 0?{}:{display:a.display}},i.output_config={...i.output_config??{},effort:e}),i}}function S(e,t){if(!ne(e.id,e.name))return t;let n=t,r=x(n.effort??re(n.reasoning,e),e.id,e.name);return{...t,onPayload:ie(r,n.onPayload)}}function ae(e,t){let n={id:e.id,name:e.name??e.id},r=t?.api??e.api,i=t?.context_window??e.context_window,a=t?.max_tokens??e.max_tokens,o=t?.reasoning??e.reasoning,s=t?.input??e.input;r&&(n.api=r),i!==void 0&&(n.context_window=i),a!==void 0&&(n.max_tokens=a),o!==void 0&&(n.reasoning=o),s&&(n.input=s);let c=t?.cost??e.cost;return c&&(n.cost=c),/haiku/i.test(e.id)&&(n.compat={supportsEagerToolInputStreaming:!1}),/sonnet-5\b/i.test(e.id)&&!n.thinkingLevelMap&&(n.thinkingLevelMap={xhigh:`xhigh`}),n}var C=Object.assign({"/packages/webapp/providers/adobe-config.json":te})[`/packages/webapp/providers/adobe-config.json`]??{clientId:``,proxyEndpoint:``,scopes:`openid,profile,email`};function w(){let e=r(`adobe`);if(e)return e.replace(/\/$/,``);if(C.proxyEndpoint)return C.proxyEndpoint.replace(/\/$/,``);throw Error(`Adobe proxy endpoint not configured — set it in Settings or adobe-config.json`)}var T=new Map,E=new Map,D=`slicc-adobe-models`;function O(e){try{localStorage.setItem(D,JSON.stringify(e))}catch{}}async function k(e){let t=T.get(e);if(t)return t;try{let t=await fetch(`${e}/v1/config`,{headers:{[G]:`6.88.0`}});if(t.ok){let n=await t.json();return T.set(e,n),n}console.warn(`[adobe] Proxy /v1/config returned ${t.status}, falling back to build-time config`)}catch(e){console.warn(`[adobe] Failed to fetch proxy config:`,e instanceof Error?e.message:String(e))}return{}}function A(e){let t=e.clientId||C.clientId;if(!t)throw Error(`Could not determine IMS client ID — proxy /v1/config did not return one and adobe-config.json is empty`);return t}function j(e){return e.scopes||C.scopes}function M(e){return e.imsEnvironment||C.imsEnvironment||`prod`}var N={prod:`https://ims-na1.adobelogin.com`,stg1:`https://ims-na1-stg1.adobelogin.com`};function P(e){return N[e??C.imsEnvironment??`prod`]??N.prod}var F=typeof chrome<`u`&&!!chrome?.runtime?.id;function I(){return n().find(e=>e.providerId===`adobe`)}async function oe(e,t){try{let n=await fetch(`${P(t)}/ims/userinfo/v2`,{headers:{Authorization:`Bearer ${e}`}});if(n.ok){let e=await n.json();return{name:e.displayName||e.name||e.email,avatar:e.picture||e.avatar_url}}console.warn(`[adobe] User profile fetch returned ${n.status}, account will have no display name`)}catch(e){console.warn(`[adobe] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function L(e){let t=e.indexOf(`#`);if(t<0)return null;let n=new URLSearchParams(e.slice(t+1)),r=n.get(`access_token`);return r?{accessToken:r,expiresIn:parseInt(n.get(`expires_in`)??`86400`,10),scope:n.get(`scope`)??void 0}:null}var R={id:`adobe`,name:`Adobe`,description:`Claude via Adobe — login with your Adobe ID`,requiresApiKey:!1,requiresBaseUrl:!C.proxyEndpoint,baseUrlPlaceholder:`https://your-proxy.example.com`,baseUrlDescription:`Anthropic-compatible proxy endpoint`,isOAuth:!0,defaultModelId:`sonnet`,oauthTokenDomains:[`ims-na1.adobelogin.com`,`ims-na1-stg1.adobelogin.com`,`*.adobelogin.com`,`*.adobe.io`,`firefall.adobe.io`,`admin.hlx.page`,`admin.hlx.live`,`admin.aem.page`,`admin.aem.live`],getModelIds:()=>{let e=e=>ae(e,E.get(e.id));for(let t of Q.values())if(t.length){let n=t.map(t=>e({id:t.id,name:t.name??t.id,reasoning:t.reasoning,input:t.input,cost:t.cost}));return O(n),n}for(let t of T.values())if(t.models?.length)return t.models.map(t=>e(t));try{let e=localStorage.getItem(D);if(e){let t=JSON.parse(e);if(t.length)return t}}catch{}return[{id:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`}]},onOAuthLogin:async(t,n,r)=>{let i=w(),a=await k(i),o=A(a),s=j(a),c=M(a),l=F?null:await ee(),u=F?null:g({pageHref:l.href,pageOrigin:l.origin,configuredRedirectUri:C.redirectUri},()=>crypto.randomUUID()),d=F?C.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:u.redirectUri,f=u?.oauthState,p=u?.expectedNonce??null,m=new URLSearchParams({client_id:o,scope:s,response_type:`token`,redirect_uri:d});f&&m.set(`state`,f),r?.forceReauth&&m.set(`prompt`,`login`);let h=await t(`${P(c)}/ims/authorize/v2?${m}`);if(!h)return;if(p&&h)try{if(new URL(h).searchParams.get(`nonce`)!==p){console.error(`[adobe] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let _=L(h);if(!_){console.error(`[adobe] Could not extract token from redirect URL`);return}let v=await oe(_.accessToken,c);await e({providerId:`adobe`,accessToken:_.accessToken,tokenExpiresAt:Date.now()+_.expiresIn*1e3,userName:v.name,userAvatar:v.avatar,scopes:_.scope,baseUrl:C.proxyEndpoint?void 0:i}),await $().catch(e=>console.warn(`[adobe] Failed to fetch models after login:`,e instanceof Error?e.message:String(e))),n()},onOAuthLogout:async()=>{let t=I();if(t?.accessToken)try{let e=T.values().next().value??{},n=e.clientId||C.clientId,r=M(e);if(n){let e=await fetch(`${P(r)}/ims/revoke`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({token:t.accessToken,token_type_hint:`access_token`,client_id:n})});e.ok||console.warn(`[adobe] Token revocation returned ${e.status}, token may still be valid server-side`)}}catch(e){console.warn(`[adobe] Failed to revoke token:`,e instanceof Error?e.message:String(e))}await e({providerId:`adobe`,accessToken:``})},onSilentRenew:async()=>I()?.accessToken?V():null,refreshModels:async e=>{await $(e);let t=R.getModelIds?.();t?.length&&O(t)}},z=null,se=_();async function B(){let e=I();if(!e?.accessToken)throw Error(`Not logged in to Adobe — please log in first`);if((e.tokenExpiresAt??0)-Date.now()>6e4)return e.accessToken;console.log(`[adobe] Token expired or expiring soon, attempting silent renewal...`);let t=await se.run(()=>V());if(t)return t;let n=I();if((n?.tokenExpiresAt??0)-Date.now()>0&&n?.accessToken)return n.accessToken;throw Error(`Adobe session expired — please log in again`)}function ce(){let e=I();return!e?.tokenExpiresAt||Date.now()>e.tokenExpiresAt-6e4}async function V(){if(typeof window>`u`){let e=v();if(!e)return null;try{let{accessToken:t}=await e.call(`silent-renew`,{providerId:`adobe`},{timeoutMs:13e4});return t}catch(e){return console.warn(`[adobe] worker→page silent-renew bridge failed:`,e instanceof Error?e.message:String(e)),null}}return z||(z=le().finally(()=>{z=null}),z)}function H(e,t){let n=A(t),r=j(t),i=M(t),a=F?null:g({pageHref:window.location.href,pageOrigin:window.location.origin,configuredRedirectUri:C.redirectUri},()=>crypto.randomUUID()),o=F?C.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:a.redirectUri,s=a?.oauthState,c=a?.expectedNonce??null,l=new URLSearchParams({client_id:n,scope:r,response_type:`token`,redirect_uri:o,prompt:`none`});return s&&l.set(`state`,s),{authorizeUrl:`${P(i)}/ims/authorize/v2?${l}`,expectedNonce:c,proxyEndpoint:e}}function U(e,t){if(!t)return!0;try{if(new URL(e).searchParams.get(`nonce`)!==t)return console.error(`[adobe] OAuth nonce mismatch — possible CSRF`),!1}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}return!0}async function W(t,n){let r=I();await e({providerId:`adobe`,accessToken:t.accessToken,tokenExpiresAt:Date.now()+t.expiresIn*1e3,userName:r?.userName,userAvatar:r?.userAvatar,scopes:t.scope,baseUrl:C.proxyEndpoint?void 0:n})}async function le(){try{let e=w(),{authorizeUrl:t,expectedNonce:n}=H(e,await k(e)),{createOAuthLauncher:r}=await a(async()=>{let{createOAuthLauncher:e}=await import(`./oauth-service-Uk8UIb05.js`);return{createOAuthLauncher:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])),i=await r()(t,{interactive:!1});if(!i||!U(i,n))return null;let o=L(i);return o?(await W(o,e),console.log(`[adobe] Token renewed silently`),await $().catch(e=>console.warn(`[adobe] Failed to refresh models after silent renewal:`,e instanceof Error?e.message:String(e))),o.accessToken):null}catch(e){return console.warn(`[adobe] Silent renewal error:`,e instanceof Error?e.message:String(e)),null}}var G=`X-Slicc-Version`;function K(e){let t={},n=G.toLowerCase();if(e.headers)for(let[r,i]of Object.entries(e.headers))r.toLowerCase()!==n&&(t[r]=i);return t[G]=`6.88.0`,{...e,headers:t}}var ue=`adobe-provider-fallback`,q=new Set;function J(e,t){if(e.headers){for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()===`x-session-id`&&n!=null)return e}return q.has(t)||(q.add(t),console.warn(`[adobe] Missing X-Session-Id from ${t} — using daily fallback. Attach an X-Session-Id header at the call site (see scoop-context.ts streamWithSessionId or docs/pitfalls.md).`)),{...e,headers:{...e.headers??{},"X-Session-Id":b(ue)}}}function de(){q.clear()}function Y(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:`adobe-anthropic`,provider:`adobe`,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}var X=(e,t,n={})=>{let r=i();return(async()=>{try{let i=await B();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${w()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=p(a,t,K(J({...n,apiKey:i},`streamAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:w(),api:`anthropic-messages`},o=h(a,t,K(J(S(e,y(e.id,e.name,{...n,apiKey:i})),`streamAdobe[anthropic]`)));for await(let e of o)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(Y(e,t)),r.end()}})(),r},Z=(e,t,n)=>{let r=i();return(async()=>{try{let i=await B();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${w()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=m(a,t,K(J({...n,apiKey:i},`streamSimpleAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:w(),api:`anthropic-messages`},o=f(a,t,K(J(S(e,y(e.id,e.name,{...n,apiKey:i})),`streamSimpleAdobe[anthropic]`)));for await(let e of o)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(Y(e,t)),r.end()}})(),r};function fe(e){let t={id:e.id,name:e.name};return e.api!==void 0&&(t.api=e.api),e.context_window!==void 0&&(t.context_window=e.context_window),e.max_tokens!==void 0&&(t.max_tokens=e.max_tokens),e.reasoning!==void 0&&(t.reasoning=e.reasoning),e.input!==void 0&&(t.input=e.input),t}function pe(){let e=new Map;for(let t of c())try{for(let n of o(t))e.set(n.id,n)}catch{}return e}function me(e,n,r){let i=`adobe-${e.api===`openai`?`openai`:`anthropic`}`,a=r.get(e.id);if(a)return{...a,provider:`adobe`,api:i};let o=t(e.id,r);return{id:e.id,name:e.name??e.id,provider:`adobe`,api:i,baseUrl:n,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:o,inputCost:o.input,outputCost:o.output,cacheReadCost:o.cacheRead,cacheWriteCost:o.cacheWrite,reasoning:!0}}function he(e,t){for(let t of e)E.set(t.id,fe(t));let n=pe();return e.map(e=>me(e,t,n))}async function ge(e){try{let t=e??await B(),n=w(),r=await fetch(`${n}/v1/models`,{headers:{Authorization:`Bearer ${t}`,[G]:`6.88.0`}});if(!r.ok)console.warn(`[adobe] Proxy /v1/models returned ${r.status}, falling back to Anthropic models`);else{let e=await r.json();if(e.data?.length)return he(e.data,n)}}catch(e){console.warn(`[adobe] Failed to fetch proxy models:`,e instanceof Error?e.message:String(e))}return null}var Q=new Map;function _e(){return o(`anthropic`).map(e=>({...e,provider:`adobe`,api:`adobe-anthropic`}))}async function $(e){let t=w(),n=Q.get(t);if(n)return n;let r=await ge(e);return r?(Q.set(t,r),r):_e()}function ve(){d({api:`adobe-anthropic`,stream:X,streamSimple:Z}),d({api:`adobe-openai`,stream:X,streamSimple:Z})}export{de as __resetAdobeSessionIdWarningCacheForTests,R as config,L as extractTokenFromUrl,$ as getAdobeModels,B as getValidAccessToken,ce as isTokenExpired,ve as register};
|
|
2
|
+
import{H as e,Y as t,d as n,y as r}from"./account-store-Bo-yhxpr.js";import{a as i}from"./diagnostics-DN_idNHx.js";import{t as a}from"./preload-helper-Czpn1I53.js";import{c as o,i as s,l as c,n as l,r as u,u as d}from"./claude-model-version-DoVrYsKi.js";import{a as f,r as p,s as m,t as h}from"./legacy-api-aliases-BnRqMAef.js";import{n as g,t as _}from"./silent-renew-backoff-t_Cd4Zw7.js";import{t as v}from"./panel-rpc-B3MSVImO.js";import"./provider-settings-DNJS-V3F.js";import{getOAuthPageOrigin as ee}from"./oauth-service-Uk8UIb05.js";import{n as y}from"./temperature-support-Cpml9LfI.js";import{t as b}from"./llm-session-id-bZQs6gBN.js";var te={proxyEndpoint:`https://adobe-llm-proxy.paolo-moz.workers.dev`,redirectUri:`https://www.sliccy.ai/auth/callback`,extensionRedirectUri:`https://akjjllgokmbgpbdbmafpiefnhidlmbgf.chromiumapp.org/adobe`};function ne(e,t){return l(e,t)}function x(e,t,n){return e!==`xhigh`||!t?e:s(t,n)?`xhigh`:u(t,n)?`max`:`high`}function re(e,t){let n=e?t?.thinkingLevelMap?.[e]:void 0;return x((()=>{if(typeof n==`string`)return n;switch(e){case`minimal`:case`low`:return`low`;case`medium`:return`medium`;case`xhigh`:return`xhigh`;default:return`high`}})(),t?.id,t?.name)}function ie(e,t){return async(n,r)=>{let i=t?await t(n,r)??n:n,a=i.thinking;return a&&a.type===`enabled`&&(i.thinking={type:`adaptive`,...a.display===void 0?{}:{display:a.display}},i.output_config={...i.output_config??{},effort:e}),i}}function S(e,t){if(!ne(e.id,e.name))return t;let n=t,r=x(n.effort??re(n.reasoning,e),e.id,e.name);return{...t,onPayload:ie(r,n.onPayload)}}function ae(e,t){let n={id:e.id,name:e.name??e.id},r=t?.api??e.api,i=t?.context_window??e.context_window,a=t?.max_tokens??e.max_tokens,o=t?.reasoning??e.reasoning,s=t?.input??e.input;r&&(n.api=r),i!==void 0&&(n.context_window=i),a!==void 0&&(n.max_tokens=a),o!==void 0&&(n.reasoning=o),s&&(n.input=s);let c=t?.cost??e.cost;return c&&(n.cost=c),/haiku/i.test(e.id)&&(n.compat={supportsEagerToolInputStreaming:!1}),/sonnet-5\b/i.test(e.id)&&!n.thinkingLevelMap&&(n.thinkingLevelMap={xhigh:`xhigh`}),n}var C=Object.assign({"/packages/webapp/providers/adobe-config.json":te})[`/packages/webapp/providers/adobe-config.json`]??{clientId:``,proxyEndpoint:``,scopes:`openid,profile,email`};function w(){let e=r(`adobe`);if(e)return e.replace(/\/$/,``);if(C.proxyEndpoint)return C.proxyEndpoint.replace(/\/$/,``);throw Error(`Adobe proxy endpoint not configured — set it in Settings or adobe-config.json`)}var T=new Map,E=new Map,D=`slicc-adobe-models`;function O(e){try{localStorage.setItem(D,JSON.stringify(e))}catch{}}async function k(e){let t=T.get(e);if(t)return t;try{let t=await fetch(`${e}/v1/config`,{headers:{[G]:`6.89.0`}});if(t.ok){let n=await t.json();return T.set(e,n),n}console.warn(`[adobe] Proxy /v1/config returned ${t.status}, falling back to build-time config`)}catch(e){console.warn(`[adobe] Failed to fetch proxy config:`,e instanceof Error?e.message:String(e))}return{}}function A(e){let t=e.clientId||C.clientId;if(!t)throw Error(`Could not determine IMS client ID — proxy /v1/config did not return one and adobe-config.json is empty`);return t}function j(e){return e.scopes||C.scopes}function M(e){return e.imsEnvironment||C.imsEnvironment||`prod`}var N={prod:`https://ims-na1.adobelogin.com`,stg1:`https://ims-na1-stg1.adobelogin.com`};function P(e){return N[e??C.imsEnvironment??`prod`]??N.prod}var F=typeof chrome<`u`&&!!chrome?.runtime?.id;function I(){return n().find(e=>e.providerId===`adobe`)}async function oe(e,t){try{let n=await fetch(`${P(t)}/ims/userinfo/v2`,{headers:{Authorization:`Bearer ${e}`}});if(n.ok){let e=await n.json();return{name:e.displayName||e.name||e.email,avatar:e.picture||e.avatar_url}}console.warn(`[adobe] User profile fetch returned ${n.status}, account will have no display name`)}catch(e){console.warn(`[adobe] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function L(e){let t=e.indexOf(`#`);if(t<0)return null;let n=new URLSearchParams(e.slice(t+1)),r=n.get(`access_token`);return r?{accessToken:r,expiresIn:parseInt(n.get(`expires_in`)??`86400`,10),scope:n.get(`scope`)??void 0}:null}var R={id:`adobe`,name:`Adobe`,description:`Claude via Adobe — login with your Adobe ID`,requiresApiKey:!1,requiresBaseUrl:!C.proxyEndpoint,baseUrlPlaceholder:`https://your-proxy.example.com`,baseUrlDescription:`Anthropic-compatible proxy endpoint`,isOAuth:!0,defaultModelId:`sonnet`,oauthTokenDomains:[`ims-na1.adobelogin.com`,`ims-na1-stg1.adobelogin.com`,`*.adobelogin.com`,`*.adobe.io`,`firefall.adobe.io`,`admin.hlx.page`,`admin.hlx.live`,`admin.aem.page`,`admin.aem.live`],getModelIds:()=>{let e=e=>ae(e,E.get(e.id));for(let t of Q.values())if(t.length){let n=t.map(t=>e({id:t.id,name:t.name??t.id,reasoning:t.reasoning,input:t.input,cost:t.cost}));return O(n),n}for(let t of T.values())if(t.models?.length)return t.models.map(t=>e(t));try{let e=localStorage.getItem(D);if(e){let t=JSON.parse(e);if(t.length)return t}}catch{}return[{id:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`}]},onOAuthLogin:async(t,n,r)=>{let i=w(),a=await k(i),o=A(a),s=j(a),c=M(a),l=F?null:await ee(),u=F?null:g({pageHref:l.href,pageOrigin:l.origin,configuredRedirectUri:C.redirectUri},()=>crypto.randomUUID()),d=F?C.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:u.redirectUri,f=u?.oauthState,p=u?.expectedNonce??null,m=new URLSearchParams({client_id:o,scope:s,response_type:`token`,redirect_uri:d});f&&m.set(`state`,f),r?.forceReauth&&m.set(`prompt`,`login`);let h=await t(`${P(c)}/ims/authorize/v2?${m}`);if(!h)return;if(p&&h)try{if(new URL(h).searchParams.get(`nonce`)!==p){console.error(`[adobe] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let _=L(h);if(!_){console.error(`[adobe] Could not extract token from redirect URL`);return}let v=await oe(_.accessToken,c);await e({providerId:`adobe`,accessToken:_.accessToken,tokenExpiresAt:Date.now()+_.expiresIn*1e3,userName:v.name,userAvatar:v.avatar,scopes:_.scope,baseUrl:C.proxyEndpoint?void 0:i}),await $().catch(e=>console.warn(`[adobe] Failed to fetch models after login:`,e instanceof Error?e.message:String(e))),n()},onOAuthLogout:async()=>{let t=I();if(t?.accessToken)try{let e=T.values().next().value??{},n=e.clientId||C.clientId,r=M(e);if(n){let e=await fetch(`${P(r)}/ims/revoke`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({token:t.accessToken,token_type_hint:`access_token`,client_id:n})});e.ok||console.warn(`[adobe] Token revocation returned ${e.status}, token may still be valid server-side`)}}catch(e){console.warn(`[adobe] Failed to revoke token:`,e instanceof Error?e.message:String(e))}await e({providerId:`adobe`,accessToken:``})},onSilentRenew:async()=>I()?.accessToken?V():null,refreshModels:async e=>{await $(e);let t=R.getModelIds?.();t?.length&&O(t)}},z=null,se=_();async function B(){let e=I();if(!e?.accessToken)throw Error(`Not logged in to Adobe — please log in first`);if((e.tokenExpiresAt??0)-Date.now()>6e4)return e.accessToken;console.log(`[adobe] Token expired or expiring soon, attempting silent renewal...`);let t=await se.run(()=>V());if(t)return t;let n=I();if((n?.tokenExpiresAt??0)-Date.now()>0&&n?.accessToken)return n.accessToken;throw Error(`Adobe session expired — please log in again`)}function ce(){let e=I();return!e?.tokenExpiresAt||Date.now()>e.tokenExpiresAt-6e4}async function V(){if(typeof window>`u`){let e=v();if(!e)return null;try{let{accessToken:t}=await e.call(`silent-renew`,{providerId:`adobe`},{timeoutMs:13e4});return t}catch(e){return console.warn(`[adobe] worker→page silent-renew bridge failed:`,e instanceof Error?e.message:String(e)),null}}return z||(z=le().finally(()=>{z=null}),z)}function H(e,t){let n=A(t),r=j(t),i=M(t),a=F?null:g({pageHref:window.location.href,pageOrigin:window.location.origin,configuredRedirectUri:C.redirectUri},()=>crypto.randomUUID()),o=F?C.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:a.redirectUri,s=a?.oauthState,c=a?.expectedNonce??null,l=new URLSearchParams({client_id:n,scope:r,response_type:`token`,redirect_uri:o,prompt:`none`});return s&&l.set(`state`,s),{authorizeUrl:`${P(i)}/ims/authorize/v2?${l}`,expectedNonce:c,proxyEndpoint:e}}function U(e,t){if(!t)return!0;try{if(new URL(e).searchParams.get(`nonce`)!==t)return console.error(`[adobe] OAuth nonce mismatch — possible CSRF`),!1}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}return!0}async function W(t,n){let r=I();await e({providerId:`adobe`,accessToken:t.accessToken,tokenExpiresAt:Date.now()+t.expiresIn*1e3,userName:r?.userName,userAvatar:r?.userAvatar,scopes:t.scope,baseUrl:C.proxyEndpoint?void 0:n})}async function le(){try{let e=w(),{authorizeUrl:t,expectedNonce:n}=H(e,await k(e)),{createOAuthLauncher:r}=await a(async()=>{let{createOAuthLauncher:e}=await import(`./oauth-service-Uk8UIb05.js`);return{createOAuthLauncher:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])),i=await r()(t,{interactive:!1});if(!i||!U(i,n))return null;let o=L(i);return o?(await W(o,e),console.log(`[adobe] Token renewed silently`),await $().catch(e=>console.warn(`[adobe] Failed to refresh models after silent renewal:`,e instanceof Error?e.message:String(e))),o.accessToken):null}catch(e){return console.warn(`[adobe] Silent renewal error:`,e instanceof Error?e.message:String(e)),null}}var G=`X-Slicc-Version`;function K(e){let t={},n=G.toLowerCase();if(e.headers)for(let[r,i]of Object.entries(e.headers))r.toLowerCase()!==n&&(t[r]=i);return t[G]=`6.89.0`,{...e,headers:t}}var ue=`adobe-provider-fallback`,q=new Set;function J(e,t){if(e.headers){for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()===`x-session-id`&&n!=null)return e}return q.has(t)||(q.add(t),console.warn(`[adobe] Missing X-Session-Id from ${t} — using daily fallback. Attach an X-Session-Id header at the call site (see scoop-context.ts streamWithSessionId or docs/pitfalls.md).`)),{...e,headers:{...e.headers??{},"X-Session-Id":b(ue)}}}function de(){q.clear()}function Y(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:`adobe-anthropic`,provider:`adobe`,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}var X=(e,t,n={})=>{let r=i();return(async()=>{try{let i=await B();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${w()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=p(a,t,K(J({...n,apiKey:i},`streamAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:w(),api:`anthropic-messages`},o=h(a,t,K(J(S(e,y(e.id,e.name,{...n,apiKey:i})),`streamAdobe[anthropic]`)));for await(let e of o)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(Y(e,t)),r.end()}})(),r},Z=(e,t,n)=>{let r=i();return(async()=>{try{let i=await B();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${w()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=m(a,t,K(J({...n,apiKey:i},`streamSimpleAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:w(),api:`anthropic-messages`},o=f(a,t,K(J(S(e,y(e.id,e.name,{...n,apiKey:i})),`streamSimpleAdobe[anthropic]`)));for await(let e of o)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(Y(e,t)),r.end()}})(),r};function fe(e){let t={id:e.id,name:e.name};return e.api!==void 0&&(t.api=e.api),e.context_window!==void 0&&(t.context_window=e.context_window),e.max_tokens!==void 0&&(t.max_tokens=e.max_tokens),e.reasoning!==void 0&&(t.reasoning=e.reasoning),e.input!==void 0&&(t.input=e.input),t}function pe(){let e=new Map;for(let t of c())try{for(let n of o(t))e.set(n.id,n)}catch{}return e}function me(e,n,r){let i=`adobe-${e.api===`openai`?`openai`:`anthropic`}`,a=r.get(e.id);if(a)return{...a,provider:`adobe`,api:i};let o=t(e.id,r);return{id:e.id,name:e.name??e.id,provider:`adobe`,api:i,baseUrl:n,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:o,inputCost:o.input,outputCost:o.output,cacheReadCost:o.cacheRead,cacheWriteCost:o.cacheWrite,reasoning:!0}}function he(e,t){for(let t of e)E.set(t.id,fe(t));let n=pe();return e.map(e=>me(e,t,n))}async function ge(e){try{let t=e??await B(),n=w(),r=await fetch(`${n}/v1/models`,{headers:{Authorization:`Bearer ${t}`,[G]:`6.89.0`}});if(!r.ok)console.warn(`[adobe] Proxy /v1/models returned ${r.status}, falling back to Anthropic models`);else{let e=await r.json();if(e.data?.length)return he(e.data,n)}}catch(e){console.warn(`[adobe] Failed to fetch proxy models:`,e instanceof Error?e.message:String(e))}return null}var Q=new Map;function _e(){return o(`anthropic`).map(e=>({...e,provider:`adobe`,api:`adobe-anthropic`}))}async function $(e){let t=w(),n=Q.get(t);if(n)return n;let r=await ge(e);return r?(Q.set(t,r),r):_e()}function ve(){d({api:`adobe-anthropic`,stream:X,streamSimple:Z}),d({api:`adobe-openai`,stream:X,streamSimple:Z})}export{de as __resetAdobeSessionIdWarningCacheForTests,R as config,L as extractTokenFromUrl,$ as getAdobeModels,B as getValidAccessToken,ce as isTokenExpired,ve as register};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CHAT_SURFACE_ID as e}from"./wc-sprinkles-
|
|
1
|
+
import{CHAT_SURFACE_ID as e}from"./wc-sprinkles-wT8iHdRT.js";var t=`focus`,n={type:`leaf`,surfaceId:`chat`};function r(e,t={},n={}){return{zones:{top:null,left:null,middle:null,right:null,bottom:null,...e},rowFr:{top:1,center:1,bottom:1,...n},colFr:{left:1,middle:1,right:1,...t}}}var i={focus:{name:`focus`,tree:r({left:n},{left:3,middle:1})}};function a(e){return i[e]??null}function o(n,r){switch(r.kind){case`set`:n.applyLayout(r.tree);break;case`reset`:{let e=a(t);e&&n.applyLayout(e.tree);break}case`chat`:n.moveSurfaceToZone(e,r.zone);break;case`open`:n.placeSurface(r.zone,r.surfaceId);break;case`close`:n.removeSurface(r.surfaceId);break;case`move`:n.moveSurfaceToZone(r.surfaceId,r.zone);break;case`size`:n.setSurfaceSize(r.surfaceId,r.size)}}export{o as applyLayout};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./logger-LESFN7Hj.js";import{t}from"./html-B_Hg2WOy.js";import{t as n}from"./types-idfTVsM8.js";import{t as r}from"./global-db-DJXlpNui.js";const i=e(`mcp-apps`),a=`/workspace/.mcp/sprinkles`;async function o(e){if(e)return e;let{VirtualFS:t}=await import(`./fs-
|
|
1
|
+
import{t as e}from"./logger-LESFN7Hj.js";import{t}from"./html-B_Hg2WOy.js";import{t as n}from"./types-idfTVsM8.js";import{t as r}from"./global-db-DJXlpNui.js";const i=e(`mcp-apps`),a=`/workspace/.mcp/sprinkles`;async function o(e){if(e)return e;let{VirtualFS:t}=await import(`./fs-BHEdp-e-.js`).then(e=>e.t);return await t.create({dbName:r})}function s(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,64)||`app`}function c(e,n){let r=t(n.title??n.name),i=n.description?t(n.description):``,a=t(n.templateUri??`about:blank`),o=JSON.stringify(e),s=JSON.stringify(n.name);return`<div class="mcp-app" data-sprinkle-title="${r}" style="display:flex;flex-direction:column;height:100%;min-height:0;">
|
|
2
2
|
<header class="mcp-app__header" style="padding:8px 12px;border-bottom:1px solid var(--s2-border-subtle,#3a3a3a);">
|
|
3
3
|
<h2 style="font-size:14px;font-weight:600;margin:0;">${r}</h2>${i?`\n <p style="font-size:12px;margin:4px 0 0;color:var(--s2-content-secondary,#a0a0a0);">${i}</p>`:``}
|
|
4
4
|
</header>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as e,g as t}from"./account-store-
|
|
1
|
+
import{b as e,g as t}from"./account-store-CYz2dZdk.js";import{a as n}from"./diagnostics-DN_idNHx.js";import{t as r}from"./models-4WTk3EBD.js";import{u as i}from"./claude-model-version-Csn7RPVg.js";import{i as a,t as o}from"./transform-messages-DZg9zDcV.js";function s(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function c(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}let l=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return l=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))};function u(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}const d=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)};var f=class extends Error{},p=class e extends f{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`x-request-id`),this.error=n;let a=n;this.code=a?.code,this.param=a?.param,this.type=a?.type}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new h({message:r,cause:d(n)});let a=n?.error;return t===400?new _(t,a,r,i):t===401?new v(t,a,r,i):t===403?new y(t,a,r,i):t===404?new b(t,a,r,i):t===409?new x(t,a,r,i):t===422?new ee(t,a,r,i):t===429?new te(t,a,r,i):t>=500?new ne(t,a,r,i):new e(t,a,r,i)}},m=class extends p{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},h=class extends p{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},g=class extends h{constructor({message:e}={}){super({message:e??`Request timed out.`})}},_=class extends p{},v=class extends p{},y=class extends p{},b=class extends p{},x=class extends p{},ee=class extends p{},te=class extends p{},ne=class extends p{},re=class extends f{constructor(){super(`Could not parse response content as the length limit was reached`)}},ie=class extends f{constructor(){super(`Could not parse response content as the request was rejected by the content filter`)}},ae=class extends Error{constructor(e){super(e)}},oe=class extends p{constructor(e,t,n){let r=`OAuth2 authentication error`,i;if(t&&typeof t==`object`){let e=t;i=e.error;let n=e.error_description;n&&typeof n==`string`?r=n:i&&(r=i)}super(e,t,r,n),this.error_code=i}},se=class extends f{constructor(e,t,n){super(e),this.provider=t,this.cause=n}};const ce=/^[a-z][a-z0-9+.-]*:/i,le=e=>ce.test(e);let S=e=>(S=Array.isArray,S(e)),ue=S;function de(e){return typeof e==`object`?e??{}:{}}function fe(e){if(!e)return!0;for(let t in e)return!1;return!0}function pe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const me=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new f(`${e} must be an integer`);if(t<0)throw new f(`${e} must be a positive integer`);return t},he=e=>{try{return JSON.parse(e)}catch{return}},ge=e=>new Promise(t=>setTimeout(t,e));function _e(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function ve(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function ye(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return ve({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function be(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function xe(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}let Se;function w(e){let t;return(Se??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}let Ce;function we(e){let t;return(Ce??=(t=new globalThis.TextDecoder,t.decode.bind(t)))(e)}var Te,T,E,D,O,Ee,De;const Oe=65536;var ke=class{constructor(){Te.add(this),T.set(this,void 0),E.set(this,void 0),D.set(this,void 0),O.set(this,void 0),Ee.set(this,void 0),s(this,T,new Uint8Array,`f`),s(this,E,0,`f`),s(this,D,0,`f`),s(this,O,0,`f`),s(this,Ee,!1,`f`)}decode(e){if(e==null)return[];let t;if(t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?w(e):e,t.length===0||c(this,Ee,`f`)&&(s(this,Ee,!1,`f`),t[0]===10&&(t=t.subarray(1)),t.length===0))return[];c(this,Te,`m`,De).call(this,t);let n=[],r;for(;(r=Ae(c(this,T,`f`),c(this,O,`f`),c(this,D,`f`)))!=null;){let e=we(c(this,T,`f`).subarray(c(this,E,`f`),r.preceding));n.push(e),s(this,E,r.index,`f`),r.carriage&&(c(this,E,`f`)<c(this,D,`f`)&&c(this,T,`f`)[c(this,E,`f`)]===10?s(this,E,c(this,E,`f`)+1,`f`):c(this,E,`f`)===c(this,D,`f`)&&s(this,Ee,!0,`f`)),s(this,O,c(this,E,`f`),`f`)}if(s(this,O,c(this,D,`f`),`f`),c(this,E,`f`)===c(this,D,`f`))s(this,E,0,`f`),s(this,D,0,`f`),s(this,O,0,`f`),c(this,T,`f`).length>Oe&&s(this,T,new Uint8Array,`f`);else if(n.length>0&&c(this,T,`f`).length>Oe){let e=c(this,D,`f`)-c(this,E,`f`);if(e<=Oe||c(this,T,`f`).length>e*4){let t=e<=Oe?Math.min(Math.max(e*2,256),Oe):e*2,n=new Uint8Array(t);n.set(c(this,T,`f`).subarray(c(this,E,`f`),c(this,D,`f`))),s(this,T,n,`f`),s(this,E,0,`f`),s(this,D,e,`f`),s(this,O,e,`f`)}}return n}flush(){return s(this,Ee,!1,`f`),c(this,E,`f`)===c(this,D,`f`)?[]:this.decode(`
|
|
2
2
|
`)}};T=new WeakMap,E=new WeakMap,D=new WeakMap,O=new WeakMap,Ee=new WeakMap,Te=new WeakSet,De=function(e){if(c(this,D,`f`)+e.length>c(this,T,`f`).length){let t=c(this,D,`f`)-c(this,E,`f`);if(c(this,E,`f`)>=c(this,T,`f`).length/2&&t+e.length<=c(this,T,`f`).length)c(this,T,`f`).copyWithin(0,c(this,E,`f`),c(this,D,`f`));else{let n=Math.max(c(this,T,`f`).length*2,t+e.length,256),r=new Uint8Array(n);r.set(c(this,T,`f`).subarray(c(this,E,`f`),c(this,D,`f`))),s(this,T,r,`f`)}s(this,O,c(this,O,`f`)-c(this,E,`f`),`f`),s(this,D,t,`f`),s(this,E,0,`f`)}c(this,T,`f`).set(e,c(this,D,`f`)),s(this,D,c(this,D,`f`)+e.length,`f`)},ke.NEWLINE_CHARS=new Set([`
|
|
3
3
|
`,`\r`]),ke.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Ae(e,t,n){for(let r=t;r<n;r++){if(e[r]===10)return{preceding:r,index:r+1,carriage:!1};if(e[r]===13)return{preceding:r,index:r+1,carriage:!0}}return null}function je(e){for(let t=0;t<e.length-1;t++){let n=Me(e,t);if(n>0){let r=t+n,i=Me(e,r);if(i>0)return r+i}}return-1}function Me(e,t){return e[t]===10?1:e[t]===13?e[t+1]===10?2:1:0}const Ne={off:0,error:200,warn:300,info:400,debug:500},Pe=(e,t,n)=>{if(e){if(pe(Ne,e))return e;k(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Ne))}`)}};function Fe(){}function Ie(e,t,n){return!t||Ne[e]>Ne[n]?Fe:t[e].bind(t)}const Le={error:Fe,warn:Fe,info:Fe,debug:Fe};let Re=new WeakMap;function k(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return Le;let r=Re.get(t);if(r&&r[0]===n)return r[1];let i={error:Ie(`error`,t,n),warn:Ie(`warn`,t,n),info:Ie(`info`,t,n),debug:Ie(`debug`,t,n)};return Re.set(t,[n,i]),i}const ze=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`authorization`||e.toLowerCase()===`api-key`||e.toLowerCase()===`x-api-key`||e.toLowerCase()===`x-amz-security-token`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t])),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e);var Be,Ve=class e{constructor(e,t,n){Be.set(this,void 0),this.iterator=e,this.controller=t,s(this,Be,n,`f`)}static fromSSEResponse(t,n,r,i){let a=!1,o=r?k(r):console;async function*s(){if(a)throw new f("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");a=!0;let e=!1,r=!1;try{for await(let e of He(t,n)){if(e.data.startsWith(`[DONE]`)){r=!0;break}if(e.event===null||!e.event.startsWith(`thread.`)){let n;try{n=JSON.parse(e.data)}catch(t){throw o.error(`Could not parse message into JSON:`,e.data),o.error(`From chunk:`,e.raw),t}if(n&&n.error)throw new p(void 0,n.error,void 0,t.headers);yield i?{event:e.event,data:n}:n}else{let t;try{t=JSON.parse(e.data)}catch(t){throw console.error(`Could not parse message into JSON:`,e.data),console.error(`From chunk:`,e.raw),t}if(e.event===`error`)throw new p(void 0,t.error,t.message,void 0);yield{event:e.event,data:t}}}e=!0}catch(e){if(r||u(e)||n.signal.aborted&&e===n.signal.reason)return;throw e}finally{e||n.abort()}}return new e(s,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new ke,r=t.getReader(),i=!1,a,o=()=>{a??=r.cancel(),a.catch(()=>void 0)};n.signal.addEventListener(`abort`,o,{once:!0});try{if(n.signal.aborted){o();return}for(;;){let{value:t,done:a}=await r.read();if(a){i=!0;break}if(n.signal.aborted)return;for(let r of e.decode(t)){if(n.signal.aborted)return;yield r}}if(n.signal.aborted)return;for(let t of e.flush()){if(n.signal.aborted)return;yield t}}finally{n.signal.removeEventListener(`abort`,o),i||o(),r.releaseLock()}}async function*o(){if(i)throw new f("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(n.signal.aborted||u(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(Be=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,c(this,Be,`f`)),new e(()=>i(n),this.controller,c(this,Be,`f`))]}toReadableStream(){let e;return ve({start:async()=>{e=this[Symbol.asyncIterator]()},async pull(t){try{let{value:n,done:r}=await e.next();if(r)return t.close();let i=w(JSON.stringify(n)+`
|
|
4
4
|
`);t.enqueue(i)}catch(e){t.error(e)}},async cancel(){await e.return?.()}})}};async function*He(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new f(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new f(`Attempted to iterate over a response with no body`);let n=new We,r=new ke,i=be(e.body);for await(let e of Ue(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}async function*Ue(e){let t=new Uint8Array,n=0,r=0,i=0;for await(let a of e){if(a==null)continue;let e;if(e=a instanceof ArrayBuffer?new Uint8Array(a):typeof a==`string`?w(a):a,r+e.length>t.length){let a=r-n;if(n>=t.length/2&&a+e.length<=t.length)t.copyWithin(0,n,r);else{let i=new Uint8Array(Math.max(t.length*2,a+e.length));i.set(t.subarray(n,r)),t=i}i-=n,n=0,r=a}t.set(e,r),r+=e.length;let o;for(;(o=je(t.subarray(i,r)))!==-1;)o+=i,yield t.slice(n,o),n=o,i=n;i=Math.max(n,r-3)}r>n&&(yield t.slice(n,r))}var We=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.slice(0,-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
|