@powerhousedao/connect 6.0.0-dev.33 → 6.0.0-dev.35
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/assets/{AddDriveModal-OXMDcTkb.js → AddDriveModal-DgWDjHk6.js} +1 -1
- package/dist/assets/{ClearStorageModal-D7SSEfHO.js → ClearStorageModal-NiCExsdP.js} +1 -1
- package/dist/assets/{CookiesPolicyModal-B6IvC-dh.js → CookiesPolicyModal-Cn_Rk_ws.js} +1 -1
- package/dist/assets/CreateDocumentModal-D-zj8JuH.js +1 -0
- package/dist/assets/{DebugSettingsModal-BPQtmD9d.js → DebugSettingsModal-B0NXumlG.js} +1 -1
- package/dist/assets/{DeleteDriveModal-CGKiLFVF.js → DeleteDriveModal-vJtB3esF.js} +1 -1
- package/dist/assets/{DeleteItemModal-BAmScid_.js → DeleteItemModal-CceF4AQk.js} +1 -1
- package/dist/assets/DisclaimerModal-q1BWMBgA.js +1 -0
- package/dist/assets/{DriveSettingsModal-z-nwyn2J.js → DriveSettingsModal-BgNxsvW0.js} +1 -1
- package/dist/assets/{ExportDocumentWithErrorsModal-wcQL_cnZ.js → ExportDocumentWithErrorsModal-ChOpQgZG.js} +1 -1
- package/dist/assets/{SettingsModal-ffV7JjcT.js → SettingsModal-vuXP88Mg.js} +1 -1
- package/dist/assets/UpgradeDriveModal-O7dF2Bbv.js +1 -0
- package/dist/assets/{design_system-Da5LZxVT.js → design_system-DJpOmF2E.js} +1 -1
- package/dist/assets/{design_system_connect-DpO_P60g.js → design_system_connect-Bf5zyCf6.js} +1 -1
- package/dist/assets/{design_system_ui-D9cdBaZ3.js → design_system_ui-BXlYYDQC.js} +1 -1
- package/dist/assets/{document_drive-BCSa7iW6.js → document_drive-CDMxtf9f.js} +1 -1
- package/dist/assets/{document_engineering-DR9pe4U5.js → document_engineering-D5yCrHRS.js} +1 -1
- package/dist/assets/{document_model-CPsSXf7O.js → document_model-DxDgOZQk.js} +11 -11
- package/dist/assets/{document_model_editor-CIde2Bem.js → document_model_editor-DNCGY7nR.js} +4 -4
- package/dist/assets/{drive_explorer-DYvuYHTD.js → drive_explorer-CtTqBc39.js} +2 -2
- package/dist/assets/{graphql-editor-CuSth38N.js → graphql-editor-BlN69xIT.js} +1 -1
- package/dist/assets/{hooks-NgdYiMof.js → hooks-C39wEEgX.js} +1 -1
- package/dist/assets/{index-D09b1OOv.js → index-0XDY9XMU.js} +3 -3
- package/dist/assets/{index-B9vSDZIB.js → index-Cg3B8BbM.js} +2 -2
- package/dist/assets/{json-editor-Di9_h65O.js → json-editor-DGIQ_sB8.js} +1 -1
- package/dist/assets/nodefs-B7r3fzXQ.js +1 -0
- package/dist/assets/{opfs-ahp-Be-APU_0.js → opfs-ahp-BICmUVJu.js} +1 -1
- package/dist/assets/{reactor_browser-BvhdfFT9.js → reactor_browser-CQckBDAv.js} +3 -3
- package/dist/assets/{state-schemas-DtEEuBHc.js → state-schemas-wgDPnzsE.js} +2 -2
- package/dist/index.html +9 -9
- package/lib/package.copy.json +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.copy.json +1 -1
- package/package.json +10 -10
- package/dist/assets/CreateDocumentModal-De7HFzqG.js +0 -1
- package/dist/assets/DisclaimerModal-zIDDMFY9.js +0 -1
- package/dist/assets/UpgradeDriveModal-C2bwCout.js +0 -1
- package/dist/assets/nodefs-C0bNYofw.js +0 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import{n as $e,s as L,o as ee,l as Dt,u as kr,_ as tt,a as be,b as Tr,c as pn,Z as Dr,d as ye}from"./zod-9j67vCAu.js";import{g as dn,p as Cr,c as at}from"./react-DQSxOgtG.js";var lt={exports:{}},Jt;function Mr(){return Jt||(Jt=1,(function(e,t){const{hasOwnProperty:n}=Object.prototype,r=m();r.configure=m,r.stringify=r,r.default=r,t.stringify=r,t.configure=m,e.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function s(h){return h.length<5e3&&!i.test(h)?`"${h}"`:JSON.stringify(h)}function l(h,y){if(h.length>200||y)return h.sort(y);for(let I=1;I<h.length;I++){const v=h[I];let
|
|
1
|
+
import{n as $e,s as L,o as ee,l as Dt,u as kr,_ as tt,a as be,b as Tr,c as pn,Z as Dr,d as ye}from"./zod-9j67vCAu.js";import{g as dn,p as Cr,c as at}from"./react-DQSxOgtG.js";var lt={exports:{}},Jt;function Mr(){return Jt||(Jt=1,(function(e,t){const{hasOwnProperty:n}=Object.prototype,r=m();r.configure=m,r.stringify=r,r.default=r,t.stringify=r,t.configure=m,e.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function s(h){return h.length<5e3&&!i.test(h)?`"${h}"`:JSON.stringify(h)}function l(h,y){if(h.length>200||y)return h.sort(y);for(let I=1;I<h.length;I++){const v=h[I];let D=I;for(;D!==0&&h[D-1]>v;)h[D]=h[D-1],D--;h[D]=v}return h}const o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u(h){return o.call(h)!==void 0&&h.length!==0}function d(h,y,I){h.length<I&&(I=h.length);const v=y===","?"":" ";let D=`"0":${v}${h[0]}`;for(let T=1;T<I;T++)D+=`${y}"${T}":${v}${h[T]}`;return D}function _(h){if(n.call(h,"circularValue")){const y=h.circularValue;if(typeof y=="string")return`"${y}"`;if(y==null)return y;if(y===Error||y===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function g(h){let y;if(n.call(h,"deterministic")&&(y=h.deterministic,typeof y!="boolean"&&typeof y!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return y===void 0?!0:y}function w(h,y){let I;if(n.call(h,y)&&(I=h[y],typeof I!="boolean"))throw new TypeError(`The "${y}" argument must be of type boolean`);return I===void 0?!0:I}function p(h,y){let I;if(n.call(h,y)){if(I=h[y],typeof I!="number")throw new TypeError(`The "${y}" argument must be of type number`);if(!Number.isInteger(I))throw new TypeError(`The "${y}" argument must be an integer`);if(I<1)throw new RangeError(`The "${y}" argument must be >= 1`)}return I===void 0?1/0:I}function S(h){return h===1?"1 item":`${h} items`}function f(h){const y=new Set;for(const I of h)(typeof I=="string"||typeof I=="number")&&y.add(String(I));return y}function b(h){if(n.call(h,"strict")){const y=h.strict;if(typeof y!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(y)return I=>{let v=`Object can not safely be stringified. Received type ${typeof I}`;throw typeof I!="function"&&(v+=` (${I.toString()})`),new Error(v)}}}function m(h){h={...h};const y=b(h);y&&(h.bigint===void 0&&(h.bigint=!1),"circularValue"in h||(h.circularValue=Error));const I=_(h),v=w(h,"bigint"),D=g(h),T=typeof D=="function"?D:void 0,F=p(h,"maximumDepth"),C=p(h,"maximumBreadth");function V(U,N,P,q,B,J){let A=N[U];switch(typeof A=="object"&&A!==null&&typeof A.toJSON=="function"&&(A=A.toJSON(U)),A=q.call(N,U,A),typeof A){case"string":return s(A);case"object":{if(A===null)return"null";if(P.indexOf(A)!==-1)return I;let R="",Y=",";const G=J;if(Array.isArray(A)){if(A.length===0)return"[]";if(F<P.length+1)return'"[Array]"';P.push(A),B!==""&&(J+=B,R+=`
|
|
2
2
|
${J}`,Y=`,
|
|
3
|
-
${J}`);const ce=Math.min(A.length,
|
|
3
|
+
${J}`);const ce=Math.min(A.length,C);let pe=0;for(;pe<ce-1;pe++){const ge=V(String(pe),A,P,q,B,J);R+=ge!==void 0?ge:"null",R+=Y}const fe=V(String(pe),A,P,q,B,J);if(R+=fe!==void 0?fe:"null",A.length-1>C){const ge=A.length-C-1;R+=`${Y}"... ${S(ge)} not stringified"`}return B!==""&&(R+=`
|
|
4
4
|
${G}`),P.pop(),`[${R}]`}let W=Object.keys(A);const ae=W.length;if(ae===0)return"{}";if(F<P.length+1)return'"[Object]"';let ie="",re="";B!==""&&(J+=B,Y=`,
|
|
5
|
-
${J}`,ie=" ");const se=Math.min(ae,
|
|
5
|
+
${J}`,ie=" ");const se=Math.min(ae,C);D&&!u(A)&&(W=l(W,T)),P.push(A);for(let ce=0;ce<se;ce++){const pe=W[ce],fe=V(pe,A,P,q,B,J);fe!==void 0&&(R+=`${re}${s(pe)}:${ie}${fe}`,re=Y)}if(ae>C){const ce=ae-C;R+=`${re}"...":${ie}"${S(ce)} not stringified"`,re=Y}return B!==""&&re.length>1&&(R=`
|
|
6
6
|
${J}${R}
|
|
7
7
|
${G}`),P.pop(),`{${R}}`}case"number":return isFinite(A)?String(A):y?y(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(A);default:return y?y(A):void 0}}function te(U,N,P,q,B,J){switch(typeof N=="object"&&N!==null&&typeof N.toJSON=="function"&&(N=N.toJSON(U)),typeof N){case"string":return s(N);case"object":{if(N===null)return"null";if(P.indexOf(N)!==-1)return I;const A=J;let R="",Y=",";if(Array.isArray(N)){if(N.length===0)return"[]";if(F<P.length+1)return'"[Array]"';P.push(N),B!==""&&(J+=B,R+=`
|
|
8
8
|
${J}`,Y=`,
|
|
9
|
-
${J}`);const ae=Math.min(N.length,
|
|
9
|
+
${J}`);const ae=Math.min(N.length,C);let ie=0;for(;ie<ae-1;ie++){const se=te(String(ie),N[ie],P,q,B,J);R+=se!==void 0?se:"null",R+=Y}const re=te(String(ie),N[ie],P,q,B,J);if(R+=re!==void 0?re:"null",N.length-1>C){const se=N.length-C-1;R+=`${Y}"... ${S(se)} not stringified"`}return B!==""&&(R+=`
|
|
10
10
|
${A}`),P.pop(),`[${R}]`}P.push(N);let G="";B!==""&&(J+=B,Y=`,
|
|
11
11
|
${J}`,G=" ");let W="";for(const ae of q){const ie=te(ae,N[ae],P,q,B,J);ie!==void 0&&(R+=`${W}${s(ae)}:${G}${ie}`,W=Y)}return B!==""&&W.length>1&&(R=`
|
|
12
12
|
${J}${R}
|
|
13
13
|
${A}`),P.pop(),`{${R}}`}case"number":return isFinite(N)?String(N):y?y(N):"null";case"boolean":return N===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(N);default:return y?y(N):void 0}}function x(U,N,P,q,B){switch(typeof N){case"string":return s(N);case"object":{if(N===null)return"null";if(typeof N.toJSON=="function"){if(N=N.toJSON(U),typeof N!="object")return x(U,N,P,q,B);if(N===null)return"null"}if(P.indexOf(N)!==-1)return I;const J=B;if(Array.isArray(N)){if(N.length===0)return"[]";if(F<P.length+1)return'"[Array]"';P.push(N),B+=q;let ie=`
|
|
14
14
|
${B}`;const re=`,
|
|
15
|
-
${B}`,se=Math.min(N.length,
|
|
15
|
+
${B}`,se=Math.min(N.length,C);let ce=0;for(;ce<se-1;ce++){const fe=x(String(ce),N[ce],P,q,B);ie+=fe!==void 0?fe:"null",ie+=re}const pe=x(String(ce),N[ce],P,q,B);if(ie+=pe!==void 0?pe:"null",N.length-1>C){const fe=N.length-C-1;ie+=`${re}"... ${S(fe)} not stringified"`}return ie+=`
|
|
16
16
|
${J}`,P.pop(),`[${ie}]`}let A=Object.keys(N);const R=A.length;if(R===0)return"{}";if(F<P.length+1)return'"[Object]"';B+=q;const Y=`,
|
|
17
|
-
${B}`;let G="",W="",ae=Math.min(R,
|
|
17
|
+
${B}`;let G="",W="",ae=Math.min(R,C);u(N)&&(G+=d(N,Y,C),A=A.slice(N.length),ae-=N.length,W=Y),D&&(A=l(A,T)),P.push(N);for(let ie=0;ie<ae;ie++){const re=A[ie],se=x(re,N[re],P,q,B);se!==void 0&&(G+=`${W}${s(re)}: ${se}`,W=Y)}if(R>C){const ie=R-C;G+=`${W}"...": "${S(ie)} not stringified"`,W=Y}return W!==""&&(G=`
|
|
18
18
|
${B}${G}
|
|
19
|
-
${J}`),P.pop(),`{${G}}`}case"number":return isFinite(N)?String(N):y?y(N):"null";case"boolean":return N===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(N);default:return y?y(N):void 0}}function j(U,N,P){switch(typeof N){case"string":return s(N);case"object":{if(N===null)return"null";if(typeof N.toJSON=="function"){if(N=N.toJSON(U),typeof N!="object")return j(U,N,P);if(N===null)return"null"}if(P.indexOf(N)!==-1)return I;let q="";const B=N.length!==void 0;if(B&&Array.isArray(N)){if(N.length===0)return"[]";if(F<P.length+1)return'"[Array]"';P.push(N);const G=Math.min(N.length,
|
|
20
|
-
`+t.length.toString();return Jr.encode(n+t)}function Yr(e){const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Array.prototype.map.call(t,n=>("00"+n.toString(16)).slice(-2)).join("")}class fn extends Error{data;constructor(t){super(),this.name="InvalidActionInputError",this.data=t,this.message=this.message||`Invalid action input: ${JSON.stringify(t,null,2)}`}}class Qr extends fn{issues;constructor(t){super(t),this.issues=t,this.name="InvalidActionInputZodError"}}class ei extends Error{_scope;_document;_operation;constructor(t,n,r){super(),this.name="HashMismatchError",this._document=n,this._scope=t,this._operation=r,this.message=JSON.stringify({error:`Hash mismatch on document ${n.header.id}, scope ${t}, index ${r.index}`,document:n,operation:r},null,1)}get document(){return this._document}get scope(){return this._scope}get operation(){return this._operation}}const ti=e=>e!=null;Tr().refine(e=>ti(e));const ni=tt(["LOAD_STATE"]),ri=tt(["PRUNE"]),ii=tt(["REDO"]),oi=tt(["SET_NAME"]),si=tt(["UNDO"]);function Le(){return L()}function ai(){return kr([li(),ci(),pi(),di(),fi()])}function li(){return ee({id:L(),timestampUtcMs:L(),input:Dt(()=>hn()),type:ni,scope:Le()})}function hn(){return ee({operations:$e(),state:Dt(()=>ui())})}function ui(){return ee({data:pn().nullish(),name:L()})}function ci(){return ee({id:L(),timestampUtcMs:L(),input:Dt(()=>mn()),type:ri,scope:Le()})}function mn(){return ee({end:$e().nullish(),start:$e().nullish()})}const gn=$e;function pi(){return ee({id:L(),timestampUtcMs:L().datetime(),input:gn(),type:ii,scope:Le()})}const _n=L;function di(){return ee({id:L(),timestampUtcMs:L().datetime(),input:_n(),type:oi,scope:be("global")})}const bn=$e;function fi(){return ee({id:L(),timestampUtcMs:L().datetime(),input:bn(),type:si,scope:Le()})}function En(e){return globalThis.crypto.randomUUID()}function Sn(e,t,n,r){const i=`${e}:${t}:${n}:${r}`;return Mt(i,"sha1","hex").slice(0,32)}const hi=(e=1,t="global")=>oe("UNDO",e,void 0,bn,t),mi=(e=1,t="global")=>oe("REDO",e,void 0,gn,t),gi=(e,t,n="global")=>oe("PRUNE",{start:e,end:t},void 0,mn,n),yn=(e,t)=>oe("LOAD_STATE",{state:e,operations:t},void 0,hn),Nt=(e="global")=>oe("NOOP",{},void 0,void 0,e);function oe(e,t,n,r,i="global"){if(!e)throw new Error("Empty action type");if(typeof e!="string")throw new Error(`Invalid action type: ${JSON.stringify(e)}`);const s={id:En(),timestampUtcMs:new Date().toISOString(),type:e,input:t,scope:i};try{r?.().parse(s.input)}catch(l){throw l instanceof Dr?new Qr(l.issues):new fn(l)}return s}const _i=e=>({id:e.id,timestampUtcMs:e.timestampUtcMs,type:e.type,input:e.input,scope:e.scope,context:e.context,attachments:e.attachments}),bi=(e,t,n,r)=>({...e,action:e,id:Sn(r.documentId,r.scope,r.branch,e.id),timestampUtcMs:e.timestampUtcMs,hash:"",error:void 0,index:t,skip:n}),Ei=(e,t,n,r)=>{const i=Sn(r.documentId,r.scope,r.branch,e.action.id);return{...e,hash:"",error:void 0,index:t,skip:n,id:i}},Si=(e,t)=>{if(!e.action)throw new Error("Operation has no action");return{...e,action:{...e.action,context:t}}},yi=(e,t,n=[])=>({user:e,app:t,signatures:n});async function Oi(e,t){const n=Kr(e),r=qr(n),i=await t(r);return[...n,`0x${Yr(i)}`]}async function aa(e,t,n,r,i){const l=t(n,e,void 0,{reuseOperationResultingState:!0}).operations[e.scope];if(!l)throw new Error(`No operations found for scope: ${e.scope}`);const o=l.at(-1);if(!o)throw new Error("Action was not applied");const u=l.at(-2)?.hash??"",d=await Oi({documentId:n.header.id,signer:r,action:e,previousStateHash:u},i),_={signer:yi(r.user,r.app,[...r.signatures,d])};return Si(o,_)}const wi=(e=En(),t="")=>({id:e,sig:{publicKey:{},nonce:""},documentType:t,createdAtUtcIso:new Date().toISOString(),slug:"",name:"",branch:"main",revision:{document:0},lastModifiedAtUtcIso:new Date().toISOString(),meta:{}});function vi(e){return["UNDO","REDO"].includes(e.type)}function qt(e){return e.type==="UNDO"}function On(e){return["SET_NAME","UNDO","REDO","PRUNE","LOAD_STATE"].includes(e.type)}function xi(e,t){const n=e(t);return{header:wi(),state:n,initialState:n,operations:{global:[],local:[]},clipboard:[]}}function Pt(e,t="global"){const n=Ct(e.state[t]||"");return Mt(n)}function Ii(e){const t=[];let n=0;for(let r=e.length-1;r>=0;r--){const i=e[r];"action"in i&&i.action.type==="NOOP"&&i.skip>0?(n++,t.unshift(i)):n>0?n--:t.unshift(i)}return t}const Ai=e=>e;function wn(e,t,n,r,i,s={},l){const{checkHashes:o=!0,reuseOperationResultingState:u,operationResultingStateParser:d=zt,skipIndexValidation:_}=l||{};let g=e;const w=[],p=new Set([...Object.keys(t),"global","local"]),S={};for(const v of p)S[v]=[];if(u)for(const[v,C]of Object.entries(t)){if(!C)continue;const T=C.findLastIndex(D=>!!D.resultingState);if(T<0){w.push(...C);continue}const F=C[T];if(!(!F||!F.resultingState))try{const D=d(F.resultingState);g={...g,[v]:D};const V=S[v];V&&V.push(...C.slice(0,T+1)),w.push(...C.slice(T+1))}catch{w.push(...C)}}else w.push(...Object.values(t).flatMap(v=>v||[]));const f={header:r,state:Ai(g),initialState:e,operations:S,clipboard:[]};let b=f;if(w.length)b=w.reduce((v,C)=>n(v,C.action,i,{ignoreSkipOperations:!0,checkHashes:o,skipIndexValidation:_,replayOptions:{operation:C}}),f);else for(const v of Object.values(S)){if(!v)continue;const C=v.at(-1);C&&(b=vn(b,C.action.scope))}if(!o)for(const v of Object.keys(b.state))for(let C=w.length-1;C>=0;C--){const T=w[C];if(T.action.scope===v){if(T.hash!==Pt(b,v))throw new ei(v,b,T);break}}const m=new Set([...Object.keys(b.operations),...Object.keys(t),"global","local"]),h={};for(const v of m)h[v]=[];const y=Array.from(m).reduce((v,C)=>{const T=b.operations[C]||[];return{...v,[C]:[...T.map((F,D)=>({...F,timestamp:t[C]?.[D]?.timestampUtcMs??F.timestampUtcMs}))]}},h),I=r?r.lastModifiedAtUtcIso:Object.values(y).reduce((v,C)=>{if(!C)return v;const T=C.at(-1);return T&&T.timestampUtcMs>v?T.timestampUtcMs:v},f.header.lastModifiedAtUtcIso);return r&&(b.header={...r,revision:b.header.revision,lastModifiedAtUtcIso:I}),{...b,operations:y}}function zt(e){const t=typeof e;if(t==="string")return JSON.parse(e);if(t==="object")return e;throw new Error(`Providing resulting state is of type: ${t}`)}var Yt;(function(e){e.UNEXPECTED_INDEX="UNEXPECTED_INDEX"})(Yt||(Yt={}));var Qt;(function(e){e.DUPLICATED_INDEX="DUPLICATED_INDEX",e.MISSING_INDEX="MISSING_INDEX"})(Qt||(Qt={}));function bt(e){const t=[];let n=e.length-1;for(;n>-1;){t.unshift(e[n]);const r=(e[n]?.index||0)-(e[n]?.skip||0)-1;let i=n-1;for(;i>-1&&(e[i]?.index||0)>r;)i--;n=i}return t}function Te(e){return e.slice().sort((t,n)=>t.skip-n.skip).sort((t,n)=>t.index-n.index)}function Ri(e){if(e.length<1)return-1;const t=bt(e);let n=(t[t.length-1]?.skip||0)+1;return t.length>1&&(n+=t[t.length-2]?.skip||0),(t[t.length-1]?.index||-1)<n?-1:n}function ki(e,t){const r=Te(e).at(-1)?.index??-1,i=r+1,s={...t,index:t.index??i};if(s.index<r)throw new Error(`The skip header operation index must be greater than or equal to ${r}`);return bt(Te([...e,s])).slice(0,-1)}function ht(e){return Object.entries(e).reduce((n,r)=>{const[i,s]=r;return s?{...n,[i]:bt(Te(s))}:n},{})}function Ti(e){return e?Object.entries(e).reduce((n,[r,i])=>i?{...n,[r]:i.map(s=>{const{resultingState:l,...o}=s;return o})}:n,{}):{}}function Di(e,t){return e.filter(n=>!t.some(r=>n.index===r.index))}function Ci(e){return Te(Object.values(e.operations).flatMap(n=>n||[])).at(-1)?.timestampUtcMs||e.header.lastModifiedAtUtcIso}function Mi(e,t){return(e.operations[t]?.at(-1)?.index??-1??-1)+1}function vn(e,t){const n={...e.header,revision:{...e.header.revision,[t]:Mi(e,t)},lastModifiedAtUtcIso:Ci(e)};return{...e,header:n}}function ct(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 wt={exports:{}},en;function Ni(){return en||(en=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(r,i,s){function l(d,_){if(!i[d]){if(!r[d]){var g=typeof ct=="function"&&ct;if(!_&&g)return g(d,!0);if(o)return o(d,!0);var w=new Error("Cannot find module '"+d+"'");throw w.code="MODULE_NOT_FOUND",w}var p=i[d]={exports:{}};r[d][0].call(p.exports,function(S){var f=r[d][1][S];return l(f||S)},p,p.exports,n,r,i,s)}return i[d].exports}for(var o=typeof ct=="function"&&ct,u=0;u<s.length;u++)l(s[u]);return l})({1:[function(n,r,i){var s=n("./utils"),l=n("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(u){for(var d,_,g,w,p,S,f,b=[],m=0,h=u.length,y=h,I=s.getTypeOf(u)!=="string";m<u.length;)y=h-m,g=I?(d=u[m++],_=m<h?u[m++]:0,m<h?u[m++]:0):(d=u.charCodeAt(m++),_=m<h?u.charCodeAt(m++):0,m<h?u.charCodeAt(m++):0),w=d>>2,p=(3&d)<<4|_>>4,S=1<y?(15&_)<<2|g>>6:64,f=2<y?63&g:64,b.push(o.charAt(w)+o.charAt(p)+o.charAt(S)+o.charAt(f));return b.join("")},i.decode=function(u){var d,_,g,w,p,S,f=0,b=0,m="data:";if(u.substr(0,m.length)===m)throw new Error("Invalid base64 input, it looks like a data url.");var h,y=3*(u=u.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(u.charAt(u.length-1)===o.charAt(64)&&y--,u.charAt(u.length-2)===o.charAt(64)&&y--,y%1!=0)throw new Error("Invalid base64 input, bad content length.");for(h=l.uint8array?new Uint8Array(0|y):new Array(0|y);f<u.length;)d=o.indexOf(u.charAt(f++))<<2|(w=o.indexOf(u.charAt(f++)))>>4,_=(15&w)<<4|(p=o.indexOf(u.charAt(f++)))>>2,g=(3&p)<<6|(S=o.indexOf(u.charAt(f++))),h[b++]=d,p!==64&&(h[b++]=_),S!==64&&(h[b++]=g);return h}},{"./support":30,"./utils":32}],2:[function(n,r,i){var s=n("./external"),l=n("./stream/DataWorker"),o=n("./stream/Crc32Probe"),u=n("./stream/DataLengthProbe");function d(_,g,w,p,S){this.compressedSize=_,this.uncompressedSize=g,this.crc32=w,this.compression=p,this.compressedContent=S}d.prototype={getContentWorker:function(){var _=new l(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("data_length")),g=this;return _.on("end",function(){if(this.streamInfo.data_length!==g.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),_},getCompressedWorker:function(){return new l(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},d.createWorkerFrom=function(_,g,w){return _.pipe(new o).pipe(new u("uncompressedSize")).pipe(g.compressWorker(w)).pipe(new u("compressedSize")).withStreamInfo("compression",g)},r.exports=d},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,i){var s=n("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,i){var s=n("./utils"),l=(function(){for(var o,u=[],d=0;d<256;d++){o=d;for(var _=0;_<8;_++)o=1&o?3988292384^o>>>1:o>>>1;u[d]=o}return u})();r.exports=function(o,u){return o!==void 0&&o.length?s.getTypeOf(o)!=="string"?(function(d,_,g,w){var p=l,S=w+g;d^=-1;for(var f=w;f<S;f++)d=d>>>8^p[255&(d^_[f])];return-1^d})(0|u,o,o.length,0):(function(d,_,g,w){var p=l,S=w+g;d^=-1;for(var f=w;f<S;f++)d=d>>>8^p[255&(d^_.charCodeAt(f))];return-1^d})(0|u,o,o.length,0):0}},{"./utils":32}],5:[function(n,r,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(n,r,i){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",l=n("pako"),o=n("./utils"),u=n("./stream/GenericWorker"),d=s?"uint8array":"array";function _(g,w){u.call(this,"FlateWorker/"+g),this._pako=null,this._pakoAction=g,this._pakoOptions=w,this.meta={}}i.magic="\b\0",o.inherits(_,u),_.prototype.processChunk=function(g){this.meta=g.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(d,g.data),!1)},_.prototype.flush=function(){u.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},_.prototype.cleanUp=function(){u.prototype.cleanUp.call(this),this._pako=null},_.prototype._createPako=function(){this._pako=new l[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var g=this;this._pako.onData=function(w){g.push({data:w,meta:g.meta})}},i.compressWorker=function(g){return new _("Deflate",g)},i.uncompressWorker=function(){return new _("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,i){function s(p,S){var f,b="";for(f=0;f<S;f++)b+=String.fromCharCode(255&p),p>>>=8;return b}function l(p,S,f,b,m,h){var y,I,v=p.file,C=p.compression,T=h!==d.utf8encode,F=o.transformTo("string",h(v.name)),D=o.transformTo("string",d.utf8encode(v.name)),V=v.comment,te=o.transformTo("string",h(V)),x=o.transformTo("string",d.utf8encode(V)),j=D.length!==v.name.length,c=x.length!==V.length,U="",N="",P="",q=v.dir,B=v.date,J={crc32:0,compressedSize:0,uncompressedSize:0};S&&!f||(J.crc32=p.crc32,J.compressedSize=p.compressedSize,J.uncompressedSize=p.uncompressedSize);var A=0;S&&(A|=8),T||!j&&!c||(A|=2048);var R=0,Y=0;q&&(R|=16),m==="UNIX"?(Y=798,R|=(function(W,ae){var ie=W;return W||(ie=ae?16893:33204),(65535&ie)<<16})(v.unixPermissions,q)):(Y=20,R|=(function(W){return 63&(W||0)})(v.dosPermissions)),y=B.getUTCHours(),y<<=6,y|=B.getUTCMinutes(),y<<=5,y|=B.getUTCSeconds()/2,I=B.getUTCFullYear()-1980,I<<=4,I|=B.getUTCMonth()+1,I<<=5,I|=B.getUTCDate(),j&&(N=s(1,1)+s(_(F),4)+D,U+="up"+s(N.length,2)+N),c&&(P=s(1,1)+s(_(te),4)+x,U+="uc"+s(P.length,2)+P);var G="";return G+=`
|
|
21
|
-
\0`,G+=s(A,2),G+=C.magic,G+=s(y,2),G+=s(I,2),G+=s(J.crc32,4),G+=s(J.compressedSize,4),G+=s(J.uncompressedSize,4),G+=s(F.length,2),G+=s(U.length,2),{fileRecord:g.LOCAL_FILE_HEADER+G+F+U,dirRecord:g.CENTRAL_FILE_HEADER+s(Y,2)+G+s(te.length,2)+"\0\0\0\0"+s(R,4)+s(b,4)+F+U+te}}var o=n("../utils"),u=n("../stream/GenericWorker"),d=n("../utf8"),_=n("../crc32"),g=n("../signature");function w(p,S,f,b){u.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=S,this.zipPlatform=f,this.encodeFileName=b,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(w,u),w.prototype.push=function(p){var S=p.meta.percent||0,f=this.entriesCount,b=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,u.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:f?(S+100*(f-b-1))/f:100}}))},w.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var S=this.streamFiles&&!p.file.dir;if(S){var f=l(p,S,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:f.fileRecord,meta:{percent:0}})}else this.accumulate=!0},w.prototype.closedSource=function(p){this.accumulate=!1;var S=this.streamFiles&&!p.file.dir,f=l(p,S,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(f.dirRecord),S)this.push({data:(function(b){return g.DATA_DESCRIPTOR+s(b.crc32,4)+s(b.compressedSize,4)+s(b.uncompressedSize,4)})(p),meta:{percent:100}});else for(this.push({data:f.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},w.prototype.flush=function(){for(var p=this.bytesWritten,S=0;S<this.dirRecords.length;S++)this.push({data:this.dirRecords[S],meta:{percent:100}});var f=this.bytesWritten-p,b=(function(m,h,y,I,v){var C=o.transformTo("string",v(I));return g.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(m,2)+s(m,2)+s(h,4)+s(y,4)+s(C.length,2)+C})(this.dirRecords.length,f,p,this.zipComment,this.encodeFileName);this.push({data:b,meta:{percent:100}})},w.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},w.prototype.registerPrevious=function(p){this._sources.push(p);var S=this;return p.on("data",function(f){S.processChunk(f)}),p.on("end",function(){S.closedSource(S.previous.streamInfo),S._sources.length?S.prepareNextSource():S.end()}),p.on("error",function(f){S.error(f)}),this},w.prototype.resume=function(){return!!u.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},w.prototype.error=function(p){var S=this._sources;if(!u.prototype.error.call(this,p))return!1;for(var f=0;f<S.length;f++)try{S[f].error(p)}catch{}return!0},w.prototype.lock=function(){u.prototype.lock.call(this);for(var p=this._sources,S=0;S<p.length;S++)p[S].lock()},r.exports=w},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,i){var s=n("../compressions"),l=n("./ZipFileWorker");i.generateWorker=function(o,u,d){var _=new l(u.streamFiles,d,u.platform,u.encodeFileName),g=0;try{o.forEach(function(w,p){g++;var S=(function(h,y){var I=h||y,v=s[I];if(!v)throw new Error(I+" is not a valid compression method !");return v})(p.options.compression,u.compression),f=p.options.compressionOptions||u.compressionOptions||{},b=p.dir,m=p.date;p._compressWorker(S,f).withStreamInfo("file",{name:w,dir:b,date:m,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(_)}),_.entriesCount=g}catch(w){_.error(w)}return _}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,i){function s(){if(!(this instanceof s))return new s;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 l=new s;for(var o in this)typeof this[o]!="function"&&(l[o]=this[o]);return l}}(s.prototype=n("./object")).loadAsync=n("./load"),s.support=n("./support"),s.defaults=n("./defaults"),s.version="3.10.1",s.loadAsync=function(l,o){return new s().loadAsync(l,o)},s.external=n("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,i){var s=n("./utils"),l=n("./external"),o=n("./utf8"),u=n("./zipEntries"),d=n("./stream/Crc32Probe"),_=n("./nodejsUtils");function g(w){return new l.Promise(function(p,S){var f=w.decompressed.getContentWorker().pipe(new d);f.on("error",function(b){S(b)}).on("end",function(){f.streamInfo.crc32!==w.decompressed.crc32?S(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(w,p){var S=this;return p=s.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),_.isNode&&_.isStream(w)?l.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",w,!0,p.optimizedBinaryString,p.base64).then(function(f){var b=new u(p);return b.load(f),b}).then(function(f){var b=[l.Promise.resolve(f)],m=f.files;if(p.checkCRC32)for(var h=0;h<m.length;h++)b.push(g(m[h]));return l.Promise.all(b)}).then(function(f){for(var b=f.shift(),m=b.files,h=0;h<m.length;h++){var y=m[h],I=y.fileNameStr,v=s.resolve(y.fileNameStr);S.file(v,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:p.createFolders}),y.dir||(S.file(v).unsafeOriginalName=I)}return b.zipComment.length&&(S.comment=b.zipComment),S})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,i){var s=n("../utils"),l=n("../stream/GenericWorker");function o(u,d){l.call(this,"Nodejs stream input adapter for "+u),this._upstreamEnded=!1,this._bindStream(d)}s.inherits(o,l),o.prototype._bindStream=function(u){var d=this;(this._stream=u).pause(),u.on("data",function(_){d.push({data:_,meta:{percent:0}})}).on("error",function(_){d.isPaused?this.generatedError=_:d.error(_)}).on("end",function(){d.isPaused?d._upstreamEnded=!0:d.end()})},o.prototype.pause=function(){return!!l.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,i){var s=n("readable-stream").Readable;function l(o,u,d){s.call(this,u),this._helper=o;var _=this;o.on("data",function(g,w){_.push(g)||_._helper.pause(),d&&d(w)}).on("error",function(g){_.emit("error",g)}).on("end",function(){_.push(null)})}n("../utils").inherits(l,s),l.prototype._read=function(){this._helper.resume()},r.exports=l},{"../utils":32,"readable-stream":16}],14:[function(n,r,i){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,l){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,l);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,l)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var l=new Buffer(s);return l.fill(0),l},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(n,r,i){function s(v,C,T){var F,D=o.getTypeOf(C),V=o.extend(T||{},_);V.date=V.date||new Date,V.compression!==null&&(V.compression=V.compression.toUpperCase()),typeof V.unixPermissions=="string"&&(V.unixPermissions=parseInt(V.unixPermissions,8)),V.unixPermissions&&16384&V.unixPermissions&&(V.dir=!0),V.dosPermissions&&16&V.dosPermissions&&(V.dir=!0),V.dir&&(v=m(v)),V.createFolders&&(F=b(v))&&h.call(this,F,!0);var te=D==="string"&&V.binary===!1&&V.base64===!1;T&&T.binary!==void 0||(V.binary=!te),(C instanceof g&&C.uncompressedSize===0||V.dir||!C||C.length===0)&&(V.base64=!1,V.binary=!0,C="",V.compression="STORE",D="string");var x=null;x=C instanceof g||C instanceof u?C:S.isNode&&S.isStream(C)?new f(v,C):o.prepareContent(v,C,V.binary,V.optimizedBinaryString,V.base64);var j=new w(v,x,V);this.files[v]=j}var l=n("./utf8"),o=n("./utils"),u=n("./stream/GenericWorker"),d=n("./stream/StreamHelper"),_=n("./defaults"),g=n("./compressedObject"),w=n("./zipObject"),p=n("./generate"),S=n("./nodejsUtils"),f=n("./nodejs/NodejsStreamInputAdapter"),b=function(v){v.slice(-1)==="/"&&(v=v.substring(0,v.length-1));var C=v.lastIndexOf("/");return 0<C?v.substring(0,C):""},m=function(v){return v.slice(-1)!=="/"&&(v+="/"),v},h=function(v,C){return C=C!==void 0?C:_.createFolders,v=m(v),this.files[v]||s.call(this,v,null,{dir:!0,createFolders:C}),this.files[v]};function y(v){return Object.prototype.toString.call(v)==="[object RegExp]"}var I={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(v){var C,T,F;for(C in this.files)F=this.files[C],(T=C.slice(this.root.length,C.length))&&C.slice(0,this.root.length)===this.root&&v(T,F)},filter:function(v){var C=[];return this.forEach(function(T,F){v(T,F)&&C.push(F)}),C},file:function(v,C,T){if(arguments.length!==1)return v=this.root+v,s.call(this,v,C,T),this;if(y(v)){var F=v;return this.filter(function(V,te){return!te.dir&&F.test(V)})}var D=this.files[this.root+v];return D&&!D.dir?D:null},folder:function(v){if(!v)return this;if(y(v))return this.filter(function(D,V){return V.dir&&v.test(D)});var C=this.root+v,T=h.call(this,C),F=this.clone();return F.root=T.name,F},remove:function(v){v=this.root+v;var C=this.files[v];if(C||(v.slice(-1)!=="/"&&(v+="/"),C=this.files[v]),C&&!C.dir)delete this.files[v];else for(var T=this.filter(function(D,V){return V.name.slice(0,v.length)===v}),F=0;F<T.length;F++)delete this.files[T[F].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(v){var C,T={};try{if((T=o.extend(v||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:l.utf8encode})).type=T.type.toLowerCase(),T.compression=T.compression.toUpperCase(),T.type==="binarystring"&&(T.type="string"),!T.type)throw new Error("No output type specified.");o.checkSupport(T.type),T.platform!=="darwin"&&T.platform!=="freebsd"&&T.platform!=="linux"&&T.platform!=="sunos"||(T.platform="UNIX"),T.platform==="win32"&&(T.platform="DOS");var F=T.comment||this.comment||"";C=p.generateWorker(this,T,F)}catch(D){(C=new u("error")).error(D)}return new d(C,T.type||"string",T.mimeType)},generateAsync:function(v,C){return this.generateInternalStream(v).accumulate(C)},generateNodeStream:function(v,C){return(v=v||{}).type||(v.type="nodebuffer"),this.generateInternalStream(v).toNodejsStream(C)}};r.exports=I},{"./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(n,r,i){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,i){var s=n("./DataReader");function l(o){s.call(this,o);for(var u=0;u<this.data.length;u++)o[u]=255&o[u]}n("../utils").inherits(l,s),l.prototype.byteAt=function(o){return this.data[this.zero+o]},l.prototype.lastIndexOfSignature=function(o){for(var u=o.charCodeAt(0),d=o.charCodeAt(1),_=o.charCodeAt(2),g=o.charCodeAt(3),w=this.length-4;0<=w;--w)if(this.data[w]===u&&this.data[w+1]===d&&this.data[w+2]===_&&this.data[w+3]===g)return w-this.zero;return-1},l.prototype.readAndCheckSignature=function(o){var u=o.charCodeAt(0),d=o.charCodeAt(1),_=o.charCodeAt(2),g=o.charCodeAt(3),w=this.readData(4);return u===w[0]&&d===w[1]&&_===w[2]&&g===w[3]},l.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var u=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,u},r.exports=l},{"../utils":32,"./DataReader":18}],18:[function(n,r,i){var s=n("../utils");function l(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}l.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var u,d=0;for(this.checkOffset(o),u=this.index+o-1;u>=this.index;u--)d=(d<<8)+this.byteAt(u);return this.index+=o,d},readString:function(o){return s.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},r.exports=l},{"../utils":32}],19:[function(n,r,i){var s=n("./Uint8ArrayReader");function l(o){s.call(this,o)}n("../utils").inherits(l,s),l.prototype.readData=function(o){this.checkOffset(o);var u=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,u},r.exports=l},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,i){var s=n("./DataReader");function l(o){s.call(this,o)}n("../utils").inherits(l,s),l.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},l.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},l.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},l.prototype.readData=function(o){this.checkOffset(o);var u=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,u},r.exports=l},{"../utils":32,"./DataReader":18}],21:[function(n,r,i){var s=n("./ArrayReader");function l(o){s.call(this,o)}n("../utils").inherits(l,s),l.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var u=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,u},r.exports=l},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,i){var s=n("../utils"),l=n("../support"),o=n("./ArrayReader"),u=n("./StringReader"),d=n("./NodeBufferReader"),_=n("./Uint8ArrayReader");r.exports=function(g){var w=s.getTypeOf(g);return s.checkSupport(w),w!=="string"||l.uint8array?w==="nodebuffer"?new d(g):l.uint8array?new _(s.transformTo("uint8array",g)):new o(s.transformTo("array",g)):new u(g)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,i){var s=n("./GenericWorker"),l=n("../utils");function o(u){s.call(this,"ConvertWorker to "+u),this.destType=u}l.inherits(o,s),o.prototype.processChunk=function(u){this.push({data:l.transformTo(this.destType,u.data),meta:u.meta})},r.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,i){var s=n("./GenericWorker"),l=n("../crc32");function o(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(o,s),o.prototype.processChunk=function(u){this.streamInfo.crc32=l(u.data,this.streamInfo.crc32||0),this.push(u)},r.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,i){var s=n("../utils"),l=n("./GenericWorker");function o(u){l.call(this,"DataLengthProbe for "+u),this.propName=u,this.withStreamInfo(u,0)}s.inherits(o,l),o.prototype.processChunk=function(u){if(u){var d=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=d+u.data.length}l.prototype.processChunk.call(this,u)},r.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,i){var s=n("../utils"),l=n("./GenericWorker");function o(u){l.call(this,"DataWorker");var d=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,u.then(function(_){d.dataIsReady=!0,d.data=_,d.max=_&&_.length||0,d.type=s.getTypeOf(_),d.isPaused||d._tickAndRepeat()},function(_){d.error(_)})}s.inherits(o,l),o.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var u=null,d=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":u=this.data.substring(this.index,d);break;case"uint8array":u=this.data.subarray(this.index,d);break;case"array":case"nodebuffer":u=this.data.slice(this.index,d)}return this.index=d,this.push({data:u,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,i){function s(l){this.name=l||"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}s.prototype={push:function(l){this.emit("data",l)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(l){this.emit("error",l)}return!0},error:function(l){return!this.isFinished&&(this.isPaused?this.generatedError=l:(this.isFinished=!0,this.emit("error",l),this.previous&&this.previous.error(l),this.cleanUp()),!0)},on:function(l,o){return this._listeners[l].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(l,o){if(this._listeners[l])for(var u=0;u<this._listeners[l].length;u++)this._listeners[l][u].call(this,o)},pipe:function(l){return l.registerPrevious(this)},registerPrevious:function(l){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=l.streamInfo,this.mergeStreamInfo(),this.previous=l;var o=this;return l.on("data",function(u){o.processChunk(u)}),l.on("end",function(){o.end()}),l.on("error",function(u){o.error(u)}),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 l=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),l=!0),this.previous&&this.previous.resume(),!l},flush:function(){},processChunk:function(l){this.push(l)},withStreamInfo:function(l,o){return this.extraStreamInfo[l]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var l in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,l)&&(this.streamInfo[l]=this.extraStreamInfo[l])},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 l="Worker "+this.name;return this.previous?this.previous+" -> "+l:l}},r.exports=s},{}],29:[function(n,r,i){var s=n("../utils"),l=n("./ConvertWorker"),o=n("./GenericWorker"),u=n("../base64"),d=n("../support"),_=n("../external"),g=null;if(d.nodestream)try{g=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function w(S,f){return new _.Promise(function(b,m){var h=[],y=S._internalType,I=S._outputType,v=S._mimeType;S.on("data",function(C,T){h.push(C),f&&f(T)}).on("error",function(C){h=[],m(C)}).on("end",function(){try{var C=(function(T,F,D){switch(T){case"blob":return s.newBlob(s.transformTo("arraybuffer",F),D);case"base64":return u.encode(F);default:return s.transformTo(T,F)}})(I,(function(T,F){var D,V=0,te=null,x=0;for(D=0;D<F.length;D++)x+=F[D].length;switch(T){case"string":return F.join("");case"array":return Array.prototype.concat.apply([],F);case"uint8array":for(te=new Uint8Array(x),D=0;D<F.length;D++)te.set(F[D],V),V+=F[D].length;return te;case"nodebuffer":return Buffer.concat(F);default:throw new Error("concat : unsupported type '"+T+"'")}})(y,h),v);b(C)}catch(T){m(T)}h=[]}).resume()})}function p(S,f,b){var m=f;switch(f){case"blob":case"arraybuffer":m="uint8array";break;case"base64":m="string"}try{this._internalType=m,this._outputType=f,this._mimeType=b,s.checkSupport(m),this._worker=S.pipe(new l(m)),S.lock()}catch(h){this._worker=new o("error"),this._worker.error(h)}}p.prototype={accumulate:function(S){return w(this,S)},on:function(S,f){var b=this;return S==="data"?this._worker.on(S,function(m){f.call(b,m.data,m.meta)}):this._worker.on(S,function(){s.delay(f,arguments,b)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(S){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new g(this,{objectMode:this._outputType!=="nodebuffer"},S)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",i.nodebuffer=typeof Buffer<"u",i.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var l=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);l.append(s),i.blob=l.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!n("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,i){for(var s=n("./utils"),l=n("./support"),o=n("./nodejsUtils"),u=n("./stream/GenericWorker"),d=new Array(256),_=0;_<256;_++)d[_]=252<=_?6:248<=_?5:240<=_?4:224<=_?3:192<=_?2:1;d[254]=d[254]=1;function g(){u.call(this,"utf-8 decode"),this.leftOver=null}function w(){u.call(this,"utf-8 encode")}i.utf8encode=function(p){return l.nodebuffer?o.newBufferFrom(p,"utf-8"):(function(S){var f,b,m,h,y,I=S.length,v=0;for(h=0;h<I;h++)(64512&(b=S.charCodeAt(h)))==55296&&h+1<I&&(64512&(m=S.charCodeAt(h+1)))==56320&&(b=65536+(b-55296<<10)+(m-56320),h++),v+=b<128?1:b<2048?2:b<65536?3:4;for(f=l.uint8array?new Uint8Array(v):new Array(v),h=y=0;y<v;h++)(64512&(b=S.charCodeAt(h)))==55296&&h+1<I&&(64512&(m=S.charCodeAt(h+1)))==56320&&(b=65536+(b-55296<<10)+(m-56320),h++),b<128?f[y++]=b:(b<2048?f[y++]=192|b>>>6:(b<65536?f[y++]=224|b>>>12:(f[y++]=240|b>>>18,f[y++]=128|b>>>12&63),f[y++]=128|b>>>6&63),f[y++]=128|63&b);return f})(p)},i.utf8decode=function(p){return l.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):(function(S){var f,b,m,h,y=S.length,I=new Array(2*y);for(f=b=0;f<y;)if((m=S[f++])<128)I[b++]=m;else if(4<(h=d[m]))I[b++]=65533,f+=h-1;else{for(m&=h===2?31:h===3?15:7;1<h&&f<y;)m=m<<6|63&S[f++],h--;1<h?I[b++]=65533:m<65536?I[b++]=m:(m-=65536,I[b++]=55296|m>>10&1023,I[b++]=56320|1023&m)}return I.length!==b&&(I.subarray?I=I.subarray(0,b):I.length=b),s.applyFromCharCode(I)})(p=s.transformTo(l.uint8array?"uint8array":"array",p))},s.inherits(g,u),g.prototype.processChunk=function(p){var S=s.transformTo(l.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(l.uint8array){var f=S;(S=new Uint8Array(f.length+this.leftOver.length)).set(this.leftOver,0),S.set(f,this.leftOver.length)}else S=this.leftOver.concat(S);this.leftOver=null}var b=(function(h,y){var I;for((y=y||h.length)>h.length&&(y=h.length),I=y-1;0<=I&&(192&h[I])==128;)I--;return I<0||I===0?y:I+d[h[I]]>y?I:y})(S),m=S;b!==S.length&&(l.uint8array?(m=S.subarray(0,b),this.leftOver=S.subarray(b,S.length)):(m=S.slice(0,b),this.leftOver=S.slice(b,S.length))),this.push({data:i.utf8decode(m),meta:p.meta})},g.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=g,s.inherits(w,u),w.prototype.processChunk=function(p){this.push({data:i.utf8encode(p.data),meta:p.meta})},i.Utf8EncodeWorker=w},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,i){var s=n("./support"),l=n("./base64"),o=n("./nodejsUtils"),u=n("./external");function d(f){return f}function _(f,b){for(var m=0;m<f.length;++m)b[m]=255&f.charCodeAt(m);return b}n("setimmediate"),i.newBlob=function(f,b){i.checkSupport("blob");try{return new Blob([f],{type:b})}catch{try{var m=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return m.append(f),m.getBlob(b)}catch{throw new Error("Bug : can't construct the Blob.")}}};var g={stringifyByChunk:function(f,b,m){var h=[],y=0,I=f.length;if(I<=m)return String.fromCharCode.apply(null,f);for(;y<I;)b==="array"||b==="nodebuffer"?h.push(String.fromCharCode.apply(null,f.slice(y,Math.min(y+m,I)))):h.push(String.fromCharCode.apply(null,f.subarray(y,Math.min(y+m,I)))),y+=m;return h.join("")},stringifyByChar:function(f){for(var b="",m=0;m<f.length;m++)b+=String.fromCharCode(f[m]);return b},applyCanBeUsed:{uint8array:(function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}})()}};function w(f){var b=65536,m=i.getTypeOf(f),h=!0;if(m==="uint8array"?h=g.applyCanBeUsed.uint8array:m==="nodebuffer"&&(h=g.applyCanBeUsed.nodebuffer),h)for(;1<b;)try{return g.stringifyByChunk(f,m,b)}catch{b=Math.floor(b/2)}return g.stringifyByChar(f)}function p(f,b){for(var m=0;m<f.length;m++)b[m]=f[m];return b}i.applyFromCharCode=w;var S={};S.string={string:d,array:function(f){return _(f,new Array(f.length))},arraybuffer:function(f){return S.string.uint8array(f).buffer},uint8array:function(f){return _(f,new Uint8Array(f.length))},nodebuffer:function(f){return _(f,o.allocBuffer(f.length))}},S.array={string:w,array:d,arraybuffer:function(f){return new Uint8Array(f).buffer},uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return o.newBufferFrom(f)}},S.arraybuffer={string:function(f){return w(new Uint8Array(f))},array:function(f){return p(new Uint8Array(f),new Array(f.byteLength))},arraybuffer:d,uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return o.newBufferFrom(new Uint8Array(f))}},S.uint8array={string:w,array:function(f){return p(f,new Array(f.length))},arraybuffer:function(f){return f.buffer},uint8array:d,nodebuffer:function(f){return o.newBufferFrom(f)}},S.nodebuffer={string:w,array:function(f){return p(f,new Array(f.length))},arraybuffer:function(f){return S.nodebuffer.uint8array(f).buffer},uint8array:function(f){return p(f,new Uint8Array(f.length))},nodebuffer:d},i.transformTo=function(f,b){if(b=b||"",!f)return b;i.checkSupport(f);var m=i.getTypeOf(b);return S[m][f](b)},i.resolve=function(f){for(var b=f.split("/"),m=[],h=0;h<b.length;h++){var y=b[h];y==="."||y===""&&h!==0&&h!==b.length-1||(y===".."?m.pop():m.push(y))}return m.join("/")},i.getTypeOf=function(f){return typeof f=="string"?"string":Object.prototype.toString.call(f)==="[object Array]"?"array":s.nodebuffer&&o.isBuffer(f)?"nodebuffer":s.uint8array&&f instanceof Uint8Array?"uint8array":s.arraybuffer&&f instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(f){if(!s[f.toLowerCase()])throw new Error(f+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(f){var b,m,h="";for(m=0;m<(f||"").length;m++)h+="\\x"+((b=f.charCodeAt(m))<16?"0":"")+b.toString(16).toUpperCase();return h},i.delay=function(f,b,m){setImmediate(function(){f.apply(m||null,b||[])})},i.inherits=function(f,b){function m(){}m.prototype=b.prototype,f.prototype=new m},i.extend=function(){var f,b,m={};for(f=0;f<arguments.length;f++)for(b in arguments[f])Object.prototype.hasOwnProperty.call(arguments[f],b)&&m[b]===void 0&&(m[b]=arguments[f][b]);return m},i.prepareContent=function(f,b,m,h,y){return u.Promise.resolve(b).then(function(I){return s.blob&&(I instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(I))!==-1)&&typeof FileReader<"u"?new u.Promise(function(v,C){var T=new FileReader;T.onload=function(F){v(F.target.result)},T.onerror=function(F){C(F.target.error)},T.readAsArrayBuffer(I)}):I}).then(function(I){var v=i.getTypeOf(I);return v?(v==="arraybuffer"?I=i.transformTo("uint8array",I):v==="string"&&(y?I=l.decode(I):m&&h!==!0&&(I=(function(C){return _(C,s.uint8array?new Uint8Array(C.length):new Array(C.length))})(I))),I):u.Promise.reject(new Error("Can't read the data of '"+f+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,i){var s=n("./reader/readerFor"),l=n("./utils"),o=n("./signature"),u=n("./zipEntry"),d=n("./support");function _(g){this.files=[],this.loadOptions=g}_.prototype={checkSignature:function(g){if(!this.reader.readAndCheckSignature(g)){this.reader.index-=4;var w=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+l.pretty(w)+", expected "+l.pretty(g)+")")}},isSignature:function(g,w){var p=this.reader.index;this.reader.setIndex(g);var S=this.reader.readString(4)===w;return this.reader.setIndex(p),S},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),w=d.uint8array?"uint8array":"array",p=l.transformTo(w,g);this.zipComment=this.loadOptions.decodeFileName(p)},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,w,p,S=this.zip64EndOfCentralSize-44;0<S;)g=this.reader.readInt(2),w=this.reader.readInt(4),p=this.reader.readData(w),this.zip64ExtensibleData[g]={id:g,length:w,value:p}},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,w;for(g=0;g<this.files.length;g++)w=this.files[g],this.reader.setIndex(w.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),w.readLocalPart(this.reader),w.handleUTF8(),w.processAttributes()},readCentralDir:function(){var g;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(g=new u({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(o.CENTRAL_DIRECTORY_END);if(g<0)throw this.isSignature(0,o.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 w=g;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===l.MAX_VALUE_16BITS||this.diskWithCentralDirStart===l.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===l.MAX_VALUE_16BITS||this.centralDirRecords===l.MAX_VALUE_16BITS||this.centralDirSize===l.MAX_VALUE_32BITS||this.centralDirOffset===l.MAX_VALUE_32BITS){if(this.zip64=!0,(g=this.reader.lastIndexOfSignature(o.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(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.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(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var S=w-p;if(0<S)this.isSignature(w,o.CENTRAL_FILE_HEADER)||(this.reader.zero=S);else if(S<0)throw new Error("Corrupted zip: missing "+Math.abs(S)+" bytes.")},prepareReader:function(g){this.reader=s(g)},load:function(g){this.prepareReader(g),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=_},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,i){var s=n("./reader/readerFor"),l=n("./utils"),o=n("./compressedObject"),u=n("./crc32"),d=n("./utf8"),_=n("./compressions"),g=n("./support");function w(p,S){this.options=p,this.loadOptions=S}w.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var S,f;if(p.skip(22),this.fileNameLength=p.readInt(2),f=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(f),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((S=(function(b){for(var m in _)if(Object.prototype.hasOwnProperty.call(_,m)&&_[m].magic===b)return _[m];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+l.pretty(this.compressionMethod)+" unknown (inner file : "+l.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,S,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var S=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(S),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=s(this.extraFields[1].value);this.uncompressedSize===l.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===l.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===l.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===l.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var S,f,b,m=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<m;)S=p.readInt(2),f=p.readInt(2),b=p.readData(f),this.extraFields[S]={id:S,length:f,value:b};p.setIndex(m)},handleUTF8:function(){var p=g.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=d.utf8decode(this.fileName),this.fileCommentStr=d.utf8decode(this.fileComment);else{var S=this.findExtraFieldUnicodePath();if(S!==null)this.fileNameStr=S;else{var f=l.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(f)}var b=this.findExtraFieldUnicodeComment();if(b!==null)this.fileCommentStr=b;else{var m=l.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(m)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var S=s(p.value);return S.readInt(1)!==1||u(this.fileName)!==S.readInt(4)?null:d.utf8decode(S.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var S=s(p.value);return S.readInt(1)!==1||u(this.fileComment)!==S.readInt(4)?null:d.utf8decode(S.readData(p.length-5))}return null}},r.exports=w},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,i){function s(S,f,b){this.name=S,this.dir=b.dir,this.date=b.date,this.comment=b.comment,this.unixPermissions=b.unixPermissions,this.dosPermissions=b.dosPermissions,this._data=f,this._dataBinary=b.binary,this.options={compression:b.compression,compressionOptions:b.compressionOptions}}var l=n("./stream/StreamHelper"),o=n("./stream/DataWorker"),u=n("./utf8"),d=n("./compressedObject"),_=n("./stream/GenericWorker");s.prototype={internalStream:function(S){var f=null,b="string";try{if(!S)throw new Error("No output type specified.");var m=(b=S.toLowerCase())==="string"||b==="text";b!=="binarystring"&&b!=="text"||(b="string"),f=this._decompressWorker();var h=!this._dataBinary;h&&!m&&(f=f.pipe(new u.Utf8EncodeWorker)),!h&&m&&(f=f.pipe(new u.Utf8DecodeWorker))}catch(y){(f=new _("error")).error(y)}return new l(f,b,"")},async:function(S,f){return this.internalStream(S).accumulate(f)},nodeStream:function(S,f){return this.internalStream(S||"nodebuffer").toNodejsStream(f)},_compressWorker:function(S,f){if(this._data instanceof d&&this._data.compression.magic===S.magic)return this._data.getCompressedWorker();var b=this._decompressWorker();return this._dataBinary||(b=b.pipe(new u.Utf8EncodeWorker)),d.createWorkerFrom(b,S,f)},_decompressWorker:function(){return this._data instanceof d?this._data.getContentWorker():this._data instanceof _?this._data:new o(this._data)}};for(var g=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],w=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<g.length;p++)s.prototype[g[p]]=w;r.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,i){(function(s){var l,o,u=s.MutationObserver||s.WebKitMutationObserver;if(u){var d=0,_=new u(S),g=s.document.createTextNode("");_.observe(g,{characterData:!0}),l=function(){g.data=d=++d%2}}else if(s.setImmediate||s.MessageChannel===void 0)l="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var f=s.document.createElement("script");f.onreadystatechange=function(){S(),f.onreadystatechange=null,f.parentNode.removeChild(f),f=null},s.document.documentElement.appendChild(f)}:function(){setTimeout(S,0)};else{var w=new s.MessageChannel;w.port1.onmessage=S,l=function(){w.port2.postMessage(0)}}var p=[];function S(){var f,b;o=!0;for(var m=p.length;m;){for(b=p,p=[],f=-1;++f<m;)b[f]();m=p.length}o=!1}r.exports=function(f){p.push(f)!==1||o||l()}}).call(this,typeof at<"u"?at:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,i){var s=n("immediate");function l(){}var o={},u=["REJECTED"],d=["FULFILLED"],_=["PENDING"];function g(m){if(typeof m!="function")throw new TypeError("resolver must be a function");this.state=_,this.queue=[],this.outcome=void 0,m!==l&&f(this,m)}function w(m,h,y){this.promise=m,typeof h=="function"&&(this.onFulfilled=h,this.callFulfilled=this.otherCallFulfilled),typeof y=="function"&&(this.onRejected=y,this.callRejected=this.otherCallRejected)}function p(m,h,y){s(function(){var I;try{I=h(y)}catch(v){return o.reject(m,v)}I===m?o.reject(m,new TypeError("Cannot resolve promise with itself")):o.resolve(m,I)})}function S(m){var h=m&&m.then;if(m&&(typeof m=="object"||typeof m=="function")&&typeof h=="function")return function(){h.apply(m,arguments)}}function f(m,h){var y=!1;function I(T){y||(y=!0,o.reject(m,T))}function v(T){y||(y=!0,o.resolve(m,T))}var C=b(function(){h(v,I)});C.status==="error"&&I(C.value)}function b(m,h){var y={};try{y.value=m(h),y.status="success"}catch(I){y.status="error",y.value=I}return y}(r.exports=g).prototype.finally=function(m){if(typeof m!="function")return this;var h=this.constructor;return this.then(function(y){return h.resolve(m()).then(function(){return y})},function(y){return h.resolve(m()).then(function(){throw y})})},g.prototype.catch=function(m){return this.then(null,m)},g.prototype.then=function(m,h){if(typeof m!="function"&&this.state===d||typeof h!="function"&&this.state===u)return this;var y=new this.constructor(l);return this.state!==_?p(y,this.state===d?m:h,this.outcome):this.queue.push(new w(y,m,h)),y},w.prototype.callFulfilled=function(m){o.resolve(this.promise,m)},w.prototype.otherCallFulfilled=function(m){p(this.promise,this.onFulfilled,m)},w.prototype.callRejected=function(m){o.reject(this.promise,m)},w.prototype.otherCallRejected=function(m){p(this.promise,this.onRejected,m)},o.resolve=function(m,h){var y=b(S,h);if(y.status==="error")return o.reject(m,y.value);var I=y.value;if(I)f(m,I);else{m.state=d,m.outcome=h;for(var v=-1,C=m.queue.length;++v<C;)m.queue[v].callFulfilled(h)}return m},o.reject=function(m,h){m.state=u,m.outcome=h;for(var y=-1,I=m.queue.length;++y<I;)m.queue[y].callRejected(h);return m},g.resolve=function(m){return m instanceof this?m:o.resolve(new this(l),m)},g.reject=function(m){var h=new this(l);return o.reject(h,m)},g.all=function(m){var h=this;if(Object.prototype.toString.call(m)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=m.length,I=!1;if(!y)return this.resolve([]);for(var v=new Array(y),C=0,T=-1,F=new this(l);++T<y;)D(m[T],T);return F;function D(V,te){h.resolve(V).then(function(x){v[te]=x,++C!==y||I||(I=!0,o.resolve(F,v))},function(x){I||(I=!0,o.reject(F,x))})}},g.race=function(m){var h=this;if(Object.prototype.toString.call(m)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=m.length,I=!1;if(!y)return this.resolve([]);for(var v=-1,C=new this(l);++v<y;)T=m[v],h.resolve(T).then(function(F){I||(I=!0,o.resolve(C,F))},function(F){I||(I=!0,o.reject(C,F))});var T;return C}},{immediate:36}],38:[function(n,r,i){var s={};(0,n("./lib/utils/common").assign)(s,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,i){var s=n("./zlib/deflate"),l=n("./utils/common"),o=n("./utils/strings"),u=n("./zlib/messages"),d=n("./zlib/zstream"),_=Object.prototype.toString,g=0,w=-1,p=0,S=8;function f(m){if(!(this instanceof f))return new f(m);this.options=l.assign({level:w,method:S,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},m||{});var h=this.options;h.raw&&0<h.windowBits?h.windowBits=-h.windowBits:h.gzip&&0<h.windowBits&&h.windowBits<16&&(h.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var y=s.deflateInit2(this.strm,h.level,h.method,h.windowBits,h.memLevel,h.strategy);if(y!==g)throw new Error(u[y]);if(h.header&&s.deflateSetHeader(this.strm,h.header),h.dictionary){var I;if(I=typeof h.dictionary=="string"?o.string2buf(h.dictionary):_.call(h.dictionary)==="[object ArrayBuffer]"?new Uint8Array(h.dictionary):h.dictionary,(y=s.deflateSetDictionary(this.strm,I))!==g)throw new Error(u[y]);this._dict_set=!0}}function b(m,h){var y=new f(h);if(y.push(m,!0),y.err)throw y.msg||u[y.err];return y.result}f.prototype.push=function(m,h){var y,I,v=this.strm,C=this.options.chunkSize;if(this.ended)return!1;I=h===~~h?h:h===!0?4:0,typeof m=="string"?v.input=o.string2buf(m):_.call(m)==="[object ArrayBuffer]"?v.input=new Uint8Array(m):v.input=m,v.next_in=0,v.avail_in=v.input.length;do{if(v.avail_out===0&&(v.output=new l.Buf8(C),v.next_out=0,v.avail_out=C),(y=s.deflate(v,I))!==1&&y!==g)return this.onEnd(y),!(this.ended=!0);v.avail_out!==0&&(v.avail_in!==0||I!==4&&I!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(l.shrinkBuf(v.output,v.next_out))):this.onData(l.shrinkBuf(v.output,v.next_out)))}while((0<v.avail_in||v.avail_out===0)&&y!==1);return I===4?(y=s.deflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===g):I!==2||(this.onEnd(g),!(v.avail_out=0))},f.prototype.onData=function(m){this.chunks.push(m)},f.prototype.onEnd=function(m){m===g&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=l.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},i.Deflate=f,i.deflate=b,i.deflateRaw=function(m,h){return(h=h||{}).raw=!0,b(m,h)},i.gzip=function(m,h){return(h=h||{}).gzip=!0,b(m,h)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,i){var s=n("./zlib/inflate"),l=n("./utils/common"),o=n("./utils/strings"),u=n("./zlib/constants"),d=n("./zlib/messages"),_=n("./zlib/zstream"),g=n("./zlib/gzheader"),w=Object.prototype.toString;function p(f){if(!(this instanceof p))return new p(f);this.options=l.assign({chunkSize:16384,windowBits:0,to:""},f||{});var b=this.options;b.raw&&0<=b.windowBits&&b.windowBits<16&&(b.windowBits=-b.windowBits,b.windowBits===0&&(b.windowBits=-15)),!(0<=b.windowBits&&b.windowBits<16)||f&&f.windowBits||(b.windowBits+=32),15<b.windowBits&&b.windowBits<48&&(15&b.windowBits)==0&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _,this.strm.avail_out=0;var m=s.inflateInit2(this.strm,b.windowBits);if(m!==u.Z_OK)throw new Error(d[m]);this.header=new g,s.inflateGetHeader(this.strm,this.header)}function S(f,b){var m=new p(b);if(m.push(f,!0),m.err)throw m.msg||d[m.err];return m.result}p.prototype.push=function(f,b){var m,h,y,I,v,C,T=this.strm,F=this.options.chunkSize,D=this.options.dictionary,V=!1;if(this.ended)return!1;h=b===~~b?b:b===!0?u.Z_FINISH:u.Z_NO_FLUSH,typeof f=="string"?T.input=o.binstring2buf(f):w.call(f)==="[object ArrayBuffer]"?T.input=new Uint8Array(f):T.input=f,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new l.Buf8(F),T.next_out=0,T.avail_out=F),(m=s.inflate(T,u.Z_NO_FLUSH))===u.Z_NEED_DICT&&D&&(C=typeof D=="string"?o.string2buf(D):w.call(D)==="[object ArrayBuffer]"?new Uint8Array(D):D,m=s.inflateSetDictionary(this.strm,C)),m===u.Z_BUF_ERROR&&V===!0&&(m=u.Z_OK,V=!1),m!==u.Z_STREAM_END&&m!==u.Z_OK)return this.onEnd(m),!(this.ended=!0);T.next_out&&(T.avail_out!==0&&m!==u.Z_STREAM_END&&(T.avail_in!==0||h!==u.Z_FINISH&&h!==u.Z_SYNC_FLUSH)||(this.options.to==="string"?(y=o.utf8border(T.output,T.next_out),I=T.next_out-y,v=o.buf2string(T.output,y),T.next_out=I,T.avail_out=F-I,I&&l.arraySet(T.output,T.output,y,I,0),this.onData(v)):this.onData(l.shrinkBuf(T.output,T.next_out)))),T.avail_in===0&&T.avail_out===0&&(V=!0)}while((0<T.avail_in||T.avail_out===0)&&m!==u.Z_STREAM_END);return m===u.Z_STREAM_END&&(h=u.Z_FINISH),h===u.Z_FINISH?(m=s.inflateEnd(this.strm),this.onEnd(m),this.ended=!0,m===u.Z_OK):h!==u.Z_SYNC_FLUSH||(this.onEnd(u.Z_OK),!(T.avail_out=0))},p.prototype.onData=function(f){this.chunks.push(f)},p.prototype.onEnd=function(f){f===u.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=l.flattenChunks(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg},i.Inflate=p,i.inflate=S,i.inflateRaw=function(f,b){return(b=b||{}).raw=!0,S(f,b)},i.ungzip=S},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";i.assign=function(u){for(var d=Array.prototype.slice.call(arguments,1);d.length;){var _=d.shift();if(_){if(typeof _!="object")throw new TypeError(_+"must be non-object");for(var g in _)_.hasOwnProperty(g)&&(u[g]=_[g])}}return u},i.shrinkBuf=function(u,d){return u.length===d?u:u.subarray?u.subarray(0,d):(u.length=d,u)};var l={arraySet:function(u,d,_,g,w){if(d.subarray&&u.subarray)u.set(d.subarray(_,_+g),w);else for(var p=0;p<g;p++)u[w+p]=d[_+p]},flattenChunks:function(u){var d,_,g,w,p,S;for(d=g=0,_=u.length;d<_;d++)g+=u[d].length;for(S=new Uint8Array(g),d=w=0,_=u.length;d<_;d++)p=u[d],S.set(p,w),w+=p.length;return S}},o={arraySet:function(u,d,_,g,w){for(var p=0;p<g;p++)u[w+p]=d[_+p]},flattenChunks:function(u){return[].concat.apply([],u)}};i.setTyped=function(u){u?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,l)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,o))},i.setTyped(s)},{}],42:[function(n,r,i){var s=n("./common"),l=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{l=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var u=new s.Buf8(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;function _(g,w){if(w<65537&&(g.subarray&&o||!g.subarray&&l))return String.fromCharCode.apply(null,s.shrinkBuf(g,w));for(var p="",S=0;S<w;S++)p+=String.fromCharCode(g[S]);return p}u[254]=u[254]=1,i.string2buf=function(g){var w,p,S,f,b,m=g.length,h=0;for(f=0;f<m;f++)(64512&(p=g.charCodeAt(f)))==55296&&f+1<m&&(64512&(S=g.charCodeAt(f+1)))==56320&&(p=65536+(p-55296<<10)+(S-56320),f++),h+=p<128?1:p<2048?2:p<65536?3:4;for(w=new s.Buf8(h),f=b=0;b<h;f++)(64512&(p=g.charCodeAt(f)))==55296&&f+1<m&&(64512&(S=g.charCodeAt(f+1)))==56320&&(p=65536+(p-55296<<10)+(S-56320),f++),p<128?w[b++]=p:(p<2048?w[b++]=192|p>>>6:(p<65536?w[b++]=224|p>>>12:(w[b++]=240|p>>>18,w[b++]=128|p>>>12&63),w[b++]=128|p>>>6&63),w[b++]=128|63&p);return w},i.buf2binstring=function(g){return _(g,g.length)},i.binstring2buf=function(g){for(var w=new s.Buf8(g.length),p=0,S=w.length;p<S;p++)w[p]=g.charCodeAt(p);return w},i.buf2string=function(g,w){var p,S,f,b,m=w||g.length,h=new Array(2*m);for(p=S=0;p<m;)if((f=g[p++])<128)h[S++]=f;else if(4<(b=u[f]))h[S++]=65533,p+=b-1;else{for(f&=b===2?31:b===3?15:7;1<b&&p<m;)f=f<<6|63&g[p++],b--;1<b?h[S++]=65533:f<65536?h[S++]=f:(f-=65536,h[S++]=55296|f>>10&1023,h[S++]=56320|1023&f)}return _(h,S)},i.utf8border=function(g,w){var p;for((w=w||g.length)>g.length&&(w=g.length),p=w-1;0<=p&&(192&g[p])==128;)p--;return p<0||p===0?w:p+u[g[p]]>w?p:w}},{"./common":41}],43:[function(n,r,i){r.exports=function(s,l,o,u){for(var d=65535&s|0,_=s>>>16&65535|0,g=0;o!==0;){for(o-=g=2e3<o?2e3:o;_=_+(d=d+l[u++]|0)|0,--g;);d%=65521,_%=65521}return d|_<<16|0}},{}],44:[function(n,r,i){r.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(n,r,i){var s=(function(){for(var l,o=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;o[u]=l}return o})();r.exports=function(l,o,u,d){var _=s,g=d+u;l^=-1;for(var w=d;w<g;w++)l=l>>>8^_[255&(l^o[w])];return-1^l}},{}],46:[function(n,r,i){var s,l=n("../utils/common"),o=n("./trees"),u=n("./adler32"),d=n("./crc32"),_=n("./messages"),g=0,w=4,p=0,S=-2,f=-1,b=4,m=2,h=8,y=9,I=286,v=30,C=19,T=2*I+1,F=15,D=3,V=258,te=V+D+1,x=42,j=113,c=1,U=2,N=3,P=4;function q(a,$){return a.msg=_[$],$}function B(a){return(a<<1)-(4<a?9:0)}function J(a){for(var $=a.length;0<=--$;)a[$]=0}function A(a){var $=a.state,z=$.pending;z>a.avail_out&&(z=a.avail_out),z!==0&&(l.arraySet(a.output,$.pending_buf,$.pending_out,z,a.next_out),a.next_out+=z,$.pending_out+=z,a.total_out+=z,a.avail_out-=z,$.pending-=z,$.pending===0&&($.pending_out=0))}function R(a,$){o._tr_flush_block(a,0<=a.block_start?a.block_start:-1,a.strstart-a.block_start,$),a.block_start=a.strstart,A(a.strm)}function Y(a,$){a.pending_buf[a.pending++]=$}function G(a,$){a.pending_buf[a.pending++]=$>>>8&255,a.pending_buf[a.pending++]=255&$}function W(a,$){var z,O,E=a.max_chain_length,k=a.strstart,H=a.prev_length,Z=a.nice_match,M=a.strstart>a.w_size-te?a.strstart-(a.w_size-te):0,X=a.window,Q=a.w_mask,K=a.prev,ne=a.strstart+V,de=X[k+H-1],ue=X[k+H];a.prev_length>=a.good_match&&(E>>=2),Z>a.lookahead&&(Z=a.lookahead);do if(X[(z=$)+H]===ue&&X[z+H-1]===de&&X[z]===X[k]&&X[++z]===X[k+1]){k+=2,z++;do;while(X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&k<ne);if(O=V-(ne-k),k=ne-V,H<O){if(a.match_start=$,Z<=(H=O))break;de=X[k+H-1],ue=X[k+H]}}while(($=K[$&Q])>M&&--E!=0);return H<=a.lookahead?H:a.lookahead}function ae(a){var $,z,O,E,k,H,Z,M,X,Q,K=a.w_size;do{if(E=a.window_size-a.lookahead-a.strstart,a.strstart>=K+(K-te)){for(l.arraySet(a.window,a.window,K,K,0),a.match_start-=K,a.strstart-=K,a.block_start-=K,$=z=a.hash_size;O=a.head[--$],a.head[$]=K<=O?O-K:0,--z;);for($=z=K;O=a.prev[--$],a.prev[$]=K<=O?O-K:0,--z;);E+=K}if(a.strm.avail_in===0)break;if(H=a.strm,Z=a.window,M=a.strstart+a.lookahead,X=E,Q=void 0,Q=H.avail_in,X<Q&&(Q=X),z=Q===0?0:(H.avail_in-=Q,l.arraySet(Z,H.input,H.next_in,Q,M),H.state.wrap===1?H.adler=u(H.adler,Z,Q,M):H.state.wrap===2&&(H.adler=d(H.adler,Z,Q,M)),H.next_in+=Q,H.total_in+=Q,Q),a.lookahead+=z,a.lookahead+a.insert>=D)for(k=a.strstart-a.insert,a.ins_h=a.window[k],a.ins_h=(a.ins_h<<a.hash_shift^a.window[k+1])&a.hash_mask;a.insert&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[k+D-1])&a.hash_mask,a.prev[k&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=k,k++,a.insert--,!(a.lookahead+a.insert<D)););}while(a.lookahead<te&&a.strm.avail_in!==0)}function ie(a,$){for(var z,O;;){if(a.lookahead<te){if(ae(a),a.lookahead<te&&$===g)return c;if(a.lookahead===0)break}if(z=0,a.lookahead>=D&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+D-1])&a.hash_mask,z=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),z!==0&&a.strstart-z<=a.w_size-te&&(a.match_length=W(a,z)),a.match_length>=D)if(O=o._tr_tally(a,a.strstart-a.match_start,a.match_length-D),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=D){for(a.match_length--;a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+D-1])&a.hash_mask,z=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart,--a.match_length!=0;);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else O=o._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(O&&(R(a,!1),a.strm.avail_out===0))return c}return a.insert=a.strstart<D-1?a.strstart:D-1,$===w?(R(a,!0),a.strm.avail_out===0?N:P):a.last_lit&&(R(a,!1),a.strm.avail_out===0)?c:U}function re(a,$){for(var z,O,E;;){if(a.lookahead<te){if(ae(a),a.lookahead<te&&$===g)return c;if(a.lookahead===0)break}if(z=0,a.lookahead>=D&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+D-1])&a.hash_mask,z=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),a.prev_length=a.match_length,a.prev_match=a.match_start,a.match_length=D-1,z!==0&&a.prev_length<a.max_lazy_match&&a.strstart-z<=a.w_size-te&&(a.match_length=W(a,z),a.match_length<=5&&(a.strategy===1||a.match_length===D&&4096<a.strstart-a.match_start)&&(a.match_length=D-1)),a.prev_length>=D&&a.match_length<=a.prev_length){for(E=a.strstart+a.lookahead-D,O=o._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-D),a.lookahead-=a.prev_length-1,a.prev_length-=2;++a.strstart<=E&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+D-1])&a.hash_mask,z=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),--a.prev_length!=0;);if(a.match_available=0,a.match_length=D-1,a.strstart++,O&&(R(a,!1),a.strm.avail_out===0))return c}else if(a.match_available){if((O=o._tr_tally(a,0,a.window[a.strstart-1]))&&R(a,!1),a.strstart++,a.lookahead--,a.strm.avail_out===0)return c}else a.match_available=1,a.strstart++,a.lookahead--}return a.match_available&&(O=o._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0),a.insert=a.strstart<D-1?a.strstart:D-1,$===w?(R(a,!0),a.strm.avail_out===0?N:P):a.last_lit&&(R(a,!1),a.strm.avail_out===0)?c:U}function se(a,$,z,O,E){this.good_length=a,this.max_lazy=$,this.nice_length=z,this.max_chain=O,this.func=E}function ce(){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=h,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 l.Buf16(2*T),this.dyn_dtree=new l.Buf16(2*(2*v+1)),this.bl_tree=new l.Buf16(2*(2*C+1)),J(this.dyn_ltree),J(this.dyn_dtree),J(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new l.Buf16(F+1),this.heap=new l.Buf16(2*I+1),J(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new l.Buf16(2*I+1),J(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 pe(a){var $;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=m,($=a.state).pending=0,$.pending_out=0,$.wrap<0&&($.wrap=-$.wrap),$.status=$.wrap?x:j,a.adler=$.wrap===2?0:1,$.last_flush=g,o._tr_init($),p):q(a,S)}function fe(a){var $=pe(a);return $===p&&(function(z){z.window_size=2*z.w_size,J(z.head),z.max_lazy_match=s[z.level].max_lazy,z.good_match=s[z.level].good_length,z.nice_match=s[z.level].nice_length,z.max_chain_length=s[z.level].max_chain,z.strstart=0,z.block_start=0,z.lookahead=0,z.insert=0,z.match_length=z.prev_length=D-1,z.match_available=0,z.ins_h=0})(a.state),$}function ge(a,$,z,O,E,k){if(!a)return S;var H=1;if($===f&&($=6),O<0?(H=0,O=-O):15<O&&(H=2,O-=16),E<1||y<E||z!==h||O<8||15<O||$<0||9<$||k<0||b<k)return q(a,S);O===8&&(O=9);var Z=new ce;return(a.state=Z).strm=a,Z.wrap=H,Z.gzhead=null,Z.w_bits=O,Z.w_size=1<<Z.w_bits,Z.w_mask=Z.w_size-1,Z.hash_bits=E+7,Z.hash_size=1<<Z.hash_bits,Z.hash_mask=Z.hash_size-1,Z.hash_shift=~~((Z.hash_bits+D-1)/D),Z.window=new l.Buf8(2*Z.w_size),Z.head=new l.Buf16(Z.hash_size),Z.prev=new l.Buf16(Z.w_size),Z.lit_bufsize=1<<E+6,Z.pending_buf_size=4*Z.lit_bufsize,Z.pending_buf=new l.Buf8(Z.pending_buf_size),Z.d_buf=1*Z.lit_bufsize,Z.l_buf=3*Z.lit_bufsize,Z.level=$,Z.strategy=k,Z.method=z,fe(a)}s=[new se(0,0,0,0,function(a,$){var z=65535;for(z>a.pending_buf_size-5&&(z=a.pending_buf_size-5);;){if(a.lookahead<=1){if(ae(a),a.lookahead===0&&$===g)return c;if(a.lookahead===0)break}a.strstart+=a.lookahead,a.lookahead=0;var O=a.block_start+z;if((a.strstart===0||a.strstart>=O)&&(a.lookahead=a.strstart-O,a.strstart=O,R(a,!1),a.strm.avail_out===0)||a.strstart-a.block_start>=a.w_size-te&&(R(a,!1),a.strm.avail_out===0))return c}return a.insert=0,$===w?(R(a,!0),a.strm.avail_out===0?N:P):(a.strstart>a.block_start&&(R(a,!1),a.strm.avail_out),c)}),new se(4,4,8,4,ie),new se(4,5,16,8,ie),new se(4,6,32,32,ie),new se(4,4,16,16,re),new se(8,16,32,32,re),new se(8,16,128,128,re),new se(8,32,128,256,re),new se(32,128,258,1024,re),new se(32,258,258,4096,re)],i.deflateInit=function(a,$){return ge(a,$,h,15,8,0)},i.deflateInit2=ge,i.deflateReset=fe,i.deflateResetKeep=pe,i.deflateSetHeader=function(a,$){return a&&a.state?a.state.wrap!==2?S:(a.state.gzhead=$,p):S},i.deflate=function(a,$){var z,O,E,k;if(!a||!a.state||5<$||$<0)return a?q(a,S):S;if(O=a.state,!a.output||!a.input&&a.avail_in!==0||O.status===666&&$!==w)return q(a,a.avail_out===0?-5:S);if(O.strm=a,z=O.last_flush,O.last_flush=$,O.status===x)if(O.wrap===2)a.adler=0,Y(O,31),Y(O,139),Y(O,8),O.gzhead?(Y(O,(O.gzhead.text?1:0)+(O.gzhead.hcrc?2:0)+(O.gzhead.extra?4:0)+(O.gzhead.name?8:0)+(O.gzhead.comment?16:0)),Y(O,255&O.gzhead.time),Y(O,O.gzhead.time>>8&255),Y(O,O.gzhead.time>>16&255),Y(O,O.gzhead.time>>24&255),Y(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),Y(O,255&O.gzhead.os),O.gzhead.extra&&O.gzhead.extra.length&&(Y(O,255&O.gzhead.extra.length),Y(O,O.gzhead.extra.length>>8&255)),O.gzhead.hcrc&&(a.adler=d(a.adler,O.pending_buf,O.pending,0)),O.gzindex=0,O.status=69):(Y(O,0),Y(O,0),Y(O,0),Y(O,0),Y(O,0),Y(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),Y(O,3),O.status=j);else{var H=h+(O.w_bits-8<<4)<<8;H|=(2<=O.strategy||O.level<2?0:O.level<6?1:O.level===6?2:3)<<6,O.strstart!==0&&(H|=32),H+=31-H%31,O.status=j,G(O,H),O.strstart!==0&&(G(O,a.adler>>>16),G(O,65535&a.adler)),a.adler=1}if(O.status===69)if(O.gzhead.extra){for(E=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>E&&(a.adler=d(a.adler,O.pending_buf,O.pending-E,E)),A(a),E=O.pending,O.pending!==O.pending_buf_size));)Y(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>E&&(a.adler=d(a.adler,O.pending_buf,O.pending-E,E)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){E=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>E&&(a.adler=d(a.adler,O.pending_buf,O.pending-E,E)),A(a),E=O.pending,O.pending===O.pending_buf_size)){k=1;break}k=O.gzindex<O.gzhead.name.length?255&O.gzhead.name.charCodeAt(O.gzindex++):0,Y(O,k)}while(k!==0);O.gzhead.hcrc&&O.pending>E&&(a.adler=d(a.adler,O.pending_buf,O.pending-E,E)),k===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){E=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>E&&(a.adler=d(a.adler,O.pending_buf,O.pending-E,E)),A(a),E=O.pending,O.pending===O.pending_buf_size)){k=1;break}k=O.gzindex<O.gzhead.comment.length?255&O.gzhead.comment.charCodeAt(O.gzindex++):0,Y(O,k)}while(k!==0);O.gzhead.hcrc&&O.pending>E&&(a.adler=d(a.adler,O.pending_buf,O.pending-E,E)),k===0&&(O.status=103)}else O.status=103;if(O.status===103&&(O.gzhead.hcrc?(O.pending+2>O.pending_buf_size&&A(a),O.pending+2<=O.pending_buf_size&&(Y(O,255&a.adler),Y(O,a.adler>>8&255),a.adler=0,O.status=j)):O.status=j),O.pending!==0){if(A(a),a.avail_out===0)return O.last_flush=-1,p}else if(a.avail_in===0&&B($)<=B(z)&&$!==w)return q(a,-5);if(O.status===666&&a.avail_in!==0)return q(a,-5);if(a.avail_in!==0||O.lookahead!==0||$!==g&&O.status!==666){var Z=O.strategy===2?(function(M,X){for(var Q;;){if(M.lookahead===0&&(ae(M),M.lookahead===0)){if(X===g)return c;break}if(M.match_length=0,Q=o._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++,Q&&(R(M,!1),M.strm.avail_out===0))return c}return M.insert=0,X===w?(R(M,!0),M.strm.avail_out===0?N:P):M.last_lit&&(R(M,!1),M.strm.avail_out===0)?c:U})(O,$):O.strategy===3?(function(M,X){for(var Q,K,ne,de,ue=M.window;;){if(M.lookahead<=V){if(ae(M),M.lookahead<=V&&X===g)return c;if(M.lookahead===0)break}if(M.match_length=0,M.lookahead>=D&&0<M.strstart&&(K=ue[ne=M.strstart-1])===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]){de=M.strstart+V;do;while(K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&ne<de);M.match_length=V-(de-ne),M.match_length>M.lookahead&&(M.match_length=M.lookahead)}if(M.match_length>=D?(Q=o._tr_tally(M,1,M.match_length-D),M.lookahead-=M.match_length,M.strstart+=M.match_length,M.match_length=0):(Q=o._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++),Q&&(R(M,!1),M.strm.avail_out===0))return c}return M.insert=0,X===w?(R(M,!0),M.strm.avail_out===0?N:P):M.last_lit&&(R(M,!1),M.strm.avail_out===0)?c:U})(O,$):s[O.level].func(O,$);if(Z!==N&&Z!==P||(O.status=666),Z===c||Z===N)return a.avail_out===0&&(O.last_flush=-1),p;if(Z===U&&($===1?o._tr_align(O):$!==5&&(o._tr_stored_block(O,0,0,!1),$===3&&(J(O.head),O.lookahead===0&&(O.strstart=0,O.block_start=0,O.insert=0))),A(a),a.avail_out===0))return O.last_flush=-1,p}return $!==w?p:O.wrap<=0?1:(O.wrap===2?(Y(O,255&a.adler),Y(O,a.adler>>8&255),Y(O,a.adler>>16&255),Y(O,a.adler>>24&255),Y(O,255&a.total_in),Y(O,a.total_in>>8&255),Y(O,a.total_in>>16&255),Y(O,a.total_in>>24&255)):(G(O,a.adler>>>16),G(O,65535&a.adler)),A(a),0<O.wrap&&(O.wrap=-O.wrap),O.pending!==0?p:1)},i.deflateEnd=function(a){var $;return a&&a.state?($=a.state.status)!==x&&$!==69&&$!==73&&$!==91&&$!==103&&$!==j&&$!==666?q(a,S):(a.state=null,$===j?q(a,-3):p):S},i.deflateSetDictionary=function(a,$){var z,O,E,k,H,Z,M,X,Q=$.length;if(!a||!a.state||(k=(z=a.state).wrap)===2||k===1&&z.status!==x||z.lookahead)return S;for(k===1&&(a.adler=u(a.adler,$,Q,0)),z.wrap=0,Q>=z.w_size&&(k===0&&(J(z.head),z.strstart=0,z.block_start=0,z.insert=0),X=new l.Buf8(z.w_size),l.arraySet(X,$,Q-z.w_size,z.w_size,0),$=X,Q=z.w_size),H=a.avail_in,Z=a.next_in,M=a.input,a.avail_in=Q,a.next_in=0,a.input=$,ae(z);z.lookahead>=D;){for(O=z.strstart,E=z.lookahead-(D-1);z.ins_h=(z.ins_h<<z.hash_shift^z.window[O+D-1])&z.hash_mask,z.prev[O&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=O,O++,--E;);z.strstart=O,z.lookahead=D-1,ae(z)}return z.strstart+=z.lookahead,z.block_start=z.strstart,z.insert=z.lookahead,z.lookahead=0,z.match_length=z.prev_length=D-1,z.match_available=0,a.next_in=Z,a.input=M,a.avail_in=H,z.wrap=k,p},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,i){r.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(n,r,i){r.exports=function(s,l){var o,u,d,_,g,w,p,S,f,b,m,h,y,I,v,C,T,F,D,V,te,x,j,c,U;o=s.state,u=s.next_in,c=s.input,d=u+(s.avail_in-5),_=s.next_out,U=s.output,g=_-(l-s.avail_out),w=_+(s.avail_out-257),p=o.dmax,S=o.wsize,f=o.whave,b=o.wnext,m=o.window,h=o.hold,y=o.bits,I=o.lencode,v=o.distcode,C=(1<<o.lenbits)-1,T=(1<<o.distbits)-1;e:do{y<15&&(h+=c[u++]<<y,y+=8,h+=c[u++]<<y,y+=8),F=I[h&C];t:for(;;){if(h>>>=D=F>>>24,y-=D,(D=F>>>16&255)===0)U[_++]=65535&F;else{if(!(16&D)){if((64&D)==0){F=I[(65535&F)+(h&(1<<D)-1)];continue t}if(32&D){o.mode=12;break e}s.msg="invalid literal/length code",o.mode=30;break e}V=65535&F,(D&=15)&&(y<D&&(h+=c[u++]<<y,y+=8),V+=h&(1<<D)-1,h>>>=D,y-=D),y<15&&(h+=c[u++]<<y,y+=8,h+=c[u++]<<y,y+=8),F=v[h&T];n:for(;;){if(h>>>=D=F>>>24,y-=D,!(16&(D=F>>>16&255))){if((64&D)==0){F=v[(65535&F)+(h&(1<<D)-1)];continue n}s.msg="invalid distance code",o.mode=30;break e}if(te=65535&F,y<(D&=15)&&(h+=c[u++]<<y,(y+=8)<D&&(h+=c[u++]<<y,y+=8)),p<(te+=h&(1<<D)-1)){s.msg="invalid distance too far back",o.mode=30;break e}if(h>>>=D,y-=D,(D=_-g)<te){if(f<(D=te-D)&&o.sane){s.msg="invalid distance too far back",o.mode=30;break e}if(j=m,(x=0)===b){if(x+=S-D,D<V){for(V-=D;U[_++]=m[x++],--D;);x=_-te,j=U}}else if(b<D){if(x+=S+b-D,(D-=b)<V){for(V-=D;U[_++]=m[x++],--D;);if(x=0,b<V){for(V-=D=b;U[_++]=m[x++],--D;);x=_-te,j=U}}}else if(x+=b-D,D<V){for(V-=D;U[_++]=m[x++],--D;);x=_-te,j=U}for(;2<V;)U[_++]=j[x++],U[_++]=j[x++],U[_++]=j[x++],V-=3;V&&(U[_++]=j[x++],1<V&&(U[_++]=j[x++]))}else{for(x=_-te;U[_++]=U[x++],U[_++]=U[x++],U[_++]=U[x++],2<(V-=3););V&&(U[_++]=U[x++],1<V&&(U[_++]=U[x++]))}break}}break}}while(u<d&&_<w);u-=V=y>>3,h&=(1<<(y-=V<<3))-1,s.next_in=u,s.next_out=_,s.avail_in=u<d?d-u+5:5-(u-d),s.avail_out=_<w?w-_+257:257-(_-w),o.hold=h,o.bits=y}},{}],49:[function(n,r,i){var s=n("../utils/common"),l=n("./adler32"),o=n("./crc32"),u=n("./inffast"),d=n("./inftrees"),_=1,g=2,w=0,p=-2,S=1,f=852,b=592;function m(x){return(x>>>24&255)+(x>>>8&65280)+((65280&x)<<8)+((255&x)<<24)}function h(){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 s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(x){var j;return x&&x.state?(j=x.state,x.total_in=x.total_out=j.total=0,x.msg="",j.wrap&&(x.adler=1&j.wrap),j.mode=S,j.last=0,j.havedict=0,j.dmax=32768,j.head=null,j.hold=0,j.bits=0,j.lencode=j.lendyn=new s.Buf32(f),j.distcode=j.distdyn=new s.Buf32(b),j.sane=1,j.back=-1,w):p}function I(x){var j;return x&&x.state?((j=x.state).wsize=0,j.whave=0,j.wnext=0,y(x)):p}function v(x,j){var c,U;return x&&x.state?(U=x.state,j<0?(c=0,j=-j):(c=1+(j>>4),j<48&&(j&=15)),j&&(j<8||15<j)?p:(U.window!==null&&U.wbits!==j&&(U.window=null),U.wrap=c,U.wbits=j,I(x))):p}function C(x,j){var c,U;return x?(U=new h,(x.state=U).window=null,(c=v(x,j))!==w&&(x.state=null),c):p}var T,F,D=!0;function V(x){if(D){var j;for(T=new s.Buf32(512),F=new s.Buf32(32),j=0;j<144;)x.lens[j++]=8;for(;j<256;)x.lens[j++]=9;for(;j<280;)x.lens[j++]=7;for(;j<288;)x.lens[j++]=8;for(d(_,x.lens,0,288,T,0,x.work,{bits:9}),j=0;j<32;)x.lens[j++]=5;d(g,x.lens,0,32,F,0,x.work,{bits:5}),D=!1}x.lencode=T,x.lenbits=9,x.distcode=F,x.distbits=5}function te(x,j,c,U){var N,P=x.state;return P.window===null&&(P.wsize=1<<P.wbits,P.wnext=0,P.whave=0,P.window=new s.Buf8(P.wsize)),U>=P.wsize?(s.arraySet(P.window,j,c-P.wsize,P.wsize,0),P.wnext=0,P.whave=P.wsize):(U<(N=P.wsize-P.wnext)&&(N=U),s.arraySet(P.window,j,c-U,N,P.wnext),(U-=N)?(s.arraySet(P.window,j,c-U,U,0),P.wnext=U,P.whave=P.wsize):(P.wnext+=N,P.wnext===P.wsize&&(P.wnext=0),P.whave<P.wsize&&(P.whave+=N))),0}i.inflateReset=I,i.inflateReset2=v,i.inflateResetKeep=y,i.inflateInit=function(x){return C(x,15)},i.inflateInit2=C,i.inflate=function(x,j){var c,U,N,P,q,B,J,A,R,Y,G,W,ae,ie,re,se,ce,pe,fe,ge,a,$,z,O,E=0,k=new s.Buf8(4),H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!x||!x.state||!x.output||!x.input&&x.avail_in!==0)return p;(c=x.state).mode===12&&(c.mode=13),q=x.next_out,N=x.output,J=x.avail_out,P=x.next_in,U=x.input,B=x.avail_in,A=c.hold,R=c.bits,Y=B,G=J,$=w;e:for(;;)switch(c.mode){case S:if(c.wrap===0){c.mode=13;break}for(;R<16;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(2&c.wrap&&A===35615){k[c.check=0]=255&A,k[1]=A>>>8&255,c.check=o(c.check,k,2,0),R=A=0,c.mode=2;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&A)<<8)+(A>>8))%31){x.msg="incorrect header check",c.mode=30;break}if((15&A)!=8){x.msg="unknown compression method",c.mode=30;break}if(R-=4,a=8+(15&(A>>>=4)),c.wbits===0)c.wbits=a;else if(a>c.wbits){x.msg="invalid window size",c.mode=30;break}c.dmax=1<<a,x.adler=c.check=1,c.mode=512&A?10:12,R=A=0;break;case 2:for(;R<16;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(c.flags=A,(255&c.flags)!=8){x.msg="unknown compression method",c.mode=30;break}if(57344&c.flags){x.msg="unknown header flags set",c.mode=30;break}c.head&&(c.head.text=A>>8&1),512&c.flags&&(k[0]=255&A,k[1]=A>>>8&255,c.check=o(c.check,k,2,0)),R=A=0,c.mode=3;case 3:for(;R<32;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.head&&(c.head.time=A),512&c.flags&&(k[0]=255&A,k[1]=A>>>8&255,k[2]=A>>>16&255,k[3]=A>>>24&255,c.check=o(c.check,k,4,0)),R=A=0,c.mode=4;case 4:for(;R<16;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.head&&(c.head.xflags=255&A,c.head.os=A>>8),512&c.flags&&(k[0]=255&A,k[1]=A>>>8&255,c.check=o(c.check,k,2,0)),R=A=0,c.mode=5;case 5:if(1024&c.flags){for(;R<16;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.length=A,c.head&&(c.head.extra_len=A),512&c.flags&&(k[0]=255&A,k[1]=A>>>8&255,c.check=o(c.check,k,2,0)),R=A=0}else c.head&&(c.head.extra=null);c.mode=6;case 6:if(1024&c.flags&&(B<(W=c.length)&&(W=B),W&&(c.head&&(a=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),s.arraySet(c.head.extra,U,P,W,a)),512&c.flags&&(c.check=o(c.check,U,W,P)),B-=W,P+=W,c.length-=W),c.length))break e;c.length=0,c.mode=7;case 7:if(2048&c.flags){if(B===0)break e;for(W=0;a=U[P+W++],c.head&&a&&c.length<65536&&(c.head.name+=String.fromCharCode(a)),a&&W<B;);if(512&c.flags&&(c.check=o(c.check,U,W,P)),B-=W,P+=W,a)break e}else c.head&&(c.head.name=null);c.length=0,c.mode=8;case 8:if(4096&c.flags){if(B===0)break e;for(W=0;a=U[P+W++],c.head&&a&&c.length<65536&&(c.head.comment+=String.fromCharCode(a)),a&&W<B;);if(512&c.flags&&(c.check=o(c.check,U,W,P)),B-=W,P+=W,a)break e}else c.head&&(c.head.comment=null);c.mode=9;case 9:if(512&c.flags){for(;R<16;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(A!==(65535&c.check)){x.msg="header crc mismatch",c.mode=30;break}R=A=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0),x.adler=c.check=0,c.mode=12;break;case 10:for(;R<32;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}x.adler=c.check=m(A),R=A=0,c.mode=11;case 11:if(c.havedict===0)return x.next_out=q,x.avail_out=J,x.next_in=P,x.avail_in=B,c.hold=A,c.bits=R,2;x.adler=c.check=1,c.mode=12;case 12:if(j===5||j===6)break e;case 13:if(c.last){A>>>=7&R,R-=7&R,c.mode=27;break}for(;R<3;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}switch(c.last=1&A,R-=1,3&(A>>>=1)){case 0:c.mode=14;break;case 1:if(V(c),c.mode=20,j!==6)break;A>>>=2,R-=2;break e;case 2:c.mode=17;break;case 3:x.msg="invalid block type",c.mode=30}A>>>=2,R-=2;break;case 14:for(A>>>=7&R,R-=7&R;R<32;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if((65535&A)!=(A>>>16^65535)){x.msg="invalid stored block lengths",c.mode=30;break}if(c.length=65535&A,R=A=0,c.mode=15,j===6)break e;case 15:c.mode=16;case 16:if(W=c.length){if(B<W&&(W=B),J<W&&(W=J),W===0)break e;s.arraySet(N,U,P,W,q),B-=W,P+=W,J-=W,q+=W,c.length-=W;break}c.mode=12;break;case 17:for(;R<14;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(c.nlen=257+(31&A),A>>>=5,R-=5,c.ndist=1+(31&A),A>>>=5,R-=5,c.ncode=4+(15&A),A>>>=4,R-=4,286<c.nlen||30<c.ndist){x.msg="too many length or distance symbols",c.mode=30;break}c.have=0,c.mode=18;case 18:for(;c.have<c.ncode;){for(;R<3;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.lens[H[c.have++]]=7&A,A>>>=3,R-=3}for(;c.have<19;)c.lens[H[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,z={bits:c.lenbits},$=d(0,c.lens,0,19,c.lencode,0,c.work,z),c.lenbits=z.bits,$){x.msg="invalid code lengths set",c.mode=30;break}c.have=0,c.mode=19;case 19:for(;c.have<c.nlen+c.ndist;){for(;se=(E=c.lencode[A&(1<<c.lenbits)-1])>>>16&255,ce=65535&E,!((re=E>>>24)<=R);){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(ce<16)A>>>=re,R-=re,c.lens[c.have++]=ce;else{if(ce===16){for(O=re+2;R<O;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(A>>>=re,R-=re,c.have===0){x.msg="invalid bit length repeat",c.mode=30;break}a=c.lens[c.have-1],W=3+(3&A),A>>>=2,R-=2}else if(ce===17){for(O=re+3;R<O;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}R-=re,a=0,W=3+(7&(A>>>=re)),A>>>=3,R-=3}else{for(O=re+7;R<O;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}R-=re,a=0,W=11+(127&(A>>>=re)),A>>>=7,R-=7}if(c.have+W>c.nlen+c.ndist){x.msg="invalid bit length repeat",c.mode=30;break}for(;W--;)c.lens[c.have++]=a}}if(c.mode===30)break;if(c.lens[256]===0){x.msg="invalid code -- missing end-of-block",c.mode=30;break}if(c.lenbits=9,z={bits:c.lenbits},$=d(_,c.lens,0,c.nlen,c.lencode,0,c.work,z),c.lenbits=z.bits,$){x.msg="invalid literal/lengths set",c.mode=30;break}if(c.distbits=6,c.distcode=c.distdyn,z={bits:c.distbits},$=d(g,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,z),c.distbits=z.bits,$){x.msg="invalid distances set",c.mode=30;break}if(c.mode=20,j===6)break e;case 20:c.mode=21;case 21:if(6<=B&&258<=J){x.next_out=q,x.avail_out=J,x.next_in=P,x.avail_in=B,c.hold=A,c.bits=R,u(x,G),q=x.next_out,N=x.output,J=x.avail_out,P=x.next_in,U=x.input,B=x.avail_in,A=c.hold,R=c.bits,c.mode===12&&(c.back=-1);break}for(c.back=0;se=(E=c.lencode[A&(1<<c.lenbits)-1])>>>16&255,ce=65535&E,!((re=E>>>24)<=R);){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(se&&(240&se)==0){for(pe=re,fe=se,ge=ce;se=(E=c.lencode[ge+((A&(1<<pe+fe)-1)>>pe)])>>>16&255,ce=65535&E,!(pe+(re=E>>>24)<=R);){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}A>>>=pe,R-=pe,c.back+=pe}if(A>>>=re,R-=re,c.back+=re,c.length=ce,se===0){c.mode=26;break}if(32&se){c.back=-1,c.mode=12;break}if(64&se){x.msg="invalid literal/length code",c.mode=30;break}c.extra=15&se,c.mode=22;case 22:if(c.extra){for(O=c.extra;R<O;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.length+=A&(1<<c.extra)-1,A>>>=c.extra,R-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=23;case 23:for(;se=(E=c.distcode[A&(1<<c.distbits)-1])>>>16&255,ce=65535&E,!((re=E>>>24)<=R);){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if((240&se)==0){for(pe=re,fe=se,ge=ce;se=(E=c.distcode[ge+((A&(1<<pe+fe)-1)>>pe)])>>>16&255,ce=65535&E,!(pe+(re=E>>>24)<=R);){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}A>>>=pe,R-=pe,c.back+=pe}if(A>>>=re,R-=re,c.back+=re,64&se){x.msg="invalid distance code",c.mode=30;break}c.offset=ce,c.extra=15&se,c.mode=24;case 24:if(c.extra){for(O=c.extra;R<O;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.offset+=A&(1<<c.extra)-1,A>>>=c.extra,R-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){x.msg="invalid distance too far back",c.mode=30;break}c.mode=25;case 25:if(J===0)break e;if(W=G-J,c.offset>W){if((W=c.offset-W)>c.whave&&c.sane){x.msg="invalid distance too far back",c.mode=30;break}ae=W>c.wnext?(W-=c.wnext,c.wsize-W):c.wnext-W,W>c.length&&(W=c.length),ie=c.window}else ie=N,ae=q-c.offset,W=c.length;for(J<W&&(W=J),J-=W,c.length-=W;N[q++]=ie[ae++],--W;);c.length===0&&(c.mode=21);break;case 26:if(J===0)break e;N[q++]=c.length,J--,c.mode=21;break;case 27:if(c.wrap){for(;R<32;){if(B===0)break e;B--,A|=U[P++]<<R,R+=8}if(G-=J,x.total_out+=G,c.total+=G,G&&(x.adler=c.check=c.flags?o(c.check,N,G,q-G):l(c.check,N,G,q-G)),G=J,(c.flags?A:m(A))!==c.check){x.msg="incorrect data check",c.mode=30;break}R=A=0}c.mode=28;case 28:if(c.wrap&&c.flags){for(;R<32;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(A!==(4294967295&c.total)){x.msg="incorrect length check",c.mode=30;break}R=A=0}c.mode=29;case 29:$=1;break e;case 30:$=-3;break e;case 31:return-4;case 32:default:return p}return x.next_out=q,x.avail_out=J,x.next_in=P,x.avail_in=B,c.hold=A,c.bits=R,(c.wsize||G!==x.avail_out&&c.mode<30&&(c.mode<27||j!==4))&&te(x,x.output,x.next_out,G-x.avail_out)?(c.mode=31,-4):(Y-=x.avail_in,G-=x.avail_out,x.total_in+=Y,x.total_out+=G,c.total+=G,c.wrap&&G&&(x.adler=c.check=c.flags?o(c.check,N,G,x.next_out-G):l(c.check,N,G,x.next_out-G)),x.data_type=c.bits+(c.last?64:0)+(c.mode===12?128:0)+(c.mode===20||c.mode===15?256:0),(Y==0&&G===0||j===4)&&$===w&&($=-5),$)},i.inflateEnd=function(x){if(!x||!x.state)return p;var j=x.state;return j.window&&(j.window=null),x.state=null,w},i.inflateGetHeader=function(x,j){var c;return x&&x.state?(2&(c=x.state).wrap)==0?p:((c.head=j).done=!1,w):p},i.inflateSetDictionary=function(x,j){var c,U=j.length;return x&&x.state?(c=x.state).wrap!==0&&c.mode!==11?p:c.mode===11&&l(1,j,U,0)!==c.check?-3:te(x,j,U,U)?(c.mode=31,-4):(c.havedict=1,w):p},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,i){var s=n("../utils/common"),l=[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],o=[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],u=[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],d=[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];r.exports=function(_,g,w,p,S,f,b,m){var h,y,I,v,C,T,F,D,V,te=m.bits,x=0,j=0,c=0,U=0,N=0,P=0,q=0,B=0,J=0,A=0,R=null,Y=0,G=new s.Buf16(16),W=new s.Buf16(16),ae=null,ie=0;for(x=0;x<=15;x++)G[x]=0;for(j=0;j<p;j++)G[g[w+j]]++;for(N=te,U=15;1<=U&&G[U]===0;U--);if(U<N&&(N=U),U===0)return S[f++]=20971520,S[f++]=20971520,m.bits=1,0;for(c=1;c<U&&G[c]===0;c++);for(N<c&&(N=c),x=B=1;x<=15;x++)if(B<<=1,(B-=G[x])<0)return-1;if(0<B&&(_===0||U!==1))return-1;for(W[1]=0,x=1;x<15;x++)W[x+1]=W[x]+G[x];for(j=0;j<p;j++)g[w+j]!==0&&(b[W[g[w+j]]++]=j);if(T=_===0?(R=ae=b,19):_===1?(R=l,Y-=257,ae=o,ie-=257,256):(R=u,ae=d,-1),x=c,C=f,q=j=A=0,I=-1,v=(J=1<<(P=N))-1,_===1&&852<J||_===2&&592<J)return 1;for(;;){for(F=x-q,V=b[j]<T?(D=0,b[j]):b[j]>T?(D=ae[ie+b[j]],R[Y+b[j]]):(D=96,0),h=1<<x-q,c=y=1<<P;S[C+(A>>q)+(y-=h)]=F<<24|D<<16|V|0,y!==0;);for(h=1<<x-1;A&h;)h>>=1;if(h!==0?(A&=h-1,A+=h):A=0,j++,--G[x]==0){if(x===U)break;x=g[w+b[j]]}if(N<x&&(A&v)!==I){for(q===0&&(q=N),C+=c,B=1<<(P=x-q);P+q<U&&!((B-=G[P+q])<=0);)P++,B<<=1;if(J+=1<<P,_===1&&852<J||_===2&&592<J)return 1;S[I=A&v]=N<<24|P<<16|C-f|0}}return A!==0&&(S[C+A]=x-q<<24|64<<16|0),m.bits=N,0}},{"../utils/common":41}],51:[function(n,r,i){r.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(n,r,i){var s=n("../utils/common"),l=0,o=1;function u(E){for(var k=E.length;0<=--k;)E[k]=0}var d=0,_=29,g=256,w=g+1+_,p=30,S=19,f=2*w+1,b=15,m=16,h=7,y=256,I=16,v=17,C=18,T=[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],F=[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],D=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],V=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],te=new Array(2*(w+2));u(te);var x=new Array(2*p);u(x);var j=new Array(512);u(j);var c=new Array(256);u(c);var U=new Array(_);u(U);var N,P,q,B=new Array(p);function J(E,k,H,Z,M){this.static_tree=E,this.extra_bits=k,this.extra_base=H,this.elems=Z,this.max_length=M,this.has_stree=E&&E.length}function A(E,k){this.dyn_tree=E,this.max_code=0,this.stat_desc=k}function R(E){return E<256?j[E]:j[256+(E>>>7)]}function Y(E,k){E.pending_buf[E.pending++]=255&k,E.pending_buf[E.pending++]=k>>>8&255}function G(E,k,H){E.bi_valid>m-H?(E.bi_buf|=k<<E.bi_valid&65535,Y(E,E.bi_buf),E.bi_buf=k>>m-E.bi_valid,E.bi_valid+=H-m):(E.bi_buf|=k<<E.bi_valid&65535,E.bi_valid+=H)}function W(E,k,H){G(E,H[2*k],H[2*k+1])}function ae(E,k){for(var H=0;H|=1&E,E>>>=1,H<<=1,0<--k;);return H>>>1}function ie(E,k,H){var Z,M,X=new Array(b+1),Q=0;for(Z=1;Z<=b;Z++)X[Z]=Q=Q+H[Z-1]<<1;for(M=0;M<=k;M++){var K=E[2*M+1];K!==0&&(E[2*M]=ae(X[K]++,K))}}function re(E){var k;for(k=0;k<w;k++)E.dyn_ltree[2*k]=0;for(k=0;k<p;k++)E.dyn_dtree[2*k]=0;for(k=0;k<S;k++)E.bl_tree[2*k]=0;E.dyn_ltree[2*y]=1,E.opt_len=E.static_len=0,E.last_lit=E.matches=0}function se(E){8<E.bi_valid?Y(E,E.bi_buf):0<E.bi_valid&&(E.pending_buf[E.pending++]=E.bi_buf),E.bi_buf=0,E.bi_valid=0}function ce(E,k,H,Z){var M=2*k,X=2*H;return E[M]<E[X]||E[M]===E[X]&&Z[k]<=Z[H]}function pe(E,k,H){for(var Z=E.heap[H],M=H<<1;M<=E.heap_len&&(M<E.heap_len&&ce(k,E.heap[M+1],E.heap[M],E.depth)&&M++,!ce(k,Z,E.heap[M],E.depth));)E.heap[H]=E.heap[M],H=M,M<<=1;E.heap[H]=Z}function fe(E,k,H){var Z,M,X,Q,K=0;if(E.last_lit!==0)for(;Z=E.pending_buf[E.d_buf+2*K]<<8|E.pending_buf[E.d_buf+2*K+1],M=E.pending_buf[E.l_buf+K],K++,Z===0?W(E,M,k):(W(E,(X=c[M])+g+1,k),(Q=T[X])!==0&&G(E,M-=U[X],Q),W(E,X=R(--Z),H),(Q=F[X])!==0&&G(E,Z-=B[X],Q)),K<E.last_lit;);W(E,y,k)}function ge(E,k){var H,Z,M,X=k.dyn_tree,Q=k.stat_desc.static_tree,K=k.stat_desc.has_stree,ne=k.stat_desc.elems,de=-1;for(E.heap_len=0,E.heap_max=f,H=0;H<ne;H++)X[2*H]!==0?(E.heap[++E.heap_len]=de=H,E.depth[H]=0):X[2*H+1]=0;for(;E.heap_len<2;)X[2*(M=E.heap[++E.heap_len]=de<2?++de:0)]=1,E.depth[M]=0,E.opt_len--,K&&(E.static_len-=Q[2*M+1]);for(k.max_code=de,H=E.heap_len>>1;1<=H;H--)pe(E,X,H);for(M=ne;H=E.heap[1],E.heap[1]=E.heap[E.heap_len--],pe(E,X,1),Z=E.heap[1],E.heap[--E.heap_max]=H,E.heap[--E.heap_max]=Z,X[2*M]=X[2*H]+X[2*Z],E.depth[M]=(E.depth[H]>=E.depth[Z]?E.depth[H]:E.depth[Z])+1,X[2*H+1]=X[2*Z+1]=M,E.heap[1]=M++,pe(E,X,1),2<=E.heap_len;);E.heap[--E.heap_max]=E.heap[1],(function(ue,Oe){var We,ve,He,he,ot,Ot,Ae=Oe.dyn_tree,Xt=Oe.max_code,Ir=Oe.stat_desc.static_tree,Ar=Oe.stat_desc.has_stree,Rr=Oe.stat_desc.extra_bits,Kt=Oe.stat_desc.extra_base,Ze=Oe.stat_desc.max_length,st=0;for(he=0;he<=b;he++)ue.bl_count[he]=0;for(Ae[2*ue.heap[ue.heap_max]+1]=0,We=ue.heap_max+1;We<f;We++)Ze<(he=Ae[2*Ae[2*(ve=ue.heap[We])+1]+1]+1)&&(he=Ze,st++),Ae[2*ve+1]=he,Xt<ve||(ue.bl_count[he]++,ot=0,Kt<=ve&&(ot=Rr[ve-Kt]),Ot=Ae[2*ve],ue.opt_len+=Ot*(he+ot),Ar&&(ue.static_len+=Ot*(Ir[2*ve+1]+ot)));if(st!==0){do{for(he=Ze-1;ue.bl_count[he]===0;)he--;ue.bl_count[he]--,ue.bl_count[he+1]+=2,ue.bl_count[Ze]--,st-=2}while(0<st);for(he=Ze;he!==0;he--)for(ve=ue.bl_count[he];ve!==0;)Xt<(He=ue.heap[--We])||(Ae[2*He+1]!==he&&(ue.opt_len+=(he-Ae[2*He+1])*Ae[2*He],Ae[2*He+1]=he),ve--)}})(E,k),ie(X,de,E.bl_count)}function a(E,k,H){var Z,M,X=-1,Q=k[1],K=0,ne=7,de=4;for(Q===0&&(ne=138,de=3),k[2*(H+1)+1]=65535,Z=0;Z<=H;Z++)M=Q,Q=k[2*(Z+1)+1],++K<ne&&M===Q||(K<de?E.bl_tree[2*M]+=K:M!==0?(M!==X&&E.bl_tree[2*M]++,E.bl_tree[2*I]++):K<=10?E.bl_tree[2*v]++:E.bl_tree[2*C]++,X=M,de=(K=0)===Q?(ne=138,3):M===Q?(ne=6,3):(ne=7,4))}function $(E,k,H){var Z,M,X=-1,Q=k[1],K=0,ne=7,de=4;for(Q===0&&(ne=138,de=3),Z=0;Z<=H;Z++)if(M=Q,Q=k[2*(Z+1)+1],!(++K<ne&&M===Q)){if(K<de)for(;W(E,M,E.bl_tree),--K!=0;);else M!==0?(M!==X&&(W(E,M,E.bl_tree),K--),W(E,I,E.bl_tree),G(E,K-3,2)):K<=10?(W(E,v,E.bl_tree),G(E,K-3,3)):(W(E,C,E.bl_tree),G(E,K-11,7));X=M,de=(K=0)===Q?(ne=138,3):M===Q?(ne=6,3):(ne=7,4)}}u(B);var z=!1;function O(E,k,H,Z){G(E,(d<<1)+(Z?1:0),3),(function(M,X,Q,K){se(M),Y(M,Q),Y(M,~Q),s.arraySet(M.pending_buf,M.window,X,Q,M.pending),M.pending+=Q})(E,k,H)}i._tr_init=function(E){z||((function(){var k,H,Z,M,X,Q=new Array(b+1);for(M=Z=0;M<_-1;M++)for(U[M]=Z,k=0;k<1<<T[M];k++)c[Z++]=M;for(c[Z-1]=M,M=X=0;M<16;M++)for(B[M]=X,k=0;k<1<<F[M];k++)j[X++]=M;for(X>>=7;M<p;M++)for(B[M]=X<<7,k=0;k<1<<F[M]-7;k++)j[256+X++]=M;for(H=0;H<=b;H++)Q[H]=0;for(k=0;k<=143;)te[2*k+1]=8,k++,Q[8]++;for(;k<=255;)te[2*k+1]=9,k++,Q[9]++;for(;k<=279;)te[2*k+1]=7,k++,Q[7]++;for(;k<=287;)te[2*k+1]=8,k++,Q[8]++;for(ie(te,w+1,Q),k=0;k<p;k++)x[2*k+1]=5,x[2*k]=ae(k,5);N=new J(te,T,g+1,w,b),P=new J(x,F,0,p,b),q=new J(new Array(0),D,0,S,h)})(),z=!0),E.l_desc=new A(E.dyn_ltree,N),E.d_desc=new A(E.dyn_dtree,P),E.bl_desc=new A(E.bl_tree,q),E.bi_buf=0,E.bi_valid=0,re(E)},i._tr_stored_block=O,i._tr_flush_block=function(E,k,H,Z){var M,X,Q=0;0<E.level?(E.strm.data_type===2&&(E.strm.data_type=(function(K){var ne,de=4093624447;for(ne=0;ne<=31;ne++,de>>>=1)if(1&de&&K.dyn_ltree[2*ne]!==0)return l;if(K.dyn_ltree[18]!==0||K.dyn_ltree[20]!==0||K.dyn_ltree[26]!==0)return o;for(ne=32;ne<g;ne++)if(K.dyn_ltree[2*ne]!==0)return o;return l})(E)),ge(E,E.l_desc),ge(E,E.d_desc),Q=(function(K){var ne;for(a(K,K.dyn_ltree,K.l_desc.max_code),a(K,K.dyn_dtree,K.d_desc.max_code),ge(K,K.bl_desc),ne=S-1;3<=ne&&K.bl_tree[2*V[ne]+1]===0;ne--);return K.opt_len+=3*(ne+1)+5+5+4,ne})(E),M=E.opt_len+3+7>>>3,(X=E.static_len+3+7>>>3)<=M&&(M=X)):M=X=H+5,H+4<=M&&k!==-1?O(E,k,H,Z):E.strategy===4||X===M?(G(E,2+(Z?1:0),3),fe(E,te,x)):(G(E,4+(Z?1:0),3),(function(K,ne,de,ue){var Oe;for(G(K,ne-257,5),G(K,de-1,5),G(K,ue-4,4),Oe=0;Oe<ue;Oe++)G(K,K.bl_tree[2*V[Oe]+1],3);$(K,K.dyn_ltree,ne-1),$(K,K.dyn_dtree,de-1)})(E,E.l_desc.max_code+1,E.d_desc.max_code+1,Q+1),fe(E,E.dyn_ltree,E.dyn_dtree)),re(E),Z&&se(E)},i._tr_tally=function(E,k,H){return E.pending_buf[E.d_buf+2*E.last_lit]=k>>>8&255,E.pending_buf[E.d_buf+2*E.last_lit+1]=255&k,E.pending_buf[E.l_buf+E.last_lit]=255&H,E.last_lit++,k===0?E.dyn_ltree[2*H]++:(E.matches++,k--,E.dyn_ltree[2*(c[H]+g+1)]++,E.dyn_dtree[2*R(k)]++),E.last_lit===E.lit_bufsize-1},i._tr_align=function(E){G(E,2,3),W(E,y,te),(function(k){k.bi_valid===16?(Y(k,k.bi_buf),k.bi_buf=0,k.bi_valid=0):8<=k.bi_valid&&(k.pending_buf[k.pending++]=255&k.bi_buf,k.bi_buf>>=8,k.bi_valid-=8)})(E)}},{"../utils/common":41}],53:[function(n,r,i){r.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(n,r,i){(function(s){(function(l,o){if(!l.setImmediate){var u,d,_,g,w=1,p={},S=!1,f=l.document,b=Object.getPrototypeOf&&Object.getPrototypeOf(l);b=b&&b.setTimeout?b:l,u={}.toString.call(l.process)==="[object process]"?function(I){Cr.nextTick(function(){h(I)})}:(function(){if(l.postMessage&&!l.importScripts){var I=!0,v=l.onmessage;return l.onmessage=function(){I=!1},l.postMessage("","*"),l.onmessage=v,I}})()?(g="setImmediate$"+Math.random()+"$",l.addEventListener?l.addEventListener("message",y,!1):l.attachEvent("onmessage",y),function(I){l.postMessage(g+I,"*")}):l.MessageChannel?((_=new MessageChannel).port1.onmessage=function(I){h(I.data)},function(I){_.port2.postMessage(I)}):f&&"onreadystatechange"in f.createElement("script")?(d=f.documentElement,function(I){var v=f.createElement("script");v.onreadystatechange=function(){h(I),v.onreadystatechange=null,d.removeChild(v),v=null},d.appendChild(v)}):function(I){setTimeout(h,0,I)},b.setImmediate=function(I){typeof I!="function"&&(I=new Function(""+I));for(var v=new Array(arguments.length-1),C=0;C<v.length;C++)v[C]=arguments[C+1];var T={callback:I,args:v};return p[w]=T,u(w),w++},b.clearImmediate=m}function m(I){delete p[I]}function h(I){if(S)setTimeout(h,0,I);else{var v=p[I];if(v){S=!0;try{(function(C){var T=C.callback,F=C.args;switch(F.length){case 0:T();break;case 1:T(F[0]);break;case 2:T(F[0],F[1]);break;case 3:T(F[0],F[1],F[2]);break;default:T.apply(o,F)}})(v)}finally{m(I),S=!1}}}}function y(I){I.source===l&&typeof I.data=="string"&&I.data.indexOf(g)===0&&h(+I.data.slice(g.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof at<"u"?at:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(wt)),wt.exports}var Pi=Ni();const xn=dn(Pi);function zi(e){const t=[],n=Object.keys(e);for(const r of n){const i=e[r];if(!i)continue;const s=i.sort((o,u)=>o.index-u.index);let l=-1;for(let o=0;o<s.length;o++)l=l+1+s[o].skip,s[o].index!==l&&t.push({message:`Invalid operation index ${s[o].index} at position ${o}`,details:{position:o,operation:s[o],scope:s[o].action.scope}})}return t}function Li(e){const t=new xn,n=e.header;return t.file("header.json",JSON.stringify(n,null,2)),t.file("state.json",JSON.stringify(e.initialState||{},null,2)),t.file("current-state.json",JSON.stringify(e.state||{},null,2)),t.file("operations.json",JSON.stringify(Ti(e.operations),null,2)),t}async function Ui(e,t){const r=await Li(e).generateAsync({type:"blob"}),i=await t.createWritable();await i.write(r),await i.close()}async function ji(e,t,n){const r=new xn;return await r.loadAsync(e),Bi(r,t,n)}async function Bi(e,t,n){const r=e.file("state.json");if(!r)throw new Error("Initial state not found");const i=await r.async("string"),s=JSON.parse(i),l=e.file("header.json");if(!l)throw new Error("Document header not found - file format may be outdated");const o=JSON.parse(await l.async("string")),u=e.file("operations.json");if(!u)throw new Error("Operations history not found");const d=JSON.parse(await u.async("string")),_=ht(d),g=zi(_);if(g.length){const p=g.map(S=>S.message);throw new Error(p.join(`
|
|
22
|
-
`))}return wn(s,_,t,o,void 0,{},n)}const Fi=/@([a-zA-Z0-9_]+)/g,$i=new Intl.DateTimeFormat,Xe=(e,t,n)=>{const r={},i=[];let s;for(;(s=Fi.exec(t))!==null;){const u=s[1];if(i.indexOf(u)===-1){i.push(u);const _=n[i.length-1];r[u]=_}}for(const[u,d]of Object.entries(r)){let _;if(!d)_="null";else if(typeof d=="string")_=d;else if(typeof d=="object")_=JSON.stringify(d);else if(typeof d=="function"){const g=d.name;_=g?`${g}()`:"anonymous()"}else _=String(d);t=t.replaceAll(`@${u}`,_)}e.length>0&&(t=`${e} ${t}`);const l=new Date,o=$i.format(l);return r.timestamp=o,[t,r]},Re={verbose:0,debug:1,info:2,warn:3,error:4};class Lt{#n;#t;#e=Re.info;errorHandler;constructor(t,n){this.#n=t||[],this.#t=this.#n.map(r=>`[${r}]`).join(""),this.errorHandler=n??(()=>{})}get level(){return Object.keys(Re).find(t=>Re[t]===this.#e)}set level(t){this.#e=Re[t]}child(t){const n=new Lt([...this.#n,...t],this.errorHandler);return n.level=this.level,n}verbose(t,...n){if(this.#e<=Re.verbose){const[r,i]=Xe(this.#t,t,n);console.debug(`[${i.timestamp}] ${r}`,i)}}debug(t,...n){if(this.#e<=Re.debug){const[r,i]=Xe(this.#t,t,n);console.debug(`[${i.timestamp}] ${r}`,i)}}info(t,...n){if(this.#e<=Re.info){const[r,i]=Xe(this.#t,t,n);console.info(`[${i.timestamp}] ${r}`,i)}}warn(t,...n){if(this.#e<=Re.warn){const[r,i]=Xe(this.#t,t,n);console.warn(`[${i.timestamp}] ${r}`,i)}}error(t,...n){if(this.#e<=Re.error){const[r,i]=Xe(this.#t,t,n);console.error(`[${i.timestamp}] ${r}`,i)}}}const In=new Lt,la=e=>{In.level=e},ua=e=>In.child(e),me={Remove:"remove",Replace:"replace",Add:"add"},An=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),Wi=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),dt=Symbol.iterator,Se={mutable:"mutable",immutable:"immutable"},Ut={};function Ye(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function tn(e,t){if(t in e){let n=Reflect.getPrototypeOf(e);for(;n;){const r=Reflect.getOwnPropertyDescriptor(n,t);if(r)return r;n=Reflect.getPrototypeOf(n)}}}function jt(e){return Object.getPrototypeOf(e)===Set.prototype}function Bt(e){return Object.getPrototypeOf(e)===Map.prototype}function Ee(e){var t;return(t=e.copy)!==null&&t!==void 0?t:e.original}function Me(e){return!!le(e)}function le(e){return typeof e!="object"?null:e?.[An]}function Ft(e){var t;const n=le(e);return n?(t=n.copy)!==null&&t!==void 0?t:n.original:e}function we(e,t){if(!e||typeof e!="object")return!1;let n;return Object.getPrototypeOf(e)===Object.prototype||Array.isArray(e)||e instanceof Map||e instanceof Set||!!t?.mark&&((n=t.mark(e,Se))===Se.immutable||typeof n=="function")}function Rn(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=le(De(n,e.key));if(r!==null&&r?.original!==e.original)return null;const i=e.parent.type===3,s=i?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(i&&n.size>s||Ye(n,s)))return null;t.push(s)}if(e.parent)return Rn(e.parent,t);t.reverse();try{Hi(e.copy,t)}catch{return null}return t}function Ue(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function De(e,t){return Ue(e)===2?e.get(t):e[t]}function nt(e,t,n){Ue(e)===2?e.set(t,n):e[t]=n}function vt(e,t){const n=le(e);return(n?Ee(n):e)[t]}function ke(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function xt(e){if(e)for(;e.finalities.revoke.length>0;)e.finalities.revoke.pop()()}function ze(e,t){return t?e:[""].concat(e).map(n=>{const r=`${n}`;return r.indexOf("/")===-1&&r.indexOf("~")===-1?r:r.replace(/~/g,"~0").replace(/\//g,"~1")}).join("/")}function Hi(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if(e=De(Ue(e)===3?Array.from(e):e,r),typeof e!="object")throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}return e}function Zi(e){const t=Object.create(Object.getPrototypeOf(e));return Reflect.ownKeys(e).forEach(n=>{let r=Reflect.getOwnPropertyDescriptor(e,n);if(r.enumerable&&r.configurable&&r.writable){t[n]=e[n];return}r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[n]}),Reflect.defineProperty(t,n,r)}),t}const Vi=Object.prototype.propertyIsEnumerable;function kn(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set){if(!jt(e)){const r=Object.getPrototypeOf(e).constructor;return new r(e.values())}return Set.prototype.difference?Set.prototype.difference.call(e,new Set):new Set(e.values())}else if(e instanceof Map){if(!Bt(e)){const r=Object.getPrototypeOf(e).constructor;return new r(e)}return new Map(e)}else if(t?.mark&&(n=t.mark(e,Se),n!==void 0)&&n!==Se.mutable){if(n===Se.immutable)return Zi(e);if(typeof n=="function"){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}else if(typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype){const r={};return Object.keys(e).forEach(i=>{r[i]=e[i]}),Object.getOwnPropertySymbols(e).forEach(i=>{Vi.call(e,i)&&(r[i]=e[i])}),r}else throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function _e(e){e.copy||(e.copy=kn(e.original,e.options))}function qe(e){if(!we(e))return Ft(e);if(Array.isArray(e))return e.map(qe);if(e instanceof Map){const n=Array.from(e.entries()).map(([r,i])=>[r,qe(i)]);if(!Bt(e)){const r=Object.getPrototypeOf(e).constructor;return new r(n)}return new Map(n)}if(e instanceof Set){const n=Array.from(e).map(qe);if(!jt(e)){const r=Object.getPrototypeOf(e).constructor;return new r(n)}return new Set(n)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=qe(e[n]);return t}function ft(e){return Me(e)?qe(e):e}function Ie(e){var t;e.assignedMap=(t=e.assignedMap)!==null&&t!==void 0?t:new Map,e.operated||(e.operated=!0,e.parent&&Ie(e.parent))}function nn(){throw new Error("Cannot modify frozen object")}function Fe(e,t,n,r,i){{n=n??new WeakMap,r=r??[],i=i??[];const l=n.has(e)?n.get(e):e;if(r.length>0){const o=r.indexOf(l);if(l&&typeof l=="object"&&o!==-1)throw r[0]===l?new Error("Forbids circular reference"):new Error(`Forbids circular reference: ~/${i.slice(0,o).map((u,d)=>{if(typeof u=="symbol")return`[${u.toString()}]`;const _=r[d];return typeof u=="object"&&(_ instanceof Map||_ instanceof Set)?Array.from(_.keys()).indexOf(u):u}).join("/")}`);r.push(l),i.push(t)}else r.push(l)}if(Object.isFrozen(e)||Me(e)){r.pop(),i.pop();return}switch(Ue(e)){case 2:for(const[o,u]of e)Fe(o,o,n,r,i),Fe(u,o,n,r,i);e.set=e.clear=e.delete=nn;break;case 3:for(const o of e)Fe(o,o,n,r,i);e.add=e.clear=e.delete=nn;break;case 1:Object.freeze(e);let l=0;for(const o of e)Fe(o,l,n,r,i),l+=1;break;default:Object.freeze(e),Object.keys(e).forEach(o=>{const u=e[o];Fe(u,o,n,r,i)})}r.pop(),i.pop()}function $t(e,t){const n=Ue(e);if(n===0)Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)});else if(n===1){let r=0;for(const i of e)t(r,i,e),r+=1}else e.forEach((r,i)=>t(i,r,e))}function Tn(e,t,n){if(Me(e)||!we(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),$t(e,(s,l)=>{var o;if(Me(l)){const u=le(l);_e(u);const d=!((o=u.assignedMap)===null||o===void 0)&&o.size||u.operated?u.copy:u.original;nt(r?i:e,s,d)}else Tn(l,t,n)}),i){const s=e,l=Array.from(s);s.clear(),l.forEach(o=>{s.add(i.has(o)?i.get(o):o)})}}function Gi(e,t){const n=e.type===3?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&Tn(De(n,t),e.finalities.handledSet,e.options)}function It(e){e.type===3&&e.copy&&(e.copy.clear(),e.setMap.forEach(t=>{e.copy.add(Ft(t))}))}function At(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const s=Rn(e);s&&t(e,s,n,r)}e.finalized=!0}}function Wt(e,t,n,r){const i=le(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push((s,l)=>{var o;const u=e.type===3?e.setMap:e.copy;if(ke(De(u,t),n)){let d=i.original;i.copy&&(d=i.copy),It(e),At(e,r,s,l),e.options.enableAutoFreeze&&(e.options.updatedValues=(o=e.options.updatedValues)!==null&&o!==void 0?o:new WeakMap,e.options.updatedValues.set(d,i.original)),nt(u,t,d)}}),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),we(n,e.options)&&e.finalities.draft.push(()=>{const s=e.type===3?e.setMap:e.copy;ke(De(s,t),n)&&Gi(e,t)})}function Xi(e,t,n,r,i){let{original:s,assignedMap:l,options:o}=e,u=e.copy;u.length<s.length&&([s,u]=[u,s],[n,r]=[r,n]);for(let d=0;d<s.length;d+=1)if(l.get(d.toString())&&u[d]!==s[d]){const _=t.concat([d]),g=ze(_,i);n.push({op:me.Replace,path:g,value:ft(u[d])}),r.push({op:me.Replace,path:g,value:ft(s[d])})}for(let d=s.length;d<u.length;d+=1){const _=t.concat([d]),g=ze(_,i);n.push({op:me.Add,path:g,value:ft(u[d])})}if(s.length<u.length){const{arrayLengthAssignment:d=!0}=o.enablePatches;if(d){const _=t.concat(["length"]),g=ze(_,i);r.push({op:me.Replace,path:g,value:s.length})}else for(let _=u.length;s.length<_;_-=1){const g=t.concat([_-1]),w=ze(g,i);r.push({op:me.Remove,path:w})}}}function Ki({original:e,copy:t,assignedMap:n},r,i,s,l){n.forEach((o,u)=>{const d=De(e,u),_=ft(De(t,u)),g=o?Ye(e,u)?me.Replace:me.Add:me.Remove;if(ke(d,_)&&g===me.Replace)return;const w=r.concat(u),p=ze(w,l);i.push(g===me.Remove?{op:g,path:p}:{op:g,path:p,value:_}),s.push(g===me.Add?{op:me.Remove,path:p}:g===me.Remove?{op:me.Add,path:p,value:d}:{op:me.Replace,path:p,value:d})})}function Ji({original:e,copy:t},n,r,i,s){let l=0;e.forEach(o=>{if(!t.has(o)){const u=n.concat([l]),d=ze(u,s);r.push({op:me.Remove,path:d,value:o}),i.unshift({op:me.Add,path:d,value:o})}l+=1}),l=0,t.forEach(o=>{if(!e.has(o)){const u=n.concat([l]),d=ze(u,s);r.push({op:me.Add,path:d,value:o}),i.unshift({op:me.Remove,path:d,value:o})}l+=1})}function Qe(e,t,n,r){const{pathAsArray:i=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return Ki(e,t,n,r,i);case 1:return Xi(e,t,n,r,i);case 3:return Ji(e,t,n,r,i)}}let Rt=!1;const mt=(e,t,n=!1)=>{if(typeof e=="object"&&e!==null&&(!we(e,t)||n)&&!Rt)throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")};function qi(e){Rt=!0;let t;try{t=e()}finally{Rt=!1}return t}const kt={get size(){return Ee(le(this)).size},has(e){return Ee(le(this)).has(e)},set(e,t){const n=le(this),r=Ee(n);return(!r.has(e)||!ke(r.get(e),t))&&(_e(n),Ie(n),n.assignedMap.set(e,!0),n.copy.set(e,t),Wt(n,e,t,Qe)),this},delete(e){if(!this.has(e))return!1;const t=le(this);return _e(t),Ie(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=le(this);if(this.size){_e(e),Ie(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){const n=le(this);Ee(n).forEach((r,i)=>{e.call(t,this.get(i),i,this)})},get(e){var t,n;const r=le(this),i=Ee(r).get(e),s=((n=(t=r.options).mark)===null||n===void 0?void 0:n.call(t,i,Se))===Se.mutable;if(r.options.strict&&mt(i,r.options,s),s||r.finalized||!we(i,r.options)||i!==r.original.get(e))return i;const l=Ut.createDraft({original:i,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return _e(r),r.copy.set(e,l),l},keys(){return Ee(le(this)).keys()},values(){const e=this.keys();return{[dt]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[dt]:()=>this.entries(),next:()=>{const t=e.next();if(t.done)return t;const n=this.get(t.value);return{done:!1,value:[t.value,n]}}}},[dt](){return this.entries()}},Yi=Reflect.ownKeys(kt),rn=(e,t,{isValuesIterator:n})=>()=>{var r,i;const s=t.next();if(s.done)return s;const l=s.value;let o=e.setMap.get(l);const u=le(o),d=((i=(r=e.options).mark)===null||i===void 0?void 0:i.call(r,o,Se))===Se.mutable;if(e.options.strict&&mt(l,e.options,d),!d&&!u&&we(l,e.options)&&!e.finalized&&e.original.has(l)){const _=Ut.createDraft({original:l,parentDraft:e,key:l,finalities:e.finalities,options:e.options});e.setMap.set(l,_),o=_}else u&&(o=u.proxy);return{done:!1,value:n?o:[o,o]}},gt={get size(){return le(this).setMap.size},has(e){const t=le(this);if(t.setMap.has(e))return!0;_e(t);const n=le(e);return!!(n&&t.setMap.has(n.original))},add(e){const t=le(this);return this.has(e)||(_e(t),Ie(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),Wt(t,e,e,Qe)),this},delete(e){if(!this.has(e))return!1;const t=le(this);_e(t),Ie(t);const n=le(e);return n&&t.setMap.has(n.original)?(t.assignedMap.set(n.original,!1),t.setMap.delete(n.original)):(!n&&t.setMap.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.setMap.delete(e))},clear(){if(!this.size)return;const e=le(this);_e(e),Ie(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=le(this);_e(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:rn(e,t,{isValuesIterator:!0})}},entries(){const e=le(this);_e(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:rn(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[dt](){return this.values()},forEach(e,t){const n=this.values();let r=n.next();for(;!r.done;)e.call(t,r.value,r.value,this),r=n.next()}};Set.prototype.difference&&Object.assign(gt,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const Qi=Reflect.ownKeys(gt),Dn={get(e,t,n){var r,i;const s=(r=e.copy)===null||r===void 0?void 0:r[t];if(s&&e.finalities.draftsCache.has(s))return s;if(t===An)return e;let l;if(e.options.mark){const d=t==="size"&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(l=e.options.mark(d,Se),l===Se.mutable)return e.options.strict&&mt(d,e.options,!0),d}const o=Ee(e);if(o instanceof Map&&Yi.includes(t))return t==="size"?Object.getOwnPropertyDescriptor(kt,"size").get.call(e.proxy):kt[t].bind(e.proxy);if(o instanceof Set&&Qi.includes(t))return t==="size"?Object.getOwnPropertyDescriptor(gt,"size").get.call(e.proxy):gt[t].bind(e.proxy);if(!Ye(o,t)){const d=tn(o,t);return d?"value"in d?d.value:(i=d.get)===null||i===void 0?void 0:i.call(e.proxy):void 0}const u=o[t];if(e.options.strict&&mt(u,e.options),e.finalized||!we(u,e.options))return u;if(u===vt(e.original,t)){if(_e(e),e.copy[t]=Ht({original:e.original[t],parentDraft:e,key:e.type===1?Number(t):t,finalities:e.finalities,options:e.options}),typeof l=="function"){const d=le(e.copy[t]);return _e(d),Ie(d),d.copy}return e.copy[t]}return Me(u)&&e.finalities.draftsCache.add(u),u},set(e,t,n){var r;if(e.type===3||e.type===2)throw new Error("Map/Set draft does not support any property assignment.");let i;if(e.type===1&&t!=="length"&&!(Number.isInteger(i=Number(t))&&i>=0&&(t===0||i===0||String(i)===String(t))))throw new Error("Only supports setting array indices and the 'length' property.");const s=tn(Ee(e),t);if(s?.set)return s.set.call(e.proxy,n),!0;const l=vt(Ee(e),t),o=le(l);return o&&ke(o.original,n)?(e.copy[t]=n,e.assignedMap=(r=e.assignedMap)!==null&&r!==void 0?r:new Map,e.assignedMap.set(t,!1),!0):(ke(n,l)&&(n!==void 0||Ye(e.original,t))||(_e(e),Ie(e),Ye(e.original,t)&&ke(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,Wt(e,t,n,Qe)),!0)},has(e,t){return t in Ee(e)},ownKeys(e){return Reflect.ownKeys(Ee(e))},getOwnPropertyDescriptor(e,t){const n=Ee(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},getPrototypeOf(e){return Reflect.getPrototypeOf(e.original)},setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return e.type===1?Dn.set.call(this,e,t,void 0,e.proxy):(vt(e.original,t)!==void 0||t in e.original?(_e(e),Ie(e),e.assignedMap.set(t,!1)):(e.assignedMap=(n=e.assignedMap)!==null&&n!==void 0?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function Ht(e){const{original:t,parentDraft:n,key:r,finalities:i,options:s}=e,l=Ue(t),o={type:l,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:i,options:s,setMap:l===3?new Map(t.entries()):void 0};(r||"key"in e)&&(o.key=r);const{proxy:u,revoke:d}=Proxy.revocable(l===1?Object.assign([],o):o,Dn);if(i.revoke.push(d),o.proxy=u,n){const _=n;_.finalities.draft.push((g,w)=>{var p,S;const f=le(u);let b=_.type===3?_.setMap:_.copy;const m=De(b,r),h=le(m);if(h){let y=h.original;h.operated&&(y=Ft(m)),It(h),At(h,Qe,g,w),_.options.enableAutoFreeze&&(_.options.updatedValues=(p=_.options.updatedValues)!==null&&p!==void 0?p:new WeakMap,_.options.updatedValues.set(y,h.original)),nt(b,r,y)}(S=f.callbacks)===null||S===void 0||S.forEach(y=>{y(g,w)})})}else{const _=le(u);_.finalities.draft.push((g,w)=>{It(_),At(_,Qe,g,w)})}return u}Ut.createDraft=Ht;function eo(e,t,n,r,i){var s;const l=le(e),o=(s=l?.original)!==null&&s!==void 0?s:e,u=!!t.length;if(l?.operated)for(;l.finalities.draft.length>0;)l.finalities.draft.pop()(n,r);const d=u?t[0]:l?l.operated?l.copy:l.original:e;return l&&xt(l),i&&Fe(d,d,l?.options.updatedValues),[d,n&&u?[{op:me.Replace,path:[],value:t[0]}]:n,r&&u?[{op:me.Replace,path:[],value:o}]:r]}function to(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet,draftsCache:new WeakSet};let i,s;t.enablePatches&&(i=[],s=[]);const o=((n=t.mark)===null||n===void 0?void 0:n.call(t,e,Se))===Se.mutable||!we(e,t)?e:Ht({original:e,parentDraft:null,finalities:r,options:t});return[o,(u=[])=>{const[d,_,g]=eo(o,u,i,s,t.enableAutoFreeze);return t.enablePatches?[d,_,g]:d}]}function Tt(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:i=!0}=e;$t(n,(s,l,o)=>{const u=le(l);if(u&&t&&u.finalities===t.finalities){e.isContainDraft=!0;const d=u.original;if(o instanceof Set){const _=Array.from(o);o.clear(),_.forEach(g=>o.add(s===g?d:g))}else nt(o,s,d)}else typeof l=="object"&&l!==null&&(e.value=l,e.isRoot=!1,Tt(e))}),i&&(e.isContainDraft||console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."),r&&console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."))}function Cn(e){var t;const n=le(e);if(!we(e,n?.options))return e;const r=Ue(e);if(n&&!n.operated)return n.original;let i;function s(){i=r===2?Bt(e)?new Map(e):new(Object.getPrototypeOf(e)).constructor(e):r===3?Array.from(n.setMap.values()):kn(e,n?.options)}if(n){n.finalized=!0;try{s()}finally{n.finalized=!1}}else i=e;if($t(i,(l,o)=>{if(n&&ke(De(n.original,l),o))return;const u=Cn(o);u!==o&&(i===e&&s(),nt(i,l,u))}),r===3){const l=(t=n?.original)!==null&&t!==void 0?t:i;return jt(l)?new Set(i):new(Object.getPrototypeOf(l)).constructor(i)}return i}function on(e){if(!Me(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return Cn(e)}const no=e=>function t(n,r,i){var s,l,o;if(typeof n=="function"&&typeof r!="function")return function(v,...C){return t(v,T=>n.call(this,T,...C),r)};const u=n,d=r;let _=i;if(typeof r!="function"&&(_=r),_!==void 0&&Object.prototype.toString.call(_)!=="[object Object]")throw new Error(`Invalid options: ${_}, 'options' should be an object.`);_=Object.assign(Object.assign({},e),_);const g=Me(u)?on(u):u,w=Array.isArray(_.mark)?((v,C)=>{for(const T of _.mark){if(typeof T!="function")throw new Error(`Invalid mark: ${T}, 'mark' should be a function.`);const F=T(v,C);if(F)return F}}):_.mark,p=(s=_.enablePatches)!==null&&s!==void 0?s:!1,S=(l=_.strict)!==null&&l!==void 0?l:!1,b={enableAutoFreeze:(o=_.enableAutoFreeze)!==null&&o!==void 0?o:!1,mark:w,strict:S,enablePatches:p};if(!we(g,b)&&typeof g=="object"&&g!==null)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[m,h]=to(g,b);if(typeof r!="function"){if(!we(g,b))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[m,h]}let y;try{y=d(m)}catch(v){throw xt(le(m)),v}const I=v=>{const C=le(m);if(!Me(v)){if(v!==void 0&&!ke(v,m)&&C?.operated)throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const F=v?.[Wi];if(F){const D=F[0];return b.strict&&typeof v=="object"&&v!==null&&Tt({rootDraft:C,value:v,useRawReturn:!0}),h([D])}if(v!==void 0)return typeof v=="object"&&v!==null&&Tt({rootDraft:C,value:v}),h([v])}if(v===m||v===void 0)return h([]);const T=le(v);if(b===T.options){if(T.operated)throw new Error("Cannot return a modified child draft.");return h([on(v)])}return h([v])};return y instanceof Promise?y.then(I,v=>{throw xt(le(m)),v}):I(y)},Et=no();Object.prototype.constructor.toString();function ro(e,t){return{...e,header:{...e.header,name:t}}}function io(e,t,n){const{scope:r}=t;return Et({document:e,action:t,skip:n,reuseLastOperationIndex:!1},s=>{const l=[...e.operations[r]],o=Te(l);s.action=Nt(r);const u=o.at(-1);let d=u?.index??-1;const _=u?.action.type!=="NOOP";_?d=d+1:s.reuseLastOperationIndex=!0;const g=_?[...o,{index:d,skip:0}]:o;if(s.skip=Ri(g),u&&s.skip>u.skip+1&&(s.skip=s.skip+1),s.skip<0)throw new Error("Cannot undo: you can't undo more operations than the ones in the scope history")})}function oo(e,t,n){const{scope:r}=t;return Et({document:e,action:t,skip:n,reuseLastOperationIndex:!1},s=>{const l=e.operations[r]||[],o=Te([...l]),u=o.filter(_=>_.action.type!=="NOOP");let d=0;for(let _=o.length-1;_>=0&&o[_].action.type==="NOOP";_--)d++;if(u.length<=d)throw new Error("Cannot undo: no more operations to undo in scope history");s.action=Nt(r),s.skip=1})}function so(e,t,n){const{scope:r,input:i}=t;return Et({document:e,action:t,skip:n,reuseLastOperationIndex:!1},l=>{if(l.skip>0)throw new Error("Cannot redo: skip value from reducer cannot be used with REDO action");if(typeof i!="number"||i>1)throw new Error("Cannot redo: you can only redo one operation at a time");if(typeof i!="number"||i<1)throw new Error("Invalid REDO action: invalid redo input value");if(l.document.clipboard.length<1)throw new Error("Cannot redo: no operations in the clipboard");const o=l.document.clipboard.findLastIndex(d=>d.action.scope===r);if(o<0)throw new Error(`Cannot redo: no operations in clipboard for scope "${r}"`);const u=l.document.clipboard.splice(o,1)[0];l.action={type:u.action.type,scope:u.action.scope,input:u.action.input}})}function ao(e,t){return{...e,header:{...e.header,name:t.state.name},state:t.state.data}}function et(e,t,n,r,i,s=Zt,l={},o){const u=Mn(n,s);return wn(e,t,u,r,i,l,o)}function lo(e,t,n,r,i){if(["UNDO","REDO","PRUNE"].includes(t.type))return e;const s=t.scope;let l=[];e.operations[s]&&(l=e.operations[s].slice());const u=l.sort((g,w)=>g.index-w.index).at(-1)?.index??-1,d=n?u:u+1,_=bi(t,d,r,i);return l.push(_),{...e,operations:{...e.operations,[s]:l}}}function uo(e,t,n,r,i,s){const l=t.action.scope,o=e.operations[l],u=o?o.slice():[],_=u.sort((p,S)=>p.index-S.index).at(-1)?.index??-1,g=n?_:_+1;if(!s&&t.index-r>g)throw new Error(`Missing operations: expected ${g} with skip 0 or equivalent, got index ${t.index} with skip ${r}`);const w=Ei(t,t.index,r,i);return u.push(w),{...e,operations:{...e.operations,[l]:u}}}function co(e,t,n,r,i,s,l){let o;return s?o=uo(e,s,n,r,i,l):o=lo(e,t,n,r,i),o=vn(o,t.scope),o}function po(e,t,n){const r=ai().parse(t);switch(r.type){case"SET_NAME":return ro(e,r.input);case"PRUNE":return go(e,r.input,n);case"LOAD_STATE":return ao(e,r.input);default:return e}}function fo(e,t,n,r=1){switch(t.type){case"UNDO":return r>=2?oo(e,t,n):io(e,t,n);case"REDO":return so(e,t,n);default:return{document:e,action:t,skip:n,reuseLastOperationIndex:!1}}}function ho(e,t,n,r,i=!1,s=zt){const l=t.scope,o=e.operations[l];if(!o)return e;const u=o.at(-1);if(!u)return e;const d=ht({...e.operations,[l]:ki(o,u)});let _;const w=d[l]?.at(-1);if(i&&w?.resultingState)_=s(w.resultingState);else{const{state:p}=et(e.initialState,d,n,e.header,void 0,void 0,void 0,{reuseOperationResultingState:i,operationResultingStateParser:s});_=p[l]}return{...e,state:{...e.state,[l]:_},operations:ht({...e.operations})}}function mo(e,t,n,r=!1,i=zt){const s=e.operations[t];if(!s)return e;const l=[...s],o=Te(l);o.pop();const u=ht({...e.operations}),d=u[t];if(!d)return e;const _=[...d],g=Di(bt(o),_),w=et(e.initialState,u,n,e.header,void 0,void 0,void 0,{reuseOperationResultingState:r,operationResultingStateParser:i}),p=Te([...e.clipboard,...g].filter(S=>S.action.type!=="NOOP")).reverse();return{...w,clipboard:p}}function Zt(e,t,n,r,i={}){const{skip:s,ignoreSkipOperations:l=!1,reuseOperationResultingState:o=!1,operationResultingStateParser:u,pruneOnSkip:d=!0,branch:_="main"}=i;let g=_i(t),w=s??i.replayOptions?.operation.skip??0,p={...e},S=!1;const f=!l&&w>0;if(vi(g)){const{skip:T,action:F,document:D,reuseLastOperationIndex:V}=fo(e,g,w,i.protocolVersion??1);g=F,w=T,p=D,S=V}else p={...p,clipboard:[]};On(g)&&(p=po(p,g,n));const b={documentId:e.header.id,scope:g.scope,branch:_};p=co(p,g,S,w,b,i.replayOptions?.operation,i.skipIndexValidation);const m=i.protocolVersion??1;if(qt(t)&&m<2)return mo(p,t.scope,n);const h=g.type==="NOOP"&&w>0;if((qt(t)||h)&&m>=2){const T=g.scope,F=p.operations[T]||[],D=Te([...F]),te=Ii(D).filter(c=>c.action.type!=="NOOP"),x={...p.operations,[T]:te};return{...et(p.initialState,x,n,p.header,r,Zt,{},{skipIndexValidation:!0}),operations:p.operations,clipboard:[]}}if(f){const T=ho(p,g,n,w,o,u);d?p=T:p={...T,operations:p.operations}}if(p=Et(p,T=>{try{const F=n(T.state,g,r);F&&qi(()=>{T.state=F})}catch(F){const D=p.operations[g.scope];if(!D)throw new Error(`No operations found for scope: ${g.scope}`);const V=D.length-1,te=T.operations[g.scope];if(!te)throw new Error(`No operations found in draft for scope: ${g.scope}`);if(te[V].error=F.message,te[V].skip=0,f){T.state={...e.state};const x=e.operations[g.scope];if(!x)throw new Error(`No operations found for scope: ${g.scope}`);T.operations={...e.operations,[g.scope]:[...x,{...te[V]}]}}}}),["UNDO","REDO","PRUNE"].includes(g.type))return p;const y=g.scope||"global";let I=Pt(p,y);i.replayOptions?.operation.hash&&i.replayOptions.operation.hash!==""&&(I=i.replayOptions.operation.hash);const C=p.operations[y]?.at(-1);return C&&(C.hash=I,o&&(C.resultingState=JSON.stringify(p.state[y]))),p}function Mn(e,t=Zt){return(r,i,s,l)=>t(r,i,e,s,l)}function go(e,t,n){const r=e.operations.global;if(!r)throw new Error("No global operations found");let{start:i,end:s}=t;i=i||0,s=s||r.length;const l=r.slice(i,s),o=r.slice(0,i),u=r.slice(s),d=et(e.initialState,{...e.operations,global:o.concat(l)},n,e.header),_=d.state,g=d.header.name,w=o.length,p=o.length?o[o.length-1].timestampUtcMs:u.length?u[0].timestampUtcMs:new Date().toISOString(),S=yn({name:g,..._},l.length);return et(e.initialState,{...e.operations,global:[...o,{skip:0,...S,action:S,timestampUtcMs:p,index:w,hash:Pt({state:_},"global")},...u.map((f,b)=>({...f,index:w+b+1}))]},n,e.header)}const _o="sha1",bo="base64";function Nn(){return{}}function Pn(){return{version:0,hash:{algorithm:_o,encoding:bo}}}function Vt(){return{auth:Nn(),document:Pn()}}function Eo(e){return{...Nn(),...e}}function So(e){return{...Pn(),...e}}function yo(e,t){return{auth:Eo(e),document:So(t)}}function zn(){return ee({__typename:be("AddChangeLogItemInput").optional(),content:L(),id:L(),insertBefore:L().nullable()})}function Ln(){return ee({description:L().nullish(),id:L(),name:L()})}function Un(){return ee({errorCode:L().nullish(),errorDescription:L().nullish(),errorName:L().nullish(),errorTemplate:L().nullish(),id:L(),operationId:L()})}function Oo(){return ee({example:L(),id:L(),operationId:L()})}function jn(){return ee({description:L().nullish(),id:L(),moduleId:L(),name:L(),reducer:L().nullish(),schema:L().nullish(),template:L().nullish(),scope:Le().nullish()})}function Bn(){return ee({scope:L(),example:L(),id:L(),insertBefore:L().nullish()})}function wo(){return ee({__typename:be("Author").optional(),name:L(),website:L().nullable()})}function Fn(){return ee({__typename:be("CodeExample").optional(),id:L(),value:L()})}function $n(){return ee({__typename:be("DeleteChangeLogItemInput").optional(),id:L()})}function Wn(){return ee({id:L()})}function Hn(){return ee({id:L()})}function vo(){return ee({id:L()})}function Zn(){return ee({id:L()})}function Vn(){return ee({scope:L(),id:L()})}function xo(){return ee({__typename:be("DocumentModelGlobalState").optional(),author:wo(),description:L(),extension:L(),id:L(),name:L(),specifications:ye(Io())})}function Io(){return ee({__typename:be("DocumentSpecification").optional(),changeLog:ye(L()),modules:ye(Ao()),state:Do(),version:$e().int()})}function Ao(){return ee({__typename:be("ModuleSpecification").optional(),description:L().nullable(),id:L(),name:L(),operations:ye(Ro())})}function Gn(){return ee({newModuleId:L(),operationId:L()})}function Ro(){return ee({__typename:be("OperationSpecification").optional(),description:L().nullable(),errors:ye(ko()),examples:ye(Fn()),id:L(),name:L().nullable(),reducer:L().nullable(),schema:L().nullable(),template:L().nullable(),scope:Le()})}function ko(){return ee({__typename:be("OperationErrorSpecification").optional(),code:L().nullable(),description:L().nullable(),id:L(),name:L().nullable(),template:L().nullable()})}function Xn(){return ee({__typename:be("ReorderChangeLogItemsInput").optional(),order:ye(L())})}function Kn(){return ee({moduleId:L(),order:ye(L())})}function Jn(){return ee({order:ye(L())})}function qn(){return ee({operationId:L(),order:ye(L())})}function To(){return ee({operationId:L(),order:ye(L())})}function Yn(){return ee({scope:L(),order:ye(L())})}function Qn(){return ee({authorName:L()})}function er(){return ee({authorWebsite:L()})}function tr(){return ee({scope:L(),initialValue:L()})}function nr(){return ee({description:L()})}function rr(){return ee({extension:L()})}function ir(){return ee({id:L()})}function or(){return ee({name:L()})}function sr(){return ee({description:L().nullish(),id:L()})}function ar(){return ee({id:L(),name:L().nullish()})}function lr(){return ee({description:L().nullish(),id:L()})}function ur(){return ee({errorCode:L().nullish(),id:L()})}function cr(){return ee({errorDescription:L().nullish(),id:L()})}function pr(){return ee({errorName:L().nullish(),id:L()})}function dr(){return ee({errorTemplate:L().nullish(),id:L()})}function fr(){return ee({id:L(),name:L().nullish()})}function hr(){return ee({id:L(),scope:Le()})}function mr(){return ee({id:L(),reducer:L().nullish()})}function gr(){return ee({id:L(),schema:L().nullish()})}function _r(){return ee({id:L(),template:L().nullish()})}function br(){return ee({scope:L(),schema:L()})}function sn(){return ee({__typename:be("State").optional(),examples:ye(Fn()),initialValue:L(),schema:L()})}function Do(){return ee({global:sn(),local:sn()})}function Er(){return ee({__typename:be("UpdateChangeLogItemInput").optional(),id:L(),newContent:L()})}function Co(){return ee({example:L(),id:L()})}function Sr(){return ee({scope:L(),id:L(),newExample:L()})}const Mo=e=>oe("SET_NAME",e,void 0,_n,"global"),No=e=>oe("SET_MODEL_NAME",{...e},void 0,or,"global"),Po=e=>oe("SET_MODEL_ID",{...e},void 0,ir,"global"),zo=e=>oe("SET_MODEL_EXTENSION",{...e},void 0,rr,"global"),Lo=e=>oe("SET_MODEL_DESCRIPTION",{...e},void 0,nr,"global"),Uo=e=>oe("SET_AUTHOR_NAME",{...e},void 0,Qn,"global"),jo=e=>oe("SET_AUTHOR_WEBSITE",{...e},void 0,er,"global"),Bo=e=>oe("ADD_MODULE",{...e},void 0,Ln,"global"),Fo=e=>oe("SET_MODULE_NAME",{...e},void 0,ar,"global"),$o=e=>oe("SET_MODULE_DESCRIPTION",{...e},void 0,sr,"global"),Wo=e=>oe("DELETE_MODULE",{...e},void 0,Wn,"global"),Ho=e=>oe("REORDER_MODULES",{...e},void 0,Jn,"global"),Zo=e=>oe("ADD_OPERATION",{...e},void 0,jn,"global"),Vo=e=>oe("SET_OPERATION_NAME",{...e},void 0,fr,"global"),Go=e=>oe("SET_OPERATION_SCOPE",{...e},void 0,hr,"global"),Xo=e=>oe("SET_OPERATION_SCHEMA",{...e},void 0,gr,"global"),Ko=e=>oe("SET_OPERATION_DESCRIPTION",{...e},void 0,lr,"global"),Jo=e=>oe("SET_OPERATION_TEMPLATE",{...e},void 0,_r,"global"),qo=e=>oe("SET_OPERATION_REDUCER",{...e},void 0,mr,"global"),Yo=e=>oe("MOVE_OPERATION",{...e},void 0,Gn,"global"),Qo=e=>oe("DELETE_OPERATION",{...e},void 0,Zn,"global"),es=e=>oe("REORDER_MODULE_OPERATIONS",{...e},void 0,Kn,"global"),ts=e=>oe("ADD_OPERATION_ERROR",{...e},void 0,Un,"global"),ns=e=>oe("SET_OPERATION_ERROR_CODE",{...e},void 0,ur,"global"),rs=e=>oe("SET_OPERATION_ERROR_NAME",{...e},void 0,pr,"global"),is=e=>oe("SET_OPERATION_ERROR_DESCRIPTION",{...e},void 0,cr,"global"),os=e=>oe("SET_OPERATION_ERROR_TEMPLATE",{...e},void 0,dr,"global"),ss=e=>oe("DELETE_OPERATION_ERROR",{...e},void 0,Hn,"global"),as=e=>oe("REORDER_OPERATION_ERRORS",{...e},void 0,qn,"global"),ls=e=>oe("SET_STATE_SCHEMA",{...e},void 0,br,"global"),us=e=>oe("SET_INITIAL_STATE",{...e},void 0,tr,"global"),cs=e=>oe("ADD_STATE_EXAMPLE",{...e},void 0,Bn,"global"),ps=e=>oe("UPDATE_STATE_EXAMPLE",{...e},void 0,Sr,"global"),ds=e=>oe("DELETE_STATE_EXAMPLE",{...e},void 0,Vn,"global"),fs=e=>oe("REORDER_STATE_EXAMPLES",{...e},void 0,Yn,"global"),hs=e=>oe("ADD_CHANGE_LOG_ITEM",{...e},void 0,zn,"global"),ms=e=>oe("UPDATE_CHANGE_LOG_ITEM",{...e},void 0,Er,"global"),gs=e=>oe("DELETE_CHANGE_LOG_ITEM",{...e},void 0,$n,"global"),_s=e=>oe("REORDER_CHANGE_LOG_ITEMS",{...e},void 0,Xn,"global"),bs=()=>oe("RELEASE_NEW_VERSION",{},void 0,void 0,"global"),Es={setName:Mo,undo:hi,redo:mi,prune:gi,loadState:yn,noop:Nt},Ss={setModelName:No,setModelId:Po,setModelExtension:zo,setModelDescription:Lo,setAuthorName:Uo,setAuthorWebsite:jo,addModule:Bo,setModuleName:Fo,setModuleDescription:$o,deleteModule:Wo,reorderModules:Ho,addOperation:Zo,setOperationName:Vo,setOperationScope:Go,setOperationSchema:Xo,setOperationDescription:Ko,setOperationTemplate:Jo,setOperationReducer:qo,moveOperation:Yo,deleteOperation:Qo,reorderModuleOperations:es,addOperationError:ts,setOperationErrorCode:ns,setOperationErrorName:rs,setOperationErrorDescription:is,setOperationErrorTemplate:os,deleteOperationError:ss,reorderOperationErrors:as,setStateSchema:ls,setInitialState:us,addStateExample:cs,updateStateExample:ps,deleteStateExample:ds,reorderStateExamples:fs,addChangeLogItem:hs,updateChangeLogItem:ms,deleteChangeLogItem:gs,reorderChangeLogItems:_s,releaseNewVersion:bs},ys={...Es,...Ss},Os="phdm",ws={},vs={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},xs={id:"powerhouse/document-model",name:"DocumentModel",extension:"phdm",description:"The Powerhouse Document Model describes the state and operations of a document type.",author:{name:"Powerhouse",website:"https://www.powerhouse.inc/"},specifications:[{version:1,changeLog:[],state:{global:{schema:`type CodeExample {
|
|
19
|
+
${J}`),P.pop(),`{${G}}`}case"number":return isFinite(N)?String(N):y?y(N):"null";case"boolean":return N===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(N);default:return y?y(N):void 0}}function j(U,N,P){switch(typeof N){case"string":return s(N);case"object":{if(N===null)return"null";if(typeof N.toJSON=="function"){if(N=N.toJSON(U),typeof N!="object")return j(U,N,P);if(N===null)return"null"}if(P.indexOf(N)!==-1)return I;let q="";const B=N.length!==void 0;if(B&&Array.isArray(N)){if(N.length===0)return"[]";if(F<P.length+1)return'"[Array]"';P.push(N);const G=Math.min(N.length,C);let W=0;for(;W<G-1;W++){const ie=j(String(W),N[W],P);q+=ie!==void 0?ie:"null",q+=","}const ae=j(String(W),N[W],P);if(q+=ae!==void 0?ae:"null",N.length-1>C){const ie=N.length-C-1;q+=`,"... ${S(ie)} not stringified"`}return P.pop(),`[${q}]`}let J=Object.keys(N);const A=J.length;if(A===0)return"{}";if(F<P.length+1)return'"[Object]"';let R="",Y=Math.min(A,C);B&&u(N)&&(q+=d(N,",",C),J=J.slice(N.length),Y-=N.length,R=","),D&&(J=l(J,T)),P.push(N);for(let G=0;G<Y;G++){const W=J[G],ae=j(W,N[W],P);ae!==void 0&&(q+=`${R}${s(W)}:${ae}`,R=",")}if(A>C){const G=A-C;q+=`${R}"...":"${S(G)} not stringified"`}return P.pop(),`{${q}}`}case"number":return isFinite(N)?String(N):y?y(N):"null";case"boolean":return N===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(N);default:return y?y(N):void 0}}function c(U,N,P){if(arguments.length>1){let q="";if(typeof P=="number"?q=" ".repeat(Math.min(P,10)):typeof P=="string"&&(q=P.slice(0,10)),N!=null){if(typeof N=="function")return V("",{"":U},[],N,q,"");if(Array.isArray(N))return te("",U,[],f(N),q,"")}if(q.length!==0)return x("",U,[],q,"")}return j("",U,[])}return c}})(lt,lt.exports)),lt.exports}var Nr=Mr();const Ct=dn(Nr);Ct.configure;const Pr=[1518500249,1859775393,-1894007588,-899497514];function zr(e){return new Lr}class Lr{constructor(){this.A=1732584193,this.B=-271733879,this.C=-1732584194,this.D=271733878,this.E=-1009589776,this._size=0,this._sp=0,(!ut||Ve>=8e3)&&(ut=new ArrayBuffer(8e3),Ve=0),this._byte=new Uint8Array(ut,Ve,80),this._word=new Int32Array(ut,Ve,20),Ve+=80}update(t){if(typeof t=="string")return this._utf8(t);if(t==null)throw new TypeError("Invalid type: "+typeof t);const n=t.byteOffset,r=t.byteLength;let i=r/64|0,s=0;if(i&&!(n&3)&&!(this._size%64)){const o=new Int32Array(t.buffer,n,i*16);for(;i--;)this._int32(o,s>>2),s+=64;this._size+=s}if(t.BYTES_PER_ELEMENT!==1&&t.buffer){const o=new Uint8Array(t.buffer,n+s,r-s);return this._uint8(o)}return s===r?this:this._uint8(t,s)}_uint8(t,n){const{_byte:r,_word:i}=this,s=t.length;for(n=n|0;n<s;){const l=this._size%64;let o=l;for(;n<s&&o<64;)r[o++]=t[n++];o>=64&&this._int32(i),this._size+=o-l}return this}_utf8(t){const{_byte:n,_word:r}=this,i=t.length;let s=this._sp;for(let l=0;l<i;){const o=this._size%64;let u=o;for(;l<i&&u<64;){let d=t.charCodeAt(l++)|0;d<128?n[u++]=d:d<2048?(n[u++]=192|d>>>6,n[u++]=128|d&63):d<55296||d>57343?(n[u++]=224|d>>>12,n[u++]=128|d>>>6&63,n[u++]=128|d&63):s?(d=((s&1023)<<10)+(d&1023)+65536,n[u++]=240|d>>>18,n[u++]=128|d>>>12&63,n[u++]=128|d>>>6&63,n[u++]=128|d&63,s=0):s=d}u>=64&&(this._int32(r),r[0]=r[16]),this._size+=u-o}return this._sp=s,this}_int32(t,n){let{A:r,B:i,C:s,D:l,E:o}=this,u=0;for(n=n|0;u<16;)Ne[u++]=De(t[n++]);for(u=16;u<80;u++)Ne[u]=Br(Ne[u-3]^Ne[u-8]^Ne[u-14]^Ne[u-16]);for(u=0;u<80;u++){const d=u/20|0,_=Fr(r)+Wr(d,i,s,l)+o+Ne[u]+Pr[d]|0;o=l,l=s,s=$r(i),i=r,r=_}this.A=r+this.A|0,this.B=i+this.B|0,this.C=s+this.C|0,this.D=l+this.D|0,this.E=o+this.E|0}digest(t){const{_byte:n,_word:r}=this;let i=this._size%64|0;for(n[i++]=128;i&3;)n[i++]=0;if(i>>=2,i>14){for(;i<16;)r[i++]=0;i=0,this._int32(r)}for(;i<16;)r[i++]=0;const s=this._size*8,l=(s&4294967295)>>>0,o=(s-l)/4294967296;return o&&(r[14]=De(o)),l&&(r[15]=De(l)),this._int32(r),t==="hex"?this._hex():this._bin()}_hex(){const{A:t,B:n,C:r,D:i,E:s}=this;return Ge(t)+Ge(n)+Ge(r)+Ge(i)+Ge(s)}_bin(){const{A:t,B:n,C:r,D:i,E:s,_byte:l,_word:o}=this;return o[0]=De(t),o[1]=De(n),o[2]=De(r),o[3]=De(i),o[4]=De(s),l.slice(0,20)}}const Ne=new Int32Array(80);let ut,Ve=0;const Ge=e=>(e+4294967296).toString(16).substr(-8),Ur=(e=>e<<24&4278190080|e<<8&16711680|e>>8&65280|e>>24&255),jr=(e=>e),De=Hr()?jr:Ur,Br=e=>e<<1|e>>>31,Fr=e=>e<<5|e>>>27,$r=e=>e<<30|e>>>2;function Wr(e,t,n,r){return e===0?t&n|~t&r:e===2?t&n|t&r|n&r:t^n^r}function Hr(){return new Uint8Array(new Uint16Array([65279]).buffer)[0]===254}const Mt=(e,t="sha1",n="base64",r)=>{if(!["sha1"].includes(t))throw new Error(`Hashing algorithm not supported: "${t}". Available: sha1`);if(!["base64","hex"].includes(n))throw new Error(`Hash encoding not supported: "${n}". Available: base64, hex`);const i=Gr(e,t);return n==="hex"?Vr(i):Zr(i)};function Zr(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Vr(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function Gr(e,t="sha1"){if(!["sha1"].includes(t))throw new Error("Hashing algorithm not supported: Available: sha1");return zr().update(e).digest()}function Xr(e){return(new Date(e).getTime()/1e3).toFixed(0)}function Kr({documentId:e,signer:t,action:n,previousStateHash:r}){const{scope:i,type:s}=n;return[Xr(new Date),t.app.key,Mt([e,i,s,Ct(n.input)].join("")),r]}const Jr=new TextEncoder;function qr(e){const t=e.join(""),n=`Signed Operation:
|
|
20
|
+
`+t.length.toString();return Jr.encode(n+t)}function Yr(e){const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Array.prototype.map.call(t,n=>("00"+n.toString(16)).slice(-2)).join("")}class fn extends Error{data;constructor(t){super(),this.name="InvalidActionInputError",this.data=t,this.message=this.message||`Invalid action input: ${JSON.stringify(t,null,2)}`}}class Qr extends fn{issues;constructor(t){super(t),this.issues=t,this.name="InvalidActionInputZodError"}}class ei extends Error{_scope;_document;_operation;constructor(t,n,r){super(),this.name="HashMismatchError",this._document=n,this._scope=t,this._operation=r,this.message=JSON.stringify({error:`Hash mismatch on document ${n.header.id}, scope ${t}, index ${r.index}`,document:n,operation:r},null,1)}get document(){return this._document}get scope(){return this._scope}get operation(){return this._operation}}const ti=e=>e!=null;Tr().refine(e=>ti(e));const ni=tt(["LOAD_STATE"]),ri=tt(["PRUNE"]),ii=tt(["REDO"]),oi=tt(["SET_NAME"]),si=tt(["UNDO"]);function Le(){return L()}function ai(){return kr([li(),ci(),pi(),di(),fi()])}function li(){return ee({id:L(),timestampUtcMs:L(),input:Dt(()=>hn()),type:ni,scope:Le()})}function hn(){return ee({operations:$e(),state:Dt(()=>ui())})}function ui(){return ee({data:pn().nullish(),name:L()})}function ci(){return ee({id:L(),timestampUtcMs:L(),input:Dt(()=>mn()),type:ri,scope:Le()})}function mn(){return ee({end:$e().nullish(),start:$e().nullish()})}const gn=$e;function pi(){return ee({id:L(),timestampUtcMs:L().datetime(),input:gn(),type:ii,scope:Le()})}const _n=L;function di(){return ee({id:L(),timestampUtcMs:L().datetime(),input:_n(),type:oi,scope:be("global")})}const bn=$e;function fi(){return ee({id:L(),timestampUtcMs:L().datetime(),input:bn(),type:si,scope:Le()})}function En(e){return globalThis.crypto.randomUUID()}function Sn(e,t,n,r){const i=`${e}:${t}:${n}:${r}`;return Mt(i,"sha1","hex").slice(0,32)}const hi=(e=1,t="global")=>oe("UNDO",e,void 0,bn,t),mi=(e=1,t="global")=>oe("REDO",e,void 0,gn,t),gi=(e,t,n="global")=>oe("PRUNE",{start:e,end:t},void 0,mn,n),yn=(e,t)=>oe("LOAD_STATE",{state:e,operations:t},void 0,hn),Nt=(e="global")=>oe("NOOP",{},void 0,void 0,e);function oe(e,t,n,r,i="global"){if(!e)throw new Error("Empty action type");if(typeof e!="string")throw new Error(`Invalid action type: ${JSON.stringify(e)}`);const s={id:En(),timestampUtcMs:new Date().toISOString(),type:e,input:t,scope:i};try{r?.().parse(s.input)}catch(l){throw l instanceof Dr?new Qr(l.issues):new fn(l)}return s}const _i=e=>({id:e.id,timestampUtcMs:e.timestampUtcMs,type:e.type,input:e.input,scope:e.scope,context:e.context,attachments:e.attachments}),bi=(e,t,n,r)=>({...e,action:e,id:Sn(r.documentId,r.scope,r.branch,e.id),timestampUtcMs:e.timestampUtcMs,hash:"",error:void 0,index:t,skip:n}),Ei=(e,t,n,r)=>{const i=Sn(r.documentId,r.scope,r.branch,e.action.id);return{...e,hash:"",error:void 0,index:t,skip:n,id:i}},Si=(e,t)=>{if(!e.action)throw new Error("Operation has no action");return{...e,action:{...e.action,context:t}}},yi=(e,t,n=[])=>({user:e,app:t,signatures:n});async function Oi(e,t){const n=Kr(e),r=qr(n),i=await t(r);return[...n,`0x${Yr(i)}`]}async function aa(e,t,n,r,i){const l=t(n,e,void 0,{reuseOperationResultingState:!0}).operations[e.scope];if(!l)throw new Error(`No operations found for scope: ${e.scope}`);const o=l.at(-1);if(!o)throw new Error("Action was not applied");const u=l.at(-2)?.hash??"",d=await Oi({documentId:n.header.id,signer:r,action:e,previousStateHash:u},i),_={signer:yi(r.user,r.app,[...r.signatures,d])};return Si(o,_)}const wi=(e=En(),t="")=>({id:e,sig:{publicKey:{},nonce:""},documentType:t,createdAtUtcIso:new Date().toISOString(),slug:"",name:"",branch:"main",revision:{document:0},lastModifiedAtUtcIso:new Date().toISOString(),meta:{}});function vi(e){return["UNDO","REDO"].includes(e.type)}function qt(e){return e.type==="UNDO"}function On(e){return["SET_NAME","UNDO","REDO","PRUNE","LOAD_STATE"].includes(e.type)}function xi(e,t){const n=e(t);return{header:wi(),state:n,initialState:n,operations:{global:[],local:[]},clipboard:[]}}function Pt(e,t="global"){const n=Ct(e.state[t]||"");return Mt(n)}function Ii(e){const t=[];let n=0;for(let r=e.length-1;r>=0;r--){const i=e[r];"action"in i&&i.action.type==="NOOP"&&i.skip>0?(n++,t.unshift(i)):n>0?n--:t.unshift(i)}return t}const Ai=e=>e;function wn(e,t,n,r,i,s={},l){const{checkHashes:o=!0,reuseOperationResultingState:u,operationResultingStateParser:d=zt,skipIndexValidation:_}=l||{};let g=e;const w=[],p=new Set([...Object.keys(t),"global","local"]),S={};for(const v of p)S[v]=[];if(u)for(const[v,D]of Object.entries(t)){if(!D)continue;const T=D.findLastIndex(C=>!!C.resultingState);if(T<0){w.push(...D);continue}const F=D[T];if(!(!F||!F.resultingState))try{const C=d(F.resultingState);g={...g,[v]:C};const V=S[v];V&&V.push(...D.slice(0,T+1)),w.push(...D.slice(T+1))}catch{w.push(...D)}}else w.push(...Object.values(t).flatMap(v=>v||[]));const f={header:r,state:Ai(g),initialState:e,operations:S,clipboard:[]};let b=f;if(w.length)b=w.reduce((v,D)=>n(v,D.action,i,{ignoreSkipOperations:!0,checkHashes:o,skipIndexValidation:_,replayOptions:{operation:D}}),f);else for(const v of Object.values(S)){if(!v)continue;const D=v.at(-1);D&&(b=vn(b,D.action.scope,D.timestampUtcMs))}if(!o)for(const v of Object.keys(b.state))for(let D=w.length-1;D>=0;D--){const T=w[D];if(T.action.scope===v){if(T.hash!==Pt(b,v))throw new ei(v,b,T);break}}const m=new Set([...Object.keys(b.operations),...Object.keys(t),"global","local"]),h={};for(const v of m)h[v]=[];const y=Array.from(m).reduce((v,D)=>{const T=b.operations[D]||[];return{...v,[D]:[...T.map((F,C)=>({...F,timestamp:t[D]?.[C]?.timestampUtcMs??F.timestampUtcMs}))]}},h),I=r?r.lastModifiedAtUtcIso:Object.values(y).reduce((v,D)=>{if(!D)return v;const T=D.at(-1);return T&&T.timestampUtcMs>v?T.timestampUtcMs:v},f.header.lastModifiedAtUtcIso);return r&&(b.header={...r,revision:b.header.revision,lastModifiedAtUtcIso:I}),{...b,operations:y}}function zt(e){const t=typeof e;if(t==="string")return JSON.parse(e);if(t==="object")return e;throw new Error(`Providing resulting state is of type: ${t}`)}var Yt;(function(e){e.UNEXPECTED_INDEX="UNEXPECTED_INDEX"})(Yt||(Yt={}));var Qt;(function(e){e.DUPLICATED_INDEX="DUPLICATED_INDEX",e.MISSING_INDEX="MISSING_INDEX"})(Qt||(Qt={}));function bt(e){const t=[];let n=e.length-1;for(;n>-1;){t.unshift(e[n]);const r=(e[n]?.index||0)-(e[n]?.skip||0)-1;let i=n-1;for(;i>-1&&(e[i]?.index||0)>r;)i--;n=i}return t}function Ce(e){return e.slice().sort((t,n)=>t.skip-n.skip).sort((t,n)=>t.index-n.index)}function Ri(e){if(e.length<1)return-1;const t=bt(e);let n=(t[t.length-1]?.skip||0)+1;return t.length>1&&(n+=t[t.length-2]?.skip||0),(t[t.length-1]?.index||-1)<n?-1:n}function ki(e,t){const r=Ce(e).at(-1)?.index??-1,i=r+1,s={...t,index:t.index??i};if(s.index<r)throw new Error(`The skip header operation index must be greater than or equal to ${r}`);return bt(Ce([...e,s])).slice(0,-1)}function ht(e){return Object.entries(e).reduce((n,r)=>{const[i,s]=r;return s?{...n,[i]:bt(Ce(s))}:n},{})}function Ti(e){return e?Object.entries(e).reduce((n,[r,i])=>i?{...n,[r]:i.map(s=>{const{resultingState:l,...o}=s;return o})}:n,{}):{}}function Di(e,t){return e.filter(n=>!t.some(r=>n.index===r.index))}function Ci(e){let t;for(const n of Object.values(e.operations))if(n)for(const r of n)(!t||r.index>t.index||r.index===t.index&&r.skip>t.skip)&&(t=r);return t?.timestampUtcMs||e.header.lastModifiedAtUtcIso}function Mi(e,t){const n=e.operations[t];let r=-1;if(n)for(const i of n)i.index>r&&(r=i.index);return r+1}function vn(e,t,n){const r=n??Ci(e),i=e.header.lastModifiedAtUtcIso,s={...e.header,revision:{...e.header.revision,[t]:Mi(e,t)},lastModifiedAtUtcIso:!i||r>i?r:i};return{...e,header:s}}function ct(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 wt={exports:{}},en;function Ni(){return en||(en=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(r,i,s){function l(d,_){if(!i[d]){if(!r[d]){var g=typeof ct=="function"&&ct;if(!_&&g)return g(d,!0);if(o)return o(d,!0);var w=new Error("Cannot find module '"+d+"'");throw w.code="MODULE_NOT_FOUND",w}var p=i[d]={exports:{}};r[d][0].call(p.exports,function(S){var f=r[d][1][S];return l(f||S)},p,p.exports,n,r,i,s)}return i[d].exports}for(var o=typeof ct=="function"&&ct,u=0;u<s.length;u++)l(s[u]);return l})({1:[function(n,r,i){var s=n("./utils"),l=n("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(u){for(var d,_,g,w,p,S,f,b=[],m=0,h=u.length,y=h,I=s.getTypeOf(u)!=="string";m<u.length;)y=h-m,g=I?(d=u[m++],_=m<h?u[m++]:0,m<h?u[m++]:0):(d=u.charCodeAt(m++),_=m<h?u.charCodeAt(m++):0,m<h?u.charCodeAt(m++):0),w=d>>2,p=(3&d)<<4|_>>4,S=1<y?(15&_)<<2|g>>6:64,f=2<y?63&g:64,b.push(o.charAt(w)+o.charAt(p)+o.charAt(S)+o.charAt(f));return b.join("")},i.decode=function(u){var d,_,g,w,p,S,f=0,b=0,m="data:";if(u.substr(0,m.length)===m)throw new Error("Invalid base64 input, it looks like a data url.");var h,y=3*(u=u.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(u.charAt(u.length-1)===o.charAt(64)&&y--,u.charAt(u.length-2)===o.charAt(64)&&y--,y%1!=0)throw new Error("Invalid base64 input, bad content length.");for(h=l.uint8array?new Uint8Array(0|y):new Array(0|y);f<u.length;)d=o.indexOf(u.charAt(f++))<<2|(w=o.indexOf(u.charAt(f++)))>>4,_=(15&w)<<4|(p=o.indexOf(u.charAt(f++)))>>2,g=(3&p)<<6|(S=o.indexOf(u.charAt(f++))),h[b++]=d,p!==64&&(h[b++]=_),S!==64&&(h[b++]=g);return h}},{"./support":30,"./utils":32}],2:[function(n,r,i){var s=n("./external"),l=n("./stream/DataWorker"),o=n("./stream/Crc32Probe"),u=n("./stream/DataLengthProbe");function d(_,g,w,p,S){this.compressedSize=_,this.uncompressedSize=g,this.crc32=w,this.compression=p,this.compressedContent=S}d.prototype={getContentWorker:function(){var _=new l(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("data_length")),g=this;return _.on("end",function(){if(this.streamInfo.data_length!==g.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),_},getCompressedWorker:function(){return new l(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},d.createWorkerFrom=function(_,g,w){return _.pipe(new o).pipe(new u("uncompressedSize")).pipe(g.compressWorker(w)).pipe(new u("compressedSize")).withStreamInfo("compression",g)},r.exports=d},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,i){var s=n("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,i){var s=n("./utils"),l=(function(){for(var o,u=[],d=0;d<256;d++){o=d;for(var _=0;_<8;_++)o=1&o?3988292384^o>>>1:o>>>1;u[d]=o}return u})();r.exports=function(o,u){return o!==void 0&&o.length?s.getTypeOf(o)!=="string"?(function(d,_,g,w){var p=l,S=w+g;d^=-1;for(var f=w;f<S;f++)d=d>>>8^p[255&(d^_[f])];return-1^d})(0|u,o,o.length,0):(function(d,_,g,w){var p=l,S=w+g;d^=-1;for(var f=w;f<S;f++)d=d>>>8^p[255&(d^_.charCodeAt(f))];return-1^d})(0|u,o,o.length,0):0}},{"./utils":32}],5:[function(n,r,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(n,r,i){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",l=n("pako"),o=n("./utils"),u=n("./stream/GenericWorker"),d=s?"uint8array":"array";function _(g,w){u.call(this,"FlateWorker/"+g),this._pako=null,this._pakoAction=g,this._pakoOptions=w,this.meta={}}i.magic="\b\0",o.inherits(_,u),_.prototype.processChunk=function(g){this.meta=g.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(d,g.data),!1)},_.prototype.flush=function(){u.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},_.prototype.cleanUp=function(){u.prototype.cleanUp.call(this),this._pako=null},_.prototype._createPako=function(){this._pako=new l[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var g=this;this._pako.onData=function(w){g.push({data:w,meta:g.meta})}},i.compressWorker=function(g){return new _("Deflate",g)},i.uncompressWorker=function(){return new _("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,i){function s(p,S){var f,b="";for(f=0;f<S;f++)b+=String.fromCharCode(255&p),p>>>=8;return b}function l(p,S,f,b,m,h){var y,I,v=p.file,D=p.compression,T=h!==d.utf8encode,F=o.transformTo("string",h(v.name)),C=o.transformTo("string",d.utf8encode(v.name)),V=v.comment,te=o.transformTo("string",h(V)),x=o.transformTo("string",d.utf8encode(V)),j=C.length!==v.name.length,c=x.length!==V.length,U="",N="",P="",q=v.dir,B=v.date,J={crc32:0,compressedSize:0,uncompressedSize:0};S&&!f||(J.crc32=p.crc32,J.compressedSize=p.compressedSize,J.uncompressedSize=p.uncompressedSize);var A=0;S&&(A|=8),T||!j&&!c||(A|=2048);var R=0,Y=0;q&&(R|=16),m==="UNIX"?(Y=798,R|=(function(W,ae){var ie=W;return W||(ie=ae?16893:33204),(65535&ie)<<16})(v.unixPermissions,q)):(Y=20,R|=(function(W){return 63&(W||0)})(v.dosPermissions)),y=B.getUTCHours(),y<<=6,y|=B.getUTCMinutes(),y<<=5,y|=B.getUTCSeconds()/2,I=B.getUTCFullYear()-1980,I<<=4,I|=B.getUTCMonth()+1,I<<=5,I|=B.getUTCDate(),j&&(N=s(1,1)+s(_(F),4)+C,U+="up"+s(N.length,2)+N),c&&(P=s(1,1)+s(_(te),4)+x,U+="uc"+s(P.length,2)+P);var G="";return G+=`
|
|
21
|
+
\0`,G+=s(A,2),G+=D.magic,G+=s(y,2),G+=s(I,2),G+=s(J.crc32,4),G+=s(J.compressedSize,4),G+=s(J.uncompressedSize,4),G+=s(F.length,2),G+=s(U.length,2),{fileRecord:g.LOCAL_FILE_HEADER+G+F+U,dirRecord:g.CENTRAL_FILE_HEADER+s(Y,2)+G+s(te.length,2)+"\0\0\0\0"+s(R,4)+s(b,4)+F+U+te}}var o=n("../utils"),u=n("../stream/GenericWorker"),d=n("../utf8"),_=n("../crc32"),g=n("../signature");function w(p,S,f,b){u.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=S,this.zipPlatform=f,this.encodeFileName=b,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(w,u),w.prototype.push=function(p){var S=p.meta.percent||0,f=this.entriesCount,b=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,u.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:f?(S+100*(f-b-1))/f:100}}))},w.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var S=this.streamFiles&&!p.file.dir;if(S){var f=l(p,S,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:f.fileRecord,meta:{percent:0}})}else this.accumulate=!0},w.prototype.closedSource=function(p){this.accumulate=!1;var S=this.streamFiles&&!p.file.dir,f=l(p,S,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(f.dirRecord),S)this.push({data:(function(b){return g.DATA_DESCRIPTOR+s(b.crc32,4)+s(b.compressedSize,4)+s(b.uncompressedSize,4)})(p),meta:{percent:100}});else for(this.push({data:f.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},w.prototype.flush=function(){for(var p=this.bytesWritten,S=0;S<this.dirRecords.length;S++)this.push({data:this.dirRecords[S],meta:{percent:100}});var f=this.bytesWritten-p,b=(function(m,h,y,I,v){var D=o.transformTo("string",v(I));return g.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(m,2)+s(m,2)+s(h,4)+s(y,4)+s(D.length,2)+D})(this.dirRecords.length,f,p,this.zipComment,this.encodeFileName);this.push({data:b,meta:{percent:100}})},w.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},w.prototype.registerPrevious=function(p){this._sources.push(p);var S=this;return p.on("data",function(f){S.processChunk(f)}),p.on("end",function(){S.closedSource(S.previous.streamInfo),S._sources.length?S.prepareNextSource():S.end()}),p.on("error",function(f){S.error(f)}),this},w.prototype.resume=function(){return!!u.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},w.prototype.error=function(p){var S=this._sources;if(!u.prototype.error.call(this,p))return!1;for(var f=0;f<S.length;f++)try{S[f].error(p)}catch{}return!0},w.prototype.lock=function(){u.prototype.lock.call(this);for(var p=this._sources,S=0;S<p.length;S++)p[S].lock()},r.exports=w},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,i){var s=n("../compressions"),l=n("./ZipFileWorker");i.generateWorker=function(o,u,d){var _=new l(u.streamFiles,d,u.platform,u.encodeFileName),g=0;try{o.forEach(function(w,p){g++;var S=(function(h,y){var I=h||y,v=s[I];if(!v)throw new Error(I+" is not a valid compression method !");return v})(p.options.compression,u.compression),f=p.options.compressionOptions||u.compressionOptions||{},b=p.dir,m=p.date;p._compressWorker(S,f).withStreamInfo("file",{name:w,dir:b,date:m,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(_)}),_.entriesCount=g}catch(w){_.error(w)}return _}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,i){function s(){if(!(this instanceof s))return new s;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 l=new s;for(var o in this)typeof this[o]!="function"&&(l[o]=this[o]);return l}}(s.prototype=n("./object")).loadAsync=n("./load"),s.support=n("./support"),s.defaults=n("./defaults"),s.version="3.10.1",s.loadAsync=function(l,o){return new s().loadAsync(l,o)},s.external=n("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,i){var s=n("./utils"),l=n("./external"),o=n("./utf8"),u=n("./zipEntries"),d=n("./stream/Crc32Probe"),_=n("./nodejsUtils");function g(w){return new l.Promise(function(p,S){var f=w.decompressed.getContentWorker().pipe(new d);f.on("error",function(b){S(b)}).on("end",function(){f.streamInfo.crc32!==w.decompressed.crc32?S(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(w,p){var S=this;return p=s.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),_.isNode&&_.isStream(w)?l.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",w,!0,p.optimizedBinaryString,p.base64).then(function(f){var b=new u(p);return b.load(f),b}).then(function(f){var b=[l.Promise.resolve(f)],m=f.files;if(p.checkCRC32)for(var h=0;h<m.length;h++)b.push(g(m[h]));return l.Promise.all(b)}).then(function(f){for(var b=f.shift(),m=b.files,h=0;h<m.length;h++){var y=m[h],I=y.fileNameStr,v=s.resolve(y.fileNameStr);S.file(v,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:p.createFolders}),y.dir||(S.file(v).unsafeOriginalName=I)}return b.zipComment.length&&(S.comment=b.zipComment),S})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,i){var s=n("../utils"),l=n("../stream/GenericWorker");function o(u,d){l.call(this,"Nodejs stream input adapter for "+u),this._upstreamEnded=!1,this._bindStream(d)}s.inherits(o,l),o.prototype._bindStream=function(u){var d=this;(this._stream=u).pause(),u.on("data",function(_){d.push({data:_,meta:{percent:0}})}).on("error",function(_){d.isPaused?this.generatedError=_:d.error(_)}).on("end",function(){d.isPaused?d._upstreamEnded=!0:d.end()})},o.prototype.pause=function(){return!!l.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,i){var s=n("readable-stream").Readable;function l(o,u,d){s.call(this,u),this._helper=o;var _=this;o.on("data",function(g,w){_.push(g)||_._helper.pause(),d&&d(w)}).on("error",function(g){_.emit("error",g)}).on("end",function(){_.push(null)})}n("../utils").inherits(l,s),l.prototype._read=function(){this._helper.resume()},r.exports=l},{"../utils":32,"readable-stream":16}],14:[function(n,r,i){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,l){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,l);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,l)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var l=new Buffer(s);return l.fill(0),l},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(n,r,i){function s(v,D,T){var F,C=o.getTypeOf(D),V=o.extend(T||{},_);V.date=V.date||new Date,V.compression!==null&&(V.compression=V.compression.toUpperCase()),typeof V.unixPermissions=="string"&&(V.unixPermissions=parseInt(V.unixPermissions,8)),V.unixPermissions&&16384&V.unixPermissions&&(V.dir=!0),V.dosPermissions&&16&V.dosPermissions&&(V.dir=!0),V.dir&&(v=m(v)),V.createFolders&&(F=b(v))&&h.call(this,F,!0);var te=C==="string"&&V.binary===!1&&V.base64===!1;T&&T.binary!==void 0||(V.binary=!te),(D instanceof g&&D.uncompressedSize===0||V.dir||!D||D.length===0)&&(V.base64=!1,V.binary=!0,D="",V.compression="STORE",C="string");var x=null;x=D instanceof g||D instanceof u?D:S.isNode&&S.isStream(D)?new f(v,D):o.prepareContent(v,D,V.binary,V.optimizedBinaryString,V.base64);var j=new w(v,x,V);this.files[v]=j}var l=n("./utf8"),o=n("./utils"),u=n("./stream/GenericWorker"),d=n("./stream/StreamHelper"),_=n("./defaults"),g=n("./compressedObject"),w=n("./zipObject"),p=n("./generate"),S=n("./nodejsUtils"),f=n("./nodejs/NodejsStreamInputAdapter"),b=function(v){v.slice(-1)==="/"&&(v=v.substring(0,v.length-1));var D=v.lastIndexOf("/");return 0<D?v.substring(0,D):""},m=function(v){return v.slice(-1)!=="/"&&(v+="/"),v},h=function(v,D){return D=D!==void 0?D:_.createFolders,v=m(v),this.files[v]||s.call(this,v,null,{dir:!0,createFolders:D}),this.files[v]};function y(v){return Object.prototype.toString.call(v)==="[object RegExp]"}var I={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(v){var D,T,F;for(D in this.files)F=this.files[D],(T=D.slice(this.root.length,D.length))&&D.slice(0,this.root.length)===this.root&&v(T,F)},filter:function(v){var D=[];return this.forEach(function(T,F){v(T,F)&&D.push(F)}),D},file:function(v,D,T){if(arguments.length!==1)return v=this.root+v,s.call(this,v,D,T),this;if(y(v)){var F=v;return this.filter(function(V,te){return!te.dir&&F.test(V)})}var C=this.files[this.root+v];return C&&!C.dir?C:null},folder:function(v){if(!v)return this;if(y(v))return this.filter(function(C,V){return V.dir&&v.test(C)});var D=this.root+v,T=h.call(this,D),F=this.clone();return F.root=T.name,F},remove:function(v){v=this.root+v;var D=this.files[v];if(D||(v.slice(-1)!=="/"&&(v+="/"),D=this.files[v]),D&&!D.dir)delete this.files[v];else for(var T=this.filter(function(C,V){return V.name.slice(0,v.length)===v}),F=0;F<T.length;F++)delete this.files[T[F].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(v){var D,T={};try{if((T=o.extend(v||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:l.utf8encode})).type=T.type.toLowerCase(),T.compression=T.compression.toUpperCase(),T.type==="binarystring"&&(T.type="string"),!T.type)throw new Error("No output type specified.");o.checkSupport(T.type),T.platform!=="darwin"&&T.platform!=="freebsd"&&T.platform!=="linux"&&T.platform!=="sunos"||(T.platform="UNIX"),T.platform==="win32"&&(T.platform="DOS");var F=T.comment||this.comment||"";D=p.generateWorker(this,T,F)}catch(C){(D=new u("error")).error(C)}return new d(D,T.type||"string",T.mimeType)},generateAsync:function(v,D){return this.generateInternalStream(v).accumulate(D)},generateNodeStream:function(v,D){return(v=v||{}).type||(v.type="nodebuffer"),this.generateInternalStream(v).toNodejsStream(D)}};r.exports=I},{"./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(n,r,i){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,i){var s=n("./DataReader");function l(o){s.call(this,o);for(var u=0;u<this.data.length;u++)o[u]=255&o[u]}n("../utils").inherits(l,s),l.prototype.byteAt=function(o){return this.data[this.zero+o]},l.prototype.lastIndexOfSignature=function(o){for(var u=o.charCodeAt(0),d=o.charCodeAt(1),_=o.charCodeAt(2),g=o.charCodeAt(3),w=this.length-4;0<=w;--w)if(this.data[w]===u&&this.data[w+1]===d&&this.data[w+2]===_&&this.data[w+3]===g)return w-this.zero;return-1},l.prototype.readAndCheckSignature=function(o){var u=o.charCodeAt(0),d=o.charCodeAt(1),_=o.charCodeAt(2),g=o.charCodeAt(3),w=this.readData(4);return u===w[0]&&d===w[1]&&_===w[2]&&g===w[3]},l.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var u=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,u},r.exports=l},{"../utils":32,"./DataReader":18}],18:[function(n,r,i){var s=n("../utils");function l(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}l.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var u,d=0;for(this.checkOffset(o),u=this.index+o-1;u>=this.index;u--)d=(d<<8)+this.byteAt(u);return this.index+=o,d},readString:function(o){return s.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},r.exports=l},{"../utils":32}],19:[function(n,r,i){var s=n("./Uint8ArrayReader");function l(o){s.call(this,o)}n("../utils").inherits(l,s),l.prototype.readData=function(o){this.checkOffset(o);var u=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,u},r.exports=l},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,i){var s=n("./DataReader");function l(o){s.call(this,o)}n("../utils").inherits(l,s),l.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},l.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},l.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},l.prototype.readData=function(o){this.checkOffset(o);var u=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,u},r.exports=l},{"../utils":32,"./DataReader":18}],21:[function(n,r,i){var s=n("./ArrayReader");function l(o){s.call(this,o)}n("../utils").inherits(l,s),l.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var u=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,u},r.exports=l},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,i){var s=n("../utils"),l=n("../support"),o=n("./ArrayReader"),u=n("./StringReader"),d=n("./NodeBufferReader"),_=n("./Uint8ArrayReader");r.exports=function(g){var w=s.getTypeOf(g);return s.checkSupport(w),w!=="string"||l.uint8array?w==="nodebuffer"?new d(g):l.uint8array?new _(s.transformTo("uint8array",g)):new o(s.transformTo("array",g)):new u(g)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,i){var s=n("./GenericWorker"),l=n("../utils");function o(u){s.call(this,"ConvertWorker to "+u),this.destType=u}l.inherits(o,s),o.prototype.processChunk=function(u){this.push({data:l.transformTo(this.destType,u.data),meta:u.meta})},r.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,i){var s=n("./GenericWorker"),l=n("../crc32");function o(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(o,s),o.prototype.processChunk=function(u){this.streamInfo.crc32=l(u.data,this.streamInfo.crc32||0),this.push(u)},r.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,i){var s=n("../utils"),l=n("./GenericWorker");function o(u){l.call(this,"DataLengthProbe for "+u),this.propName=u,this.withStreamInfo(u,0)}s.inherits(o,l),o.prototype.processChunk=function(u){if(u){var d=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=d+u.data.length}l.prototype.processChunk.call(this,u)},r.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,i){var s=n("../utils"),l=n("./GenericWorker");function o(u){l.call(this,"DataWorker");var d=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,u.then(function(_){d.dataIsReady=!0,d.data=_,d.max=_&&_.length||0,d.type=s.getTypeOf(_),d.isPaused||d._tickAndRepeat()},function(_){d.error(_)})}s.inherits(o,l),o.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var u=null,d=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":u=this.data.substring(this.index,d);break;case"uint8array":u=this.data.subarray(this.index,d);break;case"array":case"nodebuffer":u=this.data.slice(this.index,d)}return this.index=d,this.push({data:u,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,i){function s(l){this.name=l||"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}s.prototype={push:function(l){this.emit("data",l)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(l){this.emit("error",l)}return!0},error:function(l){return!this.isFinished&&(this.isPaused?this.generatedError=l:(this.isFinished=!0,this.emit("error",l),this.previous&&this.previous.error(l),this.cleanUp()),!0)},on:function(l,o){return this._listeners[l].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(l,o){if(this._listeners[l])for(var u=0;u<this._listeners[l].length;u++)this._listeners[l][u].call(this,o)},pipe:function(l){return l.registerPrevious(this)},registerPrevious:function(l){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=l.streamInfo,this.mergeStreamInfo(),this.previous=l;var o=this;return l.on("data",function(u){o.processChunk(u)}),l.on("end",function(){o.end()}),l.on("error",function(u){o.error(u)}),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 l=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),l=!0),this.previous&&this.previous.resume(),!l},flush:function(){},processChunk:function(l){this.push(l)},withStreamInfo:function(l,o){return this.extraStreamInfo[l]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var l in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,l)&&(this.streamInfo[l]=this.extraStreamInfo[l])},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 l="Worker "+this.name;return this.previous?this.previous+" -> "+l:l}},r.exports=s},{}],29:[function(n,r,i){var s=n("../utils"),l=n("./ConvertWorker"),o=n("./GenericWorker"),u=n("../base64"),d=n("../support"),_=n("../external"),g=null;if(d.nodestream)try{g=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function w(S,f){return new _.Promise(function(b,m){var h=[],y=S._internalType,I=S._outputType,v=S._mimeType;S.on("data",function(D,T){h.push(D),f&&f(T)}).on("error",function(D){h=[],m(D)}).on("end",function(){try{var D=(function(T,F,C){switch(T){case"blob":return s.newBlob(s.transformTo("arraybuffer",F),C);case"base64":return u.encode(F);default:return s.transformTo(T,F)}})(I,(function(T,F){var C,V=0,te=null,x=0;for(C=0;C<F.length;C++)x+=F[C].length;switch(T){case"string":return F.join("");case"array":return Array.prototype.concat.apply([],F);case"uint8array":for(te=new Uint8Array(x),C=0;C<F.length;C++)te.set(F[C],V),V+=F[C].length;return te;case"nodebuffer":return Buffer.concat(F);default:throw new Error("concat : unsupported type '"+T+"'")}})(y,h),v);b(D)}catch(T){m(T)}h=[]}).resume()})}function p(S,f,b){var m=f;switch(f){case"blob":case"arraybuffer":m="uint8array";break;case"base64":m="string"}try{this._internalType=m,this._outputType=f,this._mimeType=b,s.checkSupport(m),this._worker=S.pipe(new l(m)),S.lock()}catch(h){this._worker=new o("error"),this._worker.error(h)}}p.prototype={accumulate:function(S){return w(this,S)},on:function(S,f){var b=this;return S==="data"?this._worker.on(S,function(m){f.call(b,m.data,m.meta)}):this._worker.on(S,function(){s.delay(f,arguments,b)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(S){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new g(this,{objectMode:this._outputType!=="nodebuffer"},S)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",i.nodebuffer=typeof Buffer<"u",i.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var l=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);l.append(s),i.blob=l.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!n("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,i){for(var s=n("./utils"),l=n("./support"),o=n("./nodejsUtils"),u=n("./stream/GenericWorker"),d=new Array(256),_=0;_<256;_++)d[_]=252<=_?6:248<=_?5:240<=_?4:224<=_?3:192<=_?2:1;d[254]=d[254]=1;function g(){u.call(this,"utf-8 decode"),this.leftOver=null}function w(){u.call(this,"utf-8 encode")}i.utf8encode=function(p){return l.nodebuffer?o.newBufferFrom(p,"utf-8"):(function(S){var f,b,m,h,y,I=S.length,v=0;for(h=0;h<I;h++)(64512&(b=S.charCodeAt(h)))==55296&&h+1<I&&(64512&(m=S.charCodeAt(h+1)))==56320&&(b=65536+(b-55296<<10)+(m-56320),h++),v+=b<128?1:b<2048?2:b<65536?3:4;for(f=l.uint8array?new Uint8Array(v):new Array(v),h=y=0;y<v;h++)(64512&(b=S.charCodeAt(h)))==55296&&h+1<I&&(64512&(m=S.charCodeAt(h+1)))==56320&&(b=65536+(b-55296<<10)+(m-56320),h++),b<128?f[y++]=b:(b<2048?f[y++]=192|b>>>6:(b<65536?f[y++]=224|b>>>12:(f[y++]=240|b>>>18,f[y++]=128|b>>>12&63),f[y++]=128|b>>>6&63),f[y++]=128|63&b);return f})(p)},i.utf8decode=function(p){return l.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):(function(S){var f,b,m,h,y=S.length,I=new Array(2*y);for(f=b=0;f<y;)if((m=S[f++])<128)I[b++]=m;else if(4<(h=d[m]))I[b++]=65533,f+=h-1;else{for(m&=h===2?31:h===3?15:7;1<h&&f<y;)m=m<<6|63&S[f++],h--;1<h?I[b++]=65533:m<65536?I[b++]=m:(m-=65536,I[b++]=55296|m>>10&1023,I[b++]=56320|1023&m)}return I.length!==b&&(I.subarray?I=I.subarray(0,b):I.length=b),s.applyFromCharCode(I)})(p=s.transformTo(l.uint8array?"uint8array":"array",p))},s.inherits(g,u),g.prototype.processChunk=function(p){var S=s.transformTo(l.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(l.uint8array){var f=S;(S=new Uint8Array(f.length+this.leftOver.length)).set(this.leftOver,0),S.set(f,this.leftOver.length)}else S=this.leftOver.concat(S);this.leftOver=null}var b=(function(h,y){var I;for((y=y||h.length)>h.length&&(y=h.length),I=y-1;0<=I&&(192&h[I])==128;)I--;return I<0||I===0?y:I+d[h[I]]>y?I:y})(S),m=S;b!==S.length&&(l.uint8array?(m=S.subarray(0,b),this.leftOver=S.subarray(b,S.length)):(m=S.slice(0,b),this.leftOver=S.slice(b,S.length))),this.push({data:i.utf8decode(m),meta:p.meta})},g.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=g,s.inherits(w,u),w.prototype.processChunk=function(p){this.push({data:i.utf8encode(p.data),meta:p.meta})},i.Utf8EncodeWorker=w},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,i){var s=n("./support"),l=n("./base64"),o=n("./nodejsUtils"),u=n("./external");function d(f){return f}function _(f,b){for(var m=0;m<f.length;++m)b[m]=255&f.charCodeAt(m);return b}n("setimmediate"),i.newBlob=function(f,b){i.checkSupport("blob");try{return new Blob([f],{type:b})}catch{try{var m=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return m.append(f),m.getBlob(b)}catch{throw new Error("Bug : can't construct the Blob.")}}};var g={stringifyByChunk:function(f,b,m){var h=[],y=0,I=f.length;if(I<=m)return String.fromCharCode.apply(null,f);for(;y<I;)b==="array"||b==="nodebuffer"?h.push(String.fromCharCode.apply(null,f.slice(y,Math.min(y+m,I)))):h.push(String.fromCharCode.apply(null,f.subarray(y,Math.min(y+m,I)))),y+=m;return h.join("")},stringifyByChar:function(f){for(var b="",m=0;m<f.length;m++)b+=String.fromCharCode(f[m]);return b},applyCanBeUsed:{uint8array:(function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}})()}};function w(f){var b=65536,m=i.getTypeOf(f),h=!0;if(m==="uint8array"?h=g.applyCanBeUsed.uint8array:m==="nodebuffer"&&(h=g.applyCanBeUsed.nodebuffer),h)for(;1<b;)try{return g.stringifyByChunk(f,m,b)}catch{b=Math.floor(b/2)}return g.stringifyByChar(f)}function p(f,b){for(var m=0;m<f.length;m++)b[m]=f[m];return b}i.applyFromCharCode=w;var S={};S.string={string:d,array:function(f){return _(f,new Array(f.length))},arraybuffer:function(f){return S.string.uint8array(f).buffer},uint8array:function(f){return _(f,new Uint8Array(f.length))},nodebuffer:function(f){return _(f,o.allocBuffer(f.length))}},S.array={string:w,array:d,arraybuffer:function(f){return new Uint8Array(f).buffer},uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return o.newBufferFrom(f)}},S.arraybuffer={string:function(f){return w(new Uint8Array(f))},array:function(f){return p(new Uint8Array(f),new Array(f.byteLength))},arraybuffer:d,uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return o.newBufferFrom(new Uint8Array(f))}},S.uint8array={string:w,array:function(f){return p(f,new Array(f.length))},arraybuffer:function(f){return f.buffer},uint8array:d,nodebuffer:function(f){return o.newBufferFrom(f)}},S.nodebuffer={string:w,array:function(f){return p(f,new Array(f.length))},arraybuffer:function(f){return S.nodebuffer.uint8array(f).buffer},uint8array:function(f){return p(f,new Uint8Array(f.length))},nodebuffer:d},i.transformTo=function(f,b){if(b=b||"",!f)return b;i.checkSupport(f);var m=i.getTypeOf(b);return S[m][f](b)},i.resolve=function(f){for(var b=f.split("/"),m=[],h=0;h<b.length;h++){var y=b[h];y==="."||y===""&&h!==0&&h!==b.length-1||(y===".."?m.pop():m.push(y))}return m.join("/")},i.getTypeOf=function(f){return typeof f=="string"?"string":Object.prototype.toString.call(f)==="[object Array]"?"array":s.nodebuffer&&o.isBuffer(f)?"nodebuffer":s.uint8array&&f instanceof Uint8Array?"uint8array":s.arraybuffer&&f instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(f){if(!s[f.toLowerCase()])throw new Error(f+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(f){var b,m,h="";for(m=0;m<(f||"").length;m++)h+="\\x"+((b=f.charCodeAt(m))<16?"0":"")+b.toString(16).toUpperCase();return h},i.delay=function(f,b,m){setImmediate(function(){f.apply(m||null,b||[])})},i.inherits=function(f,b){function m(){}m.prototype=b.prototype,f.prototype=new m},i.extend=function(){var f,b,m={};for(f=0;f<arguments.length;f++)for(b in arguments[f])Object.prototype.hasOwnProperty.call(arguments[f],b)&&m[b]===void 0&&(m[b]=arguments[f][b]);return m},i.prepareContent=function(f,b,m,h,y){return u.Promise.resolve(b).then(function(I){return s.blob&&(I instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(I))!==-1)&&typeof FileReader<"u"?new u.Promise(function(v,D){var T=new FileReader;T.onload=function(F){v(F.target.result)},T.onerror=function(F){D(F.target.error)},T.readAsArrayBuffer(I)}):I}).then(function(I){var v=i.getTypeOf(I);return v?(v==="arraybuffer"?I=i.transformTo("uint8array",I):v==="string"&&(y?I=l.decode(I):m&&h!==!0&&(I=(function(D){return _(D,s.uint8array?new Uint8Array(D.length):new Array(D.length))})(I))),I):u.Promise.reject(new Error("Can't read the data of '"+f+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,i){var s=n("./reader/readerFor"),l=n("./utils"),o=n("./signature"),u=n("./zipEntry"),d=n("./support");function _(g){this.files=[],this.loadOptions=g}_.prototype={checkSignature:function(g){if(!this.reader.readAndCheckSignature(g)){this.reader.index-=4;var w=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+l.pretty(w)+", expected "+l.pretty(g)+")")}},isSignature:function(g,w){var p=this.reader.index;this.reader.setIndex(g);var S=this.reader.readString(4)===w;return this.reader.setIndex(p),S},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),w=d.uint8array?"uint8array":"array",p=l.transformTo(w,g);this.zipComment=this.loadOptions.decodeFileName(p)},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,w,p,S=this.zip64EndOfCentralSize-44;0<S;)g=this.reader.readInt(2),w=this.reader.readInt(4),p=this.reader.readData(w),this.zip64ExtensibleData[g]={id:g,length:w,value:p}},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,w;for(g=0;g<this.files.length;g++)w=this.files[g],this.reader.setIndex(w.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),w.readLocalPart(this.reader),w.handleUTF8(),w.processAttributes()},readCentralDir:function(){var g;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(g=new u({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(o.CENTRAL_DIRECTORY_END);if(g<0)throw this.isSignature(0,o.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 w=g;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===l.MAX_VALUE_16BITS||this.diskWithCentralDirStart===l.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===l.MAX_VALUE_16BITS||this.centralDirRecords===l.MAX_VALUE_16BITS||this.centralDirSize===l.MAX_VALUE_32BITS||this.centralDirOffset===l.MAX_VALUE_32BITS){if(this.zip64=!0,(g=this.reader.lastIndexOfSignature(o.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(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.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(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var S=w-p;if(0<S)this.isSignature(w,o.CENTRAL_FILE_HEADER)||(this.reader.zero=S);else if(S<0)throw new Error("Corrupted zip: missing "+Math.abs(S)+" bytes.")},prepareReader:function(g){this.reader=s(g)},load:function(g){this.prepareReader(g),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=_},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,i){var s=n("./reader/readerFor"),l=n("./utils"),o=n("./compressedObject"),u=n("./crc32"),d=n("./utf8"),_=n("./compressions"),g=n("./support");function w(p,S){this.options=p,this.loadOptions=S}w.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var S,f;if(p.skip(22),this.fileNameLength=p.readInt(2),f=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(f),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((S=(function(b){for(var m in _)if(Object.prototype.hasOwnProperty.call(_,m)&&_[m].magic===b)return _[m];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+l.pretty(this.compressionMethod)+" unknown (inner file : "+l.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,S,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var S=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(S),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=s(this.extraFields[1].value);this.uncompressedSize===l.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===l.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===l.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===l.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var S,f,b,m=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<m;)S=p.readInt(2),f=p.readInt(2),b=p.readData(f),this.extraFields[S]={id:S,length:f,value:b};p.setIndex(m)},handleUTF8:function(){var p=g.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=d.utf8decode(this.fileName),this.fileCommentStr=d.utf8decode(this.fileComment);else{var S=this.findExtraFieldUnicodePath();if(S!==null)this.fileNameStr=S;else{var f=l.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(f)}var b=this.findExtraFieldUnicodeComment();if(b!==null)this.fileCommentStr=b;else{var m=l.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(m)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var S=s(p.value);return S.readInt(1)!==1||u(this.fileName)!==S.readInt(4)?null:d.utf8decode(S.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var S=s(p.value);return S.readInt(1)!==1||u(this.fileComment)!==S.readInt(4)?null:d.utf8decode(S.readData(p.length-5))}return null}},r.exports=w},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,i){function s(S,f,b){this.name=S,this.dir=b.dir,this.date=b.date,this.comment=b.comment,this.unixPermissions=b.unixPermissions,this.dosPermissions=b.dosPermissions,this._data=f,this._dataBinary=b.binary,this.options={compression:b.compression,compressionOptions:b.compressionOptions}}var l=n("./stream/StreamHelper"),o=n("./stream/DataWorker"),u=n("./utf8"),d=n("./compressedObject"),_=n("./stream/GenericWorker");s.prototype={internalStream:function(S){var f=null,b="string";try{if(!S)throw new Error("No output type specified.");var m=(b=S.toLowerCase())==="string"||b==="text";b!=="binarystring"&&b!=="text"||(b="string"),f=this._decompressWorker();var h=!this._dataBinary;h&&!m&&(f=f.pipe(new u.Utf8EncodeWorker)),!h&&m&&(f=f.pipe(new u.Utf8DecodeWorker))}catch(y){(f=new _("error")).error(y)}return new l(f,b,"")},async:function(S,f){return this.internalStream(S).accumulate(f)},nodeStream:function(S,f){return this.internalStream(S||"nodebuffer").toNodejsStream(f)},_compressWorker:function(S,f){if(this._data instanceof d&&this._data.compression.magic===S.magic)return this._data.getCompressedWorker();var b=this._decompressWorker();return this._dataBinary||(b=b.pipe(new u.Utf8EncodeWorker)),d.createWorkerFrom(b,S,f)},_decompressWorker:function(){return this._data instanceof d?this._data.getContentWorker():this._data instanceof _?this._data:new o(this._data)}};for(var g=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],w=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<g.length;p++)s.prototype[g[p]]=w;r.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,i){(function(s){var l,o,u=s.MutationObserver||s.WebKitMutationObserver;if(u){var d=0,_=new u(S),g=s.document.createTextNode("");_.observe(g,{characterData:!0}),l=function(){g.data=d=++d%2}}else if(s.setImmediate||s.MessageChannel===void 0)l="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var f=s.document.createElement("script");f.onreadystatechange=function(){S(),f.onreadystatechange=null,f.parentNode.removeChild(f),f=null},s.document.documentElement.appendChild(f)}:function(){setTimeout(S,0)};else{var w=new s.MessageChannel;w.port1.onmessage=S,l=function(){w.port2.postMessage(0)}}var p=[];function S(){var f,b;o=!0;for(var m=p.length;m;){for(b=p,p=[],f=-1;++f<m;)b[f]();m=p.length}o=!1}r.exports=function(f){p.push(f)!==1||o||l()}}).call(this,typeof at<"u"?at:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,i){var s=n("immediate");function l(){}var o={},u=["REJECTED"],d=["FULFILLED"],_=["PENDING"];function g(m){if(typeof m!="function")throw new TypeError("resolver must be a function");this.state=_,this.queue=[],this.outcome=void 0,m!==l&&f(this,m)}function w(m,h,y){this.promise=m,typeof h=="function"&&(this.onFulfilled=h,this.callFulfilled=this.otherCallFulfilled),typeof y=="function"&&(this.onRejected=y,this.callRejected=this.otherCallRejected)}function p(m,h,y){s(function(){var I;try{I=h(y)}catch(v){return o.reject(m,v)}I===m?o.reject(m,new TypeError("Cannot resolve promise with itself")):o.resolve(m,I)})}function S(m){var h=m&&m.then;if(m&&(typeof m=="object"||typeof m=="function")&&typeof h=="function")return function(){h.apply(m,arguments)}}function f(m,h){var y=!1;function I(T){y||(y=!0,o.reject(m,T))}function v(T){y||(y=!0,o.resolve(m,T))}var D=b(function(){h(v,I)});D.status==="error"&&I(D.value)}function b(m,h){var y={};try{y.value=m(h),y.status="success"}catch(I){y.status="error",y.value=I}return y}(r.exports=g).prototype.finally=function(m){if(typeof m!="function")return this;var h=this.constructor;return this.then(function(y){return h.resolve(m()).then(function(){return y})},function(y){return h.resolve(m()).then(function(){throw y})})},g.prototype.catch=function(m){return this.then(null,m)},g.prototype.then=function(m,h){if(typeof m!="function"&&this.state===d||typeof h!="function"&&this.state===u)return this;var y=new this.constructor(l);return this.state!==_?p(y,this.state===d?m:h,this.outcome):this.queue.push(new w(y,m,h)),y},w.prototype.callFulfilled=function(m){o.resolve(this.promise,m)},w.prototype.otherCallFulfilled=function(m){p(this.promise,this.onFulfilled,m)},w.prototype.callRejected=function(m){o.reject(this.promise,m)},w.prototype.otherCallRejected=function(m){p(this.promise,this.onRejected,m)},o.resolve=function(m,h){var y=b(S,h);if(y.status==="error")return o.reject(m,y.value);var I=y.value;if(I)f(m,I);else{m.state=d,m.outcome=h;for(var v=-1,D=m.queue.length;++v<D;)m.queue[v].callFulfilled(h)}return m},o.reject=function(m,h){m.state=u,m.outcome=h;for(var y=-1,I=m.queue.length;++y<I;)m.queue[y].callRejected(h);return m},g.resolve=function(m){return m instanceof this?m:o.resolve(new this(l),m)},g.reject=function(m){var h=new this(l);return o.reject(h,m)},g.all=function(m){var h=this;if(Object.prototype.toString.call(m)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=m.length,I=!1;if(!y)return this.resolve([]);for(var v=new Array(y),D=0,T=-1,F=new this(l);++T<y;)C(m[T],T);return F;function C(V,te){h.resolve(V).then(function(x){v[te]=x,++D!==y||I||(I=!0,o.resolve(F,v))},function(x){I||(I=!0,o.reject(F,x))})}},g.race=function(m){var h=this;if(Object.prototype.toString.call(m)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=m.length,I=!1;if(!y)return this.resolve([]);for(var v=-1,D=new this(l);++v<y;)T=m[v],h.resolve(T).then(function(F){I||(I=!0,o.resolve(D,F))},function(F){I||(I=!0,o.reject(D,F))});var T;return D}},{immediate:36}],38:[function(n,r,i){var s={};(0,n("./lib/utils/common").assign)(s,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,i){var s=n("./zlib/deflate"),l=n("./utils/common"),o=n("./utils/strings"),u=n("./zlib/messages"),d=n("./zlib/zstream"),_=Object.prototype.toString,g=0,w=-1,p=0,S=8;function f(m){if(!(this instanceof f))return new f(m);this.options=l.assign({level:w,method:S,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},m||{});var h=this.options;h.raw&&0<h.windowBits?h.windowBits=-h.windowBits:h.gzip&&0<h.windowBits&&h.windowBits<16&&(h.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var y=s.deflateInit2(this.strm,h.level,h.method,h.windowBits,h.memLevel,h.strategy);if(y!==g)throw new Error(u[y]);if(h.header&&s.deflateSetHeader(this.strm,h.header),h.dictionary){var I;if(I=typeof h.dictionary=="string"?o.string2buf(h.dictionary):_.call(h.dictionary)==="[object ArrayBuffer]"?new Uint8Array(h.dictionary):h.dictionary,(y=s.deflateSetDictionary(this.strm,I))!==g)throw new Error(u[y]);this._dict_set=!0}}function b(m,h){var y=new f(h);if(y.push(m,!0),y.err)throw y.msg||u[y.err];return y.result}f.prototype.push=function(m,h){var y,I,v=this.strm,D=this.options.chunkSize;if(this.ended)return!1;I=h===~~h?h:h===!0?4:0,typeof m=="string"?v.input=o.string2buf(m):_.call(m)==="[object ArrayBuffer]"?v.input=new Uint8Array(m):v.input=m,v.next_in=0,v.avail_in=v.input.length;do{if(v.avail_out===0&&(v.output=new l.Buf8(D),v.next_out=0,v.avail_out=D),(y=s.deflate(v,I))!==1&&y!==g)return this.onEnd(y),!(this.ended=!0);v.avail_out!==0&&(v.avail_in!==0||I!==4&&I!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(l.shrinkBuf(v.output,v.next_out))):this.onData(l.shrinkBuf(v.output,v.next_out)))}while((0<v.avail_in||v.avail_out===0)&&y!==1);return I===4?(y=s.deflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===g):I!==2||(this.onEnd(g),!(v.avail_out=0))},f.prototype.onData=function(m){this.chunks.push(m)},f.prototype.onEnd=function(m){m===g&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=l.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},i.Deflate=f,i.deflate=b,i.deflateRaw=function(m,h){return(h=h||{}).raw=!0,b(m,h)},i.gzip=function(m,h){return(h=h||{}).gzip=!0,b(m,h)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,i){var s=n("./zlib/inflate"),l=n("./utils/common"),o=n("./utils/strings"),u=n("./zlib/constants"),d=n("./zlib/messages"),_=n("./zlib/zstream"),g=n("./zlib/gzheader"),w=Object.prototype.toString;function p(f){if(!(this instanceof p))return new p(f);this.options=l.assign({chunkSize:16384,windowBits:0,to:""},f||{});var b=this.options;b.raw&&0<=b.windowBits&&b.windowBits<16&&(b.windowBits=-b.windowBits,b.windowBits===0&&(b.windowBits=-15)),!(0<=b.windowBits&&b.windowBits<16)||f&&f.windowBits||(b.windowBits+=32),15<b.windowBits&&b.windowBits<48&&(15&b.windowBits)==0&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _,this.strm.avail_out=0;var m=s.inflateInit2(this.strm,b.windowBits);if(m!==u.Z_OK)throw new Error(d[m]);this.header=new g,s.inflateGetHeader(this.strm,this.header)}function S(f,b){var m=new p(b);if(m.push(f,!0),m.err)throw m.msg||d[m.err];return m.result}p.prototype.push=function(f,b){var m,h,y,I,v,D,T=this.strm,F=this.options.chunkSize,C=this.options.dictionary,V=!1;if(this.ended)return!1;h=b===~~b?b:b===!0?u.Z_FINISH:u.Z_NO_FLUSH,typeof f=="string"?T.input=o.binstring2buf(f):w.call(f)==="[object ArrayBuffer]"?T.input=new Uint8Array(f):T.input=f,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new l.Buf8(F),T.next_out=0,T.avail_out=F),(m=s.inflate(T,u.Z_NO_FLUSH))===u.Z_NEED_DICT&&C&&(D=typeof C=="string"?o.string2buf(C):w.call(C)==="[object ArrayBuffer]"?new Uint8Array(C):C,m=s.inflateSetDictionary(this.strm,D)),m===u.Z_BUF_ERROR&&V===!0&&(m=u.Z_OK,V=!1),m!==u.Z_STREAM_END&&m!==u.Z_OK)return this.onEnd(m),!(this.ended=!0);T.next_out&&(T.avail_out!==0&&m!==u.Z_STREAM_END&&(T.avail_in!==0||h!==u.Z_FINISH&&h!==u.Z_SYNC_FLUSH)||(this.options.to==="string"?(y=o.utf8border(T.output,T.next_out),I=T.next_out-y,v=o.buf2string(T.output,y),T.next_out=I,T.avail_out=F-I,I&&l.arraySet(T.output,T.output,y,I,0),this.onData(v)):this.onData(l.shrinkBuf(T.output,T.next_out)))),T.avail_in===0&&T.avail_out===0&&(V=!0)}while((0<T.avail_in||T.avail_out===0)&&m!==u.Z_STREAM_END);return m===u.Z_STREAM_END&&(h=u.Z_FINISH),h===u.Z_FINISH?(m=s.inflateEnd(this.strm),this.onEnd(m),this.ended=!0,m===u.Z_OK):h!==u.Z_SYNC_FLUSH||(this.onEnd(u.Z_OK),!(T.avail_out=0))},p.prototype.onData=function(f){this.chunks.push(f)},p.prototype.onEnd=function(f){f===u.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=l.flattenChunks(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg},i.Inflate=p,i.inflate=S,i.inflateRaw=function(f,b){return(b=b||{}).raw=!0,S(f,b)},i.ungzip=S},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";i.assign=function(u){for(var d=Array.prototype.slice.call(arguments,1);d.length;){var _=d.shift();if(_){if(typeof _!="object")throw new TypeError(_+"must be non-object");for(var g in _)_.hasOwnProperty(g)&&(u[g]=_[g])}}return u},i.shrinkBuf=function(u,d){return u.length===d?u:u.subarray?u.subarray(0,d):(u.length=d,u)};var l={arraySet:function(u,d,_,g,w){if(d.subarray&&u.subarray)u.set(d.subarray(_,_+g),w);else for(var p=0;p<g;p++)u[w+p]=d[_+p]},flattenChunks:function(u){var d,_,g,w,p,S;for(d=g=0,_=u.length;d<_;d++)g+=u[d].length;for(S=new Uint8Array(g),d=w=0,_=u.length;d<_;d++)p=u[d],S.set(p,w),w+=p.length;return S}},o={arraySet:function(u,d,_,g,w){for(var p=0;p<g;p++)u[w+p]=d[_+p]},flattenChunks:function(u){return[].concat.apply([],u)}};i.setTyped=function(u){u?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,l)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,o))},i.setTyped(s)},{}],42:[function(n,r,i){var s=n("./common"),l=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{l=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var u=new s.Buf8(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;function _(g,w){if(w<65537&&(g.subarray&&o||!g.subarray&&l))return String.fromCharCode.apply(null,s.shrinkBuf(g,w));for(var p="",S=0;S<w;S++)p+=String.fromCharCode(g[S]);return p}u[254]=u[254]=1,i.string2buf=function(g){var w,p,S,f,b,m=g.length,h=0;for(f=0;f<m;f++)(64512&(p=g.charCodeAt(f)))==55296&&f+1<m&&(64512&(S=g.charCodeAt(f+1)))==56320&&(p=65536+(p-55296<<10)+(S-56320),f++),h+=p<128?1:p<2048?2:p<65536?3:4;for(w=new s.Buf8(h),f=b=0;b<h;f++)(64512&(p=g.charCodeAt(f)))==55296&&f+1<m&&(64512&(S=g.charCodeAt(f+1)))==56320&&(p=65536+(p-55296<<10)+(S-56320),f++),p<128?w[b++]=p:(p<2048?w[b++]=192|p>>>6:(p<65536?w[b++]=224|p>>>12:(w[b++]=240|p>>>18,w[b++]=128|p>>>12&63),w[b++]=128|p>>>6&63),w[b++]=128|63&p);return w},i.buf2binstring=function(g){return _(g,g.length)},i.binstring2buf=function(g){for(var w=new s.Buf8(g.length),p=0,S=w.length;p<S;p++)w[p]=g.charCodeAt(p);return w},i.buf2string=function(g,w){var p,S,f,b,m=w||g.length,h=new Array(2*m);for(p=S=0;p<m;)if((f=g[p++])<128)h[S++]=f;else if(4<(b=u[f]))h[S++]=65533,p+=b-1;else{for(f&=b===2?31:b===3?15:7;1<b&&p<m;)f=f<<6|63&g[p++],b--;1<b?h[S++]=65533:f<65536?h[S++]=f:(f-=65536,h[S++]=55296|f>>10&1023,h[S++]=56320|1023&f)}return _(h,S)},i.utf8border=function(g,w){var p;for((w=w||g.length)>g.length&&(w=g.length),p=w-1;0<=p&&(192&g[p])==128;)p--;return p<0||p===0?w:p+u[g[p]]>w?p:w}},{"./common":41}],43:[function(n,r,i){r.exports=function(s,l,o,u){for(var d=65535&s|0,_=s>>>16&65535|0,g=0;o!==0;){for(o-=g=2e3<o?2e3:o;_=_+(d=d+l[u++]|0)|0,--g;);d%=65521,_%=65521}return d|_<<16|0}},{}],44:[function(n,r,i){r.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(n,r,i){var s=(function(){for(var l,o=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;o[u]=l}return o})();r.exports=function(l,o,u,d){var _=s,g=d+u;l^=-1;for(var w=d;w<g;w++)l=l>>>8^_[255&(l^o[w])];return-1^l}},{}],46:[function(n,r,i){var s,l=n("../utils/common"),o=n("./trees"),u=n("./adler32"),d=n("./crc32"),_=n("./messages"),g=0,w=4,p=0,S=-2,f=-1,b=4,m=2,h=8,y=9,I=286,v=30,D=19,T=2*I+1,F=15,C=3,V=258,te=V+C+1,x=42,j=113,c=1,U=2,N=3,P=4;function q(a,$){return a.msg=_[$],$}function B(a){return(a<<1)-(4<a?9:0)}function J(a){for(var $=a.length;0<=--$;)a[$]=0}function A(a){var $=a.state,z=$.pending;z>a.avail_out&&(z=a.avail_out),z!==0&&(l.arraySet(a.output,$.pending_buf,$.pending_out,z,a.next_out),a.next_out+=z,$.pending_out+=z,a.total_out+=z,a.avail_out-=z,$.pending-=z,$.pending===0&&($.pending_out=0))}function R(a,$){o._tr_flush_block(a,0<=a.block_start?a.block_start:-1,a.strstart-a.block_start,$),a.block_start=a.strstart,A(a.strm)}function Y(a,$){a.pending_buf[a.pending++]=$}function G(a,$){a.pending_buf[a.pending++]=$>>>8&255,a.pending_buf[a.pending++]=255&$}function W(a,$){var z,O,E=a.max_chain_length,k=a.strstart,H=a.prev_length,Z=a.nice_match,M=a.strstart>a.w_size-te?a.strstart-(a.w_size-te):0,X=a.window,Q=a.w_mask,K=a.prev,ne=a.strstart+V,de=X[k+H-1],ue=X[k+H];a.prev_length>=a.good_match&&(E>>=2),Z>a.lookahead&&(Z=a.lookahead);do if(X[(z=$)+H]===ue&&X[z+H-1]===de&&X[z]===X[k]&&X[++z]===X[k+1]){k+=2,z++;do;while(X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&X[++k]===X[++z]&&k<ne);if(O=V-(ne-k),k=ne-V,H<O){if(a.match_start=$,Z<=(H=O))break;de=X[k+H-1],ue=X[k+H]}}while(($=K[$&Q])>M&&--E!=0);return H<=a.lookahead?H:a.lookahead}function ae(a){var $,z,O,E,k,H,Z,M,X,Q,K=a.w_size;do{if(E=a.window_size-a.lookahead-a.strstart,a.strstart>=K+(K-te)){for(l.arraySet(a.window,a.window,K,K,0),a.match_start-=K,a.strstart-=K,a.block_start-=K,$=z=a.hash_size;O=a.head[--$],a.head[$]=K<=O?O-K:0,--z;);for($=z=K;O=a.prev[--$],a.prev[$]=K<=O?O-K:0,--z;);E+=K}if(a.strm.avail_in===0)break;if(H=a.strm,Z=a.window,M=a.strstart+a.lookahead,X=E,Q=void 0,Q=H.avail_in,X<Q&&(Q=X),z=Q===0?0:(H.avail_in-=Q,l.arraySet(Z,H.input,H.next_in,Q,M),H.state.wrap===1?H.adler=u(H.adler,Z,Q,M):H.state.wrap===2&&(H.adler=d(H.adler,Z,Q,M)),H.next_in+=Q,H.total_in+=Q,Q),a.lookahead+=z,a.lookahead+a.insert>=C)for(k=a.strstart-a.insert,a.ins_h=a.window[k],a.ins_h=(a.ins_h<<a.hash_shift^a.window[k+1])&a.hash_mask;a.insert&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[k+C-1])&a.hash_mask,a.prev[k&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=k,k++,a.insert--,!(a.lookahead+a.insert<C)););}while(a.lookahead<te&&a.strm.avail_in!==0)}function ie(a,$){for(var z,O;;){if(a.lookahead<te){if(ae(a),a.lookahead<te&&$===g)return c;if(a.lookahead===0)break}if(z=0,a.lookahead>=C&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+C-1])&a.hash_mask,z=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),z!==0&&a.strstart-z<=a.w_size-te&&(a.match_length=W(a,z)),a.match_length>=C)if(O=o._tr_tally(a,a.strstart-a.match_start,a.match_length-C),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=C){for(a.match_length--;a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+C-1])&a.hash_mask,z=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart,--a.match_length!=0;);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else O=o._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(O&&(R(a,!1),a.strm.avail_out===0))return c}return a.insert=a.strstart<C-1?a.strstart:C-1,$===w?(R(a,!0),a.strm.avail_out===0?N:P):a.last_lit&&(R(a,!1),a.strm.avail_out===0)?c:U}function re(a,$){for(var z,O,E;;){if(a.lookahead<te){if(ae(a),a.lookahead<te&&$===g)return c;if(a.lookahead===0)break}if(z=0,a.lookahead>=C&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+C-1])&a.hash_mask,z=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),a.prev_length=a.match_length,a.prev_match=a.match_start,a.match_length=C-1,z!==0&&a.prev_length<a.max_lazy_match&&a.strstart-z<=a.w_size-te&&(a.match_length=W(a,z),a.match_length<=5&&(a.strategy===1||a.match_length===C&&4096<a.strstart-a.match_start)&&(a.match_length=C-1)),a.prev_length>=C&&a.match_length<=a.prev_length){for(E=a.strstart+a.lookahead-C,O=o._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-C),a.lookahead-=a.prev_length-1,a.prev_length-=2;++a.strstart<=E&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+C-1])&a.hash_mask,z=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),--a.prev_length!=0;);if(a.match_available=0,a.match_length=C-1,a.strstart++,O&&(R(a,!1),a.strm.avail_out===0))return c}else if(a.match_available){if((O=o._tr_tally(a,0,a.window[a.strstart-1]))&&R(a,!1),a.strstart++,a.lookahead--,a.strm.avail_out===0)return c}else a.match_available=1,a.strstart++,a.lookahead--}return a.match_available&&(O=o._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0),a.insert=a.strstart<C-1?a.strstart:C-1,$===w?(R(a,!0),a.strm.avail_out===0?N:P):a.last_lit&&(R(a,!1),a.strm.avail_out===0)?c:U}function se(a,$,z,O,E){this.good_length=a,this.max_lazy=$,this.nice_length=z,this.max_chain=O,this.func=E}function ce(){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=h,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 l.Buf16(2*T),this.dyn_dtree=new l.Buf16(2*(2*v+1)),this.bl_tree=new l.Buf16(2*(2*D+1)),J(this.dyn_ltree),J(this.dyn_dtree),J(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new l.Buf16(F+1),this.heap=new l.Buf16(2*I+1),J(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new l.Buf16(2*I+1),J(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 pe(a){var $;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=m,($=a.state).pending=0,$.pending_out=0,$.wrap<0&&($.wrap=-$.wrap),$.status=$.wrap?x:j,a.adler=$.wrap===2?0:1,$.last_flush=g,o._tr_init($),p):q(a,S)}function fe(a){var $=pe(a);return $===p&&(function(z){z.window_size=2*z.w_size,J(z.head),z.max_lazy_match=s[z.level].max_lazy,z.good_match=s[z.level].good_length,z.nice_match=s[z.level].nice_length,z.max_chain_length=s[z.level].max_chain,z.strstart=0,z.block_start=0,z.lookahead=0,z.insert=0,z.match_length=z.prev_length=C-1,z.match_available=0,z.ins_h=0})(a.state),$}function ge(a,$,z,O,E,k){if(!a)return S;var H=1;if($===f&&($=6),O<0?(H=0,O=-O):15<O&&(H=2,O-=16),E<1||y<E||z!==h||O<8||15<O||$<0||9<$||k<0||b<k)return q(a,S);O===8&&(O=9);var Z=new ce;return(a.state=Z).strm=a,Z.wrap=H,Z.gzhead=null,Z.w_bits=O,Z.w_size=1<<Z.w_bits,Z.w_mask=Z.w_size-1,Z.hash_bits=E+7,Z.hash_size=1<<Z.hash_bits,Z.hash_mask=Z.hash_size-1,Z.hash_shift=~~((Z.hash_bits+C-1)/C),Z.window=new l.Buf8(2*Z.w_size),Z.head=new l.Buf16(Z.hash_size),Z.prev=new l.Buf16(Z.w_size),Z.lit_bufsize=1<<E+6,Z.pending_buf_size=4*Z.lit_bufsize,Z.pending_buf=new l.Buf8(Z.pending_buf_size),Z.d_buf=1*Z.lit_bufsize,Z.l_buf=3*Z.lit_bufsize,Z.level=$,Z.strategy=k,Z.method=z,fe(a)}s=[new se(0,0,0,0,function(a,$){var z=65535;for(z>a.pending_buf_size-5&&(z=a.pending_buf_size-5);;){if(a.lookahead<=1){if(ae(a),a.lookahead===0&&$===g)return c;if(a.lookahead===0)break}a.strstart+=a.lookahead,a.lookahead=0;var O=a.block_start+z;if((a.strstart===0||a.strstart>=O)&&(a.lookahead=a.strstart-O,a.strstart=O,R(a,!1),a.strm.avail_out===0)||a.strstart-a.block_start>=a.w_size-te&&(R(a,!1),a.strm.avail_out===0))return c}return a.insert=0,$===w?(R(a,!0),a.strm.avail_out===0?N:P):(a.strstart>a.block_start&&(R(a,!1),a.strm.avail_out),c)}),new se(4,4,8,4,ie),new se(4,5,16,8,ie),new se(4,6,32,32,ie),new se(4,4,16,16,re),new se(8,16,32,32,re),new se(8,16,128,128,re),new se(8,32,128,256,re),new se(32,128,258,1024,re),new se(32,258,258,4096,re)],i.deflateInit=function(a,$){return ge(a,$,h,15,8,0)},i.deflateInit2=ge,i.deflateReset=fe,i.deflateResetKeep=pe,i.deflateSetHeader=function(a,$){return a&&a.state?a.state.wrap!==2?S:(a.state.gzhead=$,p):S},i.deflate=function(a,$){var z,O,E,k;if(!a||!a.state||5<$||$<0)return a?q(a,S):S;if(O=a.state,!a.output||!a.input&&a.avail_in!==0||O.status===666&&$!==w)return q(a,a.avail_out===0?-5:S);if(O.strm=a,z=O.last_flush,O.last_flush=$,O.status===x)if(O.wrap===2)a.adler=0,Y(O,31),Y(O,139),Y(O,8),O.gzhead?(Y(O,(O.gzhead.text?1:0)+(O.gzhead.hcrc?2:0)+(O.gzhead.extra?4:0)+(O.gzhead.name?8:0)+(O.gzhead.comment?16:0)),Y(O,255&O.gzhead.time),Y(O,O.gzhead.time>>8&255),Y(O,O.gzhead.time>>16&255),Y(O,O.gzhead.time>>24&255),Y(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),Y(O,255&O.gzhead.os),O.gzhead.extra&&O.gzhead.extra.length&&(Y(O,255&O.gzhead.extra.length),Y(O,O.gzhead.extra.length>>8&255)),O.gzhead.hcrc&&(a.adler=d(a.adler,O.pending_buf,O.pending,0)),O.gzindex=0,O.status=69):(Y(O,0),Y(O,0),Y(O,0),Y(O,0),Y(O,0),Y(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),Y(O,3),O.status=j);else{var H=h+(O.w_bits-8<<4)<<8;H|=(2<=O.strategy||O.level<2?0:O.level<6?1:O.level===6?2:3)<<6,O.strstart!==0&&(H|=32),H+=31-H%31,O.status=j,G(O,H),O.strstart!==0&&(G(O,a.adler>>>16),G(O,65535&a.adler)),a.adler=1}if(O.status===69)if(O.gzhead.extra){for(E=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>E&&(a.adler=d(a.adler,O.pending_buf,O.pending-E,E)),A(a),E=O.pending,O.pending!==O.pending_buf_size));)Y(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>E&&(a.adler=d(a.adler,O.pending_buf,O.pending-E,E)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){E=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>E&&(a.adler=d(a.adler,O.pending_buf,O.pending-E,E)),A(a),E=O.pending,O.pending===O.pending_buf_size)){k=1;break}k=O.gzindex<O.gzhead.name.length?255&O.gzhead.name.charCodeAt(O.gzindex++):0,Y(O,k)}while(k!==0);O.gzhead.hcrc&&O.pending>E&&(a.adler=d(a.adler,O.pending_buf,O.pending-E,E)),k===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){E=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>E&&(a.adler=d(a.adler,O.pending_buf,O.pending-E,E)),A(a),E=O.pending,O.pending===O.pending_buf_size)){k=1;break}k=O.gzindex<O.gzhead.comment.length?255&O.gzhead.comment.charCodeAt(O.gzindex++):0,Y(O,k)}while(k!==0);O.gzhead.hcrc&&O.pending>E&&(a.adler=d(a.adler,O.pending_buf,O.pending-E,E)),k===0&&(O.status=103)}else O.status=103;if(O.status===103&&(O.gzhead.hcrc?(O.pending+2>O.pending_buf_size&&A(a),O.pending+2<=O.pending_buf_size&&(Y(O,255&a.adler),Y(O,a.adler>>8&255),a.adler=0,O.status=j)):O.status=j),O.pending!==0){if(A(a),a.avail_out===0)return O.last_flush=-1,p}else if(a.avail_in===0&&B($)<=B(z)&&$!==w)return q(a,-5);if(O.status===666&&a.avail_in!==0)return q(a,-5);if(a.avail_in!==0||O.lookahead!==0||$!==g&&O.status!==666){var Z=O.strategy===2?(function(M,X){for(var Q;;){if(M.lookahead===0&&(ae(M),M.lookahead===0)){if(X===g)return c;break}if(M.match_length=0,Q=o._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++,Q&&(R(M,!1),M.strm.avail_out===0))return c}return M.insert=0,X===w?(R(M,!0),M.strm.avail_out===0?N:P):M.last_lit&&(R(M,!1),M.strm.avail_out===0)?c:U})(O,$):O.strategy===3?(function(M,X){for(var Q,K,ne,de,ue=M.window;;){if(M.lookahead<=V){if(ae(M),M.lookahead<=V&&X===g)return c;if(M.lookahead===0)break}if(M.match_length=0,M.lookahead>=C&&0<M.strstart&&(K=ue[ne=M.strstart-1])===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]){de=M.strstart+V;do;while(K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]&&ne<de);M.match_length=V-(de-ne),M.match_length>M.lookahead&&(M.match_length=M.lookahead)}if(M.match_length>=C?(Q=o._tr_tally(M,1,M.match_length-C),M.lookahead-=M.match_length,M.strstart+=M.match_length,M.match_length=0):(Q=o._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++),Q&&(R(M,!1),M.strm.avail_out===0))return c}return M.insert=0,X===w?(R(M,!0),M.strm.avail_out===0?N:P):M.last_lit&&(R(M,!1),M.strm.avail_out===0)?c:U})(O,$):s[O.level].func(O,$);if(Z!==N&&Z!==P||(O.status=666),Z===c||Z===N)return a.avail_out===0&&(O.last_flush=-1),p;if(Z===U&&($===1?o._tr_align(O):$!==5&&(o._tr_stored_block(O,0,0,!1),$===3&&(J(O.head),O.lookahead===0&&(O.strstart=0,O.block_start=0,O.insert=0))),A(a),a.avail_out===0))return O.last_flush=-1,p}return $!==w?p:O.wrap<=0?1:(O.wrap===2?(Y(O,255&a.adler),Y(O,a.adler>>8&255),Y(O,a.adler>>16&255),Y(O,a.adler>>24&255),Y(O,255&a.total_in),Y(O,a.total_in>>8&255),Y(O,a.total_in>>16&255),Y(O,a.total_in>>24&255)):(G(O,a.adler>>>16),G(O,65535&a.adler)),A(a),0<O.wrap&&(O.wrap=-O.wrap),O.pending!==0?p:1)},i.deflateEnd=function(a){var $;return a&&a.state?($=a.state.status)!==x&&$!==69&&$!==73&&$!==91&&$!==103&&$!==j&&$!==666?q(a,S):(a.state=null,$===j?q(a,-3):p):S},i.deflateSetDictionary=function(a,$){var z,O,E,k,H,Z,M,X,Q=$.length;if(!a||!a.state||(k=(z=a.state).wrap)===2||k===1&&z.status!==x||z.lookahead)return S;for(k===1&&(a.adler=u(a.adler,$,Q,0)),z.wrap=0,Q>=z.w_size&&(k===0&&(J(z.head),z.strstart=0,z.block_start=0,z.insert=0),X=new l.Buf8(z.w_size),l.arraySet(X,$,Q-z.w_size,z.w_size,0),$=X,Q=z.w_size),H=a.avail_in,Z=a.next_in,M=a.input,a.avail_in=Q,a.next_in=0,a.input=$,ae(z);z.lookahead>=C;){for(O=z.strstart,E=z.lookahead-(C-1);z.ins_h=(z.ins_h<<z.hash_shift^z.window[O+C-1])&z.hash_mask,z.prev[O&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=O,O++,--E;);z.strstart=O,z.lookahead=C-1,ae(z)}return z.strstart+=z.lookahead,z.block_start=z.strstart,z.insert=z.lookahead,z.lookahead=0,z.match_length=z.prev_length=C-1,z.match_available=0,a.next_in=Z,a.input=M,a.avail_in=H,z.wrap=k,p},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,i){r.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(n,r,i){r.exports=function(s,l){var o,u,d,_,g,w,p,S,f,b,m,h,y,I,v,D,T,F,C,V,te,x,j,c,U;o=s.state,u=s.next_in,c=s.input,d=u+(s.avail_in-5),_=s.next_out,U=s.output,g=_-(l-s.avail_out),w=_+(s.avail_out-257),p=o.dmax,S=o.wsize,f=o.whave,b=o.wnext,m=o.window,h=o.hold,y=o.bits,I=o.lencode,v=o.distcode,D=(1<<o.lenbits)-1,T=(1<<o.distbits)-1;e:do{y<15&&(h+=c[u++]<<y,y+=8,h+=c[u++]<<y,y+=8),F=I[h&D];t:for(;;){if(h>>>=C=F>>>24,y-=C,(C=F>>>16&255)===0)U[_++]=65535&F;else{if(!(16&C)){if((64&C)==0){F=I[(65535&F)+(h&(1<<C)-1)];continue t}if(32&C){o.mode=12;break e}s.msg="invalid literal/length code",o.mode=30;break e}V=65535&F,(C&=15)&&(y<C&&(h+=c[u++]<<y,y+=8),V+=h&(1<<C)-1,h>>>=C,y-=C),y<15&&(h+=c[u++]<<y,y+=8,h+=c[u++]<<y,y+=8),F=v[h&T];n:for(;;){if(h>>>=C=F>>>24,y-=C,!(16&(C=F>>>16&255))){if((64&C)==0){F=v[(65535&F)+(h&(1<<C)-1)];continue n}s.msg="invalid distance code",o.mode=30;break e}if(te=65535&F,y<(C&=15)&&(h+=c[u++]<<y,(y+=8)<C&&(h+=c[u++]<<y,y+=8)),p<(te+=h&(1<<C)-1)){s.msg="invalid distance too far back",o.mode=30;break e}if(h>>>=C,y-=C,(C=_-g)<te){if(f<(C=te-C)&&o.sane){s.msg="invalid distance too far back",o.mode=30;break e}if(j=m,(x=0)===b){if(x+=S-C,C<V){for(V-=C;U[_++]=m[x++],--C;);x=_-te,j=U}}else if(b<C){if(x+=S+b-C,(C-=b)<V){for(V-=C;U[_++]=m[x++],--C;);if(x=0,b<V){for(V-=C=b;U[_++]=m[x++],--C;);x=_-te,j=U}}}else if(x+=b-C,C<V){for(V-=C;U[_++]=m[x++],--C;);x=_-te,j=U}for(;2<V;)U[_++]=j[x++],U[_++]=j[x++],U[_++]=j[x++],V-=3;V&&(U[_++]=j[x++],1<V&&(U[_++]=j[x++]))}else{for(x=_-te;U[_++]=U[x++],U[_++]=U[x++],U[_++]=U[x++],2<(V-=3););V&&(U[_++]=U[x++],1<V&&(U[_++]=U[x++]))}break}}break}}while(u<d&&_<w);u-=V=y>>3,h&=(1<<(y-=V<<3))-1,s.next_in=u,s.next_out=_,s.avail_in=u<d?d-u+5:5-(u-d),s.avail_out=_<w?w-_+257:257-(_-w),o.hold=h,o.bits=y}},{}],49:[function(n,r,i){var s=n("../utils/common"),l=n("./adler32"),o=n("./crc32"),u=n("./inffast"),d=n("./inftrees"),_=1,g=2,w=0,p=-2,S=1,f=852,b=592;function m(x){return(x>>>24&255)+(x>>>8&65280)+((65280&x)<<8)+((255&x)<<24)}function h(){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 s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(x){var j;return x&&x.state?(j=x.state,x.total_in=x.total_out=j.total=0,x.msg="",j.wrap&&(x.adler=1&j.wrap),j.mode=S,j.last=0,j.havedict=0,j.dmax=32768,j.head=null,j.hold=0,j.bits=0,j.lencode=j.lendyn=new s.Buf32(f),j.distcode=j.distdyn=new s.Buf32(b),j.sane=1,j.back=-1,w):p}function I(x){var j;return x&&x.state?((j=x.state).wsize=0,j.whave=0,j.wnext=0,y(x)):p}function v(x,j){var c,U;return x&&x.state?(U=x.state,j<0?(c=0,j=-j):(c=1+(j>>4),j<48&&(j&=15)),j&&(j<8||15<j)?p:(U.window!==null&&U.wbits!==j&&(U.window=null),U.wrap=c,U.wbits=j,I(x))):p}function D(x,j){var c,U;return x?(U=new h,(x.state=U).window=null,(c=v(x,j))!==w&&(x.state=null),c):p}var T,F,C=!0;function V(x){if(C){var j;for(T=new s.Buf32(512),F=new s.Buf32(32),j=0;j<144;)x.lens[j++]=8;for(;j<256;)x.lens[j++]=9;for(;j<280;)x.lens[j++]=7;for(;j<288;)x.lens[j++]=8;for(d(_,x.lens,0,288,T,0,x.work,{bits:9}),j=0;j<32;)x.lens[j++]=5;d(g,x.lens,0,32,F,0,x.work,{bits:5}),C=!1}x.lencode=T,x.lenbits=9,x.distcode=F,x.distbits=5}function te(x,j,c,U){var N,P=x.state;return P.window===null&&(P.wsize=1<<P.wbits,P.wnext=0,P.whave=0,P.window=new s.Buf8(P.wsize)),U>=P.wsize?(s.arraySet(P.window,j,c-P.wsize,P.wsize,0),P.wnext=0,P.whave=P.wsize):(U<(N=P.wsize-P.wnext)&&(N=U),s.arraySet(P.window,j,c-U,N,P.wnext),(U-=N)?(s.arraySet(P.window,j,c-U,U,0),P.wnext=U,P.whave=P.wsize):(P.wnext+=N,P.wnext===P.wsize&&(P.wnext=0),P.whave<P.wsize&&(P.whave+=N))),0}i.inflateReset=I,i.inflateReset2=v,i.inflateResetKeep=y,i.inflateInit=function(x){return D(x,15)},i.inflateInit2=D,i.inflate=function(x,j){var c,U,N,P,q,B,J,A,R,Y,G,W,ae,ie,re,se,ce,pe,fe,ge,a,$,z,O,E=0,k=new s.Buf8(4),H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!x||!x.state||!x.output||!x.input&&x.avail_in!==0)return p;(c=x.state).mode===12&&(c.mode=13),q=x.next_out,N=x.output,J=x.avail_out,P=x.next_in,U=x.input,B=x.avail_in,A=c.hold,R=c.bits,Y=B,G=J,$=w;e:for(;;)switch(c.mode){case S:if(c.wrap===0){c.mode=13;break}for(;R<16;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(2&c.wrap&&A===35615){k[c.check=0]=255&A,k[1]=A>>>8&255,c.check=o(c.check,k,2,0),R=A=0,c.mode=2;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&A)<<8)+(A>>8))%31){x.msg="incorrect header check",c.mode=30;break}if((15&A)!=8){x.msg="unknown compression method",c.mode=30;break}if(R-=4,a=8+(15&(A>>>=4)),c.wbits===0)c.wbits=a;else if(a>c.wbits){x.msg="invalid window size",c.mode=30;break}c.dmax=1<<a,x.adler=c.check=1,c.mode=512&A?10:12,R=A=0;break;case 2:for(;R<16;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(c.flags=A,(255&c.flags)!=8){x.msg="unknown compression method",c.mode=30;break}if(57344&c.flags){x.msg="unknown header flags set",c.mode=30;break}c.head&&(c.head.text=A>>8&1),512&c.flags&&(k[0]=255&A,k[1]=A>>>8&255,c.check=o(c.check,k,2,0)),R=A=0,c.mode=3;case 3:for(;R<32;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.head&&(c.head.time=A),512&c.flags&&(k[0]=255&A,k[1]=A>>>8&255,k[2]=A>>>16&255,k[3]=A>>>24&255,c.check=o(c.check,k,4,0)),R=A=0,c.mode=4;case 4:for(;R<16;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.head&&(c.head.xflags=255&A,c.head.os=A>>8),512&c.flags&&(k[0]=255&A,k[1]=A>>>8&255,c.check=o(c.check,k,2,0)),R=A=0,c.mode=5;case 5:if(1024&c.flags){for(;R<16;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.length=A,c.head&&(c.head.extra_len=A),512&c.flags&&(k[0]=255&A,k[1]=A>>>8&255,c.check=o(c.check,k,2,0)),R=A=0}else c.head&&(c.head.extra=null);c.mode=6;case 6:if(1024&c.flags&&(B<(W=c.length)&&(W=B),W&&(c.head&&(a=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),s.arraySet(c.head.extra,U,P,W,a)),512&c.flags&&(c.check=o(c.check,U,W,P)),B-=W,P+=W,c.length-=W),c.length))break e;c.length=0,c.mode=7;case 7:if(2048&c.flags){if(B===0)break e;for(W=0;a=U[P+W++],c.head&&a&&c.length<65536&&(c.head.name+=String.fromCharCode(a)),a&&W<B;);if(512&c.flags&&(c.check=o(c.check,U,W,P)),B-=W,P+=W,a)break e}else c.head&&(c.head.name=null);c.length=0,c.mode=8;case 8:if(4096&c.flags){if(B===0)break e;for(W=0;a=U[P+W++],c.head&&a&&c.length<65536&&(c.head.comment+=String.fromCharCode(a)),a&&W<B;);if(512&c.flags&&(c.check=o(c.check,U,W,P)),B-=W,P+=W,a)break e}else c.head&&(c.head.comment=null);c.mode=9;case 9:if(512&c.flags){for(;R<16;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(A!==(65535&c.check)){x.msg="header crc mismatch",c.mode=30;break}R=A=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0),x.adler=c.check=0,c.mode=12;break;case 10:for(;R<32;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}x.adler=c.check=m(A),R=A=0,c.mode=11;case 11:if(c.havedict===0)return x.next_out=q,x.avail_out=J,x.next_in=P,x.avail_in=B,c.hold=A,c.bits=R,2;x.adler=c.check=1,c.mode=12;case 12:if(j===5||j===6)break e;case 13:if(c.last){A>>>=7&R,R-=7&R,c.mode=27;break}for(;R<3;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}switch(c.last=1&A,R-=1,3&(A>>>=1)){case 0:c.mode=14;break;case 1:if(V(c),c.mode=20,j!==6)break;A>>>=2,R-=2;break e;case 2:c.mode=17;break;case 3:x.msg="invalid block type",c.mode=30}A>>>=2,R-=2;break;case 14:for(A>>>=7&R,R-=7&R;R<32;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if((65535&A)!=(A>>>16^65535)){x.msg="invalid stored block lengths",c.mode=30;break}if(c.length=65535&A,R=A=0,c.mode=15,j===6)break e;case 15:c.mode=16;case 16:if(W=c.length){if(B<W&&(W=B),J<W&&(W=J),W===0)break e;s.arraySet(N,U,P,W,q),B-=W,P+=W,J-=W,q+=W,c.length-=W;break}c.mode=12;break;case 17:for(;R<14;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(c.nlen=257+(31&A),A>>>=5,R-=5,c.ndist=1+(31&A),A>>>=5,R-=5,c.ncode=4+(15&A),A>>>=4,R-=4,286<c.nlen||30<c.ndist){x.msg="too many length or distance symbols",c.mode=30;break}c.have=0,c.mode=18;case 18:for(;c.have<c.ncode;){for(;R<3;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.lens[H[c.have++]]=7&A,A>>>=3,R-=3}for(;c.have<19;)c.lens[H[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,z={bits:c.lenbits},$=d(0,c.lens,0,19,c.lencode,0,c.work,z),c.lenbits=z.bits,$){x.msg="invalid code lengths set",c.mode=30;break}c.have=0,c.mode=19;case 19:for(;c.have<c.nlen+c.ndist;){for(;se=(E=c.lencode[A&(1<<c.lenbits)-1])>>>16&255,ce=65535&E,!((re=E>>>24)<=R);){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(ce<16)A>>>=re,R-=re,c.lens[c.have++]=ce;else{if(ce===16){for(O=re+2;R<O;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(A>>>=re,R-=re,c.have===0){x.msg="invalid bit length repeat",c.mode=30;break}a=c.lens[c.have-1],W=3+(3&A),A>>>=2,R-=2}else if(ce===17){for(O=re+3;R<O;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}R-=re,a=0,W=3+(7&(A>>>=re)),A>>>=3,R-=3}else{for(O=re+7;R<O;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}R-=re,a=0,W=11+(127&(A>>>=re)),A>>>=7,R-=7}if(c.have+W>c.nlen+c.ndist){x.msg="invalid bit length repeat",c.mode=30;break}for(;W--;)c.lens[c.have++]=a}}if(c.mode===30)break;if(c.lens[256]===0){x.msg="invalid code -- missing end-of-block",c.mode=30;break}if(c.lenbits=9,z={bits:c.lenbits},$=d(_,c.lens,0,c.nlen,c.lencode,0,c.work,z),c.lenbits=z.bits,$){x.msg="invalid literal/lengths set",c.mode=30;break}if(c.distbits=6,c.distcode=c.distdyn,z={bits:c.distbits},$=d(g,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,z),c.distbits=z.bits,$){x.msg="invalid distances set",c.mode=30;break}if(c.mode=20,j===6)break e;case 20:c.mode=21;case 21:if(6<=B&&258<=J){x.next_out=q,x.avail_out=J,x.next_in=P,x.avail_in=B,c.hold=A,c.bits=R,u(x,G),q=x.next_out,N=x.output,J=x.avail_out,P=x.next_in,U=x.input,B=x.avail_in,A=c.hold,R=c.bits,c.mode===12&&(c.back=-1);break}for(c.back=0;se=(E=c.lencode[A&(1<<c.lenbits)-1])>>>16&255,ce=65535&E,!((re=E>>>24)<=R);){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(se&&(240&se)==0){for(pe=re,fe=se,ge=ce;se=(E=c.lencode[ge+((A&(1<<pe+fe)-1)>>pe)])>>>16&255,ce=65535&E,!(pe+(re=E>>>24)<=R);){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}A>>>=pe,R-=pe,c.back+=pe}if(A>>>=re,R-=re,c.back+=re,c.length=ce,se===0){c.mode=26;break}if(32&se){c.back=-1,c.mode=12;break}if(64&se){x.msg="invalid literal/length code",c.mode=30;break}c.extra=15&se,c.mode=22;case 22:if(c.extra){for(O=c.extra;R<O;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.length+=A&(1<<c.extra)-1,A>>>=c.extra,R-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=23;case 23:for(;se=(E=c.distcode[A&(1<<c.distbits)-1])>>>16&255,ce=65535&E,!((re=E>>>24)<=R);){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if((240&se)==0){for(pe=re,fe=se,ge=ce;se=(E=c.distcode[ge+((A&(1<<pe+fe)-1)>>pe)])>>>16&255,ce=65535&E,!(pe+(re=E>>>24)<=R);){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}A>>>=pe,R-=pe,c.back+=pe}if(A>>>=re,R-=re,c.back+=re,64&se){x.msg="invalid distance code",c.mode=30;break}c.offset=ce,c.extra=15&se,c.mode=24;case 24:if(c.extra){for(O=c.extra;R<O;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}c.offset+=A&(1<<c.extra)-1,A>>>=c.extra,R-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){x.msg="invalid distance too far back",c.mode=30;break}c.mode=25;case 25:if(J===0)break e;if(W=G-J,c.offset>W){if((W=c.offset-W)>c.whave&&c.sane){x.msg="invalid distance too far back",c.mode=30;break}ae=W>c.wnext?(W-=c.wnext,c.wsize-W):c.wnext-W,W>c.length&&(W=c.length),ie=c.window}else ie=N,ae=q-c.offset,W=c.length;for(J<W&&(W=J),J-=W,c.length-=W;N[q++]=ie[ae++],--W;);c.length===0&&(c.mode=21);break;case 26:if(J===0)break e;N[q++]=c.length,J--,c.mode=21;break;case 27:if(c.wrap){for(;R<32;){if(B===0)break e;B--,A|=U[P++]<<R,R+=8}if(G-=J,x.total_out+=G,c.total+=G,G&&(x.adler=c.check=c.flags?o(c.check,N,G,q-G):l(c.check,N,G,q-G)),G=J,(c.flags?A:m(A))!==c.check){x.msg="incorrect data check",c.mode=30;break}R=A=0}c.mode=28;case 28:if(c.wrap&&c.flags){for(;R<32;){if(B===0)break e;B--,A+=U[P++]<<R,R+=8}if(A!==(4294967295&c.total)){x.msg="incorrect length check",c.mode=30;break}R=A=0}c.mode=29;case 29:$=1;break e;case 30:$=-3;break e;case 31:return-4;case 32:default:return p}return x.next_out=q,x.avail_out=J,x.next_in=P,x.avail_in=B,c.hold=A,c.bits=R,(c.wsize||G!==x.avail_out&&c.mode<30&&(c.mode<27||j!==4))&&te(x,x.output,x.next_out,G-x.avail_out)?(c.mode=31,-4):(Y-=x.avail_in,G-=x.avail_out,x.total_in+=Y,x.total_out+=G,c.total+=G,c.wrap&&G&&(x.adler=c.check=c.flags?o(c.check,N,G,x.next_out-G):l(c.check,N,G,x.next_out-G)),x.data_type=c.bits+(c.last?64:0)+(c.mode===12?128:0)+(c.mode===20||c.mode===15?256:0),(Y==0&&G===0||j===4)&&$===w&&($=-5),$)},i.inflateEnd=function(x){if(!x||!x.state)return p;var j=x.state;return j.window&&(j.window=null),x.state=null,w},i.inflateGetHeader=function(x,j){var c;return x&&x.state?(2&(c=x.state).wrap)==0?p:((c.head=j).done=!1,w):p},i.inflateSetDictionary=function(x,j){var c,U=j.length;return x&&x.state?(c=x.state).wrap!==0&&c.mode!==11?p:c.mode===11&&l(1,j,U,0)!==c.check?-3:te(x,j,U,U)?(c.mode=31,-4):(c.havedict=1,w):p},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,i){var s=n("../utils/common"),l=[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],o=[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],u=[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],d=[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];r.exports=function(_,g,w,p,S,f,b,m){var h,y,I,v,D,T,F,C,V,te=m.bits,x=0,j=0,c=0,U=0,N=0,P=0,q=0,B=0,J=0,A=0,R=null,Y=0,G=new s.Buf16(16),W=new s.Buf16(16),ae=null,ie=0;for(x=0;x<=15;x++)G[x]=0;for(j=0;j<p;j++)G[g[w+j]]++;for(N=te,U=15;1<=U&&G[U]===0;U--);if(U<N&&(N=U),U===0)return S[f++]=20971520,S[f++]=20971520,m.bits=1,0;for(c=1;c<U&&G[c]===0;c++);for(N<c&&(N=c),x=B=1;x<=15;x++)if(B<<=1,(B-=G[x])<0)return-1;if(0<B&&(_===0||U!==1))return-1;for(W[1]=0,x=1;x<15;x++)W[x+1]=W[x]+G[x];for(j=0;j<p;j++)g[w+j]!==0&&(b[W[g[w+j]]++]=j);if(T=_===0?(R=ae=b,19):_===1?(R=l,Y-=257,ae=o,ie-=257,256):(R=u,ae=d,-1),x=c,D=f,q=j=A=0,I=-1,v=(J=1<<(P=N))-1,_===1&&852<J||_===2&&592<J)return 1;for(;;){for(F=x-q,V=b[j]<T?(C=0,b[j]):b[j]>T?(C=ae[ie+b[j]],R[Y+b[j]]):(C=96,0),h=1<<x-q,c=y=1<<P;S[D+(A>>q)+(y-=h)]=F<<24|C<<16|V|0,y!==0;);for(h=1<<x-1;A&h;)h>>=1;if(h!==0?(A&=h-1,A+=h):A=0,j++,--G[x]==0){if(x===U)break;x=g[w+b[j]]}if(N<x&&(A&v)!==I){for(q===0&&(q=N),D+=c,B=1<<(P=x-q);P+q<U&&!((B-=G[P+q])<=0);)P++,B<<=1;if(J+=1<<P,_===1&&852<J||_===2&&592<J)return 1;S[I=A&v]=N<<24|P<<16|D-f|0}}return A!==0&&(S[D+A]=x-q<<24|64<<16|0),m.bits=N,0}},{"../utils/common":41}],51:[function(n,r,i){r.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(n,r,i){var s=n("../utils/common"),l=0,o=1;function u(E){for(var k=E.length;0<=--k;)E[k]=0}var d=0,_=29,g=256,w=g+1+_,p=30,S=19,f=2*w+1,b=15,m=16,h=7,y=256,I=16,v=17,D=18,T=[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],F=[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],C=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],V=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],te=new Array(2*(w+2));u(te);var x=new Array(2*p);u(x);var j=new Array(512);u(j);var c=new Array(256);u(c);var U=new Array(_);u(U);var N,P,q,B=new Array(p);function J(E,k,H,Z,M){this.static_tree=E,this.extra_bits=k,this.extra_base=H,this.elems=Z,this.max_length=M,this.has_stree=E&&E.length}function A(E,k){this.dyn_tree=E,this.max_code=0,this.stat_desc=k}function R(E){return E<256?j[E]:j[256+(E>>>7)]}function Y(E,k){E.pending_buf[E.pending++]=255&k,E.pending_buf[E.pending++]=k>>>8&255}function G(E,k,H){E.bi_valid>m-H?(E.bi_buf|=k<<E.bi_valid&65535,Y(E,E.bi_buf),E.bi_buf=k>>m-E.bi_valid,E.bi_valid+=H-m):(E.bi_buf|=k<<E.bi_valid&65535,E.bi_valid+=H)}function W(E,k,H){G(E,H[2*k],H[2*k+1])}function ae(E,k){for(var H=0;H|=1&E,E>>>=1,H<<=1,0<--k;);return H>>>1}function ie(E,k,H){var Z,M,X=new Array(b+1),Q=0;for(Z=1;Z<=b;Z++)X[Z]=Q=Q+H[Z-1]<<1;for(M=0;M<=k;M++){var K=E[2*M+1];K!==0&&(E[2*M]=ae(X[K]++,K))}}function re(E){var k;for(k=0;k<w;k++)E.dyn_ltree[2*k]=0;for(k=0;k<p;k++)E.dyn_dtree[2*k]=0;for(k=0;k<S;k++)E.bl_tree[2*k]=0;E.dyn_ltree[2*y]=1,E.opt_len=E.static_len=0,E.last_lit=E.matches=0}function se(E){8<E.bi_valid?Y(E,E.bi_buf):0<E.bi_valid&&(E.pending_buf[E.pending++]=E.bi_buf),E.bi_buf=0,E.bi_valid=0}function ce(E,k,H,Z){var M=2*k,X=2*H;return E[M]<E[X]||E[M]===E[X]&&Z[k]<=Z[H]}function pe(E,k,H){for(var Z=E.heap[H],M=H<<1;M<=E.heap_len&&(M<E.heap_len&&ce(k,E.heap[M+1],E.heap[M],E.depth)&&M++,!ce(k,Z,E.heap[M],E.depth));)E.heap[H]=E.heap[M],H=M,M<<=1;E.heap[H]=Z}function fe(E,k,H){var Z,M,X,Q,K=0;if(E.last_lit!==0)for(;Z=E.pending_buf[E.d_buf+2*K]<<8|E.pending_buf[E.d_buf+2*K+1],M=E.pending_buf[E.l_buf+K],K++,Z===0?W(E,M,k):(W(E,(X=c[M])+g+1,k),(Q=T[X])!==0&&G(E,M-=U[X],Q),W(E,X=R(--Z),H),(Q=F[X])!==0&&G(E,Z-=B[X],Q)),K<E.last_lit;);W(E,y,k)}function ge(E,k){var H,Z,M,X=k.dyn_tree,Q=k.stat_desc.static_tree,K=k.stat_desc.has_stree,ne=k.stat_desc.elems,de=-1;for(E.heap_len=0,E.heap_max=f,H=0;H<ne;H++)X[2*H]!==0?(E.heap[++E.heap_len]=de=H,E.depth[H]=0):X[2*H+1]=0;for(;E.heap_len<2;)X[2*(M=E.heap[++E.heap_len]=de<2?++de:0)]=1,E.depth[M]=0,E.opt_len--,K&&(E.static_len-=Q[2*M+1]);for(k.max_code=de,H=E.heap_len>>1;1<=H;H--)pe(E,X,H);for(M=ne;H=E.heap[1],E.heap[1]=E.heap[E.heap_len--],pe(E,X,1),Z=E.heap[1],E.heap[--E.heap_max]=H,E.heap[--E.heap_max]=Z,X[2*M]=X[2*H]+X[2*Z],E.depth[M]=(E.depth[H]>=E.depth[Z]?E.depth[H]:E.depth[Z])+1,X[2*H+1]=X[2*Z+1]=M,E.heap[1]=M++,pe(E,X,1),2<=E.heap_len;);E.heap[--E.heap_max]=E.heap[1],(function(ue,Oe){var We,ve,He,he,ot,Ot,Ae=Oe.dyn_tree,Xt=Oe.max_code,Ir=Oe.stat_desc.static_tree,Ar=Oe.stat_desc.has_stree,Rr=Oe.stat_desc.extra_bits,Kt=Oe.stat_desc.extra_base,Ze=Oe.stat_desc.max_length,st=0;for(he=0;he<=b;he++)ue.bl_count[he]=0;for(Ae[2*ue.heap[ue.heap_max]+1]=0,We=ue.heap_max+1;We<f;We++)Ze<(he=Ae[2*Ae[2*(ve=ue.heap[We])+1]+1]+1)&&(he=Ze,st++),Ae[2*ve+1]=he,Xt<ve||(ue.bl_count[he]++,ot=0,Kt<=ve&&(ot=Rr[ve-Kt]),Ot=Ae[2*ve],ue.opt_len+=Ot*(he+ot),Ar&&(ue.static_len+=Ot*(Ir[2*ve+1]+ot)));if(st!==0){do{for(he=Ze-1;ue.bl_count[he]===0;)he--;ue.bl_count[he]--,ue.bl_count[he+1]+=2,ue.bl_count[Ze]--,st-=2}while(0<st);for(he=Ze;he!==0;he--)for(ve=ue.bl_count[he];ve!==0;)Xt<(He=ue.heap[--We])||(Ae[2*He+1]!==he&&(ue.opt_len+=(he-Ae[2*He+1])*Ae[2*He],Ae[2*He+1]=he),ve--)}})(E,k),ie(X,de,E.bl_count)}function a(E,k,H){var Z,M,X=-1,Q=k[1],K=0,ne=7,de=4;for(Q===0&&(ne=138,de=3),k[2*(H+1)+1]=65535,Z=0;Z<=H;Z++)M=Q,Q=k[2*(Z+1)+1],++K<ne&&M===Q||(K<de?E.bl_tree[2*M]+=K:M!==0?(M!==X&&E.bl_tree[2*M]++,E.bl_tree[2*I]++):K<=10?E.bl_tree[2*v]++:E.bl_tree[2*D]++,X=M,de=(K=0)===Q?(ne=138,3):M===Q?(ne=6,3):(ne=7,4))}function $(E,k,H){var Z,M,X=-1,Q=k[1],K=0,ne=7,de=4;for(Q===0&&(ne=138,de=3),Z=0;Z<=H;Z++)if(M=Q,Q=k[2*(Z+1)+1],!(++K<ne&&M===Q)){if(K<de)for(;W(E,M,E.bl_tree),--K!=0;);else M!==0?(M!==X&&(W(E,M,E.bl_tree),K--),W(E,I,E.bl_tree),G(E,K-3,2)):K<=10?(W(E,v,E.bl_tree),G(E,K-3,3)):(W(E,D,E.bl_tree),G(E,K-11,7));X=M,de=(K=0)===Q?(ne=138,3):M===Q?(ne=6,3):(ne=7,4)}}u(B);var z=!1;function O(E,k,H,Z){G(E,(d<<1)+(Z?1:0),3),(function(M,X,Q,K){se(M),Y(M,Q),Y(M,~Q),s.arraySet(M.pending_buf,M.window,X,Q,M.pending),M.pending+=Q})(E,k,H)}i._tr_init=function(E){z||((function(){var k,H,Z,M,X,Q=new Array(b+1);for(M=Z=0;M<_-1;M++)for(U[M]=Z,k=0;k<1<<T[M];k++)c[Z++]=M;for(c[Z-1]=M,M=X=0;M<16;M++)for(B[M]=X,k=0;k<1<<F[M];k++)j[X++]=M;for(X>>=7;M<p;M++)for(B[M]=X<<7,k=0;k<1<<F[M]-7;k++)j[256+X++]=M;for(H=0;H<=b;H++)Q[H]=0;for(k=0;k<=143;)te[2*k+1]=8,k++,Q[8]++;for(;k<=255;)te[2*k+1]=9,k++,Q[9]++;for(;k<=279;)te[2*k+1]=7,k++,Q[7]++;for(;k<=287;)te[2*k+1]=8,k++,Q[8]++;for(ie(te,w+1,Q),k=0;k<p;k++)x[2*k+1]=5,x[2*k]=ae(k,5);N=new J(te,T,g+1,w,b),P=new J(x,F,0,p,b),q=new J(new Array(0),C,0,S,h)})(),z=!0),E.l_desc=new A(E.dyn_ltree,N),E.d_desc=new A(E.dyn_dtree,P),E.bl_desc=new A(E.bl_tree,q),E.bi_buf=0,E.bi_valid=0,re(E)},i._tr_stored_block=O,i._tr_flush_block=function(E,k,H,Z){var M,X,Q=0;0<E.level?(E.strm.data_type===2&&(E.strm.data_type=(function(K){var ne,de=4093624447;for(ne=0;ne<=31;ne++,de>>>=1)if(1&de&&K.dyn_ltree[2*ne]!==0)return l;if(K.dyn_ltree[18]!==0||K.dyn_ltree[20]!==0||K.dyn_ltree[26]!==0)return o;for(ne=32;ne<g;ne++)if(K.dyn_ltree[2*ne]!==0)return o;return l})(E)),ge(E,E.l_desc),ge(E,E.d_desc),Q=(function(K){var ne;for(a(K,K.dyn_ltree,K.l_desc.max_code),a(K,K.dyn_dtree,K.d_desc.max_code),ge(K,K.bl_desc),ne=S-1;3<=ne&&K.bl_tree[2*V[ne]+1]===0;ne--);return K.opt_len+=3*(ne+1)+5+5+4,ne})(E),M=E.opt_len+3+7>>>3,(X=E.static_len+3+7>>>3)<=M&&(M=X)):M=X=H+5,H+4<=M&&k!==-1?O(E,k,H,Z):E.strategy===4||X===M?(G(E,2+(Z?1:0),3),fe(E,te,x)):(G(E,4+(Z?1:0),3),(function(K,ne,de,ue){var Oe;for(G(K,ne-257,5),G(K,de-1,5),G(K,ue-4,4),Oe=0;Oe<ue;Oe++)G(K,K.bl_tree[2*V[Oe]+1],3);$(K,K.dyn_ltree,ne-1),$(K,K.dyn_dtree,de-1)})(E,E.l_desc.max_code+1,E.d_desc.max_code+1,Q+1),fe(E,E.dyn_ltree,E.dyn_dtree)),re(E),Z&&se(E)},i._tr_tally=function(E,k,H){return E.pending_buf[E.d_buf+2*E.last_lit]=k>>>8&255,E.pending_buf[E.d_buf+2*E.last_lit+1]=255&k,E.pending_buf[E.l_buf+E.last_lit]=255&H,E.last_lit++,k===0?E.dyn_ltree[2*H]++:(E.matches++,k--,E.dyn_ltree[2*(c[H]+g+1)]++,E.dyn_dtree[2*R(k)]++),E.last_lit===E.lit_bufsize-1},i._tr_align=function(E){G(E,2,3),W(E,y,te),(function(k){k.bi_valid===16?(Y(k,k.bi_buf),k.bi_buf=0,k.bi_valid=0):8<=k.bi_valid&&(k.pending_buf[k.pending++]=255&k.bi_buf,k.bi_buf>>=8,k.bi_valid-=8)})(E)}},{"../utils/common":41}],53:[function(n,r,i){r.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(n,r,i){(function(s){(function(l,o){if(!l.setImmediate){var u,d,_,g,w=1,p={},S=!1,f=l.document,b=Object.getPrototypeOf&&Object.getPrototypeOf(l);b=b&&b.setTimeout?b:l,u={}.toString.call(l.process)==="[object process]"?function(I){Cr.nextTick(function(){h(I)})}:(function(){if(l.postMessage&&!l.importScripts){var I=!0,v=l.onmessage;return l.onmessage=function(){I=!1},l.postMessage("","*"),l.onmessage=v,I}})()?(g="setImmediate$"+Math.random()+"$",l.addEventListener?l.addEventListener("message",y,!1):l.attachEvent("onmessage",y),function(I){l.postMessage(g+I,"*")}):l.MessageChannel?((_=new MessageChannel).port1.onmessage=function(I){h(I.data)},function(I){_.port2.postMessage(I)}):f&&"onreadystatechange"in f.createElement("script")?(d=f.documentElement,function(I){var v=f.createElement("script");v.onreadystatechange=function(){h(I),v.onreadystatechange=null,d.removeChild(v),v=null},d.appendChild(v)}):function(I){setTimeout(h,0,I)},b.setImmediate=function(I){typeof I!="function"&&(I=new Function(""+I));for(var v=new Array(arguments.length-1),D=0;D<v.length;D++)v[D]=arguments[D+1];var T={callback:I,args:v};return p[w]=T,u(w),w++},b.clearImmediate=m}function m(I){delete p[I]}function h(I){if(S)setTimeout(h,0,I);else{var v=p[I];if(v){S=!0;try{(function(D){var T=D.callback,F=D.args;switch(F.length){case 0:T();break;case 1:T(F[0]);break;case 2:T(F[0],F[1]);break;case 3:T(F[0],F[1],F[2]);break;default:T.apply(o,F)}})(v)}finally{m(I),S=!1}}}}function y(I){I.source===l&&typeof I.data=="string"&&I.data.indexOf(g)===0&&h(+I.data.slice(g.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof at<"u"?at:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(wt)),wt.exports}var Pi=Ni();const xn=dn(Pi);function zi(e){const t=[],n=Object.keys(e);for(const r of n){const i=e[r];if(!i)continue;const s=i.sort((o,u)=>o.index-u.index);let l=-1;for(let o=0;o<s.length;o++)l=l+1+s[o].skip,s[o].index!==l&&t.push({message:`Invalid operation index ${s[o].index} at position ${o}`,details:{position:o,operation:s[o],scope:s[o].action.scope}})}return t}function Li(e){const t=new xn,n=e.header;return t.file("header.json",JSON.stringify(n,null,2)),t.file("state.json",JSON.stringify(e.initialState||{},null,2)),t.file("current-state.json",JSON.stringify(e.state||{},null,2)),t.file("operations.json",JSON.stringify(Ti(e.operations),null,2)),t}async function Ui(e,t){const r=await Li(e).generateAsync({type:"blob"}),i=await t.createWritable();await i.write(r),await i.close()}async function ji(e,t,n){const r=new xn;return await r.loadAsync(e),Bi(r,t,n)}async function Bi(e,t,n){const r=e.file("state.json");if(!r)throw new Error("Initial state not found");const i=await r.async("string"),s=JSON.parse(i),l=e.file("header.json");if(!l)throw new Error("Document header not found - file format may be outdated");const o=JSON.parse(await l.async("string")),u=e.file("operations.json");if(!u)throw new Error("Operations history not found");const d=JSON.parse(await u.async("string")),_=ht(d),g=zi(_);if(g.length){const p=g.map(S=>S.message);throw new Error(p.join(`
|
|
22
|
+
`))}return wn(s,_,t,o,void 0,{},n)}const Fi=/@([a-zA-Z0-9_]+)/g,$i=new Intl.DateTimeFormat,Xe=(e,t,n)=>{const r={},i=[];let s;for(;(s=Fi.exec(t))!==null;){const u=s[1];if(i.indexOf(u)===-1){i.push(u);const _=n[i.length-1];r[u]=_}}for(const[u,d]of Object.entries(r)){let _;if(!d)_="null";else if(typeof d=="string")_=d;else if(typeof d=="object")_=JSON.stringify(d);else if(typeof d=="function"){const g=d.name;_=g?`${g}()`:"anonymous()"}else _=String(d);t=t.replaceAll(`@${u}`,_)}e.length>0&&(t=`${e} ${t}`);const l=new Date,o=$i.format(l);return r.timestamp=o,[t,r]},Re={verbose:0,debug:1,info:2,warn:3,error:4};class Lt{#n;#t;#e=Re.info;errorHandler;constructor(t,n){this.#n=t||[],this.#t=this.#n.map(r=>`[${r}]`).join(""),this.errorHandler=n??(()=>{})}get level(){return Object.keys(Re).find(t=>Re[t]===this.#e)}set level(t){this.#e=Re[t]}child(t){const n=new Lt([...this.#n,...t],this.errorHandler);return n.level=this.level,n}verbose(t,...n){if(this.#e<=Re.verbose){const[r,i]=Xe(this.#t,t,n);console.debug(`[${i.timestamp}] ${r}`,i)}}debug(t,...n){if(this.#e<=Re.debug){const[r,i]=Xe(this.#t,t,n);console.debug(`[${i.timestamp}] ${r}`,i)}}info(t,...n){if(this.#e<=Re.info){const[r,i]=Xe(this.#t,t,n);console.info(`[${i.timestamp}] ${r}`,i)}}warn(t,...n){if(this.#e<=Re.warn){const[r,i]=Xe(this.#t,t,n);console.warn(`[${i.timestamp}] ${r}`,i)}}error(t,...n){if(this.#e<=Re.error){const[r,i]=Xe(this.#t,t,n);console.error(`[${i.timestamp}] ${r}`,i)}}}const In=new Lt,la=e=>{In.level=e},ua=e=>In.child(e),me={Remove:"remove",Replace:"replace",Add:"add"},An=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),Wi=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),dt=Symbol.iterator,Se={mutable:"mutable",immutable:"immutable"},Ut={};function Ye(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function tn(e,t){if(t in e){let n=Reflect.getPrototypeOf(e);for(;n;){const r=Reflect.getOwnPropertyDescriptor(n,t);if(r)return r;n=Reflect.getPrototypeOf(n)}}}function jt(e){return Object.getPrototypeOf(e)===Set.prototype}function Bt(e){return Object.getPrototypeOf(e)===Map.prototype}function Ee(e){var t;return(t=e.copy)!==null&&t!==void 0?t:e.original}function Me(e){return!!le(e)}function le(e){return typeof e!="object"?null:e?.[An]}function Ft(e){var t;const n=le(e);return n?(t=n.copy)!==null&&t!==void 0?t:n.original:e}function we(e,t){if(!e||typeof e!="object")return!1;let n;return Object.getPrototypeOf(e)===Object.prototype||Array.isArray(e)||e instanceof Map||e instanceof Set||!!t?.mark&&((n=t.mark(e,Se))===Se.immutable||typeof n=="function")}function Rn(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=le(Te(n,e.key));if(r!==null&&r?.original!==e.original)return null;const i=e.parent.type===3,s=i?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(i&&n.size>s||Ye(n,s)))return null;t.push(s)}if(e.parent)return Rn(e.parent,t);t.reverse();try{Hi(e.copy,t)}catch{return null}return t}function Ue(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function Te(e,t){return Ue(e)===2?e.get(t):e[t]}function nt(e,t,n){Ue(e)===2?e.set(t,n):e[t]=n}function vt(e,t){const n=le(e);return(n?Ee(n):e)[t]}function ke(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function xt(e){if(e)for(;e.finalities.revoke.length>0;)e.finalities.revoke.pop()()}function ze(e,t){return t?e:[""].concat(e).map(n=>{const r=`${n}`;return r.indexOf("/")===-1&&r.indexOf("~")===-1?r:r.replace(/~/g,"~0").replace(/\//g,"~1")}).join("/")}function Hi(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if(e=Te(Ue(e)===3?Array.from(e):e,r),typeof e!="object")throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}return e}function Zi(e){const t=Object.create(Object.getPrototypeOf(e));return Reflect.ownKeys(e).forEach(n=>{let r=Reflect.getOwnPropertyDescriptor(e,n);if(r.enumerable&&r.configurable&&r.writable){t[n]=e[n];return}r.writable||(r.writable=!0,r.configurable=!0),(r.get||r.set)&&(r={configurable:!0,writable:!0,enumerable:r.enumerable,value:e[n]}),Reflect.defineProperty(t,n,r)}),t}const Vi=Object.prototype.propertyIsEnumerable;function kn(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set){if(!jt(e)){const r=Object.getPrototypeOf(e).constructor;return new r(e.values())}return Set.prototype.difference?Set.prototype.difference.call(e,new Set):new Set(e.values())}else if(e instanceof Map){if(!Bt(e)){const r=Object.getPrototypeOf(e).constructor;return new r(e)}return new Map(e)}else if(t?.mark&&(n=t.mark(e,Se),n!==void 0)&&n!==Se.mutable){if(n===Se.immutable)return Zi(e);if(typeof n=="function"){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return n()}throw new Error(`Unsupported mark result: ${n}`)}else if(typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype){const r={};return Object.keys(e).forEach(i=>{r[i]=e[i]}),Object.getOwnPropertySymbols(e).forEach(i=>{Vi.call(e,i)&&(r[i]=e[i])}),r}else throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function _e(e){e.copy||(e.copy=kn(e.original,e.options))}function qe(e){if(!we(e))return Ft(e);if(Array.isArray(e))return e.map(qe);if(e instanceof Map){const n=Array.from(e.entries()).map(([r,i])=>[r,qe(i)]);if(!Bt(e)){const r=Object.getPrototypeOf(e).constructor;return new r(n)}return new Map(n)}if(e instanceof Set){const n=Array.from(e).map(qe);if(!jt(e)){const r=Object.getPrototypeOf(e).constructor;return new r(n)}return new Set(n)}const t=Object.create(Object.getPrototypeOf(e));for(const n in e)t[n]=qe(e[n]);return t}function ft(e){return Me(e)?qe(e):e}function Ie(e){var t;e.assignedMap=(t=e.assignedMap)!==null&&t!==void 0?t:new Map,e.operated||(e.operated=!0,e.parent&&Ie(e.parent))}function nn(){throw new Error("Cannot modify frozen object")}function Fe(e,t,n,r,i){{n=n??new WeakMap,r=r??[],i=i??[];const l=n.has(e)?n.get(e):e;if(r.length>0){const o=r.indexOf(l);if(l&&typeof l=="object"&&o!==-1)throw r[0]===l?new Error("Forbids circular reference"):new Error(`Forbids circular reference: ~/${i.slice(0,o).map((u,d)=>{if(typeof u=="symbol")return`[${u.toString()}]`;const _=r[d];return typeof u=="object"&&(_ instanceof Map||_ instanceof Set)?Array.from(_.keys()).indexOf(u):u}).join("/")}`);r.push(l),i.push(t)}else r.push(l)}if(Object.isFrozen(e)||Me(e)){r.pop(),i.pop();return}switch(Ue(e)){case 2:for(const[o,u]of e)Fe(o,o,n,r,i),Fe(u,o,n,r,i);e.set=e.clear=e.delete=nn;break;case 3:for(const o of e)Fe(o,o,n,r,i);e.add=e.clear=e.delete=nn;break;case 1:Object.freeze(e);let l=0;for(const o of e)Fe(o,l,n,r,i),l+=1;break;default:Object.freeze(e),Object.keys(e).forEach(o=>{const u=e[o];Fe(u,o,n,r,i)})}r.pop(),i.pop()}function $t(e,t){const n=Ue(e);if(n===0)Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)});else if(n===1){let r=0;for(const i of e)t(r,i,e),r+=1}else e.forEach((r,i)=>t(i,r,e))}function Tn(e,t,n){if(Me(e)||!we(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),$t(e,(s,l)=>{var o;if(Me(l)){const u=le(l);_e(u);const d=!((o=u.assignedMap)===null||o===void 0)&&o.size||u.operated?u.copy:u.original;nt(r?i:e,s,d)}else Tn(l,t,n)}),i){const s=e,l=Array.from(s);s.clear(),l.forEach(o=>{s.add(i.has(o)?i.get(o):o)})}}function Gi(e,t){const n=e.type===3?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&Tn(Te(n,t),e.finalities.handledSet,e.options)}function It(e){e.type===3&&e.copy&&(e.copy.clear(),e.setMap.forEach(t=>{e.copy.add(Ft(t))}))}function At(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const s=Rn(e);s&&t(e,s,n,r)}e.finalized=!0}}function Wt(e,t,n,r){const i=le(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push((s,l)=>{var o;const u=e.type===3?e.setMap:e.copy;if(ke(Te(u,t),n)){let d=i.original;i.copy&&(d=i.copy),It(e),At(e,r,s,l),e.options.enableAutoFreeze&&(e.options.updatedValues=(o=e.options.updatedValues)!==null&&o!==void 0?o:new WeakMap,e.options.updatedValues.set(d,i.original)),nt(u,t,d)}}),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),we(n,e.options)&&e.finalities.draft.push(()=>{const s=e.type===3?e.setMap:e.copy;ke(Te(s,t),n)&&Gi(e,t)})}function Xi(e,t,n,r,i){let{original:s,assignedMap:l,options:o}=e,u=e.copy;u.length<s.length&&([s,u]=[u,s],[n,r]=[r,n]);for(let d=0;d<s.length;d+=1)if(l.get(d.toString())&&u[d]!==s[d]){const _=t.concat([d]),g=ze(_,i);n.push({op:me.Replace,path:g,value:ft(u[d])}),r.push({op:me.Replace,path:g,value:ft(s[d])})}for(let d=s.length;d<u.length;d+=1){const _=t.concat([d]),g=ze(_,i);n.push({op:me.Add,path:g,value:ft(u[d])})}if(s.length<u.length){const{arrayLengthAssignment:d=!0}=o.enablePatches;if(d){const _=t.concat(["length"]),g=ze(_,i);r.push({op:me.Replace,path:g,value:s.length})}else for(let _=u.length;s.length<_;_-=1){const g=t.concat([_-1]),w=ze(g,i);r.push({op:me.Remove,path:w})}}}function Ki({original:e,copy:t,assignedMap:n},r,i,s,l){n.forEach((o,u)=>{const d=Te(e,u),_=ft(Te(t,u)),g=o?Ye(e,u)?me.Replace:me.Add:me.Remove;if(ke(d,_)&&g===me.Replace)return;const w=r.concat(u),p=ze(w,l);i.push(g===me.Remove?{op:g,path:p}:{op:g,path:p,value:_}),s.push(g===me.Add?{op:me.Remove,path:p}:g===me.Remove?{op:me.Add,path:p,value:d}:{op:me.Replace,path:p,value:d})})}function Ji({original:e,copy:t},n,r,i,s){let l=0;e.forEach(o=>{if(!t.has(o)){const u=n.concat([l]),d=ze(u,s);r.push({op:me.Remove,path:d,value:o}),i.unshift({op:me.Add,path:d,value:o})}l+=1}),l=0,t.forEach(o=>{if(!e.has(o)){const u=n.concat([l]),d=ze(u,s);r.push({op:me.Add,path:d,value:o}),i.unshift({op:me.Remove,path:d,value:o})}l+=1})}function Qe(e,t,n,r){const{pathAsArray:i=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return Ki(e,t,n,r,i);case 1:return Xi(e,t,n,r,i);case 3:return Ji(e,t,n,r,i)}}let Rt=!1;const mt=(e,t,n=!1)=>{if(typeof e=="object"&&e!==null&&(!we(e,t)||n)&&!Rt)throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")};function qi(e){Rt=!0;let t;try{t=e()}finally{Rt=!1}return t}const kt={get size(){return Ee(le(this)).size},has(e){return Ee(le(this)).has(e)},set(e,t){const n=le(this),r=Ee(n);return(!r.has(e)||!ke(r.get(e),t))&&(_e(n),Ie(n),n.assignedMap.set(e,!0),n.copy.set(e,t),Wt(n,e,t,Qe)),this},delete(e){if(!this.has(e))return!1;const t=le(this);return _e(t),Ie(t),t.original.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.copy.delete(e),!0},clear(){const e=le(this);if(this.size){_e(e),Ie(e),e.assignedMap=new Map;for(const[t]of e.original)e.assignedMap.set(t,!1);e.copy.clear()}},forEach(e,t){const n=le(this);Ee(n).forEach((r,i)=>{e.call(t,this.get(i),i,this)})},get(e){var t,n;const r=le(this),i=Ee(r).get(e),s=((n=(t=r.options).mark)===null||n===void 0?void 0:n.call(t,i,Se))===Se.mutable;if(r.options.strict&&mt(i,r.options,s),s||r.finalized||!we(i,r.options)||i!==r.original.get(e))return i;const l=Ut.createDraft({original:i,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return _e(r),r.copy.set(e,l),l},keys(){return Ee(le(this)).keys()},values(){const e=this.keys();return{[dt]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[dt]:()=>this.entries(),next:()=>{const t=e.next();if(t.done)return t;const n=this.get(t.value);return{done:!1,value:[t.value,n]}}}},[dt](){return this.entries()}},Yi=Reflect.ownKeys(kt),rn=(e,t,{isValuesIterator:n})=>()=>{var r,i;const s=t.next();if(s.done)return s;const l=s.value;let o=e.setMap.get(l);const u=le(o),d=((i=(r=e.options).mark)===null||i===void 0?void 0:i.call(r,o,Se))===Se.mutable;if(e.options.strict&&mt(l,e.options,d),!d&&!u&&we(l,e.options)&&!e.finalized&&e.original.has(l)){const _=Ut.createDraft({original:l,parentDraft:e,key:l,finalities:e.finalities,options:e.options});e.setMap.set(l,_),o=_}else u&&(o=u.proxy);return{done:!1,value:n?o:[o,o]}},gt={get size(){return le(this).setMap.size},has(e){const t=le(this);if(t.setMap.has(e))return!0;_e(t);const n=le(e);return!!(n&&t.setMap.has(n.original))},add(e){const t=le(this);return this.has(e)||(_e(t),Ie(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),Wt(t,e,e,Qe)),this},delete(e){if(!this.has(e))return!1;const t=le(this);_e(t),Ie(t);const n=le(e);return n&&t.setMap.has(n.original)?(t.assignedMap.set(n.original,!1),t.setMap.delete(n.original)):(!n&&t.setMap.has(e)?t.assignedMap.set(e,!1):t.assignedMap.delete(e),t.setMap.delete(e))},clear(){if(!this.size)return;const e=le(this);_e(e),Ie(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=le(this);_e(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:rn(e,t,{isValuesIterator:!0})}},entries(){const e=le(this);_e(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:rn(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[dt](){return this.values()},forEach(e,t){const n=this.values();let r=n.next();for(;!r.done;)e.call(t,r.value,r.value,this),r=n.next()}};Set.prototype.difference&&Object.assign(gt,{intersection(e){return Set.prototype.intersection.call(new Set(this.values()),e)},union(e){return Set.prototype.union.call(new Set(this.values()),e)},difference(e){return Set.prototype.difference.call(new Set(this.values()),e)},symmetricDifference(e){return Set.prototype.symmetricDifference.call(new Set(this.values()),e)},isSubsetOf(e){return Set.prototype.isSubsetOf.call(new Set(this.values()),e)},isSupersetOf(e){return Set.prototype.isSupersetOf.call(new Set(this.values()),e)},isDisjointFrom(e){return Set.prototype.isDisjointFrom.call(new Set(this.values()),e)}});const Qi=Reflect.ownKeys(gt),Dn={get(e,t,n){var r,i;const s=(r=e.copy)===null||r===void 0?void 0:r[t];if(s&&e.finalities.draftsCache.has(s))return s;if(t===An)return e;let l;if(e.options.mark){const d=t==="size"&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(l=e.options.mark(d,Se),l===Se.mutable)return e.options.strict&&mt(d,e.options,!0),d}const o=Ee(e);if(o instanceof Map&&Yi.includes(t))return t==="size"?Object.getOwnPropertyDescriptor(kt,"size").get.call(e.proxy):kt[t].bind(e.proxy);if(o instanceof Set&&Qi.includes(t))return t==="size"?Object.getOwnPropertyDescriptor(gt,"size").get.call(e.proxy):gt[t].bind(e.proxy);if(!Ye(o,t)){const d=tn(o,t);return d?"value"in d?d.value:(i=d.get)===null||i===void 0?void 0:i.call(e.proxy):void 0}const u=o[t];if(e.options.strict&&mt(u,e.options),e.finalized||!we(u,e.options))return u;if(u===vt(e.original,t)){if(_e(e),e.copy[t]=Ht({original:e.original[t],parentDraft:e,key:e.type===1?Number(t):t,finalities:e.finalities,options:e.options}),typeof l=="function"){const d=le(e.copy[t]);return _e(d),Ie(d),d.copy}return e.copy[t]}return Me(u)&&e.finalities.draftsCache.add(u),u},set(e,t,n){var r;if(e.type===3||e.type===2)throw new Error("Map/Set draft does not support any property assignment.");let i;if(e.type===1&&t!=="length"&&!(Number.isInteger(i=Number(t))&&i>=0&&(t===0||i===0||String(i)===String(t))))throw new Error("Only supports setting array indices and the 'length' property.");const s=tn(Ee(e),t);if(s?.set)return s.set.call(e.proxy,n),!0;const l=vt(Ee(e),t),o=le(l);return o&&ke(o.original,n)?(e.copy[t]=n,e.assignedMap=(r=e.assignedMap)!==null&&r!==void 0?r:new Map,e.assignedMap.set(t,!1),!0):(ke(n,l)&&(n!==void 0||Ye(e.original,t))||(_e(e),Ie(e),Ye(e.original,t)&&ke(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,Wt(e,t,n,Qe)),!0)},has(e,t){return t in Ee(e)},ownKeys(e){return Reflect.ownKeys(Ee(e))},getOwnPropertyDescriptor(e,t){const n=Ee(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},getPrototypeOf(e){return Reflect.getPrototypeOf(e.original)},setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(e,t){var n;return e.type===1?Dn.set.call(this,e,t,void 0,e.proxy):(vt(e.original,t)!==void 0||t in e.original?(_e(e),Ie(e),e.assignedMap.set(t,!1)):(e.assignedMap=(n=e.assignedMap)!==null&&n!==void 0?n:new Map,e.assignedMap.delete(t)),e.copy&&delete e.copy[t],!0)}};function Ht(e){const{original:t,parentDraft:n,key:r,finalities:i,options:s}=e,l=Ue(t),o={type:l,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:i,options:s,setMap:l===3?new Map(t.entries()):void 0};(r||"key"in e)&&(o.key=r);const{proxy:u,revoke:d}=Proxy.revocable(l===1?Object.assign([],o):o,Dn);if(i.revoke.push(d),o.proxy=u,n){const _=n;_.finalities.draft.push((g,w)=>{var p,S;const f=le(u);let b=_.type===3?_.setMap:_.copy;const m=Te(b,r),h=le(m);if(h){let y=h.original;h.operated&&(y=Ft(m)),It(h),At(h,Qe,g,w),_.options.enableAutoFreeze&&(_.options.updatedValues=(p=_.options.updatedValues)!==null&&p!==void 0?p:new WeakMap,_.options.updatedValues.set(y,h.original)),nt(b,r,y)}(S=f.callbacks)===null||S===void 0||S.forEach(y=>{y(g,w)})})}else{const _=le(u);_.finalities.draft.push((g,w)=>{It(_),At(_,Qe,g,w)})}return u}Ut.createDraft=Ht;function eo(e,t,n,r,i){var s;const l=le(e),o=(s=l?.original)!==null&&s!==void 0?s:e,u=!!t.length;if(l?.operated)for(;l.finalities.draft.length>0;)l.finalities.draft.pop()(n,r);const d=u?t[0]:l?l.operated?l.copy:l.original:e;return l&&xt(l),i&&Fe(d,d,l?.options.updatedValues),[d,n&&u?[{op:me.Replace,path:[],value:t[0]}]:n,r&&u?[{op:me.Replace,path:[],value:o}]:r]}function to(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet,draftsCache:new WeakSet};let i,s;t.enablePatches&&(i=[],s=[]);const o=((n=t.mark)===null||n===void 0?void 0:n.call(t,e,Se))===Se.mutable||!we(e,t)?e:Ht({original:e,parentDraft:null,finalities:r,options:t});return[o,(u=[])=>{const[d,_,g]=eo(o,u,i,s,t.enableAutoFreeze);return t.enablePatches?[d,_,g]:d}]}function Tt(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:i=!0}=e;$t(n,(s,l,o)=>{const u=le(l);if(u&&t&&u.finalities===t.finalities){e.isContainDraft=!0;const d=u.original;if(o instanceof Set){const _=Array.from(o);o.clear(),_.forEach(g=>o.add(s===g?d:g))}else nt(o,s,d)}else typeof l=="object"&&l!==null&&(e.value=l,e.isRoot=!1,Tt(e))}),i&&(e.isContainDraft||console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."),r&&console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."))}function Cn(e){var t;const n=le(e);if(!we(e,n?.options))return e;const r=Ue(e);if(n&&!n.operated)return n.original;let i;function s(){i=r===2?Bt(e)?new Map(e):new(Object.getPrototypeOf(e)).constructor(e):r===3?Array.from(n.setMap.values()):kn(e,n?.options)}if(n){n.finalized=!0;try{s()}finally{n.finalized=!1}}else i=e;if($t(i,(l,o)=>{if(n&&ke(Te(n.original,l),o))return;const u=Cn(o);u!==o&&(i===e&&s(),nt(i,l,u))}),r===3){const l=(t=n?.original)!==null&&t!==void 0?t:i;return jt(l)?new Set(i):new(Object.getPrototypeOf(l)).constructor(i)}return i}function on(e){if(!Me(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return Cn(e)}const no=e=>function t(n,r,i){var s,l,o;if(typeof n=="function"&&typeof r!="function")return function(v,...D){return t(v,T=>n.call(this,T,...D),r)};const u=n,d=r;let _=i;if(typeof r!="function"&&(_=r),_!==void 0&&Object.prototype.toString.call(_)!=="[object Object]")throw new Error(`Invalid options: ${_}, 'options' should be an object.`);_=Object.assign(Object.assign({},e),_);const g=Me(u)?on(u):u,w=Array.isArray(_.mark)?((v,D)=>{for(const T of _.mark){if(typeof T!="function")throw new Error(`Invalid mark: ${T}, 'mark' should be a function.`);const F=T(v,D);if(F)return F}}):_.mark,p=(s=_.enablePatches)!==null&&s!==void 0?s:!1,S=(l=_.strict)!==null&&l!==void 0?l:!1,b={enableAutoFreeze:(o=_.enableAutoFreeze)!==null&&o!==void 0?o:!1,mark:w,strict:S,enablePatches:p};if(!we(g,b)&&typeof g=="object"&&g!==null)throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");const[m,h]=to(g,b);if(typeof r!="function"){if(!we(g,b))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[m,h]}let y;try{y=d(m)}catch(v){throw xt(le(m)),v}const I=v=>{const D=le(m);if(!Me(v)){if(v!==void 0&&!ke(v,m)&&D?.operated)throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");const F=v?.[Wi];if(F){const C=F[0];return b.strict&&typeof v=="object"&&v!==null&&Tt({rootDraft:D,value:v,useRawReturn:!0}),h([C])}if(v!==void 0)return typeof v=="object"&&v!==null&&Tt({rootDraft:D,value:v}),h([v])}if(v===m||v===void 0)return h([]);const T=le(v);if(b===T.options){if(T.operated)throw new Error("Cannot return a modified child draft.");return h([on(v)])}return h([v])};return y instanceof Promise?y.then(I,v=>{throw xt(le(m)),v}):I(y)},Et=no();Object.prototype.constructor.toString();function ro(e,t){return{...e,header:{...e.header,name:t}}}function io(e,t,n){const{scope:r}=t;return Et({document:e,action:t,skip:n,reuseLastOperationIndex:!1},s=>{const l=[...e.operations[r]],o=Ce(l);s.action=Nt(r);const u=o.at(-1);let d=u?.index??-1;const _=u?.action.type!=="NOOP";_?d=d+1:s.reuseLastOperationIndex=!0;const g=_?[...o,{index:d,skip:0}]:o;if(s.skip=Ri(g),u&&s.skip>u.skip+1&&(s.skip=s.skip+1),s.skip<0)throw new Error("Cannot undo: you can't undo more operations than the ones in the scope history")})}function oo(e,t,n){const{scope:r}=t;return Et({document:e,action:t,skip:n,reuseLastOperationIndex:!1},s=>{const l=e.operations[r]||[],o=Ce([...l]),u=o.filter(_=>_.action.type!=="NOOP");let d=0;for(let _=o.length-1;_>=0&&o[_].action.type==="NOOP";_--)d++;if(u.length<=d)throw new Error("Cannot undo: no more operations to undo in scope history");s.action=Nt(r),s.skip=1})}function so(e,t,n){const{scope:r,input:i}=t;return Et({document:e,action:t,skip:n,reuseLastOperationIndex:!1},l=>{if(l.skip>0)throw new Error("Cannot redo: skip value from reducer cannot be used with REDO action");if(typeof i!="number"||i>1)throw new Error("Cannot redo: you can only redo one operation at a time");if(typeof i!="number"||i<1)throw new Error("Invalid REDO action: invalid redo input value");if(l.document.clipboard.length<1)throw new Error("Cannot redo: no operations in the clipboard");const o=l.document.clipboard.findLastIndex(d=>d.action.scope===r);if(o<0)throw new Error(`Cannot redo: no operations in clipboard for scope "${r}"`);const u=l.document.clipboard.splice(o,1)[0];l.action={type:u.action.type,scope:u.action.scope,input:u.action.input}})}function ao(e,t){return{...e,header:{...e.header,name:t.state.name},state:t.state.data}}function et(e,t,n,r,i,s=Zt,l={},o){const u=Mn(n,s);return wn(e,t,u,r,i,l,o)}function lo(e,t,n,r,i){if(["UNDO","REDO","PRUNE"].includes(t.type))return e;const s=t.scope;let l=[];e.operations[s]&&(l=e.operations[s].slice());const u=l.sort((g,w)=>g.index-w.index).at(-1)?.index??-1,d=n?u:u+1,_=bi(t,d,r,i);return l.push(_),{...e,operations:{...e.operations,[s]:l}}}function uo(e,t,n,r,i,s){const l=t.action.scope,o=e.operations[l],u=o?o.slice():[],_=u.sort((p,S)=>p.index-S.index).at(-1)?.index??-1,g=n?_:_+1;if(!s&&t.index-r>g)throw new Error(`Missing operations: expected ${g} with skip 0 or equivalent, got index ${t.index} with skip ${r}`);const w=Ei(t,t.index,r,i);return u.push(w),{...e,operations:{...e.operations,[l]:u}}}function co(e,t,n,r,i,s,l){let o;return s?o=uo(e,s,n,r,i,l):o=lo(e,t,n,r,i),o=vn(o,t.scope,t.timestampUtcMs),o}function po(e,t,n){const r=ai().parse(t);switch(r.type){case"SET_NAME":return ro(e,r.input);case"PRUNE":return go(e,r.input,n);case"LOAD_STATE":return ao(e,r.input);default:return e}}function fo(e,t,n,r=1){switch(t.type){case"UNDO":return r>=2?oo(e,t,n):io(e,t,n);case"REDO":return so(e,t,n);default:return{document:e,action:t,skip:n,reuseLastOperationIndex:!1}}}function ho(e,t,n,r,i=!1,s=zt){const l=t.scope,o=e.operations[l];if(!o)return e;const u=o.at(-1);if(!u)return e;const d=ht({...e.operations,[l]:ki(o,u)});let _;const w=d[l]?.at(-1);if(i&&w?.resultingState)_=s(w.resultingState);else{const{state:p}=et(e.initialState,d,n,e.header,void 0,void 0,void 0,{reuseOperationResultingState:i,operationResultingStateParser:s});_=p[l]}return{...e,state:{...e.state,[l]:_},operations:ht({...e.operations})}}function mo(e,t,n,r=!1,i=zt){const s=e.operations[t];if(!s)return e;const l=[...s],o=Ce(l);o.pop();const u=ht({...e.operations}),d=u[t];if(!d)return e;const _=[...d],g=Di(bt(o),_),w=et(e.initialState,u,n,e.header,void 0,void 0,void 0,{reuseOperationResultingState:r,operationResultingStateParser:i}),p=Ce([...e.clipboard,...g].filter(S=>S.action.type!=="NOOP")).reverse();return{...w,clipboard:p}}function Zt(e,t,n,r,i={}){const{skip:s,ignoreSkipOperations:l=!1,reuseOperationResultingState:o=!1,operationResultingStateParser:u,pruneOnSkip:d=!0,branch:_="main"}=i;let g=_i(t),w=s??i.replayOptions?.operation.skip??0,p={...e},S=!1;const f=!l&&w>0;if(vi(g)){const{skip:T,action:F,document:C,reuseLastOperationIndex:V}=fo(e,g,w,i.protocolVersion??1);g=F,w=T,p=C,S=V}else p={...p,clipboard:[]};On(g)&&(p=po(p,g,n));const b={documentId:e.header.id,scope:g.scope,branch:_};p=co(p,g,S,w,b,i.replayOptions?.operation,i.skipIndexValidation);const m=i.protocolVersion??1;if(qt(t)&&m<2)return mo(p,t.scope,n);const h=g.type==="NOOP"&&w>0;if((qt(t)||h)&&m>=2){const T=g.scope,F=p.operations[T]||[],C=Ce([...F]),te=Ii(C).filter(c=>c.action.type!=="NOOP"),x={...p.operations,[T]:te};return{...et(p.initialState,x,n,p.header,r,Zt,{},{skipIndexValidation:!0}),operations:p.operations,clipboard:[]}}if(f){const T=ho(p,g,n,w,o,u);d?p=T:p={...T,operations:p.operations}}if(p=Et(p,T=>{try{const F=n(T.state,g,r);F&&qi(()=>{T.state=F})}catch(F){const C=p.operations[g.scope];if(!C)throw new Error(`No operations found for scope: ${g.scope}`);const V=C.length-1,te=T.operations[g.scope];if(!te)throw new Error(`No operations found in draft for scope: ${g.scope}`);if(te[V].error=F.message,te[V].skip=0,f){T.state={...e.state};const x=e.operations[g.scope];if(!x)throw new Error(`No operations found for scope: ${g.scope}`);T.operations={...e.operations,[g.scope]:[...x,{...te[V]}]}}}}),["UNDO","REDO","PRUNE"].includes(g.type))return p;const y=g.scope||"global";let I=Pt(p,y);i.replayOptions?.operation.hash&&i.replayOptions.operation.hash!==""&&(I=i.replayOptions.operation.hash);const D=p.operations[y]?.at(-1);return D&&(D.hash=I,o&&(D.resultingState=JSON.stringify(p.state[y]))),p}function Mn(e,t=Zt){return(r,i,s,l)=>t(r,i,e,s,l)}function go(e,t,n){const r=e.operations.global;if(!r)throw new Error("No global operations found");let{start:i,end:s}=t;i=i||0,s=s||r.length;const l=r.slice(i,s),o=r.slice(0,i),u=r.slice(s),d=et(e.initialState,{...e.operations,global:o.concat(l)},n,e.header),_=d.state,g=d.header.name,w=o.length,p=o.length?o[o.length-1].timestampUtcMs:u.length?u[0].timestampUtcMs:new Date().toISOString(),S=yn({name:g,..._},l.length);return et(e.initialState,{...e.operations,global:[...o,{skip:0,...S,action:S,timestampUtcMs:p,index:w,hash:Pt({state:_},"global")},...u.map((f,b)=>({...f,index:w+b+1}))]},n,e.header)}const _o="sha1",bo="base64";function Nn(){return{}}function Pn(){return{version:0,hash:{algorithm:_o,encoding:bo}}}function Vt(){return{auth:Nn(),document:Pn()}}function Eo(e){return{...Nn(),...e}}function So(e){return{...Pn(),...e}}function yo(e,t){return{auth:Eo(e),document:So(t)}}function zn(){return ee({__typename:be("AddChangeLogItemInput").optional(),content:L(),id:L(),insertBefore:L().nullable()})}function Ln(){return ee({description:L().nullish(),id:L(),name:L()})}function Un(){return ee({errorCode:L().nullish(),errorDescription:L().nullish(),errorName:L().nullish(),errorTemplate:L().nullish(),id:L(),operationId:L()})}function Oo(){return ee({example:L(),id:L(),operationId:L()})}function jn(){return ee({description:L().nullish(),id:L(),moduleId:L(),name:L(),reducer:L().nullish(),schema:L().nullish(),template:L().nullish(),scope:Le().nullish()})}function Bn(){return ee({scope:L(),example:L(),id:L(),insertBefore:L().nullish()})}function wo(){return ee({__typename:be("Author").optional(),name:L(),website:L().nullable()})}function Fn(){return ee({__typename:be("CodeExample").optional(),id:L(),value:L()})}function $n(){return ee({__typename:be("DeleteChangeLogItemInput").optional(),id:L()})}function Wn(){return ee({id:L()})}function Hn(){return ee({id:L()})}function vo(){return ee({id:L()})}function Zn(){return ee({id:L()})}function Vn(){return ee({scope:L(),id:L()})}function xo(){return ee({__typename:be("DocumentModelGlobalState").optional(),author:wo(),description:L(),extension:L(),id:L(),name:L(),specifications:ye(Io())})}function Io(){return ee({__typename:be("DocumentSpecification").optional(),changeLog:ye(L()),modules:ye(Ao()),state:Do(),version:$e().int()})}function Ao(){return ee({__typename:be("ModuleSpecification").optional(),description:L().nullable(),id:L(),name:L(),operations:ye(Ro())})}function Gn(){return ee({newModuleId:L(),operationId:L()})}function Ro(){return ee({__typename:be("OperationSpecification").optional(),description:L().nullable(),errors:ye(ko()),examples:ye(Fn()),id:L(),name:L().nullable(),reducer:L().nullable(),schema:L().nullable(),template:L().nullable(),scope:Le()})}function ko(){return ee({__typename:be("OperationErrorSpecification").optional(),code:L().nullable(),description:L().nullable(),id:L(),name:L().nullable(),template:L().nullable()})}function Xn(){return ee({__typename:be("ReorderChangeLogItemsInput").optional(),order:ye(L())})}function Kn(){return ee({moduleId:L(),order:ye(L())})}function Jn(){return ee({order:ye(L())})}function qn(){return ee({operationId:L(),order:ye(L())})}function To(){return ee({operationId:L(),order:ye(L())})}function Yn(){return ee({scope:L(),order:ye(L())})}function Qn(){return ee({authorName:L()})}function er(){return ee({authorWebsite:L()})}function tr(){return ee({scope:L(),initialValue:L()})}function nr(){return ee({description:L()})}function rr(){return ee({extension:L()})}function ir(){return ee({id:L()})}function or(){return ee({name:L()})}function sr(){return ee({description:L().nullish(),id:L()})}function ar(){return ee({id:L(),name:L().nullish()})}function lr(){return ee({description:L().nullish(),id:L()})}function ur(){return ee({errorCode:L().nullish(),id:L()})}function cr(){return ee({errorDescription:L().nullish(),id:L()})}function pr(){return ee({errorName:L().nullish(),id:L()})}function dr(){return ee({errorTemplate:L().nullish(),id:L()})}function fr(){return ee({id:L(),name:L().nullish()})}function hr(){return ee({id:L(),scope:Le()})}function mr(){return ee({id:L(),reducer:L().nullish()})}function gr(){return ee({id:L(),schema:L().nullish()})}function _r(){return ee({id:L(),template:L().nullish()})}function br(){return ee({scope:L(),schema:L()})}function sn(){return ee({__typename:be("State").optional(),examples:ye(Fn()),initialValue:L(),schema:L()})}function Do(){return ee({global:sn(),local:sn()})}function Er(){return ee({__typename:be("UpdateChangeLogItemInput").optional(),id:L(),newContent:L()})}function Co(){return ee({example:L(),id:L()})}function Sr(){return ee({scope:L(),id:L(),newExample:L()})}const Mo=e=>oe("SET_NAME",e,void 0,_n,"global"),No=e=>oe("SET_MODEL_NAME",{...e},void 0,or,"global"),Po=e=>oe("SET_MODEL_ID",{...e},void 0,ir,"global"),zo=e=>oe("SET_MODEL_EXTENSION",{...e},void 0,rr,"global"),Lo=e=>oe("SET_MODEL_DESCRIPTION",{...e},void 0,nr,"global"),Uo=e=>oe("SET_AUTHOR_NAME",{...e},void 0,Qn,"global"),jo=e=>oe("SET_AUTHOR_WEBSITE",{...e},void 0,er,"global"),Bo=e=>oe("ADD_MODULE",{...e},void 0,Ln,"global"),Fo=e=>oe("SET_MODULE_NAME",{...e},void 0,ar,"global"),$o=e=>oe("SET_MODULE_DESCRIPTION",{...e},void 0,sr,"global"),Wo=e=>oe("DELETE_MODULE",{...e},void 0,Wn,"global"),Ho=e=>oe("REORDER_MODULES",{...e},void 0,Jn,"global"),Zo=e=>oe("ADD_OPERATION",{...e},void 0,jn,"global"),Vo=e=>oe("SET_OPERATION_NAME",{...e},void 0,fr,"global"),Go=e=>oe("SET_OPERATION_SCOPE",{...e},void 0,hr,"global"),Xo=e=>oe("SET_OPERATION_SCHEMA",{...e},void 0,gr,"global"),Ko=e=>oe("SET_OPERATION_DESCRIPTION",{...e},void 0,lr,"global"),Jo=e=>oe("SET_OPERATION_TEMPLATE",{...e},void 0,_r,"global"),qo=e=>oe("SET_OPERATION_REDUCER",{...e},void 0,mr,"global"),Yo=e=>oe("MOVE_OPERATION",{...e},void 0,Gn,"global"),Qo=e=>oe("DELETE_OPERATION",{...e},void 0,Zn,"global"),es=e=>oe("REORDER_MODULE_OPERATIONS",{...e},void 0,Kn,"global"),ts=e=>oe("ADD_OPERATION_ERROR",{...e},void 0,Un,"global"),ns=e=>oe("SET_OPERATION_ERROR_CODE",{...e},void 0,ur,"global"),rs=e=>oe("SET_OPERATION_ERROR_NAME",{...e},void 0,pr,"global"),is=e=>oe("SET_OPERATION_ERROR_DESCRIPTION",{...e},void 0,cr,"global"),os=e=>oe("SET_OPERATION_ERROR_TEMPLATE",{...e},void 0,dr,"global"),ss=e=>oe("DELETE_OPERATION_ERROR",{...e},void 0,Hn,"global"),as=e=>oe("REORDER_OPERATION_ERRORS",{...e},void 0,qn,"global"),ls=e=>oe("SET_STATE_SCHEMA",{...e},void 0,br,"global"),us=e=>oe("SET_INITIAL_STATE",{...e},void 0,tr,"global"),cs=e=>oe("ADD_STATE_EXAMPLE",{...e},void 0,Bn,"global"),ps=e=>oe("UPDATE_STATE_EXAMPLE",{...e},void 0,Sr,"global"),ds=e=>oe("DELETE_STATE_EXAMPLE",{...e},void 0,Vn,"global"),fs=e=>oe("REORDER_STATE_EXAMPLES",{...e},void 0,Yn,"global"),hs=e=>oe("ADD_CHANGE_LOG_ITEM",{...e},void 0,zn,"global"),ms=e=>oe("UPDATE_CHANGE_LOG_ITEM",{...e},void 0,Er,"global"),gs=e=>oe("DELETE_CHANGE_LOG_ITEM",{...e},void 0,$n,"global"),_s=e=>oe("REORDER_CHANGE_LOG_ITEMS",{...e},void 0,Xn,"global"),bs=()=>oe("RELEASE_NEW_VERSION",{},void 0,void 0,"global"),Es={setName:Mo,undo:hi,redo:mi,prune:gi,loadState:yn,noop:Nt},Ss={setModelName:No,setModelId:Po,setModelExtension:zo,setModelDescription:Lo,setAuthorName:Uo,setAuthorWebsite:jo,addModule:Bo,setModuleName:Fo,setModuleDescription:$o,deleteModule:Wo,reorderModules:Ho,addOperation:Zo,setOperationName:Vo,setOperationScope:Go,setOperationSchema:Xo,setOperationDescription:Ko,setOperationTemplate:Jo,setOperationReducer:qo,moveOperation:Yo,deleteOperation:Qo,reorderModuleOperations:es,addOperationError:ts,setOperationErrorCode:ns,setOperationErrorName:rs,setOperationErrorDescription:is,setOperationErrorTemplate:os,deleteOperationError:ss,reorderOperationErrors:as,setStateSchema:ls,setInitialState:us,addStateExample:cs,updateStateExample:ps,deleteStateExample:ds,reorderStateExamples:fs,addChangeLogItem:hs,updateChangeLogItem:ms,deleteChangeLogItem:gs,reorderChangeLogItems:_s,releaseNewVersion:bs},ys={...Es,...Ss},Os="phdm",ws={},vs={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},xs={id:"powerhouse/document-model",name:"DocumentModel",extension:"phdm",description:"The Powerhouse Document Model describes the state and operations of a document type.",author:{name:"Powerhouse",website:"https://www.powerhouse.inc/"},specifications:[{version:1,changeLog:[],state:{global:{schema:`type CodeExample {
|
|
23
23
|
id: ID!
|
|
24
24
|
value: String!
|
|
25
25
|
}
|
|
@@ -238,4 +238,4 @@ type DocumentModelGlobalState {
|
|
|
238
238
|
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"REORDER_STATE_EXAMPLES",id:"",description:"Changes the order of state examples for a document scope",schema:`input ReorderStateExamplesInput {
|
|
239
239
|
scope: String!
|
|
240
240
|
order: [ID!]!
|
|
241
|
-
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""}]}]},yr="powerhouse/document-model",Is=ee({id:L(),name:L(),createdAtUtcIso:L(),lastModifiedAtUtcIso:L(),documentType:L()}),As=ee({global:pn()}),Rs=Is.extend({documentType:be(yr)}),_t=As.extend({global:xo()}),Or=ee({header:Rs,state:_t,initialState:_t});function ks(e){return _t.safeParse(e).success}function Ts(e){_t.parse(e)}function Ds(e){return Or.safeParse(e).success}function Cs(e){Or.parse(e)}const Ms=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),Ns=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),Ps=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),zs=/[^\p{L}\d]+/giu,an="$1\0$2",ln="";function wr(e){let t=e.trim();t=t.replace(Ms,an).replace(Ns,an),t=t.replace(zs,"\0");let n=0,r=t.length;for(;t.charAt(n)==="\0";)n++;if(n===r)return[];for(;t.charAt(r-1)==="\0";)r--;return t.slice(n,r).split(/\0/g)}function Ls(e){const t=wr(e);for(let n=0;n<t.length;n++){const r=t[n],i=Ps.exec(r);if(i){const s=i.index+(i[1]??i[2]).length;t.splice(n,1,r.slice(0,s),r.slice(s))}}return t}function Us(e,t){const[n,r,i]=rt(e,t);return n+r.map(St(t?.locale)).join(t?.delimiter??" ")+i}function un(e,t){const[n,r,i]=rt(e,t),s=St(t?.locale),l=yt(t?.locale),o=t?.mergeAmbiguousCharacters?Gt(s,l):js(s,l);return n+r.map(o).join(t?.delimiter??"")+i}function ca(e,t){const[n,r,i]=rt(e,t),s=St(t?.locale),l=yt(t?.locale);return n+r.map(Gt(s,l)).join(" ")+i}function pa(e,t){const[n,r,i]=rt(e,t);return n+r.map(yt(t?.locale)).join("_")+i}function da(e,t){const[n,r,i]=rt(e,t),s=St(t?.locale),l=yt(t?.locale),o=Gt(s,l);return n+r.map((u,d)=>d===0?o(u):s(u)).join(" ")+i}function fa(e,t){return Us(e,{delimiter:"_",...t})}function St(e){return e===!1?t=>t.toLowerCase():t=>t.toLocaleLowerCase(e)}function yt(e){return e===!1?t=>t.toUpperCase():t=>t.toLocaleUpperCase(e)}function Gt(e,t){return n=>`${t(n[0])}${e(n.slice(1))}`}function js(e,t){return(n,r)=>{const i=n[0];return(r>0&&i>="0"&&i<="9"?"_"+i:t(i))+e(n.slice(1))}}function rt(e,t={}){const n=t.split??(t.separateNumbers?Ls:wr),r=t.prefixCharacters??ln,i=t.suffixCharacters??ln;let s=0,l=e.length;for(;s<e.length;){const o=e.charAt(s);if(!r.includes(o))break;s++}for(;l>s;){const o=l-1,u=e.charAt(o);if(!i.includes(u))break;l=o}return[e.slice(0,s),n(e.slice(s,l)),e.slice(l)]}const Bs=["UNDO","REDO","PRUNE","LOAD_STATE","SET_NAME","NOOP"];function Fs(e){return Bs.includes(e.toUpperCase())}function $s(e,t){const n=e.specifications[e.specifications.length-1];if(!n)return[];const r=[];for(const i of n.modules)for(const s of i.operations)t&&s.id===t||s.name&&r.push(s.name.toUpperCase());return r}function cn(e,t,n){if(!e)return;const r=e.toUpperCase();if(Fs(e))throw new Error(`Operation name "${e}" is reserved. Please use a different name.`);if($s(t,n).includes(r))throw new Error(`Operation name "${e}" is already used by another operation. Operation names must be unique across all modules.`)}function ha(e,t=!1){const n=[];if(t&&e==="")return n;try{const r=JSON.parse(e);!t&&!Object.keys(r).length&&n.push({message:"Initial state cannot be empty",details:{initialState:e}})}catch{n.push({message:"Invalid initial state",details:{initialState:e}})}return n}function ma(e,t,n="",r=!0){const i=[];if(!r&&!e)return i.push({message:"State schema is required",details:{schema:e}}),i;if(r&&!e)return i;const s=`${un(t)}${un(n)}State`;return new RegExp(`\\btype\\s+${s}(?:\\s|\\{|@|$)`).test(e)||i.push({message:`Invalid state schema name. Expected type ${s}`,details:{schema:e}}),i}function ga(e){const t=[];e.length||t.push({message:"Modules are required",details:{modules:e}});const n=e.reduce((r,i)=>[...r,...Ws(i)],[]);return[...t,...n]}function Ws(e){const t=[];e.name||t.push({message:"Module name is required",details:{module:e}}),e.operations.length||t.push({message:"Module operations are required",details:{module:e}});const n=e.operations.reduce((r,i)=>[...r,...Hs(i)],[]);return[...t,...n]}function Hs(e){const t=[];return e.name||t.push({message:"Operation name is required",details:{operation:e}}),e.schema||t.push({message:"Operation schema is required",details:{operation:e}}),t}function it(e){const t={};return e.forEach((n,r)=>t[n]=r),(n,r)=>(t[r.id]||999999)-(t[n.id]||999999)}const je={setModelNameOperation(e,t){e.name=t.input.name},setModelIdOperation(e,t){e.id=t.input.id},setModelExtensionOperation(e,t){e.extension=t.input.extension},setModelDescriptionOperation(e,t){e.description=t.input.description},setAuthorNameOperation(e,t){e.author=e.author||{name:"",website:null},e.author.name=t.input.authorName},setAuthorWebsiteOperation(e,t){e.author=e.author||{name:"",website:null},e.author.website=t.input.authorWebsite}},Ke={addModuleOperation(e,t){e.specifications[e.specifications.length-1].modules.push({id:t.input.id,name:t.input.name,description:t.input.description||"",operations:[]})},setModuleNameOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].id===t.input.id&&(n.modules[r].name=t.input.name||"")},setModuleDescriptionOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].id===t.input.id&&(n.modules[r].description=t.input.description||"")},deleteModuleOperation(e,t){const n=e.specifications[e.specifications.length-1];n.modules=n.modules.filter(r=>r.id!=t.input.id)},reorderModulesOperation(e,t){e.specifications[e.specifications.length-1].modules.sort(it(t.input.order))}},Pe={addOperationErrorOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.operationId&&n.modules[r].operations[i].errors.push({id:t.input.id,name:t.input.errorName||"",code:t.input.errorCode||"",description:t.input.errorDescription||"",template:t.input.errorTemplate||""})},setOperationErrorCodeOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].errors.length;s++)n.modules[r].operations[i].errors[s].id==t.input.id&&(n.modules[r].operations[i].errors[s].code=t.input.errorCode||"")},setOperationErrorNameOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].errors.length;s++)n.modules[r].operations[i].errors[s].id==t.input.id&&(n.modules[r].operations[i].errors[s].name=t.input.errorName||"")},setOperationErrorDescriptionOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].errors.length;s++)n.modules[r].operations[i].errors[s].id==t.input.id&&(n.modules[r].operations[i].errors[s].description=t.input.errorDescription||"")},setOperationErrorTemplateOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].errors.length;s++)n.modules[r].operations[i].errors[s].id==t.input.id&&(n.modules[r].operations[i].errors[s].template=t.input.errorTemplate||"")},deleteOperationErrorOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].errors=n.modules[r].operations[i].errors.filter(s=>s.id!=t.input.id)},reorderOperationErrorsOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.operationId&&n.modules[r].operations[i].errors.sort(it(t.input.order))}},pt={addOperationExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.operationId&&n.modules[r].operations[i].examples.push({id:t.input.id,value:t.input.example})},updateOperationExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].examples.length;s++)n.modules[r].operations[i].examples[s].id==t.input.id&&(n.modules[r].operations[i].examples[s].value=t.input.example)},deleteOperationExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].examples=n.modules[r].operations[i].examples.filter(s=>s.id!=t.input.id)},reorderOperationExamplesOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.operationId&&n.modules[r].operations[i].examples.sort(it(t.input.order))}},xe={addOperationOperation(e,t){cn(t.input.name,e);const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].id==t.input.moduleId&&n.modules[r].operations.push({id:t.input.id,name:t.input.name,description:t.input.description||"",schema:t.input.schema||"",template:t.input.template||t.input.description||"",reducer:t.input.reducer||"",errors:[],examples:[],scope:t.input.scope||"global"})},setOperationNameOperation(e,t){t.input.name&&cn(t.input.name,e,t.input.id);const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].name=t.input.name||"")},setOperationScopeOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].scope=t.input.scope||"global")},setOperationSchemaOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].schema=t.input.schema||"")},setOperationDescriptionOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].description=t.input.description||"")},setOperationTemplateOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].template=t.input.template||"")},setOperationReducerOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].reducer=t.input.reducer||"")},moveOperationOperation(e,t){const n=[],r=e.specifications[e.specifications.length-1];for(let i=0;i<r.modules.length;i++)r.modules[i].operations=r.modules[i].operations.filter(s=>s.id==t.input.operationId?(n.push(s),!1):!0);for(let i=0;i<r.modules.length;i++)r.modules[i].id==t.input.newModuleId&&r.modules[i].operations.push(...n)},deleteOperationOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].operations=n.modules[r].operations.filter(i=>i.id!=t.input.id)},reorderModuleOperationsOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].id==t.input.moduleId&&n.modules[r].operations.sort(it(t.input.order))}},Be={setStateSchemaOperation(e,t){const n=e.specifications[e.specifications.length-1];if(Object.keys(n.state).includes(t.input.scope))n.state[t.input.scope].schema=t.input.schema;else throw new Error(`Invalid scope: ${t.input.scope}`)},setInitialStateOperation(e,t){const n=e.specifications[e.specifications.length-1];if(Object.keys(n.state).includes(t.input.scope))n.state[t.input.scope].initialValue=t.input.initialValue;else throw new Error(`Invalid scope: ${t.input.scope}`)},addStateExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];if(Object.keys(n.state).includes(t.input.scope))n.state[t.input.scope].examples.push({id:t.input.id,value:t.input.example});else throw new Error(`Invalid scope: ${t.input.scope}`)},updateStateExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];if(!Object.keys(n.state).includes(t.input.scope))throw new Error(`Invalid scope: ${t.input.scope}`);const r=n.state[t.input.scope].examples;for(let i=0;i<r.length;i++)r[i].id==t.input.id&&(r[i].value=t.input.newExample)},deleteStateExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];if(Object.keys(n.state).includes(t.input.scope))n.state[t.input.scope].examples=n.state[t.input.scope].examples.filter(r=>r.id!=t.input.id);else throw new Error(`Invalid scope: ${t.input.scope}`)},reorderStateExamplesOperation(e,t){const n=e.specifications[e.specifications.length-1];if(Object.keys(n.state).includes(t.input.scope))n.state[t.input.scope].examples.sort(it(t.input.order));else throw new Error(`Invalid scope: ${t.input.scope}`)}},Je={addChangeLogItemOperation(e,t){throw new Error('Reducer "addChangeLogItemOperation" not yet implemented')},updateChangeLogItemOperation(e,t){throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented')},deleteChangeLogItemOperation(e,t){throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented')},reorderChangeLogItemsOperation(e,t){throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented')},releaseNewVersionOperation(e,t){const n=e.specifications[e.specifications.length-1],r=n.modules.map(l=>({...l,operations:l.operations.map(o=>({...o,errors:o.errors.map(u=>({...u})),examples:o.examples.map(u=>({...u}))}))})),i={global:{...n.state.global,examples:n.state.global.examples.map(l=>({...l}))},local:{...n.state.local,examples:n.state.local.examples.map(l=>({...l}))}},s={version:n.version+1,changeLog:[],state:i,modules:r};e.specifications.push(s)}},Zs=(e,t)=>{if(On(t))return e;switch(t.type){case"SET_MODEL_NAME":or().parse(t.input),je.setModelNameOperation(e.global,t);break;case"SET_MODEL_ID":ir().parse(t.input),je.setModelIdOperation(e.global,t);break;case"SET_MODEL_EXTENSION":rr().parse(t.input),je.setModelExtensionOperation(e.global,t);break;case"SET_MODEL_DESCRIPTION":nr().parse(t.input),je.setModelDescriptionOperation(e.global,t);break;case"SET_AUTHOR_NAME":Qn().parse(t.input),je.setAuthorNameOperation(e.global,t);break;case"SET_AUTHOR_WEBSITE":er().parse(t.input),je.setAuthorWebsiteOperation(e.global,t);break;case"ADD_CHANGE_LOG_ITEM":zn().parse(t.input),Je.addChangeLogItemOperation(e.global,t);break;case"UPDATE_CHANGE_LOG_ITEM":Er().parse(t.input),Je.updateChangeLogItemOperation(e.global,t);break;case"DELETE_CHANGE_LOG_ITEM":$n().parse(t.input),Je.deleteChangeLogItemOperation(e.global,t);break;case"REORDER_CHANGE_LOG_ITEMS":Xn().parse(t.input),Je.reorderChangeLogItemsOperation(e.global,t);break;case"RELEASE_NEW_VERSION":if(Object.keys(t.input).length>0)throw new Error("Expected empty input for action RELEASE_NEW_VERSION");Je.releaseNewVersionOperation(e.global,t);break;case"ADD_MODULE":Ln().parse(t.input),Ke.addModuleOperation(e.global,t);break;case"SET_MODULE_NAME":ar().parse(t.input),Ke.setModuleNameOperation(e.global,t);break;case"SET_MODULE_DESCRIPTION":sr().parse(t.input),Ke.setModuleDescriptionOperation(e.global,t);break;case"DELETE_MODULE":Wn().parse(t.input),Ke.deleteModuleOperation(e.global,t);break;case"REORDER_MODULES":Jn().parse(t.input),Ke.reorderModulesOperation(e.global,t);break;case"ADD_OPERATION_ERROR":Un().parse(t.input),Pe.addOperationErrorOperation(e.global,t);break;case"SET_OPERATION_ERROR_CODE":ur().parse(t.input),Pe.setOperationErrorCodeOperation(e.global,t);break;case"SET_OPERATION_ERROR_NAME":pr().parse(t.input),Pe.setOperationErrorNameOperation(e.global,t);break;case"SET_OPERATION_ERROR_DESCRIPTION":cr().parse(t.input),Pe.setOperationErrorDescriptionOperation(e.global,t);break;case"SET_OPERATION_ERROR_TEMPLATE":dr().parse(t.input),Pe.setOperationErrorTemplateOperation(e.global,t);break;case"DELETE_OPERATION_ERROR":Hn().parse(t.input),Pe.deleteOperationErrorOperation(e.global,t);break;case"REORDER_OPERATION_ERRORS":qn().parse(t.input),Pe.reorderOperationErrorsOperation(e.global,t);break;case"ADD_OPERATION_EXAMPLE":Oo().parse(t.input),pt.addOperationExampleOperation(e.global,t);break;case"UPDATE_OPERATION_EXAMPLE":Co().parse(t.input),pt.updateOperationExampleOperation(e.global,t);break;case"DELETE_OPERATION_EXAMPLE":vo().parse(t.input),pt.deleteOperationExampleOperation(e.global,t);break;case"REORDER_OPERATION_EXAMPLES":To().parse(t.input),pt.reorderOperationExamplesOperation(e.global,t);break;case"ADD_OPERATION":jn().parse(t.input),xe.addOperationOperation(e.global,t);break;case"SET_OPERATION_NAME":fr().parse(t.input),xe.setOperationNameOperation(e.global,t);break;case"SET_OPERATION_SCOPE":hr().parse(t.input),xe.setOperationScopeOperation(e.global,t);break;case"SET_OPERATION_SCHEMA":gr().parse(t.input),xe.setOperationSchemaOperation(e.global,t);break;case"SET_OPERATION_DESCRIPTION":lr().parse(t.input),xe.setOperationDescriptionOperation(e.global,t);break;case"SET_OPERATION_TEMPLATE":_r().parse(t.input),xe.setOperationTemplateOperation(e.global,t);break;case"SET_OPERATION_REDUCER":mr().parse(t.input),xe.setOperationReducerOperation(e.global,t);break;case"MOVE_OPERATION":Gn().parse(t.input),xe.moveOperationOperation(e.global,t);break;case"DELETE_OPERATION":Zn().parse(t.input),xe.deleteOperationOperation(e.global,t);break;case"REORDER_MODULE_OPERATIONS":Kn().parse(t.input),xe.reorderModuleOperationsOperation(e.global,t);break;case"SET_STATE_SCHEMA":br().parse(t.input),Be.setStateSchemaOperation(e.global,t);break;case"SET_INITIAL_STATE":tr().parse(t.input),Be.setInitialStateOperation(e.global,t);break;case"ADD_STATE_EXAMPLE":Bn().parse(t.input),Be.addStateExampleOperation(e.global,t);break;case"UPDATE_STATE_EXAMPLE":Sr().parse(t.input),Be.updateStateExampleOperation(e.global,t);break;case"DELETE_STATE_EXAMPLE":Vn().parse(t.input),Be.deleteStateExampleOperation(e.global,t);break;case"REORDER_STATE_EXAMPLES":Yn().parse(t.input),Be.reorderStateExamplesOperation(e.global,t);break;default:return e}},vr=Mn(Zs),Vs=(e,t)=>Ui(e,t),Gs=e=>ji(e,vr),xr=e=>({...Vt(),global:{...vs,...e?.global??{}},local:{...ws,...e?.local??{}}});function Xs(){return{...Vt(),author:{name:"",website:""},description:"",extension:"",id:"",name:"",specifications:[]}}function Ks(){return{}}function Js(e){return{...Xs(),...e||{}}}function qs(e){return{...Ks()}}function Ys(e,t,n){return{...yo(e?.auth,e?.document),global:Js(t),local:qs()}}function Qs(e){const t=xi(xr,e);return t.header.documentType=yr,t}const ea=e=>ks(e),ta=e=>{Ts(e)},na=e=>Ds(e),ra=e=>{Cs(e)},ia={fileExtension:Os,createState:xr,createDocument:Qs,loadFromInput:Gs,saveToFileHandle:Vs,isStateOfType:ea,assertIsStateOfType:ta,isDocumentOfType:na,assertIsDocumentOfType:ra},_a={reducer:vr,documentModel:Ys(Vt(),xs),actions:ys,utils:ia};export{la as $,Wo as A,As as B,Vo as C,Xo as D,Ko as E,Qo as F,ts as G,ss as H,rs as I,Zo as J,aa as K,yr as L,Li as M,wi as N,wn as O,ys as P,vi as Q,Sn as R,Lt as S,ca as T,ha as U,ma as V,ga as W,mi as X,hi as Y,bt as Z,Te as _,Mn as a,_a as a0,Is as b,oe as c,Ui as d,ji as e,xi as f,En as g,Vt as h,On as i,Ys as j,ua as k,In as l,pa as m,da as n,No as o,un as p,ls as q,Po as r,fa as s,Lo as t,zo as u,Uo as v,jo as w,us as x,Bo as y,Fo as z};
|
|
241
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""}]}]},yr="powerhouse/document-model",Is=ee({id:L(),name:L(),createdAtUtcIso:L(),lastModifiedAtUtcIso:L(),documentType:L()}),As=ee({global:pn()}),Rs=Is.extend({documentType:be(yr)}),_t=As.extend({global:xo()}),Or=ee({header:Rs,state:_t,initialState:_t});function ks(e){return _t.safeParse(e).success}function Ts(e){_t.parse(e)}function Ds(e){return Or.safeParse(e).success}function Cs(e){Or.parse(e)}const Ms=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),Ns=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),Ps=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),zs=/[^\p{L}\d]+/giu,an="$1\0$2",ln="";function wr(e){let t=e.trim();t=t.replace(Ms,an).replace(Ns,an),t=t.replace(zs,"\0");let n=0,r=t.length;for(;t.charAt(n)==="\0";)n++;if(n===r)return[];for(;t.charAt(r-1)==="\0";)r--;return t.slice(n,r).split(/\0/g)}function Ls(e){const t=wr(e);for(let n=0;n<t.length;n++){const r=t[n],i=Ps.exec(r);if(i){const s=i.index+(i[1]??i[2]).length;t.splice(n,1,r.slice(0,s),r.slice(s))}}return t}function Us(e,t){const[n,r,i]=rt(e,t);return n+r.map(St(t?.locale)).join(t?.delimiter??" ")+i}function un(e,t){const[n,r,i]=rt(e,t),s=St(t?.locale),l=yt(t?.locale),o=t?.mergeAmbiguousCharacters?Gt(s,l):js(s,l);return n+r.map(o).join(t?.delimiter??"")+i}function ca(e,t){const[n,r,i]=rt(e,t),s=St(t?.locale),l=yt(t?.locale);return n+r.map(Gt(s,l)).join(" ")+i}function pa(e,t){const[n,r,i]=rt(e,t);return n+r.map(yt(t?.locale)).join("_")+i}function da(e,t){const[n,r,i]=rt(e,t),s=St(t?.locale),l=yt(t?.locale),o=Gt(s,l);return n+r.map((u,d)=>d===0?o(u):s(u)).join(" ")+i}function fa(e,t){return Us(e,{delimiter:"_",...t})}function St(e){return e===!1?t=>t.toLowerCase():t=>t.toLocaleLowerCase(e)}function yt(e){return e===!1?t=>t.toUpperCase():t=>t.toLocaleUpperCase(e)}function Gt(e,t){return n=>`${t(n[0])}${e(n.slice(1))}`}function js(e,t){return(n,r)=>{const i=n[0];return(r>0&&i>="0"&&i<="9"?"_"+i:t(i))+e(n.slice(1))}}function rt(e,t={}){const n=t.split??(t.separateNumbers?Ls:wr),r=t.prefixCharacters??ln,i=t.suffixCharacters??ln;let s=0,l=e.length;for(;s<e.length;){const o=e.charAt(s);if(!r.includes(o))break;s++}for(;l>s;){const o=l-1,u=e.charAt(o);if(!i.includes(u))break;l=o}return[e.slice(0,s),n(e.slice(s,l)),e.slice(l)]}const Bs=["UNDO","REDO","PRUNE","LOAD_STATE","SET_NAME","NOOP"];function Fs(e){return Bs.includes(e.toUpperCase())}function $s(e,t){const n=e.specifications[e.specifications.length-1];if(!n)return[];const r=[];for(const i of n.modules)for(const s of i.operations)t&&s.id===t||s.name&&r.push(s.name.toUpperCase());return r}function cn(e,t,n){if(!e)return;const r=e.toUpperCase();if(Fs(e))throw new Error(`Operation name "${e}" is reserved. Please use a different name.`);if($s(t,n).includes(r))throw new Error(`Operation name "${e}" is already used by another operation. Operation names must be unique across all modules.`)}function ha(e,t=!1){const n=[];if(t&&e==="")return n;try{const r=JSON.parse(e);!t&&!Object.keys(r).length&&n.push({message:"Initial state cannot be empty",details:{initialState:e}})}catch{n.push({message:"Invalid initial state",details:{initialState:e}})}return n}function ma(e,t,n="",r=!0){const i=[];if(!r&&!e)return i.push({message:"State schema is required",details:{schema:e}}),i;if(r&&!e)return i;const s=`${un(t)}${un(n)}State`;return new RegExp(`\\btype\\s+${s}(?:\\s|\\{|@|$)`).test(e)||i.push({message:`Invalid state schema name. Expected type ${s}`,details:{schema:e}}),i}function ga(e){const t=[];e.length||t.push({message:"Modules are required",details:{modules:e}});const n=e.reduce((r,i)=>[...r,...Ws(i)],[]);return[...t,...n]}function Ws(e){const t=[];e.name||t.push({message:"Module name is required",details:{module:e}}),e.operations.length||t.push({message:"Module operations are required",details:{module:e}});const n=e.operations.reduce((r,i)=>[...r,...Hs(i)],[]);return[...t,...n]}function Hs(e){const t=[];return e.name||t.push({message:"Operation name is required",details:{operation:e}}),e.schema||t.push({message:"Operation schema is required",details:{operation:e}}),t}function it(e){const t={};return e.forEach((n,r)=>t[n]=r),(n,r)=>(t[r.id]||999999)-(t[n.id]||999999)}const je={setModelNameOperation(e,t){e.name=t.input.name},setModelIdOperation(e,t){e.id=t.input.id},setModelExtensionOperation(e,t){e.extension=t.input.extension},setModelDescriptionOperation(e,t){e.description=t.input.description},setAuthorNameOperation(e,t){e.author=e.author||{name:"",website:null},e.author.name=t.input.authorName},setAuthorWebsiteOperation(e,t){e.author=e.author||{name:"",website:null},e.author.website=t.input.authorWebsite}},Ke={addModuleOperation(e,t){e.specifications[e.specifications.length-1].modules.push({id:t.input.id,name:t.input.name,description:t.input.description||"",operations:[]})},setModuleNameOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].id===t.input.id&&(n.modules[r].name=t.input.name||"")},setModuleDescriptionOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].id===t.input.id&&(n.modules[r].description=t.input.description||"")},deleteModuleOperation(e,t){const n=e.specifications[e.specifications.length-1];n.modules=n.modules.filter(r=>r.id!=t.input.id)},reorderModulesOperation(e,t){e.specifications[e.specifications.length-1].modules.sort(it(t.input.order))}},Pe={addOperationErrorOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.operationId&&n.modules[r].operations[i].errors.push({id:t.input.id,name:t.input.errorName||"",code:t.input.errorCode||"",description:t.input.errorDescription||"",template:t.input.errorTemplate||""})},setOperationErrorCodeOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].errors.length;s++)n.modules[r].operations[i].errors[s].id==t.input.id&&(n.modules[r].operations[i].errors[s].code=t.input.errorCode||"")},setOperationErrorNameOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].errors.length;s++)n.modules[r].operations[i].errors[s].id==t.input.id&&(n.modules[r].operations[i].errors[s].name=t.input.errorName||"")},setOperationErrorDescriptionOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].errors.length;s++)n.modules[r].operations[i].errors[s].id==t.input.id&&(n.modules[r].operations[i].errors[s].description=t.input.errorDescription||"")},setOperationErrorTemplateOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].errors.length;s++)n.modules[r].operations[i].errors[s].id==t.input.id&&(n.modules[r].operations[i].errors[s].template=t.input.errorTemplate||"")},deleteOperationErrorOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].errors=n.modules[r].operations[i].errors.filter(s=>s.id!=t.input.id)},reorderOperationErrorsOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.operationId&&n.modules[r].operations[i].errors.sort(it(t.input.order))}},pt={addOperationExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.operationId&&n.modules[r].operations[i].examples.push({id:t.input.id,value:t.input.example})},updateOperationExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)for(let s=0;s<n.modules[r].operations[i].examples.length;s++)n.modules[r].operations[i].examples[s].id==t.input.id&&(n.modules[r].operations[i].examples[s].value=t.input.example)},deleteOperationExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].examples=n.modules[r].operations[i].examples.filter(s=>s.id!=t.input.id)},reorderOperationExamplesOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.operationId&&n.modules[r].operations[i].examples.sort(it(t.input.order))}},xe={addOperationOperation(e,t){cn(t.input.name,e);const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].id==t.input.moduleId&&n.modules[r].operations.push({id:t.input.id,name:t.input.name,description:t.input.description||"",schema:t.input.schema||"",template:t.input.template||t.input.description||"",reducer:t.input.reducer||"",errors:[],examples:[],scope:t.input.scope||"global"})},setOperationNameOperation(e,t){t.input.name&&cn(t.input.name,e,t.input.id);const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].name=t.input.name||"")},setOperationScopeOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].scope=t.input.scope||"global")},setOperationSchemaOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].schema=t.input.schema||"")},setOperationDescriptionOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].description=t.input.description||"")},setOperationTemplateOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].template=t.input.template||"")},setOperationReducerOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)for(let i=0;i<n.modules[r].operations.length;i++)n.modules[r].operations[i].id==t.input.id&&(n.modules[r].operations[i].reducer=t.input.reducer||"")},moveOperationOperation(e,t){const n=[],r=e.specifications[e.specifications.length-1];for(let i=0;i<r.modules.length;i++)r.modules[i].operations=r.modules[i].operations.filter(s=>s.id==t.input.operationId?(n.push(s),!1):!0);for(let i=0;i<r.modules.length;i++)r.modules[i].id==t.input.newModuleId&&r.modules[i].operations.push(...n)},deleteOperationOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].operations=n.modules[r].operations.filter(i=>i.id!=t.input.id)},reorderModuleOperationsOperation(e,t){const n=e.specifications[e.specifications.length-1];for(let r=0;r<n.modules.length;r++)n.modules[r].id==t.input.moduleId&&n.modules[r].operations.sort(it(t.input.order))}},Be={setStateSchemaOperation(e,t){const n=e.specifications[e.specifications.length-1];if(Object.keys(n.state).includes(t.input.scope))n.state[t.input.scope].schema=t.input.schema;else throw new Error(`Invalid scope: ${t.input.scope}`)},setInitialStateOperation(e,t){const n=e.specifications[e.specifications.length-1];if(Object.keys(n.state).includes(t.input.scope))n.state[t.input.scope].initialValue=t.input.initialValue;else throw new Error(`Invalid scope: ${t.input.scope}`)},addStateExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];if(Object.keys(n.state).includes(t.input.scope))n.state[t.input.scope].examples.push({id:t.input.id,value:t.input.example});else throw new Error(`Invalid scope: ${t.input.scope}`)},updateStateExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];if(!Object.keys(n.state).includes(t.input.scope))throw new Error(`Invalid scope: ${t.input.scope}`);const r=n.state[t.input.scope].examples;for(let i=0;i<r.length;i++)r[i].id==t.input.id&&(r[i].value=t.input.newExample)},deleteStateExampleOperation(e,t){const n=e.specifications[e.specifications.length-1];if(Object.keys(n.state).includes(t.input.scope))n.state[t.input.scope].examples=n.state[t.input.scope].examples.filter(r=>r.id!=t.input.id);else throw new Error(`Invalid scope: ${t.input.scope}`)},reorderStateExamplesOperation(e,t){const n=e.specifications[e.specifications.length-1];if(Object.keys(n.state).includes(t.input.scope))n.state[t.input.scope].examples.sort(it(t.input.order));else throw new Error(`Invalid scope: ${t.input.scope}`)}},Je={addChangeLogItemOperation(e,t){throw new Error('Reducer "addChangeLogItemOperation" not yet implemented')},updateChangeLogItemOperation(e,t){throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented')},deleteChangeLogItemOperation(e,t){throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented')},reorderChangeLogItemsOperation(e,t){throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented')},releaseNewVersionOperation(e,t){const n=e.specifications[e.specifications.length-1],r=n.modules.map(l=>({...l,operations:l.operations.map(o=>({...o,errors:o.errors.map(u=>({...u})),examples:o.examples.map(u=>({...u}))}))})),i={global:{...n.state.global,examples:n.state.global.examples.map(l=>({...l}))},local:{...n.state.local,examples:n.state.local.examples.map(l=>({...l}))}},s={version:n.version+1,changeLog:[],state:i,modules:r};e.specifications.push(s)}},Zs=(e,t)=>{if(On(t))return e;switch(t.type){case"SET_MODEL_NAME":or().parse(t.input),je.setModelNameOperation(e.global,t);break;case"SET_MODEL_ID":ir().parse(t.input),je.setModelIdOperation(e.global,t);break;case"SET_MODEL_EXTENSION":rr().parse(t.input),je.setModelExtensionOperation(e.global,t);break;case"SET_MODEL_DESCRIPTION":nr().parse(t.input),je.setModelDescriptionOperation(e.global,t);break;case"SET_AUTHOR_NAME":Qn().parse(t.input),je.setAuthorNameOperation(e.global,t);break;case"SET_AUTHOR_WEBSITE":er().parse(t.input),je.setAuthorWebsiteOperation(e.global,t);break;case"ADD_CHANGE_LOG_ITEM":zn().parse(t.input),Je.addChangeLogItemOperation(e.global,t);break;case"UPDATE_CHANGE_LOG_ITEM":Er().parse(t.input),Je.updateChangeLogItemOperation(e.global,t);break;case"DELETE_CHANGE_LOG_ITEM":$n().parse(t.input),Je.deleteChangeLogItemOperation(e.global,t);break;case"REORDER_CHANGE_LOG_ITEMS":Xn().parse(t.input),Je.reorderChangeLogItemsOperation(e.global,t);break;case"RELEASE_NEW_VERSION":if(Object.keys(t.input).length>0)throw new Error("Expected empty input for action RELEASE_NEW_VERSION");Je.releaseNewVersionOperation(e.global,t);break;case"ADD_MODULE":Ln().parse(t.input),Ke.addModuleOperation(e.global,t);break;case"SET_MODULE_NAME":ar().parse(t.input),Ke.setModuleNameOperation(e.global,t);break;case"SET_MODULE_DESCRIPTION":sr().parse(t.input),Ke.setModuleDescriptionOperation(e.global,t);break;case"DELETE_MODULE":Wn().parse(t.input),Ke.deleteModuleOperation(e.global,t);break;case"REORDER_MODULES":Jn().parse(t.input),Ke.reorderModulesOperation(e.global,t);break;case"ADD_OPERATION_ERROR":Un().parse(t.input),Pe.addOperationErrorOperation(e.global,t);break;case"SET_OPERATION_ERROR_CODE":ur().parse(t.input),Pe.setOperationErrorCodeOperation(e.global,t);break;case"SET_OPERATION_ERROR_NAME":pr().parse(t.input),Pe.setOperationErrorNameOperation(e.global,t);break;case"SET_OPERATION_ERROR_DESCRIPTION":cr().parse(t.input),Pe.setOperationErrorDescriptionOperation(e.global,t);break;case"SET_OPERATION_ERROR_TEMPLATE":dr().parse(t.input),Pe.setOperationErrorTemplateOperation(e.global,t);break;case"DELETE_OPERATION_ERROR":Hn().parse(t.input),Pe.deleteOperationErrorOperation(e.global,t);break;case"REORDER_OPERATION_ERRORS":qn().parse(t.input),Pe.reorderOperationErrorsOperation(e.global,t);break;case"ADD_OPERATION_EXAMPLE":Oo().parse(t.input),pt.addOperationExampleOperation(e.global,t);break;case"UPDATE_OPERATION_EXAMPLE":Co().parse(t.input),pt.updateOperationExampleOperation(e.global,t);break;case"DELETE_OPERATION_EXAMPLE":vo().parse(t.input),pt.deleteOperationExampleOperation(e.global,t);break;case"REORDER_OPERATION_EXAMPLES":To().parse(t.input),pt.reorderOperationExamplesOperation(e.global,t);break;case"ADD_OPERATION":jn().parse(t.input),xe.addOperationOperation(e.global,t);break;case"SET_OPERATION_NAME":fr().parse(t.input),xe.setOperationNameOperation(e.global,t);break;case"SET_OPERATION_SCOPE":hr().parse(t.input),xe.setOperationScopeOperation(e.global,t);break;case"SET_OPERATION_SCHEMA":gr().parse(t.input),xe.setOperationSchemaOperation(e.global,t);break;case"SET_OPERATION_DESCRIPTION":lr().parse(t.input),xe.setOperationDescriptionOperation(e.global,t);break;case"SET_OPERATION_TEMPLATE":_r().parse(t.input),xe.setOperationTemplateOperation(e.global,t);break;case"SET_OPERATION_REDUCER":mr().parse(t.input),xe.setOperationReducerOperation(e.global,t);break;case"MOVE_OPERATION":Gn().parse(t.input),xe.moveOperationOperation(e.global,t);break;case"DELETE_OPERATION":Zn().parse(t.input),xe.deleteOperationOperation(e.global,t);break;case"REORDER_MODULE_OPERATIONS":Kn().parse(t.input),xe.reorderModuleOperationsOperation(e.global,t);break;case"SET_STATE_SCHEMA":br().parse(t.input),Be.setStateSchemaOperation(e.global,t);break;case"SET_INITIAL_STATE":tr().parse(t.input),Be.setInitialStateOperation(e.global,t);break;case"ADD_STATE_EXAMPLE":Bn().parse(t.input),Be.addStateExampleOperation(e.global,t);break;case"UPDATE_STATE_EXAMPLE":Sr().parse(t.input),Be.updateStateExampleOperation(e.global,t);break;case"DELETE_STATE_EXAMPLE":Vn().parse(t.input),Be.deleteStateExampleOperation(e.global,t);break;case"REORDER_STATE_EXAMPLES":Yn().parse(t.input),Be.reorderStateExamplesOperation(e.global,t);break;default:return e}},vr=Mn(Zs),Vs=(e,t)=>Ui(e,t),Gs=e=>ji(e,vr),xr=e=>({...Vt(),global:{...vs,...e?.global??{}},local:{...ws,...e?.local??{}}});function Xs(){return{...Vt(),author:{name:"",website:""},description:"",extension:"",id:"",name:"",specifications:[]}}function Ks(){return{}}function Js(e){return{...Xs(),...e||{}}}function qs(e){return{...Ks()}}function Ys(e,t,n){return{...yo(e?.auth,e?.document),global:Js(t),local:qs()}}function Qs(e){const t=xi(xr,e);return t.header.documentType=yr,t}const ea=e=>ks(e),ta=e=>{Ts(e)},na=e=>Ds(e),ra=e=>{Cs(e)},ia={fileExtension:Os,createState:xr,createDocument:Qs,loadFromInput:Gs,saveToFileHandle:Vs,isStateOfType:ea,assertIsStateOfType:ta,isDocumentOfType:na,assertIsDocumentOfType:ra},_a={reducer:vr,documentModel:Ys(Vt(),xs),actions:ys,utils:ia};export{la as $,Wo as A,As as B,Vo as C,Xo as D,Ko as E,Qo as F,ts as G,ss as H,rs as I,Zo as J,aa as K,yr as L,Li as M,wi as N,wn as O,ys as P,vi as Q,Sn as R,Lt as S,ca as T,ha as U,ma as V,ga as W,mi as X,hi as Y,bt as Z,Ce as _,Mn as a,_a as a0,Is as b,oe as c,Ui as d,ji as e,xi as f,En as g,Vt as h,On as i,Ys as j,ua as k,In as l,pa as m,da as n,No as o,un as p,ls as q,Po as r,fa as s,Lo as t,zo as u,Uo as v,jo as w,us as x,Bo as y,Fo as z};
|