@openparachute/notes-ui 0.1.3 → 0.1.5-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.parachute/info +1 -1
- package/dist/CNAME +1 -0
- package/dist/assets/{Activity-BiO1mKun.js → Activity-D95uEfl-.js} +1 -1
- package/dist/assets/{AddVault-BejrnPnA.js → AddVault-DyLm40Wr.js} +1 -1
- package/dist/assets/AttachmentDropZone-BpW24D0t.js +1 -0
- package/dist/assets/{Calendar-BiXXgzE_.js → Calendar-BxC8PSFW.js} +1 -1
- package/dist/assets/{Capture-ZvHD0u6T.js → Capture-DCy4NMNH.js} +2 -2
- package/dist/assets/Import-B7PEdPjZ.js +12 -0
- package/dist/assets/NoteEditor-DoAZre6A.js +1 -0
- package/dist/assets/NoteNew-modij3mZ.js +1 -0
- package/dist/assets/{NoteRenderer-DOCu05JW.js → NoteRenderer-DZG-A0PR.js} +1 -1
- package/dist/assets/NoteView-DC4F7Yg0.js +3 -0
- package/dist/assets/OAuthCallback-DCVwov9d.js +1 -0
- package/dist/assets/PinArchiveButtons-B-J_q8fy.js +1 -0
- package/dist/assets/Settings-CV-HhWB9.js +1 -0
- package/dist/assets/Tags-C8cO3-Em.js +1 -0
- package/dist/assets/{Today-s14qlIMl.js → Today-DZXV6hrm.js} +1 -1
- package/dist/assets/{VaultGraph-CbcMA4S9.js → VaultGraph-DRR18im5.js} +2 -2
- package/dist/assets/{Vaults-B8nAmi_t.js → Vaults-CE_H2o0k.js} +1 -1
- package/dist/assets/{index-BUHugAd8.js → index-CeSJJ5Fs.js} +15 -15
- package/dist/assets/index-RxgFsdXJ.css +1 -0
- package/dist/assets/{react-force-graph-2d-DQm7mpQp.js → react-force-graph-2d-ByCzo_0U.js} +10 -10
- package/dist/assets/{useAttachmentUploader-vAtmWb3K.js → useAttachmentUploader-B1jCiVcW.js} +16 -16
- package/dist/index.html +2 -2
- package/dist/sw.js +1 -1
- package/meta.json +1 -1
- package/package.json +12 -5
- package/dist/assets/NoteEditor-DSEAQ_XL.js +0 -1
- package/dist/assets/NoteNew-DXPvIkGy.js +0 -1
- package/dist/assets/NoteView-BSnSuLxa.js +0 -3
- package/dist/assets/OAuthCallback-Dk46U1xZ.js +0 -1
- package/dist/assets/PinArchiveButtons-R5EYUe6B.js +0 -1
- package/dist/assets/Settings-BgN0grKh.js +0 -1
- package/dist/assets/Tags-DFQLC8AP.js +0 -1
- package/dist/assets/index-D_L2igjK.css +0 -1
package/dist/.parachute/info
CHANGED
package/dist/CNAME
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
notes.parachute.computer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ac as h,Y as g,z as l,t as e,N as f,L as m,B as b,V as y}from"./index-CeSJJ5Fs.js";const p=1440*60*1e3,j=5e3;function N(n,r=30,s=new Date){const d=s.getTime()-r*p,a=[];for(const t of n){const c=t.path??t.id,o=Date.parse(t.createdAt);if(Number.isFinite(o)&&o>=d&&a.push({id:`${t.id}:created`,noteId:t.id,noteName:c,kind:"created",at:t.createdAt,preview:t.preview,tags:t.tags}),t.updatedAt){const i=Date.parse(t.updatedAt);Number.isFinite(i)&&i>=d&&Number.isFinite(o)&&i-o>j&&a.push({id:`${t.id}:updated`,noteId:t.id,noteName:c,kind:"updated",at:t.updatedAt,preview:t.preview,tags:t.tags})}}return a.sort((t,c)=>Date.parse(c.at)-Date.parse(t.at)),a}const v=["today","yesterday","thisWeek","older"],k={today:"Today",yesterday:"Yesterday",thisWeek:"This week",older:"Older"};function w(n,r=new Date){const s=Date.parse(n);if(!Number.isFinite(s))return null;const d=u(r),a=u(new Date(s)),t=Math.round((d.getTime()-a.getTime())/p);return t<0||t===0?"today":t===1?"yesterday":t<7?"thisWeek":"older"}function u(n){return new Date(n.getFullYear(),n.getMonth(),n.getDate())}function D(n,r=new Date){const s={today:[],yesterday:[],thisWeek:[],older:[]};for(const d of n){const a=w(d.at,r);a&&s[a].push(d)}return s}const x=50;function F(){const n=h(i=>i.getActiveVault()),r=g(),[s,d]=l.useState(x),a=l.useMemo(()=>r.data?N(r.data):[],[r.data]),t=l.useMemo(()=>a.slice(0,s),[a,s]),c=l.useMemo(()=>D(t),[t]),o=a.length-t.length;return n?e.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-6 md:px-6 md:py-10",children:[e.jsxs("header",{className:"mb-5 md:mb-6",children:[e.jsx("p",{className:"text-xs uppercase tracking-wider text-fg-dim",children:"Activity"}),e.jsx("h1",{className:"font-serif text-2xl tracking-tight md:text-3xl",children:"Recent changes"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"Last 30 days, newest first. Deletions aren't tracked yet."})]}),r.isPending?e.jsx(T,{}):r.isError?e.jsx(B,{error:r.error}):a.length===0?e.jsx(S,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-8",children:v.map(i=>c[i].length>0?e.jsx(E,{title:k[i],events:c[i]},i):null)}),o>0?e.jsx("div",{className:"mt-8 flex justify-center",children:e.jsxs("button",{type:"button",onClick:()=>d(i=>i+x),className:"rounded-md border border-border bg-card px-4 py-2 text-sm text-fg-muted hover:text-accent",children:["Load more (",o," remaining)"]})}):null]})]}):e.jsx(f,{to:"/",replace:!0})}function E({title:n,events:r}){return e.jsxs("section",{children:[e.jsxs("h2",{className:"mb-2 text-xs uppercase tracking-wider text-fg-dim",children:[n," (",r.length,")"]}),e.jsx("ol",{className:"divide-y divide-border rounded-md border border-border bg-card",children:r.map(s=>e.jsx("li",{children:e.jsxs(m,{to:`/n/${encodeURIComponent(s.noteId)}`,className:"block px-4 py-3 hover:bg-bg/60 focus:bg-bg/60 focus:outline-none",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(A,{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",children:s.tags.map(d=>e.jsxs("span",{className:"rounded-md bg-border/40 px-1.5 py-0.5 text-xs text-fg-dim",children:["#",d]},d))}):null]})},s.id))})]})}function A({kind:n}){return n==="created"?e.jsx("span",{className:"shrink-0 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs text-accent",children:"Created"}):e.jsx("span",{className:"shrink-0 rounded-md bg-border/40 px-1.5 py-0.5 text-xs text-fg-muted",children:"Edited"})}function S(){return e.jsxs("div",{className:"rounded-md border border-border bg-card p-10 text-center",children:[e.jsx("p",{className:"mb-4 text-fg-muted",children:"No activity in the last 30 days."}),e.jsx(m,{to:"/capture",className:"inline-block rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent-hover",children:"Open capture"})]})}function T(){return e.jsx("div",{className:"space-y-3","aria-busy":"true",children:[0,1,2,3,4].map(n=>e.jsx("div",{className:"h-16 animate-pulse rounded-md bg-border/30"},n))})}function B({error:n}){const r=n instanceof y;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:r?"Session expired":"Could not load activity"}),e.jsx("p",{className:"mb-4 text-sm text-fg-muted",children:n.message}),r?e.jsx(m,{to:"/add",className:"inline-block rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent-hover",children:"Reconnect vault"}):null]})}export{F as Activity};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a5 as v,z as t,Z as j,t as e,I as y,x as w,k as N,a as S}from"./index-CeSJJ5Fs.js";function R(){const[b]=v(),u=b.get("url")??"",[a,c]=t.useState(u),[i,l]=t.useState(null),[g,d]=t.useState(!1),[o,m]=t.useState(!1),x=t.useRef(null),h=t.useRef(u.length>0),n=j();t.useEffect(()=>{var s;(s=x.current)==null||s.focus()},[]),t.useEffect(()=>{h.current||n.status==="found"&&n.origin&&a===""&&(c(n.origin),h.current=!0)},[n.status,n.origin,a]);async function p(s){s.preventDefault(),l(null),d(!1);let f;try{f=w(a)}catch(r){l(r.message);return}m(!0);try{const{authorizeUrl:r}=await N(f);window.location.assign(r)}catch(r){r instanceof S?d(!0):l(r.message),m(!1)}}return e.jsxs("div",{className:"mx-auto max-w-xl px-6 py-16",children:[e.jsx("h1",{className:"mb-2 font-serif text-4xl tracking-tight",children:"Connect a vault"}),e.jsx("p",{className:"mb-8 text-fg-muted",children:"Paste your Parachute hub URL. You'll be taken to its consent page to authorize Parachute Notes."}),e.jsxs("form",{onSubmit:p,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"vault-url",className:"mb-1.5 block text-sm font-medium text-fg",children:"Hub URL"}),e.jsx("input",{id:"vault-url",ref:x,type:"url",required:!0,placeholder:"http://localhost:1939",value:a,onChange:s=>c(s.target.value),disabled:o,className:"w-full rounded-md border border-border bg-card px-3 py-2 font-mono text-sm text-fg focus:border-accent focus:outline-none"}),e.jsxs("p",{className:"mt-1.5 text-xs text-fg-dim",children:["For a local install the hub lives at ",e.jsx("code",{children:"http://localhost:1939"}),". A standalone vault URL (e.g. ",e.jsx("code",{children:"https://host/vault/default"}),") also works — Notes will OAuth against whichever issuer answers."]})]}),g?e.jsx(y,{}):null,i?e.jsx("div",{className:"rounded-md border border-red-400/30 bg-red-400/5 px-3 py-2 text-sm text-red-400",children:i}):null,e.jsx("button",{type:"submit",disabled:o||!a,className:"w-full rounded-md bg-accent px-4 py-2.5 text-sm font-medium text-white hover:bg-accent-hover disabled:cursor-not-allowed disabled:opacity-60",children:o?"Starting OAuth…":"Continue"})]})]})}export{R as AddVault};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as r,t as c}from"./index-CeSJJ5Fs.js";function v({onDropFiles:t,children:s,className:a,hint:o}){const[i,f]=r.useState(!1),n=r.useRef(0),d=r.useCallback(e=>{l(e.dataTransfer)&&(e.preventDefault(),n.current+=1,f(!0))},[]),p=r.useCallback(e=>{l(e.dataTransfer)&&(e.preventDefault(),n.current=Math.max(0,n.current-1),n.current===0&&f(!1))},[]),m=r.useCallback(e=>{l(e.dataTransfer)&&(e.preventDefault(),e.dataTransfer.dropEffect="copy")},[]),x=r.useCallback(e=>{if(!l(e.dataTransfer))return;e.preventDefault(),f(!1),n.current=0;const u=Array.from(e.dataTransfer.files);u.length>0&&t(u)},[t]);return c.jsxs("div",{className:`relative ${a??""}`,onDragEnter:d,onDragLeave:p,onDragOver:m,onDrop:x,children:[s,i?c.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center rounded-md border-2 border-dashed border-accent bg-accent/10 text-sm text-accent",children:c.jsxs("div",{className:"rounded-md bg-bg/80 px-4 py-2 font-medium shadow",children:["Drop to attach",o?c.jsxs("span",{className:"ml-2 text-fg-dim",children:["— ",o]}):null]})}):null]})}function l(t){if(!t)return!1;const s=t.types;for(let a=0;a<s.length;a++)if(s[a]==="Files")return!0;return!1}export{v as A};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ac as k,a5 as E,Y as A,z as y,t as e,N as K,L as d,V as S}from"./index-CeSJJ5Fs.js";import{d as f,c as j,e as P,m as T,t as V,s as N,p as i,a as C}from"./dates-BGZoWpL2.js";const Y=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],x=5;function B(){const a=k(t=>t.getActiveVault()),[o]=E(),l=o.get("month"),r=f(l)??f(j()),s=A(),h=P(),v=y.useMemo(()=>T(r.year,r.month),[r.year,r.month]),$=y.useMemo(()=>{const t=new Map;if(!s.data)return t;for(const n of s.data){const c=V(n.createdAt);c&&t.set(c,(t.get(c)??0)+1)}return t},[s.data]);if(!a)return e.jsx(K,{to:"/",replace:!0});const u=N(r.year,r.month,-1),p=N(r.year,r.month,1),b=`${u.year}-${i(u.month)}`,g=`${p.year}-${i(p.month)}`,M=j(),w=`${r.year}-${i(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:C(r.year,r.month)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[e.jsxs(d,{to:`/calendar?month=${b}`,className:"rounded-md border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent","aria-label":"Previous month",children:["← ",b]}),w?null:e.jsx(d,{to:"/calendar",className:"rounded-md border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent",children:"This month"}),e.jsxs(d,{to:`/calendar?month=${g}`,className:"rounded-md border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent","aria-label":"Next month",children:[g," →"]}),e.jsx(d,{to:`/today?date=${h}`,className:"rounded-md 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:Y.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()}-${i(t.getMonth()+1)}-${i(t.getDate())}`,c=t.getMonth()+1===r.month,m=$.get(n)??0,D=n===h;return e.jsxs(d,{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 ${c?"":"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 ${D?"bg-accent text-white":"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),l=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)),l>0?e.jsxs("span",{className:"ml-0.5 text-[10px] text-fg-dim",children:["+",l]}):null]})}function F({error:a}){const o=a instanceof S;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(d,{to:"/add",className:"inline-block rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent-hover",children:"Reconnect vault"}):null]})}export{B as Calendar};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ac as xe,a9 as be,a6 as ye,a7 as ve,G as we,z as i,v as G,p as ke,u as Te,o as S,l as Re,t as a,N as Se,B as je,e as Ne,w as oe,L as Ee}from"./index-CeSJJ5Fs.js";const Ie=["audio/webm;codecs=opus","audio/mp4","audio/ogg;codecs=opus"];function Ce(r=Ie){if(typeof MediaRecorder>"u")return null;for(const t of r)if(MediaRecorder.isTypeSupported(t))return t;return null}function Me(r){return r.startsWith("audio/webm")?"webm":r.startsWith("audio/mp4")?"m4a":r.startsWith("audio/ogg")?"ogg":r.startsWith("audio/wav")?"wav":"bin"}function Ae(r){const t=r.now??(()=>Date.now()),d=r.MediaRecorderCtor??MediaRecorder,n=new d(r.stream,{mimeType:r.mimeType}),l=[];let s="idle",m=0,A=0;n.ondataavailable=k=>{k.data&&k.data.size>0&&l.push(k.data)};const p=()=>{for(const k of r.stream.getTracks())k.stop()};return{get state(){return s},get mimeType(){return r.mimeType},start(){if(s!=="idle")throw new Error(`Cannot start from ${s}`);n.start(),m=t(),s="recording"},pause(){s==="recording"&&(n.pause(),A+=t()-m,s="paused")},resume(){s==="paused"&&(n.resume(),m=t(),s="recording")},async stop(){if(s==="idle"||s==="stopped")throw new Error(`Cannot stop from ${s}`);s==="recording"&&(A+=t()-m);const k=new Promise(x=>{n.onstop=async()=>{const L=await $e(l);x({data:L,mimeType:r.mimeType,durationMs:A})}});return n.stop(),s="stopped",p(),k},cancel(){if(s==="recording"||s==="paused")try{n.stop()}catch{}s="stopped",l.length=0,p()}}}async function De(r){const t=r;return typeof t.arrayBuffer=="function"?t.arrayBuffer():new Promise((d,n)=>{const l=new FileReader;l.onload=()=>d(l.result),l.onerror=()=>n(l.error??new Error("FileReader error")),l.readAsArrayBuffer(r)})}async function $e(r){if(r.length===0)return new ArrayBuffer(0);const t=await Promise.all(r.map(s=>De(s))),d=t.reduce((s,m)=>s+m.byteLength,0),n=new Uint8Array(d);let l=0;for(const s of t)n.set(new Uint8Array(s),l),l+=s.byteLength;return n.buffer}async function Oe(){var r;if(typeof navigator>"u"||!((r=navigator.mediaDevices)!=null&&r.getUserMedia)){const t=new Error("Microphone is not available in this browser.");throw t.kind="unavailable",t}try{return await navigator.mediaDevices.getUserMedia({audio:!0})}catch(t){const d=new Error(t instanceof Error?t.message:"Microphone permission denied."),n=t instanceof DOMException?t.name:"";throw d.kind=n==="NotFoundError"||n==="OverconstrainedError"?"no-device":"permission-denied",d}}function Le(r,t=new Date){return`memo-${t.toISOString().replace(/[:.]/g,"-").replace(/Z$/,"")}.${Me(r)}`}function se(r=new Date){const t=r.getFullYear(),d=String(r.getMonth()+1).padStart(2,"0"),n=String(r.getDate()).padStart(2,"0"),l=String(r.getHours()).padStart(2,"0"),s=String(r.getMinutes()).padStart(2,"0"),m=String(r.getSeconds()).padStart(2,"0");return`Notes/${t}/${d}-${n}/${l}-${s}-${m}`}const Ue=/(?:^|\s)#([a-zA-Z][\w-]*)/g;function Y(r){const t=new Set;for(const d of r.matchAll(Ue)){const n=oe(d[1]??"");n&&t.add(n)}return[...t]}function Z(r){const t=Math.floor(r/1e3),d=Math.floor(t/60),n=t%60;return`${String(d).padStart(2,"0")}:${String(n).padStart(2,"0")}`}function Fe({moreFieldsOpenDefault:r=!1}={}){const t=xe(e=>e.getActiveVault()),d=be(e=>e.push),{db:n,blobStore:l,engine:s}=ye(),{roles:m}=ve((t==null?void 0:t.id)??null),A=we(),[p,k]=i.useState(""),[x,L]=i.useState([]),[ie,F]=i.useState(""),[ce,de]=i.useState(r),D=i.useRef(se()),J=i.useRef(!1),[j,Q]=i.useState(()=>D.current),le=i.useCallback(e=>{J.current=e.trim()!==""&&e!==D.current,Q(e)},[]),[N,ue]=i.useState(""),[c,b]=i.useState({kind:"idle"}),[me,B]=i.useState(0),$=i.useRef(null),[q,X]=i.useState(null),[pe,fe]=i.useState(0),V=i.useRef(null),E=i.useRef(null),W=i.useRef(null),U=i.useRef(!1);i.useEffect(()=>{if(c.kind!=="recording")return;const e=setInterval(()=>B(Date.now()-c.startedAt),250);return()=>clearInterval(e)},[c]),i.useEffect(()=>()=>{E.current&&URL.revokeObjectURL(E.current)},[]),i.useEffect(()=>{var e;(e=W.current)==null||e.focus()},[]);const ge=i.useCallback(async()=>{if(!(c.kind==="recording"||c.kind==="requesting")){b({kind:"requesting"});try{const e=Ce();if(!e){b({kind:"denied",message:"This browser can't record audio in a format we can save."});return}const o=await Oe(),u=Ae({stream:o,mimeType:e});V.current=u,u.start(),B(0),b({kind:"recording",startedAt:Date.now()})}catch(e){const o=e,u=o.kind==="permission-denied"?"Microphone access was denied. Update your browser's site settings to record.":o.kind==="no-device"?"No microphone was found on this device.":o instanceof Error?o.message:"Microphone is not available in this browser.";b({kind:"denied",message:u})}}},[c]),ee=i.useCallback(async()=>{const e=V.current;if(!(!e||c.kind!=="recording"))try{const o=await e.stop();V.current=null;const u=new Blob([o.data],{type:o.mimeType}),y=URL.createObjectURL(u);E.current&&URL.revokeObjectURL(E.current),E.current=y,b({kind:"have-audio",data:o.data,mimeType:o.mimeType,url:y,durationMs:o.durationMs})}catch(o){d(o instanceof Error?`Recording failed: ${o.message}`:"Recording failed.","error"),b({kind:"idle"})}},[c,d]);i.useEffect(()=>{if(c.kind!=="recording")return;const e=()=>{ee()};return window.addEventListener("pointerup",e),window.addEventListener("pointercancel",e),()=>{window.removeEventListener("pointerup",e),window.removeEventListener("pointercancel",e)}},[c,ee]);const _=i.useCallback(()=>{E.current&&(URL.revokeObjectURL(E.current),E.current=null),b({kind:"idle"}),B(0)},[]),te=i.useCallback(()=>{var e;if($.current=null,X(null),k(""),L([]),F(""),!J.current){const o=se();D.current=o,Q(o)}_(),(e=W.current)==null||e.focus()},[_]),P=c.kind==="have-audio",T=p.trim().length>0,H=(T||P)&&c.kind!=="saving",z=i.useCallback(async()=>{if(!H||!n||!t)return;if(P&&!l){d("Sync queue not ready — try again in a moment.","error");return}const e=c.kind==="have-audio"?c:null;U.current=!0,b({kind:"saving"});const o=x.filter(g=>g.length>0),u=Y(p),y=[];T&&y.push(m.captureText),e&&y.push(m.captureVoice);const v=Array.from(new Set([...y,...o,...u].filter(g=>g.length>0))),f=$.current,w=(f==null?void 0:f.localId)??G(),I=j.trim()||D.current,C=N.trim(),h=C?{summary:C}:void 0;A&&ke(t.id,A);try{if(e){const g=new Date,O=Le(e.mimeType,g),M=Te(),R=T?`${p.trim()}
|
|
2
2
|
|
|
3
3
|
_Transcript pending._
|
|
4
4
|
|
|
@@ -6,4 +6,4 @@ _Transcript pending._
|
|
|
6
6
|
`:`_Transcript pending._
|
|
7
7
|
|
|
8
8
|
![[${O}]]
|
|
9
|
-
`,ae=I;if(!l)throw new Error("blob store missing");await l.put(M,e.data,e.mimeType,t.id),await S(n,{kind:"create-note",localId:w,payload:{content:R,path:ae,...v.length?{tags:v}:{},...h?{metadata:h}:{}}},{vaultId:t.id}),await S(n,{kind:"upload-attachment",blobId:M,filename:O,mimeType:e.mimeType},{vaultId:t.id}),await S(n,{kind:"link-attachment",noteId:w,pathRef:Re(M),mimeType:e.mimeType,transcribe:!0},{vaultId:t.id})}else f!=null&&f.createCommitted?await S(n,{kind:"update-note",targetId:w,payload:{content:p,path:I,...v.length?{tags:{add:v}}:{},...h?{metadata:h}:{}}},{vaultId:t.id}):await S(n,{kind:"create-note",localId:w,payload:{content:p,path:I,...v.length?{tags:v}:{},...h?{metadata:h}:{}}},{vaultId:t.id});s==null||s.runOnce(),d(e?"Captured — syncing audio.":"Captured.","success"),te(),b({kind:"idle"}),
|
|
9
|
+
`,ae=I;if(!l)throw new Error("blob store missing");await l.put(M,e.data,e.mimeType,t.id),await S(n,{kind:"create-note",localId:w,payload:{content:R,path:ae,...v.length?{tags:v}:{},...h?{metadata:h}:{}}},{vaultId:t.id}),await S(n,{kind:"upload-attachment",blobId:M,filename:O,mimeType:e.mimeType},{vaultId:t.id}),await S(n,{kind:"link-attachment",noteId:w,pathRef:Re(M),mimeType:e.mimeType,transcribe:!0},{vaultId:t.id})}else f!=null&&f.createCommitted?await S(n,{kind:"update-note",targetId:w,payload:{content:p,path:I,...v.length?{tags:{add:v}}:{},...h?{metadata:h}:{}}},{vaultId:t.id}):await S(n,{kind:"create-note",localId:w,payload:{content:p,path:I,...v.length?{tags:v}:{},...h?{metadata:h}:{}}},{vaultId:t.id});s==null||s.runOnce(),d(e?"Captured — syncing audio.":"Captured.","success"),te(),b({kind:"idle"}),U.current=!1}catch(g){d(g instanceof Error?`Capture failed: ${g.message}`:"Capture failed.","error"),U.current=!1,b(e?{kind:"have-audio",data:e.data,mimeType:e.mimeType,url:e.url,durationMs:e.durationMs}:{kind:"idle"})}},[H,n,t,l,A,c,P,T,x,p,j,N,m.captureText,m.captureVoice,s,d,te]),re=i.useCallback(async()=>{if(!n||!t||c.kind!=="idle"||!T)return;const e=x.filter(h=>h.length>0),o=Y(p),u=Array.from(new Set([m.captureText,...e,...o].filter(h=>h.length>0))),y=j.trim()||D.current,v=N.trim(),f=v?{summary:v}:void 0,w=$.current,I=!w,C=(w==null?void 0:w.localId)??G();I&&($.current={localId:C,createCommitted:!0});try{I?await S(n,{kind:"create-note",localId:C,payload:{content:p,path:y,...u.length?{tags:u}:{},...f?{metadata:f}:{}}},{vaultId:t.id}):await S(n,{kind:"update-note",targetId:C,payload:{content:p,path:y,...u.length?{tags:{add:u}}:{},...f?{metadata:f}:{}}},{vaultId:t.id}),s==null||s.runOnce(),X(Date.now())}catch{I&&($.current=null)}},[n,t,c.kind,T,p,x,j,N,m.captureText,s]),he=i.useCallback(e=>{(e.metaKey||e.ctrlKey)&&e.key==="Enter"&&(e.preventDefault(),z())},[z]),ne=i.useRef({db:n,activeVaultId:(t==null?void 0:t.id)??null,content:p,tags:x,pathOverride:j,summary:N,roles:m});return ne.current={db:n,activeVaultId:(t==null?void 0:t.id)??null,content:p,tags:x,pathOverride:j,summary:N,roles:m},i.useEffect(()=>()=>{if(U.current)return;const{db:e,activeVaultId:o,content:u,tags:y,pathOverride:v,summary:f,roles:w}=ne.current;if(!u.trim()||!e||!o)return;const C=y.filter(K=>K.length>0),h=Y(u),g=Array.from(new Set([w.captureText,...C,...h].filter(K=>K.length>0))),O=v.trim()||D.current,M=f.trim(),R=$.current;(R!=null&&R.createCommitted?S(e,{kind:"update-note",targetId:R.localId,payload:{content:u,path:O,...g.length?{tags:{add:g}}:{},...M?{metadata:{summary:M}}:{}}},{vaultId:o}):S(e,{kind:"create-note",localId:(R==null?void 0:R.localId)??G(),payload:{content:u,path:O,...g.length?{tags:g}:{},...M?{metadata:{summary:M}}:{}}},{vaultId:o})).catch(()=>{})},[]),i.useEffect(()=>{if(q===null)return;const e=setInterval(()=>{fe(o=>o+1)},15e3);return()=>clearInterval(e)},[q]),i.useEffect(()=>{if(c.kind==="recording"||c.kind==="requesting"||c.kind==="saving"||c.kind==="have-audio"||!T)return;const e=setTimeout(()=>{U.current||re()},5e3);return()=>clearTimeout(e)},[c.kind,T,p,x,j,N,re]),t?a.jsxs("div",{className:"mx-auto max-w-2xl px-4 py-5 md:px-6 md:py-8",children:[a.jsxs("header",{className:"mb-5",children:[a.jsx("h1",{className:"font-serif text-2xl text-fg md:text-3xl",children:"Capture"}),a.jsxs("p",{className:"mt-1 text-xs text-fg-dim",children:["Type a thought, hold the mic to record, or both."," ",a.jsx("kbd",{className:"rounded bg-bg/60 px-1",children:"⌘"}),a.jsx("kbd",{className:"rounded bg-bg/60 px-1",children:"↵"})," to send."]})]}),a.jsxs("section",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-5 md:p-6",children:[a.jsx("textarea",{ref:W,value:p,onChange:e=>k(e.target.value),onKeyDown:he,placeholder:"What are you thinking?","aria-label":"Capture content",rows:8,disabled:c.kind==="saving",className:"min-h-[30vh] w-full resize-y rounded-md border border-border bg-bg px-3 py-2 text-sm text-fg placeholder:text-fg-dim focus:border-accent focus:outline-none disabled:opacity-60"}),q!==null?a.jsxs("p",{className:"-mt-2 text-right text-[11px] text-fg-dim","aria-live":"polite","data-indicator-tick":pe,children:["Draft saved · ",je(new Date(q).toISOString())]}):null,c.kind==="have-audio"?a.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-accent/30 bg-accent/5 p-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("span",{className:"text-sm text-fg-muted",children:["🎙 Recorded ",Z(c.durationMs)]}),a.jsx("button",{type:"button",onClick:_,className:"text-xs text-fg-dim hover:text-red-400",children:"Discard"})]}),a.jsx("audio",{controls:!0,src:c.url,className:"w-full",children:a.jsx("track",{kind:"captions"})}),a.jsx("p",{className:"text-xs text-fg-dim",children:"Transcript will be appended once your vault processes it."})]}):null,c.kind==="denied"?a.jsx("p",{className:"rounded-md border border-red-500/30 bg-red-500/5 px-3 py-2 text-xs text-red-400",children:c.message}):null,a.jsx(Ne,{tags:x,input:ie,onInputChange:F,onAdd:e=>{const o=oe(e);!o||x.includes(o)||(L(u=>[...u,o]),F(""))},onRemove:e=>L(o=>o.filter(u=>u!==e))}),a.jsxs("details",{className:"group rounded-md border border-border bg-bg/50",open:ce,onToggle:e=>de(e.currentTarget.open),children:[a.jsx("summary",{className:"cursor-pointer select-none px-3 py-2 text-xs text-fg-muted hover:text-accent",children:"More fields"}),a.jsxs("div",{className:"space-y-3 px-3 pb-3 pt-1",children:[a.jsxs("label",{className:"flex flex-col gap-1 text-xs",children:[a.jsx("span",{className:"text-fg-dim",children:"Title"}),a.jsx("input",{type:"text",value:j,onChange:e=>le(e.target.value),placeholder:"(blank → auto-generated)","aria-label":"Title override",className:"rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-xs text-fg focus:border-accent focus:outline-none"})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-xs",children:[a.jsx("span",{className:"text-fg-dim",children:"Summary"}),a.jsx("input",{type:"text",value:N,onChange:e=>ue(e.target.value),placeholder:"(optional one-line description)","aria-label":"Summary",className:"rounded-md border border-border bg-card px-2.5 py-1.5 text-xs text-fg focus:border-accent focus:outline-none"})]}),a.jsxs("p",{className:"text-xs text-fg-dim",children:["Need to attach a file?"," ",a.jsx(Ee,{to:"/new",className:"text-accent hover:underline",children:"Open the full editor"}),"."]})]})]}),a.jsxs("div",{className:"flex items-center justify-between gap-3 pt-2",children:[a.jsx(Pe,{phase:c,elapsedMs:me,onPointerDown:()=>void ge()}),a.jsxs("div",{className:"flex flex-col items-end gap-1",children:[a.jsx("button",{type:"button",onClick:()=>void z(),disabled:!H,className:"min-h-11 rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent-hover disabled:opacity-40",children:c.kind==="saving"?"Saving…":"Capture"}),a.jsx("span",{className:"text-[11px] text-fg-dim",children:P&&T?"Will save as a note with audio attached.":P?"Will save as a voice memo.":T?"Will save as a text note.":"Type or record to capture."})]})]})]})]}):a.jsx(Se,{to:"/",replace:!0})}function Pe({phase:r,elapsedMs:t,onPointerDown:d}){const n=r.kind==="recording",l=r.kind==="requesting",s=n?`Recording — release to stop (${Z(t)})`:l?"Requesting microphone…":"Hold to record";return a.jsxs("button",{type:"button",onPointerDown:m=>{m.preventDefault(),d()},"aria-label":s,"aria-pressed":n,disabled:r.kind==="saving",className:`flex min-h-11 items-center gap-2 rounded-full border px-4 py-2 text-sm font-medium transition select-none ${n?"border-red-500/40 bg-red-500/10 text-red-400":"border-accent/30 bg-accent/10 text-accent hover:bg-accent/15"} disabled:opacity-40`,children:[a.jsx("span",{"aria-hidden":"true",className:n?"animate-pulse":"",children:"🎙"}),a.jsx("span",{children:n?`Rec ${Z(t)}`:l?"Requesting…":"Hold to record"})]})}export{Fe as Capture,Y as extractHashtags};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{m as kt,r as Ht,f as Gt,h as Vt,V as Kt,i as Tt,ac as Yt,G as Xt,W as $t,a9 as qt,z as gt,t as H,N as Jt,L as Qt}from"./index-CeSJJ5Fs.js";import{A as te}from"./AttachmentDropZone-BpW24D0t.js";function ee(E){return E.length===0?"unknown":E.some(Dt)?"obsidian-zip":E.some(At)?"loose-markdown":"unknown"}function Dt(E){return E.name.toLowerCase().endsWith(".zip")}function At(E){const D=E.name.toLowerCase();return D.endsWith(".md")||D.endsWith(".markdown")}const jt=/^---\r?\n/;function re(E){if(!jt.test(E))return{data:{},content:E};const D=E.replace(jt,""),o=D.search(/\r?\n---\r?\n|\r?\n---$/);if(o===-1)return{data:{},content:E};const k=D.slice(0,o),u=D.slice(o).replace(/^\r?\n---\r?\n?/,"");return{data:ne(k),content:u}}function ne(E){const D=E.split(/\r?\n/),o={};let k=0;for(;k<D.length;){const u=D[k]??"";if(u.trim()===""||u.trimStart().startsWith("#")){k++;continue}const i=u.match(/^([\w][\w.-]*)\s*:\s*(.*)$/);if(!i){k++;continue}const s=i[1],r=(i[2]??"").trim();if(r===""){const c=se(D,k+1);if(c!=null&&c.line.trimStart().startsWith("- ")){const{items:b,consumed:v}=ie(D,k+1,c.indent);o[s]=b,k=k+1+v}else o[s]="",k++}else o[s]=It(r),k++}return o}function ie(E,D,o){const k=[];let u=D;for(;u<E.length;){const i=E[u]??"";if(i.trim()===""){u++;continue}const s=Pt(i);if(s<o||!i.slice(s).startsWith("- "))break;const r=i.slice(s+2).trim();k.push(It(r)),u++}return{items:k,consumed:u-D}}function se(E,D){for(let o=D;o<E.length;o++){const k=E[o]??"";if(k.trim()!=="")return{line:k,indent:Pt(k)}}return null}function Pt(E){let D=0;for(;D<E.length&&E[D]===" ";)D++;return D}function It(E){if(E.length===0)return"";if(E.startsWith("[")&&E.endsWith("]")){const D=E.slice(1,-1).trim();return D===""?[]:ae(D).map(o=>It(o.trim()))}if(E.startsWith('"')&&E.endsWith('"')&&E.length>=2)return E.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\");if(E.startsWith("'")&&E.endsWith("'")&&E.length>=2)return E.slice(1,-1).replace(/''/g,"'");if(E==="true")return!0;if(E==="false")return!1;if(E==="null"||E==="~")return null;if(/^-?\d+(\.\d+)?$/.test(E)){const D=Number(E);return Number.isFinite(D)?D:E}return E}function ae(E){const D=[];let o=0,k=null,u=0;for(let i=0;i<E.length;i++){const s=E[i];if(k){s===k&&(k=null);continue}if(s==='"'||s==="'"){k=s;continue}s==="["?o++:s==="]"?o--:s===","&&o===0&&(D.push(E.slice(u,i)),u=i+1)}return D.push(E.slice(u)),D}function Ft(E){const{sourcePath:D,raw:o}=E,{data:k,content:u}=re(o),i=oe(k,D),s=St(k,"id"),r=St(k,"created_at")??St(k,"createdAt"),c=ce(k,u),b={};for(const[g,_]of Object.entries(k))g==="id"||g==="path"||g==="tags"||g==="created_at"||g==="createdAt"||(b[g]=_);const v={sourcePath:D,path:i,content:u,tags:c,metadata:b};return s&&(v.id=s),r&&(v.createdAt=r),v}function oe(E,D){const o=St(E,"path");return Rt(o||le(D))}function St(E,D){const o=E[D];if(typeof o=="string"&&o.trim()!=="")return o.trim()}function le(E){return E.replace(/\.(md|markdown)$/i,"")}function Rt(E){return E.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+|\/+$/g,"")}const ue=/(?:^|\s)#([a-zA-Z][\w-]*)/g;function ce(E,D){const o=new Set,k=E.tags;if(Array.isArray(k))for(const u of k){const i=Ct(u);i&&o.add(i)}else if(typeof k=="string")for(const u of k.split(/[,\s]+/)){const i=Ct(u);i&&o.add(i)}for(const u of D.matchAll(ue)){const i=Ct(u[1]??"");i&&o.add(i)}return[...o]}function Ct(E){if(typeof E!="string")return typeof E=="number"||typeof E=="boolean"?String(E).toLowerCase():null;const D=E.trim().replace(/^#/,"").toLowerCase();return!D||!/^[a-z0-9_/-]+$/.test(D)?null:D}function he(E){return typeof E.text=="function"?E.text():new Promise((D,o)=>{const k=new FileReader;k.onload=()=>D(k.result),k.onerror=()=>o(k.error??new Error("FileReader failed")),k.readAsText(E)})}async function de(E){const D=[],o=[];for(const k of E){if(!At(k)){o.push({sourcePath:k.name,reason:"Not a markdown file (.md / .markdown) — skipped."});continue}try{const u=await he(k),i=k.webkitRelativePath||k.name,s=Ft({sourcePath:i,raw:u});D.push(s)}catch(u){o.push({sourcePath:k.name,reason:u instanceof Error?u.message:String(u)})}}return{format:"loose-markdown",notes:D,errors:o,tags:fe(D)}}function fe(E){const D=new Set;for(const o of E)for(const k of o.tags)D.add(k);return[...D].sort()}function xt(E){throw new Error('Could not dynamically require "'+E+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Et={exports:{}};/*!
|
|
2
|
+
|
|
3
|
+
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
|
|
4
|
+
<http://stuartk.com/jszip>
|
|
5
|
+
|
|
6
|
+
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
|
7
|
+
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
|
8
|
+
|
|
9
|
+
JSZip uses the library pako released under the MIT license :
|
|
10
|
+
https://github.com/nodeca/pako/blob/main/LICENSE
|
|
11
|
+
*/var Bt;function pe(){return Bt||(Bt=1,(function(E,D){(function(o){E.exports=o()})(function(){return(function o(k,u,i){function s(b,v){if(!u[b]){if(!k[b]){var g=typeof xt=="function"&&xt;if(!v&&g)return g(b,!0);if(r)return r(b,!0);var _=new Error("Cannot find module '"+b+"'");throw _.code="MODULE_NOT_FOUND",_}var a=u[b]={exports:{}};k[b][0].call(a.exports,function(p){var n=k[b][1][p];return s(n||p)},a,a.exports,o,k,u,i)}return u[b].exports}for(var r=typeof xt=="function"&&xt,c=0;c<i.length;c++)s(i[c]);return s})({1:[function(o,k,u){var i=o("./utils"),s=o("./support"),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";u.encode=function(c){for(var b,v,g,_,a,p,n,d=[],l=0,m=c.length,w=m,z=i.getTypeOf(c)!=="string";l<c.length;)w=m-l,g=z?(b=c[l++],v=l<m?c[l++]:0,l<m?c[l++]:0):(b=c.charCodeAt(l++),v=l<m?c.charCodeAt(l++):0,l<m?c.charCodeAt(l++):0),_=b>>2,a=(3&b)<<4|v>>4,p=1<w?(15&v)<<2|g>>6:64,n=2<w?63&g:64,d.push(r.charAt(_)+r.charAt(a)+r.charAt(p)+r.charAt(n));return d.join("")},u.decode=function(c){var b,v,g,_,a,p,n=0,d=0,l="data:";if(c.substr(0,l.length)===l)throw new Error("Invalid base64 input, it looks like a data url.");var m,w=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===r.charAt(64)&&w--,c.charAt(c.length-2)===r.charAt(64)&&w--,w%1!=0)throw new Error("Invalid base64 input, bad content length.");for(m=s.uint8array?new Uint8Array(0|w):new Array(0|w);n<c.length;)b=r.indexOf(c.charAt(n++))<<2|(_=r.indexOf(c.charAt(n++)))>>4,v=(15&_)<<4|(a=r.indexOf(c.charAt(n++)))>>2,g=(3&a)<<6|(p=r.indexOf(c.charAt(n++))),m[d++]=b,a!==64&&(m[d++]=v),p!==64&&(m[d++]=g);return m}},{"./support":30,"./utils":32}],2:[function(o,k,u){var i=o("./external"),s=o("./stream/DataWorker"),r=o("./stream/Crc32Probe"),c=o("./stream/DataLengthProbe");function b(v,g,_,a,p){this.compressedSize=v,this.uncompressedSize=g,this.crc32=_,this.compression=a,this.compressedContent=p}b.prototype={getContentWorker:function(){var v=new s(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),g=this;return v.on("end",function(){if(this.streamInfo.data_length!==g.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),v},getCompressedWorker:function(){return new s(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},b.createWorkerFrom=function(v,g,_){return v.pipe(new r).pipe(new c("uncompressedSize")).pipe(g.compressWorker(_)).pipe(new c("compressedSize")).withStreamInfo("compression",g)},k.exports=b},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(o,k,u){var i=o("./stream/GenericWorker");u.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},u.DEFLATE=o("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(o,k,u){var i=o("./utils"),s=(function(){for(var r,c=[],b=0;b<256;b++){r=b;for(var v=0;v<8;v++)r=1&r?3988292384^r>>>1:r>>>1;c[b]=r}return c})();k.exports=function(r,c){return r!==void 0&&r.length?i.getTypeOf(r)!=="string"?(function(b,v,g,_){var a=s,p=_+g;b^=-1;for(var n=_;n<p;n++)b=b>>>8^a[255&(b^v[n])];return-1^b})(0|c,r,r.length,0):(function(b,v,g,_){var a=s,p=_+g;b^=-1;for(var n=_;n<p;n++)b=b>>>8^a[255&(b^v.charCodeAt(n))];return-1^b})(0|c,r,r.length,0):0}},{"./utils":32}],5:[function(o,k,u){u.base64=!1,u.binary=!1,u.dir=!1,u.createFolders=!0,u.date=null,u.compression=null,u.compressionOptions=null,u.comment=null,u.unixPermissions=null,u.dosPermissions=null},{}],6:[function(o,k,u){var i=null;i=typeof Promise<"u"?Promise:o("lie"),k.exports={Promise:i}},{lie:37}],7:[function(o,k,u){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=o("pako"),r=o("./utils"),c=o("./stream/GenericWorker"),b=i?"uint8array":"array";function v(g,_){c.call(this,"FlateWorker/"+g),this._pako=null,this._pakoAction=g,this._pakoOptions=_,this.meta={}}u.magic="\b\0",r.inherits(v,c),v.prototype.processChunk=function(g){this.meta=g.meta,this._pako===null&&this._createPako(),this._pako.push(r.transformTo(b,g.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 s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var g=this;this._pako.onData=function(_){g.push({data:_,meta:g.meta})}},u.compressWorker=function(g){return new v("Deflate",g)},u.uncompressWorker=function(){return new v("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(o,k,u){function i(a,p){var n,d="";for(n=0;n<p;n++)d+=String.fromCharCode(255&a),a>>>=8;return d}function s(a,p,n,d,l,m){var w,z,S=a.file,P=a.compression,j=m!==b.utf8encode,W=r.transformTo("string",m(S.name)),O=r.transformTo("string",b.utf8encode(S.name)),G=S.comment,J=r.transformTo("string",m(G)),y=r.transformTo("string",b.utf8encode(G)),R=O.length!==S.name.length,e=y.length!==G.length,T="",tt="",L="",et=S.dir,Z=S.date,Q={crc32:0,compressedSize:0,uncompressedSize:0};p&&!n||(Q.crc32=a.crc32,Q.compressedSize=a.compressedSize,Q.uncompressedSize=a.uncompressedSize);var I=0;p&&(I|=8),j||!R&&!e||(I|=2048);var A=0,q=0;et&&(A|=16),l==="UNIX"?(q=798,A|=(function(K,at){var ct=K;return K||(ct=at?16893:33204),(65535&ct)<<16})(S.unixPermissions,et)):(q=20,A|=(function(K){return 63&(K||0)})(S.dosPermissions)),w=Z.getUTCHours(),w<<=6,w|=Z.getUTCMinutes(),w<<=5,w|=Z.getUTCSeconds()/2,z=Z.getUTCFullYear()-1980,z<<=4,z|=Z.getUTCMonth()+1,z<<=5,z|=Z.getUTCDate(),R&&(tt=i(1,1)+i(v(W),4)+O,T+="up"+i(tt.length,2)+tt),e&&(L=i(1,1)+i(v(J),4)+y,T+="uc"+i(L.length,2)+L);var Y="";return Y+=`
|
|
12
|
+
\0`,Y+=i(I,2),Y+=P.magic,Y+=i(w,2),Y+=i(z,2),Y+=i(Q.crc32,4),Y+=i(Q.compressedSize,4),Y+=i(Q.uncompressedSize,4),Y+=i(W.length,2),Y+=i(T.length,2),{fileRecord:g.LOCAL_FILE_HEADER+Y+W+T,dirRecord:g.CENTRAL_FILE_HEADER+i(q,2)+Y+i(J.length,2)+"\0\0\0\0"+i(A,4)+i(d,4)+W+T+J}}var r=o("../utils"),c=o("../stream/GenericWorker"),b=o("../utf8"),v=o("../crc32"),g=o("../signature");function _(a,p,n,d){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=n,this.encodeFileName=d,this.streamFiles=a,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(_,c),_.prototype.push=function(a){var p=a.meta.percent||0,n=this.entriesCount,d=this._sources.length;this.accumulate?this.contentBuffer.push(a):(this.bytesWritten+=a.data.length,c.prototype.push.call(this,{data:a.data,meta:{currentFile:this.currentFile,percent:n?(p+100*(n-d-1))/n:100}}))},_.prototype.openedSource=function(a){this.currentSourceOffset=this.bytesWritten,this.currentFile=a.file.name;var p=this.streamFiles&&!a.file.dir;if(p){var n=s(a,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},_.prototype.closedSource=function(a){this.accumulate=!1;var p=this.streamFiles&&!a.file.dir,n=s(a,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),p)this.push({data:(function(d){return g.DATA_DESCRIPTOR+i(d.crc32,4)+i(d.compressedSize,4)+i(d.uncompressedSize,4)})(a),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},_.prototype.flush=function(){for(var a=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var n=this.bytesWritten-a,d=(function(l,m,w,z,S){var P=r.transformTo("string",S(z));return g.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(l,2)+i(l,2)+i(m,4)+i(w,4)+i(P.length,2)+P})(this.dirRecords.length,n,a,this.zipComment,this.encodeFileName);this.push({data:d,meta:{percent:100}})},_.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},_.prototype.registerPrevious=function(a){this._sources.push(a);var p=this;return a.on("data",function(n){p.processChunk(n)}),a.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),a.on("error",function(n){p.error(n)}),this},_.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))},_.prototype.error=function(a){var p=this._sources;if(!c.prototype.error.call(this,a))return!1;for(var n=0;n<p.length;n++)try{p[n].error(a)}catch{}return!0},_.prototype.lock=function(){c.prototype.lock.call(this);for(var a=this._sources,p=0;p<a.length;p++)a[p].lock()},k.exports=_},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(o,k,u){var i=o("../compressions"),s=o("./ZipFileWorker");u.generateWorker=function(r,c,b){var v=new s(c.streamFiles,b,c.platform,c.encodeFileName),g=0;try{r.forEach(function(_,a){g++;var p=(function(m,w){var z=m||w,S=i[z];if(!S)throw new Error(z+" is not a valid compression method !");return S})(a.options.compression,c.compression),n=a.options.compressionOptions||c.compressionOptions||{},d=a.dir,l=a.date;a._compressWorker(p,n).withStreamInfo("file",{name:_,dir:d,date:l,comment:a.comment||"",unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions}).pipe(v)}),v.entriesCount=g}catch(_){v.error(_)}return v}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(o,k,u){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 s=new i;for(var r in this)typeof this[r]!="function"&&(s[r]=this[r]);return s}}(i.prototype=o("./object")).loadAsync=o("./load"),i.support=o("./support"),i.defaults=o("./defaults"),i.version="3.10.1",i.loadAsync=function(s,r){return new i().loadAsync(s,r)},i.external=o("./external"),k.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(o,k,u){var i=o("./utils"),s=o("./external"),r=o("./utf8"),c=o("./zipEntries"),b=o("./stream/Crc32Probe"),v=o("./nodejsUtils");function g(_){return new s.Promise(function(a,p){var n=_.decompressed.getContentWorker().pipe(new b);n.on("error",function(d){p(d)}).on("end",function(){n.streamInfo.crc32!==_.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):a()}).resume()})}k.exports=function(_,a){var p=this;return a=i.extend(a||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:r.utf8decode}),v.isNode&&v.isStream(_)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",_,!0,a.optimizedBinaryString,a.base64).then(function(n){var d=new c(a);return d.load(n),d}).then(function(n){var d=[s.Promise.resolve(n)],l=n.files;if(a.checkCRC32)for(var m=0;m<l.length;m++)d.push(g(l[m]));return s.Promise.all(d)}).then(function(n){for(var d=n.shift(),l=d.files,m=0;m<l.length;m++){var w=l[m],z=w.fileNameStr,S=i.resolve(w.fileNameStr);p.file(S,w.decompressed,{binary:!0,optimizedBinaryString:!0,date:w.date,dir:w.dir,comment:w.fileCommentStr.length?w.fileCommentStr:null,unixPermissions:w.unixPermissions,dosPermissions:w.dosPermissions,createFolders:a.createFolders}),w.dir||(p.file(S).unsafeOriginalName=z)}return d.zipComment.length&&(p.comment=d.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(o,k,u){var i=o("../utils"),s=o("../stream/GenericWorker");function r(c,b){s.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(b)}i.inherits(r,s),r.prototype._bindStream=function(c){var b=this;(this._stream=c).pause(),c.on("data",function(v){b.push({data:v,meta:{percent:0}})}).on("error",function(v){b.isPaused?this.generatedError=v:b.error(v)}).on("end",function(){b.isPaused?b._upstreamEnded=!0:b.end()})},r.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},r.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},k.exports=r},{"../stream/GenericWorker":28,"../utils":32}],13:[function(o,k,u){var i=o("readable-stream").Readable;function s(r,c,b){i.call(this,c),this._helper=r;var v=this;r.on("data",function(g,_){v.push(g)||v._helper.pause(),b&&b(_)}).on("error",function(g){v.emit("error",g)}).on("end",function(){v.push(null)})}o("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},k.exports=s},{"../utils":32,"readable-stream":16}],14:[function(o,k,u){k.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,s)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var s=new Buffer(i);return s.fill(0),s},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,k,u){function i(S,P,j){var W,O=r.getTypeOf(P),G=r.extend(j||{},v);G.date=G.date||new Date,G.compression!==null&&(G.compression=G.compression.toUpperCase()),typeof G.unixPermissions=="string"&&(G.unixPermissions=parseInt(G.unixPermissions,8)),G.unixPermissions&&16384&G.unixPermissions&&(G.dir=!0),G.dosPermissions&&16&G.dosPermissions&&(G.dir=!0),G.dir&&(S=l(S)),G.createFolders&&(W=d(S))&&m.call(this,W,!0);var J=O==="string"&&G.binary===!1&&G.base64===!1;j&&j.binary!==void 0||(G.binary=!J),(P instanceof g&&P.uncompressedSize===0||G.dir||!P||P.length===0)&&(G.base64=!1,G.binary=!0,P="",G.compression="STORE",O="string");var y=null;y=P instanceof g||P instanceof c?P:p.isNode&&p.isStream(P)?new n(S,P):r.prepareContent(S,P,G.binary,G.optimizedBinaryString,G.base64);var R=new _(S,y,G);this.files[S]=R}var s=o("./utf8"),r=o("./utils"),c=o("./stream/GenericWorker"),b=o("./stream/StreamHelper"),v=o("./defaults"),g=o("./compressedObject"),_=o("./zipObject"),a=o("./generate"),p=o("./nodejsUtils"),n=o("./nodejs/NodejsStreamInputAdapter"),d=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var P=S.lastIndexOf("/");return 0<P?S.substring(0,P):""},l=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},m=function(S,P){return P=P!==void 0?P:v.createFolders,S=l(S),this.files[S]||i.call(this,S,null,{dir:!0,createFolders:P}),this.files[S]};function w(S){return Object.prototype.toString.call(S)==="[object RegExp]"}var z={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(S){var P,j,W;for(P in this.files)W=this.files[P],(j=P.slice(this.root.length,P.length))&&P.slice(0,this.root.length)===this.root&&S(j,W)},filter:function(S){var P=[];return this.forEach(function(j,W){S(j,W)&&P.push(W)}),P},file:function(S,P,j){if(arguments.length!==1)return S=this.root+S,i.call(this,S,P,j),this;if(w(S)){var W=S;return this.filter(function(G,J){return!J.dir&&W.test(G)})}var O=this.files[this.root+S];return O&&!O.dir?O:null},folder:function(S){if(!S)return this;if(w(S))return this.filter(function(O,G){return G.dir&&S.test(O)});var P=this.root+S,j=m.call(this,P),W=this.clone();return W.root=j.name,W},remove:function(S){S=this.root+S;var P=this.files[S];if(P||(S.slice(-1)!=="/"&&(S+="/"),P=this.files[S]),P&&!P.dir)delete this.files[S];else for(var j=this.filter(function(O,G){return G.name.slice(0,S.length)===S}),W=0;W<j.length;W++)delete this.files[j[W].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(S){var P,j={};try{if((j=r.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=j.type.toLowerCase(),j.compression=j.compression.toUpperCase(),j.type==="binarystring"&&(j.type="string"),!j.type)throw new Error("No output type specified.");r.checkSupport(j.type),j.platform!=="darwin"&&j.platform!=="freebsd"&&j.platform!=="linux"&&j.platform!=="sunos"||(j.platform="UNIX"),j.platform==="win32"&&(j.platform="DOS");var W=j.comment||this.comment||"";P=a.generateWorker(this,j,W)}catch(O){(P=new c("error")).error(O)}return new b(P,j.type||"string",j.mimeType)},generateAsync:function(S,P){return this.generateInternalStream(S).accumulate(P)},generateNodeStream:function(S,P){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(P)}};k.exports=z},{"./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,k,u){k.exports=o("stream")},{stream:void 0}],17:[function(o,k,u){var i=o("./DataReader");function s(r){i.call(this,r);for(var c=0;c<this.data.length;c++)r[c]=255&r[c]}o("../utils").inherits(s,i),s.prototype.byteAt=function(r){return this.data[this.zero+r]},s.prototype.lastIndexOfSignature=function(r){for(var c=r.charCodeAt(0),b=r.charCodeAt(1),v=r.charCodeAt(2),g=r.charCodeAt(3),_=this.length-4;0<=_;--_)if(this.data[_]===c&&this.data[_+1]===b&&this.data[_+2]===v&&this.data[_+3]===g)return _-this.zero;return-1},s.prototype.readAndCheckSignature=function(r){var c=r.charCodeAt(0),b=r.charCodeAt(1),v=r.charCodeAt(2),g=r.charCodeAt(3),_=this.readData(4);return c===_[0]&&b===_[1]&&v===_[2]&&g===_[3]},s.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},k.exports=s},{"../utils":32,"./DataReader":18}],18:[function(o,k,u){var i=o("../utils");function s(r){this.data=r,this.length=r.length,this.index=0,this.zero=0}s.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,b=0;for(this.checkOffset(r),c=this.index+r-1;c>=this.index;c--)b=(b<<8)+this.byteAt(c);return this.index+=r,b},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))}},k.exports=s},{"../utils":32}],19:[function(o,k,u){var i=o("./Uint8ArrayReader");function s(r){i.call(this,r)}o("../utils").inherits(s,i),s.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},k.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(o,k,u){var i=o("./DataReader");function s(r){i.call(this,r)}o("../utils").inherits(s,i),s.prototype.byteAt=function(r){return this.data.charCodeAt(this.zero+r)},s.prototype.lastIndexOfSignature=function(r){return this.data.lastIndexOf(r)-this.zero},s.prototype.readAndCheckSignature=function(r){return r===this.readData(4)},s.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},k.exports=s},{"../utils":32,"./DataReader":18}],21:[function(o,k,u){var i=o("./ArrayReader");function s(r){i.call(this,r)}o("../utils").inherits(s,i),s.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},k.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(o,k,u){var i=o("../utils"),s=o("../support"),r=o("./ArrayReader"),c=o("./StringReader"),b=o("./NodeBufferReader"),v=o("./Uint8ArrayReader");k.exports=function(g){var _=i.getTypeOf(g);return i.checkSupport(_),_!=="string"||s.uint8array?_==="nodebuffer"?new b(g):s.uint8array?new v(i.transformTo("uint8array",g)):new r(i.transformTo("array",g)):new c(g)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(o,k,u){u.LOCAL_FILE_HEADER="PK",u.CENTRAL_FILE_HEADER="PK",u.CENTRAL_DIRECTORY_END="PK",u.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",u.ZIP64_CENTRAL_DIRECTORY_END="PK",u.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(o,k,u){var i=o("./GenericWorker"),s=o("../utils");function r(c){i.call(this,"ConvertWorker to "+c),this.destType=c}s.inherits(r,i),r.prototype.processChunk=function(c){this.push({data:s.transformTo(this.destType,c.data),meta:c.meta})},k.exports=r},{"../utils":32,"./GenericWorker":28}],25:[function(o,k,u){var i=o("./GenericWorker"),s=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=s(c.data,this.streamInfo.crc32||0),this.push(c)},k.exports=r},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(o,k,u){var i=o("../utils"),s=o("./GenericWorker");function r(c){s.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}i.inherits(r,s),r.prototype.processChunk=function(c){if(c){var b=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=b+c.data.length}s.prototype.processChunk.call(this,c)},k.exports=r},{"../utils":32,"./GenericWorker":28}],27:[function(o,k,u){var i=o("../utils"),s=o("./GenericWorker");function r(c){s.call(this,"DataWorker");var b=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(v){b.dataIsReady=!0,b.data=v,b.max=v&&v.length||0,b.type=i.getTypeOf(v),b.isPaused||b._tickAndRepeat()},function(v){b.error(v)})}i.inherits(r,s),r.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!s.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,b=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,b);break;case"uint8array":c=this.data.subarray(this.index,b);break;case"array":case"nodebuffer":c=this.data.slice(this.index,b)}return this.index=b,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},k.exports=r},{"../utils":32,"./GenericWorker":28}],28:[function(o,k,u){function i(s){this.name=s||"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(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,r){return this._listeners[s].push(r),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,r){if(this._listeners[s])for(var c=0;c<this._listeners[s].length;c++)this._listeners[s][c].call(this,r)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var r=this;return s.on("data",function(c){r.processChunk(c)}),s.on("end",function(){r.end()}),s.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 s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,r){return this.extraStreamInfo[s]=r,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},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 s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},k.exports=i},{}],29:[function(o,k,u){var i=o("../utils"),s=o("./ConvertWorker"),r=o("./GenericWorker"),c=o("../base64"),b=o("../support"),v=o("../external"),g=null;if(b.nodestream)try{g=o("../nodejs/NodejsStreamOutputAdapter")}catch{}function _(p,n){return new v.Promise(function(d,l){var m=[],w=p._internalType,z=p._outputType,S=p._mimeType;p.on("data",function(P,j){m.push(P),n&&n(j)}).on("error",function(P){m=[],l(P)}).on("end",function(){try{var P=(function(j,W,O){switch(j){case"blob":return i.newBlob(i.transformTo("arraybuffer",W),O);case"base64":return c.encode(W);default:return i.transformTo(j,W)}})(z,(function(j,W){var O,G=0,J=null,y=0;for(O=0;O<W.length;O++)y+=W[O].length;switch(j){case"string":return W.join("");case"array":return Array.prototype.concat.apply([],W);case"uint8array":for(J=new Uint8Array(y),O=0;O<W.length;O++)J.set(W[O],G),G+=W[O].length;return J;case"nodebuffer":return Buffer.concat(W);default:throw new Error("concat : unsupported type '"+j+"'")}})(w,m),S);d(P)}catch(j){l(j)}m=[]}).resume()})}function a(p,n,d){var l=n;switch(n){case"blob":case"arraybuffer":l="uint8array";break;case"base64":l="string"}try{this._internalType=l,this._outputType=n,this._mimeType=d,i.checkSupport(l),this._worker=p.pipe(new s(l)),p.lock()}catch(m){this._worker=new r("error"),this._worker.error(m)}}a.prototype={accumulate:function(p){return _(this,p)},on:function(p,n){var d=this;return p==="data"?this._worker.on(p,function(l){n.call(d,l.data,l.meta)}):this._worker.on(p,function(){i.delay(n,arguments,d)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new g(this,{objectMode:this._outputType!=="nodebuffer"},p)}},k.exports=a},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(o,k,u){if(u.base64=!0,u.array=!0,u.string=!0,u.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",u.nodebuffer=typeof Buffer<"u",u.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")u.blob=!1;else{var i=new ArrayBuffer(0);try{u.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),u.blob=s.getBlob("application/zip").size===0}catch{u.blob=!1}}}try{u.nodestream=!!o("readable-stream").Readable}catch{u.nodestream=!1}},{"readable-stream":16}],31:[function(o,k,u){for(var i=o("./utils"),s=o("./support"),r=o("./nodejsUtils"),c=o("./stream/GenericWorker"),b=new Array(256),v=0;v<256;v++)b[v]=252<=v?6:248<=v?5:240<=v?4:224<=v?3:192<=v?2:1;b[254]=b[254]=1;function g(){c.call(this,"utf-8 decode"),this.leftOver=null}function _(){c.call(this,"utf-8 encode")}u.utf8encode=function(a){return s.nodebuffer?r.newBufferFrom(a,"utf-8"):(function(p){var n,d,l,m,w,z=p.length,S=0;for(m=0;m<z;m++)(64512&(d=p.charCodeAt(m)))==55296&&m+1<z&&(64512&(l=p.charCodeAt(m+1)))==56320&&(d=65536+(d-55296<<10)+(l-56320),m++),S+=d<128?1:d<2048?2:d<65536?3:4;for(n=s.uint8array?new Uint8Array(S):new Array(S),m=w=0;w<S;m++)(64512&(d=p.charCodeAt(m)))==55296&&m+1<z&&(64512&(l=p.charCodeAt(m+1)))==56320&&(d=65536+(d-55296<<10)+(l-56320),m++),d<128?n[w++]=d:(d<2048?n[w++]=192|d>>>6:(d<65536?n[w++]=224|d>>>12:(n[w++]=240|d>>>18,n[w++]=128|d>>>12&63),n[w++]=128|d>>>6&63),n[w++]=128|63&d);return n})(a)},u.utf8decode=function(a){return s.nodebuffer?i.transformTo("nodebuffer",a).toString("utf-8"):(function(p){var n,d,l,m,w=p.length,z=new Array(2*w);for(n=d=0;n<w;)if((l=p[n++])<128)z[d++]=l;else if(4<(m=b[l]))z[d++]=65533,n+=m-1;else{for(l&=m===2?31:m===3?15:7;1<m&&n<w;)l=l<<6|63&p[n++],m--;1<m?z[d++]=65533:l<65536?z[d++]=l:(l-=65536,z[d++]=55296|l>>10&1023,z[d++]=56320|1023&l)}return z.length!==d&&(z.subarray?z=z.subarray(0,d):z.length=d),i.applyFromCharCode(z)})(a=i.transformTo(s.uint8array?"uint8array":"array",a))},i.inherits(g,c),g.prototype.processChunk=function(a){var p=i.transformTo(s.uint8array?"uint8array":"array",a.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var n=p;(p=new Uint8Array(n.length+this.leftOver.length)).set(this.leftOver,0),p.set(n,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var d=(function(m,w){var z;for((w=w||m.length)>m.length&&(w=m.length),z=w-1;0<=z&&(192&m[z])==128;)z--;return z<0||z===0?w:z+b[m[z]]>w?z:w})(p),l=p;d!==p.length&&(s.uint8array?(l=p.subarray(0,d),this.leftOver=p.subarray(d,p.length)):(l=p.slice(0,d),this.leftOver=p.slice(d,p.length))),this.push({data:u.utf8decode(l),meta:a.meta})},g.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:u.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},u.Utf8DecodeWorker=g,i.inherits(_,c),_.prototype.processChunk=function(a){this.push({data:u.utf8encode(a.data),meta:a.meta})},u.Utf8EncodeWorker=_},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(o,k,u){var i=o("./support"),s=o("./base64"),r=o("./nodejsUtils"),c=o("./external");function b(n){return n}function v(n,d){for(var l=0;l<n.length;++l)d[l]=255&n.charCodeAt(l);return d}o("setimmediate"),u.newBlob=function(n,d){u.checkSupport("blob");try{return new Blob([n],{type:d})}catch{try{var l=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return l.append(n),l.getBlob(d)}catch{throw new Error("Bug : can't construct the Blob.")}}};var g={stringifyByChunk:function(n,d,l){var m=[],w=0,z=n.length;if(z<=l)return String.fromCharCode.apply(null,n);for(;w<z;)d==="array"||d==="nodebuffer"?m.push(String.fromCharCode.apply(null,n.slice(w,Math.min(w+l,z)))):m.push(String.fromCharCode.apply(null,n.subarray(w,Math.min(w+l,z)))),w+=l;return m.join("")},stringifyByChar:function(n){for(var d="",l=0;l<n.length;l++)d+=String.fromCharCode(n[l]);return d},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 _(n){var d=65536,l=u.getTypeOf(n),m=!0;if(l==="uint8array"?m=g.applyCanBeUsed.uint8array:l==="nodebuffer"&&(m=g.applyCanBeUsed.nodebuffer),m)for(;1<d;)try{return g.stringifyByChunk(n,l,d)}catch{d=Math.floor(d/2)}return g.stringifyByChar(n)}function a(n,d){for(var l=0;l<n.length;l++)d[l]=n[l];return d}u.applyFromCharCode=_;var p={};p.string={string:b,array:function(n){return v(n,new Array(n.length))},arraybuffer:function(n){return p.string.uint8array(n).buffer},uint8array:function(n){return v(n,new Uint8Array(n.length))},nodebuffer:function(n){return v(n,r.allocBuffer(n.length))}},p.array={string:_,array:b,arraybuffer:function(n){return new Uint8Array(n).buffer},uint8array:function(n){return new Uint8Array(n)},nodebuffer:function(n){return r.newBufferFrom(n)}},p.arraybuffer={string:function(n){return _(new Uint8Array(n))},array:function(n){return a(new Uint8Array(n),new Array(n.byteLength))},arraybuffer:b,uint8array:function(n){return new Uint8Array(n)},nodebuffer:function(n){return r.newBufferFrom(new Uint8Array(n))}},p.uint8array={string:_,array:function(n){return a(n,new Array(n.length))},arraybuffer:function(n){return n.buffer},uint8array:b,nodebuffer:function(n){return r.newBufferFrom(n)}},p.nodebuffer={string:_,array:function(n){return a(n,new Array(n.length))},arraybuffer:function(n){return p.nodebuffer.uint8array(n).buffer},uint8array:function(n){return a(n,new Uint8Array(n.length))},nodebuffer:b},u.transformTo=function(n,d){if(d=d||"",!n)return d;u.checkSupport(n);var l=u.getTypeOf(d);return p[l][n](d)},u.resolve=function(n){for(var d=n.split("/"),l=[],m=0;m<d.length;m++){var w=d[m];w==="."||w===""&&m!==0&&m!==d.length-1||(w===".."?l.pop():l.push(w))}return l.join("/")},u.getTypeOf=function(n){return typeof n=="string"?"string":Object.prototype.toString.call(n)==="[object Array]"?"array":i.nodebuffer&&r.isBuffer(n)?"nodebuffer":i.uint8array&&n instanceof Uint8Array?"uint8array":i.arraybuffer&&n instanceof ArrayBuffer?"arraybuffer":void 0},u.checkSupport=function(n){if(!i[n.toLowerCase()])throw new Error(n+" is not supported by this platform")},u.MAX_VALUE_16BITS=65535,u.MAX_VALUE_32BITS=-1,u.pretty=function(n){var d,l,m="";for(l=0;l<(n||"").length;l++)m+="\\x"+((d=n.charCodeAt(l))<16?"0":"")+d.toString(16).toUpperCase();return m},u.delay=function(n,d,l){setImmediate(function(){n.apply(l||null,d||[])})},u.inherits=function(n,d){function l(){}l.prototype=d.prototype,n.prototype=new l},u.extend=function(){var n,d,l={};for(n=0;n<arguments.length;n++)for(d in arguments[n])Object.prototype.hasOwnProperty.call(arguments[n],d)&&l[d]===void 0&&(l[d]=arguments[n][d]);return l},u.prepareContent=function(n,d,l,m,w){return c.Promise.resolve(d).then(function(z){return i.blob&&(z instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(z))!==-1)&&typeof FileReader<"u"?new c.Promise(function(S,P){var j=new FileReader;j.onload=function(W){S(W.target.result)},j.onerror=function(W){P(W.target.error)},j.readAsArrayBuffer(z)}):z}).then(function(z){var S=u.getTypeOf(z);return S?(S==="arraybuffer"?z=u.transformTo("uint8array",z):S==="string"&&(w?z=s.decode(z):l&&m!==!0&&(z=(function(P){return v(P,i.uint8array?new Uint8Array(P.length):new Array(P.length))})(z))),z):c.Promise.reject(new Error("Can't read the data of '"+n+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(o,k,u){var i=o("./reader/readerFor"),s=o("./utils"),r=o("./signature"),c=o("./zipEntry"),b=o("./support");function v(g){this.files=[],this.loadOptions=g}v.prototype={checkSignature:function(g){if(!this.reader.readAndCheckSignature(g)){this.reader.index-=4;var _=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(_)+", expected "+s.pretty(g)+")")}},isSignature:function(g,_){var a=this.reader.index;this.reader.setIndex(g);var p=this.reader.readString(4)===_;return this.reader.setIndex(a),p},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 g=this.reader.readData(this.zipCommentLength),_=b.uint8array?"uint8array":"array",a=s.transformTo(_,g);this.zipComment=this.loadOptions.decodeFileName(a)},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 g,_,a,p=this.zip64EndOfCentralSize-44;0<p;)g=this.reader.readInt(2),_=this.reader.readInt(4),a=this.reader.readData(_),this.zip64ExtensibleData[g]={id:g,length:_,value:a}},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 g,_;for(g=0;g<this.files.length;g++)_=this.files[g],this.reader.setIndex(_.localHeaderOffset),this.checkSignature(r.LOCAL_FILE_HEADER),_.readLocalPart(this.reader),_.handleUTF8(),_.processAttributes()},readCentralDir:function(){var g;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(r.CENTRAL_FILE_HEADER);)(g=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(g);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 g=this.reader.lastIndexOfSignature(r.CENTRAL_DIRECTORY_END);if(g<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(g);var _=g;if(this.checkSignature(r.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(g=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(g),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 a=this.centralDirOffset+this.centralDirSize;this.zip64&&(a+=20,a+=12+this.zip64EndOfCentralSize);var p=_-a;if(0<p)this.isSignature(_,r.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(g){this.reader=i(g)},load:function(g){this.prepareReader(g),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},k.exports=v},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(o,k,u){var i=o("./reader/readerFor"),s=o("./utils"),r=o("./compressedObject"),c=o("./crc32"),b=o("./utf8"),v=o("./compressions"),g=o("./support");function _(a,p){this.options=a,this.loadOptions=p}_.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(a){var p,n;if(a.skip(22),this.fileNameLength=a.readInt(2),n=a.readInt(2),this.fileName=a.readData(this.fileNameLength),a.skip(n),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((p=(function(d){for(var l in v)if(Object.prototype.hasOwnProperty.call(v,l)&&v[l].magic===d)return v[l];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new r(this.compressedSize,this.uncompressedSize,this.crc32,p,a.readData(this.compressedSize))},readCentralPart:function(a){this.versionMadeBy=a.readInt(2),a.skip(2),this.bitFlag=a.readInt(2),this.compressionMethod=a.readString(2),this.date=a.readDate(),this.crc32=a.readInt(4),this.compressedSize=a.readInt(4),this.uncompressedSize=a.readInt(4);var p=a.readInt(2);if(this.extraFieldsLength=a.readInt(2),this.fileCommentLength=a.readInt(2),this.diskNumberStart=a.readInt(2),this.internalFileAttributes=a.readInt(2),this.externalFileAttributes=a.readInt(4),this.localHeaderOffset=a.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");a.skip(p),this.readExtraFields(a),this.parseZIP64ExtraField(a),this.fileComment=a.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var a=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),a==0&&(this.dosPermissions=63&this.externalFileAttributes),a==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var a=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=a.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=a.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=a.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=a.readInt(4))}},readExtraFields:function(a){var p,n,d,l=a.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});a.index+4<l;)p=a.readInt(2),n=a.readInt(2),d=a.readData(n),this.extraFields[p]={id:p,length:n,value:d};a.setIndex(l)},handleUTF8:function(){var a=g.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=b.utf8decode(this.fileName),this.fileCommentStr=b.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var n=s.transformTo(a,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(n)}var d=this.findExtraFieldUnicodeComment();if(d!==null)this.fileCommentStr=d;else{var l=s.transformTo(a,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(l)}}},findExtraFieldUnicodePath:function(){var a=this.extraFields[28789];if(a){var p=i(a.value);return p.readInt(1)!==1||c(this.fileName)!==p.readInt(4)?null:b.utf8decode(p.readData(a.length-5))}return null},findExtraFieldUnicodeComment:function(){var a=this.extraFields[25461];if(a){var p=i(a.value);return p.readInt(1)!==1||c(this.fileComment)!==p.readInt(4)?null:b.utf8decode(p.readData(a.length-5))}return null}},k.exports=_},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(o,k,u){function i(p,n,d){this.name=p,this.dir=d.dir,this.date=d.date,this.comment=d.comment,this.unixPermissions=d.unixPermissions,this.dosPermissions=d.dosPermissions,this._data=n,this._dataBinary=d.binary,this.options={compression:d.compression,compressionOptions:d.compressionOptions}}var s=o("./stream/StreamHelper"),r=o("./stream/DataWorker"),c=o("./utf8"),b=o("./compressedObject"),v=o("./stream/GenericWorker");i.prototype={internalStream:function(p){var n=null,d="string";try{if(!p)throw new Error("No output type specified.");var l=(d=p.toLowerCase())==="string"||d==="text";d!=="binarystring"&&d!=="text"||(d="string"),n=this._decompressWorker();var m=!this._dataBinary;m&&!l&&(n=n.pipe(new c.Utf8EncodeWorker)),!m&&l&&(n=n.pipe(new c.Utf8DecodeWorker))}catch(w){(n=new v("error")).error(w)}return new s(n,d,"")},async:function(p,n){return this.internalStream(p).accumulate(n)},nodeStream:function(p,n){return this.internalStream(p||"nodebuffer").toNodejsStream(n)},_compressWorker:function(p,n){if(this._data instanceof b&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var d=this._decompressWorker();return this._dataBinary||(d=d.pipe(new c.Utf8EncodeWorker)),b.createWorkerFrom(d,p,n)},_decompressWorker:function(){return this._data instanceof b?this._data.getContentWorker():this._data instanceof v?this._data:new r(this._data)}};for(var g=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],_=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},a=0;a<g.length;a++)i.prototype[g[a]]=_;k.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(o,k,u){(function(i){var s,r,c=i.MutationObserver||i.WebKitMutationObserver;if(c){var b=0,v=new c(p),g=i.document.createTextNode("");v.observe(g,{characterData:!0}),s=function(){g.data=b=++b%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var n=i.document.createElement("script");n.onreadystatechange=function(){p(),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},i.document.documentElement.appendChild(n)}:function(){setTimeout(p,0)};else{var _=new i.MessageChannel;_.port1.onmessage=p,s=function(){_.port2.postMessage(0)}}var a=[];function p(){var n,d;r=!0;for(var l=a.length;l;){for(d=a,a=[],n=-1;++n<l;)d[n]();l=a.length}r=!1}k.exports=function(n){a.push(n)!==1||r||s()}}).call(this,typeof kt<"u"?kt:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(o,k,u){var i=o("immediate");function s(){}var r={},c=["REJECTED"],b=["FULFILLED"],v=["PENDING"];function g(l){if(typeof l!="function")throw new TypeError("resolver must be a function");this.state=v,this.queue=[],this.outcome=void 0,l!==s&&n(this,l)}function _(l,m,w){this.promise=l,typeof m=="function"&&(this.onFulfilled=m,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function a(l,m,w){i(function(){var z;try{z=m(w)}catch(S){return r.reject(l,S)}z===l?r.reject(l,new TypeError("Cannot resolve promise with itself")):r.resolve(l,z)})}function p(l){var m=l&&l.then;if(l&&(typeof l=="object"||typeof l=="function")&&typeof m=="function")return function(){m.apply(l,arguments)}}function n(l,m){var w=!1;function z(j){w||(w=!0,r.reject(l,j))}function S(j){w||(w=!0,r.resolve(l,j))}var P=d(function(){m(S,z)});P.status==="error"&&z(P.value)}function d(l,m){var w={};try{w.value=l(m),w.status="success"}catch(z){w.status="error",w.value=z}return w}(k.exports=g).prototype.finally=function(l){if(typeof l!="function")return this;var m=this.constructor;return this.then(function(w){return m.resolve(l()).then(function(){return w})},function(w){return m.resolve(l()).then(function(){throw w})})},g.prototype.catch=function(l){return this.then(null,l)},g.prototype.then=function(l,m){if(typeof l!="function"&&this.state===b||typeof m!="function"&&this.state===c)return this;var w=new this.constructor(s);return this.state!==v?a(w,this.state===b?l:m,this.outcome):this.queue.push(new _(w,l,m)),w},_.prototype.callFulfilled=function(l){r.resolve(this.promise,l)},_.prototype.otherCallFulfilled=function(l){a(this.promise,this.onFulfilled,l)},_.prototype.callRejected=function(l){r.reject(this.promise,l)},_.prototype.otherCallRejected=function(l){a(this.promise,this.onRejected,l)},r.resolve=function(l,m){var w=d(p,m);if(w.status==="error")return r.reject(l,w.value);var z=w.value;if(z)n(l,z);else{l.state=b,l.outcome=m;for(var S=-1,P=l.queue.length;++S<P;)l.queue[S].callFulfilled(m)}return l},r.reject=function(l,m){l.state=c,l.outcome=m;for(var w=-1,z=l.queue.length;++w<z;)l.queue[w].callRejected(m);return l},g.resolve=function(l){return l instanceof this?l:r.resolve(new this(s),l)},g.reject=function(l){var m=new this(s);return r.reject(m,l)},g.all=function(l){var m=this;if(Object.prototype.toString.call(l)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=l.length,z=!1;if(!w)return this.resolve([]);for(var S=new Array(w),P=0,j=-1,W=new this(s);++j<w;)O(l[j],j);return W;function O(G,J){m.resolve(G).then(function(y){S[J]=y,++P!==w||z||(z=!0,r.resolve(W,S))},function(y){z||(z=!0,r.reject(W,y))})}},g.race=function(l){var m=this;if(Object.prototype.toString.call(l)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=l.length,z=!1;if(!w)return this.resolve([]);for(var S=-1,P=new this(s);++S<w;)j=l[S],m.resolve(j).then(function(W){z||(z=!0,r.resolve(P,W))},function(W){z||(z=!0,r.reject(P,W))});var j;return P}},{immediate:36}],38:[function(o,k,u){var i={};(0,o("./lib/utils/common").assign)(i,o("./lib/deflate"),o("./lib/inflate"),o("./lib/zlib/constants")),k.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(o,k,u){var i=o("./zlib/deflate"),s=o("./utils/common"),r=o("./utils/strings"),c=o("./zlib/messages"),b=o("./zlib/zstream"),v=Object.prototype.toString,g=0,_=-1,a=0,p=8;function n(l){if(!(this instanceof n))return new n(l);this.options=s.assign({level:_,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:a,to:""},l||{});var m=this.options;m.raw&&0<m.windowBits?m.windowBits=-m.windowBits:m.gzip&&0<m.windowBits&&m.windowBits<16&&(m.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new b,this.strm.avail_out=0;var w=i.deflateInit2(this.strm,m.level,m.method,m.windowBits,m.memLevel,m.strategy);if(w!==g)throw new Error(c[w]);if(m.header&&i.deflateSetHeader(this.strm,m.header),m.dictionary){var z;if(z=typeof m.dictionary=="string"?r.string2buf(m.dictionary):v.call(m.dictionary)==="[object ArrayBuffer]"?new Uint8Array(m.dictionary):m.dictionary,(w=i.deflateSetDictionary(this.strm,z))!==g)throw new Error(c[w]);this._dict_set=!0}}function d(l,m){var w=new n(m);if(w.push(l,!0),w.err)throw w.msg||c[w.err];return w.result}n.prototype.push=function(l,m){var w,z,S=this.strm,P=this.options.chunkSize;if(this.ended)return!1;z=m===~~m?m:m===!0?4:0,typeof l=="string"?S.input=r.string2buf(l):v.call(l)==="[object ArrayBuffer]"?S.input=new Uint8Array(l):S.input=l,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new s.Buf8(P),S.next_out=0,S.avail_out=P),(w=i.deflate(S,z))!==1&&w!==g)return this.onEnd(w),!(this.ended=!0);S.avail_out!==0&&(S.avail_in!==0||z!==4&&z!==2)||(this.options.to==="string"?this.onData(r.buf2binstring(s.shrinkBuf(S.output,S.next_out))):this.onData(s.shrinkBuf(S.output,S.next_out)))}while((0<S.avail_in||S.avail_out===0)&&w!==1);return z===4?(w=i.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===g):z!==2||(this.onEnd(g),!(S.avail_out=0))},n.prototype.onData=function(l){this.chunks.push(l)},n.prototype.onEnd=function(l){l===g&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=l,this.msg=this.strm.msg},u.Deflate=n,u.deflate=d,u.deflateRaw=function(l,m){return(m=m||{}).raw=!0,d(l,m)},u.gzip=function(l,m){return(m=m||{}).gzip=!0,d(l,m)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(o,k,u){var i=o("./zlib/inflate"),s=o("./utils/common"),r=o("./utils/strings"),c=o("./zlib/constants"),b=o("./zlib/messages"),v=o("./zlib/zstream"),g=o("./zlib/gzheader"),_=Object.prototype.toString;function a(n){if(!(this instanceof a))return new a(n);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},n||{});var d=this.options;d.raw&&0<=d.windowBits&&d.windowBits<16&&(d.windowBits=-d.windowBits,d.windowBits===0&&(d.windowBits=-15)),!(0<=d.windowBits&&d.windowBits<16)||n&&n.windowBits||(d.windowBits+=32),15<d.windowBits&&d.windowBits<48&&(15&d.windowBits)==0&&(d.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new v,this.strm.avail_out=0;var l=i.inflateInit2(this.strm,d.windowBits);if(l!==c.Z_OK)throw new Error(b[l]);this.header=new g,i.inflateGetHeader(this.strm,this.header)}function p(n,d){var l=new a(d);if(l.push(n,!0),l.err)throw l.msg||b[l.err];return l.result}a.prototype.push=function(n,d){var l,m,w,z,S,P,j=this.strm,W=this.options.chunkSize,O=this.options.dictionary,G=!1;if(this.ended)return!1;m=d===~~d?d:d===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof n=="string"?j.input=r.binstring2buf(n):_.call(n)==="[object ArrayBuffer]"?j.input=new Uint8Array(n):j.input=n,j.next_in=0,j.avail_in=j.input.length;do{if(j.avail_out===0&&(j.output=new s.Buf8(W),j.next_out=0,j.avail_out=W),(l=i.inflate(j,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&O&&(P=typeof O=="string"?r.string2buf(O):_.call(O)==="[object ArrayBuffer]"?new Uint8Array(O):O,l=i.inflateSetDictionary(this.strm,P)),l===c.Z_BUF_ERROR&&G===!0&&(l=c.Z_OK,G=!1),l!==c.Z_STREAM_END&&l!==c.Z_OK)return this.onEnd(l),!(this.ended=!0);j.next_out&&(j.avail_out!==0&&l!==c.Z_STREAM_END&&(j.avail_in!==0||m!==c.Z_FINISH&&m!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=r.utf8border(j.output,j.next_out),z=j.next_out-w,S=r.buf2string(j.output,w),j.next_out=z,j.avail_out=W-z,z&&s.arraySet(j.output,j.output,w,z,0),this.onData(S)):this.onData(s.shrinkBuf(j.output,j.next_out)))),j.avail_in===0&&j.avail_out===0&&(G=!0)}while((0<j.avail_in||j.avail_out===0)&&l!==c.Z_STREAM_END);return l===c.Z_STREAM_END&&(m=c.Z_FINISH),m===c.Z_FINISH?(l=i.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,l===c.Z_OK):m!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(j.avail_out=0))},a.prototype.onData=function(n){this.chunks.push(n)},a.prototype.onEnd=function(n){n===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg},u.Inflate=a,u.inflate=p,u.inflateRaw=function(n,d){return(d=d||{}).raw=!0,p(n,d)},u.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(o,k,u){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";u.assign=function(c){for(var b=Array.prototype.slice.call(arguments,1);b.length;){var v=b.shift();if(v){if(typeof v!="object")throw new TypeError(v+"must be non-object");for(var g in v)v.hasOwnProperty(g)&&(c[g]=v[g])}}return c},u.shrinkBuf=function(c,b){return c.length===b?c:c.subarray?c.subarray(0,b):(c.length=b,c)};var s={arraySet:function(c,b,v,g,_){if(b.subarray&&c.subarray)c.set(b.subarray(v,v+g),_);else for(var a=0;a<g;a++)c[_+a]=b[v+a]},flattenChunks:function(c){var b,v,g,_,a,p;for(b=g=0,v=c.length;b<v;b++)g+=c[b].length;for(p=new Uint8Array(g),b=_=0,v=c.length;b<v;b++)a=c[b],p.set(a,_),_+=a.length;return p}},r={arraySet:function(c,b,v,g,_){for(var a=0;a<g;a++)c[_+a]=b[v+a]},flattenChunks:function(c){return[].concat.apply([],c)}};u.setTyped=function(c){c?(u.Buf8=Uint8Array,u.Buf16=Uint16Array,u.Buf32=Int32Array,u.assign(u,s)):(u.Buf8=Array,u.Buf16=Array,u.Buf32=Array,u.assign(u,r))},u.setTyped(i)},{}],42:[function(o,k,u){var i=o("./common"),s=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{r=!1}for(var c=new i.Buf8(256),b=0;b<256;b++)c[b]=252<=b?6:248<=b?5:240<=b?4:224<=b?3:192<=b?2:1;function v(g,_){if(_<65537&&(g.subarray&&r||!g.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(g,_));for(var a="",p=0;p<_;p++)a+=String.fromCharCode(g[p]);return a}c[254]=c[254]=1,u.string2buf=function(g){var _,a,p,n,d,l=g.length,m=0;for(n=0;n<l;n++)(64512&(a=g.charCodeAt(n)))==55296&&n+1<l&&(64512&(p=g.charCodeAt(n+1)))==56320&&(a=65536+(a-55296<<10)+(p-56320),n++),m+=a<128?1:a<2048?2:a<65536?3:4;for(_=new i.Buf8(m),n=d=0;d<m;n++)(64512&(a=g.charCodeAt(n)))==55296&&n+1<l&&(64512&(p=g.charCodeAt(n+1)))==56320&&(a=65536+(a-55296<<10)+(p-56320),n++),a<128?_[d++]=a:(a<2048?_[d++]=192|a>>>6:(a<65536?_[d++]=224|a>>>12:(_[d++]=240|a>>>18,_[d++]=128|a>>>12&63),_[d++]=128|a>>>6&63),_[d++]=128|63&a);return _},u.buf2binstring=function(g){return v(g,g.length)},u.binstring2buf=function(g){for(var _=new i.Buf8(g.length),a=0,p=_.length;a<p;a++)_[a]=g.charCodeAt(a);return _},u.buf2string=function(g,_){var a,p,n,d,l=_||g.length,m=new Array(2*l);for(a=p=0;a<l;)if((n=g[a++])<128)m[p++]=n;else if(4<(d=c[n]))m[p++]=65533,a+=d-1;else{for(n&=d===2?31:d===3?15:7;1<d&&a<l;)n=n<<6|63&g[a++],d--;1<d?m[p++]=65533:n<65536?m[p++]=n:(n-=65536,m[p++]=55296|n>>10&1023,m[p++]=56320|1023&n)}return v(m,p)},u.utf8border=function(g,_){var a;for((_=_||g.length)>g.length&&(_=g.length),a=_-1;0<=a&&(192&g[a])==128;)a--;return a<0||a===0?_:a+c[g[a]]>_?a:_}},{"./common":41}],43:[function(o,k,u){k.exports=function(i,s,r,c){for(var b=65535&i|0,v=i>>>16&65535|0,g=0;r!==0;){for(r-=g=2e3<r?2e3:r;v=v+(b=b+s[c++]|0)|0,--g;);b%=65521,v%=65521}return b|v<<16|0}},{}],44:[function(o,k,u){k.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,k,u){var i=(function(){for(var s,r=[],c=0;c<256;c++){s=c;for(var b=0;b<8;b++)s=1&s?3988292384^s>>>1:s>>>1;r[c]=s}return r})();k.exports=function(s,r,c,b){var v=i,g=b+c;s^=-1;for(var _=b;_<g;_++)s=s>>>8^v[255&(s^r[_])];return-1^s}},{}],46:[function(o,k,u){var i,s=o("../utils/common"),r=o("./trees"),c=o("./adler32"),b=o("./crc32"),v=o("./messages"),g=0,_=4,a=0,p=-2,n=-1,d=4,l=2,m=8,w=9,z=286,S=30,P=19,j=2*z+1,W=15,O=3,G=258,J=G+O+1,y=42,R=113,e=1,T=2,tt=3,L=4;function et(t,B){return t.msg=v[B],B}function Z(t){return(t<<1)-(4<t?9:0)}function Q(t){for(var B=t.length;0<=--B;)t[B]=0}function I(t){var B=t.state,N=B.pending;N>t.avail_out&&(N=t.avail_out),N!==0&&(s.arraySet(t.output,B.pending_buf,B.pending_out,N,t.next_out),t.next_out+=N,B.pending_out+=N,t.total_out+=N,t.avail_out-=N,B.pending-=N,B.pending===0&&(B.pending_out=0))}function A(t,B){r._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,B),t.block_start=t.strstart,I(t.strm)}function q(t,B){t.pending_buf[t.pending++]=B}function Y(t,B){t.pending_buf[t.pending++]=B>>>8&255,t.pending_buf[t.pending++]=255&B}function K(t,B){var N,f,h=t.max_chain_length,x=t.strstart,F=t.prev_length,U=t.nice_match,C=t.strstart>t.w_size-J?t.strstart-(t.w_size-J):0,M=t.window,X=t.w_mask,V=t.prev,$=t.strstart+G,st=M[x+F-1],nt=M[x+F];t.prev_length>=t.good_match&&(h>>=2),U>t.lookahead&&(U=t.lookahead);do if(M[(N=B)+F]===nt&&M[N+F-1]===st&&M[N]===M[x]&&M[++N]===M[x+1]){x+=2,N++;do;while(M[++x]===M[++N]&&M[++x]===M[++N]&&M[++x]===M[++N]&&M[++x]===M[++N]&&M[++x]===M[++N]&&M[++x]===M[++N]&&M[++x]===M[++N]&&M[++x]===M[++N]&&x<$);if(f=G-($-x),x=$-G,F<f){if(t.match_start=B,U<=(F=f))break;st=M[x+F-1],nt=M[x+F]}}while((B=V[B&X])>C&&--h!=0);return F<=t.lookahead?F:t.lookahead}function at(t){var B,N,f,h,x,F,U,C,M,X,V=t.w_size;do{if(h=t.window_size-t.lookahead-t.strstart,t.strstart>=V+(V-J)){for(s.arraySet(t.window,t.window,V,V,0),t.match_start-=V,t.strstart-=V,t.block_start-=V,B=N=t.hash_size;f=t.head[--B],t.head[B]=V<=f?f-V:0,--N;);for(B=N=V;f=t.prev[--B],t.prev[B]=V<=f?f-V:0,--N;);h+=V}if(t.strm.avail_in===0)break;if(F=t.strm,U=t.window,C=t.strstart+t.lookahead,M=h,X=void 0,X=F.avail_in,M<X&&(X=M),N=X===0?0:(F.avail_in-=X,s.arraySet(U,F.input,F.next_in,X,C),F.state.wrap===1?F.adler=c(F.adler,U,X,C):F.state.wrap===2&&(F.adler=b(F.adler,U,X,C)),F.next_in+=X,F.total_in+=X,X),t.lookahead+=N,t.lookahead+t.insert>=O)for(x=t.strstart-t.insert,t.ins_h=t.window[x],t.ins_h=(t.ins_h<<t.hash_shift^t.window[x+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[x+O-1])&t.hash_mask,t.prev[x&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=x,x++,t.insert--,!(t.lookahead+t.insert<O)););}while(t.lookahead<J&&t.strm.avail_in!==0)}function ct(t,B){for(var N,f;;){if(t.lookahead<J){if(at(t),t.lookahead<J&&B===g)return e;if(t.lookahead===0)break}if(N=0,t.lookahead>=O&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+O-1])&t.hash_mask,N=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),N!==0&&t.strstart-N<=t.w_size-J&&(t.match_length=K(t,N)),t.match_length>=O)if(f=r._tr_tally(t,t.strstart-t.match_start,t.match_length-O),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=O){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+O-1])&t.hash_mask,N=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 f=r._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(f&&(A(t,!1),t.strm.avail_out===0))return e}return t.insert=t.strstart<O-1?t.strstart:O-1,B===_?(A(t,!0),t.strm.avail_out===0?tt:L):t.last_lit&&(A(t,!1),t.strm.avail_out===0)?e:T}function rt(t,B){for(var N,f,h;;){if(t.lookahead<J){if(at(t),t.lookahead<J&&B===g)return e;if(t.lookahead===0)break}if(N=0,t.lookahead>=O&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+O-1])&t.hash_mask,N=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=O-1,N!==0&&t.prev_length<t.max_lazy_match&&t.strstart-N<=t.w_size-J&&(t.match_length=K(t,N),t.match_length<=5&&(t.strategy===1||t.match_length===O&&4096<t.strstart-t.match_start)&&(t.match_length=O-1)),t.prev_length>=O&&t.match_length<=t.prev_length){for(h=t.strstart+t.lookahead-O,f=r._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-O),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=h&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+O-1])&t.hash_mask,N=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=O-1,t.strstart++,f&&(A(t,!1),t.strm.avail_out===0))return e}else if(t.match_available){if((f=r._tr_tally(t,0,t.window[t.strstart-1]))&&A(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&&(f=r._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<O-1?t.strstart:O-1,B===_?(A(t,!0),t.strm.avail_out===0?tt:L):t.last_lit&&(A(t,!1),t.strm.avail_out===0)?e:T}function it(t,B,N,f,h){this.good_length=t,this.max_lazy=B,this.nice_length=N,this.max_chain=f,this.func=h}function ut(){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=m,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 s.Buf16(2*j),this.dyn_dtree=new s.Buf16(2*(2*S+1)),this.bl_tree=new s.Buf16(2*(2*P+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 s.Buf16(W+1),this.heap=new s.Buf16(2*z+1),Q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*z+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 B;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=l,(B=t.state).pending=0,B.pending_out=0,B.wrap<0&&(B.wrap=-B.wrap),B.status=B.wrap?y:R,t.adler=B.wrap===2?0:1,B.last_flush=g,r._tr_init(B),a):et(t,p)}function ft(t){var B=ot(t);return B===a&&(function(N){N.window_size=2*N.w_size,Q(N.head),N.max_lazy_match=i[N.level].max_lazy,N.good_match=i[N.level].good_length,N.nice_match=i[N.level].nice_length,N.max_chain_length=i[N.level].max_chain,N.strstart=0,N.block_start=0,N.lookahead=0,N.insert=0,N.match_length=N.prev_length=O-1,N.match_available=0,N.ins_h=0})(t.state),B}function dt(t,B,N,f,h,x){if(!t)return p;var F=1;if(B===n&&(B=6),f<0?(F=0,f=-f):15<f&&(F=2,f-=16),h<1||w<h||N!==m||f<8||15<f||B<0||9<B||x<0||d<x)return et(t,p);f===8&&(f=9);var U=new ut;return(t.state=U).strm=t,U.wrap=F,U.gzhead=null,U.w_bits=f,U.w_size=1<<U.w_bits,U.w_mask=U.w_size-1,U.hash_bits=h+7,U.hash_size=1<<U.hash_bits,U.hash_mask=U.hash_size-1,U.hash_shift=~~((U.hash_bits+O-1)/O),U.window=new s.Buf8(2*U.w_size),U.head=new s.Buf16(U.hash_size),U.prev=new s.Buf16(U.w_size),U.lit_bufsize=1<<h+6,U.pending_buf_size=4*U.lit_bufsize,U.pending_buf=new s.Buf8(U.pending_buf_size),U.d_buf=1*U.lit_bufsize,U.l_buf=3*U.lit_bufsize,U.level=B,U.strategy=x,U.method=N,ft(t)}i=[new it(0,0,0,0,function(t,B){var N=65535;for(N>t.pending_buf_size-5&&(N=t.pending_buf_size-5);;){if(t.lookahead<=1){if(at(t),t.lookahead===0&&B===g)return e;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var f=t.block_start+N;if((t.strstart===0||t.strstart>=f)&&(t.lookahead=t.strstart-f,t.strstart=f,A(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-J&&(A(t,!1),t.strm.avail_out===0))return e}return t.insert=0,B===_?(A(t,!0),t.strm.avail_out===0?tt:L):(t.strstart>t.block_start&&(A(t,!1),t.strm.avail_out),e)}),new it(4,4,8,4,ct),new it(4,5,16,8,ct),new it(4,6,32,32,ct),new it(4,4,16,16,rt),new it(8,16,32,32,rt),new it(8,16,128,128,rt),new it(8,32,128,256,rt),new it(32,128,258,1024,rt),new it(32,258,258,4096,rt)],u.deflateInit=function(t,B){return dt(t,B,m,15,8,0)},u.deflateInit2=dt,u.deflateReset=ft,u.deflateResetKeep=ot,u.deflateSetHeader=function(t,B){return t&&t.state?t.state.wrap!==2?p:(t.state.gzhead=B,a):p},u.deflate=function(t,B){var N,f,h,x;if(!t||!t.state||5<B||B<0)return t?et(t,p):p;if(f=t.state,!t.output||!t.input&&t.avail_in!==0||f.status===666&&B!==_)return et(t,t.avail_out===0?-5:p);if(f.strm=t,N=f.last_flush,f.last_flush=B,f.status===y)if(f.wrap===2)t.adler=0,q(f,31),q(f,139),q(f,8),f.gzhead?(q(f,(f.gzhead.text?1:0)+(f.gzhead.hcrc?2:0)+(f.gzhead.extra?4:0)+(f.gzhead.name?8:0)+(f.gzhead.comment?16:0)),q(f,255&f.gzhead.time),q(f,f.gzhead.time>>8&255),q(f,f.gzhead.time>>16&255),q(f,f.gzhead.time>>24&255),q(f,f.level===9?2:2<=f.strategy||f.level<2?4:0),q(f,255&f.gzhead.os),f.gzhead.extra&&f.gzhead.extra.length&&(q(f,255&f.gzhead.extra.length),q(f,f.gzhead.extra.length>>8&255)),f.gzhead.hcrc&&(t.adler=b(t.adler,f.pending_buf,f.pending,0)),f.gzindex=0,f.status=69):(q(f,0),q(f,0),q(f,0),q(f,0),q(f,0),q(f,f.level===9?2:2<=f.strategy||f.level<2?4:0),q(f,3),f.status=R);else{var F=m+(f.w_bits-8<<4)<<8;F|=(2<=f.strategy||f.level<2?0:f.level<6?1:f.level===6?2:3)<<6,f.strstart!==0&&(F|=32),F+=31-F%31,f.status=R,Y(f,F),f.strstart!==0&&(Y(f,t.adler>>>16),Y(f,65535&t.adler)),t.adler=1}if(f.status===69)if(f.gzhead.extra){for(h=f.pending;f.gzindex<(65535&f.gzhead.extra.length)&&(f.pending!==f.pending_buf_size||(f.gzhead.hcrc&&f.pending>h&&(t.adler=b(t.adler,f.pending_buf,f.pending-h,h)),I(t),h=f.pending,f.pending!==f.pending_buf_size));)q(f,255&f.gzhead.extra[f.gzindex]),f.gzindex++;f.gzhead.hcrc&&f.pending>h&&(t.adler=b(t.adler,f.pending_buf,f.pending-h,h)),f.gzindex===f.gzhead.extra.length&&(f.gzindex=0,f.status=73)}else f.status=73;if(f.status===73)if(f.gzhead.name){h=f.pending;do{if(f.pending===f.pending_buf_size&&(f.gzhead.hcrc&&f.pending>h&&(t.adler=b(t.adler,f.pending_buf,f.pending-h,h)),I(t),h=f.pending,f.pending===f.pending_buf_size)){x=1;break}x=f.gzindex<f.gzhead.name.length?255&f.gzhead.name.charCodeAt(f.gzindex++):0,q(f,x)}while(x!==0);f.gzhead.hcrc&&f.pending>h&&(t.adler=b(t.adler,f.pending_buf,f.pending-h,h)),x===0&&(f.gzindex=0,f.status=91)}else f.status=91;if(f.status===91)if(f.gzhead.comment){h=f.pending;do{if(f.pending===f.pending_buf_size&&(f.gzhead.hcrc&&f.pending>h&&(t.adler=b(t.adler,f.pending_buf,f.pending-h,h)),I(t),h=f.pending,f.pending===f.pending_buf_size)){x=1;break}x=f.gzindex<f.gzhead.comment.length?255&f.gzhead.comment.charCodeAt(f.gzindex++):0,q(f,x)}while(x!==0);f.gzhead.hcrc&&f.pending>h&&(t.adler=b(t.adler,f.pending_buf,f.pending-h,h)),x===0&&(f.status=103)}else f.status=103;if(f.status===103&&(f.gzhead.hcrc?(f.pending+2>f.pending_buf_size&&I(t),f.pending+2<=f.pending_buf_size&&(q(f,255&t.adler),q(f,t.adler>>8&255),t.adler=0,f.status=R)):f.status=R),f.pending!==0){if(I(t),t.avail_out===0)return f.last_flush=-1,a}else if(t.avail_in===0&&Z(B)<=Z(N)&&B!==_)return et(t,-5);if(f.status===666&&t.avail_in!==0)return et(t,-5);if(t.avail_in!==0||f.lookahead!==0||B!==g&&f.status!==666){var U=f.strategy===2?(function(C,M){for(var X;;){if(C.lookahead===0&&(at(C),C.lookahead===0)){if(M===g)return e;break}if(C.match_length=0,X=r._tr_tally(C,0,C.window[C.strstart]),C.lookahead--,C.strstart++,X&&(A(C,!1),C.strm.avail_out===0))return e}return C.insert=0,M===_?(A(C,!0),C.strm.avail_out===0?tt:L):C.last_lit&&(A(C,!1),C.strm.avail_out===0)?e:T})(f,B):f.strategy===3?(function(C,M){for(var X,V,$,st,nt=C.window;;){if(C.lookahead<=G){if(at(C),C.lookahead<=G&&M===g)return e;if(C.lookahead===0)break}if(C.match_length=0,C.lookahead>=O&&0<C.strstart&&(V=nt[$=C.strstart-1])===nt[++$]&&V===nt[++$]&&V===nt[++$]){st=C.strstart+G;do;while(V===nt[++$]&&V===nt[++$]&&V===nt[++$]&&V===nt[++$]&&V===nt[++$]&&V===nt[++$]&&V===nt[++$]&&V===nt[++$]&&$<st);C.match_length=G-(st-$),C.match_length>C.lookahead&&(C.match_length=C.lookahead)}if(C.match_length>=O?(X=r._tr_tally(C,1,C.match_length-O),C.lookahead-=C.match_length,C.strstart+=C.match_length,C.match_length=0):(X=r._tr_tally(C,0,C.window[C.strstart]),C.lookahead--,C.strstart++),X&&(A(C,!1),C.strm.avail_out===0))return e}return C.insert=0,M===_?(A(C,!0),C.strm.avail_out===0?tt:L):C.last_lit&&(A(C,!1),C.strm.avail_out===0)?e:T})(f,B):i[f.level].func(f,B);if(U!==tt&&U!==L||(f.status=666),U===e||U===tt)return t.avail_out===0&&(f.last_flush=-1),a;if(U===T&&(B===1?r._tr_align(f):B!==5&&(r._tr_stored_block(f,0,0,!1),B===3&&(Q(f.head),f.lookahead===0&&(f.strstart=0,f.block_start=0,f.insert=0))),I(t),t.avail_out===0))return f.last_flush=-1,a}return B!==_?a:f.wrap<=0?1:(f.wrap===2?(q(f,255&t.adler),q(f,t.adler>>8&255),q(f,t.adler>>16&255),q(f,t.adler>>24&255),q(f,255&t.total_in),q(f,t.total_in>>8&255),q(f,t.total_in>>16&255),q(f,t.total_in>>24&255)):(Y(f,t.adler>>>16),Y(f,65535&t.adler)),I(t),0<f.wrap&&(f.wrap=-f.wrap),f.pending!==0?a:1)},u.deflateEnd=function(t){var B;return t&&t.state?(B=t.state.status)!==y&&B!==69&&B!==73&&B!==91&&B!==103&&B!==R&&B!==666?et(t,p):(t.state=null,B===R?et(t,-3):a):p},u.deflateSetDictionary=function(t,B){var N,f,h,x,F,U,C,M,X=B.length;if(!t||!t.state||(x=(N=t.state).wrap)===2||x===1&&N.status!==y||N.lookahead)return p;for(x===1&&(t.adler=c(t.adler,B,X,0)),N.wrap=0,X>=N.w_size&&(x===0&&(Q(N.head),N.strstart=0,N.block_start=0,N.insert=0),M=new s.Buf8(N.w_size),s.arraySet(M,B,X-N.w_size,N.w_size,0),B=M,X=N.w_size),F=t.avail_in,U=t.next_in,C=t.input,t.avail_in=X,t.next_in=0,t.input=B,at(N);N.lookahead>=O;){for(f=N.strstart,h=N.lookahead-(O-1);N.ins_h=(N.ins_h<<N.hash_shift^N.window[f+O-1])&N.hash_mask,N.prev[f&N.w_mask]=N.head[N.ins_h],N.head[N.ins_h]=f,f++,--h;);N.strstart=f,N.lookahead=O-1,at(N)}return N.strstart+=N.lookahead,N.block_start=N.strstart,N.insert=N.lookahead,N.lookahead=0,N.match_length=N.prev_length=O-1,N.match_available=0,t.next_in=U,t.input=C,t.avail_in=F,N.wrap=x,a},u.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(o,k,u){k.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,k,u){k.exports=function(i,s){var r,c,b,v,g,_,a,p,n,d,l,m,w,z,S,P,j,W,O,G,J,y,R,e,T;r=i.state,c=i.next_in,e=i.input,b=c+(i.avail_in-5),v=i.next_out,T=i.output,g=v-(s-i.avail_out),_=v+(i.avail_out-257),a=r.dmax,p=r.wsize,n=r.whave,d=r.wnext,l=r.window,m=r.hold,w=r.bits,z=r.lencode,S=r.distcode,P=(1<<r.lenbits)-1,j=(1<<r.distbits)-1;t:do{w<15&&(m+=e[c++]<<w,w+=8,m+=e[c++]<<w,w+=8),W=z[m&P];e:for(;;){if(m>>>=O=W>>>24,w-=O,(O=W>>>16&255)===0)T[v++]=65535&W;else{if(!(16&O)){if((64&O)==0){W=z[(65535&W)+(m&(1<<O)-1)];continue e}if(32&O){r.mode=12;break t}i.msg="invalid literal/length code",r.mode=30;break t}G=65535&W,(O&=15)&&(w<O&&(m+=e[c++]<<w,w+=8),G+=m&(1<<O)-1,m>>>=O,w-=O),w<15&&(m+=e[c++]<<w,w+=8,m+=e[c++]<<w,w+=8),W=S[m&j];r:for(;;){if(m>>>=O=W>>>24,w-=O,!(16&(O=W>>>16&255))){if((64&O)==0){W=S[(65535&W)+(m&(1<<O)-1)];continue r}i.msg="invalid distance code",r.mode=30;break t}if(J=65535&W,w<(O&=15)&&(m+=e[c++]<<w,(w+=8)<O&&(m+=e[c++]<<w,w+=8)),a<(J+=m&(1<<O)-1)){i.msg="invalid distance too far back",r.mode=30;break t}if(m>>>=O,w-=O,(O=v-g)<J){if(n<(O=J-O)&&r.sane){i.msg="invalid distance too far back",r.mode=30;break t}if(R=l,(y=0)===d){if(y+=p-O,O<G){for(G-=O;T[v++]=l[y++],--O;);y=v-J,R=T}}else if(d<O){if(y+=p+d-O,(O-=d)<G){for(G-=O;T[v++]=l[y++],--O;);if(y=0,d<G){for(G-=O=d;T[v++]=l[y++],--O;);y=v-J,R=T}}}else if(y+=d-O,O<G){for(G-=O;T[v++]=l[y++],--O;);y=v-J,R=T}for(;2<G;)T[v++]=R[y++],T[v++]=R[y++],T[v++]=R[y++],G-=3;G&&(T[v++]=R[y++],1<G&&(T[v++]=R[y++]))}else{for(y=v-J;T[v++]=T[y++],T[v++]=T[y++],T[v++]=T[y++],2<(G-=3););G&&(T[v++]=T[y++],1<G&&(T[v++]=T[y++]))}break}}break}}while(c<b&&v<_);c-=G=w>>3,m&=(1<<(w-=G<<3))-1,i.next_in=c,i.next_out=v,i.avail_in=c<b?b-c+5:5-(c-b),i.avail_out=v<_?_-v+257:257-(v-_),r.hold=m,r.bits=w}},{}],49:[function(o,k,u){var i=o("../utils/common"),s=o("./adler32"),r=o("./crc32"),c=o("./inffast"),b=o("./inftrees"),v=1,g=2,_=0,a=-2,p=1,n=852,d=592;function l(y){return(y>>>24&255)+(y>>>8&65280)+((65280&y)<<8)+((255&y)<<24)}function m(){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 w(y){var R;return y&&y.state?(R=y.state,y.total_in=y.total_out=R.total=0,y.msg="",R.wrap&&(y.adler=1&R.wrap),R.mode=p,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(n),R.distcode=R.distdyn=new i.Buf32(d),R.sane=1,R.back=-1,_):a}function z(y){var R;return y&&y.state?((R=y.state).wsize=0,R.whave=0,R.wnext=0,w(y)):a}function S(y,R){var e,T;return y&&y.state?(T=y.state,R<0?(e=0,R=-R):(e=1+(R>>4),R<48&&(R&=15)),R&&(R<8||15<R)?a:(T.window!==null&&T.wbits!==R&&(T.window=null),T.wrap=e,T.wbits=R,z(y))):a}function P(y,R){var e,T;return y?(T=new m,(y.state=T).window=null,(e=S(y,R))!==_&&(y.state=null),e):a}var j,W,O=!0;function G(y){if(O){var R;for(j=new i.Buf32(512),W=new i.Buf32(32),R=0;R<144;)y.lens[R++]=8;for(;R<256;)y.lens[R++]=9;for(;R<280;)y.lens[R++]=7;for(;R<288;)y.lens[R++]=8;for(b(v,y.lens,0,288,j,0,y.work,{bits:9}),R=0;R<32;)y.lens[R++]=5;b(g,y.lens,0,32,W,0,y.work,{bits:5}),O=!1}y.lencode=j,y.lenbits=9,y.distcode=W,y.distbits=5}function J(y,R,e,T){var tt,L=y.state;return L.window===null&&(L.wsize=1<<L.wbits,L.wnext=0,L.whave=0,L.window=new i.Buf8(L.wsize)),T>=L.wsize?(i.arraySet(L.window,R,e-L.wsize,L.wsize,0),L.wnext=0,L.whave=L.wsize):(T<(tt=L.wsize-L.wnext)&&(tt=T),i.arraySet(L.window,R,e-T,tt,L.wnext),(T-=tt)?(i.arraySet(L.window,R,e-T,T,0),L.wnext=T,L.whave=L.wsize):(L.wnext+=tt,L.wnext===L.wsize&&(L.wnext=0),L.whave<L.wsize&&(L.whave+=tt))),0}u.inflateReset=z,u.inflateReset2=S,u.inflateResetKeep=w,u.inflateInit=function(y){return P(y,15)},u.inflateInit2=P,u.inflate=function(y,R){var e,T,tt,L,et,Z,Q,I,A,q,Y,K,at,ct,rt,it,ut,ot,ft,dt,t,B,N,f,h=0,x=new i.Buf8(4),F=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!y||!y.state||!y.output||!y.input&&y.avail_in!==0)return a;(e=y.state).mode===12&&(e.mode=13),et=y.next_out,tt=y.output,Q=y.avail_out,L=y.next_in,T=y.input,Z=y.avail_in,I=e.hold,A=e.bits,q=Z,Y=Q,B=_;t:for(;;)switch(e.mode){case p:if(e.wrap===0){e.mode=13;break}for(;A<16;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}if(2&e.wrap&&I===35615){x[e.check=0]=255&I,x[1]=I>>>8&255,e.check=r(e.check,x,2,0),A=I=0,e.mode=2;break}if(e.flags=0,e.head&&(e.head.done=!1),!(1&e.wrap)||(((255&I)<<8)+(I>>8))%31){y.msg="incorrect header check",e.mode=30;break}if((15&I)!=8){y.msg="unknown compression method",e.mode=30;break}if(A-=4,t=8+(15&(I>>>=4)),e.wbits===0)e.wbits=t;else if(t>e.wbits){y.msg="invalid window size",e.mode=30;break}e.dmax=1<<t,y.adler=e.check=1,e.mode=512&I?10:12,A=I=0;break;case 2:for(;A<16;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}if(e.flags=I,(255&e.flags)!=8){y.msg="unknown compression method",e.mode=30;break}if(57344&e.flags){y.msg="unknown header flags set",e.mode=30;break}e.head&&(e.head.text=I>>8&1),512&e.flags&&(x[0]=255&I,x[1]=I>>>8&255,e.check=r(e.check,x,2,0)),A=I=0,e.mode=3;case 3:for(;A<32;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}e.head&&(e.head.time=I),512&e.flags&&(x[0]=255&I,x[1]=I>>>8&255,x[2]=I>>>16&255,x[3]=I>>>24&255,e.check=r(e.check,x,4,0)),A=I=0,e.mode=4;case 4:for(;A<16;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}e.head&&(e.head.xflags=255&I,e.head.os=I>>8),512&e.flags&&(x[0]=255&I,x[1]=I>>>8&255,e.check=r(e.check,x,2,0)),A=I=0,e.mode=5;case 5:if(1024&e.flags){for(;A<16;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}e.length=I,e.head&&(e.head.extra_len=I),512&e.flags&&(x[0]=255&I,x[1]=I>>>8&255,e.check=r(e.check,x,2,0)),A=I=0}else e.head&&(e.head.extra=null);e.mode=6;case 6:if(1024&e.flags&&(Z<(K=e.length)&&(K=Z),K&&(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,T,L,K,t)),512&e.flags&&(e.check=r(e.check,T,K,L)),Z-=K,L+=K,e.length-=K),e.length))break t;e.length=0,e.mode=7;case 7:if(2048&e.flags){if(Z===0)break t;for(K=0;t=T[L+K++],e.head&&t&&e.length<65536&&(e.head.name+=String.fromCharCode(t)),t&&K<Z;);if(512&e.flags&&(e.check=r(e.check,T,K,L)),Z-=K,L+=K,t)break t}else e.head&&(e.head.name=null);e.length=0,e.mode=8;case 8:if(4096&e.flags){if(Z===0)break t;for(K=0;t=T[L+K++],e.head&&t&&e.length<65536&&(e.head.comment+=String.fromCharCode(t)),t&&K<Z;);if(512&e.flags&&(e.check=r(e.check,T,K,L)),Z-=K,L+=K,t)break t}else e.head&&(e.head.comment=null);e.mode=9;case 9:if(512&e.flags){for(;A<16;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}if(I!==(65535&e.check)){y.msg="header crc mismatch",e.mode=30;break}A=I=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),y.adler=e.check=0,e.mode=12;break;case 10:for(;A<32;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}y.adler=e.check=l(I),A=I=0,e.mode=11;case 11:if(e.havedict===0)return y.next_out=et,y.avail_out=Q,y.next_in=L,y.avail_in=Z,e.hold=I,e.bits=A,2;y.adler=e.check=1,e.mode=12;case 12:if(R===5||R===6)break t;case 13:if(e.last){I>>>=7&A,A-=7&A,e.mode=27;break}for(;A<3;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}switch(e.last=1&I,A-=1,3&(I>>>=1)){case 0:e.mode=14;break;case 1:if(G(e),e.mode=20,R!==6)break;I>>>=2,A-=2;break t;case 2:e.mode=17;break;case 3:y.msg="invalid block type",e.mode=30}I>>>=2,A-=2;break;case 14:for(I>>>=7&A,A-=7&A;A<32;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}if((65535&I)!=(I>>>16^65535)){y.msg="invalid stored block lengths",e.mode=30;break}if(e.length=65535&I,A=I=0,e.mode=15,R===6)break t;case 15:e.mode=16;case 16:if(K=e.length){if(Z<K&&(K=Z),Q<K&&(K=Q),K===0)break t;i.arraySet(tt,T,L,K,et),Z-=K,L+=K,Q-=K,et+=K,e.length-=K;break}e.mode=12;break;case 17:for(;A<14;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}if(e.nlen=257+(31&I),I>>>=5,A-=5,e.ndist=1+(31&I),I>>>=5,A-=5,e.ncode=4+(15&I),I>>>=4,A-=4,286<e.nlen||30<e.ndist){y.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(;A<3;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}e.lens[F[e.have++]]=7&I,I>>>=3,A-=3}for(;e.have<19;)e.lens[F[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,N={bits:e.lenbits},B=b(0,e.lens,0,19,e.lencode,0,e.work,N),e.lenbits=N.bits,B){y.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(;it=(h=e.lencode[I&(1<<e.lenbits)-1])>>>16&255,ut=65535&h,!((rt=h>>>24)<=A);){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}if(ut<16)I>>>=rt,A-=rt,e.lens[e.have++]=ut;else{if(ut===16){for(f=rt+2;A<f;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}if(I>>>=rt,A-=rt,e.have===0){y.msg="invalid bit length repeat",e.mode=30;break}t=e.lens[e.have-1],K=3+(3&I),I>>>=2,A-=2}else if(ut===17){for(f=rt+3;A<f;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}A-=rt,t=0,K=3+(7&(I>>>=rt)),I>>>=3,A-=3}else{for(f=rt+7;A<f;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}A-=rt,t=0,K=11+(127&(I>>>=rt)),I>>>=7,A-=7}if(e.have+K>e.nlen+e.ndist){y.msg="invalid bit length repeat",e.mode=30;break}for(;K--;)e.lens[e.have++]=t}}if(e.mode===30)break;if(e.lens[256]===0){y.msg="invalid code -- missing end-of-block",e.mode=30;break}if(e.lenbits=9,N={bits:e.lenbits},B=b(v,e.lens,0,e.nlen,e.lencode,0,e.work,N),e.lenbits=N.bits,B){y.msg="invalid literal/lengths set",e.mode=30;break}if(e.distbits=6,e.distcode=e.distdyn,N={bits:e.distbits},B=b(g,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,N),e.distbits=N.bits,B){y.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<=Z&&258<=Q){y.next_out=et,y.avail_out=Q,y.next_in=L,y.avail_in=Z,e.hold=I,e.bits=A,c(y,Y),et=y.next_out,tt=y.output,Q=y.avail_out,L=y.next_in,T=y.input,Z=y.avail_in,I=e.hold,A=e.bits,e.mode===12&&(e.back=-1);break}for(e.back=0;it=(h=e.lencode[I&(1<<e.lenbits)-1])>>>16&255,ut=65535&h,!((rt=h>>>24)<=A);){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}if(it&&(240&it)==0){for(ot=rt,ft=it,dt=ut;it=(h=e.lencode[dt+((I&(1<<ot+ft)-1)>>ot)])>>>16&255,ut=65535&h,!(ot+(rt=h>>>24)<=A);){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}I>>>=ot,A-=ot,e.back+=ot}if(I>>>=rt,A-=rt,e.back+=rt,e.length=ut,it===0){e.mode=26;break}if(32&it){e.back=-1,e.mode=12;break}if(64&it){y.msg="invalid literal/length code",e.mode=30;break}e.extra=15&it,e.mode=22;case 22:if(e.extra){for(f=e.extra;A<f;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}e.length+=I&(1<<e.extra)-1,I>>>=e.extra,A-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=23;case 23:for(;it=(h=e.distcode[I&(1<<e.distbits)-1])>>>16&255,ut=65535&h,!((rt=h>>>24)<=A);){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}if((240&it)==0){for(ot=rt,ft=it,dt=ut;it=(h=e.distcode[dt+((I&(1<<ot+ft)-1)>>ot)])>>>16&255,ut=65535&h,!(ot+(rt=h>>>24)<=A);){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}I>>>=ot,A-=ot,e.back+=ot}if(I>>>=rt,A-=rt,e.back+=rt,64&it){y.msg="invalid distance code",e.mode=30;break}e.offset=ut,e.extra=15&it,e.mode=24;case 24:if(e.extra){for(f=e.extra;A<f;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}e.offset+=I&(1<<e.extra)-1,I>>>=e.extra,A-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){y.msg="invalid distance too far back",e.mode=30;break}e.mode=25;case 25:if(Q===0)break t;if(K=Y-Q,e.offset>K){if((K=e.offset-K)>e.whave&&e.sane){y.msg="invalid distance too far back",e.mode=30;break}at=K>e.wnext?(K-=e.wnext,e.wsize-K):e.wnext-K,K>e.length&&(K=e.length),ct=e.window}else ct=tt,at=et-e.offset,K=e.length;for(Q<K&&(K=Q),Q-=K,e.length-=K;tt[et++]=ct[at++],--K;);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(;A<32;){if(Z===0)break t;Z--,I|=T[L++]<<A,A+=8}if(Y-=Q,y.total_out+=Y,e.total+=Y,Y&&(y.adler=e.check=e.flags?r(e.check,tt,Y,et-Y):s(e.check,tt,Y,et-Y)),Y=Q,(e.flags?I:l(I))!==e.check){y.msg="incorrect data check",e.mode=30;break}A=I=0}e.mode=28;case 28:if(e.wrap&&e.flags){for(;A<32;){if(Z===0)break t;Z--,I+=T[L++]<<A,A+=8}if(I!==(4294967295&e.total)){y.msg="incorrect length check",e.mode=30;break}A=I=0}e.mode=29;case 29:B=1;break t;case 30:B=-3;break t;case 31:return-4;case 32:default:return a}return y.next_out=et,y.avail_out=Q,y.next_in=L,y.avail_in=Z,e.hold=I,e.bits=A,(e.wsize||Y!==y.avail_out&&e.mode<30&&(e.mode<27||R!==4))&&J(y,y.output,y.next_out,Y-y.avail_out)?(e.mode=31,-4):(q-=y.avail_in,Y-=y.avail_out,y.total_in+=q,y.total_out+=Y,e.total+=Y,e.wrap&&Y&&(y.adler=e.check=e.flags?r(e.check,tt,Y,y.next_out-Y):s(e.check,tt,Y,y.next_out-Y)),y.data_type=e.bits+(e.last?64:0)+(e.mode===12?128:0)+(e.mode===20||e.mode===15?256:0),(q==0&&Y===0||R===4)&&B===_&&(B=-5),B)},u.inflateEnd=function(y){if(!y||!y.state)return a;var R=y.state;return R.window&&(R.window=null),y.state=null,_},u.inflateGetHeader=function(y,R){var e;return y&&y.state?(2&(e=y.state).wrap)==0?a:((e.head=R).done=!1,_):a},u.inflateSetDictionary=function(y,R){var e,T=R.length;return y&&y.state?(e=y.state).wrap!==0&&e.mode!==11?a:e.mode===11&&s(1,R,T,0)!==e.check?-3:J(y,R,T,T)?(e.mode=31,-4):(e.havedict=1,_):a},u.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(o,k,u){var i=o("../utils/common"),s=[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],b=[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];k.exports=function(v,g,_,a,p,n,d,l){var m,w,z,S,P,j,W,O,G,J=l.bits,y=0,R=0,e=0,T=0,tt=0,L=0,et=0,Z=0,Q=0,I=0,A=null,q=0,Y=new i.Buf16(16),K=new i.Buf16(16),at=null,ct=0;for(y=0;y<=15;y++)Y[y]=0;for(R=0;R<a;R++)Y[g[_+R]]++;for(tt=J,T=15;1<=T&&Y[T]===0;T--);if(T<tt&&(tt=T),T===0)return p[n++]=20971520,p[n++]=20971520,l.bits=1,0;for(e=1;e<T&&Y[e]===0;e++);for(tt<e&&(tt=e),y=Z=1;y<=15;y++)if(Z<<=1,(Z-=Y[y])<0)return-1;if(0<Z&&(v===0||T!==1))return-1;for(K[1]=0,y=1;y<15;y++)K[y+1]=K[y]+Y[y];for(R=0;R<a;R++)g[_+R]!==0&&(d[K[g[_+R]]++]=R);if(j=v===0?(A=at=d,19):v===1?(A=s,q-=257,at=r,ct-=257,256):(A=c,at=b,-1),y=e,P=n,et=R=I=0,z=-1,S=(Q=1<<(L=tt))-1,v===1&&852<Q||v===2&&592<Q)return 1;for(;;){for(W=y-et,G=d[R]<j?(O=0,d[R]):d[R]>j?(O=at[ct+d[R]],A[q+d[R]]):(O=96,0),m=1<<y-et,e=w=1<<L;p[P+(I>>et)+(w-=m)]=W<<24|O<<16|G|0,w!==0;);for(m=1<<y-1;I&m;)m>>=1;if(m!==0?(I&=m-1,I+=m):I=0,R++,--Y[y]==0){if(y===T)break;y=g[_+d[R]]}if(tt<y&&(I&S)!==z){for(et===0&&(et=tt),P+=e,Z=1<<(L=y-et);L+et<T&&!((Z-=Y[L+et])<=0);)L++,Z<<=1;if(Q+=1<<L,v===1&&852<Q||v===2&&592<Q)return 1;p[z=I&S]=tt<<24|L<<16|P-n|0}}return I!==0&&(p[P+I]=y-et<<24|64<<16|0),l.bits=tt,0}},{"../utils/common":41}],51:[function(o,k,u){k.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,k,u){var i=o("../utils/common"),s=0,r=1;function c(h){for(var x=h.length;0<=--x;)h[x]=0}var b=0,v=29,g=256,_=g+1+v,a=30,p=19,n=2*_+1,d=15,l=16,m=7,w=256,z=16,S=17,P=18,j=[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],W=[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],O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],G=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],J=new Array(2*(_+2));c(J);var y=new Array(2*a);c(y);var R=new Array(512);c(R);var e=new Array(256);c(e);var T=new Array(v);c(T);var tt,L,et,Z=new Array(a);function Q(h,x,F,U,C){this.static_tree=h,this.extra_bits=x,this.extra_base=F,this.elems=U,this.max_length=C,this.has_stree=h&&h.length}function I(h,x){this.dyn_tree=h,this.max_code=0,this.stat_desc=x}function A(h){return h<256?R[h]:R[256+(h>>>7)]}function q(h,x){h.pending_buf[h.pending++]=255&x,h.pending_buf[h.pending++]=x>>>8&255}function Y(h,x,F){h.bi_valid>l-F?(h.bi_buf|=x<<h.bi_valid&65535,q(h,h.bi_buf),h.bi_buf=x>>l-h.bi_valid,h.bi_valid+=F-l):(h.bi_buf|=x<<h.bi_valid&65535,h.bi_valid+=F)}function K(h,x,F){Y(h,F[2*x],F[2*x+1])}function at(h,x){for(var F=0;F|=1&h,h>>>=1,F<<=1,0<--x;);return F>>>1}function ct(h,x,F){var U,C,M=new Array(d+1),X=0;for(U=1;U<=d;U++)M[U]=X=X+F[U-1]<<1;for(C=0;C<=x;C++){var V=h[2*C+1];V!==0&&(h[2*C]=at(M[V]++,V))}}function rt(h){var x;for(x=0;x<_;x++)h.dyn_ltree[2*x]=0;for(x=0;x<a;x++)h.dyn_dtree[2*x]=0;for(x=0;x<p;x++)h.bl_tree[2*x]=0;h.dyn_ltree[2*w]=1,h.opt_len=h.static_len=0,h.last_lit=h.matches=0}function it(h){8<h.bi_valid?q(h,h.bi_buf):0<h.bi_valid&&(h.pending_buf[h.pending++]=h.bi_buf),h.bi_buf=0,h.bi_valid=0}function ut(h,x,F,U){var C=2*x,M=2*F;return h[C]<h[M]||h[C]===h[M]&&U[x]<=U[F]}function ot(h,x,F){for(var U=h.heap[F],C=F<<1;C<=h.heap_len&&(C<h.heap_len&&ut(x,h.heap[C+1],h.heap[C],h.depth)&&C++,!ut(x,U,h.heap[C],h.depth));)h.heap[F]=h.heap[C],F=C,C<<=1;h.heap[F]=U}function ft(h,x,F){var U,C,M,X,V=0;if(h.last_lit!==0)for(;U=h.pending_buf[h.d_buf+2*V]<<8|h.pending_buf[h.d_buf+2*V+1],C=h.pending_buf[h.l_buf+V],V++,U===0?K(h,C,x):(K(h,(M=e[C])+g+1,x),(X=j[M])!==0&&Y(h,C-=T[M],X),K(h,M=A(--U),F),(X=W[M])!==0&&Y(h,U-=Z[M],X)),V<h.last_lit;);K(h,w,x)}function dt(h,x){var F,U,C,M=x.dyn_tree,X=x.stat_desc.static_tree,V=x.stat_desc.has_stree,$=x.stat_desc.elems,st=-1;for(h.heap_len=0,h.heap_max=n,F=0;F<$;F++)M[2*F]!==0?(h.heap[++h.heap_len]=st=F,h.depth[F]=0):M[2*F+1]=0;for(;h.heap_len<2;)M[2*(C=h.heap[++h.heap_len]=st<2?++st:0)]=1,h.depth[C]=0,h.opt_len--,V&&(h.static_len-=X[2*C+1]);for(x.max_code=st,F=h.heap_len>>1;1<=F;F--)ot(h,M,F);for(C=$;F=h.heap[1],h.heap[1]=h.heap[h.heap_len--],ot(h,M,1),U=h.heap[1],h.heap[--h.heap_max]=F,h.heap[--h.heap_max]=U,M[2*C]=M[2*F]+M[2*U],h.depth[C]=(h.depth[F]>=h.depth[U]?h.depth[F]:h.depth[U])+1,M[2*F+1]=M[2*U+1]=C,h.heap[1]=C++,ot(h,M,1),2<=h.heap_len;);h.heap[--h.heap_max]=h.heap[1],(function(nt,ht){var _t,pt,bt,lt,yt,zt,mt=ht.dyn_tree,Nt=ht.max_code,Wt=ht.stat_desc.static_tree,Zt=ht.stat_desc.has_stree,Mt=ht.stat_desc.extra_bits,Ot=ht.stat_desc.extra_base,vt=ht.stat_desc.max_length,wt=0;for(lt=0;lt<=d;lt++)nt.bl_count[lt]=0;for(mt[2*nt.heap[nt.heap_max]+1]=0,_t=nt.heap_max+1;_t<n;_t++)vt<(lt=mt[2*mt[2*(pt=nt.heap[_t])+1]+1]+1)&&(lt=vt,wt++),mt[2*pt+1]=lt,Nt<pt||(nt.bl_count[lt]++,yt=0,Ot<=pt&&(yt=Mt[pt-Ot]),zt=mt[2*pt],nt.opt_len+=zt*(lt+yt),Zt&&(nt.static_len+=zt*(Wt[2*pt+1]+yt)));if(wt!==0){do{for(lt=vt-1;nt.bl_count[lt]===0;)lt--;nt.bl_count[lt]--,nt.bl_count[lt+1]+=2,nt.bl_count[vt]--,wt-=2}while(0<wt);for(lt=vt;lt!==0;lt--)for(pt=nt.bl_count[lt];pt!==0;)Nt<(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--)}})(h,x),ct(M,st,h.bl_count)}function t(h,x,F){var U,C,M=-1,X=x[1],V=0,$=7,st=4;for(X===0&&($=138,st=3),x[2*(F+1)+1]=65535,U=0;U<=F;U++)C=X,X=x[2*(U+1)+1],++V<$&&C===X||(V<st?h.bl_tree[2*C]+=V:C!==0?(C!==M&&h.bl_tree[2*C]++,h.bl_tree[2*z]++):V<=10?h.bl_tree[2*S]++:h.bl_tree[2*P]++,M=C,st=(V=0)===X?($=138,3):C===X?($=6,3):($=7,4))}function B(h,x,F){var U,C,M=-1,X=x[1],V=0,$=7,st=4;for(X===0&&($=138,st=3),U=0;U<=F;U++)if(C=X,X=x[2*(U+1)+1],!(++V<$&&C===X)){if(V<st)for(;K(h,C,h.bl_tree),--V!=0;);else C!==0?(C!==M&&(K(h,C,h.bl_tree),V--),K(h,z,h.bl_tree),Y(h,V-3,2)):V<=10?(K(h,S,h.bl_tree),Y(h,V-3,3)):(K(h,P,h.bl_tree),Y(h,V-11,7));M=C,st=(V=0)===X?($=138,3):C===X?($=6,3):($=7,4)}}c(Z);var N=!1;function f(h,x,F,U){Y(h,(b<<1)+(U?1:0),3),(function(C,M,X,V){it(C),q(C,X),q(C,~X),i.arraySet(C.pending_buf,C.window,M,X,C.pending),C.pending+=X})(h,x,F)}u._tr_init=function(h){N||((function(){var x,F,U,C,M,X=new Array(d+1);for(C=U=0;C<v-1;C++)for(T[C]=U,x=0;x<1<<j[C];x++)e[U++]=C;for(e[U-1]=C,C=M=0;C<16;C++)for(Z[C]=M,x=0;x<1<<W[C];x++)R[M++]=C;for(M>>=7;C<a;C++)for(Z[C]=M<<7,x=0;x<1<<W[C]-7;x++)R[256+M++]=C;for(F=0;F<=d;F++)X[F]=0;for(x=0;x<=143;)J[2*x+1]=8,x++,X[8]++;for(;x<=255;)J[2*x+1]=9,x++,X[9]++;for(;x<=279;)J[2*x+1]=7,x++,X[7]++;for(;x<=287;)J[2*x+1]=8,x++,X[8]++;for(ct(J,_+1,X),x=0;x<a;x++)y[2*x+1]=5,y[2*x]=at(x,5);tt=new Q(J,j,g+1,_,d),L=new Q(y,W,0,a,d),et=new Q(new Array(0),O,0,p,m)})(),N=!0),h.l_desc=new I(h.dyn_ltree,tt),h.d_desc=new I(h.dyn_dtree,L),h.bl_desc=new I(h.bl_tree,et),h.bi_buf=0,h.bi_valid=0,rt(h)},u._tr_stored_block=f,u._tr_flush_block=function(h,x,F,U){var C,M,X=0;0<h.level?(h.strm.data_type===2&&(h.strm.data_type=(function(V){var $,st=4093624447;for($=0;$<=31;$++,st>>>=1)if(1&st&&V.dyn_ltree[2*$]!==0)return s;if(V.dyn_ltree[18]!==0||V.dyn_ltree[20]!==0||V.dyn_ltree[26]!==0)return r;for($=32;$<g;$++)if(V.dyn_ltree[2*$]!==0)return r;return s})(h)),dt(h,h.l_desc),dt(h,h.d_desc),X=(function(V){var $;for(t(V,V.dyn_ltree,V.l_desc.max_code),t(V,V.dyn_dtree,V.d_desc.max_code),dt(V,V.bl_desc),$=p-1;3<=$&&V.bl_tree[2*G[$]+1]===0;$--);return V.opt_len+=3*($+1)+5+5+4,$})(h),C=h.opt_len+3+7>>>3,(M=h.static_len+3+7>>>3)<=C&&(C=M)):C=M=F+5,F+4<=C&&x!==-1?f(h,x,F,U):h.strategy===4||M===C?(Y(h,2+(U?1:0),3),ft(h,J,y)):(Y(h,4+(U?1:0),3),(function(V,$,st,nt){var ht;for(Y(V,$-257,5),Y(V,st-1,5),Y(V,nt-4,4),ht=0;ht<nt;ht++)Y(V,V.bl_tree[2*G[ht]+1],3);B(V,V.dyn_ltree,$-1),B(V,V.dyn_dtree,st-1)})(h,h.l_desc.max_code+1,h.d_desc.max_code+1,X+1),ft(h,h.dyn_ltree,h.dyn_dtree)),rt(h),U&&it(h)},u._tr_tally=function(h,x,F){return h.pending_buf[h.d_buf+2*h.last_lit]=x>>>8&255,h.pending_buf[h.d_buf+2*h.last_lit+1]=255&x,h.pending_buf[h.l_buf+h.last_lit]=255&F,h.last_lit++,x===0?h.dyn_ltree[2*F]++:(h.matches++,x--,h.dyn_ltree[2*(e[F]+g+1)]++,h.dyn_dtree[2*A(x)]++),h.last_lit===h.lit_bufsize-1},u._tr_align=function(h){Y(h,2,3),K(h,w,J),(function(x){x.bi_valid===16?(q(x,x.bi_buf),x.bi_buf=0,x.bi_valid=0):8<=x.bi_valid&&(x.pending_buf[x.pending++]=255&x.bi_buf,x.bi_buf>>=8,x.bi_valid-=8)})(h)}},{"../utils/common":41}],53:[function(o,k,u){k.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,k,u){(function(i){(function(s,r){if(!s.setImmediate){var c,b,v,g,_=1,a={},p=!1,n=s.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(s);d=d&&d.setTimeout?d:s,c={}.toString.call(s.process)==="[object process]"?function(z){process.nextTick(function(){m(z)})}:(function(){if(s.postMessage&&!s.importScripts){var z=!0,S=s.onmessage;return s.onmessage=function(){z=!1},s.postMessage("","*"),s.onmessage=S,z}})()?(g="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",w,!1):s.attachEvent("onmessage",w),function(z){s.postMessage(g+z,"*")}):s.MessageChannel?((v=new MessageChannel).port1.onmessage=function(z){m(z.data)},function(z){v.port2.postMessage(z)}):n&&"onreadystatechange"in n.createElement("script")?(b=n.documentElement,function(z){var S=n.createElement("script");S.onreadystatechange=function(){m(z),S.onreadystatechange=null,b.removeChild(S),S=null},b.appendChild(S)}):function(z){setTimeout(m,0,z)},d.setImmediate=function(z){typeof z!="function"&&(z=new Function(""+z));for(var S=new Array(arguments.length-1),P=0;P<S.length;P++)S[P]=arguments[P+1];var j={callback:z,args:S};return a[_]=j,c(_),_++},d.clearImmediate=l}function l(z){delete a[z]}function m(z){if(p)setTimeout(m,0,z);else{var S=a[z];if(S){p=!0;try{(function(P){var j=P.callback,W=P.args;switch(W.length){case 0:j();break;case 1:j(W[0]);break;case 2:j(W[0],W[1]);break;case 3:j(W[0],W[1],W[2]);break;default:j.apply(r,W)}})(S)}finally{l(z),p=!1}}}}function w(z){z.source===s&&typeof z.data=="string"&&z.data.indexOf(g)===0&&m(+z.data.slice(g.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)})})(Et)),Et.exports}var me=pe();const ge=Ht(me);async function _e(E){let D;try{D=await ge.loadAsync(E)}catch(i){return{format:"obsidian-zip",notes:[],errors:[{sourcePath:E.name,reason:`Could not read zip: ${i instanceof Error?i.message:String(i)}`}],tags:[]}}const o=[],k=[],u=[];D.forEach((i,s)=>{u.push({path:i,obj:s})}),u.sort((i,s)=>i.path.localeCompare(s.path));for(const{path:i,obj:s}of u)if(!s.dir&&!Ut(i)&&Lt(i))try{const r=await s.async("string"),c=be(i,u),b=Ft({sourcePath:c,raw:r});o.push(b)}catch(r){k.push({sourcePath:i,reason:r instanceof Error?r.message:String(r)})}return{format:"obsidian-zip",notes:o,errors:k,tags:ve(o)}}function Ut(E){return E.split("/").some(o=>o===".obsidian"||o===".trash"||o==="__MACOSX")}function Lt(E){const D=E.toLowerCase();return D.endsWith(".md")||D.endsWith(".markdown")}function be(E,D){const o=E.split("/")[0];if(!o)return E;let k=o;for(const u of D){if(Ut(u.path)||!Lt(u.path))continue;if(u.path.split("/")[0]!==k){k=null;break}}return k&&E.startsWith(`${k}/`)?E.slice(k.length+1):E}function ve(E){const D=new Set;for(const o of E)for(const k of o.tags)D.add(k);return[...D].sort()}const ye=5,we=500;async function ke(E){const{client:D,notes:o,onProgress:k,signal:u}=E,i=Math.max(1,E.concurrency??ye),s=[];let r=0,c=0,b=!1;const v=o.map(Ee);async function g(){for(;;){if(u!=null&&u.aborted||b)return;const d=r++;if(d>=o.length)return;const l=o[d],m=v[d],w=await xe(D,l,m,u);s[d]=w,c++,w.status==="errored"&&w.reason.startsWith("auth:")&&(b=!0),k==null||k({done:c,total:o.length})}}const _=Array.from({length:Math.min(i,o.length)},()=>g());await Promise.all(_);for(let d=0;d<o.length;d++)s[d]||(s[d]={status:"errored",sourcePath:o[d].sourcePath,reason:b?"Skipped — vault session ended before this note was reached.":"Skipped — import was cancelled."});let a=0,p=0,n=0;for(const d of s)d.status==="created"?a++:d.status==="skipped"?p++:n++;return{created:a,skipped:p,errored:n,outcomes:s}}async function xe(E,D,o,k){try{const u=await Se(E,o,k);return{status:"created",sourcePath:D.sourcePath,noteId:u.id}}catch(u){return u instanceof Gt||u instanceof Vt?{status:"skipped",sourcePath:D.sourcePath,reason:u.message||"Already exists in vault"}:u instanceof Kt?{status:"errored",sourcePath:D.sourcePath,reason:`auth: ${u.message}`}:u instanceof Tt?{status:"errored",sourcePath:D.sourcePath,reason:`vault unreachable (${u.status}): ${u.message}`}:{status:"errored",sourcePath:D.sourcePath,reason:u instanceof Error?u.message:String(u)}}}async function Se(E,D,o){const k={};o&&(k.signal=o);try{return await E.createNote(D,k)}catch(u){if(!ze(u)||o!=null&&o.aborted)throw u;return await Ce(we,o),await E.createNote(D,k)}}function ze(E){return E instanceof Tt}function Ce(E,D){return new Promise(o=>{const k=setTimeout(()=>{D==null||D.removeEventListener("abort",u),o()},E),u=()=>{clearTimeout(k),o()};D&&D.addEventListener("abort",u,{once:!0})})}function Ee(E){const D={content:E.content};E.path&&(D.path=E.path),E.tags.length>0&&(D.tags=E.tags),Object.keys(E.metadata).length>0&&(D.metadata=E.metadata);const o=D;return E.id&&(o.id=E.id),E.createdAt&&(o.created_at=E.createdAt),D}function Te(){const E=Yt(_=>_.getActiveVault()),D=Xt(),o=$t(),k=qt(_=>_.push),[u,i]=gt.useState({kind:"pick"}),s=gt.useRef(null),r=gt.useRef(null);if(!E)return H.jsx(Jt,{to:"/",replace:!0});const c=gt.useCallback(async _=>{if(_.length===0)return;i({kind:"parsing"});const a=ee(_);try{let p;if(a==="obsidian-zip"){const n=_.find(Dt);if(!n){k("No zip file found in selection","error"),i({kind:"pick"});return}p=await _e(n)}else a==="loose-markdown"?p=await de(_.filter(At)):p={format:a,notes:[],errors:_.map(n=>({sourcePath:n.name,reason:"Unrecognized format (expected .zip, .md, or .markdown)."})),tags:[]};i({kind:"review",parsed:p})}catch(p){k(p instanceof Error?p.message:"Parse failed","error"),i({kind:"pick"})}},[k]),b=gt.useCallback(async()=>{if(u.kind!=="review")return;if(!D){k("Vault session unavailable — reconnect first","error");return}const _=new AbortController;r.current=_,i({kind:"importing",parsed:u.parsed,progress:{done:0,total:u.parsed.notes.length}});const a=await ke({client:D,notes:u.parsed.notes,signal:_.signal,onProgress:p=>{i(n=>n.kind==="importing"?{...n,progress:p}:n)}});r.current=null,i({kind:"done",report:a,parsed:u.parsed})},[u,D,k]),v=gt.useCallback(()=>{var _;(_=r.current)==null||_.abort()},[]),g=gt.useCallback(()=>{i({kind:"pick"}),s.current&&(s.current.value="")},[]);return H.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-7 md:px-6 md:py-10",children:[H.jsx("nav",{className:"mb-4 text-sm text-fg-dim",children:H.jsx(Qt,{to:"/",className:"hover:text-accent",children:"← All notes"})}),H.jsxs("header",{className:"mb-6",children:[H.jsxs("h1",{className:"font-serif text-2xl tracking-tight md:text-3xl",children:["Import notes into ",H.jsx("span",{className:"text-accent",children:E.name})]}),H.jsx("p",{className:"mt-2 text-sm 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."})]}),u.kind==="pick"||u.kind==="parsing"?H.jsx(Ae,{parsing:u.kind==="parsing",onFiles:c,inputRef:s}):null,u.kind==="review"?H.jsx(Ie,{parsed:u.parsed,onConfirm:b,onBack:g}):null,u.kind==="importing"?H.jsx(Ne,{progress:u.progress,onCancel:v}):null,u.kind==="done"?H.jsx(Oe,{report:u.report,parsed:u.parsed,onAnother:g,onHome:()=>o("/")}):null]})}function Ae({parsing:E,onFiles:D,inputRef:o}){const k=u=>{const i=Array.from(u.target.files??[]);i.length>0&&D(i)};return H.jsx("section",{children:H.jsx(te,{onDropFiles:D,className:"rounded-md border border-border bg-card",hint:"zip or markdown",children:H.jsxs("div",{className:"flex min-h-[40vh] flex-col items-center justify-center gap-4 p-8 text-center",children:[H.jsx("p",{className:"font-serif text-lg",children:E?"Reading files…":"Drop a file here"}),H.jsx("p",{className:"text-sm text-fg-dim",children:"Accepts an Obsidian vault `.zip`, or one or more `.md` / `.markdown` files."}),H.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-3",children:[H.jsxs("label",{className:"inline-flex min-h-11 cursor-pointer items-center rounded-md bg-accent px-4 py-1.5 text-sm font-medium text-white hover:bg-accent-hover",children:[E?"Reading…":"Choose files",H.jsx("input",{ref:o,type:"file",className:"sr-only",accept:".zip,.md,.markdown",multiple:!0,disabled:E,onChange:k})]}),H.jsx("span",{className:"text-xs text-fg-dim",children:"— or drag and drop above"})]}),H.jsxs("details",{className:"mt-2 text-left text-xs text-fg-dim",children:[H.jsx("summary",{className:"cursor-pointer text-fg-muted hover:text-accent",children:"What about other tools?"}),H.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"," ",H.jsx("code",{className:"rounded bg-bg/60 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 Ie({parsed:E,onConfirm:D,onBack:o}){const{notes:k,errors:u,tags:i}=E,s=k.length,r=s>0,c=gt.useMemo(()=>k.slice(0,8),[k]),b=gt.useMemo(()=>i.slice(0,12),[i]);return H.jsxs("section",{className:"space-y-6",children:[H.jsxs("div",{className:"rounded-md border border-border bg-card p-4",children:[H.jsx("h2",{className:"font-serif text-lg",children:"Dry run"}),H.jsxs("p",{className:"mt-1 text-sm text-fg-muted",children:["Detected format: ",H.jsx(je,{format:E.format}),"."," ",H.jsx("strong",{className:"text-fg",children:s})," ",s===1?"note":"notes"," will be created."," ",u.length>0?H.jsxs("span",{className:"text-fg-dim",children:[u.length," file(s) couldn't be parsed."]}):null]}),i.length>0?H.jsxs("p",{className:"mt-2 text-sm text-fg-muted",children:[H.jsx("span",{className:"text-xs uppercase tracking-wider text-fg-dim",children:"Tags found"})," ",b.map(v=>H.jsxs("span",{className:"ml-1 inline-block rounded bg-bg/60 px-1.5 py-0.5 font-mono text-xs text-fg",children:["#",v]},v)),i.length>b.length?H.jsxs("span",{className:"ml-2 text-fg-dim",children:["+",i.length-b.length," more"]}):null]}):null]}),c.length>0?H.jsxs("div",{className:"rounded-md border border-border bg-card p-4",children:[H.jsxs("h3",{className:"mb-2 text-xs uppercase tracking-wider text-fg-dim",children:["Preview (",c.length," of ",s,")"]}),H.jsx("ul",{className:"space-y-1.5 font-mono text-xs",children:c.map(v=>H.jsxs("li",{className:"flex items-center justify-between gap-3",children:[H.jsx("span",{className:"truncate text-fg",children:v.path||v.sourcePath}),H.jsx("span",{className:"shrink-0 text-fg-dim",children:v.tags.length>0?`${v.tags.length} tag${v.tags.length===1?"":"s"}`:""})]},v.sourcePath))})]}):null,u.length>0?H.jsxs("details",{className:"rounded-md border border-border bg-card p-4",children:[H.jsxs("summary",{className:"cursor-pointer text-sm text-fg-muted hover:text-accent",children:[u.length," file(s) skipped during parse"]}),H.jsx("ul",{className:"mt-3 space-y-1 text-xs",children:u.map(v=>H.jsxs("li",{className:"flex flex-col gap-0.5",children:[H.jsx("span",{className:"font-mono text-fg",children:v.sourcePath}),H.jsx("span",{className:"text-fg-dim",children:v.reason})]},v.sourcePath))})]}):null,H.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-3",children:[H.jsx("button",{type:"button",onClick:o,className:"min-h-11 rounded-md border border-border bg-card px-3 py-1.5 text-sm text-fg-muted hover:text-accent",children:"Choose different files"}),H.jsxs("button",{type:"button",onClick:D,disabled:!r,className:"min-h-11 rounded-md bg-accent px-4 py-1.5 text-sm font-medium text-white hover:bg-accent-hover disabled:opacity-40",children:["Run import (",s," ",s===1?"note":"notes",")"]})]})]})}function Ne({progress:E,onCancel:D}){const o=E.total===0?0:Math.round(E.done/E.total*100);return H.jsxs("section",{className:"space-y-4 rounded-md border border-border bg-card p-6",children:[H.jsx("h2",{className:"font-serif text-lg",children:"Importing…"}),H.jsxs("p",{className:"text-sm text-fg-muted",children:[E.done," / ",E.total," notes processed."]}),H.jsx("div",{className:"h-2 w-full overflow-hidden rounded bg-bg/60",role:"progressbar",tabIndex:0,"aria-label":"Import progress","aria-valuenow":E.done,"aria-valuemin":0,"aria-valuemax":E.total,children:H.jsx("div",{className:"h-full bg-accent transition-all",style:{width:`${o}%`}})}),H.jsx("div",{className:"flex justify-end",children:H.jsx("button",{type:"button",onClick:D,className:"min-h-11 rounded-md border border-border bg-card px-3 py-1.5 text-sm text-fg-muted hover:text-accent",children:"Cancel"})})]})}function Oe({report:E,parsed:D,onAnother:o,onHome:k}){const u=E.outcomes.filter(s=>s.status==="errored"),i=E.outcomes.filter(s=>s.status==="skipped");return H.jsxs("section",{className:"space-y-6",children:[H.jsxs("div",{className:"rounded-md border border-border bg-card p-4",children:[H.jsx("h2",{className:"font-serif text-lg",children:"Import complete"}),H.jsxs("ul",{className:"mt-3 space-y-1 text-sm",children:[H.jsxs("li",{children:[H.jsx("span",{className:"text-accent",children:E.created})," created"]}),H.jsxs("li",{children:[H.jsx("span",{className:"text-fg-muted",children:E.skipped})," skipped (already in vault)"]}),H.jsxs("li",{children:[H.jsx("span",{className:E.errored>0?"text-red-400":"text-fg-muted",children:E.errored})," ","errored"]})]}),D.errors.length>0?H.jsxs("p",{className:"mt-2 text-xs text-fg-dim",children:["(Plus ",D.errors.length," file(s) skipped at the parse stage — see above.)"]}):null]}),i.length>0?H.jsxs("details",{className:"rounded-md border border-border bg-card p-4",children:[H.jsxs("summary",{className:"cursor-pointer text-sm text-fg-muted hover:text-accent",children:[i.length," skipped — vault already had a matching note"]}),H.jsx("ul",{className:"mt-3 space-y-1 text-xs",children:i.map(s=>H.jsxs("li",{className:"flex flex-col gap-0.5",children:[H.jsx("span",{className:"font-mono text-fg",children:s.sourcePath}),H.jsx("span",{className:"text-fg-dim",children:s.status==="skipped"?s.reason:""})]},`s-${s.sourcePath}`))})]}):null,u.length>0?H.jsxs("details",{className:"rounded-md border border-red-500/30 bg-red-500/5 p-4",open:!0,children:[H.jsxs("summary",{className:"cursor-pointer text-sm font-medium text-red-400",children:[u.length," errored"]}),H.jsx("ul",{className:"mt-3 space-y-1 text-xs",children:u.map(s=>H.jsxs("li",{className:"flex flex-col gap-0.5",children:[H.jsx("span",{className:"font-mono text-fg",children:s.sourcePath}),H.jsx("span",{className:"text-fg-dim",children:s.status==="errored"?s.reason:""})]},`e-${s.sourcePath}`))})]}):null,H.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-3",children:[H.jsx("button",{type:"button",onClick:o,className:"min-h-11 rounded-md border border-border bg-card px-3 py-1.5 text-sm text-fg-muted hover:text-accent",children:"Run another import"}),H.jsx("button",{type:"button",onClick:k,className:"min-h-11 rounded-md bg-accent px-4 py-1.5 text-sm font-medium text-white hover:bg-accent-hover",children:"Back to vault"})]})]})}function je({format:E}){const D=E==="obsidian-zip"?"Obsidian vault (zip)":E==="loose-markdown"?"loose markdown":"unknown";return H.jsx("span",{className:"rounded bg-bg/60 px-1.5 py-0.5 font-mono text-xs text-fg",children:D})}export{Te as Import};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as d,t as e,a9 as D,M as V,V as C,g as _,$ as z,ac as O,X as W,N as K,L as R,W as Y,aa as q,f as H,B as P,e as X,w as Z}from"./index-CeSJJ5Fs.js";import{A as G}from"./AttachmentDropZone-BpW24D0t.js";import{u as J,C as Q,A as ee,a as te}from"./useAttachmentUploader-B1jCiVcW.js";import{P as se,D as ne}from"./PinArchiveButtons-B-J_q8fy.js";import{b as re,N as ae}from"./NoteRenderer-DZG-A0PR.js";const oe=250;function de({noteId:t,attachment:n}){const[l,a]=d.useState(!1),o=ce(n);return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>a(!0),"aria-label":`Remove attachment ${o}`,className:"shrink-0 rounded border border-transparent px-1.5 py-0.5 text-fg-dim hover:border-red-500/40 hover:text-red-400",children:"✕"}),l?e.jsx(ie,{noteId:t,attachment:n,label:o,onClose:()=>a(!1)}):null]})}function ie({noteId:t,attachment:n,label:l,onClose:a}){const o=D(i=>i.push),m=V(),[s,h]=d.useState(!1),[w,p]=d.useState(null),N=d.useRef(null);d.useEffect(()=>{const i=setTimeout(()=>h(!0),oe);return()=>clearTimeout(i)},[]),d.useEffect(()=>{var i;(i=N.current)==null||i.focus()},[]),d.useEffect(()=>{const i=g=>{g.key==="Escape"&&a()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[a]);const b=d.useCallback(()=>{!s||m.isPending||(p(null),m.mutate({noteId:t,attachmentId:n.id},{onSuccess:()=>{o(`Removed ${l}`,"success"),a()},onError:i=>{if(i instanceof C){p("Session expired. Reconnect to remove attachments.");return}if(i instanceof _){o(`Already removed ${l}`,"info"),a();return}p(i instanceof Error?i.message:"Remove failed")}}))},[s,n.id,l,m,t,a,o]);return e.jsx("dialog",{open:!0,"aria-labelledby":"confirm-remove-attachment-title",className:"fixed inset-0 z-40 m-0 flex h-full max-h-full w-full max-w-full items-center justify-center bg-black/60 p-4",onMouseDown:i=>{i.target===i.currentTarget&&a()},children:e.jsxs("div",{className:"w-full max-w-md rounded-md border border-border bg-card p-6 shadow-xl",children:[e.jsx("h2",{id:"confirm-remove-attachment-title",className:"mb-2 font-serif text-lg text-red-400",children:"Remove attachment?"}),e.jsxs("p",{className:"mb-3 text-sm text-fg-muted",children:[e.jsx("span",{className:"rounded bg-bg/60 px-1 py-0.5 font-mono text-xs text-fg",children:l})," ","will be detached from this note. If no other note references the file, it will also be deleted from storage. Markdown referencing it will show a broken link until you update it."]}),w?e.jsx("p",{role:"alert",className:"mb-3 text-sm text-red-400",children:w}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{ref:N,type:"button",onClick:a,className:"min-h-11 rounded-md border border-border bg-card px-3 py-1.5 text-sm text-fg-muted hover:text-fg",children:"Cancel"}),e.jsx("button",{type:"button",onClick:b,disabled:!s||m.isPending,className:"min-h-11 rounded-md bg-red-500 px-4 py-1.5 text-sm font-medium text-white hover:bg-red-600 disabled:opacity-40",children:m.isPending?"Removing…":"Remove"})]})]})})}function ce(t){if(t.filename)return t.filename;if(t.path){const n=t.path.split("/").pop();return n||t.path}return t.id}function ye(){const{id:t}=z(),n=t?decodeURIComponent(t):void 0,l=O(o=>o.getActiveVault()),a=W(n);return l?e.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-5 md:px-6 md:py-8",children:[e.jsx("nav",{className:"mb-4 text-sm text-fg-dim",children:e.jsx(R,{to:n?`/n/${encodeURIComponent(n)}`:"/",className:"hover:text-accent",children:"← Back to note"})}),a.isPending?e.jsx(xe,{}):a.isError?e.jsx(fe,{error:a.error}):a.data?e.jsx(le,{note:a.data}):e.jsx(he,{id:n??""})]}):e.jsx(K,{to:"/",replace:!0})}function S(t){return{content:t.content??"",path:t.path??"",tags:[...t.tags??[]]}}function le({note:t}){const n=Y(),l=D(r=>r.push),a=d.useMemo(()=>re(t),[t]),[o,m]=d.useState(()=>S(t)),[s,h]=d.useState(()=>S(t)),[w,p]=d.useState(""),[N,b]=d.useState(null),[i,g]=d.useState(null),[y,L]=d.useState("edit"),v=q(t.id),k=d.useRef(t),E=d.useRef(null),j=J({noteId:t.id,onInsert:r=>{E.current?E.current.insertAtCursor(r):h(c=>({...c,content:`${c.content}${r}`}))},onLinked:()=>{l("Attachment added","success")},onError:r=>l(r,"error")});d.useEffect(()=>{k.current=t},[t]);const u=s.content!==o.content||s.path!==o.path||!pe(s.tags,o.tags),A=d.useCallback(()=>{if(!u||v.isPending)return;const r={};s.content!==o.content&&(r.content=s.content),s.path!==o.path&&(r.path=s.path);const c=be(o.tags,s.tags);(c.add.length||c.remove.length)&&(r.tags=c);const f=k.current.updatedAt??k.current.createdAt;f&&(r.if_updated_at=f),g(null),b(null),v.mutate(r,{onSuccess:x=>{m(S(x)),h(S(x)),k.current=x,x.id!==t.id&&n(`/n/${encodeURIComponent(x.id)}/edit`,{replace:!0})},onError:x=>{x instanceof H?b(x):x instanceof C?g("Session expired. Reconnect to save."):g(x instanceof Error?x.message:"Save failed")}})},[o,s,u,v,n,t.id]),$=d.useCallback(()=>{u&&confirm("Discard all edits and revert to last saved version?")&&(h(o),b(null),g(null))},[o,u]),T=d.useCallback(()=>{u&&!confirm("Discard unsaved changes?")||n(`/n/${encodeURIComponent(t.id)}`)},[u,n,t.id]);d.useEffect(()=>{if(!u)return;const r=c=>{c.preventDefault(),c.returnValue=""};return window.addEventListener("beforeunload",r),()=>window.removeEventListener("beforeunload",r)},[u]);const B=s.path!==o.path,M=r=>{const c=Z(r);c&&(s.tags.includes(c)||(h(f=>({...f,tags:[...f.tags,c]})),p("")))},U=r=>{h(c=>({...c,tags:c.tags.filter(f=>f!==r)}))},F=s.content;return e.jsxs("article",{children:[e.jsxs("header",{className:"mb-4 border-b border-border pb-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-xs uppercase tracking-wider text-fg-dim",children:"Editing"}),u?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-accent","aria-label":"unsaved changes",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-accent"}),"unsaved"]}):e.jsxs("span",{className:"text-xs text-fg-dim",children:["saved ",P(t.updatedAt)]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(se,{note:t}),e.jsx(ne,{note:t}),e.jsx("span",{className:"mx-1 h-5 w-px bg-border","aria-hidden":"true"}),e.jsx("button",{type:"button",onClick:$,disabled:!u||v.isPending,className:"min-h-11 rounded-md border border-border bg-card px-3 py-1.5 text-sm text-fg-muted hover:text-accent disabled:opacity-40",children:"Revert"}),e.jsx("button",{type:"button",onClick:T,className:"min-h-11 rounded-md border border-border bg-card px-3 py-1.5 text-sm text-fg-muted hover:text-accent",children:"Cancel"}),e.jsx("button",{type:"button",onClick:A,disabled:!u||v.isPending,className:"min-h-11 rounded-md bg-accent px-4 py-1.5 text-sm font-medium text-white hover:bg-accent-hover disabled:opacity-40",title:"Save (⌘S)",children:v.isPending?"Saving…":"Save"})]})]}),e.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[e.jsx(X,{tags:s.tags,input:w,onInputChange:p,onAdd:M,onRemove:U}),e.jsxs("label",{className:"flex items-baseline gap-3 text-sm",children:[e.jsx("span",{className:"shrink-0 text-xs uppercase tracking-wider text-fg-dim",children:"Title"}),e.jsx("input",{type:"text",value:s.path,onChange:r=>h(c=>({...c,path:r.target.value})),className:"flex-1 rounded-md border border-border bg-card px-2.5 py-1 font-mono text-sm text-fg focus:border-accent focus:outline-none","aria-label":"Note path",placeholder:"(no path)"})]}),B?e.jsx("p",{className:"text-xs text-accent",children:"Renaming moves the note — its id may change."}):null]})]}),N?e.jsx(ue,{conflict:N,onReload:()=>{window.location.reload()},onDismiss:()=>b(null)}):null,i?e.jsx("div",{className:"mb-4 rounded-md border border-red-500/30 bg-red-500/5 p-3 text-sm text-red-400",children:i}):null,e.jsx("div",{role:"tablist","aria-label":"Editor view",className:"mb-3 inline-flex rounded-md border border-border bg-card p-0.5 text-sm lg:hidden",children:["edit","preview"].map(r=>e.jsx("button",{type:"button",role:"tab","aria-selected":y===r,onClick:()=>L(r),className:`rounded px-3 py-1.5 capitalize ${y===r?"bg-accent text-white":"text-fg-muted hover:text-accent"}`,children:r},r))}),e.jsxs("div",{className:"grid min-h-[60vh] gap-4 lg:grid-cols-2",children:[e.jsx(G,{onDropFiles:j.start,className:`min-w-0 rounded-md border border-border bg-card ${y==="edit"?"":"hidden lg:block"}`,hint:I,children:e.jsx(Q,{ref:E,value:s.content,onChange:r=>h(c=>({...c,content:r})),onSave:A,onCancel:T,onPasteFile:r=>(j.start(r),!0)})}),e.jsx("div",{className:`min-w-0 overflow-auto rounded-md border border-border bg-card p-4 ${y==="preview"?"":"hidden lg:block"}`,children:e.jsx(ae,{note:{path:s.path,content:F},resolve:a})})]}),e.jsx(me,{noteId:t.id,attachments:t.attachments??[],uploads:j.uploads,onPickFiles:j.start,onCancel:j.cancel,onDismiss:j.dismiss})]})}const I=e.jsxs(e.Fragment,{children:["Images, audio, webm video."," ",e.jsx("a",{href:"https://github.com/ParachuteComputer/parachute-vault/issues/127",target:"_blank",rel:"noreferrer",className:"underline",children:"PDF + mp4 coming"})]});function me({noteId:t,attachments:n,uploads:l,onPickFiles:a,onCancel:o,onDismiss:m}){return e.jsxs("section",{className:"mt-6 border-t border-border pt-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("h2",{className:"font-serif text-lg",children:"Attachments"}),e.jsx(ee,{onPickFiles:a})]}),e.jsxs("p",{className:"mb-3 text-xs text-fg-dim",children:["Drop or paste files into the editor. Max 100 MB each. ",I,"."]}),e.jsx(te,{uploads:l,onCancel:o,onDismiss:m}),n.length>0?e.jsx("ul",{className:"mt-3 space-y-1 text-sm",children:n.map(s=>e.jsxs("li",{className:"flex items-center justify-between gap-2 rounded border border-border bg-card/50 px-3 py-1.5 font-mono text-xs",children:[e.jsx("span",{className:"truncate",title:s.path??s.id,children:s.filename??s.path??s.id}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.mimeType?e.jsx("span",{className:"text-fg-dim",children:s.mimeType}):null,e.jsx(de,{noteId:t,attachment:s})]})]},s.id))}):null]})}function ue({conflict:t,onReload:n,onDismiss:l}){return e.jsxs("div",{className:"mb-4 rounded-md border border-amber-500/40 bg-amber-500/10 p-4",children:[e.jsx("p",{className:"mb-1 font-medium text-amber-500",children:"This note was edited elsewhere."}),e.jsxs("p",{className:"mb-3 text-sm text-fg-muted",children:["Your save was rejected to avoid overwriting the other edit.",t.currentUpdatedAt?` Latest update ${P(t.currentUpdatedAt)}.`:""]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:n,className:"rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent-hover",children:"Reload latest (discard my edits)"}),e.jsx("button",{type:"button",onClick:l,className:"rounded-md border border-border px-3 py-1.5 text-sm text-fg-muted hover:text-fg",children:"Keep editing"})]})]})}function xe(){return e.jsxs("div",{className:"grid min-h-[60vh] gap-4 lg:grid-cols-2","aria-busy":"true",children:[e.jsx("div",{className:"animate-pulse rounded-md border border-border bg-card"}),e.jsx("div",{className:"animate-pulse rounded-md border border-border bg-card"})]})}function he({id:t}){return e.jsxs("div",{className:"rounded-md border border-border bg-card p-10 text-center",children:[e.jsx("p",{className:"mb-2 font-serif text-xl",children:"Note not found"}),e.jsxs("p",{className:"mb-4 text-sm text-fg-muted",children:["No note with id ",e.jsx("span",{className:"font-mono",children:t})," in this vault."]}),e.jsx(R,{to:"/",className:"text-sm text-accent hover:underline",children:"Back to all notes"})]})}function fe({error:t}){const n=t 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:n?"Session expired":"Could not load note"}),e.jsx("p",{className:"mb-4 text-sm text-fg-muted",children:t.message}),n?e.jsx(R,{to:"/add",className:"inline-block rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent-hover",children:"Reconnect vault"}):null]})}function pe(t,n){if(t.length!==n.length)return!1;const l=new Set(t);for(const a of n)if(!l.has(a))return!1;return!0}function be(t,n){const l=new Set(t),a=new Set(n),o=n.filter(s=>!l.has(s)),m=t.filter(s=>!a.has(s));return{add:o,remove:m}}export{ye as NoteEditor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ac as T,W as P,a9 as I,K as R,Q as L,z as n,t as e,N as V,V as $,L as F,e as _,w as M}from"./index-CeSJJ5Fs.js";import{A as U}from"./AttachmentDropZone-BpW24D0t.js";import{u as z,C as B,A as W,a as K}from"./useAttachmentUploader-B1jCiVcW.js";import{b as O,N as Q}from"./NoteRenderer-DZG-A0PR.js";const Y={content:"",path:"",tags:[],summary:""};function J(){const w=T(t=>t.getActiveVault()),l=P(),d=I(t=>t.push),c=R(),f=L(),[a,o]=n.useState(Y),[C,b]=n.useState(""),[v,x]=n.useState(null),[m,k]=n.useState([]),p=n.useRef(null),i=z({noteId:null,onInsert:t=>{p.current?p.current.insertAtCursor(t):o(s=>({...s,content:`${s.content}${t}`}))},onStaged:t=>k(s=>[...s,t]),onError:t=>d(t,"error")});if(!w)return e.jsx(V,{to:"/",replace:!0});const u=a.content.length>0||a.path.length>0||a.tags.length>0||a.summary.length>0,h=a.content.trim().length>0&&a.path.trim().length>0,j=n.useCallback(()=>{if(!h||c.isPending)return;const t={content:a.content,path:a.path.trim()};a.tags.length&&(t.tags=a.tags);const s=a.summary.trim();s&&(t.metadata={summary:s}),x(null),c.mutate(t,{onSuccess:async r=>{for(const g of m)try{await f.mutateAsync({noteId:r.id,path:g.path,mimeType:g.mimeType})}catch(y){const D=y instanceof Error?y.message:"Link failed";d(`Failed to attach ${g.filename}: ${D}`,"error")}d(`Created ${r.path??r.id}`,"success"),l(`/n/${encodeURIComponent(r.id)}`)},onError:r=>{r instanceof $?x("Session expired. Reconnect to save."):x(r instanceof Error?`${r.message} — if the path is taken, try a different one.`:"Create failed")}})},[a,h,f,c,l,d,m]),N=n.useCallback(()=>{u&&!confirm("Discard this draft?")||l("/")},[u,l]);n.useEffect(()=>{if(!u)return;const t=s=>{s.preventDefault(),s.returnValue=""};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[u]);const A=t=>{const s=M(t);!s||a.tags.includes(s)||(o(r=>({...r,tags:[...r.tags,s]})),b(""))},E=t=>{o(s=>({...s,tags:s.tags.filter(r=>r!==t)}))},S=O({id:"__new__",createdAt:new Date().toISOString()});return e.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-5 md:px-6 md:py-8",children:[e.jsx("nav",{className:"mb-4 text-sm text-fg-dim",children:e.jsx(F,{to:"/",className:"hover:text-accent",children:"← All notes"})}),e.jsxs("article",{children:[e.jsxs("header",{className:"mb-4 border-b border-border pb-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm",children:e.jsx("span",{className:"text-xs uppercase tracking-wider text-fg-dim",children:"New note"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:N,className:"min-h-11 rounded-md border border-border bg-card px-3 py-1.5 text-sm text-fg-muted hover:text-accent",children:"Cancel"}),e.jsx("button",{type:"button",onClick:j,disabled:!h||c.isPending,className:"min-h-11 rounded-md bg-accent px-4 py-1.5 text-sm font-medium text-white hover:bg-accent-hover disabled:opacity-40",title:"Create (⌘S)",children:c.isPending?"Creating…":"Create"})]})]}),e.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[e.jsxs("label",{className:"flex items-baseline gap-3 text-sm",children:[e.jsx("span",{className:"shrink-0 text-xs uppercase tracking-wider text-fg-dim",children:"Title"}),e.jsx("input",{type:"text",value:a.path,onChange:t=>o(s=>({...s,path:t.target.value})),className:"flex-1 rounded-md border border-border bg-card px-2.5 py-1 font-mono text-sm text-fg focus:border-accent focus:outline-none","aria-label":"Note path",placeholder:"e.g. Projects/README"})]}),e.jsxs("label",{className:"flex items-baseline gap-3 text-sm",children:[e.jsx("span",{className:"shrink-0 text-xs uppercase tracking-wider text-fg-dim",children:"Summary"}),e.jsx("input",{type:"text",value:a.summary,onChange:t=>o(s=>({...s,summary:t.target.value})),className:"flex-1 rounded-md border border-border bg-card px-2.5 py-1 text-sm text-fg focus:border-accent focus:outline-none","aria-label":"Note summary",placeholder:"(optional one-line description)"})]}),e.jsx(_,{tags:a.tags,input:C,onInputChange:b,onAdd:A,onRemove:E})]})]}),v?e.jsx("div",{role:"alert",className:"mb-4 rounded-md border border-red-500/30 bg-red-500/5 p-3 text-sm text-red-400",children:v}):null,e.jsxs("div",{className:"grid min-h-[60vh] gap-4 lg:grid-cols-2",children:[e.jsx(U,{onDropFiles:i.start,className:"min-w-0 rounded-md border border-border bg-card",hint:"Images, audio, webm video",children:e.jsx(B,{ref:p,value:a.content,onChange:t=>o(s=>({...s,content:t})),onSave:j,onCancel:N,onPasteFile:t=>(i.start(t),!0)})}),e.jsx("div",{className:"min-w-0 overflow-auto rounded-md border border-border bg-card p-4",children:a.content.trim()?e.jsx(Q,{note:{path:a.path,content:a.content},resolve:S}):e.jsx("p",{className:"text-sm text-fg-dim",children:"Preview appears here as you type."})})]}),e.jsxs("section",{className:"mt-6 border-t border-border pt-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("h2",{className:"font-serif text-lg",children:"Attachments"}),e.jsx(W,{onPickFiles:i.start})]}),e.jsxs("p",{className:"mb-3 text-xs text-fg-dim",children:["Drop or paste files into the editor. Attachments link to the note when you save. Max 100 MB each. Images, audio, webm video."," ",e.jsx("a",{href:"https://github.com/ParachuteComputer/parachute-vault/issues/127",target:"_blank",rel:"noreferrer",className:"underline",children:"PDF + mp4 coming"}),"."]}),e.jsx(K,{uploads:i.uploads,onCancel:i.cancel,onDismiss:i.dismiss}),m.length>0?e.jsx("ul",{className:"mt-3 space-y-1 text-sm",children:m.map(t=>e.jsxs("li",{className:"flex items-center justify-between gap-2 rounded border border-border bg-card/50 px-3 py-1.5 font-mono text-xs text-fg-muted",children:[e.jsx("span",{className:"truncate",children:t.filename}),e.jsx("span",{className:"shrink-0 text-fg-dim",children:"staged"})]},t.path))}):null]})]})]})}export{J as NoteNew};
|