@openparachute/app 0.22.5
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/CHANGELOG.md +3473 -0
- package/LICENSE +661 -0
- package/README.md +68 -0
- package/dist/.parachute/info +8 -0
- package/dist/apple-touch-icon-180x180.png +0 -0
- package/dist/assets/Account-BhmA30V5.js +1 -0
- package/dist/assets/Activity-BgJa7Woi.js +1 -0
- package/dist/assets/AddVault-BWa_-QjM.js +1 -0
- package/dist/assets/AddVaultChooser-B3ElIlza.js +1 -0
- package/dist/assets/AddVaultCreate-DKJfYFJ1.js +1 -0
- package/dist/assets/Calendar-DUwSvnCY.js +1 -0
- package/dist/assets/CheckEmail-BQYQLTLL.js +1 -0
- package/dist/assets/ConnectAI-DCtARp-w.js +1 -0
- package/dist/assets/DayView-nficJMEc.js +1 -0
- package/dist/assets/Export-DNAoKjAn.js +1 -0
- package/dist/assets/Import-CoFeXNMx.js +20 -0
- package/dist/assets/NoteEditor-DtrdRbqx.js +1 -0
- package/dist/assets/NoteNew-C0DMe5Q8.js +8 -0
- package/dist/assets/NoteRenderer-Dl9X9uRt.js +37 -0
- package/dist/assets/NoteView-B2QH25fP.js +3 -0
- package/dist/assets/OAuthCallback-Dj26N8oJ.js +1 -0
- package/dist/assets/PinArchiveButtons-BXZFiW-i.js +1 -0
- package/dist/assets/Settings-BuXl91ig.js +1 -0
- package/dist/assets/TagPage-q7PgbEHn.js +1 -0
- package/dist/assets/TagSchemaEditor-DIHppYmj.js +1 -0
- package/dist/assets/Tags-BqJ9vWM5.js +1 -0
- package/dist/assets/VaultGraph-CaiNmEtX.js +3 -0
- package/dist/assets/Vaults-CTsUsDH8.js +1 -0
- package/dist/assets/ViewNew-BegTqdOq.js +1 -0
- package/dist/assets/ViewSurface-ClCtZW0N.js +1 -0
- package/dist/assets/Welcome-CN4Zh9jP.js +1 -0
- package/dist/assets/WizardShell-ZqrzQKxp.js +1 -0
- package/dist/assets/attachment-upload-l7qA8_xw.js +2 -0
- package/dist/assets/editor-mode-D9fveTEx.js +1 -0
- package/dist/assets/figtree-latin-ext-wght-normal-DCwSJGxG.woff2 +0 -0
- package/dist/assets/figtree-latin-wght-normal-D_ZTVpCC.woff2 +0 -0
- package/dist/assets/fraunces-latin-ext-opsz-italic-CGbN9UgK.woff2 +0 -0
- package/dist/assets/fraunces-latin-ext-opsz-normal-CJcjJNj7.woff2 +0 -0
- package/dist/assets/fraunces-latin-opsz-italic-lSdLDfvT.woff2 +0 -0
- package/dist/assets/fraunces-latin-opsz-normal-DihXLNYH.woff2 +0 -0
- package/dist/assets/fraunces-vietnamese-opsz-italic-DxWqP7Ku.woff2 +0 -0
- package/dist/assets/fraunces-vietnamese-opsz-normal-Czevyj-6.woff2 +0 -0
- package/dist/assets/history-ByMClxJV.js +1 -0
- package/dist/assets/index-CaleIHD8.css +1 -0
- package/dist/assets/index-Dwo2xe8_.js +66 -0
- package/dist/assets/provenance-B6WFYTWW.js +1 -0
- package/dist/assets/react-force-graph-2d-BMU3lxLC.js +44 -0
- package/dist/assets/transcribe-default-LVAxyzpn.js +1 -0
- package/dist/assets/types-BaJkUfo6.js +1 -0
- package/dist/assets/url-QSQwrjSV.js +1 -0
- package/dist/assets/useAttachmentUploader-C3UnTg01.js +30 -0
- package/dist/assets/workbox-window.prod.es5-BBnX5xw4.js +2 -0
- package/dist/favicon.ico +0 -0
- package/dist/icon.svg +21 -0
- package/dist/index.html +31 -0
- package/dist/manifest.webmanifest +1 -0
- package/dist/maskable-icon-512x512.png +0 -0
- package/dist/pwa-192x192.png +0 -0
- package/dist/pwa-512x512.png +0 -0
- package/dist/pwa-64x64.png +0 -0
- package/dist/sw.js +1 -0
- package/dist/workbox-9c191d2f.js +1 -0
- package/meta.json +20 -0
- package/package.json +83 -0
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Parachute — the super-surface (`parachute-app`)
|
|
2
|
+
|
|
3
|
+
The go-to single-page app for interfacing with your Parachute. It is, at heart,
|
|
4
|
+
a **surface**: name a vault, capture and browse your notes, connect your AI, and
|
|
5
|
+
manage the **cloud** and the **hub** through their APIs — all from one calm,
|
|
6
|
+
warm home.
|
|
7
|
+
|
|
8
|
+
- **Layer:** L2 Surface (super-surface). Speaks the wire contract (vault REST/MCP,
|
|
9
|
+
the cloud `/account/*` door contract, OAuth/PKCE).
|
|
10
|
+
- **Vision (Aaron):** *"The Parachute app is really just a surface — a single-page
|
|
11
|
+
application that manages the cloud and the hub via their APIs. The ideal
|
|
12
|
+
starting point for interfacing with your parachute. Our go-to super surface."*
|
|
13
|
+
|
|
14
|
+
## What this is (and isn't)
|
|
15
|
+
|
|
16
|
+
Seeded from `parachute-surface/packages/notes-ui` to keep the hard-won machinery
|
|
17
|
+
— the vault client, OAuth/PKCE auth, the offline sync/outbox layer,
|
|
18
|
+
IndexedDB/OPFS, notes CRUD, and the `surface-client` / `surface-render`
|
|
19
|
+
integration. The **arrival** and **home** were rebuilt to match the synthesized
|
|
20
|
+
prototype: a calm centered arrival, the vault-name-as-identity thread, and a
|
|
21
|
+
warm home with a focused composer and quiet quick-actions.
|
|
22
|
+
|
|
23
|
+
This app is developed **in parallel** with the currently-deployed notes-ui; it
|
|
24
|
+
does not touch that production path. Cut-over is a later decision.
|
|
25
|
+
|
|
26
|
+
## Install (self-host)
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
parachute install app # bun add -g @openparachute/app
|
|
30
|
+
parachute start app # served at <origin>/app, port 1944
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The published package is a **prebuilt bundle**: the tarball carries `dist/`
|
|
34
|
+
(the SPA shell, hashed assets, service worker, PWA manifest) and nothing is
|
|
35
|
+
built on the operator's machine. `parachute start app` runs the hub's
|
|
36
|
+
static-serve shim (`parachute-hub` `src/notes-serve.ts --package
|
|
37
|
+
@openparachute/app`), which resolves the installed package's `dist/`
|
|
38
|
+
and serves it directly.
|
|
39
|
+
|
|
40
|
+
Because the shipped artifact *is* `dist/`, the `prepack` hook rebuilds it for
|
|
41
|
+
every `npm pack` / `npm publish`, and both CI and the release workflow refuse
|
|
42
|
+
to proceed unless the tarball actually contains `dist/index.html` +
|
|
43
|
+
`dist/assets/*`.
|
|
44
|
+
|
|
45
|
+
## Develop
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
bun install
|
|
49
|
+
bun run dev # http://localhost:1942
|
|
50
|
+
bun run build # tsc -b && vite build → dist/
|
|
51
|
+
bun run typecheck
|
|
52
|
+
bun run lint
|
|
53
|
+
bun run test # vitest — bare `bun test` breaks (the `@/` alias only
|
|
54
|
+
# resolves through vitest.config.ts)
|
|
55
|
+
bun run test:smoke # assert a built dist/ is publishable (run after build)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Root-hosted by default (`base: /`). The runtime mount detector
|
|
59
|
+
(`src/lib/base-url.ts`) still lets the same bundle serve under a sub-path.
|
|
60
|
+
|
|
61
|
+
## Storage namespace
|
|
62
|
+
|
|
63
|
+
Keeps the frozen `lens:*` localStorage / IndexedDB keys from notes-ui. This app
|
|
64
|
+
runs at its own origin, so storage is isolated from any notes-ui install; reusing
|
|
65
|
+
the keys keeps the sync/outbox machinery untouched and any future data migration
|
|
66
|
+
between the two trivial.
|
|
67
|
+
|
|
68
|
+
Part of the [Parachute Computer](https://parachute.computer) ecosystem. AGPL-3.0.
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as m,u as N,g as M,j as e,a as A,L as j,b as $,c as T,s as O,l as k,m as q,d as Y,I as _,e as D,f as F,h as U,i as G,o as H,k as Q,n as X,p as z,S as I,q as C,B as J}from"./index-Dwo2xe8_.js";import{f as K,a as S}from"./provenance-B6WFYTWW.js";function fe(){const[t,s]=m.useState({kind:"loading"}),n=N(a=>a.identityEpoch);return m.useEffect(()=>{let a=!0;return(async()=>{let l;try{l=await M()}catch{a&&s({kind:"device"});return}a&&s(l.signed_in?{kind:"manager",email:l.email,username:l.username,csrf:l.csrf}:{kind:"device"})})(),()=>{a=!1}},[n]),e.jsxs("div",{className:"page-prose",children:[e.jsxs("header",{className:"mb-8",children:[e.jsx("h1",{className:"page-title",children:"Your parachute"}),e.jsx("p",{className:"mt-2 max-w-prose text-fg-muted",children:"Your account, plan, vaults, and connections — managed here."})]}),t.kind==="loading"?e.jsx("output",{"aria-live":"polite",className:"block py-10 text-center text-sm text-fg-dim",children:e.jsx("span",{className:"animate-pulse",children:"Loading your account…"})}):t.kind==="device"?e.jsx(me,{}):e.jsx(W,{email:t.email,username:t.username,csrf:t.csrf})]})}function W({email:t,username:s,csrf:n}){const a=$(),l=A(d=>d.getActiveVault()),c=N(d=>d.identityEpoch),i=T(),x=i.isPending?"loading":i.data??null,h=O(i.data),f=m.useCallback(()=>i.refetch(),[i.refetch]),[b,r]=m.useState("loading"),[o,g]=m.useState(null);m.useEffect(()=>{let d=!0;return k().then(y=>{d&&r(y.vaults)}).catch(y=>{q(y),d&&r("error")}),Y().then(y=>{d&&g(y)}),()=>{d=!1}},[c]);const u=m.useCallback(async()=>{try{const{vaults:d}=await k();r(d)}catch{r("error")}},[]);async function p(){try{await U(n)}finally{G(),a("/",{replace:!0})}}return e.jsxs("div",{className:"space-y-6",children:[e.jsx(Z,{email:t,username:s,summary:h,onSignOut:p}),e.jsx(te,{state:x,descriptor:o,onRetry:f,retrying:i.isFetching}),e.jsx(ue,{vaults:b,summary:h,onReload:u}),e.jsx(L,{hasActiveVault:!!l})]})}function Z({email:t,username:s,summary:n,onSignOut:a}){return e.jsx("section",{"aria-label":"Account",className:"card p-6 shadow-soft",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"eyebrow mb-1",children:"Signed in as"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[e.jsx("p",{className:"break-words font-serif text-xl text-fg",children:t??s??"your account"}),e.jsx(ee,{summary:n})]})]}),e.jsx("button",{type:"button",onClick:a,className:"focus-ring shrink-0 text-sm text-fg-dim hover:text-accent",children:"Sign out"})]})})}function ee({summary:t}){if(!t)return null;const s=t.plan.trial_days_left;return typeof s=="number"?e.jsxs("span",{className:"chip border-transparent bg-sun-soft font-medium text-sun-ink",children:["Free trial · ",s===0?"ends today":`${s} day${s===1?"":"s"} left`]}):e.jsx("span",{className:"chip",children:t.plan.label})}function te({state:t,descriptor:s,onRetry:n,retrying:a}){return t===null||t!=="loading"&&t!=="error"&&!t.billing_enabled?null:e.jsxs("section",{"aria-label":"Plan & billing",className:"card p-6 shadow-soft",children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Plan & billing"}),t==="loading"?e.jsxs("div",{"aria-busy":"true",className:"mt-4 space-y-2.5",children:[e.jsx("div",{className:"skeleton h-4 w-3/5 rounded-md"}),e.jsx("div",{className:"skeleton h-4 w-2/5 rounded-md"})]}):t==="error"?e.jsxs("div",{className:"mt-4 text-center",children:[e.jsx("p",{className:"mb-1 font-serif text-lg text-fg",children:"Couldn't load your plan."}),e.jsx("p",{className:"mb-5 text-sm text-fg-muted",children:"A hiccup reaching your account — your plan hasn't changed."}),e.jsx("button",{type:"button",onClick:n,disabled:a,className:"btn btn-primary btn-touch",children:a?"Retrying…":"Retry"})]}):t.has_billing_customer?e.jsx(se,{summary:t}):e.jsx(oe,{summary:t,plans:(s==null?void 0:s.plans)??[]})]})}function se({summary:t}){const[s,n]=m.useState(!1),[a,l]=m.useState(null);async function c(){n(!0),l(null);try{const{url:i}=await z();window.location.assign(i)}catch(i){if(n(!1),i instanceof I){N.getState().markExpired();return}l("Billing isn't available right now.")}}return e.jsxs("div",{className:"mt-4",children:[e.jsx("p",{className:"text-sm text-fg-muted",children:R(t)}),e.jsx("button",{type:"button",onClick:c,disabled:s,className:"btn btn-primary btn-touch mt-4",children:s?"Opening…":"Manage plan & billing ↗"}),a?e.jsx(B,{text:a}):null]})}const v=["monthly","quarterly","yearly"],E={monthly:"Monthly",quarterly:"Quarterly",yearly:"Yearly"},ne={monthly:"/mo",quarterly:"/quarter",yearly:"/yr"},ae={monthly:1,quarterly:3,yearly:12};function le(t){var n,a;const s=new Set;for(const l of t)for(const c of v)(a=(n=l.intervals)==null?void 0:n[c])!=null&&a.available&&s.add(c);return v.filter(l=>s.has(l))}function V(t,s){return t.label?t.label:typeof t.price=="number"?`$${t.price}${ne[s]}`:null}function re(t){var s;for(const n of v){const a=(s=t.intervals)==null?void 0:s[n];if(a!=null&&a.available)return{interval:n,entry:a}}return null}function ie(t,s){if(!s||!t.intervals)return typeof t.price_month=="number"?`$${t.price_month}/mo`:null;const n=[];let a=!1,l=null;for(const i of v){const x=t.intervals[i];if(!(x!=null&&x.available))continue;i==="monthly"&&(a=!0);const h=V(x,i);if(h&&n.push(h),typeof x.price=="number"){const f=x.price/ae[i];l=l===null?f:Math.min(l,f)}}if(n.length===0)return null;const c=n.join(" · ");return a||l===null?c:`${c} — about $${Math.max(1,Math.round(l))}/mo`}function ce(t){if(t instanceof J)switch(t.code){case"already_subscribed":return"You're already subscribed — refresh to see your plan.";case"invalid_plan":case"invalid_interval":case"invalid_tier":return"That plan isn't offered on this cycle — pick another."}return"Billing isn't available right now."}function B({text:t}){return e.jsx("p",{className:"mt-3 rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:t})}function oe({summary:t,plans:s}){const n=le(s),[a,l]=m.useState(null),c=a!==null&&n.includes(a)?a:n[0]??null,[i,x]=m.useState(null),[h,f]=m.useState(null);async function b(r){if(!i){x(r),f(null);try{const{url:o}=c?await C(r,c):await C(r);window.location.assign(o)}catch(o){if(x(null),o instanceof I){N.getState().markExpired();return}f(ce(o))}}}return e.jsxs("div",{className:"mt-4",children:[e.jsx("p",{className:"text-sm text-fg-muted",children:R(t)}),c&&n.length>1?e.jsxs("fieldset",{className:"mt-4 flex flex-wrap items-center gap-1.5",children:[e.jsx("legend",{className:"sr-only",children:"Billing interval"}),n.map(r=>{const o=r===c;return e.jsx("button",{type:"button",onClick:()=>l(r),"aria-pressed":o,className:`chip focus-ring ${o?"chip-tag-active font-medium":"chip-tag"}`,children:E[r]},r)})]}):null,s.length>0?e.jsx("ul",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:s.map(r=>{var y;const o=r.id===t.plan.tier,g=c?(y=r.intervals)==null?void 0:y[c]:void 0,u=n.length===0||(g==null?void 0:g.available)===!0,p=ie(r,n.length>0),d=u?null:re(r);return e.jsxs("li",{className:"rounded-xl border border-border bg-bg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-serif text-lg text-fg",children:r.name}),o?e.jsx("span",{className:"chip",children:"Current"}):null]}),p?e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:p}):null,typeof r.vaults=="number"?e.jsxs("p",{className:"mt-0.5 text-xs text-fg-dim",children:[r.vaults," vault",r.vaults===1?"":"s"]}):null,o?null:u?e.jsx("button",{type:"button",onClick:()=>b(r.id),disabled:i!==null,className:"btn btn-primary btn-sm btn-touch mt-3 w-full",children:i===r.id?"Starting…":`Upgrade to ${r.name}`}):e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",disabled:!0,className:"btn btn-secondary btn-sm btn-touch w-full",children:["Not available"," ",E[c].toLowerCase()]}),d?e.jsxs("p",{className:"mt-1 text-xs text-fg-dim",children:["Available from ",V(d.entry,d.interval)]}):null]})]},r.id)})}):null,h?e.jsx(B,{text:h}):null]})}function R(t){const{plan:s}=t,n=[s.label];typeof s.trial_days_left=="number"?n.push(`${s.trial_days_left} day${s.trial_days_left===1?"":"s"} left`):typeof s.price_monthly_usd=="number"&&s.price_monthly_usd>0&&n.push(`$${s.price_monthly_usd}/mo`),typeof s.vault_limit=="number"&&typeof s.vaults_used=="number"&&n.push(`${s.vaults_used} of ${s.vault_limit} vaults`);const a=S(s.storage_used_bytes??0);if(a){const l=s.storage_limit_bytes?S(s.storage_limit_bytes):null;n.push(l?`${a} of ${l}`:a)}return n.join(" · ")}function ue({vaults:t,summary:s,onReload:n}){const a=$(),[l,c]=m.useState(null),[i,x]=m.useState(null),[h,f]=m.useState(!1);async function b(u){if(!l){c(u.name),x(null);try{await H(u.name),Q(u.name),a("/")}catch(p){c(null),x(X(p,"Couldn't open that vault."))}}}async function r(){f(!0);try{await n()}finally{f(!1)}}const o=s==null?void 0:s.plan,g=o&&typeof o.vault_limit=="number"&&typeof o.vaults_used=="number"?`${o.vaults_used} of ${o.vault_limit} on your plan`:null;return e.jsxs("section",{"aria-label":"Your vaults",className:"card p-6 shadow-soft",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1",children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Your vaults"}),g?e.jsx("span",{className:"text-xs text-fg-muted",children:g}):null]}),t==="loading"?e.jsxs("div",{"aria-busy":"true",className:"mt-4 space-y-2.5",children:[e.jsx("div",{className:"skeleton h-9 rounded-lg"}),e.jsx("div",{className:"skeleton h-9 w-4/5 rounded-lg"})]}):t==="error"?e.jsxs("div",{className:"mt-4 text-center",children:[e.jsx("p",{className:"mb-1 font-serif text-lg text-fg",children:"Couldn't load your vaults."}),e.jsx("p",{className:"mb-5 text-sm text-fg-muted",children:"A hiccup reaching your account — nothing's lost, your vaults are safe."}),e.jsx("button",{type:"button",onClick:r,disabled:h,className:"btn btn-primary btn-touch",children:h?"Retrying…":"Retry"})]}):t.length===0?e.jsxs("div",{className:"mt-4 text-center",children:[e.jsx("p",{className:"mb-1 font-serif text-lg text-fg",children:"No vaults yet."}),e.jsx("p",{className:"mb-5 text-sm text-fg-muted",children:"Create your first — a private home for your notes, always yours to export."}),e.jsx(j,{to:"/add-vault/create",className:"btn btn-primary btn-touch",children:"Create a vault"})]}):e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"mt-3 divide-y divide-border-light",children:t.map(u=>{const p=K(u.usage),d=u.url?u.url.replace(/^https?:\/\//,""):null;return e.jsxs("li",{className:"flex items-center gap-3 py-3",children:[e.jsx(de,{name:u.name}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate font-serif text-lg leading-snug text-fg",children:u.name}),d?e.jsx("p",{className:"mt-0.5 truncate note-id",children:d}):null,p?e.jsx("p",{className:"mt-0.5 text-xs text-fg-muted",children:p}):null]}),e.jsx("button",{type:"button",onClick:()=>b(u),disabled:l===u.name,className:"btn btn-primary btn-sm btn-touch shrink-0",children:l===u.name?"Opening…":"Open →"})]},u.name)})}),e.jsx("p",{className:"mt-3 border-t border-border-light pt-3 text-sm",children:e.jsx(j,{to:"/add-vault",className:"focus-ring font-semibold text-accent hover:underline",children:"+ Add a vault"})})]}),i?e.jsx("p",{className:"mt-4 rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:i}):null]})}function de({name:t}){const s=(t.trim()[0]??"?").toUpperCase();return e.jsx("span",{"aria-hidden":!0,className:"grid h-9 w-9 shrink-0 place-items-center rounded-full bg-grass-soft text-sm font-semibold text-grass-ink",children:s})}function L({hasActiveVault:t}){return e.jsxs("section",{"aria-label":"Connections",className:"card p-6 shadow-soft",children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Connections"}),e.jsxs("div",{className:"mt-2 divide-y divide-border-light",children:[t?e.jsx(w,{to:"/connect",tone:"sky",icon:e.jsx(_,{width:18,height:18}),title:"Connect your AI",description:"Claude, ChatGPT, or any MCP client — one memory, shared."}):e.jsxs("div",{className:"-mx-2 flex items-center gap-3 px-2 py-3 opacity-60",children:[e.jsx(P,{tone:"sky",children:e.jsx(_,{width:18,height:18})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-medium text-fg",children:"Connect your AI"}),e.jsx("p",{className:"mt-0.5 text-sm text-fg-muted",children:"Open a vault above to connect an AI to it."})]})]}),e.jsx(w,{to:"/import",tone:"grass",icon:e.jsx(D,{width:18,height:18}),title:"Import notes",description:"Bring your notes over from anywhere markdown lives."}),e.jsx(w,{to:"/export",tone:"sun",icon:e.jsx(F,{width:18,height:18}),title:"Export notes",description:"Download your vault as open Markdown — yours to keep."})]})]})}function w({to:t,tone:s,icon:n,title:a,description:l}){return e.jsxs(j,{to:t,className:"focus-ring -mx-2 flex items-center gap-3 rounded-lg px-2 py-3 hover:bg-bg-soft",children:[e.jsx(P,{tone:s,children:n}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block font-medium text-fg",children:a}),e.jsx("span",{className:"mt-0.5 block text-sm text-fg-muted",children:l})]}),e.jsx("span",{"aria-hidden":!0,className:"shrink-0 text-lg text-fg-dim",children:"›"})]})}function P({tone:t,children:s}){const n=t==="grass"?"bg-grass-soft text-grass-ink":t==="sun"?"bg-sun-soft text-sun-ink":"bg-bg-soft";return e.jsx("span",{"aria-hidden":!0,className:`grid h-10 w-10 shrink-0 place-items-center rounded-full ${n}`,style:t==="sky"?{color:"var(--color-sky)"}:void 0,children:s})}function me(){const t=A(n=>n.vaults),s=Object.values(t);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"card p-6 shadow-soft",children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"This device"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"You're managing the vaults connected on this device. Sign in to your account to manage your plan and hosted vaults from anywhere."}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-3",children:[e.jsx(j,{to:"/",className:"btn btn-primary btn-touch",children:"Sign in"}),e.jsx(j,{to:"/vaults",className:"btn btn-ghost btn-touch",children:s.length>0?`${s.length} connected`:"Connect a vault"})]})]}),e.jsx(L,{hasActiveVault:s.length>0})]})}export{fe as Account};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as x,t as f,r as l,j as e,N as g,v as y,E as j,L as u,w as N,x as b,V as v}from"./index-Dwo2xe8_.js";const h=1440*60*1e3,w=5e3;function E(a,n=30,s=new Date){const r=s.getTime()-n*h,i=[];for(const t of a){const c=t.path??t.id,d=Date.parse(t.createdAt);if(Number.isFinite(d)&&d>=r&&i.push({id:`${t.id}:created`,noteId:t.id,noteName:c,kind:"created",at:t.createdAt,preview:t.preview,tags:t.tags}),t.updatedAt){const o=Date.parse(t.updatedAt);Number.isFinite(o)&&o>=r&&Number.isFinite(d)&&o-d>w&&i.push({id:`${t.id}:updated`,noteId:t.id,noteName:c,kind:"updated",at:t.updatedAt,preview:t.preview,tags:t.tags})}}return i.sort((t,c)=>Date.parse(c.at)-Date.parse(t.at)),i}const k=["today","yesterday","thisWeek","older"],D={today:"Today",yesterday:"Yesterday",thisWeek:"This week",older:"Older"};function A(a,n=new Date){const s=Date.parse(a);if(!Number.isFinite(s))return null;const r=m(n),i=m(new Date(s)),t=Math.round((r.getTime()-i.getTime())/h);return t<0||t===0?"today":t===1?"yesterday":t<7?"thisWeek":"older"}function m(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate())}function S(a,n=new Date){const s={today:[],yesterday:[],thisWeek:[],older:[]};for(const r of a){const i=A(r.at,n);i&&s[i].push(r)}return s}const p=50;function R(){const a=x(o=>o.getActiveVault()),n=f(),[s,r]=l.useState(p),i=l.useMemo(()=>n.data?E(n.data):[],[n.data]),t=l.useMemo(()=>i.slice(0,s),[i,s]),c=l.useMemo(()=>S(t),[t]),d=i.length-t.length;return a?e.jsxs("div",{className:"page-prose",children:[e.jsxs("header",{className:"mb-8",children:[e.jsx("p",{className:"eyebrow mb-1",children:"Activity"}),e.jsx("h1",{className:"page-title",children:"Recent changes"}),e.jsx("p",{className:"mt-2 text-fg-muted",children:"Last 30 days, newest first. Deletions aren't tracked yet."})]}),n.isPending?e.jsx(F,{}):n.isError?e.jsx(L,{error:n.error}):i.length===0?e.jsx(C,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-8",children:k.map(o=>c[o].length>0?e.jsx(T,{title:D[o],events:c[o]},o):null)}),d>0?e.jsx("div",{className:"mt-8 flex justify-center",children:e.jsxs("button",{type:"button",onClick:()=>r(o=>o+p),className:"btn btn-secondary btn-touch",children:["Load more (",d," remaining)"]})}):null]})]}):e.jsx(g,{to:"/",replace:!0})}function T({title:a,events:n}){return e.jsxs("section",{children:[e.jsxs("h2",{className:"eyebrow mb-3",children:[a," (",n.length,")"]}),e.jsx("ol",{className:"card shadow-soft divide-y divide-border rounded-xl",children:n.map(s=>e.jsx("li",{children:e.jsxs(u,{to:`/n/${encodeURIComponent(s.noteId)}`,className:"focus-ring block px-5 py-4 transition-colors hover:bg-bg-soft",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx(B,{kind:s.kind}),e.jsx("span",{className:"truncate font-mono text-sm text-fg",children:s.noteName})]}),e.jsx("span",{className:"shrink-0 text-xs text-fg-dim",children:b(s.at)})]}),s.preview?e.jsx("p",{className:"mt-1 truncate text-sm text-fg-muted",children:s.preview}):null,s.tags&&s.tags.length>0?e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:s.tags.map(r=>e.jsxs("span",{className:"chip chip-tag max-w-full break-all",children:["#",r]},r))}):null]})},s.id))})]})}function B({kind:a}){return a==="created"?e.jsx("span",{className:"chip chip-tag shrink-0",children:"Created"}):e.jsx("span",{className:"chip shrink-0",children:"Edited"})}function C(){return e.jsx(N,{title:"No activity in the last 30 days.",action:e.jsx(u,{to:"/new",className:"btn btn-primary",children:"New note"})})}function F(){return e.jsx("div",{className:"space-y-3","aria-busy":"true",children:[0,1,2,3,4].map(a=>e.jsx(y,{className:"h-16 rounded-xl"},a))})}function L({error:a}){const n=a instanceof v;return e.jsx(j,{title:n?"Session expired":"Could not load activity",message:a.message,action:n?e.jsx(u,{to:"/add",className:"btn btn-primary",children:"Reconnect vault"}):void 0})}export{R as Activity};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{y as z,b as E,r,z as I,A as g,C as V,D as A,a as F,F as H,G as q,j as e,P as B,H as D}from"./index-Dwo2xe8_.js";import{W as L}from"./WizardShell-ZqrzQKxp.js";import{s as O}from"./url-QSQwrjSV.js";import"./history-ByMClxJV.js";function W(s){const o=s.trim();if(!o)return null;try{return new URL(g(o)).host}catch{return null}}function J(){const[s,o]=z(),b=E(),m=s.get("url")??"",u=s.get("add")??"",f=/^https?:\/\//i.test(u),v=m||(f?u:""),i=O(s.get("redirect")),[a,y]=r.useState(v),[j,x]=r.useState(null),[R,w]=r.useState(!1),[h,N]=r.useState(!1),S=r.useRef(null),C=r.useRef(v.length>0),U=r.useRef(!1),c=I();r.useEffect(()=>{var t;(t=S.current)==null||t.focus()},[]),r.useEffect(()=>{C.current||c.status==="found"&&c.origin&&a===""&&(y(c.origin),C.current=!0)},[c.status,c.origin,a]);const p=r.useCallback(async t=>{x(null),w(!1);let l;try{l=g(t)}catch(n){x(n.message);return}N(!0);try{const{authorizeUrl:n}=await V(l,void 0,void 0,{...i?{redirect:i}:{}});window.location.assign(n)}catch(n){n instanceof A?w(!0):x(n.message),N(!1)}},[i]);r.useEffect(()=>{if(U.current||!u)return;U.current=!0;const t=new URLSearchParams(s);if(t.delete("add"),o(t,{replace:!0}),m||!f)return;let l;try{l=g(u)}catch{return}const P=F.getState().vaults[H(l)];if(P){q(P.id,{toast:!0}),b(i??"/",{replace:!0});return}p(l)},[u,f,m,i,s,o,b,p]);function k(t){t.preventDefault(),p(a)}const d=W(a);return e.jsxs(L,{escape:{kind:"back",to:"/"},children:[e.jsx(B,{size:60,className:"mx-auto mb-6 drop-in"}),e.jsx("p",{className:"eyebrow mb-3",children:"Self-hosted"}),e.jsxs("h1",{className:"hero-title mb-4",children:["Connect your ",e.jsx("span",{className:"accent-word",children:"own"})," vault."]}),e.jsx("p",{className:"mx-auto mb-8 max-w-sm text-lg leading-relaxed text-fg-muted",children:"Point Parachute at a vault running on your own server."}),e.jsxs("form",{onSubmit:k,className:"mx-auto w-full max-w-sm text-left",children:[e.jsx("label",{htmlFor:"vault-url",className:"eyebrow mb-2 block",children:"Vault address"}),e.jsx("input",{id:"vault-url",ref:S,type:"url",required:!0,placeholder:"hub.your-domain.com",value:a,onChange:t=>y(t.target.value),disabled:h,className:"input input-on-bg font-mono"}),e.jsxs("p",{className:"mt-1.5 text-xs text-fg-dim",children:["A local install lives at ",e.jsx("code",{className:"note-id",children:"http://localhost:1939"}),"."]}),R?e.jsx("div",{className:"mt-3",children:e.jsx(D,{})}):null,j?e.jsx("p",{className:"mt-3 rounded-xl border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:j}):null,d?e.jsxs("div",{className:"mt-5 rounded-2xl border border-sun bg-sun-soft px-4 py-3 text-left font-round text-sm leading-relaxed text-sun-ink",children:["Next, ",e.jsx("b",{className:"font-semibold text-fg",children:d})," — your server, not ours — will ask you to sign in and approve this app. Then you land right back here."]}):null,e.jsx("button",{type:"submit",disabled:h||!a,className:"btn btn-primary btn-lg mt-5 w-full justify-center rounded-full shadow-soft",children:h?"Continuing…":d?`Continue to ${d} →`:"Continue"})]})]})}export{J as AddVault};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as o,J as c,a as d,j as e,P as m}from"./index-Dwo2xe8_.js";import{W as x}from"./WizardShell-ZqrzQKxp.js";import"./history-ByMClxJV.js";function f(){const s=o(),a=c(),t=d(l=>l.getActiveVault()),n=null,r=t?"/vaults":"/";return e.jsxs(x,{wide:!0,escape:{kind:"back",to:r},children:[e.jsx(m,{size:56,className:"mx-auto mb-6"}),a?e.jsxs("p",{className:"chip mb-4 inline-flex border-grass/40 bg-grass-soft text-grass-ink",children:[e.jsx("span",{"aria-hidden":"true",children:"✓"})," Signed in as ",a]}):null,e.jsx("p",{className:"eyebrow mb-3",children:"Add a vault"}),e.jsxs("h1",{className:"hero-title mb-8",style:{fontSize:"clamp(1.8rem, 4vw, 2.4rem)"},children:["Bring another ",e.jsx("span",{className:"accent-word",children:"vault"})," in."]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsx(i,{icon:"📂",verb:"Open",description:"One of your account's vaults not on this device.",onClick:()=>s("/welcome?pick=1")}),e.jsx(i,{icon:"✦",verb:"Create",description:t?e.jsxs(e.Fragment,{children:["Brand-new and empty — separate from"," ",e.jsx("b",{className:"font-semibold text-fg",children:t.name}),"."]}):"Brand-new and empty — its own private space, nothing shared.",foot:n,onClick:()=>s("/add-vault/create")}),e.jsx(i,{icon:"⌂",verb:"Connect",description:"A self-hosted vault on your own server.",onClick:()=>s("/add")})]})]})}function i({icon:s,verb:a,description:t,foot:n,onClick:r}){return e.jsxs("button",{type:"button",onClick:r,"aria-label":a,className:"tile flex flex-col items-center gap-2 p-6 text-center",children:[e.jsx("span",{"aria-hidden":"true",className:"text-xl",children:s}),e.jsx("span",{"aria-hidden":"true",className:"font-round text-base font-bold text-fg",children:a}),e.jsx("span",{className:"font-round text-xs leading-relaxed text-fg-muted",children:t}),n?e.jsx("span",{className:"mt-1 font-round text-xs text-fg-dim",children:n}):null]})}export{f as AddVaultChooser};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as j,y as N,r as n,K as k,n as v,j as e,N as S,P as b,J as C,a as E,d as T,o as A,k as V}from"./index-Dwo2xe8_.js";import{W as g}from"./WizardShell-ZqrzQKxp.js";import"./history-ByMClxJV.js";const h=["Name","Making it","Ready"];function y(t){return t.toLowerCase().replace(/[^a-z0-9-]/g,"")}function M(){const t=j(),[o]=N(),a=o.get("first")==="1",[s,l]=n.useState({kind:"naming"}),i=n.useRef(null);return n.useEffect(()=>{if(s.kind!=="creating"||i.current===s.name)return;i.current=s.name;const{name:r}=s;(async()=>{try{const c=await k(r),d=new URLSearchParams({vault:c});a&&d.set("first","1"),t(`/add-vault/ready?${d.toString()}`,{replace:!0})}catch(c){i.current=null,l({kind:"naming",attemptedName:r,error:v(c,"Couldn't create your vault. Try a different name.")})}})()},[s,t,a]),s.kind==="creating"?e.jsx(g,{escape:{kind:"none"},progress:{labels:h,current:1},children:e.jsx(P,{name:s.name})}):e.jsx(g,{escape:{kind:"back",to:a?"/":"/add-vault"},progress:{labels:h,current:0},children:e.jsx(L,{first:a,initialName:s.attemptedName,error:s.error,onCreate:r=>l({kind:"creating",name:r})})})}function R({email:t}){return t?e.jsxs("p",{className:"chip mb-4 inline-flex border-grass/40 bg-grass-soft text-grass-ink",children:[e.jsx("span",{"aria-hidden":"true",children:"✓"})," Signed in as ",t]}):null}function L({first:t,initialName:o,error:a,onCreate:s}){const[l,i]=n.useState(()=>y(o??"")),[r,c]=n.useState(null),d=C(),p=E(m=>{var x;return((x=m.getActiveVault())==null?void 0:x.name)??null}),u=l.trim();n.useEffect(()=>{let m=!0;return T().then(x=>{m&&c((x==null?void 0:x.vault_url_template)??null)}),()=>{m=!1}},[]);function w(m){m.preventDefault(),u&&s(u)}return e.jsxs(e.Fragment,{children:[e.jsx(b,{size:60,className:"mx-auto mb-6 drop-in"}),e.jsx(R,{email:d}),e.jsx("p",{className:"eyebrow mb-3",children:t?"Account created ✓":"Adding a vault"}),e.jsxs("h1",{className:"hero-title mb-4",children:[t?"Let's make your first":"Let's make your new"," ",e.jsx("span",{className:"accent-word",children:"vault."})]}),e.jsx("p",{className:"mx-auto mb-8 max-w-md text-lg leading-relaxed text-fg-muted",children:t?e.jsxs(e.Fragment,{children:["A vault is the private home for your notes — any AI you invite can read it, always yours to export. ",e.jsx("b",{className:"font-semibold text-fg",children:"This creates a brand-new, empty one."})]}):e.jsxs(e.Fragment,{children:["This one's separate from"," ",e.jsx("b",{className:"font-semibold text-fg",children:p??"your other vault"})," — its own private space, nothing shared."]})}),e.jsxs("form",{onSubmit:w,children:[e.jsx("input",{autoFocus:!0,value:l,onChange:m=>i(y(m.target.value)),placeholder:"moss",autoComplete:"off",spellCheck:!1,"aria-label":"Vault name",className:"mx-auto mb-2 block w-full max-w-sm border-0 border-b-2 border-border bg-transparent pb-2 text-center font-serif text-3xl text-fg outline-none transition-colors focus:border-accent-light"}),e.jsx("p",{className:"mb-6 min-h-6 font-round text-sm text-fg-muted",children:u?e.jsxs("span",{children:["Your vault:"," ",e.jsx("b",{className:"rounded-md bg-grass-soft px-2 py-0.5 text-grass-ink",children:u}),r?e.jsxs(e.Fragment,{children:[" — it will live at ",e.jsx("span",{className:"font-mono text-xs",children:r.replace("{name}",u)})]}):null]}):"Letters, numbers, hyphens — pick a word you like."}),e.jsxs("p",{className:"mx-auto mb-8 max-w-sm font-round text-xs text-fg-dim",children:[e.jsx("span",{className:"font-semibold text-fg-muted",children:"The address is permanent"}),", so pick a word you like. Letters, numbers, hyphens."]}),a?e.jsx("p",{className:"mx-auto mb-6 max-w-sm rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:a}):null,e.jsx("button",{type:"submit",disabled:!u,className:"btn btn-primary btn-lg justify-center rounded-full px-6 shadow-soft",children:u?`Create ${u} →`:"Create →"})]})]})}const f=["Setting up your vault…","Preparing your keys…","Almost there…"];function z(){const[t,o]=n.useState(0);return n.useEffect(()=>{if(t>=f.length-1)return;const a=setTimeout(()=>o(s=>Math.min(s+1,f.length-1)),650);return()=>clearTimeout(a)},[t]),e.jsx("output",{"aria-live":"polite",className:"font-round text-sm text-fg-muted",children:f[t]})}function P({name:t}){return e.jsxs(e.Fragment,{children:[e.jsx(b,{size:96,className:"mx-auto mb-6 animate-pulse"}),e.jsxs("h1",{className:"hero-title mb-3",style:{fontSize:"clamp(1.6rem, 3.5vw, 1.9rem)"},children:["Making a place for ",e.jsxs("span",{className:"accent-word",children:[t,"…"]})]}),e.jsx(z,{})]})}function _(){const t=j(),[o]=N(),a=o.get("vault")??"",s=o.get("first")==="1",[l,i]=n.useState(!1),[r,c]=n.useState(null);if(!a)return e.jsx(S,{to:"/add-vault",replace:!0});async function d(){if(!l){i(!0),c(null);try{await A(a),V(a),t("/")}catch(p){i(!1),c(v(p,"Couldn't open your vault. Try again."))}}}return e.jsxs(g,{escape:s?{kind:"none"}:{kind:"maybe-later",to:"/"},progress:{labels:h,current:2},children:[e.jsx(b,{size:90,className:"mx-auto mb-6 fade-up"}),e.jsx("p",{className:"eyebrow mb-3",children:"Ready"}),e.jsxs("h1",{className:"hero-title mb-3",style:{fontSize:"clamp(1.8rem, 4vw, 2.3rem)"},children:[a," is ",e.jsx("span",{className:"accent-word",children:"ready."})]}),e.jsx("p",{className:"mx-auto mb-8 max-w-sm text-fg-muted",children:"Everything inside is yours. Open format. Export anytime."}),r?e.jsx("p",{className:"mx-auto mb-6 max-w-sm rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:r}):null,e.jsx("button",{type:"button",onClick:d,disabled:l,className:"btn btn-primary btn-lg justify-center rounded-full px-6 shadow-soft",children:l?"Opening…":`Open ${a} →`})]})}export{M as AddVaultCreate,_ as AddVaultReady};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as k,y as E,M as y,O as f,t as A,Q as K,r as j,R as S,T,j as e,N as P,U as N,W as l,X as V,L as c,V as C}from"./index-Dwo2xe8_.js";const R=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],x=5;function W(){const a=k(t=>t.getActiveVault()),[o]=E(),i=o.get("month"),r=y(i)??y(f()),s=A(),h=K(),v=j.useMemo(()=>S(r.year,r.month),[r.year,r.month]),$=j.useMemo(()=>{const t=new Map;if(!s.data)return t;for(const n of s.data){const d=T(n.createdAt);d&&t.set(d,(t.get(d)??0)+1)}return t},[s.data]);if(!a)return e.jsx(P,{to:"/",replace:!0});const u=N(r.year,r.month,-1),p=N(r.year,r.month,1),g=`${u.year}-${l(u.month)}`,b=`${p.year}-${l(p.month)}`,M=f(),w=`${r.year}-${l(r.month)}`===M;return e.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-6 md:px-6 md:py-10",children:[e.jsxs("header",{className:"mb-6 flex flex-wrap items-baseline justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wider text-fg-dim",children:"Calendar"}),e.jsx("h1",{className:"font-serif text-3xl tracking-tight",children:V(r.year,r.month)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[e.jsxs(c,{to:`/calendar?month=${g}`,className:"rounded-lg border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent","aria-label":"Previous month",children:["← ",g]}),w?null:e.jsx(c,{to:"/calendar",className:"rounded-lg border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent",children:"This month"}),e.jsxs(c,{to:`/calendar?month=${b}`,className:"rounded-lg border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent","aria-label":"Next month",children:[b," →"]}),e.jsx(c,{to:`/today?date=${h}`,className:"rounded-lg border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent",children:"Today"})]})]}),s.isError?e.jsx(F,{error:s.error}):e.jsxs("div",{className:"rounded-md border border-border bg-card","aria-busy":s.isPending,children:[e.jsx("div",{className:"grid grid-cols-7 border-b border-border text-xs uppercase tracking-wider text-fg-dim",children:R.map(t=>e.jsx("div",{className:"px-2 py-2 text-center",children:t},t))}),e.jsx("div",{className:"grid grid-cols-7",children:v.map(t=>{const n=`${t.getFullYear()}-${l(t.getMonth()+1)}-${l(t.getDate())}`,d=t.getMonth()+1===r.month,m=$.get(n)??0,D=n===h;return e.jsxs(c,{to:`/today?date=${n}`,className:`flex min-h-20 flex-col border-b border-r border-border p-1.5 text-xs hover:bg-bg/60 focus:bg-bg/60 focus:outline-none ${d?"":"opacity-40"}`,"aria-label":`${n} — ${m} notes`,children:[e.jsx("span",{className:`mb-1 inline-flex h-6 w-6 items-center justify-center rounded-full tabular-nums ${D?"bg-accent text-(--color-on-accent)":"text-fg"}`,children:t.getDate()}),m>0?e.jsx(_,{count:m}):e.jsx("span",{className:"sr-only",children:"no notes"})]},n)})})]}),e.jsx("p",{className:"mt-3 text-xs text-fg-dim",children:"Each dot is a note created on that day. Click any day to open /today."})]})}function _({count:a}){const o=Math.min(a,x),i=a>x?a-x:0;return e.jsxs("span",{className:"flex flex-wrap items-center gap-0.5",children:[Array.from({length:o}).map((r,s)=>e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-accent","aria-hidden":"true"},s)),i>0?e.jsxs("span",{className:"ml-0.5 text-[10px] text-fg-dim",children:["+",i]}):null]})}function F({error:a}){const o=a instanceof C;return e.jsxs("div",{className:"rounded-md border border-red-500/30 bg-red-500/5 p-6",children:[e.jsx("p",{className:"mb-2 font-medium text-red-400",children:o?"Session expired":"Could not load notes"}),e.jsx("p",{className:"mb-4 text-sm text-fg-muted",children:a.message}),o?e.jsx(c,{to:"/add",className:"inline-block rounded-lg bg-accent px-4 py-2 text-sm font-medium text-(--color-on-accent) hover:bg-accent-hover",children:"Reconnect vault"}):null]})}export{W as Calendar};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as S,r as s,J as E,j as e,N as R,P as I,g as f,bB as L,bC as M,bD as O}from"./index-Dwo2xe8_.js";import{W}from"./WizardShell-ZqrzQKxp.js";import"./history-ByMClxJV.js";const h="/welcome",_=3e3,N="That code didn't work — check it and try again.";function T(){const c=S(),[a,v]=s.useState(()=>E()??""),[r,i]=s.useState("idle"),[g,j]=s.useState(""),[w,o]=s.useState(""),[l,d]=s.useState(null),[b,p]=s.useState(!1),u=s.useRef(!1),m=s.useRef(!1);if(s.useEffect(()=>{let t=!1;const x=setInterval(async()=>{try{const k=await f();!t&&k.signed_in&&c(h,{replace:!0})}catch{}},_);return()=>{t=!0,clearInterval(x)}},[c]),!a)return e.jsx(R,{to:"/",replace:!0});async function y(t=a){if(!u.current){u.current=!0;try{const n=await f();await L(t,n.csrf,h),t!==a&&(M(t),v(t)),i("resent")}catch{i("idle")}finally{u.current=!1}}}async function C(t){const n=t.replace(/\D/g,"").slice(0,6);if(o(n),d(null),!(n.length<6||m.current)){m.current=!0,p(!0);try{const x=await f();if(await O(a,n,x.csrf)){c(h,{replace:!0});return}d(N),o("")}catch{d(N),o("")}finally{m.current=!1,p(!1)}}}return e.jsxs(W,{escape:{kind:"back",to:"/",label:"← Back to sign in"},children:[e.jsx(I,{size:56,className:"mx-auto mb-6"}),e.jsx("p",{className:"eyebrow mb-3",children:"Check your email"}),e.jsxs("h1",{className:"hero-title mb-3",style:{fontSize:"clamp(1.6rem, 3.5vw, 2.1rem)"},children:["We sent a sign-in link to ",e.jsx("span",{className:"accent-word",children:a})]}),e.jsx("p",{className:"text-fg-muted",children:"Works once, expires in 10 min."}),e.jsx("p",{className:"mx-auto mt-3 mb-6 max-w-sm font-round text-sm text-fg-muted",children:"New here? That same link creates your account — the email says which."}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-4",children:[e.jsx("button",{type:"button",onClick:()=>y(),className:"btn btn-secondary btn-touch rounded-full",children:"Resend the link"}),e.jsx("button",{type:"button",onClick:()=>i(r==="code"?"idle":"code"),className:"font-round text-sm font-semibold text-link hover:underline",style:{color:"var(--color-sky)"},children:r==="code"?"Hide the code field":"Or type the code from the email"}),e.jsx("button",{type:"button",onClick:()=>i("changeemail"),className:"font-round text-sm font-semibold text-link hover:underline",style:{color:"var(--color-sky)"},children:"Use a different email"})]}),r==="resent"?e.jsx("p",{className:"mx-auto mt-4 max-w-sm rounded-xl border border-grass bg-grass-soft px-4 py-3 text-sm text-grass-ink",children:"✓ Sent again — check your inbox."}):null,r==="code"?e.jsxs("div",{className:"mx-auto mt-4 max-w-xs",children:[e.jsx("label",{htmlFor:"signin-code",className:"mb-2 block font-round text-sm text-fg-muted",children:"6-digit code"}),e.jsx("input",{id:"signin-code",value:w,onChange:t=>{C(t.target.value)},inputMode:"numeric",autoComplete:"one-time-code",pattern:"[0-9]*",placeholder:"123456",disabled:b,"aria-invalid":l?!0:void 0,"aria-describedby":l?"signin-code-error":void 0,autoFocus:!0,className:"input w-full text-center text-2xl tracking-[0.4em]"}),e.jsx("output",{"aria-live":"polite",className:"mt-2 block text-center text-xs text-fg-dim",children:b?"Checking…":" "}),l?e.jsx("p",{id:"signin-code-error",role:"alert",className:"rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-center text-sm text-danger",children:l}):null]}):null,r==="changeemail"?e.jsxs("div",{className:"mx-auto mt-4 max-w-sm",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:g,onChange:t=>j(t.target.value),placeholder:"you@example.com","aria-label":"Email address",type:"email",className:"input"}),e.jsx("button",{type:"button",onClick:()=>{const t=g.trim();/.+@.+\..+/.test(t)&&y(t)},className:"btn btn-primary btn-touch shrink-0 rounded-full",children:"Send link"})]}),e.jsx("button",{type:"button",onClick:()=>i("idle"),className:"mt-2 font-round text-sm text-fg-dim hover:text-accent",children:"Cancel"})]}):null]})}export{T as CheckEmail};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as m,j as e,N as h,L as l,Y as o}from"./index-Dwo2xe8_.js";function u(s){return`${s.replace(/\/+$/,"")}/mcp`}function x(s){return`parachute-${s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"vault"}`}function p(s,t){return`claude mcp add --transport http ${x(s)} ${t}`}function y(){const s=m(n=>n.getActiveVault());if(!s)return e.jsx(h,{to:"/",replace:!0});const t=u(s.url),a=p(s.name,t);return e.jsxs("div",{className:"page-prose",children:[e.jsx("nav",{className:"mb-4 text-sm text-fg-dim",children:e.jsx(l,{to:"/",className:"focus-ring hover:text-accent",children:"← Home"})}),e.jsxs("header",{className:"mb-8",children:[e.jsx("p",{className:"eyebrow mb-1",children:s.name}),e.jsx("h1",{className:"page-title",children:"Connect your AI"}),e.jsx("p",{className:"mt-3 text-fg-muted",children:"Your vault speaks MCP — an open standard — so any AI can read and write it: Claude, ChatGPT, Claude Code, Cursor, or an agent you build. One memory, shared with every assistant you choose to connect."})]}),e.jsxs("section",{"aria-labelledby":"mcp-url-heading",className:"mb-8",children:[e.jsx("h2",{id:"mcp-url-heading",className:"eyebrow mb-2",children:"Your vault address"}),e.jsxs("p",{className:"mb-3 text-sm text-fg-muted",children:["Paste this wherever an AI asks for an MCP server. The"," ",e.jsx("code",{className:"rounded bg-bg-soft px-1 font-mono text-fg",children:"/mcp"})," suffix matters — it's the connection endpoint, not a page to open."]}),e.jsx(o,{value:t,label:"vault MCP URL"}),e.jsxs("p",{className:"mt-3 text-sm text-fg-muted",children:["It reads and writes only inside"," ",e.jsx("b",{className:"rounded-md bg-grass-soft px-2 py-0.5 font-medium text-grass-ink",children:s.name})," ","— never anywhere else. Disconnect anytime from your vault's settings."]})]}),e.jsx("h2",{className:"eyebrow mb-3",children:"Bring your AI in"}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(d,{title:"Claude",initial:"C",tone:"coral",steps:g}),e.jsx(d,{title:"ChatGPT",initial:"G",tone:"grass",steps:b,note:"Exact menu names vary by ChatGPT version; the shape is the same — add an MCP server, paste the URL."})]}),e.jsxs("section",{"aria-labelledby":"other-clients-heading",className:"mt-8",children:[e.jsx("h2",{id:"other-clients-heading",className:"eyebrow mb-2",children:"Other AIs & the command line"}),e.jsx("p",{className:"mb-3 text-sm text-fg-muted",children:"That same URL works in any MCP-compatible client — Cursor, an agent you build, anywhere an AI asks for an MCP server. For Claude Code:"}),e.jsx(o,{value:a,label:"Claude Code command"})]}),e.jsx("div",{className:"mt-10 flex flex-wrap items-center gap-3 border-t border-border pt-6",children:e.jsx(l,{to:"/",className:"btn btn-primary btn-touch",children:"Done — back to your vault"})})]})}const g=[{key:"settings",body:e.jsxs(e.Fragment,{children:["Open"," ",e.jsx("a",{href:"https://claude.ai",target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline",children:"claude.ai"})," ","and go to ",e.jsx("strong",{className:"text-fg",children:"Settings → Connectors"}),"."]})},{key:"add",body:e.jsxs(e.Fragment,{children:["Choose ",e.jsx("strong",{className:"text-fg",children:"Add custom connector"}),"."]})},{key:"paste",body:"Paste your vault address above and connect."}],b=[{key:"settings",body:e.jsxs(e.Fragment,{children:["Open ChatGPT's ",e.jsx("strong",{className:"text-fg",children:"Settings"})," and find its connectors (custom connectors need a paid ChatGPT plan)."]})},{key:"add",body:"Add a custom connector / MCP server."},{key:"paste",body:"Paste the same vault address and connect."}];function d({title:s,initial:t,tone:a,steps:n,note:r}){const i=a==="coral"?"bg-coral-soft text-coral-ink":"bg-grass-soft text-grass-ink";return e.jsxs("section",{className:"tile p-5","aria-label":`Connect ${s}`,children:[e.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[e.jsx("span",{"aria-hidden":"true",className:`grid h-9 w-9 shrink-0 place-items-center rounded-full font-round text-sm font-semibold ${i}`,children:t}),e.jsx("h2",{className:"font-serif text-xl text-fg",children:s})]}),e.jsx("ol",{className:"list-decimal space-y-2 pl-5 text-sm text-fg-muted",children:n.map(c=>e.jsx("li",{children:c.body},c.key))}),r?e.jsx("p",{className:"mt-3 text-xs text-fg-dim",children:r}):null]})}export{y as ConnectAI};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as g,y as w,j as e,N as p,Q as k,Z as E,t as S,r as A,T as y,L as c,_ as b,$ as D,a0 as R,v as T,E as V,w as $,a1 as L,a2 as B,a3 as C,a4 as K,V as P}from"./index-Dwo2xe8_.js";import{u as O}from"./history-ByMClxJV.js";function Z(){const s=g(t=>t.getActiveVault()),[a]=w(),n=a.get("date");return s?n===null?e.jsx(p,{to:"/",replace:!0}):e.jsx(F,{dateParam:n}):e.jsx(p,{to:"/",replace:!0})}function F({dateParam:s}){const a=O("/"),n=k(),t=s||n,r=E(t),o=S(),i=A.useMemo(()=>{const m=[],x=[];if(!o.data||!r)return{created:m,edited:x};for(const l of o.data){const j=y(l.createdAt),v=y(l.updatedAt??l.createdAt);j===t&&m.push(l),v===t&&j!==t&&x.push(l)}return{created:m,edited:x}},[o.data,r,t]);if(!r)return e.jsxs("div",{className:"page-prose",children:[e.jsxs("p",{className:"text-sm text-danger",children:["Invalid date in URL: ",t]}),e.jsx(c,{to:"/",className:"text-sm text-accent hover:underline",children:"Back to today"})]});const d=t===n,u=b(t,-1),h=b(t,1),f=t.slice(0,7);return e.jsxs("div",{className:"page-prose",children:[e.jsx("nav",{className:"mb-6 text-sm text-fg-dim",children:e.jsx("button",{type:"button",onClick:a,className:"hover:text-accent",children:"← Back"})}),e.jsxs("header",{className:"mb-6 flex flex-wrap items-baseline justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow",children:d?"Today":"On"}),e.jsx("h1",{className:"page-title",children:D(t)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[e.jsxs(c,{to:`/today?date=${u}`,className:"btn btn-secondary btn-sm","aria-label":"Previous day",children:["← ",u]}),d?null:e.jsx(c,{to:"/",className:"btn btn-secondary btn-sm",children:"Today"}),e.jsxs(c,{to:`/today?date=${h}`,className:"btn btn-secondary btn-sm","aria-label":"Next day",children:[h," →"]}),e.jsx(c,{to:`/calendar?month=${f}`,className:"btn btn-secondary btn-sm",children:"Calendar"}),e.jsx(c,{to:"/new",className:"btn btn-primary btn-sm",children:"+ New note"})]})]}),o.isPending?e.jsx(I,{}):o.isError&&!o.data?e.jsx(M,{error:o.error}):i.created.length===0&&i.edited.length===0?e.jsx(H,{isToday:d,targetKey:t}):e.jsxs("div",{className:"space-y-8",children:[o.isError?e.jsx(R,{}):null,i.created.length>0?e.jsx(N,{title:d?"Created today":`Created on ${t}`,notes:i.created}):null,i.edited.length>0?e.jsx(N,{title:d?"Edited today":`Edited on ${t}`,notes:i.edited}):null]})]})}function N({title:s,notes:a}){const n=g(r=>r.getActiveVault()),{roles:t}=L((n==null?void 0:n.id)??null);return e.jsxs("section",{children:[e.jsxs(B,{children:[s," (",a.length,")"]}),e.jsx(C,{children:a.map(r=>e.jsx(K,{note:r,pinnedTag:t.pinned,archivedTag:t.archived},r.id))})]})}function H({isToday:s,targetKey:a}){return e.jsx($,{title:s?"Nothing yet today — start capturing.":`Nothing on ${a}.`,action:s?e.jsx(c,{to:"/new",className:"btn btn-primary",children:"New note"}):void 0})}function I(){return e.jsx("div",{className:"space-y-3","aria-busy":"true",children:[0,1,2,3].map(s=>e.jsx(T,{className:"h-14 rounded-xl"},s))})}function M({error:s}){const a=s instanceof P;return e.jsx(V,{title:a?"Session expired":"Could not load notes",message:s.message,action:a?e.jsx(c,{to:"/add",className:"btn btn-primary",children:"Reconnect vault"}):void 0})}export{Z as DayView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as u,a5 as m,a6 as p,r as d,j as e,N as x,a7 as h,L as g}from"./index-Dwo2xe8_.js";function j(){const a=u(s=>s.getActiveVault()),n=m(),r=p(s=>s.push),[t,o]=d.useState({kind:"idle"});if(!a)return e.jsx(x,{to:"/",replace:!0});const i=d.useCallback(async()=>{if(!n){r("Vault session unavailable — reconnect first","error");return}o({kind:"preparing"});try{const s=await n.exportVault(),c=new Date().toISOString().slice(0,10);f(s,`${a.name}-export-${c}.tar`),o({kind:"idle"}),r("Export downloaded.","success")}catch(s){if(s instanceof h){o({kind:"unsupported"});return}o({kind:"error",message:"Couldn't reach your vault — try again."})}},[n,a.name,r]),l=t.kind==="preparing";return e.jsxs("div",{className:"page-prose",children:[e.jsx("nav",{className:"mb-4 text-sm text-fg-dim",children:e.jsx(g,{to:"/notes",className:"focus-ring hover:text-accent",children:"← All notes"})}),e.jsxs("header",{className:"mb-8",children:[e.jsxs("h1",{className:"page-title",children:["Export notes from ",e.jsx("span",{className:"text-accent",children:a.name})]}),e.jsx("p",{className:"mt-3 text-fg-muted",children:"A portable folder of your notes — plain Markdown, with your tags, links, and attachments included. Yours to keep, no matter what happens to Parachute."})]}),e.jsxs("section",{className:"card space-y-5 rounded-xl p-6 shadow-soft",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-serif text-lg text-fg",children:"What's in the download"}),e.jsxs("ul",{className:"mt-2 list-disc space-y-1 pl-5 text-sm text-fg-muted",children:[e.jsx("li",{children:"One markdown file per note, with tags, metadata, and links as frontmatter."}),e.jsx("li",{children:"Your tag definitions, so an import elsewhere keeps their structure."}),e.jsx("li",{children:"Attachment files — images, audio, PDF, video — alongside the notes that use them."})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("button",{type:"button",onClick:i,disabled:l,className:"btn btn-primary btn-touch",children:l?"Preparing your export…":"Export my vault"}),l?e.jsx("span",{className:"text-sm text-fg-dim",children:"This can take a moment."}):null]}),t.kind==="error"?e.jsx("p",{className:"rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:t.message}):null,t.kind==="unsupported"?e.jsxs("div",{className:"rounded-lg border border-border bg-bg-soft px-3 py-2 text-sm text-fg-muted",children:[e.jsx("p",{children:"Export over the web isn't available on this vault yet — self-hosted vaults don't carry this door today."}),e.jsxs("p",{className:"mt-1",children:["From the vault's command line, run"," ",e.jsx("code",{className:"rounded bg-card px-1 font-mono text-fg",children:"parachute-vault export <dir>"})," ","to get the same portable folder."]})]}):null]})]})}function f(a,n){const r=URL.createObjectURL(a),t=document.createElement("a");t.href=r,t.download=n,document.body.appendChild(t),t.click(),t.remove(),URL.revokeObjectURL(r)}export{j as Export};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{a8 as te,a9 as ee,V as re,aa as Mt,ab as kt,ac as ne,a as se,a5 as ie,b as ae,y as oe,a6 as le,r as gt,j as D,N as Tt,L as ce}from"./index-Dwo2xe8_.js";import{f as ue,A as he}from"./attachment-upload-l7qA8_xw.js";const de=new Set(["png","jpg","jpeg","gif","webp"]),fe=new Set(["wav","mp3","m4a","ogg","webm"]),pe=new Set(["mp4"]),me=new Set(["txt","json","csv","yaml","yml","svg","tsv","log"]);function ge(y){const S=y.toLowerCase();return de.has(S)?"image":S==="pdf"?"pdf":fe.has(S)?"audio":pe.has(S)?"video":me.has(S)?"text":"unsupported"}function _e(y){return ge(ue(y))}function be(y){return y==="image"||y==="pdf"||y==="audio"||y==="video"}function $t(y){return typeof y.text=="function"?y.text():new Promise((S,o)=>{const b=new FileReader;b.onload=()=>S(b.result),b.onerror=()=>o(b.error??new Error("FileReader failed")),b.readAsText(y)})}function ye(y){const S=new Map,o=new Map;for(const b of y){const h=b.filename.toLowerCase();S.has(h)||S.set(h,b),o.set(Nt(b.sourcePath),b)}return{byBasename:S,byPath:o}}function Nt(y){let S=y.trim();try{S=decodeURIComponent(S)}catch{}return S=S.replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,""),S.toLowerCase()}function Ct(y){const S=Nt(y),o=S.lastIndexOf("/");return o>=0?S.slice(o+1):S}function Bt(y){return/\.[a-z0-9]+$/i.test(Ct(y))}function Dt(y,S){const o=Nt(S),b=y.byPath.get(o);if(b)return b;for(const[h,i]of y.byPath)if(h===o||h.endsWith(`/${o}`))return i;return y.byBasename.get(Ct(S))??null}function Ft(y,S){const o=`/api/storage/${y.storagePath}`,b=S||y.filename;return y.isImage?``:`[${b}](${o})`}function ve(y,S){let o=0;const b=new Set,h=/(!?)\[\[([^\]|#]+)(?:[#|][^\]]*)?\]\]/g,i=y.replace(h,(c,m,v)=>{if(!Bt(v))return c;const _=Dt(S,v);return _?(o++,b.add(_.sourcePath),Ft(_,Ct(v))):c}),n=/(!?)\[([^\]]*)\]\(\s*(<[^>]+>|[^)\s]+)(\s+[^)]*)?\)/g;return{content:i.replace(n,(c,m,v,_,w)=>{const s=_.startsWith("<")&&_.endsWith(">")?_.slice(1,-1):_;if(/^(https?:|mailto:|tel:|#|\/api\/storage\/)/i.test(s.trim())||!Bt(s))return c;const d=Dt(S,s);if(!d)return c;o++,b.add(d.sourcePath);const a=v.trim()||Ct(s);return Ft(d,a)}),rewritten:o,referenced:b}}const we=5,ke=500;async function It(y){const{client:S,notes:o,onProgress:b,signal:h}=y,i=Math.max(1,y.concurrency??we),n=[];let r=0,c=0,m=!1;const v=o.map(ze);async function _(){for(;;){if(h!=null&&h.aborted||m)return;const l=r++;if(l>=o.length)return;const u=o[l],p=v[l],x=await xe(S,u,p,h);n[l]=x,c++,x.status==="errored"&&x.reason.startsWith("auth:")&&(m=!0),b==null||b({done:c,total:o.length})}}const w=Array.from({length:Math.min(i,o.length)},()=>_());await Promise.all(w);for(let l=0;l<o.length;l++)n[l]||(n[l]={status:"errored",sourcePath:o[l].sourcePath,reason:m?"Skipped — vault session ended before this note was reached.":"Skipped — import was cancelled."});let s=0,d=0,a=0;for(const l of n)l.status==="created"?s++:l.status==="skipped"?d++:a++;return{created:s,skipped:d,errored:a,outcomes:n}}async function xe(y,S,o,b){try{const h=await Se(y,o,b);return{status:"created",sourcePath:S.sourcePath,noteId:h.id}}catch(h){return h instanceof te||h instanceof ee?{status:"skipped",sourcePath:S.sourcePath,reason:h.message||"Already exists in vault"}:h instanceof re?{status:"errored",sourcePath:S.sourcePath,reason:`auth: ${h.message}`}:h instanceof Mt?{status:"errored",sourcePath:S.sourcePath,reason:`vault unreachable (${h.status}): ${h.message}`}:{status:"errored",sourcePath:S.sourcePath,reason:h instanceof Error?h.message:String(h)}}}async function Se(y,S,o){const b={};o&&(b.signal=o);try{return await y.createNote(S,b)}catch(h){if(!Ce(h)||o!=null&&o.aborted)throw h;return await Ee(ke,o),await y.createNote(S,b)}}function Ce(y){return y instanceof Mt}function Ee(y,S){return new Promise(o=>{const b=setTimeout(()=>{S==null||S.removeEventListener("abort",h),o()},y),h=()=>{clearTimeout(b),o()};S&&S.addEventListener("abort",h,{once:!0})})}function ze(y){const S={content:y.content};y.path&&(S.path=y.path),y.tags.length>0&&(S.tags=y.tags),Object.keys(y.metadata).length>0&&(S.metadata=y.metadata);const o=S;return y.id&&(o.id=y.id),y.createdAt&&(o.created_at=y.createdAt),S}const Lt="Imported files",Ae=20;async function Ie(y){const{client:S,parsed:o,signal:b}=y,h=[],i=[],n=[],r=[];for(const l of o.attachments)be(l.kind)?i.push(l):l.kind==="text"?n.push(l):r.push(l);const c=new Map;for(const l of i){if(b!=null&&b.aborted){h.push({status:"skipped",sourcePath:l.sourcePath,reason:"Skipped — import was cancelled."});continue}try{const u=new File([l.blob],l.filename,{type:l.blob.type||void 0}),p=await S.uploadStorageFile(u,{signal:b});c.set(l.sourcePath,{attachment:l,storagePath:p.path,mimeType:p.mimeType,isImage:p.mimeType.startsWith("image/")})}catch(u){h.push({status:"errored",sourcePath:l.sourcePath,reason:`Upload failed: ${u instanceof Error?u.message:String(u)}`})}}const m=Ne(c),v=new Map,_=o.notes.map(l=>{const{content:u,referenced:p}=ve(l.content,m);return v.set(l.sourcePath,p),{...l,content:u}}),w=await It({client:S,notes:_,...y.concurrency!==void 0?{concurrency:y.concurrency}:{},...y.onProgress?{onProgress:y.onProgress}:{},...b?{signal:b}:{}}),s=new Map;for(const l of w.outcomes)l.status==="created"&&s.set(l.sourcePath,l.noteId);const d=new Map;for(const[l,u]of v){const p=s.get(l);if(p)for(const x of u){let E=d.get(x);E||(E=new Set,d.set(x,E)),E.add(p)}}for(const[l,u]of c){const p=d.get(l);if(!p||p.size===0)continue;let x=0;for(const E of p){if(b!=null&&b.aborted)break;try{await S.linkAttachment(E,{path:u.storagePath,mimeType:u.mimeType}),x++}catch{}}h.push({status:"uploaded",sourcePath:l,storagePath:u.storagePath,references:x})}if(n.length>0&&!(b!=null&&b.aborted)){const l=[];for(const p of n)l.push(await je(p));const u=await It({client:S,notes:l,...y.concurrency!==void 0?{concurrency:y.concurrency}:{},...b?{signal:b}:{}});for(let p=0;p<n.length;p++){const x=n[p],E=u.outcomes[p];(E==null?void 0:E.status)==="created"?h.push({status:"uploaded",sourcePath:x.sourcePath,storagePath:`note:${E.noteId}`,references:1,asNote:!0}):h.push({status:"skipped",sourcePath:x.sourcePath,reason:(E==null?void 0:E.status)==="skipped"?`Imported as note, but ${E.reason}`:`Could not import as note: ${(E==null?void 0:E.status)==="errored"?E.reason:"unknown"}`})}}else if(n.length>0)for(const l of n)h.push({status:"skipped",sourcePath:l.sourcePath,reason:"Skipped — import was cancelled."});const a=[...c.entries()].filter(([l])=>{var u;return!(((u=d.get(l))==null?void 0:u.size)??0)}).map(([,l])=>l);if(a.length>0)if(b!=null&&b.aborted)for(const l of a)h.push({status:"uploaded",sourcePath:l.attachment.sourcePath,storagePath:l.storagePath,references:0});else await Re(S,a,h,y.concurrency,b);for(const l of r)h.push({status:"skipped",sourcePath:l.sourcePath,reason:`.${l.ext||"?"} is not a vault storage type — not imported. (Re-save it in a supported format to bring it across.)`});return Te(w,h)}function Ne(y){return ye([...y.values()].map(S=>({sourcePath:S.attachment.sourcePath,storagePath:S.storagePath,isImage:S.isImage,filename:S.attachment.filename})))}async function je(y){let S="";try{S=await $t(y.blob)}catch{S=""}const o=Pe(y.ext)?`\`\`\`${Oe(y.ext)}
|
|
2
|
+
${S}
|
|
3
|
+
\`\`\`
|
|
4
|
+
`:`${S}
|
|
5
|
+
`;return{sourcePath:y.sourcePath,path:y.sourcePath.replace(/\.([^/.]+)$/,"-$1"),content:o,tags:["imported-file"],metadata:{imported_from:y.sourcePath,original_type:y.ext}}}function Pe(y){return["json","csv","tsv","yaml","yml","svg","log"].includes(y.toLowerCase())}function Oe(y){const S=y.toLowerCase();return S==="yml"?"yaml":S==="svg"?"xml":S==="tsv"?"csv":S}async function Re(y,S,o,b,h){const i=["# Imported files","","Attachments from your import not embedded in any note:",""];for(const r of S){const c=`/api/storage/${r.storagePath}`;i.push(r.isImage?`- `:`- [${r.attachment.filename}](${c})`)}let n=null;for(let r=1;r<=Ae&&!n&&!(h!=null&&h.aborted);r++){const c=r===1?Lt:`${Lt} ${r}`,m={sourcePath:c,path:c,content:`${i.join(`
|
|
6
|
+
`)}
|
|
7
|
+
`,tags:["imported-file"],metadata:{}},_=(await It({client:y,notes:[m],...b!==void 0?{concurrency:b}:{}})).outcomes[0];if((_==null?void 0:_.status)==="created")n=_.noteId;else if((_==null?void 0:_.status)!=="skipped")break}for(const r of S){if(n)try{await y.linkAttachment(n,{path:r.storagePath,mimeType:r.mimeType})}catch{}o.push({status:"uploaded",sourcePath:r.attachment.sourcePath,storagePath:r.storagePath,references:n?1:0})}}function Te(y,S){let o=0,b=0,h=0,i=0;for(const n of S)n.status==="uploaded"?n.asNote?b++:o++:n.status==="skipped"?h++:i++;return{...y,attachmentsUploaded:o,filesImportedAsNotes:b,attachmentsSkipped:h,attachmentsErrored:i,attachmentOutcomes:S}}function Be(y){return y.length===0?"unknown":y.some(Ht)?"obsidian-zip":y.some(jt)?"loose-markdown":"unknown"}function Ht(y){return y.name.toLowerCase().endsWith(".zip")}function jt(y){const S=y.name.toLowerCase();return S.endsWith(".md")||S.endsWith(".markdown")}function De(y){const S=y.charCodeAt(0)===65279?y.slice(1):y,o=S.split(/\r?\n/);if(o[0]!=="---")return{data:{},content:S};let b=-1;for(let n=1;n<o.length;n++)if(o[n]==="---"){b=n;break}if(b===-1)return{data:{},content:S};const h=o.slice(1,b).join(`
|
|
8
|
+
`),i=o.slice(b+1).join(`
|
|
9
|
+
`);return{data:Fe(h),content:i}}function Fe(y){const S=y.split(/\r?\n/),o={};let b=0;for(;b<S.length;){const h=S[b]??"";if(h.trim()===""||h.trimStart().startsWith("#")){b++;continue}const i=h.match(/^([\w][\w.-]*)\s*:\s*(.*)$/);if(!i){b++;continue}const n=i[1],r=(i[2]??"").trim();if(r===""){const c=Ue(S,b+1);if(c!=null&&c.line.trimStart().startsWith("- ")){const{items:m,consumed:v}=Le(S,b+1,c.indent);o[n]=m,b=b+1+v}else o[n]="",b++}else o[n]=Pt(r),b++}return o}function Le(y,S,o){const b=[];let h=S;for(;h<y.length;){const i=y[h]??"";if(i.trim()===""){h++;continue}const n=Gt(i);if(n<o||!i.slice(n).startsWith("- "))break;const r=i.slice(n+2).trim();b.push(Pt(r)),h++}return{items:b,consumed:h-S}}function Ue(y,S){for(let o=S;o<y.length;o++){const b=y[o]??"";if(b.trim()!=="")return{line:b,indent:Gt(b)}}return null}function Gt(y){let S=0;for(;S<y.length&&y[S]===" ";)S++;return S}function Pt(y){if(y.length===0)return"";if(y.startsWith("[")&&y.endsWith("]")){const S=y.slice(1,-1).trim();return S===""?[]:We(S).map(o=>Pt(o.trim()))}if(y.startsWith('"')&&y.endsWith('"')&&y.length>=2)return y.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\");if(y.startsWith("'")&&y.endsWith("'")&&y.length>=2)return y.slice(1,-1).replace(/''/g,"'");if(y==="true")return!0;if(y==="false")return!1;if(y==="null"||y==="~")return null;if(/^-?\d+(\.\d+)?$/.test(y)){const S=Number(y);return Number.isFinite(S)?S:y}return y}function We(y){const S=[];let o=0,b=null,h=0;for(let i=0;i<y.length;i++){const n=y[i];if(b){n===b&&(b=null);continue}if(n==='"'||n==="'"){b=n;continue}n==="["?o++:n==="]"?o--:n===","&&o===0&&(S.push(y.slice(h,i)),h=i+1)}return S.push(y.slice(h)),S}function Vt(y){const{sourcePath:S,raw:o}=y,{data:b,content:h}=De(o),i=Ze(b,S),n=Xt(b,"id"),r=xt(b,"created_at")??xt(b,"createdAt"),c=xt(b,"updated_at")??xt(b,"updatedAt"),m=He(b,h),v=new Set(["id","path","tags","created_at","createdAt","updated_at","updatedAt"]),_={};for(const[s,d]of Object.entries(b))v.has(s)||(_[s]=d);const w={sourcePath:S,path:i,content:h,tags:m,metadata:_};return n&&(w.id=n),r&&(w.createdAt=r),c&&(w.updatedAt=c),w}function Ze(y,S){const o=Xt(y,"path");return Wt(Ut(o||S))}function Xt(y,S){const o=y[S];if(typeof o=="string"&&o.trim()!=="")return o.trim()}function xt(y,S){const o=y[S];if(typeof o=="string"&&o.trim()!=="")return o.trim();if(typeof o=="number")return String(o)}function Ut(y){return y.replace(/\.(md|markdown)$/i,"")}function Wt(y){return y.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+|\/+$/g,"")}const Me=/(?:^|\s)#([A-Za-z0-9_/-]*[A-Za-z_/-][A-Za-z0-9_/-]*)/g;function $e(y){return y.replace(/```[\s\S]*?```/g,"").replace(/`[^`\n]+`/g,"")}function He(y,S){const o=new Set,b=y.tags;if(Array.isArray(b))for(const i of b){const n=zt(i);n&&o.add(n)}else if(typeof b=="string")for(const i of b.split(/[,\s]+/)){const n=zt(i);n&&o.add(n)}const h=$e(S);for(const i of h.matchAll(Me)){const n=zt(i[1]??"");n&&o.add(n)}return[...o]}function zt(y){if(typeof y!="string")return typeof y=="number"||typeof y=="boolean"?String(y).toLowerCase():null;const S=y.trim().replace(/^#/,"").toLowerCase();return!S||!/^[a-z0-9_/-]+$/.test(S)?null:S}async function Ge(y){const S=[],o=[];for(const b of y){if(!jt(b)){o.push({sourcePath:b.name,reason:"Not a markdown file (.md / .markdown) — skipped."});continue}try{const h=await $t(b),i=b.webkitRelativePath||b.name,n=Vt({sourcePath:i,raw:h});S.push(n)}catch(h){o.push({sourcePath:b.name,reason:h instanceof Error?h.message:String(h)})}}return{format:"loose-markdown",notes:S,errors:o,tags:Ve(S),attachments:[]}}function Ve(y){const S=new Set;for(const o of y)for(const b of o.tags)S.add(b);return[...S].sort()}function St(y){throw new Error('Could not dynamically require "'+y+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var At={exports:{}};/*!
|
|
10
|
+
|
|
11
|
+
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
|
|
12
|
+
<http://stuartk.com/jszip>
|
|
13
|
+
|
|
14
|
+
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
|
15
|
+
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
|
16
|
+
|
|
17
|
+
JSZip uses the library pako released under the MIT license :
|
|
18
|
+
https://github.com/nodeca/pako/blob/main/LICENSE
|
|
19
|
+
*/var Zt;function Xe(){return Zt||(Zt=1,(function(y,S){(function(o){y.exports=o()})(function(){return(function o(b,h,i){function n(m,v){if(!h[m]){if(!b[m]){var _=typeof St=="function"&&St;if(!v&&_)return _(m,!0);if(r)return r(m,!0);var w=new Error("Cannot find module '"+m+"'");throw w.code="MODULE_NOT_FOUND",w}var s=h[m]={exports:{}};b[m][0].call(s.exports,function(d){var a=b[m][1][d];return n(a||d)},s,s.exports,o,b,h,i)}return h[m].exports}for(var r=typeof St=="function"&&St,c=0;c<i.length;c++)n(i[c]);return n})({1:[function(o,b,h){var i=o("./utils"),n=o("./support"),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";h.encode=function(c){for(var m,v,_,w,s,d,a,l=[],u=0,p=c.length,x=p,E=i.getTypeOf(c)!=="string";u<c.length;)x=p-u,_=E?(m=c[u++],v=u<p?c[u++]:0,u<p?c[u++]:0):(m=c.charCodeAt(u++),v=u<p?c.charCodeAt(u++):0,u<p?c.charCodeAt(u++):0),w=m>>2,s=(3&m)<<4|v>>4,d=1<x?(15&v)<<2|_>>6:64,a=2<x?63&_:64,l.push(r.charAt(w)+r.charAt(s)+r.charAt(d)+r.charAt(a));return l.join("")},h.decode=function(c){var m,v,_,w,s,d,a=0,l=0,u="data:";if(c.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");var p,x=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===r.charAt(64)&&x--,c.charAt(c.length-2)===r.charAt(64)&&x--,x%1!=0)throw new Error("Invalid base64 input, bad content length.");for(p=n.uint8array?new Uint8Array(0|x):new Array(0|x);a<c.length;)m=r.indexOf(c.charAt(a++))<<2|(w=r.indexOf(c.charAt(a++)))>>4,v=(15&w)<<4|(s=r.indexOf(c.charAt(a++)))>>2,_=(3&s)<<6|(d=r.indexOf(c.charAt(a++))),p[l++]=m,s!==64&&(p[l++]=v),d!==64&&(p[l++]=_);return p}},{"./support":30,"./utils":32}],2:[function(o,b,h){var i=o("./external"),n=o("./stream/DataWorker"),r=o("./stream/Crc32Probe"),c=o("./stream/DataLengthProbe");function m(v,_,w,s,d){this.compressedSize=v,this.uncompressedSize=_,this.crc32=w,this.compression=s,this.compressedContent=d}m.prototype={getContentWorker:function(){var v=new n(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),_=this;return v.on("end",function(){if(this.streamInfo.data_length!==_.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),v},getCompressedWorker:function(){return new n(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},m.createWorkerFrom=function(v,_,w){return v.pipe(new r).pipe(new c("uncompressedSize")).pipe(_.compressWorker(w)).pipe(new c("compressedSize")).withStreamInfo("compression",_)},b.exports=m},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(o,b,h){var i=o("./stream/GenericWorker");h.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},h.DEFLATE=o("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(o,b,h){var i=o("./utils"),n=(function(){for(var r,c=[],m=0;m<256;m++){r=m;for(var v=0;v<8;v++)r=1&r?3988292384^r>>>1:r>>>1;c[m]=r}return c})();b.exports=function(r,c){return r!==void 0&&r.length?i.getTypeOf(r)!=="string"?(function(m,v,_,w){var s=n,d=w+_;m^=-1;for(var a=w;a<d;a++)m=m>>>8^s[255&(m^v[a])];return-1^m})(0|c,r,r.length,0):(function(m,v,_,w){var s=n,d=w+_;m^=-1;for(var a=w;a<d;a++)m=m>>>8^s[255&(m^v.charCodeAt(a))];return-1^m})(0|c,r,r.length,0):0}},{"./utils":32}],5:[function(o,b,h){h.base64=!1,h.binary=!1,h.dir=!1,h.createFolders=!0,h.date=null,h.compression=null,h.compressionOptions=null,h.comment=null,h.unixPermissions=null,h.dosPermissions=null},{}],6:[function(o,b,h){var i=null;i=typeof Promise<"u"?Promise:o("lie"),b.exports={Promise:i}},{lie:37}],7:[function(o,b,h){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",n=o("pako"),r=o("./utils"),c=o("./stream/GenericWorker"),m=i?"uint8array":"array";function v(_,w){c.call(this,"FlateWorker/"+_),this._pako=null,this._pakoAction=_,this._pakoOptions=w,this.meta={}}h.magic="\b\0",r.inherits(v,c),v.prototype.processChunk=function(_){this.meta=_.meta,this._pako===null&&this._createPako(),this._pako.push(r.transformTo(m,_.data),!1)},v.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},v.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},v.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var _=this;this._pako.onData=function(w){_.push({data:w,meta:_.meta})}},h.compressWorker=function(_){return new v("Deflate",_)},h.uncompressWorker=function(){return new v("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(o,b,h){function i(s,d){var a,l="";for(a=0;a<d;a++)l+=String.fromCharCode(255&s),s>>>=8;return l}function n(s,d,a,l,u,p){var x,E,z=s.file,F=s.compression,O=p!==m.utf8encode,Z=r.transformTo("string",p(z.name)),P=r.transformTo("string",m.utf8encode(z.name)),H=z.comment,J=r.transformTo("string",p(H)),k=r.transformTo("string",m.utf8encode(H)),R=P.length!==z.name.length,e=k.length!==H.length,B="",tt="",W="",et=z.dir,M=z.date,Q={crc32:0,compressedSize:0,uncompressedSize:0};d&&!a||(Q.crc32=s.crc32,Q.compressedSize=s.compressedSize,Q.uncompressedSize=s.uncompressedSize);var N=0;d&&(N|=8),O||!R&&!e||(N|=2048);var I=0,q=0;et&&(I|=16),u==="UNIX"?(q=798,I|=(function(V,at){var ut=V;return V||(ut=at?16893:33204),(65535&ut)<<16})(z.unixPermissions,et)):(q=20,I|=(function(V){return 63&(V||0)})(z.dosPermissions)),x=M.getUTCHours(),x<<=6,x|=M.getUTCMinutes(),x<<=5,x|=M.getUTCSeconds()/2,E=M.getUTCFullYear()-1980,E<<=4,E|=M.getUTCMonth()+1,E<<=5,E|=M.getUTCDate(),R&&(tt=i(1,1)+i(v(Z),4)+P,B+="up"+i(tt.length,2)+tt),e&&(W=i(1,1)+i(v(J),4)+k,B+="uc"+i(W.length,2)+W);var X="";return X+=`
|
|
20
|
+
\0`,X+=i(N,2),X+=F.magic,X+=i(x,2),X+=i(E,2),X+=i(Q.crc32,4),X+=i(Q.compressedSize,4),X+=i(Q.uncompressedSize,4),X+=i(Z.length,2),X+=i(B.length,2),{fileRecord:_.LOCAL_FILE_HEADER+X+Z+B,dirRecord:_.CENTRAL_FILE_HEADER+i(q,2)+X+i(J.length,2)+"\0\0\0\0"+i(I,4)+i(l,4)+Z+B+J}}var r=o("../utils"),c=o("../stream/GenericWorker"),m=o("../utf8"),v=o("../crc32"),_=o("../signature");function w(s,d,a,l){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=d,this.zipPlatform=a,this.encodeFileName=l,this.streamFiles=s,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(w,c),w.prototype.push=function(s){var d=s.meta.percent||0,a=this.entriesCount,l=this._sources.length;this.accumulate?this.contentBuffer.push(s):(this.bytesWritten+=s.data.length,c.prototype.push.call(this,{data:s.data,meta:{currentFile:this.currentFile,percent:a?(d+100*(a-l-1))/a:100}}))},w.prototype.openedSource=function(s){this.currentSourceOffset=this.bytesWritten,this.currentFile=s.file.name;var d=this.streamFiles&&!s.file.dir;if(d){var a=n(s,d,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:a.fileRecord,meta:{percent:0}})}else this.accumulate=!0},w.prototype.closedSource=function(s){this.accumulate=!1;var d=this.streamFiles&&!s.file.dir,a=n(s,d,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(a.dirRecord),d)this.push({data:(function(l){return _.DATA_DESCRIPTOR+i(l.crc32,4)+i(l.compressedSize,4)+i(l.uncompressedSize,4)})(s),meta:{percent:100}});else for(this.push({data:a.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},w.prototype.flush=function(){for(var s=this.bytesWritten,d=0;d<this.dirRecords.length;d++)this.push({data:this.dirRecords[d],meta:{percent:100}});var a=this.bytesWritten-s,l=(function(u,p,x,E,z){var F=r.transformTo("string",z(E));return _.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(u,2)+i(u,2)+i(p,4)+i(x,4)+i(F.length,2)+F})(this.dirRecords.length,a,s,this.zipComment,this.encodeFileName);this.push({data:l,meta:{percent:100}})},w.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},w.prototype.registerPrevious=function(s){this._sources.push(s);var d=this;return s.on("data",function(a){d.processChunk(a)}),s.on("end",function(){d.closedSource(d.previous.streamInfo),d._sources.length?d.prepareNextSource():d.end()}),s.on("error",function(a){d.error(a)}),this},w.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},w.prototype.error=function(s){var d=this._sources;if(!c.prototype.error.call(this,s))return!1;for(var a=0;a<d.length;a++)try{d[a].error(s)}catch{}return!0},w.prototype.lock=function(){c.prototype.lock.call(this);for(var s=this._sources,d=0;d<s.length;d++)s[d].lock()},b.exports=w},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(o,b,h){var i=o("../compressions"),n=o("./ZipFileWorker");h.generateWorker=function(r,c,m){var v=new n(c.streamFiles,m,c.platform,c.encodeFileName),_=0;try{r.forEach(function(w,s){_++;var d=(function(p,x){var E=p||x,z=i[E];if(!z)throw new Error(E+" is not a valid compression method !");return z})(s.options.compression,c.compression),a=s.options.compressionOptions||c.compressionOptions||{},l=s.dir,u=s.date;s._compressWorker(d,a).withStreamInfo("file",{name:w,dir:l,date:u,comment:s.comment||"",unixPermissions:s.unixPermissions,dosPermissions:s.dosPermissions}).pipe(v)}),v.entriesCount=_}catch(w){v.error(w)}return v}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(o,b,h){function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var n=new i;for(var r in this)typeof this[r]!="function"&&(n[r]=this[r]);return n}}(i.prototype=o("./object")).loadAsync=o("./load"),i.support=o("./support"),i.defaults=o("./defaults"),i.version="3.10.1",i.loadAsync=function(n,r){return new i().loadAsync(n,r)},i.external=o("./external"),b.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(o,b,h){var i=o("./utils"),n=o("./external"),r=o("./utf8"),c=o("./zipEntries"),m=o("./stream/Crc32Probe"),v=o("./nodejsUtils");function _(w){return new n.Promise(function(s,d){var a=w.decompressed.getContentWorker().pipe(new m);a.on("error",function(l){d(l)}).on("end",function(){a.streamInfo.crc32!==w.decompressed.crc32?d(new Error("Corrupted zip : CRC32 mismatch")):s()}).resume()})}b.exports=function(w,s){var d=this;return s=i.extend(s||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:r.utf8decode}),v.isNode&&v.isStream(w)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",w,!0,s.optimizedBinaryString,s.base64).then(function(a){var l=new c(s);return l.load(a),l}).then(function(a){var l=[n.Promise.resolve(a)],u=a.files;if(s.checkCRC32)for(var p=0;p<u.length;p++)l.push(_(u[p]));return n.Promise.all(l)}).then(function(a){for(var l=a.shift(),u=l.files,p=0;p<u.length;p++){var x=u[p],E=x.fileNameStr,z=i.resolve(x.fileNameStr);d.file(z,x.decompressed,{binary:!0,optimizedBinaryString:!0,date:x.date,dir:x.dir,comment:x.fileCommentStr.length?x.fileCommentStr:null,unixPermissions:x.unixPermissions,dosPermissions:x.dosPermissions,createFolders:s.createFolders}),x.dir||(d.file(z).unsafeOriginalName=E)}return l.zipComment.length&&(d.comment=l.zipComment),d})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(o,b,h){var i=o("../utils"),n=o("../stream/GenericWorker");function r(c,m){n.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(m)}i.inherits(r,n),r.prototype._bindStream=function(c){var m=this;(this._stream=c).pause(),c.on("data",function(v){m.push({data:v,meta:{percent:0}})}).on("error",function(v){m.isPaused?this.generatedError=v:m.error(v)}).on("end",function(){m.isPaused?m._upstreamEnded=!0:m.end()})},r.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},r.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},b.exports=r},{"../stream/GenericWorker":28,"../utils":32}],13:[function(o,b,h){var i=o("readable-stream").Readable;function n(r,c,m){i.call(this,c),this._helper=r;var v=this;r.on("data",function(_,w){v.push(_)||v._helper.pause(),m&&m(w)}).on("error",function(_){v.emit("error",_)}).on("end",function(){v.push(null)})}o("../utils").inherits(n,i),n.prototype._read=function(){this._helper.resume()},b.exports=n},{"../utils":32,"readable-stream":16}],14:[function(o,b,h){b.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,n){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,n);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,n)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var n=new Buffer(i);return n.fill(0),n},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(o,b,h){function i(z,F,O){var Z,P=r.getTypeOf(F),H=r.extend(O||{},v);H.date=H.date||new Date,H.compression!==null&&(H.compression=H.compression.toUpperCase()),typeof H.unixPermissions=="string"&&(H.unixPermissions=parseInt(H.unixPermissions,8)),H.unixPermissions&&16384&H.unixPermissions&&(H.dir=!0),H.dosPermissions&&16&H.dosPermissions&&(H.dir=!0),H.dir&&(z=u(z)),H.createFolders&&(Z=l(z))&&p.call(this,Z,!0);var J=P==="string"&&H.binary===!1&&H.base64===!1;O&&O.binary!==void 0||(H.binary=!J),(F instanceof _&&F.uncompressedSize===0||H.dir||!F||F.length===0)&&(H.base64=!1,H.binary=!0,F="",H.compression="STORE",P="string");var k=null;k=F instanceof _||F instanceof c?F:d.isNode&&d.isStream(F)?new a(z,F):r.prepareContent(z,F,H.binary,H.optimizedBinaryString,H.base64);var R=new w(z,k,H);this.files[z]=R}var n=o("./utf8"),r=o("./utils"),c=o("./stream/GenericWorker"),m=o("./stream/StreamHelper"),v=o("./defaults"),_=o("./compressedObject"),w=o("./zipObject"),s=o("./generate"),d=o("./nodejsUtils"),a=o("./nodejs/NodejsStreamInputAdapter"),l=function(z){z.slice(-1)==="/"&&(z=z.substring(0,z.length-1));var F=z.lastIndexOf("/");return 0<F?z.substring(0,F):""},u=function(z){return z.slice(-1)!=="/"&&(z+="/"),z},p=function(z,F){return F=F!==void 0?F:v.createFolders,z=u(z),this.files[z]||i.call(this,z,null,{dir:!0,createFolders:F}),this.files[z]};function x(z){return Object.prototype.toString.call(z)==="[object RegExp]"}var E={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(z){var F,O,Z;for(F in this.files)Z=this.files[F],(O=F.slice(this.root.length,F.length))&&F.slice(0,this.root.length)===this.root&&z(O,Z)},filter:function(z){var F=[];return this.forEach(function(O,Z){z(O,Z)&&F.push(Z)}),F},file:function(z,F,O){if(arguments.length!==1)return z=this.root+z,i.call(this,z,F,O),this;if(x(z)){var Z=z;return this.filter(function(H,J){return!J.dir&&Z.test(H)})}var P=this.files[this.root+z];return P&&!P.dir?P:null},folder:function(z){if(!z)return this;if(x(z))return this.filter(function(P,H){return H.dir&&z.test(P)});var F=this.root+z,O=p.call(this,F),Z=this.clone();return Z.root=O.name,Z},remove:function(z){z=this.root+z;var F=this.files[z];if(F||(z.slice(-1)!=="/"&&(z+="/"),F=this.files[z]),F&&!F.dir)delete this.files[z];else for(var O=this.filter(function(P,H){return H.name.slice(0,z.length)===z}),Z=0;Z<O.length;Z++)delete this.files[O[Z].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(z){var F,O={};try{if((O=r.extend(z||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=O.type.toLowerCase(),O.compression=O.compression.toUpperCase(),O.type==="binarystring"&&(O.type="string"),!O.type)throw new Error("No output type specified.");r.checkSupport(O.type),O.platform!=="darwin"&&O.platform!=="freebsd"&&O.platform!=="linux"&&O.platform!=="sunos"||(O.platform="UNIX"),O.platform==="win32"&&(O.platform="DOS");var Z=O.comment||this.comment||"";F=s.generateWorker(this,O,Z)}catch(P){(F=new c("error")).error(P)}return new m(F,O.type||"string",O.mimeType)},generateAsync:function(z,F){return this.generateInternalStream(z).accumulate(F)},generateNodeStream:function(z,F){return(z=z||{}).type||(z.type="nodebuffer"),this.generateInternalStream(z).toNodejsStream(F)}};b.exports=E},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(o,b,h){b.exports=o("stream")},{stream:void 0}],17:[function(o,b,h){var i=o("./DataReader");function n(r){i.call(this,r);for(var c=0;c<this.data.length;c++)r[c]=255&r[c]}o("../utils").inherits(n,i),n.prototype.byteAt=function(r){return this.data[this.zero+r]},n.prototype.lastIndexOfSignature=function(r){for(var c=r.charCodeAt(0),m=r.charCodeAt(1),v=r.charCodeAt(2),_=r.charCodeAt(3),w=this.length-4;0<=w;--w)if(this.data[w]===c&&this.data[w+1]===m&&this.data[w+2]===v&&this.data[w+3]===_)return w-this.zero;return-1},n.prototype.readAndCheckSignature=function(r){var c=r.charCodeAt(0),m=r.charCodeAt(1),v=r.charCodeAt(2),_=r.charCodeAt(3),w=this.readData(4);return c===w[0]&&m===w[1]&&v===w[2]&&_===w[3]},n.prototype.readData=function(r){if(this.checkOffset(r),r===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,c},b.exports=n},{"../utils":32,"./DataReader":18}],18:[function(o,b,h){var i=o("../utils");function n(r){this.data=r,this.length=r.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(r){this.checkIndex(this.index+r)},checkIndex:function(r){if(this.length<this.zero+r||r<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+r+"). Corrupted zip ?")},setIndex:function(r){this.checkIndex(r),this.index=r},skip:function(r){this.setIndex(this.index+r)},byteAt:function(){},readInt:function(r){var c,m=0;for(this.checkOffset(r),c=this.index+r-1;c>=this.index;c--)m=(m<<8)+this.byteAt(c);return this.index+=r,m},readString:function(r){return i.transformTo("string",this.readData(r))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var r=this.readInt(4);return new Date(Date.UTC(1980+(r>>25&127),(r>>21&15)-1,r>>16&31,r>>11&31,r>>5&63,(31&r)<<1))}},b.exports=n},{"../utils":32}],19:[function(o,b,h){var i=o("./Uint8ArrayReader");function n(r){i.call(this,r)}o("../utils").inherits(n,i),n.prototype.readData=function(r){this.checkOffset(r);var c=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,c},b.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(o,b,h){var i=o("./DataReader");function n(r){i.call(this,r)}o("../utils").inherits(n,i),n.prototype.byteAt=function(r){return this.data.charCodeAt(this.zero+r)},n.prototype.lastIndexOfSignature=function(r){return this.data.lastIndexOf(r)-this.zero},n.prototype.readAndCheckSignature=function(r){return r===this.readData(4)},n.prototype.readData=function(r){this.checkOffset(r);var c=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,c},b.exports=n},{"../utils":32,"./DataReader":18}],21:[function(o,b,h){var i=o("./ArrayReader");function n(r){i.call(this,r)}o("../utils").inherits(n,i),n.prototype.readData=function(r){if(this.checkOffset(r),r===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+r);return this.index+=r,c},b.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(o,b,h){var i=o("../utils"),n=o("../support"),r=o("./ArrayReader"),c=o("./StringReader"),m=o("./NodeBufferReader"),v=o("./Uint8ArrayReader");b.exports=function(_){var w=i.getTypeOf(_);return i.checkSupport(w),w!=="string"||n.uint8array?w==="nodebuffer"?new m(_):n.uint8array?new v(i.transformTo("uint8array",_)):new r(i.transformTo("array",_)):new c(_)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(o,b,h){h.LOCAL_FILE_HEADER="PK",h.CENTRAL_FILE_HEADER="PK",h.CENTRAL_DIRECTORY_END="PK",h.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",h.ZIP64_CENTRAL_DIRECTORY_END="PK",h.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(o,b,h){var i=o("./GenericWorker"),n=o("../utils");function r(c){i.call(this,"ConvertWorker to "+c),this.destType=c}n.inherits(r,i),r.prototype.processChunk=function(c){this.push({data:n.transformTo(this.destType,c.data),meta:c.meta})},b.exports=r},{"../utils":32,"./GenericWorker":28}],25:[function(o,b,h){var i=o("./GenericWorker"),n=o("../crc32");function r(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}o("../utils").inherits(r,i),r.prototype.processChunk=function(c){this.streamInfo.crc32=n(c.data,this.streamInfo.crc32||0),this.push(c)},b.exports=r},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(o,b,h){var i=o("../utils"),n=o("./GenericWorker");function r(c){n.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}i.inherits(r,n),r.prototype.processChunk=function(c){if(c){var m=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=m+c.data.length}n.prototype.processChunk.call(this,c)},b.exports=r},{"../utils":32,"./GenericWorker":28}],27:[function(o,b,h){var i=o("../utils"),n=o("./GenericWorker");function r(c){n.call(this,"DataWorker");var m=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(v){m.dataIsReady=!0,m.data=v,m.max=v&&v.length||0,m.type=i.getTypeOf(v),m.isPaused||m._tickAndRepeat()},function(v){m.error(v)})}i.inherits(r,n),r.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,m=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,m);break;case"uint8array":c=this.data.subarray(this.index,m);break;case"array":case"nodebuffer":c=this.data.slice(this.index,m)}return this.index=m,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},b.exports=r},{"../utils":32,"./GenericWorker":28}],28:[function(o,b,h){function i(n){this.name=n||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(n){this.emit("data",n)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(n){this.emit("error",n)}return!0},error:function(n){return!this.isFinished&&(this.isPaused?this.generatedError=n:(this.isFinished=!0,this.emit("error",n),this.previous&&this.previous.error(n),this.cleanUp()),!0)},on:function(n,r){return this._listeners[n].push(r),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(n,r){if(this._listeners[n])for(var c=0;c<this._listeners[n].length;c++)this._listeners[n][c].call(this,r)},pipe:function(n){return n.registerPrevious(this)},registerPrevious:function(n){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=n.streamInfo,this.mergeStreamInfo(),this.previous=n;var r=this;return n.on("data",function(c){r.processChunk(c)}),n.on("end",function(){r.end()}),n.on("error",function(c){r.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var n=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),n=!0),this.previous&&this.previous.resume(),!n},flush:function(){},processChunk:function(n){this.push(n)},withStreamInfo:function(n,r){return this.extraStreamInfo[n]=r,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var n in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,n)&&(this.streamInfo[n]=this.extraStreamInfo[n])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var n="Worker "+this.name;return this.previous?this.previous+" -> "+n:n}},b.exports=i},{}],29:[function(o,b,h){var i=o("../utils"),n=o("./ConvertWorker"),r=o("./GenericWorker"),c=o("../base64"),m=o("../support"),v=o("../external"),_=null;if(m.nodestream)try{_=o("../nodejs/NodejsStreamOutputAdapter")}catch{}function w(d,a){return new v.Promise(function(l,u){var p=[],x=d._internalType,E=d._outputType,z=d._mimeType;d.on("data",function(F,O){p.push(F),a&&a(O)}).on("error",function(F){p=[],u(F)}).on("end",function(){try{var F=(function(O,Z,P){switch(O){case"blob":return i.newBlob(i.transformTo("arraybuffer",Z),P);case"base64":return c.encode(Z);default:return i.transformTo(O,Z)}})(E,(function(O,Z){var P,H=0,J=null,k=0;for(P=0;P<Z.length;P++)k+=Z[P].length;switch(O){case"string":return Z.join("");case"array":return Array.prototype.concat.apply([],Z);case"uint8array":for(J=new Uint8Array(k),P=0;P<Z.length;P++)J.set(Z[P],H),H+=Z[P].length;return J;case"nodebuffer":return Buffer.concat(Z);default:throw new Error("concat : unsupported type '"+O+"'")}})(x,p),z);l(F)}catch(O){u(O)}p=[]}).resume()})}function s(d,a,l){var u=a;switch(a){case"blob":case"arraybuffer":u="uint8array";break;case"base64":u="string"}try{this._internalType=u,this._outputType=a,this._mimeType=l,i.checkSupport(u),this._worker=d.pipe(new n(u)),d.lock()}catch(p){this._worker=new r("error"),this._worker.error(p)}}s.prototype={accumulate:function(d){return w(this,d)},on:function(d,a){var l=this;return d==="data"?this._worker.on(d,function(u){a.call(l,u.data,u.meta)}):this._worker.on(d,function(){i.delay(a,arguments,l)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(d){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new _(this,{objectMode:this._outputType!=="nodebuffer"},d)}},b.exports=s},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(o,b,h){if(h.base64=!0,h.array=!0,h.string=!0,h.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",h.nodebuffer=typeof Buffer<"u",h.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")h.blob=!1;else{var i=new ArrayBuffer(0);try{h.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(i),h.blob=n.getBlob("application/zip").size===0}catch{h.blob=!1}}}try{h.nodestream=!!o("readable-stream").Readable}catch{h.nodestream=!1}},{"readable-stream":16}],31:[function(o,b,h){for(var i=o("./utils"),n=o("./support"),r=o("./nodejsUtils"),c=o("./stream/GenericWorker"),m=new Array(256),v=0;v<256;v++)m[v]=252<=v?6:248<=v?5:240<=v?4:224<=v?3:192<=v?2:1;m[254]=m[254]=1;function _(){c.call(this,"utf-8 decode"),this.leftOver=null}function w(){c.call(this,"utf-8 encode")}h.utf8encode=function(s){return n.nodebuffer?r.newBufferFrom(s,"utf-8"):(function(d){var a,l,u,p,x,E=d.length,z=0;for(p=0;p<E;p++)(64512&(l=d.charCodeAt(p)))==55296&&p+1<E&&(64512&(u=d.charCodeAt(p+1)))==56320&&(l=65536+(l-55296<<10)+(u-56320),p++),z+=l<128?1:l<2048?2:l<65536?3:4;for(a=n.uint8array?new Uint8Array(z):new Array(z),p=x=0;x<z;p++)(64512&(l=d.charCodeAt(p)))==55296&&p+1<E&&(64512&(u=d.charCodeAt(p+1)))==56320&&(l=65536+(l-55296<<10)+(u-56320),p++),l<128?a[x++]=l:(l<2048?a[x++]=192|l>>>6:(l<65536?a[x++]=224|l>>>12:(a[x++]=240|l>>>18,a[x++]=128|l>>>12&63),a[x++]=128|l>>>6&63),a[x++]=128|63&l);return a})(s)},h.utf8decode=function(s){return n.nodebuffer?i.transformTo("nodebuffer",s).toString("utf-8"):(function(d){var a,l,u,p,x=d.length,E=new Array(2*x);for(a=l=0;a<x;)if((u=d[a++])<128)E[l++]=u;else if(4<(p=m[u]))E[l++]=65533,a+=p-1;else{for(u&=p===2?31:p===3?15:7;1<p&&a<x;)u=u<<6|63&d[a++],p--;1<p?E[l++]=65533:u<65536?E[l++]=u:(u-=65536,E[l++]=55296|u>>10&1023,E[l++]=56320|1023&u)}return E.length!==l&&(E.subarray?E=E.subarray(0,l):E.length=l),i.applyFromCharCode(E)})(s=i.transformTo(n.uint8array?"uint8array":"array",s))},i.inherits(_,c),_.prototype.processChunk=function(s){var d=i.transformTo(n.uint8array?"uint8array":"array",s.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var a=d;(d=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),d.set(a,this.leftOver.length)}else d=this.leftOver.concat(d);this.leftOver=null}var l=(function(p,x){var E;for((x=x||p.length)>p.length&&(x=p.length),E=x-1;0<=E&&(192&p[E])==128;)E--;return E<0||E===0?x:E+m[p[E]]>x?E:x})(d),u=d;l!==d.length&&(n.uint8array?(u=d.subarray(0,l),this.leftOver=d.subarray(l,d.length)):(u=d.slice(0,l),this.leftOver=d.slice(l,d.length))),this.push({data:h.utf8decode(u),meta:s.meta})},_.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:h.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},h.Utf8DecodeWorker=_,i.inherits(w,c),w.prototype.processChunk=function(s){this.push({data:h.utf8encode(s.data),meta:s.meta})},h.Utf8EncodeWorker=w},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(o,b,h){var i=o("./support"),n=o("./base64"),r=o("./nodejsUtils"),c=o("./external");function m(a){return a}function v(a,l){for(var u=0;u<a.length;++u)l[u]=255&a.charCodeAt(u);return l}o("setimmediate"),h.newBlob=function(a,l){h.checkSupport("blob");try{return new Blob([a],{type:l})}catch{try{var u=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return u.append(a),u.getBlob(l)}catch{throw new Error("Bug : can't construct the Blob.")}}};var _={stringifyByChunk:function(a,l,u){var p=[],x=0,E=a.length;if(E<=u)return String.fromCharCode.apply(null,a);for(;x<E;)l==="array"||l==="nodebuffer"?p.push(String.fromCharCode.apply(null,a.slice(x,Math.min(x+u,E)))):p.push(String.fromCharCode.apply(null,a.subarray(x,Math.min(x+u,E)))),x+=u;return p.join("")},stringifyByChar:function(a){for(var l="",u=0;u<a.length;u++)l+=String.fromCharCode(a[u]);return l},applyCanBeUsed:{uint8array:(function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,r.allocBuffer(1)).length===1}catch{return!1}})()}};function w(a){var l=65536,u=h.getTypeOf(a),p=!0;if(u==="uint8array"?p=_.applyCanBeUsed.uint8array:u==="nodebuffer"&&(p=_.applyCanBeUsed.nodebuffer),p)for(;1<l;)try{return _.stringifyByChunk(a,u,l)}catch{l=Math.floor(l/2)}return _.stringifyByChar(a)}function s(a,l){for(var u=0;u<a.length;u++)l[u]=a[u];return l}h.applyFromCharCode=w;var d={};d.string={string:m,array:function(a){return v(a,new Array(a.length))},arraybuffer:function(a){return d.string.uint8array(a).buffer},uint8array:function(a){return v(a,new Uint8Array(a.length))},nodebuffer:function(a){return v(a,r.allocBuffer(a.length))}},d.array={string:w,array:m,arraybuffer:function(a){return new Uint8Array(a).buffer},uint8array:function(a){return new Uint8Array(a)},nodebuffer:function(a){return r.newBufferFrom(a)}},d.arraybuffer={string:function(a){return w(new Uint8Array(a))},array:function(a){return s(new Uint8Array(a),new Array(a.byteLength))},arraybuffer:m,uint8array:function(a){return new Uint8Array(a)},nodebuffer:function(a){return r.newBufferFrom(new Uint8Array(a))}},d.uint8array={string:w,array:function(a){return s(a,new Array(a.length))},arraybuffer:function(a){return a.buffer},uint8array:m,nodebuffer:function(a){return r.newBufferFrom(a)}},d.nodebuffer={string:w,array:function(a){return s(a,new Array(a.length))},arraybuffer:function(a){return d.nodebuffer.uint8array(a).buffer},uint8array:function(a){return s(a,new Uint8Array(a.length))},nodebuffer:m},h.transformTo=function(a,l){if(l=l||"",!a)return l;h.checkSupport(a);var u=h.getTypeOf(l);return d[u][a](l)},h.resolve=function(a){for(var l=a.split("/"),u=[],p=0;p<l.length;p++){var x=l[p];x==="."||x===""&&p!==0&&p!==l.length-1||(x===".."?u.pop():u.push(x))}return u.join("/")},h.getTypeOf=function(a){return typeof a=="string"?"string":Object.prototype.toString.call(a)==="[object Array]"?"array":i.nodebuffer&&r.isBuffer(a)?"nodebuffer":i.uint8array&&a instanceof Uint8Array?"uint8array":i.arraybuffer&&a instanceof ArrayBuffer?"arraybuffer":void 0},h.checkSupport=function(a){if(!i[a.toLowerCase()])throw new Error(a+" is not supported by this platform")},h.MAX_VALUE_16BITS=65535,h.MAX_VALUE_32BITS=-1,h.pretty=function(a){var l,u,p="";for(u=0;u<(a||"").length;u++)p+="\\x"+((l=a.charCodeAt(u))<16?"0":"")+l.toString(16).toUpperCase();return p},h.delay=function(a,l,u){setImmediate(function(){a.apply(u||null,l||[])})},h.inherits=function(a,l){function u(){}u.prototype=l.prototype,a.prototype=new u},h.extend=function(){var a,l,u={};for(a=0;a<arguments.length;a++)for(l in arguments[a])Object.prototype.hasOwnProperty.call(arguments[a],l)&&u[l]===void 0&&(u[l]=arguments[a][l]);return u},h.prepareContent=function(a,l,u,p,x){return c.Promise.resolve(l).then(function(E){return i.blob&&(E instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(E))!==-1)&&typeof FileReader<"u"?new c.Promise(function(z,F){var O=new FileReader;O.onload=function(Z){z(Z.target.result)},O.onerror=function(Z){F(Z.target.error)},O.readAsArrayBuffer(E)}):E}).then(function(E){var z=h.getTypeOf(E);return z?(z==="arraybuffer"?E=h.transformTo("uint8array",E):z==="string"&&(x?E=n.decode(E):u&&p!==!0&&(E=(function(F){return v(F,i.uint8array?new Uint8Array(F.length):new Array(F.length))})(E))),E):c.Promise.reject(new Error("Can't read the data of '"+a+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(o,b,h){var i=o("./reader/readerFor"),n=o("./utils"),r=o("./signature"),c=o("./zipEntry"),m=o("./support");function v(_){this.files=[],this.loadOptions=_}v.prototype={checkSignature:function(_){if(!this.reader.readAndCheckSignature(_)){this.reader.index-=4;var w=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(w)+", expected "+n.pretty(_)+")")}},isSignature:function(_,w){var s=this.reader.index;this.reader.setIndex(_);var d=this.reader.readString(4)===w;return this.reader.setIndex(s),d},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var _=this.reader.readData(this.zipCommentLength),w=m.uint8array?"uint8array":"array",s=n.transformTo(w,_);this.zipComment=this.loadOptions.decodeFileName(s)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var _,w,s,d=this.zip64EndOfCentralSize-44;0<d;)_=this.reader.readInt(2),w=this.reader.readInt(4),s=this.reader.readData(w),this.zip64ExtensibleData[_]={id:_,length:w,value:s}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var _,w;for(_=0;_<this.files.length;_++)w=this.files[_],this.reader.setIndex(w.localHeaderOffset),this.checkSignature(r.LOCAL_FILE_HEADER),w.readLocalPart(this.reader),w.handleUTF8(),w.processAttributes()},readCentralDir:function(){var _;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(r.CENTRAL_FILE_HEADER);)(_=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(_);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var _=this.reader.lastIndexOfSignature(r.CENTRAL_DIRECTORY_END);if(_<0)throw this.isSignature(0,r.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(_);var w=_;if(this.checkSignature(r.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(_=this.reader.lastIndexOfSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(_),this.checkSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,r.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(r.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(r.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var s=this.centralDirOffset+this.centralDirSize;this.zip64&&(s+=20,s+=12+this.zip64EndOfCentralSize);var d=w-s;if(0<d)this.isSignature(w,r.CENTRAL_FILE_HEADER)||(this.reader.zero=d);else if(d<0)throw new Error("Corrupted zip: missing "+Math.abs(d)+" bytes.")},prepareReader:function(_){this.reader=i(_)},load:function(_){this.prepareReader(_),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},b.exports=v},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(o,b,h){var i=o("./reader/readerFor"),n=o("./utils"),r=o("./compressedObject"),c=o("./crc32"),m=o("./utf8"),v=o("./compressions"),_=o("./support");function w(s,d){this.options=s,this.loadOptions=d}w.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(s){var d,a;if(s.skip(22),this.fileNameLength=s.readInt(2),a=s.readInt(2),this.fileName=s.readData(this.fileNameLength),s.skip(a),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((d=(function(l){for(var u in v)if(Object.prototype.hasOwnProperty.call(v,u)&&v[u].magic===l)return v[u];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new r(this.compressedSize,this.uncompressedSize,this.crc32,d,s.readData(this.compressedSize))},readCentralPart:function(s){this.versionMadeBy=s.readInt(2),s.skip(2),this.bitFlag=s.readInt(2),this.compressionMethod=s.readString(2),this.date=s.readDate(),this.crc32=s.readInt(4),this.compressedSize=s.readInt(4),this.uncompressedSize=s.readInt(4);var d=s.readInt(2);if(this.extraFieldsLength=s.readInt(2),this.fileCommentLength=s.readInt(2),this.diskNumberStart=s.readInt(2),this.internalFileAttributes=s.readInt(2),this.externalFileAttributes=s.readInt(4),this.localHeaderOffset=s.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");s.skip(d),this.readExtraFields(s),this.parseZIP64ExtraField(s),this.fileComment=s.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var s=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),s==0&&(this.dosPermissions=63&this.externalFileAttributes),s==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var s=i(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=s.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=s.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=s.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=s.readInt(4))}},readExtraFields:function(s){var d,a,l,u=s.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});s.index+4<u;)d=s.readInt(2),a=s.readInt(2),l=s.readData(a),this.extraFields[d]={id:d,length:a,value:l};s.setIndex(u)},handleUTF8:function(){var s=_.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=m.utf8decode(this.fileName),this.fileCommentStr=m.utf8decode(this.fileComment);else{var d=this.findExtraFieldUnicodePath();if(d!==null)this.fileNameStr=d;else{var a=n.transformTo(s,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(a)}var l=this.findExtraFieldUnicodeComment();if(l!==null)this.fileCommentStr=l;else{var u=n.transformTo(s,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(u)}}},findExtraFieldUnicodePath:function(){var s=this.extraFields[28789];if(s){var d=i(s.value);return d.readInt(1)!==1||c(this.fileName)!==d.readInt(4)?null:m.utf8decode(d.readData(s.length-5))}return null},findExtraFieldUnicodeComment:function(){var s=this.extraFields[25461];if(s){var d=i(s.value);return d.readInt(1)!==1||c(this.fileComment)!==d.readInt(4)?null:m.utf8decode(d.readData(s.length-5))}return null}},b.exports=w},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(o,b,h){function i(d,a,l){this.name=d,this.dir=l.dir,this.date=l.date,this.comment=l.comment,this.unixPermissions=l.unixPermissions,this.dosPermissions=l.dosPermissions,this._data=a,this._dataBinary=l.binary,this.options={compression:l.compression,compressionOptions:l.compressionOptions}}var n=o("./stream/StreamHelper"),r=o("./stream/DataWorker"),c=o("./utf8"),m=o("./compressedObject"),v=o("./stream/GenericWorker");i.prototype={internalStream:function(d){var a=null,l="string";try{if(!d)throw new Error("No output type specified.");var u=(l=d.toLowerCase())==="string"||l==="text";l!=="binarystring"&&l!=="text"||(l="string"),a=this._decompressWorker();var p=!this._dataBinary;p&&!u&&(a=a.pipe(new c.Utf8EncodeWorker)),!p&&u&&(a=a.pipe(new c.Utf8DecodeWorker))}catch(x){(a=new v("error")).error(x)}return new n(a,l,"")},async:function(d,a){return this.internalStream(d).accumulate(a)},nodeStream:function(d,a){return this.internalStream(d||"nodebuffer").toNodejsStream(a)},_compressWorker:function(d,a){if(this._data instanceof m&&this._data.compression.magic===d.magic)return this._data.getCompressedWorker();var l=this._decompressWorker();return this._dataBinary||(l=l.pipe(new c.Utf8EncodeWorker)),m.createWorkerFrom(l,d,a)},_decompressWorker:function(){return this._data instanceof m?this._data.getContentWorker():this._data instanceof v?this._data:new r(this._data)}};for(var _=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],w=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},s=0;s<_.length;s++)i.prototype[_[s]]=w;b.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(o,b,h){(function(i){var n,r,c=i.MutationObserver||i.WebKitMutationObserver;if(c){var m=0,v=new c(d),_=i.document.createTextNode("");v.observe(_,{characterData:!0}),n=function(){_.data=m=++m%2}}else if(i.setImmediate||i.MessageChannel===void 0)n="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var a=i.document.createElement("script");a.onreadystatechange=function(){d(),a.onreadystatechange=null,a.parentNode.removeChild(a),a=null},i.document.documentElement.appendChild(a)}:function(){setTimeout(d,0)};else{var w=new i.MessageChannel;w.port1.onmessage=d,n=function(){w.port2.postMessage(0)}}var s=[];function d(){var a,l;r=!0;for(var u=s.length;u;){for(l=s,s=[],a=-1;++a<u;)l[a]();u=s.length}r=!1}b.exports=function(a){s.push(a)!==1||r||n()}}).call(this,typeof kt<"u"?kt:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(o,b,h){var i=o("immediate");function n(){}var r={},c=["REJECTED"],m=["FULFILLED"],v=["PENDING"];function _(u){if(typeof u!="function")throw new TypeError("resolver must be a function");this.state=v,this.queue=[],this.outcome=void 0,u!==n&&a(this,u)}function w(u,p,x){this.promise=u,typeof p=="function"&&(this.onFulfilled=p,this.callFulfilled=this.otherCallFulfilled),typeof x=="function"&&(this.onRejected=x,this.callRejected=this.otherCallRejected)}function s(u,p,x){i(function(){var E;try{E=p(x)}catch(z){return r.reject(u,z)}E===u?r.reject(u,new TypeError("Cannot resolve promise with itself")):r.resolve(u,E)})}function d(u){var p=u&&u.then;if(u&&(typeof u=="object"||typeof u=="function")&&typeof p=="function")return function(){p.apply(u,arguments)}}function a(u,p){var x=!1;function E(O){x||(x=!0,r.reject(u,O))}function z(O){x||(x=!0,r.resolve(u,O))}var F=l(function(){p(z,E)});F.status==="error"&&E(F.value)}function l(u,p){var x={};try{x.value=u(p),x.status="success"}catch(E){x.status="error",x.value=E}return x}(b.exports=_).prototype.finally=function(u){if(typeof u!="function")return this;var p=this.constructor;return this.then(function(x){return p.resolve(u()).then(function(){return x})},function(x){return p.resolve(u()).then(function(){throw x})})},_.prototype.catch=function(u){return this.then(null,u)},_.prototype.then=function(u,p){if(typeof u!="function"&&this.state===m||typeof p!="function"&&this.state===c)return this;var x=new this.constructor(n);return this.state!==v?s(x,this.state===m?u:p,this.outcome):this.queue.push(new w(x,u,p)),x},w.prototype.callFulfilled=function(u){r.resolve(this.promise,u)},w.prototype.otherCallFulfilled=function(u){s(this.promise,this.onFulfilled,u)},w.prototype.callRejected=function(u){r.reject(this.promise,u)},w.prototype.otherCallRejected=function(u){s(this.promise,this.onRejected,u)},r.resolve=function(u,p){var x=l(d,p);if(x.status==="error")return r.reject(u,x.value);var E=x.value;if(E)a(u,E);else{u.state=m,u.outcome=p;for(var z=-1,F=u.queue.length;++z<F;)u.queue[z].callFulfilled(p)}return u},r.reject=function(u,p){u.state=c,u.outcome=p;for(var x=-1,E=u.queue.length;++x<E;)u.queue[x].callRejected(p);return u},_.resolve=function(u){return u instanceof this?u:r.resolve(new this(n),u)},_.reject=function(u){var p=new this(n);return r.reject(p,u)},_.all=function(u){var p=this;if(Object.prototype.toString.call(u)!=="[object Array]")return this.reject(new TypeError("must be an array"));var x=u.length,E=!1;if(!x)return this.resolve([]);for(var z=new Array(x),F=0,O=-1,Z=new this(n);++O<x;)P(u[O],O);return Z;function P(H,J){p.resolve(H).then(function(k){z[J]=k,++F!==x||E||(E=!0,r.resolve(Z,z))},function(k){E||(E=!0,r.reject(Z,k))})}},_.race=function(u){var p=this;if(Object.prototype.toString.call(u)!=="[object Array]")return this.reject(new TypeError("must be an array"));var x=u.length,E=!1;if(!x)return this.resolve([]);for(var z=-1,F=new this(n);++z<x;)O=u[z],p.resolve(O).then(function(Z){E||(E=!0,r.resolve(F,Z))},function(Z){E||(E=!0,r.reject(F,Z))});var O;return F}},{immediate:36}],38:[function(o,b,h){var i={};(0,o("./lib/utils/common").assign)(i,o("./lib/deflate"),o("./lib/inflate"),o("./lib/zlib/constants")),b.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(o,b,h){var i=o("./zlib/deflate"),n=o("./utils/common"),r=o("./utils/strings"),c=o("./zlib/messages"),m=o("./zlib/zstream"),v=Object.prototype.toString,_=0,w=-1,s=0,d=8;function a(u){if(!(this instanceof a))return new a(u);this.options=n.assign({level:w,method:d,chunkSize:16384,windowBits:15,memLevel:8,strategy:s,to:""},u||{});var p=this.options;p.raw&&0<p.windowBits?p.windowBits=-p.windowBits:p.gzip&&0<p.windowBits&&p.windowBits<16&&(p.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new m,this.strm.avail_out=0;var x=i.deflateInit2(this.strm,p.level,p.method,p.windowBits,p.memLevel,p.strategy);if(x!==_)throw new Error(c[x]);if(p.header&&i.deflateSetHeader(this.strm,p.header),p.dictionary){var E;if(E=typeof p.dictionary=="string"?r.string2buf(p.dictionary):v.call(p.dictionary)==="[object ArrayBuffer]"?new Uint8Array(p.dictionary):p.dictionary,(x=i.deflateSetDictionary(this.strm,E))!==_)throw new Error(c[x]);this._dict_set=!0}}function l(u,p){var x=new a(p);if(x.push(u,!0),x.err)throw x.msg||c[x.err];return x.result}a.prototype.push=function(u,p){var x,E,z=this.strm,F=this.options.chunkSize;if(this.ended)return!1;E=p===~~p?p:p===!0?4:0,typeof u=="string"?z.input=r.string2buf(u):v.call(u)==="[object ArrayBuffer]"?z.input=new Uint8Array(u):z.input=u,z.next_in=0,z.avail_in=z.input.length;do{if(z.avail_out===0&&(z.output=new n.Buf8(F),z.next_out=0,z.avail_out=F),(x=i.deflate(z,E))!==1&&x!==_)return this.onEnd(x),!(this.ended=!0);z.avail_out!==0&&(z.avail_in!==0||E!==4&&E!==2)||(this.options.to==="string"?this.onData(r.buf2binstring(n.shrinkBuf(z.output,z.next_out))):this.onData(n.shrinkBuf(z.output,z.next_out)))}while((0<z.avail_in||z.avail_out===0)&&x!==1);return E===4?(x=i.deflateEnd(this.strm),this.onEnd(x),this.ended=!0,x===_):E!==2||(this.onEnd(_),!(z.avail_out=0))},a.prototype.onData=function(u){this.chunks.push(u)},a.prototype.onEnd=function(u){u===_&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=u,this.msg=this.strm.msg},h.Deflate=a,h.deflate=l,h.deflateRaw=function(u,p){return(p=p||{}).raw=!0,l(u,p)},h.gzip=function(u,p){return(p=p||{}).gzip=!0,l(u,p)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(o,b,h){var i=o("./zlib/inflate"),n=o("./utils/common"),r=o("./utils/strings"),c=o("./zlib/constants"),m=o("./zlib/messages"),v=o("./zlib/zstream"),_=o("./zlib/gzheader"),w=Object.prototype.toString;function s(a){if(!(this instanceof s))return new s(a);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},a||{});var l=this.options;l.raw&&0<=l.windowBits&&l.windowBits<16&&(l.windowBits=-l.windowBits,l.windowBits===0&&(l.windowBits=-15)),!(0<=l.windowBits&&l.windowBits<16)||a&&a.windowBits||(l.windowBits+=32),15<l.windowBits&&l.windowBits<48&&(15&l.windowBits)==0&&(l.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new v,this.strm.avail_out=0;var u=i.inflateInit2(this.strm,l.windowBits);if(u!==c.Z_OK)throw new Error(m[u]);this.header=new _,i.inflateGetHeader(this.strm,this.header)}function d(a,l){var u=new s(l);if(u.push(a,!0),u.err)throw u.msg||m[u.err];return u.result}s.prototype.push=function(a,l){var u,p,x,E,z,F,O=this.strm,Z=this.options.chunkSize,P=this.options.dictionary,H=!1;if(this.ended)return!1;p=l===~~l?l:l===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof a=="string"?O.input=r.binstring2buf(a):w.call(a)==="[object ArrayBuffer]"?O.input=new Uint8Array(a):O.input=a,O.next_in=0,O.avail_in=O.input.length;do{if(O.avail_out===0&&(O.output=new n.Buf8(Z),O.next_out=0,O.avail_out=Z),(u=i.inflate(O,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&P&&(F=typeof P=="string"?r.string2buf(P):w.call(P)==="[object ArrayBuffer]"?new Uint8Array(P):P,u=i.inflateSetDictionary(this.strm,F)),u===c.Z_BUF_ERROR&&H===!0&&(u=c.Z_OK,H=!1),u!==c.Z_STREAM_END&&u!==c.Z_OK)return this.onEnd(u),!(this.ended=!0);O.next_out&&(O.avail_out!==0&&u!==c.Z_STREAM_END&&(O.avail_in!==0||p!==c.Z_FINISH&&p!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(x=r.utf8border(O.output,O.next_out),E=O.next_out-x,z=r.buf2string(O.output,x),O.next_out=E,O.avail_out=Z-E,E&&n.arraySet(O.output,O.output,x,E,0),this.onData(z)):this.onData(n.shrinkBuf(O.output,O.next_out)))),O.avail_in===0&&O.avail_out===0&&(H=!0)}while((0<O.avail_in||O.avail_out===0)&&u!==c.Z_STREAM_END);return u===c.Z_STREAM_END&&(p=c.Z_FINISH),p===c.Z_FINISH?(u=i.inflateEnd(this.strm),this.onEnd(u),this.ended=!0,u===c.Z_OK):p!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(O.avail_out=0))},s.prototype.onData=function(a){this.chunks.push(a)},s.prototype.onEnd=function(a){a===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},h.Inflate=s,h.inflate=d,h.inflateRaw=function(a,l){return(l=l||{}).raw=!0,d(a,l)},h.ungzip=d},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(o,b,h){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";h.assign=function(c){for(var m=Array.prototype.slice.call(arguments,1);m.length;){var v=m.shift();if(v){if(typeof v!="object")throw new TypeError(v+"must be non-object");for(var _ in v)v.hasOwnProperty(_)&&(c[_]=v[_])}}return c},h.shrinkBuf=function(c,m){return c.length===m?c:c.subarray?c.subarray(0,m):(c.length=m,c)};var n={arraySet:function(c,m,v,_,w){if(m.subarray&&c.subarray)c.set(m.subarray(v,v+_),w);else for(var s=0;s<_;s++)c[w+s]=m[v+s]},flattenChunks:function(c){var m,v,_,w,s,d;for(m=_=0,v=c.length;m<v;m++)_+=c[m].length;for(d=new Uint8Array(_),m=w=0,v=c.length;m<v;m++)s=c[m],d.set(s,w),w+=s.length;return d}},r={arraySet:function(c,m,v,_,w){for(var s=0;s<_;s++)c[w+s]=m[v+s]},flattenChunks:function(c){return[].concat.apply([],c)}};h.setTyped=function(c){c?(h.Buf8=Uint8Array,h.Buf16=Uint16Array,h.Buf32=Int32Array,h.assign(h,n)):(h.Buf8=Array,h.Buf16=Array,h.Buf32=Array,h.assign(h,r))},h.setTyped(i)},{}],42:[function(o,b,h){var i=o("./common"),n=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch{n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{r=!1}for(var c=new i.Buf8(256),m=0;m<256;m++)c[m]=252<=m?6:248<=m?5:240<=m?4:224<=m?3:192<=m?2:1;function v(_,w){if(w<65537&&(_.subarray&&r||!_.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(_,w));for(var s="",d=0;d<w;d++)s+=String.fromCharCode(_[d]);return s}c[254]=c[254]=1,h.string2buf=function(_){var w,s,d,a,l,u=_.length,p=0;for(a=0;a<u;a++)(64512&(s=_.charCodeAt(a)))==55296&&a+1<u&&(64512&(d=_.charCodeAt(a+1)))==56320&&(s=65536+(s-55296<<10)+(d-56320),a++),p+=s<128?1:s<2048?2:s<65536?3:4;for(w=new i.Buf8(p),a=l=0;l<p;a++)(64512&(s=_.charCodeAt(a)))==55296&&a+1<u&&(64512&(d=_.charCodeAt(a+1)))==56320&&(s=65536+(s-55296<<10)+(d-56320),a++),s<128?w[l++]=s:(s<2048?w[l++]=192|s>>>6:(s<65536?w[l++]=224|s>>>12:(w[l++]=240|s>>>18,w[l++]=128|s>>>12&63),w[l++]=128|s>>>6&63),w[l++]=128|63&s);return w},h.buf2binstring=function(_){return v(_,_.length)},h.binstring2buf=function(_){for(var w=new i.Buf8(_.length),s=0,d=w.length;s<d;s++)w[s]=_.charCodeAt(s);return w},h.buf2string=function(_,w){var s,d,a,l,u=w||_.length,p=new Array(2*u);for(s=d=0;s<u;)if((a=_[s++])<128)p[d++]=a;else if(4<(l=c[a]))p[d++]=65533,s+=l-1;else{for(a&=l===2?31:l===3?15:7;1<l&&s<u;)a=a<<6|63&_[s++],l--;1<l?p[d++]=65533:a<65536?p[d++]=a:(a-=65536,p[d++]=55296|a>>10&1023,p[d++]=56320|1023&a)}return v(p,d)},h.utf8border=function(_,w){var s;for((w=w||_.length)>_.length&&(w=_.length),s=w-1;0<=s&&(192&_[s])==128;)s--;return s<0||s===0?w:s+c[_[s]]>w?s:w}},{"./common":41}],43:[function(o,b,h){b.exports=function(i,n,r,c){for(var m=65535&i|0,v=i>>>16&65535|0,_=0;r!==0;){for(r-=_=2e3<r?2e3:r;v=v+(m=m+n[c++]|0)|0,--_;);m%=65521,v%=65521}return m|v<<16|0}},{}],44:[function(o,b,h){b.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(o,b,h){var i=(function(){for(var n,r=[],c=0;c<256;c++){n=c;for(var m=0;m<8;m++)n=1&n?3988292384^n>>>1:n>>>1;r[c]=n}return r})();b.exports=function(n,r,c,m){var v=i,_=m+c;n^=-1;for(var w=m;w<_;w++)n=n>>>8^v[255&(n^r[w])];return-1^n}},{}],46:[function(o,b,h){var i,n=o("../utils/common"),r=o("./trees"),c=o("./adler32"),m=o("./crc32"),v=o("./messages"),_=0,w=4,s=0,d=-2,a=-1,l=4,u=2,p=8,x=9,E=286,z=30,F=19,O=2*E+1,Z=15,P=3,H=258,J=H+P+1,k=42,R=113,e=1,B=2,tt=3,W=4;function et(t,T){return t.msg=v[T],T}function M(t){return(t<<1)-(4<t?9:0)}function Q(t){for(var T=t.length;0<=--T;)t[T]=0}function N(t){var T=t.state,j=T.pending;j>t.avail_out&&(j=t.avail_out),j!==0&&(n.arraySet(t.output,T.pending_buf,T.pending_out,j,t.next_out),t.next_out+=j,T.pending_out+=j,t.total_out+=j,t.avail_out-=j,T.pending-=j,T.pending===0&&(T.pending_out=0))}function I(t,T){r._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,T),t.block_start=t.strstart,N(t.strm)}function q(t,T){t.pending_buf[t.pending++]=T}function X(t,T){t.pending_buf[t.pending++]=T>>>8&255,t.pending_buf[t.pending++]=255&T}function V(t,T){var j,g,f=t.max_chain_length,C=t.strstart,L=t.prev_length,U=t.nice_match,A=t.strstart>t.w_size-J?t.strstart-(t.w_size-J):0,$=t.window,K=t.w_mask,G=t.prev,Y=t.strstart+H,it=$[C+L-1],nt=$[C+L];t.prev_length>=t.good_match&&(f>>=2),U>t.lookahead&&(U=t.lookahead);do if($[(j=T)+L]===nt&&$[j+L-1]===it&&$[j]===$[C]&&$[++j]===$[C+1]){C+=2,j++;do;while($[++C]===$[++j]&&$[++C]===$[++j]&&$[++C]===$[++j]&&$[++C]===$[++j]&&$[++C]===$[++j]&&$[++C]===$[++j]&&$[++C]===$[++j]&&$[++C]===$[++j]&&C<Y);if(g=H-(Y-C),C=Y-H,L<g){if(t.match_start=T,U<=(L=g))break;it=$[C+L-1],nt=$[C+L]}}while((T=G[T&K])>A&&--f!=0);return L<=t.lookahead?L:t.lookahead}function at(t){var T,j,g,f,C,L,U,A,$,K,G=t.w_size;do{if(f=t.window_size-t.lookahead-t.strstart,t.strstart>=G+(G-J)){for(n.arraySet(t.window,t.window,G,G,0),t.match_start-=G,t.strstart-=G,t.block_start-=G,T=j=t.hash_size;g=t.head[--T],t.head[T]=G<=g?g-G:0,--j;);for(T=j=G;g=t.prev[--T],t.prev[T]=G<=g?g-G:0,--j;);f+=G}if(t.strm.avail_in===0)break;if(L=t.strm,U=t.window,A=t.strstart+t.lookahead,$=f,K=void 0,K=L.avail_in,$<K&&(K=$),j=K===0?0:(L.avail_in-=K,n.arraySet(U,L.input,L.next_in,K,A),L.state.wrap===1?L.adler=c(L.adler,U,K,A):L.state.wrap===2&&(L.adler=m(L.adler,U,K,A)),L.next_in+=K,L.total_in+=K,K),t.lookahead+=j,t.lookahead+t.insert>=P)for(C=t.strstart-t.insert,t.ins_h=t.window[C],t.ins_h=(t.ins_h<<t.hash_shift^t.window[C+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[C+P-1])&t.hash_mask,t.prev[C&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=C,C++,t.insert--,!(t.lookahead+t.insert<P)););}while(t.lookahead<J&&t.strm.avail_in!==0)}function ut(t,T){for(var j,g;;){if(t.lookahead<J){if(at(t),t.lookahead<J&&T===_)return e;if(t.lookahead===0)break}if(j=0,t.lookahead>=P&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+P-1])&t.hash_mask,j=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),j!==0&&t.strstart-j<=t.w_size-J&&(t.match_length=V(t,j)),t.match_length>=P)if(g=r._tr_tally(t,t.strstart-t.match_start,t.match_length-P),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=P){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+P-1])&t.hash_mask,j=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart,--t.match_length!=0;);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else g=r._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(g&&(I(t,!1),t.strm.avail_out===0))return e}return t.insert=t.strstart<P-1?t.strstart:P-1,T===w?(I(t,!0),t.strm.avail_out===0?tt:W):t.last_lit&&(I(t,!1),t.strm.avail_out===0)?e:B}function rt(t,T){for(var j,g,f;;){if(t.lookahead<J){if(at(t),t.lookahead<J&&T===_)return e;if(t.lookahead===0)break}if(j=0,t.lookahead>=P&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+P-1])&t.hash_mask,j=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=P-1,j!==0&&t.prev_length<t.max_lazy_match&&t.strstart-j<=t.w_size-J&&(t.match_length=V(t,j),t.match_length<=5&&(t.strategy===1||t.match_length===P&&4096<t.strstart-t.match_start)&&(t.match_length=P-1)),t.prev_length>=P&&t.match_length<=t.prev_length){for(f=t.strstart+t.lookahead-P,g=r._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-P),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=f&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+P-1])&t.hash_mask,j=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),--t.prev_length!=0;);if(t.match_available=0,t.match_length=P-1,t.strstart++,g&&(I(t,!1),t.strm.avail_out===0))return e}else if(t.match_available){if((g=r._tr_tally(t,0,t.window[t.strstart-1]))&&I(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return e}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(g=r._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<P-1?t.strstart:P-1,T===w?(I(t,!0),t.strm.avail_out===0?tt:W):t.last_lit&&(I(t,!1),t.strm.avail_out===0)?e:B}function st(t,T,j,g,f){this.good_length=t,this.max_lazy=T,this.nice_length=j,this.max_chain=g,this.func=f}function ct(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=p,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new n.Buf16(2*O),this.dyn_dtree=new n.Buf16(2*(2*z+1)),this.bl_tree=new n.Buf16(2*(2*F+1)),Q(this.dyn_ltree),Q(this.dyn_dtree),Q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(Z+1),this.heap=new n.Buf16(2*E+1),Q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(2*E+1),Q(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function ot(t){var T;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=u,(T=t.state).pending=0,T.pending_out=0,T.wrap<0&&(T.wrap=-T.wrap),T.status=T.wrap?k:R,t.adler=T.wrap===2?0:1,T.last_flush=_,r._tr_init(T),s):et(t,d)}function ft(t){var T=ot(t);return T===s&&(function(j){j.window_size=2*j.w_size,Q(j.head),j.max_lazy_match=i[j.level].max_lazy,j.good_match=i[j.level].good_length,j.nice_match=i[j.level].nice_length,j.max_chain_length=i[j.level].max_chain,j.strstart=0,j.block_start=0,j.lookahead=0,j.insert=0,j.match_length=j.prev_length=P-1,j.match_available=0,j.ins_h=0})(t.state),T}function dt(t,T,j,g,f,C){if(!t)return d;var L=1;if(T===a&&(T=6),g<0?(L=0,g=-g):15<g&&(L=2,g-=16),f<1||x<f||j!==p||g<8||15<g||T<0||9<T||C<0||l<C)return et(t,d);g===8&&(g=9);var U=new ct;return(t.state=U).strm=t,U.wrap=L,U.gzhead=null,U.w_bits=g,U.w_size=1<<U.w_bits,U.w_mask=U.w_size-1,U.hash_bits=f+7,U.hash_size=1<<U.hash_bits,U.hash_mask=U.hash_size-1,U.hash_shift=~~((U.hash_bits+P-1)/P),U.window=new n.Buf8(2*U.w_size),U.head=new n.Buf16(U.hash_size),U.prev=new n.Buf16(U.w_size),U.lit_bufsize=1<<f+6,U.pending_buf_size=4*U.lit_bufsize,U.pending_buf=new n.Buf8(U.pending_buf_size),U.d_buf=1*U.lit_bufsize,U.l_buf=3*U.lit_bufsize,U.level=T,U.strategy=C,U.method=j,ft(t)}i=[new st(0,0,0,0,function(t,T){var j=65535;for(j>t.pending_buf_size-5&&(j=t.pending_buf_size-5);;){if(t.lookahead<=1){if(at(t),t.lookahead===0&&T===_)return e;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var g=t.block_start+j;if((t.strstart===0||t.strstart>=g)&&(t.lookahead=t.strstart-g,t.strstart=g,I(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-J&&(I(t,!1),t.strm.avail_out===0))return e}return t.insert=0,T===w?(I(t,!0),t.strm.avail_out===0?tt:W):(t.strstart>t.block_start&&(I(t,!1),t.strm.avail_out),e)}),new st(4,4,8,4,ut),new st(4,5,16,8,ut),new st(4,6,32,32,ut),new st(4,4,16,16,rt),new st(8,16,32,32,rt),new st(8,16,128,128,rt),new st(8,32,128,256,rt),new st(32,128,258,1024,rt),new st(32,258,258,4096,rt)],h.deflateInit=function(t,T){return dt(t,T,p,15,8,0)},h.deflateInit2=dt,h.deflateReset=ft,h.deflateResetKeep=ot,h.deflateSetHeader=function(t,T){return t&&t.state?t.state.wrap!==2?d:(t.state.gzhead=T,s):d},h.deflate=function(t,T){var j,g,f,C;if(!t||!t.state||5<T||T<0)return t?et(t,d):d;if(g=t.state,!t.output||!t.input&&t.avail_in!==0||g.status===666&&T!==w)return et(t,t.avail_out===0?-5:d);if(g.strm=t,j=g.last_flush,g.last_flush=T,g.status===k)if(g.wrap===2)t.adler=0,q(g,31),q(g,139),q(g,8),g.gzhead?(q(g,(g.gzhead.text?1:0)+(g.gzhead.hcrc?2:0)+(g.gzhead.extra?4:0)+(g.gzhead.name?8:0)+(g.gzhead.comment?16:0)),q(g,255&g.gzhead.time),q(g,g.gzhead.time>>8&255),q(g,g.gzhead.time>>16&255),q(g,g.gzhead.time>>24&255),q(g,g.level===9?2:2<=g.strategy||g.level<2?4:0),q(g,255&g.gzhead.os),g.gzhead.extra&&g.gzhead.extra.length&&(q(g,255&g.gzhead.extra.length),q(g,g.gzhead.extra.length>>8&255)),g.gzhead.hcrc&&(t.adler=m(t.adler,g.pending_buf,g.pending,0)),g.gzindex=0,g.status=69):(q(g,0),q(g,0),q(g,0),q(g,0),q(g,0),q(g,g.level===9?2:2<=g.strategy||g.level<2?4:0),q(g,3),g.status=R);else{var L=p+(g.w_bits-8<<4)<<8;L|=(2<=g.strategy||g.level<2?0:g.level<6?1:g.level===6?2:3)<<6,g.strstart!==0&&(L|=32),L+=31-L%31,g.status=R,X(g,L),g.strstart!==0&&(X(g,t.adler>>>16),X(g,65535&t.adler)),t.adler=1}if(g.status===69)if(g.gzhead.extra){for(f=g.pending;g.gzindex<(65535&g.gzhead.extra.length)&&(g.pending!==g.pending_buf_size||(g.gzhead.hcrc&&g.pending>f&&(t.adler=m(t.adler,g.pending_buf,g.pending-f,f)),N(t),f=g.pending,g.pending!==g.pending_buf_size));)q(g,255&g.gzhead.extra[g.gzindex]),g.gzindex++;g.gzhead.hcrc&&g.pending>f&&(t.adler=m(t.adler,g.pending_buf,g.pending-f,f)),g.gzindex===g.gzhead.extra.length&&(g.gzindex=0,g.status=73)}else g.status=73;if(g.status===73)if(g.gzhead.name){f=g.pending;do{if(g.pending===g.pending_buf_size&&(g.gzhead.hcrc&&g.pending>f&&(t.adler=m(t.adler,g.pending_buf,g.pending-f,f)),N(t),f=g.pending,g.pending===g.pending_buf_size)){C=1;break}C=g.gzindex<g.gzhead.name.length?255&g.gzhead.name.charCodeAt(g.gzindex++):0,q(g,C)}while(C!==0);g.gzhead.hcrc&&g.pending>f&&(t.adler=m(t.adler,g.pending_buf,g.pending-f,f)),C===0&&(g.gzindex=0,g.status=91)}else g.status=91;if(g.status===91)if(g.gzhead.comment){f=g.pending;do{if(g.pending===g.pending_buf_size&&(g.gzhead.hcrc&&g.pending>f&&(t.adler=m(t.adler,g.pending_buf,g.pending-f,f)),N(t),f=g.pending,g.pending===g.pending_buf_size)){C=1;break}C=g.gzindex<g.gzhead.comment.length?255&g.gzhead.comment.charCodeAt(g.gzindex++):0,q(g,C)}while(C!==0);g.gzhead.hcrc&&g.pending>f&&(t.adler=m(t.adler,g.pending_buf,g.pending-f,f)),C===0&&(g.status=103)}else g.status=103;if(g.status===103&&(g.gzhead.hcrc?(g.pending+2>g.pending_buf_size&&N(t),g.pending+2<=g.pending_buf_size&&(q(g,255&t.adler),q(g,t.adler>>8&255),t.adler=0,g.status=R)):g.status=R),g.pending!==0){if(N(t),t.avail_out===0)return g.last_flush=-1,s}else if(t.avail_in===0&&M(T)<=M(j)&&T!==w)return et(t,-5);if(g.status===666&&t.avail_in!==0)return et(t,-5);if(t.avail_in!==0||g.lookahead!==0||T!==_&&g.status!==666){var U=g.strategy===2?(function(A,$){for(var K;;){if(A.lookahead===0&&(at(A),A.lookahead===0)){if($===_)return e;break}if(A.match_length=0,K=r._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++,K&&(I(A,!1),A.strm.avail_out===0))return e}return A.insert=0,$===w?(I(A,!0),A.strm.avail_out===0?tt:W):A.last_lit&&(I(A,!1),A.strm.avail_out===0)?e:B})(g,T):g.strategy===3?(function(A,$){for(var K,G,Y,it,nt=A.window;;){if(A.lookahead<=H){if(at(A),A.lookahead<=H&&$===_)return e;if(A.lookahead===0)break}if(A.match_length=0,A.lookahead>=P&&0<A.strstart&&(G=nt[Y=A.strstart-1])===nt[++Y]&&G===nt[++Y]&&G===nt[++Y]){it=A.strstart+H;do;while(G===nt[++Y]&&G===nt[++Y]&&G===nt[++Y]&&G===nt[++Y]&&G===nt[++Y]&&G===nt[++Y]&&G===nt[++Y]&&G===nt[++Y]&&Y<it);A.match_length=H-(it-Y),A.match_length>A.lookahead&&(A.match_length=A.lookahead)}if(A.match_length>=P?(K=r._tr_tally(A,1,A.match_length-P),A.lookahead-=A.match_length,A.strstart+=A.match_length,A.match_length=0):(K=r._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++),K&&(I(A,!1),A.strm.avail_out===0))return e}return A.insert=0,$===w?(I(A,!0),A.strm.avail_out===0?tt:W):A.last_lit&&(I(A,!1),A.strm.avail_out===0)?e:B})(g,T):i[g.level].func(g,T);if(U!==tt&&U!==W||(g.status=666),U===e||U===tt)return t.avail_out===0&&(g.last_flush=-1),s;if(U===B&&(T===1?r._tr_align(g):T!==5&&(r._tr_stored_block(g,0,0,!1),T===3&&(Q(g.head),g.lookahead===0&&(g.strstart=0,g.block_start=0,g.insert=0))),N(t),t.avail_out===0))return g.last_flush=-1,s}return T!==w?s:g.wrap<=0?1:(g.wrap===2?(q(g,255&t.adler),q(g,t.adler>>8&255),q(g,t.adler>>16&255),q(g,t.adler>>24&255),q(g,255&t.total_in),q(g,t.total_in>>8&255),q(g,t.total_in>>16&255),q(g,t.total_in>>24&255)):(X(g,t.adler>>>16),X(g,65535&t.adler)),N(t),0<g.wrap&&(g.wrap=-g.wrap),g.pending!==0?s:1)},h.deflateEnd=function(t){var T;return t&&t.state?(T=t.state.status)!==k&&T!==69&&T!==73&&T!==91&&T!==103&&T!==R&&T!==666?et(t,d):(t.state=null,T===R?et(t,-3):s):d},h.deflateSetDictionary=function(t,T){var j,g,f,C,L,U,A,$,K=T.length;if(!t||!t.state||(C=(j=t.state).wrap)===2||C===1&&j.status!==k||j.lookahead)return d;for(C===1&&(t.adler=c(t.adler,T,K,0)),j.wrap=0,K>=j.w_size&&(C===0&&(Q(j.head),j.strstart=0,j.block_start=0,j.insert=0),$=new n.Buf8(j.w_size),n.arraySet($,T,K-j.w_size,j.w_size,0),T=$,K=j.w_size),L=t.avail_in,U=t.next_in,A=t.input,t.avail_in=K,t.next_in=0,t.input=T,at(j);j.lookahead>=P;){for(g=j.strstart,f=j.lookahead-(P-1);j.ins_h=(j.ins_h<<j.hash_shift^j.window[g+P-1])&j.hash_mask,j.prev[g&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=g,g++,--f;);j.strstart=g,j.lookahead=P-1,at(j)}return j.strstart+=j.lookahead,j.block_start=j.strstart,j.insert=j.lookahead,j.lookahead=0,j.match_length=j.prev_length=P-1,j.match_available=0,t.next_in=U,t.input=A,t.avail_in=L,j.wrap=C,s},h.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(o,b,h){b.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(o,b,h){b.exports=function(i,n){var r,c,m,v,_,w,s,d,a,l,u,p,x,E,z,F,O,Z,P,H,J,k,R,e,B;r=i.state,c=i.next_in,e=i.input,m=c+(i.avail_in-5),v=i.next_out,B=i.output,_=v-(n-i.avail_out),w=v+(i.avail_out-257),s=r.dmax,d=r.wsize,a=r.whave,l=r.wnext,u=r.window,p=r.hold,x=r.bits,E=r.lencode,z=r.distcode,F=(1<<r.lenbits)-1,O=(1<<r.distbits)-1;t:do{x<15&&(p+=e[c++]<<x,x+=8,p+=e[c++]<<x,x+=8),Z=E[p&F];e:for(;;){if(p>>>=P=Z>>>24,x-=P,(P=Z>>>16&255)===0)B[v++]=65535&Z;else{if(!(16&P)){if((64&P)==0){Z=E[(65535&Z)+(p&(1<<P)-1)];continue e}if(32&P){r.mode=12;break t}i.msg="invalid literal/length code",r.mode=30;break t}H=65535&Z,(P&=15)&&(x<P&&(p+=e[c++]<<x,x+=8),H+=p&(1<<P)-1,p>>>=P,x-=P),x<15&&(p+=e[c++]<<x,x+=8,p+=e[c++]<<x,x+=8),Z=z[p&O];r:for(;;){if(p>>>=P=Z>>>24,x-=P,!(16&(P=Z>>>16&255))){if((64&P)==0){Z=z[(65535&Z)+(p&(1<<P)-1)];continue r}i.msg="invalid distance code",r.mode=30;break t}if(J=65535&Z,x<(P&=15)&&(p+=e[c++]<<x,(x+=8)<P&&(p+=e[c++]<<x,x+=8)),s<(J+=p&(1<<P)-1)){i.msg="invalid distance too far back",r.mode=30;break t}if(p>>>=P,x-=P,(P=v-_)<J){if(a<(P=J-P)&&r.sane){i.msg="invalid distance too far back",r.mode=30;break t}if(R=u,(k=0)===l){if(k+=d-P,P<H){for(H-=P;B[v++]=u[k++],--P;);k=v-J,R=B}}else if(l<P){if(k+=d+l-P,(P-=l)<H){for(H-=P;B[v++]=u[k++],--P;);if(k=0,l<H){for(H-=P=l;B[v++]=u[k++],--P;);k=v-J,R=B}}}else if(k+=l-P,P<H){for(H-=P;B[v++]=u[k++],--P;);k=v-J,R=B}for(;2<H;)B[v++]=R[k++],B[v++]=R[k++],B[v++]=R[k++],H-=3;H&&(B[v++]=R[k++],1<H&&(B[v++]=R[k++]))}else{for(k=v-J;B[v++]=B[k++],B[v++]=B[k++],B[v++]=B[k++],2<(H-=3););H&&(B[v++]=B[k++],1<H&&(B[v++]=B[k++]))}break}}break}}while(c<m&&v<w);c-=H=x>>3,p&=(1<<(x-=H<<3))-1,i.next_in=c,i.next_out=v,i.avail_in=c<m?m-c+5:5-(c-m),i.avail_out=v<w?w-v+257:257-(v-w),r.hold=p,r.bits=x}},{}],49:[function(o,b,h){var i=o("../utils/common"),n=o("./adler32"),r=o("./crc32"),c=o("./inffast"),m=o("./inftrees"),v=1,_=2,w=0,s=-2,d=1,a=852,l=592;function u(k){return(k>>>24&255)+(k>>>8&65280)+((65280&k)<<8)+((255&k)<<24)}function p(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function x(k){var R;return k&&k.state?(R=k.state,k.total_in=k.total_out=R.total=0,k.msg="",R.wrap&&(k.adler=1&R.wrap),R.mode=d,R.last=0,R.havedict=0,R.dmax=32768,R.head=null,R.hold=0,R.bits=0,R.lencode=R.lendyn=new i.Buf32(a),R.distcode=R.distdyn=new i.Buf32(l),R.sane=1,R.back=-1,w):s}function E(k){var R;return k&&k.state?((R=k.state).wsize=0,R.whave=0,R.wnext=0,x(k)):s}function z(k,R){var e,B;return k&&k.state?(B=k.state,R<0?(e=0,R=-R):(e=1+(R>>4),R<48&&(R&=15)),R&&(R<8||15<R)?s:(B.window!==null&&B.wbits!==R&&(B.window=null),B.wrap=e,B.wbits=R,E(k))):s}function F(k,R){var e,B;return k?(B=new p,(k.state=B).window=null,(e=z(k,R))!==w&&(k.state=null),e):s}var O,Z,P=!0;function H(k){if(P){var R;for(O=new i.Buf32(512),Z=new i.Buf32(32),R=0;R<144;)k.lens[R++]=8;for(;R<256;)k.lens[R++]=9;for(;R<280;)k.lens[R++]=7;for(;R<288;)k.lens[R++]=8;for(m(v,k.lens,0,288,O,0,k.work,{bits:9}),R=0;R<32;)k.lens[R++]=5;m(_,k.lens,0,32,Z,0,k.work,{bits:5}),P=!1}k.lencode=O,k.lenbits=9,k.distcode=Z,k.distbits=5}function J(k,R,e,B){var tt,W=k.state;return W.window===null&&(W.wsize=1<<W.wbits,W.wnext=0,W.whave=0,W.window=new i.Buf8(W.wsize)),B>=W.wsize?(i.arraySet(W.window,R,e-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(B<(tt=W.wsize-W.wnext)&&(tt=B),i.arraySet(W.window,R,e-B,tt,W.wnext),(B-=tt)?(i.arraySet(W.window,R,e-B,B,0),W.wnext=B,W.whave=W.wsize):(W.wnext+=tt,W.wnext===W.wsize&&(W.wnext=0),W.whave<W.wsize&&(W.whave+=tt))),0}h.inflateReset=E,h.inflateReset2=z,h.inflateResetKeep=x,h.inflateInit=function(k){return F(k,15)},h.inflateInit2=F,h.inflate=function(k,R){var e,B,tt,W,et,M,Q,N,I,q,X,V,at,ut,rt,st,ct,ot,ft,dt,t,T,j,g,f=0,C=new i.Buf8(4),L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!k||!k.state||!k.output||!k.input&&k.avail_in!==0)return s;(e=k.state).mode===12&&(e.mode=13),et=k.next_out,tt=k.output,Q=k.avail_out,W=k.next_in,B=k.input,M=k.avail_in,N=e.hold,I=e.bits,q=M,X=Q,T=w;t:for(;;)switch(e.mode){case d:if(e.wrap===0){e.mode=13;break}for(;I<16;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}if(2&e.wrap&&N===35615){C[e.check=0]=255&N,C[1]=N>>>8&255,e.check=r(e.check,C,2,0),I=N=0,e.mode=2;break}if(e.flags=0,e.head&&(e.head.done=!1),!(1&e.wrap)||(((255&N)<<8)+(N>>8))%31){k.msg="incorrect header check",e.mode=30;break}if((15&N)!=8){k.msg="unknown compression method",e.mode=30;break}if(I-=4,t=8+(15&(N>>>=4)),e.wbits===0)e.wbits=t;else if(t>e.wbits){k.msg="invalid window size",e.mode=30;break}e.dmax=1<<t,k.adler=e.check=1,e.mode=512&N?10:12,I=N=0;break;case 2:for(;I<16;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}if(e.flags=N,(255&e.flags)!=8){k.msg="unknown compression method",e.mode=30;break}if(57344&e.flags){k.msg="unknown header flags set",e.mode=30;break}e.head&&(e.head.text=N>>8&1),512&e.flags&&(C[0]=255&N,C[1]=N>>>8&255,e.check=r(e.check,C,2,0)),I=N=0,e.mode=3;case 3:for(;I<32;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}e.head&&(e.head.time=N),512&e.flags&&(C[0]=255&N,C[1]=N>>>8&255,C[2]=N>>>16&255,C[3]=N>>>24&255,e.check=r(e.check,C,4,0)),I=N=0,e.mode=4;case 4:for(;I<16;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}e.head&&(e.head.xflags=255&N,e.head.os=N>>8),512&e.flags&&(C[0]=255&N,C[1]=N>>>8&255,e.check=r(e.check,C,2,0)),I=N=0,e.mode=5;case 5:if(1024&e.flags){for(;I<16;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}e.length=N,e.head&&(e.head.extra_len=N),512&e.flags&&(C[0]=255&N,C[1]=N>>>8&255,e.check=r(e.check,C,2,0)),I=N=0}else e.head&&(e.head.extra=null);e.mode=6;case 6:if(1024&e.flags&&(M<(V=e.length)&&(V=M),V&&(e.head&&(t=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Array(e.head.extra_len)),i.arraySet(e.head.extra,B,W,V,t)),512&e.flags&&(e.check=r(e.check,B,V,W)),M-=V,W+=V,e.length-=V),e.length))break t;e.length=0,e.mode=7;case 7:if(2048&e.flags){if(M===0)break t;for(V=0;t=B[W+V++],e.head&&t&&e.length<65536&&(e.head.name+=String.fromCharCode(t)),t&&V<M;);if(512&e.flags&&(e.check=r(e.check,B,V,W)),M-=V,W+=V,t)break t}else e.head&&(e.head.name=null);e.length=0,e.mode=8;case 8:if(4096&e.flags){if(M===0)break t;for(V=0;t=B[W+V++],e.head&&t&&e.length<65536&&(e.head.comment+=String.fromCharCode(t)),t&&V<M;);if(512&e.flags&&(e.check=r(e.check,B,V,W)),M-=V,W+=V,t)break t}else e.head&&(e.head.comment=null);e.mode=9;case 9:if(512&e.flags){for(;I<16;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}if(N!==(65535&e.check)){k.msg="header crc mismatch",e.mode=30;break}I=N=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),k.adler=e.check=0,e.mode=12;break;case 10:for(;I<32;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}k.adler=e.check=u(N),I=N=0,e.mode=11;case 11:if(e.havedict===0)return k.next_out=et,k.avail_out=Q,k.next_in=W,k.avail_in=M,e.hold=N,e.bits=I,2;k.adler=e.check=1,e.mode=12;case 12:if(R===5||R===6)break t;case 13:if(e.last){N>>>=7&I,I-=7&I,e.mode=27;break}for(;I<3;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}switch(e.last=1&N,I-=1,3&(N>>>=1)){case 0:e.mode=14;break;case 1:if(H(e),e.mode=20,R!==6)break;N>>>=2,I-=2;break t;case 2:e.mode=17;break;case 3:k.msg="invalid block type",e.mode=30}N>>>=2,I-=2;break;case 14:for(N>>>=7&I,I-=7&I;I<32;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}if((65535&N)!=(N>>>16^65535)){k.msg="invalid stored block lengths",e.mode=30;break}if(e.length=65535&N,I=N=0,e.mode=15,R===6)break t;case 15:e.mode=16;case 16:if(V=e.length){if(M<V&&(V=M),Q<V&&(V=Q),V===0)break t;i.arraySet(tt,B,W,V,et),M-=V,W+=V,Q-=V,et+=V,e.length-=V;break}e.mode=12;break;case 17:for(;I<14;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}if(e.nlen=257+(31&N),N>>>=5,I-=5,e.ndist=1+(31&N),N>>>=5,I-=5,e.ncode=4+(15&N),N>>>=4,I-=4,286<e.nlen||30<e.ndist){k.msg="too many length or distance symbols",e.mode=30;break}e.have=0,e.mode=18;case 18:for(;e.have<e.ncode;){for(;I<3;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}e.lens[L[e.have++]]=7&N,N>>>=3,I-=3}for(;e.have<19;)e.lens[L[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,j={bits:e.lenbits},T=m(0,e.lens,0,19,e.lencode,0,e.work,j),e.lenbits=j.bits,T){k.msg="invalid code lengths set",e.mode=30;break}e.have=0,e.mode=19;case 19:for(;e.have<e.nlen+e.ndist;){for(;st=(f=e.lencode[N&(1<<e.lenbits)-1])>>>16&255,ct=65535&f,!((rt=f>>>24)<=I);){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}if(ct<16)N>>>=rt,I-=rt,e.lens[e.have++]=ct;else{if(ct===16){for(g=rt+2;I<g;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}if(N>>>=rt,I-=rt,e.have===0){k.msg="invalid bit length repeat",e.mode=30;break}t=e.lens[e.have-1],V=3+(3&N),N>>>=2,I-=2}else if(ct===17){for(g=rt+3;I<g;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}I-=rt,t=0,V=3+(7&(N>>>=rt)),N>>>=3,I-=3}else{for(g=rt+7;I<g;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}I-=rt,t=0,V=11+(127&(N>>>=rt)),N>>>=7,I-=7}if(e.have+V>e.nlen+e.ndist){k.msg="invalid bit length repeat",e.mode=30;break}for(;V--;)e.lens[e.have++]=t}}if(e.mode===30)break;if(e.lens[256]===0){k.msg="invalid code -- missing end-of-block",e.mode=30;break}if(e.lenbits=9,j={bits:e.lenbits},T=m(v,e.lens,0,e.nlen,e.lencode,0,e.work,j),e.lenbits=j.bits,T){k.msg="invalid literal/lengths set",e.mode=30;break}if(e.distbits=6,e.distcode=e.distdyn,j={bits:e.distbits},T=m(_,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,j),e.distbits=j.bits,T){k.msg="invalid distances set",e.mode=30;break}if(e.mode=20,R===6)break t;case 20:e.mode=21;case 21:if(6<=M&&258<=Q){k.next_out=et,k.avail_out=Q,k.next_in=W,k.avail_in=M,e.hold=N,e.bits=I,c(k,X),et=k.next_out,tt=k.output,Q=k.avail_out,W=k.next_in,B=k.input,M=k.avail_in,N=e.hold,I=e.bits,e.mode===12&&(e.back=-1);break}for(e.back=0;st=(f=e.lencode[N&(1<<e.lenbits)-1])>>>16&255,ct=65535&f,!((rt=f>>>24)<=I);){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}if(st&&(240&st)==0){for(ot=rt,ft=st,dt=ct;st=(f=e.lencode[dt+((N&(1<<ot+ft)-1)>>ot)])>>>16&255,ct=65535&f,!(ot+(rt=f>>>24)<=I);){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}N>>>=ot,I-=ot,e.back+=ot}if(N>>>=rt,I-=rt,e.back+=rt,e.length=ct,st===0){e.mode=26;break}if(32&st){e.back=-1,e.mode=12;break}if(64&st){k.msg="invalid literal/length code",e.mode=30;break}e.extra=15&st,e.mode=22;case 22:if(e.extra){for(g=e.extra;I<g;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}e.length+=N&(1<<e.extra)-1,N>>>=e.extra,I-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=23;case 23:for(;st=(f=e.distcode[N&(1<<e.distbits)-1])>>>16&255,ct=65535&f,!((rt=f>>>24)<=I);){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}if((240&st)==0){for(ot=rt,ft=st,dt=ct;st=(f=e.distcode[dt+((N&(1<<ot+ft)-1)>>ot)])>>>16&255,ct=65535&f,!(ot+(rt=f>>>24)<=I);){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}N>>>=ot,I-=ot,e.back+=ot}if(N>>>=rt,I-=rt,e.back+=rt,64&st){k.msg="invalid distance code",e.mode=30;break}e.offset=ct,e.extra=15&st,e.mode=24;case 24:if(e.extra){for(g=e.extra;I<g;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}e.offset+=N&(1<<e.extra)-1,N>>>=e.extra,I-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){k.msg="invalid distance too far back",e.mode=30;break}e.mode=25;case 25:if(Q===0)break t;if(V=X-Q,e.offset>V){if((V=e.offset-V)>e.whave&&e.sane){k.msg="invalid distance too far back",e.mode=30;break}at=V>e.wnext?(V-=e.wnext,e.wsize-V):e.wnext-V,V>e.length&&(V=e.length),ut=e.window}else ut=tt,at=et-e.offset,V=e.length;for(Q<V&&(V=Q),Q-=V,e.length-=V;tt[et++]=ut[at++],--V;);e.length===0&&(e.mode=21);break;case 26:if(Q===0)break t;tt[et++]=e.length,Q--,e.mode=21;break;case 27:if(e.wrap){for(;I<32;){if(M===0)break t;M--,N|=B[W++]<<I,I+=8}if(X-=Q,k.total_out+=X,e.total+=X,X&&(k.adler=e.check=e.flags?r(e.check,tt,X,et-X):n(e.check,tt,X,et-X)),X=Q,(e.flags?N:u(N))!==e.check){k.msg="incorrect data check",e.mode=30;break}I=N=0}e.mode=28;case 28:if(e.wrap&&e.flags){for(;I<32;){if(M===0)break t;M--,N+=B[W++]<<I,I+=8}if(N!==(4294967295&e.total)){k.msg="incorrect length check",e.mode=30;break}I=N=0}e.mode=29;case 29:T=1;break t;case 30:T=-3;break t;case 31:return-4;case 32:default:return s}return k.next_out=et,k.avail_out=Q,k.next_in=W,k.avail_in=M,e.hold=N,e.bits=I,(e.wsize||X!==k.avail_out&&e.mode<30&&(e.mode<27||R!==4))&&J(k,k.output,k.next_out,X-k.avail_out)?(e.mode=31,-4):(q-=k.avail_in,X-=k.avail_out,k.total_in+=q,k.total_out+=X,e.total+=X,e.wrap&&X&&(k.adler=e.check=e.flags?r(e.check,tt,X,k.next_out-X):n(e.check,tt,X,k.next_out-X)),k.data_type=e.bits+(e.last?64:0)+(e.mode===12?128:0)+(e.mode===20||e.mode===15?256:0),(q==0&&X===0||R===4)&&T===w&&(T=-5),T)},h.inflateEnd=function(k){if(!k||!k.state)return s;var R=k.state;return R.window&&(R.window=null),k.state=null,w},h.inflateGetHeader=function(k,R){var e;return k&&k.state?(2&(e=k.state).wrap)==0?s:((e.head=R).done=!1,w):s},h.inflateSetDictionary=function(k,R){var e,B=R.length;return k&&k.state?(e=k.state).wrap!==0&&e.mode!==11?s:e.mode===11&&n(1,R,B,0)!==e.check?-3:J(k,R,B,B)?(e.mode=31,-4):(e.havedict=1,w):s},h.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(o,b,h){var i=o("../utils/common"),n=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],r=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],m=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];b.exports=function(v,_,w,s,d,a,l,u){var p,x,E,z,F,O,Z,P,H,J=u.bits,k=0,R=0,e=0,B=0,tt=0,W=0,et=0,M=0,Q=0,N=0,I=null,q=0,X=new i.Buf16(16),V=new i.Buf16(16),at=null,ut=0;for(k=0;k<=15;k++)X[k]=0;for(R=0;R<s;R++)X[_[w+R]]++;for(tt=J,B=15;1<=B&&X[B]===0;B--);if(B<tt&&(tt=B),B===0)return d[a++]=20971520,d[a++]=20971520,u.bits=1,0;for(e=1;e<B&&X[e]===0;e++);for(tt<e&&(tt=e),k=M=1;k<=15;k++)if(M<<=1,(M-=X[k])<0)return-1;if(0<M&&(v===0||B!==1))return-1;for(V[1]=0,k=1;k<15;k++)V[k+1]=V[k]+X[k];for(R=0;R<s;R++)_[w+R]!==0&&(l[V[_[w+R]]++]=R);if(O=v===0?(I=at=l,19):v===1?(I=n,q-=257,at=r,ut-=257,256):(I=c,at=m,-1),k=e,F=a,et=R=N=0,E=-1,z=(Q=1<<(W=tt))-1,v===1&&852<Q||v===2&&592<Q)return 1;for(;;){for(Z=k-et,H=l[R]<O?(P=0,l[R]):l[R]>O?(P=at[ut+l[R]],I[q+l[R]]):(P=96,0),p=1<<k-et,e=x=1<<W;d[F+(N>>et)+(x-=p)]=Z<<24|P<<16|H|0,x!==0;);for(p=1<<k-1;N&p;)p>>=1;if(p!==0?(N&=p-1,N+=p):N=0,R++,--X[k]==0){if(k===B)break;k=_[w+l[R]]}if(tt<k&&(N&z)!==E){for(et===0&&(et=tt),F+=e,M=1<<(W=k-et);W+et<B&&!((M-=X[W+et])<=0);)W++,M<<=1;if(Q+=1<<W,v===1&&852<Q||v===2&&592<Q)return 1;d[E=N&z]=tt<<24|W<<16|F-a|0}}return N!==0&&(d[F+N]=k-et<<24|64<<16|0),u.bits=tt,0}},{"../utils/common":41}],51:[function(o,b,h){b.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(o,b,h){var i=o("../utils/common"),n=0,r=1;function c(f){for(var C=f.length;0<=--C;)f[C]=0}var m=0,v=29,_=256,w=_+1+v,s=30,d=19,a=2*w+1,l=15,u=16,p=7,x=256,E=16,z=17,F=18,O=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Z=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],J=new Array(2*(w+2));c(J);var k=new Array(2*s);c(k);var R=new Array(512);c(R);var e=new Array(256);c(e);var B=new Array(v);c(B);var tt,W,et,M=new Array(s);function Q(f,C,L,U,A){this.static_tree=f,this.extra_bits=C,this.extra_base=L,this.elems=U,this.max_length=A,this.has_stree=f&&f.length}function N(f,C){this.dyn_tree=f,this.max_code=0,this.stat_desc=C}function I(f){return f<256?R[f]:R[256+(f>>>7)]}function q(f,C){f.pending_buf[f.pending++]=255&C,f.pending_buf[f.pending++]=C>>>8&255}function X(f,C,L){f.bi_valid>u-L?(f.bi_buf|=C<<f.bi_valid&65535,q(f,f.bi_buf),f.bi_buf=C>>u-f.bi_valid,f.bi_valid+=L-u):(f.bi_buf|=C<<f.bi_valid&65535,f.bi_valid+=L)}function V(f,C,L){X(f,L[2*C],L[2*C+1])}function at(f,C){for(var L=0;L|=1&f,f>>>=1,L<<=1,0<--C;);return L>>>1}function ut(f,C,L){var U,A,$=new Array(l+1),K=0;for(U=1;U<=l;U++)$[U]=K=K+L[U-1]<<1;for(A=0;A<=C;A++){var G=f[2*A+1];G!==0&&(f[2*A]=at($[G]++,G))}}function rt(f){var C;for(C=0;C<w;C++)f.dyn_ltree[2*C]=0;for(C=0;C<s;C++)f.dyn_dtree[2*C]=0;for(C=0;C<d;C++)f.bl_tree[2*C]=0;f.dyn_ltree[2*x]=1,f.opt_len=f.static_len=0,f.last_lit=f.matches=0}function st(f){8<f.bi_valid?q(f,f.bi_buf):0<f.bi_valid&&(f.pending_buf[f.pending++]=f.bi_buf),f.bi_buf=0,f.bi_valid=0}function ct(f,C,L,U){var A=2*C,$=2*L;return f[A]<f[$]||f[A]===f[$]&&U[C]<=U[L]}function ot(f,C,L){for(var U=f.heap[L],A=L<<1;A<=f.heap_len&&(A<f.heap_len&&ct(C,f.heap[A+1],f.heap[A],f.depth)&&A++,!ct(C,U,f.heap[A],f.depth));)f.heap[L]=f.heap[A],L=A,A<<=1;f.heap[L]=U}function ft(f,C,L){var U,A,$,K,G=0;if(f.last_lit!==0)for(;U=f.pending_buf[f.d_buf+2*G]<<8|f.pending_buf[f.d_buf+2*G+1],A=f.pending_buf[f.l_buf+G],G++,U===0?V(f,A,C):(V(f,($=e[A])+_+1,C),(K=O[$])!==0&&X(f,A-=B[$],K),V(f,$=I(--U),L),(K=Z[$])!==0&&X(f,U-=M[$],K)),G<f.last_lit;);V(f,x,C)}function dt(f,C){var L,U,A,$=C.dyn_tree,K=C.stat_desc.static_tree,G=C.stat_desc.has_stree,Y=C.stat_desc.elems,it=-1;for(f.heap_len=0,f.heap_max=a,L=0;L<Y;L++)$[2*L]!==0?(f.heap[++f.heap_len]=it=L,f.depth[L]=0):$[2*L+1]=0;for(;f.heap_len<2;)$[2*(A=f.heap[++f.heap_len]=it<2?++it:0)]=1,f.depth[A]=0,f.opt_len--,G&&(f.static_len-=K[2*A+1]);for(C.max_code=it,L=f.heap_len>>1;1<=L;L--)ot(f,$,L);for(A=Y;L=f.heap[1],f.heap[1]=f.heap[f.heap_len--],ot(f,$,1),U=f.heap[1],f.heap[--f.heap_max]=L,f.heap[--f.heap_max]=U,$[2*A]=$[2*L]+$[2*U],f.depth[A]=(f.depth[L]>=f.depth[U]?f.depth[L]:f.depth[U])+1,$[2*L+1]=$[2*U+1]=A,f.heap[1]=A++,ot(f,$,1),2<=f.heap_len;);f.heap[--f.heap_max]=f.heap[1],(function(nt,ht){var _t,pt,bt,lt,vt,Et,mt=ht.dyn_tree,Ot=ht.max_code,qt=ht.stat_desc.static_tree,Jt=ht.stat_desc.has_stree,Qt=ht.stat_desc.extra_bits,Rt=ht.stat_desc.extra_base,yt=ht.stat_desc.max_length,wt=0;for(lt=0;lt<=l;lt++)nt.bl_count[lt]=0;for(mt[2*nt.heap[nt.heap_max]+1]=0,_t=nt.heap_max+1;_t<a;_t++)yt<(lt=mt[2*mt[2*(pt=nt.heap[_t])+1]+1]+1)&&(lt=yt,wt++),mt[2*pt+1]=lt,Ot<pt||(nt.bl_count[lt]++,vt=0,Rt<=pt&&(vt=Qt[pt-Rt]),Et=mt[2*pt],nt.opt_len+=Et*(lt+vt),Jt&&(nt.static_len+=Et*(qt[2*pt+1]+vt)));if(wt!==0){do{for(lt=yt-1;nt.bl_count[lt]===0;)lt--;nt.bl_count[lt]--,nt.bl_count[lt+1]+=2,nt.bl_count[yt]--,wt-=2}while(0<wt);for(lt=yt;lt!==0;lt--)for(pt=nt.bl_count[lt];pt!==0;)Ot<(bt=nt.heap[--_t])||(mt[2*bt+1]!==lt&&(nt.opt_len+=(lt-mt[2*bt+1])*mt[2*bt],mt[2*bt+1]=lt),pt--)}})(f,C),ut($,it,f.bl_count)}function t(f,C,L){var U,A,$=-1,K=C[1],G=0,Y=7,it=4;for(K===0&&(Y=138,it=3),C[2*(L+1)+1]=65535,U=0;U<=L;U++)A=K,K=C[2*(U+1)+1],++G<Y&&A===K||(G<it?f.bl_tree[2*A]+=G:A!==0?(A!==$&&f.bl_tree[2*A]++,f.bl_tree[2*E]++):G<=10?f.bl_tree[2*z]++:f.bl_tree[2*F]++,$=A,it=(G=0)===K?(Y=138,3):A===K?(Y=6,3):(Y=7,4))}function T(f,C,L){var U,A,$=-1,K=C[1],G=0,Y=7,it=4;for(K===0&&(Y=138,it=3),U=0;U<=L;U++)if(A=K,K=C[2*(U+1)+1],!(++G<Y&&A===K)){if(G<it)for(;V(f,A,f.bl_tree),--G!=0;);else A!==0?(A!==$&&(V(f,A,f.bl_tree),G--),V(f,E,f.bl_tree),X(f,G-3,2)):G<=10?(V(f,z,f.bl_tree),X(f,G-3,3)):(V(f,F,f.bl_tree),X(f,G-11,7));$=A,it=(G=0)===K?(Y=138,3):A===K?(Y=6,3):(Y=7,4)}}c(M);var j=!1;function g(f,C,L,U){X(f,(m<<1)+(U?1:0),3),(function(A,$,K,G){st(A),q(A,K),q(A,~K),i.arraySet(A.pending_buf,A.window,$,K,A.pending),A.pending+=K})(f,C,L)}h._tr_init=function(f){j||((function(){var C,L,U,A,$,K=new Array(l+1);for(A=U=0;A<v-1;A++)for(B[A]=U,C=0;C<1<<O[A];C++)e[U++]=A;for(e[U-1]=A,A=$=0;A<16;A++)for(M[A]=$,C=0;C<1<<Z[A];C++)R[$++]=A;for($>>=7;A<s;A++)for(M[A]=$<<7,C=0;C<1<<Z[A]-7;C++)R[256+$++]=A;for(L=0;L<=l;L++)K[L]=0;for(C=0;C<=143;)J[2*C+1]=8,C++,K[8]++;for(;C<=255;)J[2*C+1]=9,C++,K[9]++;for(;C<=279;)J[2*C+1]=7,C++,K[7]++;for(;C<=287;)J[2*C+1]=8,C++,K[8]++;for(ut(J,w+1,K),C=0;C<s;C++)k[2*C+1]=5,k[2*C]=at(C,5);tt=new Q(J,O,_+1,w,l),W=new Q(k,Z,0,s,l),et=new Q(new Array(0),P,0,d,p)})(),j=!0),f.l_desc=new N(f.dyn_ltree,tt),f.d_desc=new N(f.dyn_dtree,W),f.bl_desc=new N(f.bl_tree,et),f.bi_buf=0,f.bi_valid=0,rt(f)},h._tr_stored_block=g,h._tr_flush_block=function(f,C,L,U){var A,$,K=0;0<f.level?(f.strm.data_type===2&&(f.strm.data_type=(function(G){var Y,it=4093624447;for(Y=0;Y<=31;Y++,it>>>=1)if(1&it&&G.dyn_ltree[2*Y]!==0)return n;if(G.dyn_ltree[18]!==0||G.dyn_ltree[20]!==0||G.dyn_ltree[26]!==0)return r;for(Y=32;Y<_;Y++)if(G.dyn_ltree[2*Y]!==0)return r;return n})(f)),dt(f,f.l_desc),dt(f,f.d_desc),K=(function(G){var Y;for(t(G,G.dyn_ltree,G.l_desc.max_code),t(G,G.dyn_dtree,G.d_desc.max_code),dt(G,G.bl_desc),Y=d-1;3<=Y&&G.bl_tree[2*H[Y]+1]===0;Y--);return G.opt_len+=3*(Y+1)+5+5+4,Y})(f),A=f.opt_len+3+7>>>3,($=f.static_len+3+7>>>3)<=A&&(A=$)):A=$=L+5,L+4<=A&&C!==-1?g(f,C,L,U):f.strategy===4||$===A?(X(f,2+(U?1:0),3),ft(f,J,k)):(X(f,4+(U?1:0),3),(function(G,Y,it,nt){var ht;for(X(G,Y-257,5),X(G,it-1,5),X(G,nt-4,4),ht=0;ht<nt;ht++)X(G,G.bl_tree[2*H[ht]+1],3);T(G,G.dyn_ltree,Y-1),T(G,G.dyn_dtree,it-1)})(f,f.l_desc.max_code+1,f.d_desc.max_code+1,K+1),ft(f,f.dyn_ltree,f.dyn_dtree)),rt(f),U&&st(f)},h._tr_tally=function(f,C,L){return f.pending_buf[f.d_buf+2*f.last_lit]=C>>>8&255,f.pending_buf[f.d_buf+2*f.last_lit+1]=255&C,f.pending_buf[f.l_buf+f.last_lit]=255&L,f.last_lit++,C===0?f.dyn_ltree[2*L]++:(f.matches++,C--,f.dyn_ltree[2*(e[L]+_+1)]++,f.dyn_dtree[2*I(C)]++),f.last_lit===f.lit_bufsize-1},h._tr_align=function(f){X(f,2,3),V(f,x,J),(function(C){C.bi_valid===16?(q(C,C.bi_buf),C.bi_buf=0,C.bi_valid=0):8<=C.bi_valid&&(C.pending_buf[C.pending++]=255&C.bi_buf,C.bi_buf>>=8,C.bi_valid-=8)})(f)}},{"../utils/common":41}],53:[function(o,b,h){b.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(o,b,h){(function(i){(function(n,r){if(!n.setImmediate){var c,m,v,_,w=1,s={},d=!1,a=n.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(n);l=l&&l.setTimeout?l:n,c={}.toString.call(n.process)==="[object process]"?function(E){process.nextTick(function(){p(E)})}:(function(){if(n.postMessage&&!n.importScripts){var E=!0,z=n.onmessage;return n.onmessage=function(){E=!1},n.postMessage("","*"),n.onmessage=z,E}})()?(_="setImmediate$"+Math.random()+"$",n.addEventListener?n.addEventListener("message",x,!1):n.attachEvent("onmessage",x),function(E){n.postMessage(_+E,"*")}):n.MessageChannel?((v=new MessageChannel).port1.onmessage=function(E){p(E.data)},function(E){v.port2.postMessage(E)}):a&&"onreadystatechange"in a.createElement("script")?(m=a.documentElement,function(E){var z=a.createElement("script");z.onreadystatechange=function(){p(E),z.onreadystatechange=null,m.removeChild(z),z=null},m.appendChild(z)}):function(E){setTimeout(p,0,E)},l.setImmediate=function(E){typeof E!="function"&&(E=new Function(""+E));for(var z=new Array(arguments.length-1),F=0;F<z.length;F++)z[F]=arguments[F+1];var O={callback:E,args:z};return s[w]=O,c(w),w++},l.clearImmediate=u}function u(E){delete s[E]}function p(E){if(d)setTimeout(p,0,E);else{var z=s[E];if(z){d=!0;try{(function(F){var O=F.callback,Z=F.args;switch(Z.length){case 0:O();break;case 1:O(Z[0]);break;case 2:O(Z[0],Z[1]);break;case 3:O(Z[0],Z[1],Z[2]);break;default:O.apply(r,Z)}})(z)}finally{u(E),d=!1}}}}function x(E){E.source===n&&typeof E.data=="string"&&E.data.indexOf(_)===0&&p(+E.data.slice(_.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof kt<"u"?kt:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(At)),At.exports}var Ke=Xe();const Ye=ne(Ke);async function qe(y){let S;try{S=await Ye.loadAsync(y)}catch(r){return{format:"obsidian-zip",notes:[],errors:[{sourcePath:y.name,reason:`Could not read zip: ${r instanceof Error?r.message:String(r)}`}],tags:[],attachments:[]}}const o=[],b=[],h=[],i=[];S.forEach((r,c)=>{i.push({path:r,obj:c})}),i.sort((r,c)=>r.path.localeCompare(c.path));const n=er(i);for(const{path:r,obj:c}of i){if(c.dir||Kt(r))continue;const m=rr(r,n);if(Yt(r)){try{const v=await c.async("string"),_=Vt({sourcePath:m,raw:v});o.push(_)}catch(v){b.push({sourcePath:r,reason:v instanceof Error?v.message:String(v)})}continue}try{const v=await c.async("blob"),_=Je(m);h.push({sourcePath:m,filename:_,ext:Qe(_),kind:_e(_),blob:v})}catch(v){b.push({sourcePath:r,reason:v instanceof Error?v.message:String(v)})}}return{format:"obsidian-zip",notes:o,errors:b,tags:nr(o),attachments:h}}function Je(y){const S=y.lastIndexOf("/");return S>=0?y.slice(S+1):y}function Qe(y){const S=y.lastIndexOf(".");return S>=0?y.slice(S+1).toLowerCase():""}const tr=new Set([".obsidian",".trash",".git",".parachute","__MACOSX","node_modules"]);function Kt(y){return y.split("/").some(o=>tr.has(o)||o.startsWith("."))}function Yt(y){const S=y.toLowerCase();return S.endsWith(".md")||S.endsWith(".markdown")}function er(y){let S=null;for(const o of y){if(Kt(o.path)||!Yt(o.path))continue;const b=o.path.split("/")[0]??"";if(!o.path.includes("/"))return null;if(S===null)S=b;else if(b!==S)return null}return S}function rr(y,S){return S&&y.startsWith(`${S}/`)?y.slice(S.length+1):y}function nr(y){const S=new Set;for(const o of y)for(const b of o.tags)S.add(b);return[...S].sort()}function hr(){const y=se(s=>s.getActiveVault()),S=ie(),o=ae(),[b]=oe(),h=le(s=>s.push),[i,n]=gt.useState({kind:"pick"}),r=gt.useRef(null),c=gt.useRef(null);if(!y){const s=b.get("url");if(s){const d=`/add?url=${encodeURIComponent(s)}&redirect=${encodeURIComponent("/import")}`;return D.jsx(Tt,{to:d,replace:!0})}return D.jsx(Tt,{to:"/",replace:!0})}const m=gt.useCallback(async s=>{if(s.length===0)return;n({kind:"parsing"});const d=Be(s);try{let a;if(d==="obsidian-zip"){const l=s.find(Ht);if(!l){h("No zip file found in selection","error"),n({kind:"pick"});return}a=await qe(l)}else d==="loose-markdown"?a=await Ge(s.filter(jt)):a={format:d,notes:[],errors:s.map(l=>({sourcePath:l.name,reason:"Unrecognized format (expected .zip, .md, or .markdown)."})),tags:[],attachments:[]};n({kind:"review",parsed:a})}catch(a){h(a instanceof Error?a.message:"Parse failed","error"),n({kind:"pick"})}},[h]),v=gt.useCallback(async()=>{if(i.kind!=="review")return;if(!S){h("Vault session unavailable — reconnect first","error");return}const s=new AbortController;c.current=s,n({kind:"importing",parsed:i.parsed,progress:{done:0,total:i.parsed.notes.length}});const d=await Ie({client:S,parsed:i.parsed,signal:s.signal,onProgress:a=>{n(l=>l.kind==="importing"?{...l,progress:a}:l)}});c.current=null,n({kind:"done",report:d,parsed:i.parsed})},[i,S,h]),_=gt.useCallback(()=>{var s;(s=c.current)==null||s.abort()},[]),w=gt.useCallback(()=>{n({kind:"pick"}),r.current&&(r.current.value="")},[]);return D.jsxs("div",{className:"page-prose",children:[D.jsx("nav",{className:"mb-4 text-sm text-fg-dim",children:D.jsx(ce,{to:"/notes",className:"focus-ring hover:text-accent",children:"← All notes"})}),D.jsxs("header",{className:"mb-8",children:[D.jsxs("h1",{className:"page-title",children:["Import notes into ",D.jsx("span",{className:"text-accent",children:y.name})]}),D.jsx("p",{className:"mt-3 text-fg-muted",children:"Upload an Obsidian vault zip or drop in loose markdown files. Everything is parsed in your browser and previewed before any note lands in the vault."})]}),i.kind==="pick"||i.kind==="parsing"?D.jsx(sr,{parsing:i.kind==="parsing",onFiles:m,inputRef:r}):null,i.kind==="review"?D.jsx(ir,{parsed:i.parsed,onConfirm:v,onBack:w}):null,i.kind==="importing"?D.jsx(ar,{progress:i.progress,onCancel:_}):null,i.kind==="done"?D.jsx(or,{report:i.report,parsed:i.parsed,onAnother:w,onHome:()=>o("/")}):null]})}function sr({parsing:y,onFiles:S,inputRef:o}){const b=h=>{const i=Array.from(h.target.files??[]);i.length>0&&S(i)};return D.jsx("section",{children:D.jsx(he,{onDropFiles:S,className:"rounded-2xl border border-border bg-card shadow-soft",hint:"zip or markdown",children:D.jsxs("div",{className:"flex min-h-[40vh] flex-col items-center justify-center gap-4 p-8 text-center",children:[D.jsx("p",{className:"font-serif text-lg text-fg",children:y?"Reading files…":"Drop a file here"}),D.jsx("p",{className:"text-sm text-fg-dim",children:"Accepts an Obsidian vault `.zip`, or one or more `.md` / `.markdown` files."}),D.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-3",children:[D.jsxs("label",{className:"btn btn-primary btn-touch cursor-pointer",children:[y?"Reading…":"Choose files",D.jsx("input",{ref:o,type:"file",className:"sr-only",accept:".zip,.md,.markdown",multiple:!0,disabled:y,onChange:b})]}),D.jsx("span",{className:"text-xs text-fg-dim",children:"— or drag and drop above"})]}),D.jsxs("details",{className:"mt-2 text-left text-xs text-fg-dim",children:[D.jsx("summary",{className:"cursor-pointer text-fg-muted hover:text-accent",children:"What about other tools?"}),D.jsxs("p",{className:"mt-2 max-w-md",children:["Notion CSV/JSON, Roam, Logseq, and Apple Notes exports are on the roadmap. For now, the CLI path"," ",D.jsx("code",{className:"rounded bg-bg-soft px-1 font-mono",children:"parachute-vault import <path>"})," ","handles broader formats — or paste the contents into Claude and ask it to add the notes via MCP."]})]})]})})})}function ir({parsed:y,onConfirm:S,onBack:o}){const{notes:b,errors:h,tags:i,attachments:n}=y,r=b.length,c=n.filter(d=>["image","pdf","audio","video"].includes(d.kind)).length,m=n.filter(d=>d.kind==="text").length,v=n.filter(d=>d.kind==="unsupported").length,_=r>0||c>0||m>0,w=gt.useMemo(()=>b.slice(0,8),[b]),s=gt.useMemo(()=>i.slice(0,12),[i]);return D.jsxs("section",{className:"space-y-6",children:[D.jsxs("div",{className:"card rounded-xl p-5 shadow-soft",children:[D.jsx("h2",{className:"font-serif text-lg text-fg",children:"Dry run"}),D.jsxs("p",{className:"mt-1 text-sm text-fg-muted",children:["Detected format: ",D.jsx(lr,{format:y.format}),"."," ",D.jsx("strong",{className:"text-fg",children:r})," ",r===1?"note":"notes"," will be created."," ",c>0?D.jsxs("span",{className:"text-fg-muted",children:[D.jsx("strong",{className:"text-fg",children:c})," attachment",c===1?"":"s"," (images / PDFs / audio) will come across."," "]}):null,m>0?D.jsxs("span",{className:"text-fg-muted",children:[m," data file",m===1?"":"s"," (json / csv / yaml / txt) will be saved as notes."," "]}):null,v>0?D.jsxs("span",{className:"text-fg-dim",children:[v," file",v===1?"":"s"," can't be imported (not a vault file type)."," "]}):null,h.length>0?D.jsxs("span",{className:"text-fg-dim",children:[h.length," file(s) couldn't be parsed."]}):null]}),i.length>0?D.jsxs("p",{className:"mt-2 text-sm text-fg-muted",children:[D.jsx("span",{className:"eyebrow",children:"Tags found"})," ",s.map(d=>D.jsxs("span",{className:"chip chip-tag ml-1",children:["#",d]},d)),i.length>s.length?D.jsxs("span",{className:"ml-2 text-fg-dim",children:["+",i.length-s.length," more"]}):null]}):null]}),w.length>0?D.jsxs("div",{className:"card rounded-xl p-5 shadow-soft",children:[D.jsxs("h3",{className:"eyebrow mb-2",children:["Preview (",w.length," of ",r,")"]}),D.jsx("ul",{className:"space-y-1.5 font-mono text-xs",children:w.map(d=>D.jsxs("li",{className:"flex items-center justify-between gap-3",children:[D.jsx("span",{className:"truncate text-fg",children:d.path||d.sourcePath}),D.jsx("span",{className:"shrink-0 text-fg-dim",children:d.tags.length>0?`${d.tags.length} tag${d.tags.length===1?"":"s"}`:""})]},d.sourcePath))})]}):null,h.length>0?D.jsxs("details",{className:"card rounded-xl p-5 shadow-soft",children:[D.jsxs("summary",{className:"cursor-pointer text-sm text-fg-muted hover:text-accent",children:[h.length," file(s) skipped during parse"]}),D.jsx("ul",{className:"mt-3 space-y-1 text-xs",children:h.map(d=>D.jsxs("li",{className:"flex flex-col gap-0.5",children:[D.jsx("span",{className:"font-mono text-fg",children:d.sourcePath}),D.jsx("span",{className:"text-fg-dim",children:d.reason})]},d.sourcePath))})]}):null,D.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-3",children:[D.jsx("button",{type:"button",onClick:o,className:"btn btn-secondary btn-touch",children:"Choose different files"}),D.jsxs("button",{type:"button",onClick:S,disabled:!_,className:"btn btn-primary btn-touch",children:["Run import (",r," ",r===1?"note":"notes",c>0?` + ${c} attachment${c===1?"":"s"}`:"",")"]})]})]})}function ar({progress:y,onCancel:S}){const o=y.total===0?0:Math.round(y.done/y.total*100);return D.jsxs("section",{className:"card space-y-4 rounded-xl p-6 shadow-soft",children:[D.jsx("h2",{className:"font-serif text-lg text-fg",children:"Importing…"}),D.jsxs("p",{className:"text-sm text-fg-muted",children:[y.done," / ",y.total," notes processed."]}),D.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-bg-soft",role:"progressbar",tabIndex:0,"aria-label":"Import progress","aria-valuenow":y.done,"aria-valuemin":0,"aria-valuemax":y.total,children:D.jsx("div",{className:"h-full bg-accent transition-all",style:{width:`${o}%`}})}),D.jsx("div",{className:"flex justify-end",children:D.jsx("button",{type:"button",onClick:S,className:"btn btn-secondary btn-touch",children:"Cancel"})})]})}function or({report:y,parsed:S,onAnother:o,onHome:b}){const h=y.outcomes.filter(m=>m.status==="errored"),i=y.outcomes.filter(m=>m.status==="skipped"),n=y.attachmentOutcomes.filter(m=>m.status==="skipped"),r=y.attachmentOutcomes.filter(m=>m.status==="errored"),c=y.attachmentOutcomes.length>0;return D.jsxs("section",{className:"space-y-6",children:[D.jsxs("div",{className:"card rounded-xl p-5 shadow-soft",children:[D.jsx("h2",{className:"font-serif text-lg text-fg",children:"Import complete"}),D.jsxs("ul",{className:"mt-3 space-y-1 text-sm",children:[D.jsxs("li",{children:[D.jsx("span",{className:"text-accent",children:y.created})," notes created"]}),D.jsxs("li",{children:[D.jsx("span",{className:"text-fg-muted",children:y.skipped})," notes skipped (already in vault)"]}),D.jsxs("li",{children:[D.jsx("span",{className:y.errored>0?"text-danger":"text-fg-muted",children:y.errored})," ","notes errored"]}),c?D.jsxs(D.Fragment,{children:[D.jsxs("li",{className:"pt-1",children:[D.jsx("span",{className:"text-accent",children:y.attachmentsUploaded})," attachments imported"]}),y.filesImportedAsNotes>0?D.jsxs("li",{children:[D.jsx("span",{className:"text-accent",children:y.filesImportedAsNotes})," data files imported as notes"]}):null,y.attachmentsSkipped>0?D.jsxs("li",{children:[D.jsx("span",{className:"text-fg-muted",children:y.attachmentsSkipped})," attachments skipped (not a vault file type)"]}):null,y.attachmentsErrored>0?D.jsxs("li",{children:[D.jsx("span",{className:"text-danger",children:y.attachmentsErrored})," attachments errored"]}):null]}):null]}),S.errors.length>0?D.jsxs("p",{className:"mt-2 text-xs text-fg-dim",children:["(Plus ",S.errors.length," file(s) skipped at the parse stage — see above.)"]}):null]}),n.length>0||r.length>0?D.jsxs("details",{className:"card rounded-xl p-5 shadow-soft",children:[D.jsxs("summary",{className:"cursor-pointer text-sm text-fg-muted hover:text-accent",children:[n.length+r.length," attachment(s) not imported as files — why"]}),D.jsx("ul",{className:"mt-3 space-y-1 text-xs",children:[...r,...n].map(m=>D.jsxs("li",{className:"flex flex-col gap-0.5",children:[D.jsx("span",{className:"font-mono text-fg",children:m.sourcePath}),D.jsx("span",{className:"text-fg-dim",children:m.status==="skipped"||m.status==="errored"?m.reason:""})]},`a-${m.sourcePath}`))})]}):null,i.length>0?D.jsxs("details",{className:"card rounded-xl p-5 shadow-soft",children:[D.jsxs("summary",{className:"cursor-pointer text-sm text-fg-muted hover:text-accent",children:[i.length," skipped — vault already had a matching note"]}),D.jsx("ul",{className:"mt-3 space-y-1 text-xs",children:i.map(m=>D.jsxs("li",{className:"flex flex-col gap-0.5",children:[D.jsx("span",{className:"font-mono text-fg",children:m.sourcePath}),D.jsx("span",{className:"text-fg-dim",children:m.status==="skipped"?m.reason:""})]},`s-${m.sourcePath}`))})]}):null,h.length>0?D.jsxs("details",{className:"rounded-xl border border-danger-border bg-danger-soft p-5",open:!0,children:[D.jsxs("summary",{className:"cursor-pointer text-sm font-medium text-danger",children:[h.length," errored"]}),D.jsx("ul",{className:"mt-3 space-y-1 text-xs",children:h.map(m=>D.jsxs("li",{className:"flex flex-col gap-0.5",children:[D.jsx("span",{className:"font-mono text-fg",children:m.sourcePath}),D.jsx("span",{className:"text-fg-dim",children:m.status==="errored"?m.reason:""})]},`e-${m.sourcePath}`))})]}):null,D.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-3",children:[D.jsx("button",{type:"button",onClick:o,className:"btn btn-secondary btn-touch",children:"Run another import"}),D.jsx("button",{type:"button",onClick:b,className:"btn btn-primary btn-touch",children:"Back to vault"})]})]})}function lr({format:y}){const S=y==="obsidian-zip"?"Obsidian vault (zip)":y==="loose-markdown"?"loose markdown":"unknown";return D.jsx("span",{className:"rounded bg-bg-soft px-1.5 py-0.5 font-mono text-xs text-fg",children:S})}export{hr as Import};
|