@powerhousedao/connect 5.1.0-dev.29 → 5.1.0-dev.30

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.
Files changed (78) hide show
  1. package/dist/assets/AddDriveModal-D9L-2Lil.js +1 -0
  2. package/dist/assets/ClearStorageModal-DT3crd2J.js +1 -0
  3. package/dist/assets/CookiesPolicyModal-Cg-ZIYwQ.js +1 -0
  4. package/dist/assets/CreateDocumentModal-B5-4x1PL.js +1 -0
  5. package/dist/assets/DebugSettingsModal-2VROxLa6.js +1 -0
  6. package/dist/assets/DeleteDriveModal-BqTbD9AA.js +1 -0
  7. package/dist/assets/DeleteItemModal-BcTkVZ5s.js +1 -0
  8. package/dist/assets/DisclaimerModal-C8twiB3J.js +1 -0
  9. package/dist/assets/DriveSettingsModal-DGXi1S_w.js +1 -0
  10. package/dist/assets/ExportDocumentWithErrorsModal-CnVPh2hg.js +1 -0
  11. package/dist/assets/SettingsModal-DhLRuwrH.js +1 -0
  12. package/dist/assets/UpgradeDriveModal-BQmVYoWu.js +1 -0
  13. package/dist/assets/{design_system-gAiP_N8l.js → design_system-wiExdGSo.js} +1 -1
  14. package/dist/assets/{design_system_connect-BUNE85sp.js → design_system_connect-C8sP_VL9.js} +1 -1
  15. package/dist/assets/{design_system_ui-CX_lP9BQ.js → design_system_ui-CPf6X_7e.js} +1 -1
  16. package/dist/assets/{document_drive-D_NVRtm0.js → document_drive-CwJB1Xeu.js} +7 -7
  17. package/dist/assets/{document_engineering-DtiGQNMA.js → document_engineering-CO_nmZuG.js} +1 -1
  18. package/dist/assets/{document_model-D_YYwqlB.js → document_model-Dg5TMlFt.js} +11 -11
  19. package/dist/assets/document_model_editor-BWBEv1yk.js +25 -0
  20. package/dist/assets/{drive_explorer-BOo0zosf.js → drive_explorer-Br9HlKVt.js} +2 -2
  21. package/dist/assets/{graphql-editor-ZI3JWeRm.js → graphql-editor-CJvpFT5J.js} +1 -1
  22. package/dist/assets/{hooks-tAMMspZu.js → hooks-CBM25xI9.js} +1 -1
  23. package/dist/assets/index-C9sx8eSK.js +18 -0
  24. package/dist/assets/index-CaSdt_en.js +25 -0
  25. package/dist/assets/{json-editor-CCBi5J7O.js → json-editor-ROpu8Iji.js} +1 -1
  26. package/dist/assets/{nodefs-BPStfV0K.js → nodefs-Vq2O_c5A.js} +1 -1
  27. package/dist/assets/{opfs-ahp-D2os-mtZ.js → opfs-ahp-BrSKGNTW.js} +1 -1
  28. package/dist/assets/{reactor_browser-DEAUU86i.js → reactor_browser-C4GeHg-H.js} +6 -6
  29. package/dist/assets/{state-schemas-AtsBs3mc.js → state-schemas--EJ9plhU.js} +2 -2
  30. package/dist/index.html +9 -9
  31. package/lib/package.copy.json +1 -1
  32. package/lib/src/components/app.d.ts.map +1 -1
  33. package/lib/src/components/app.js +11 -0
  34. package/lib/src/components/app.js.map +1 -1
  35. package/lib/src/components/drive-editor-container.d.ts.map +1 -1
  36. package/lib/src/components/drive-editor-container.js +3 -6
  37. package/lib/src/components/drive-editor-container.js.map +1 -1
  38. package/lib/src/components/editors.d.ts.map +1 -1
  39. package/lib/src/components/editors.js +3 -9
  40. package/lib/src/components/editors.js.map +1 -1
  41. package/lib/src/components/error-boundary.d.ts +103 -0
  42. package/lib/src/components/error-boundary.d.ts.map +1 -0
  43. package/lib/src/components/error-boundary.js +104 -0
  44. package/lib/src/components/error-boundary.js.map +1 -0
  45. package/lib/src/components/modal/index.d.ts +0 -1
  46. package/lib/src/components/modal/index.d.ts.map +1 -1
  47. package/lib/src/components/modal/index.js +0 -1
  48. package/lib/src/components/modal/index.js.map +1 -1
  49. package/lib/src/components/modal/modals-container.js +2 -2
  50. package/lib/src/components/modal/modals-container.js.map +1 -1
  51. package/lib/src/components/sidebar.d.ts.map +1 -1
  52. package/lib/src/components/sidebar.js +2 -3
  53. package/lib/src/components/sidebar.js.map +1 -1
  54. package/lib/src/store/reactor.d.ts.map +1 -1
  55. package/lib/src/store/reactor.js +4 -1
  56. package/lib/src/store/reactor.js.map +1 -1
  57. package/lib/tsconfig.tsbuildinfo +1 -1
  58. package/package.copy.json +1 -1
  59. package/package.json +10 -10
  60. package/dist/assets/AddDriveModal-DmDlxz9g.js +0 -1
  61. package/dist/assets/ClearStorageModal-8Zo1zxf4.js +0 -1
  62. package/dist/assets/CookiesPolicyModal-DoBO5gDN.js +0 -1
  63. package/dist/assets/CreateDocumentModal-B3-4KBWq.js +0 -1
  64. package/dist/assets/DebugSettingsModal-DBs18b92.js +0 -1
  65. package/dist/assets/DeleteDriveModal-8Igg-ZFf.js +0 -1
  66. package/dist/assets/DeleteItemModal-BC-svDc1.js +0 -1
  67. package/dist/assets/DisclaimerModal-BreBiiR8.js +0 -1
  68. package/dist/assets/DriveSettingsModal-BFriMDYd.js +0 -1
  69. package/dist/assets/ExportDocumentWithErrorsModal-k8Lw1abQ.js +0 -1
  70. package/dist/assets/SettingsModal-BUOaIP45.js +0 -1
  71. package/dist/assets/UpgradeDriveModal-HjXWTJ2k.js +0 -1
  72. package/dist/assets/document_model_editor-CwyBllD-.js +0 -25
  73. package/dist/assets/index-DeVT-Y59.js +0 -25
  74. package/dist/assets/index-DneIeEtZ.js +0 -18
  75. package/lib/src/components/modal/modals-error-boundary.d.ts +0 -18
  76. package/lib/src/components/modal/modals-error-boundary.d.ts.map +0 -1
  77. package/lib/src/components/modal/modals-error-boundary.js +0 -22
  78. package/lib/src/components/modal/modals-error-boundary.js.map +0 -1
@@ -1,25 +1,25 @@
1
- import{n as $e,s as L,o as ee,l as Tt,u as Ir,_ as Qe,a as be,b as Ar,c as sn,Z as Rr,d as Se}from"./zod-BpTyxkjy.js";import{g as an,p as kr,c as ot}from"./react-DQSxOgtG.js";var st={exports:{}},Gt;function Tr(){return Gt||(Gt=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,E){if(h.length>200||E)return h.sort(E);for(let v=1;v<h.length;v++){const x=h[v];let T=v;for(;T!==0&&h[T-1]>x;)h[T]=h[T-1],T--;h[T]=x}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,E,v){h.length<v&&(v=h.length);const x=E===","?"":" ";let T=`"0":${x}${h[0]}`;for(let M=1;M<v;M++)T+=`${E}"${M}":${x}${h[M]}`;return T}function g(h){if(n.call(h,"circularValue")){const E=h.circularValue;if(typeof E=="string")return`"${E}"`;if(E==null)return E;if(E===Error||E===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 _(h){let E;if(n.call(h,"deterministic")&&(E=h.deterministic,typeof E!="boolean"&&typeof E!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return E===void 0?!0:E}function w(h,E){let v;if(n.call(h,E)&&(v=h[E],typeof v!="boolean"))throw new TypeError(`The "${E}" argument must be of type boolean`);return v===void 0?!0:v}function f(h,E){let v;if(n.call(h,E)){if(v=h[E],typeof v!="number")throw new TypeError(`The "${E}" argument must be of type number`);if(!Number.isInteger(v))throw new TypeError(`The "${E}" argument must be an integer`);if(v<1)throw new RangeError(`The "${E}" argument must be >= 1`)}return v===void 0?1/0:v}function S(h){return h===1?"1 item":`${h} items`}function p(h){const E=new Set;for(const v of h)(typeof v=="string"||typeof v=="number")&&E.add(String(v));return E}function b(h){if(n.call(h,"strict")){const E=h.strict;if(typeof E!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(E)return v=>{let x=`Object can not safely be stringified. Received type ${typeof v}`;throw typeof v!="function"&&(x+=` (${v.toString()})`),new Error(x)}}}function m(h){h={...h};const E=b(h);E&&(h.bigint===void 0&&(h.bigint=!1),"circularValue"in h||(h.circularValue=Error));const v=g(h),x=w(h,"bigint"),T=_(h),M=typeof T=="function"?T:void 0,F=f(h,"maximumDepth"),D=f(h,"maximumBreadth");function G(U,N,z,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(z.indexOf(A)!==-1)return v;let R="",Y=",";const V=J;if(Array.isArray(A)){if(A.length===0)return"[]";if(F<z.length+1)return'"[Array]"';z.push(A),B!==""&&(J+=B,R+=`
1
+ import{n as $e,s as L,o as ee,l as Tt,u as Ar,_ as Qe,a as be,b as Rr,c as an,Z as kr,d as Se}from"./zod-BpTyxkjy.js";import{g as ln,p as Tr,c as ot}from"./react-DQSxOgtG.js";var st={exports:{}},Gt;function Dr(){return Gt||(Gt=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 o(h){return h.length<5e3&&!i.test(h)?`"${h}"`:JSON.stringify(h)}function l(h,E){if(h.length>200||E)return h.sort(E);for(let v=1;v<h.length;v++){const x=h[v];let T=v;for(;T!==0&&h[T-1]>x;)h[T]=h[T-1],T--;h[T]=x}return h}const s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u(h){return s.call(h)!==void 0&&h.length!==0}function d(h,E,v){h.length<v&&(v=h.length);const x=E===","?"":" ";let T=`"0":${x}${h[0]}`;for(let M=1;M<v;M++)T+=`${E}"${M}":${x}${h[M]}`;return T}function g(h){if(n.call(h,"circularValue")){const E=h.circularValue;if(typeof E=="string")return`"${E}"`;if(E==null)return E;if(E===Error||E===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 _(h){let E;if(n.call(h,"deterministic")&&(E=h.deterministic,typeof E!="boolean"&&typeof E!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return E===void 0?!0:E}function w(h,E){let v;if(n.call(h,E)&&(v=h[E],typeof v!="boolean"))throw new TypeError(`The "${E}" argument must be of type boolean`);return v===void 0?!0:v}function f(h,E){let v;if(n.call(h,E)){if(v=h[E],typeof v!="number")throw new TypeError(`The "${E}" argument must be of type number`);if(!Number.isInteger(v))throw new TypeError(`The "${E}" argument must be an integer`);if(v<1)throw new RangeError(`The "${E}" argument must be >= 1`)}return v===void 0?1/0:v}function S(h){return h===1?"1 item":`${h} items`}function p(h){const E=new Set;for(const v of h)(typeof v=="string"||typeof v=="number")&&E.add(String(v));return E}function b(h){if(n.call(h,"strict")){const E=h.strict;if(typeof E!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(E)return v=>{let x=`Object can not safely be stringified. Received type ${typeof v}`;throw typeof v!="function"&&(x+=` (${v.toString()})`),new Error(x)}}}function m(h){h={...h};const E=b(h);E&&(h.bigint===void 0&&(h.bigint=!1),"circularValue"in h||(h.circularValue=Error));const v=g(h),x=w(h,"bigint"),T=_(h),M=typeof T=="function"?T:void 0,F=f(h,"maximumDepth"),D=f(h,"maximumBreadth");function G(U,N,z,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 o(A);case"object":{if(A===null)return"null";if(z.indexOf(A)!==-1)return v;let R="",Y=",";const V=J;if(Array.isArray(A)){if(A.length===0)return"[]";if(F<z.length+1)return'"[Array]"';z.push(A),B!==""&&(J+=B,R+=`
2
2
  ${J}`,Y=`,
3
3
  ${J}`);const ce=Math.min(A.length,D);let pe=0;for(;pe<ce-1;pe++){const ge=G(String(pe),A,z,q,B,J);R+=ge!==void 0?ge:"null",R+=Y}const fe=G(String(pe),A,z,q,B,J);if(R+=fe!==void 0?fe:"null",A.length-1>D){const ge=A.length-D-1;R+=`${Y}"... ${S(ge)} not stringified"`}return B!==""&&(R+=`
4
4
  ${V}`),z.pop(),`[${R}]`}let W=Object.keys(A);const ae=W.length;if(ae===0)return"{}";if(F<z.length+1)return'"[Object]"';let ie="",re="";B!==""&&(J+=B,Y=`,
5
- ${J}`,ie=" ");const se=Math.min(ae,D);T&&!u(A)&&(W=l(W,M)),z.push(A);for(let ce=0;ce<se;ce++){const pe=W[ce],fe=G(pe,A,z,q,B,J);fe!==void 0&&(R+=`${re}${s(pe)}:${ie}${fe}`,re=Y)}if(ae>D){const ce=ae-D;R+=`${re}"...":${ie}"${S(ce)} not stringified"`,re=Y}return B!==""&&re.length>1&&(R=`
5
+ ${J}`,ie=" ");const se=Math.min(ae,D);T&&!u(A)&&(W=l(W,M)),z.push(A);for(let ce=0;ce<se;ce++){const pe=W[ce],fe=G(pe,A,z,q,B,J);fe!==void 0&&(R+=`${re}${o(pe)}:${ie}${fe}`,re=Y)}if(ae>D){const ce=ae-D;R+=`${re}"...":${ie}"${S(ce)} not stringified"`,re=Y}return B!==""&&re.length>1&&(R=`
6
6
  ${J}${R}
7
- ${V}`),z.pop(),`{${R}}`}case"number":return isFinite(A)?String(A):E?E(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(x)return String(A);default:return E?E(A):void 0}}function te(U,N,z,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(z.indexOf(N)!==-1)return v;const A=J;let R="",Y=",";if(Array.isArray(N)){if(N.length===0)return"[]";if(F<z.length+1)return'"[Array]"';z.push(N),B!==""&&(J+=B,R+=`
7
+ ${V}`),z.pop(),`{${R}}`}case"number":return isFinite(A)?String(A):E?E(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(x)return String(A);default:return E?E(A):void 0}}function te(U,N,z,q,B,J){switch(typeof N=="object"&&N!==null&&typeof N.toJSON=="function"&&(N=N.toJSON(U)),typeof N){case"string":return o(N);case"object":{if(N===null)return"null";if(z.indexOf(N)!==-1)return v;const A=J;let R="",Y=",";if(Array.isArray(N)){if(N.length===0)return"[]";if(F<z.length+1)return'"[Array]"';z.push(N),B!==""&&(J+=B,R+=`
8
8
  ${J}`,Y=`,
9
9
  ${J}`);const ae=Math.min(N.length,D);let ie=0;for(;ie<ae-1;ie++){const se=te(String(ie),N[ie],z,q,B,J);R+=se!==void 0?se:"null",R+=Y}const re=te(String(ie),N[ie],z,q,B,J);if(R+=re!==void 0?re:"null",N.length-1>D){const se=N.length-D-1;R+=`${Y}"... ${S(se)} not stringified"`}return B!==""&&(R+=`
10
10
  ${A}`),z.pop(),`[${R}]`}z.push(N);let V="";B!==""&&(J+=B,Y=`,
11
- ${J}`,V=" ");let W="";for(const ae of q){const ie=te(ae,N[ae],z,q,B,J);ie!==void 0&&(R+=`${W}${s(ae)}:${V}${ie}`,W=Y)}return B!==""&&W.length>1&&(R=`
11
+ ${J}`,V=" ");let W="";for(const ae of q){const ie=te(ae,N[ae],z,q,B,J);ie!==void 0&&(R+=`${W}${o(ae)}:${V}${ie}`,W=Y)}return B!==""&&W.length>1&&(R=`
12
12
  ${J}${R}
13
- ${A}`),z.pop(),`{${R}}`}case"number":return isFinite(N)?String(N):E?E(N):"null";case"boolean":return N===!0?"true":"false";case"undefined":return;case"bigint":if(x)return String(N);default:return E?E(N):void 0}}function I(U,N,z,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 I(U,N,z,q,B);if(N===null)return"null"}if(z.indexOf(N)!==-1)return v;const J=B;if(Array.isArray(N)){if(N.length===0)return"[]";if(F<z.length+1)return'"[Array]"';z.push(N),B+=q;let ie=`
13
+ ${A}`),z.pop(),`{${R}}`}case"number":return isFinite(N)?String(N):E?E(N):"null";case"boolean":return N===!0?"true":"false";case"undefined":return;case"bigint":if(x)return String(N);default:return E?E(N):void 0}}function I(U,N,z,q,B){switch(typeof N){case"string":return o(N);case"object":{if(N===null)return"null";if(typeof N.toJSON=="function"){if(N=N.toJSON(U),typeof N!="object")return I(U,N,z,q,B);if(N===null)return"null"}if(z.indexOf(N)!==-1)return v;const J=B;if(Array.isArray(N)){if(N.length===0)return"[]";if(F<z.length+1)return'"[Array]"';z.push(N),B+=q;let ie=`
14
14
  ${B}`;const re=`,
15
15
  ${B}`,se=Math.min(N.length,D);let ce=0;for(;ce<se-1;ce++){const fe=I(String(ce),N[ce],z,q,B);ie+=fe!==void 0?fe:"null",ie+=re}const pe=I(String(ce),N[ce],z,q,B);if(ie+=pe!==void 0?pe:"null",N.length-1>D){const fe=N.length-D-1;ie+=`${re}"... ${S(fe)} not stringified"`}return ie+=`
16
16
  ${J}`,z.pop(),`[${ie}]`}let A=Object.keys(N);const R=A.length;if(R===0)return"{}";if(F<z.length+1)return'"[Object]"';B+=q;const Y=`,
17
- ${B}`;let V="",W="",ae=Math.min(R,D);u(N)&&(V+=d(N,Y,D),A=A.slice(N.length),ae-=N.length,W=Y),T&&(A=l(A,M)),z.push(N);for(let ie=0;ie<ae;ie++){const re=A[ie],se=I(re,N[re],z,q,B);se!==void 0&&(V+=`${W}${s(re)}: ${se}`,W=Y)}if(R>D){const ie=R-D;V+=`${W}"...": "${S(ie)} not stringified"`,W=Y}return W!==""&&(V=`
17
+ ${B}`;let V="",W="",ae=Math.min(R,D);u(N)&&(V+=d(N,Y,D),A=A.slice(N.length),ae-=N.length,W=Y),T&&(A=l(A,M)),z.push(N);for(let ie=0;ie<ae;ie++){const re=A[ie],se=I(re,N[re],z,q,B);se!==void 0&&(V+=`${W}${o(re)}: ${se}`,W=Y)}if(R>D){const ie=R-D;V+=`${W}"...": "${S(ie)} not stringified"`,W=Y}return W!==""&&(V=`
18
18
  ${B}${V}
19
- ${J}`),z.pop(),`{${V}}`}case"number":return isFinite(N)?String(N):E?E(N):"null";case"boolean":return N===!0?"true":"false";case"undefined":return;case"bigint":if(x)return String(N);default:return E?E(N):void 0}}function j(U,N,z){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,z);if(N===null)return"null"}if(z.indexOf(N)!==-1)return v;let q="";const B=N.length!==void 0;if(B&&Array.isArray(N)){if(N.length===0)return"[]";if(F<z.length+1)return'"[Array]"';z.push(N);const V=Math.min(N.length,D);let W=0;for(;W<V-1;W++){const ie=j(String(W),N[W],z);q+=ie!==void 0?ie:"null",q+=","}const ae=j(String(W),N[W],z);if(q+=ae!==void 0?ae:"null",N.length-1>D){const ie=N.length-D-1;q+=`,"... ${S(ie)} not stringified"`}return z.pop(),`[${q}]`}let J=Object.keys(N);const A=J.length;if(A===0)return"{}";if(F<z.length+1)return'"[Object]"';let R="",Y=Math.min(A,D);B&&u(N)&&(q+=d(N,",",D),J=J.slice(N.length),Y-=N.length,R=","),T&&(J=l(J,M)),z.push(N);for(let V=0;V<Y;V++){const W=J[V],ae=j(W,N[W],z);ae!==void 0&&(q+=`${R}${s(W)}:${ae}`,R=",")}if(A>D){const V=A-D;q+=`${R}"...":"${S(V)} not stringified"`}return z.pop(),`{${q}}`}case"number":return isFinite(N)?String(N):E?E(N):"null";case"boolean":return N===!0?"true":"false";case"undefined":return;case"bigint":if(x)return String(N);default:return E?E(N):void 0}}function c(U,N,z){if(arguments.length>1){let q="";if(typeof z=="number"?q=" ".repeat(Math.min(z,10)):typeof z=="string"&&(q=z.slice(0,10)),N!=null){if(typeof N=="function")return G("",{"":U},[],N,q,"");if(Array.isArray(N))return te("",U,[],p(N),q,"")}if(q.length!==0)return I("",U,[],q,"")}return j("",U,[])}return c}})(st,st.exports)),st.exports}var Dr=Tr();const _t=an(Dr);_t.configure;const Vt=_t,Cr=[1518500249,1859775393,-1894007588,-899497514];function Mr(e){return new Nr}class Nr{constructor(){this.A=1732584193,this.B=-271733879,this.C=-1732584194,this.D=271733878,this.E=-1009589776,this._size=0,this._sp=0,(!at||Ge>=8e3)&&(at=new ArrayBuffer(8e3),Ge=0),this._byte=new Uint8Array(at,Ge,80),this._word=new Int32Array(at,Ge,20),Ge+=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++]=Ce(t[n++]);for(u=16;u<80;u++)Ne[u]=Lr(Ne[u-3]^Ne[u-8]^Ne[u-14]^Ne[u-16]);for(u=0;u<80;u++){const d=u/20|0,g=Ur(r)+Br(d,i,s,l)+o+Ne[u]+Cr[d]|0;o=l,l=s,s=jr(i),i=r,r=g}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]=Ce(o)),l&&(r[15]=Ce(l)),this._int32(r),t==="hex"?this._hex():this._bin()}_hex(){const{A:t,B:n,C:r,D:i,E:s}=this;return Ve(t)+Ve(n)+Ve(r)+Ve(i)+Ve(s)}_bin(){const{A:t,B:n,C:r,D:i,E:s,_byte:l,_word:o}=this;return o[0]=Ce(t),o[1]=Ce(n),o[2]=Ce(r),o[3]=Ce(i),o[4]=Ce(s),l.slice(0,20)}}const Ne=new Int32Array(80);let at,Ge=0;const Ve=e=>(e+4294967296).toString(16).substr(-8),zr=(e=>e<<24&4278190080|e<<8&16711680|e>>8&65280|e>>24&255),Pr=(e=>e),Ce=Fr()?Pr:zr,Lr=e=>e<<1|e>>>31,Ur=e=>e<<5|e>>>27,jr=e=>e<<30|e>>>2;function Br(e,t,n,r){return e===0?t&n|~t&r:e===2?t&n|t&r|n&r:t^n^r}function Fr(){return new Uint8Array(new Uint16Array([65279]).buffer)[0]===254}const ln=(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=Hr(e,t);return n==="hex"?Wr(i):$r(i)};function $r(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Wr(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function Hr(e,t="sha1"){if(!["sha1"].includes(t))throw new Error("Hashing algorithm not supported: Available: sha1");return Mr().update(e).digest()}function Zr(e){return(new Date(e).getTime()/1e3).toFixed(0)}function Gr({documentId:e,signer:t,action:n,previousStateHash:r}){const{scope:i,type:s}=n;return[Zr(new Date),t.app.key,ln([e,i,s,_t(n.input)].join("")),r]}const Vr=new TextEncoder;function Xr(e){const t=e.join(""),n=`Signed Operation:
20
- `+t.length.toString();return Vr.encode(n+t)}function Kr(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 un 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 Jr extends un{issues;constructor(t){super(t),this.issues=t,this.name="InvalidActionInputZodError"}}class qr 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 Yr=e=>e!=null;Ar().refine(e=>Yr(e));const Qr=Qe(["LOAD_STATE"]),ei=Qe(["PRUNE"]),ti=Qe(["REDO"]),ni=Qe(["SET_NAME"]),ri=Qe(["UNDO"]);function Le(){return L()}function ii(){return Ir([oi(),ai(),li(),ui(),ci()])}function oi(){return ee({id:L(),timestampUtcMs:L(),input:Tt(()=>cn()),type:Qr,scope:Le()})}function cn(){return ee({operations:$e(),state:Tt(()=>si())})}function si(){return ee({data:sn().nullish(),name:L()})}function ai(){return ee({id:L(),timestampUtcMs:L(),input:Tt(()=>pn()),type:ei,scope:Le()})}function pn(){return ee({end:$e().nullish(),start:$e().nullish()})}const dn=$e;function li(){return ee({id:L(),timestampUtcMs:L().datetime(),input:dn(),type:ti,scope:Le()})}const fn=L;function ui(){return ee({id:L(),timestampUtcMs:L().datetime(),input:fn(),type:ni,scope:be("global")})}const hn=$e;function ci(){return ee({id:L(),timestampUtcMs:L().datetime(),input:hn(),type:ri,scope:Le()})}function Dt(e){return globalThis.crypto.randomUUID()}const pi=(e=1,t="global")=>oe("UNDO",e,void 0,hn,t),di=(e=1,t="global")=>oe("REDO",e,void 0,dn,t),fi=(e,t,n="global")=>oe("PRUNE",{start:e,end:t},void 0,pn,n),mn=(e,t)=>oe("LOAD_STATE",{state:e,operations:t},void 0,cn),gn=(e="global")=>oe("NOOP",void 0,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:Dt(),timestampUtcMs:new Date().toISOString(),type:e,input:t,scope:i};try{r?.().parse(s.input)}catch(l){throw l instanceof Rr?new Jr(l.issues):new un(l)}return s}const hi=e=>({id:e.id,timestampUtcMs:e.timestampUtcMs,type:e.type,input:e.input,scope:e.scope,context:e.context,attachments:e.attachments}),mi=(e,t,n)=>({...e,action:e,id:Dt(),timestampUtcMs:new Date().toISOString(),hash:"",error:void 0,index:t,skip:n}),gi=(e,t)=>({...e,hash:"",error:void 0,skip:t}),_i=(e,t)=>{if(!e.action)throw new Error("Operation has no action");return{...e,action:{...e.action,context:t}}},bi=(e,t,n=[])=>({user:e,app:t,signatures:n});async function yi(e,t){const n=Gr(e),r=Xr(n),i=await t(r);return[...n,`0x${Kr(i)}`]}async function ia(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 yi({documentId:n.header.id,signer:r,action:e,previousStateHash:u},i),g={signer:bi(r.user,r.app,[...r.signatures,d])};return _i(o,g)}const Ei=e=>`${e.documentType}:${e.createdAtUtcIso}:${e.nonce}`;function Si(e){let t;return{async publicKey(){return e},async sign(n){throw new Error("verification-only signer cannot sign data")},async signAction(n,r){throw new Error("verification-only signer cannot sign actions")},async verify(n,r){t||(t=await crypto.subtle.importKey("jwk",e,{name:"ECDSA",namedCurve:"P-256"},!0,["verify"]));let i;try{i=await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},t,new Uint8Array(r),new Uint8Array(n))}catch{throw new Error("invalid signature")}if(!i)throw new Error("invalid signature")}}}const wi=e=>Si(e.sig.publicKey),Oi=async(e,t,n)=>{const r=Ei(e),s=new TextEncoder().encode(r),l=Uint8Array.from(atob(t),o=>o.charCodeAt(0));await n.verify(s,l)},oa=async e=>{const t=wi(e);return Oi({documentType:e.documentType,createdAtUtcIso:e.createdAtUtcIso,nonce:e.sig.nonce},e.id,t)},xi=(e=Dt(),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 Ii(e){return e.type==="UNDO"}function _n(e){return["SET_NAME","UNDO","REDO","PRUNE","LOAD_STATE"].includes(e.type)}function bn(e,t){const n=e(t);return{header:xi(),state:n,initialState:n,operations:{global:[],local:[]},clipboard:[]}}function Ct(e,t="global"){const n=_t(e.state[t]||"");return ln(n)}const Ai=e=>e;function yn(e,t,n,r,i,s={},l){const{checkHashes:o=!0,reuseOperationResultingState:u,operationResultingStateParser:d=Mt}=l||{};let g=e;const _=[],w=new Set([...Object.keys(t),"global","local"]),f={};for(const v of w)f[v]=[];if(u)for(const[v,x]of Object.entries(t)){if(!x)continue;const T=x.findLastIndex(F=>!!F.resultingState);if(T<0){_.push(...x);continue}const M=x[T];if(!(!M||!M.resultingState))try{const F=d(M.resultingState);g={...g,[v]:F};const D=f[v];D&&D.push(...x.slice(0,T+1)),_.push(...x.slice(T+1))}catch{_.push(...x)}}else _.push(...Object.values(t).flatMap(v=>v||[]));const S=bn(Ai,g);i?.slug&&(S.header.slug=i.slug),S.initialState=e,S.operations=f;let p=S;if(_.length)p=_.reduce((v,x)=>n(v,x.action,r,{ignoreSkipOperations:!0,checkHashes:o,replayOptions:{operation:x}}),S);else for(const v of Object.values(f)){if(!v)continue;const x=v.at(-1);x&&(p=Sn(p,x.action.scope))}if(!o)for(const v of Object.keys(p.state))for(let x=_.length-1;x>=0;x--){const T=_[x];if(T.action.scope===v){if(T.hash!==Ct(p,v))throw new qr(v,p,T);break}}const b=new Set([...Object.keys(p.operations),...Object.keys(t),"global","local"]),m={};for(const v of b)m[v]=[];const h=Array.from(b).reduce((v,x)=>{const T=p.operations[x]||[];return{...v,[x]:[...T.map((M,F)=>({...M,timestamp:t[x]?.[F]?.timestampUtcMs??M.timestampUtcMs}))]}},m),E=i?i.lastModifiedAtUtcIso:Object.values(h).reduce((v,x)=>{if(!x)return v;const T=x.at(-1);return T&&T.timestampUtcMs>v?T.timestampUtcMs:v},S.header.lastModifiedAtUtcIso);return i&&(p.header={...i,revision:p.header.revision,lastModifiedAtUtcIso:E}),{...p,operations:h}}function Mt(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 Xt;(function(e){e.UNEXPECTED_INDEX="UNEXPECTED_INDEX"})(Xt||(Xt={}));var Kt;(function(e){e.DUPLICATED_INDEX="DUPLICATED_INDEX",e.MISSING_INDEX="MISSING_INDEX"})(Kt||(Kt={}));function Re(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 sa(e,t,n){return[...t,...n].sort((r,i)=>new Date(r.timestampUtcMs||"").getTime()-new Date(i.timestampUtcMs||"").getTime()).map((r,i)=>({...r,index:e.index+i,skip:i===0?e.skip:0}))}function En(e,t){const n=e,r=t,i={index:n.index,skip:n.skip,type:n.type??null,scope:n.scope??null,input:n.input??null},s={index:r.index,skip:r.skip,type:r.type??null,scope:r.scope??null,input:r.input??null};return Vt(i)===Vt(s)}function aa(e,t){const n=Re(Te(e.slice())),r=Re(Te(t.slice()));if(n.length<1)return[r,[]];const i=[];let s=!1;for(;r.length>0;){const l=r[0];let o=n.shift();for(;o&&Ri(o,l);)i.push(o),o=n.shift();if(o?s||(En(o,l)?(r.shift(),i.push(o)):(n.unshift(o),s=!0)):s=!0,s){let u=r.shift();for(;u;)i.push(u),u=r.shift()}}if(!s){let l=n.shift();for(;l;)i.push(l),l=n.shift()}return[Re(i),n]}function Ri(e,t){return e.index<t.index||e.index===t.index&&e.id===t.id&&e.skip<t.skip}function ki(e,t){const n=[],r=[],i=[],s=Math.max(e.length,t.length);let l=!1;for(let o=0;o<s;o++){const u=e[o],d=t[o];u&&d?!l&&En(u,d)?n.push(u):(l=!0,r.push(u),i.push(d)):u?r.push(u):d&&i.push(d)}return[n,r,i]}function la(e,t,n){const[r,i,s]=ki(Re(e),Re(t)),l=St(r),o=1+Math.max(l,St(i),St(s)),u=Ci(s,i),d=n({index:o,skip:o-(l+1)},i,u);return r.concat(d)}function St(e){const t=e[e.length-1];return t?t.index:-1}function Ti(e){if(e.length<1)return-1;const t=Re(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 ua(e){return e.reduce((n,r)=>(n[r.action.scope]||(n[r.action.scope]=[]),n[r.action.scope]?.push(r),n),{})}function ca(e,t){return e.filter(n=>!t.some(r=>n.action.type==="NOOP"&&n.skip===0&&n.index===r.index||n.index===r.index&&n.skip===r.skip&&n.action.scope===r.action.scope&&n.hash===r.hash&&n.action.type===r.action.type))}function Di(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 Re(Te([...e,s])).slice(0,-1)}function dt(e){return Object.entries(e).reduce((n,r)=>{const[i,s]=r;return s?{...n,[i]:Re(Te(s))}:n},{})}function Ci(e,t){return e.filter(n=>n.id?!t.some(r=>r.id===n.id):!0)}function Mi(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 Ni(e,t){return e.filter(n=>!t.some(r=>n.index===r.index))}function zi(e){return Te(Object.values(e.operations).flatMap(n=>n||[])).at(-1)?.timestampUtcMs||e.header.lastModifiedAtUtcIso}function Pi(e,t){return(e.operations[t]?.at(-1)?.index??-1??-1)+1}function Sn(e,t){const n={...e.header,revision:{...e.header.revision,[t]:Pi(e,t)},lastModifiedAtUtcIso:zi(e)};return{...e,header:n}}function lt(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:{}},Jt;function Li(){return Jt||(Jt=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(r,i,s){function l(d,g){if(!i[d]){if(!r[d]){var _=typeof lt=="function"&&lt;if(!g&&_)return _(d,!0);if(o)return o(d,!0);var w=new Error("Cannot find module '"+d+"'");throw w.code="MODULE_NOT_FOUND",w}var f=i[d]={exports:{}};r[d][0].call(f.exports,function(S){var p=r[d][1][S];return l(p||S)},f,f.exports,n,r,i,s)}return i[d].exports}for(var o=typeof lt=="function"&&lt,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,f,S,p,b=[],m=0,h=u.length,E=h,v=s.getTypeOf(u)!=="string";m<u.length;)E=h-m,_=v?(d=u[m++],g=m<h?u[m++]:0,m<h?u[m++]:0):(d=u.charCodeAt(m++),g=m<h?u.charCodeAt(m++):0,m<h?u.charCodeAt(m++):0),w=d>>2,f=(3&d)<<4|g>>4,S=1<E?(15&g)<<2|_>>6:64,p=2<E?63&_:64,b.push(o.charAt(w)+o.charAt(f)+o.charAt(S)+o.charAt(p));return b.join("")},i.decode=function(u){var d,g,_,w,f,S,p=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,E=3*(u=u.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(u.charAt(u.length-1)===o.charAt(64)&&E--,u.charAt(u.length-2)===o.charAt(64)&&E--,E%1!=0)throw new Error("Invalid base64 input, bad content length.");for(h=l.uint8array?new Uint8Array(0|E):new Array(0|E);p<u.length;)d=o.indexOf(u.charAt(p++))<<2|(w=o.indexOf(u.charAt(p++)))>>4,g=(15&w)<<4|(f=o.indexOf(u.charAt(p++)))>>2,_=(3&f)<<6|(S=o.indexOf(u.charAt(p++))),h[b++]=d,f!==64&&(h[b++]=g),S!==64&&(h[b++]=_);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,f,S){this.compressedSize=g,this.uncompressedSize=_,this.crc32=w,this.compression=f,this.compressedContent=S}d.prototype={getContentWorker:function(){var g=new l(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("data_length")),_=this;return g.on("end",function(){if(this.streamInfo.data_length!==_.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),g},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 g.pipe(new o).pipe(new u("uncompressedSize")).pipe(_.compressWorker(w)).pipe(new u("compressedSize")).withStreamInfo("compression",_)},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 g=0;g<8;g++)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 f=l,S=w+_;d^=-1;for(var p=w;p<S;p++)d=d>>>8^f[255&(d^g[p])];return-1^d})(0|u,o,o.length,0):(function(d,g,_,w){var f=l,S=w+_;d^=-1;for(var p=w;p<S;p++)d=d>>>8^f[255&(d^g.charCodeAt(p))];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/"+_),this._pako=null,this._pakoAction=_,this._pakoOptions=w,this.meta={}}i.magic="\b\0",o.inherits(g,u),g.prototype.processChunk=function(_){this.meta=_.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(d,_.data),!1)},g.prototype.flush=function(){u.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},g.prototype.cleanUp=function(){u.prototype.cleanUp.call(this),this._pako=null},g.prototype._createPako=function(){this._pako=new l[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var _=this;this._pako.onData=function(w){_.push({data:w,meta:_.meta})}},i.compressWorker=function(_){return new g("Deflate",_)},i.uncompressWorker=function(){return new g("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,i){function s(f,S){var p,b="";for(p=0;p<S;p++)b+=String.fromCharCode(255&f),f>>>=8;return b}function l(f,S,p,b,m,h){var E,v,x=f.file,T=f.compression,M=h!==d.utf8encode,F=o.transformTo("string",h(x.name)),D=o.transformTo("string",d.utf8encode(x.name)),G=x.comment,te=o.transformTo("string",h(G)),I=o.transformTo("string",d.utf8encode(G)),j=D.length!==x.name.length,c=I.length!==G.length,U="",N="",z="",q=x.dir,B=x.date,J={crc32:0,compressedSize:0,uncompressedSize:0};S&&!p||(J.crc32=f.crc32,J.compressedSize=f.compressedSize,J.uncompressedSize=f.uncompressedSize);var A=0;S&&(A|=8),M||!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})(x.unixPermissions,q)):(Y=20,R|=(function(W){return 63&(W||0)})(x.dosPermissions)),E=B.getUTCHours(),E<<=6,E|=B.getUTCMinutes(),E<<=5,E|=B.getUTCSeconds()/2,v=B.getUTCFullYear()-1980,v<<=4,v|=B.getUTCMonth()+1,v<<=5,v|=B.getUTCDate(),j&&(N=s(1,1)+s(g(F),4)+D,U+="up"+s(N.length,2)+N),c&&(z=s(1,1)+s(g(te),4)+I,U+="uc"+s(z.length,2)+z);var V="";return V+=`
21
- \0`,V+=s(A,2),V+=T.magic,V+=s(E,2),V+=s(v,2),V+=s(J.crc32,4),V+=s(J.compressedSize,4),V+=s(J.uncompressedSize,4),V+=s(F.length,2),V+=s(U.length,2),{fileRecord:_.LOCAL_FILE_HEADER+V+F+U,dirRecord:_.CENTRAL_FILE_HEADER+s(Y,2)+V+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"),g=n("../crc32"),_=n("../signature");function w(f,S,p,b){u.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=S,this.zipPlatform=p,this.encodeFileName=b,this.streamFiles=f,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(f){var S=f.meta.percent||0,p=this.entriesCount,b=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,u.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:p?(S+100*(p-b-1))/p:100}}))},w.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var S=this.streamFiles&&!f.file.dir;if(S){var p=l(f,S,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},w.prototype.closedSource=function(f){this.accumulate=!1;var S=this.streamFiles&&!f.file.dir,p=l(f,S,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),S)this.push({data:(function(b){return _.DATA_DESCRIPTOR+s(b.crc32,4)+s(b.compressedSize,4)+s(b.uncompressedSize,4)})(f),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},w.prototype.flush=function(){for(var f=this.bytesWritten,S=0;S<this.dirRecords.length;S++)this.push({data:this.dirRecords[S],meta:{percent:100}});var p=this.bytesWritten-f,b=(function(m,h,E,v,x){var T=o.transformTo("string",x(v));return _.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(m,2)+s(m,2)+s(h,4)+s(E,4)+s(T.length,2)+T})(this.dirRecords.length,p,f,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(f){this._sources.push(f);var S=this;return f.on("data",function(p){S.processChunk(p)}),f.on("end",function(){S.closedSource(S.previous.streamInfo),S._sources.length?S.prepareNextSource():S.end()}),f.on("error",function(p){S.error(p)}),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(f){var S=this._sources;if(!u.prototype.error.call(this,f))return!1;for(var p=0;p<S.length;p++)try{S[p].error(f)}catch{}return!0},w.prototype.lock=function(){u.prototype.lock.call(this);for(var f=this._sources,S=0;S<f.length;S++)f[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 g=new l(u.streamFiles,d,u.platform,u.encodeFileName),_=0;try{o.forEach(function(w,f){_++;var S=(function(h,E){var v=h||E,x=s[v];if(!x)throw new Error(v+" is not a valid compression method !");return x})(f.options.compression,u.compression),p=f.options.compressionOptions||u.compressionOptions||{},b=f.dir,m=f.date;f._compressWorker(S,p).withStreamInfo("file",{name:w,dir:b,date:m,comment:f.comment||"",unixPermissions:f.unixPermissions,dosPermissions:f.dosPermissions}).pipe(g)}),g.entriesCount=_}catch(w){g.error(w)}return g}},{"../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"),g=n("./nodejsUtils");function _(w){return new l.Promise(function(f,S){var p=w.decompressed.getContentWorker().pipe(new d);p.on("error",function(b){S(b)}).on("end",function(){p.streamInfo.crc32!==w.decompressed.crc32?S(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}r.exports=function(w,f){var S=this;return f=s.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),g.isNode&&g.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,f.optimizedBinaryString,f.base64).then(function(p){var b=new u(f);return b.load(p),b}).then(function(p){var b=[l.Promise.resolve(p)],m=p.files;if(f.checkCRC32)for(var h=0;h<m.length;h++)b.push(_(m[h]));return l.Promise.all(b)}).then(function(p){for(var b=p.shift(),m=b.files,h=0;h<m.length;h++){var E=m[h],v=E.fileNameStr,x=s.resolve(E.fileNameStr);S.file(x,E.decompressed,{binary:!0,optimizedBinaryString:!0,date:E.date,dir:E.dir,comment:E.fileCommentStr.length?E.fileCommentStr:null,unixPermissions:E.unixPermissions,dosPermissions:E.dosPermissions,createFolders:f.createFolders}),E.dir||(S.file(x).unsafeOriginalName=v)}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(g){d.push({data:g,meta:{percent:0}})}).on("error",function(g){d.isPaused?this.generatedError=g:d.error(g)}).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 g=this;o.on("data",function(_,w){g.push(_)||g._helper.pause(),d&&d(w)}).on("error",function(_){g.emit("error",_)}).on("end",function(){g.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(x,T,M){var F,D=o.getTypeOf(T),G=o.extend(M||{},g);G.date=G.date||new Date,G.compression!==null&&(G.compression=G.compression.toUpperCase()),typeof G.unixPermissions=="string"&&(G.unixPermissions=parseInt(G.unixPermissions,8)),G.unixPermissions&&16384&G.unixPermissions&&(G.dir=!0),G.dosPermissions&&16&G.dosPermissions&&(G.dir=!0),G.dir&&(x=m(x)),G.createFolders&&(F=b(x))&&h.call(this,F,!0);var te=D==="string"&&G.binary===!1&&G.base64===!1;M&&M.binary!==void 0||(G.binary=!te),(T instanceof _&&T.uncompressedSize===0||G.dir||!T||T.length===0)&&(G.base64=!1,G.binary=!0,T="",G.compression="STORE",D="string");var I=null;I=T instanceof _||T instanceof u?T:S.isNode&&S.isStream(T)?new p(x,T):o.prepareContent(x,T,G.binary,G.optimizedBinaryString,G.base64);var j=new w(x,I,G);this.files[x]=j}var l=n("./utf8"),o=n("./utils"),u=n("./stream/GenericWorker"),d=n("./stream/StreamHelper"),g=n("./defaults"),_=n("./compressedObject"),w=n("./zipObject"),f=n("./generate"),S=n("./nodejsUtils"),p=n("./nodejs/NodejsStreamInputAdapter"),b=function(x){x.slice(-1)==="/"&&(x=x.substring(0,x.length-1));var T=x.lastIndexOf("/");return 0<T?x.substring(0,T):""},m=function(x){return x.slice(-1)!=="/"&&(x+="/"),x},h=function(x,T){return T=T!==void 0?T:g.createFolders,x=m(x),this.files[x]||s.call(this,x,null,{dir:!0,createFolders:T}),this.files[x]};function E(x){return Object.prototype.toString.call(x)==="[object RegExp]"}var v={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(x){var T,M,F;for(T in this.files)F=this.files[T],(M=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&x(M,F)},filter:function(x){var T=[];return this.forEach(function(M,F){x(M,F)&&T.push(F)}),T},file:function(x,T,M){if(arguments.length!==1)return x=this.root+x,s.call(this,x,T,M),this;if(E(x)){var F=x;return this.filter(function(G,te){return!te.dir&&F.test(G)})}var D=this.files[this.root+x];return D&&!D.dir?D:null},folder:function(x){if(!x)return this;if(E(x))return this.filter(function(D,G){return G.dir&&x.test(D)});var T=this.root+x,M=h.call(this,T),F=this.clone();return F.root=M.name,F},remove:function(x){x=this.root+x;var T=this.files[x];if(T||(x.slice(-1)!=="/"&&(x+="/"),T=this.files[x]),T&&!T.dir)delete this.files[x];else for(var M=this.filter(function(D,G){return G.name.slice(0,x.length)===x}),F=0;F<M.length;F++)delete this.files[M[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(x){var T,M={};try{if((M=o.extend(x||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:l.utf8encode})).type=M.type.toLowerCase(),M.compression=M.compression.toUpperCase(),M.type==="binarystring"&&(M.type="string"),!M.type)throw new Error("No output type specified.");o.checkSupport(M.type),M.platform!=="darwin"&&M.platform!=="freebsd"&&M.platform!=="linux"&&M.platform!=="sunos"||(M.platform="UNIX"),M.platform==="win32"&&(M.platform="DOS");var F=M.comment||this.comment||"";T=f.generateWorker(this,M,F)}catch(D){(T=new u("error")).error(D)}return new d(T,M.type||"string",M.mimeType)},generateAsync:function(x,T){return this.generateInternalStream(x).accumulate(T)},generateNodeStream:function(x,T){return(x=x||{}).type||(x.type="nodebuffer"),this.generateInternalStream(x).toNodejsStream(T)}};r.exports=v},{"./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),g=o.charCodeAt(2),_=o.charCodeAt(3),w=this.length-4;0<=w;--w)if(this.data[w]===u&&this.data[w+1]===d&&this.data[w+2]===g&&this.data[w+3]===_)return w-this.zero;return-1},l.prototype.readAndCheckSignature=function(o){var u=o.charCodeAt(0),d=o.charCodeAt(1),g=o.charCodeAt(2),_=o.charCodeAt(3),w=this.readData(4);return u===w[0]&&d===w[1]&&g===w[2]&&_===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"),g=n("./Uint8ArrayReader");r.exports=function(_){var w=s.getTypeOf(_);return s.checkSupport(w),w!=="string"||l.uint8array?w==="nodebuffer"?new d(_):l.uint8array?new g(s.transformTo("uint8array",_)):new o(s.transformTo("array",_)):new u(_)}},{"../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(g){d.dataIsReady=!0,d.data=g,d.max=g&&g.length||0,d.type=s.getTypeOf(g),d.isPaused||d._tickAndRepeat()},function(g){d.error(g)})}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"),g=n("../external"),_=null;if(d.nodestream)try{_=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function w(S,p){return new g.Promise(function(b,m){var h=[],E=S._internalType,v=S._outputType,x=S._mimeType;S.on("data",function(T,M){h.push(T),p&&p(M)}).on("error",function(T){h=[],m(T)}).on("end",function(){try{var T=(function(M,F,D){switch(M){case"blob":return s.newBlob(s.transformTo("arraybuffer",F),D);case"base64":return u.encode(F);default:return s.transformTo(M,F)}})(v,(function(M,F){var D,G=0,te=null,I=0;for(D=0;D<F.length;D++)I+=F[D].length;switch(M){case"string":return F.join("");case"array":return Array.prototype.concat.apply([],F);case"uint8array":for(te=new Uint8Array(I),D=0;D<F.length;D++)te.set(F[D],G),G+=F[D].length;return te;case"nodebuffer":return Buffer.concat(F);default:throw new Error("concat : unsupported type '"+M+"'")}})(E,h),x);b(T)}catch(M){m(M)}h=[]}).resume()})}function f(S,p,b){var m=p;switch(p){case"blob":case"arraybuffer":m="uint8array";break;case"base64":m="string"}try{this._internalType=m,this._outputType=p,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)}}f.prototype={accumulate:function(S){return w(this,S)},on:function(S,p){var b=this;return S==="data"?this._worker.on(S,function(m){p.call(b,m.data,m.meta)}):this._worker.on(S,function(){s.delay(p,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 _(this,{objectMode:this._outputType!=="nodebuffer"},S)}},r.exports=f},{"../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),g=0;g<256;g++)d[g]=252<=g?6:248<=g?5:240<=g?4:224<=g?3:192<=g?2:1;d[254]=d[254]=1;function _(){u.call(this,"utf-8 decode"),this.leftOver=null}function w(){u.call(this,"utf-8 encode")}i.utf8encode=function(f){return l.nodebuffer?o.newBufferFrom(f,"utf-8"):(function(S){var p,b,m,h,E,v=S.length,x=0;for(h=0;h<v;h++)(64512&(b=S.charCodeAt(h)))==55296&&h+1<v&&(64512&(m=S.charCodeAt(h+1)))==56320&&(b=65536+(b-55296<<10)+(m-56320),h++),x+=b<128?1:b<2048?2:b<65536?3:4;for(p=l.uint8array?new Uint8Array(x):new Array(x),h=E=0;E<x;h++)(64512&(b=S.charCodeAt(h)))==55296&&h+1<v&&(64512&(m=S.charCodeAt(h+1)))==56320&&(b=65536+(b-55296<<10)+(m-56320),h++),b<128?p[E++]=b:(b<2048?p[E++]=192|b>>>6:(b<65536?p[E++]=224|b>>>12:(p[E++]=240|b>>>18,p[E++]=128|b>>>12&63),p[E++]=128|b>>>6&63),p[E++]=128|63&b);return p})(f)},i.utf8decode=function(f){return l.nodebuffer?s.transformTo("nodebuffer",f).toString("utf-8"):(function(S){var p,b,m,h,E=S.length,v=new Array(2*E);for(p=b=0;p<E;)if((m=S[p++])<128)v[b++]=m;else if(4<(h=d[m]))v[b++]=65533,p+=h-1;else{for(m&=h===2?31:h===3?15:7;1<h&&p<E;)m=m<<6|63&S[p++],h--;1<h?v[b++]=65533:m<65536?v[b++]=m:(m-=65536,v[b++]=55296|m>>10&1023,v[b++]=56320|1023&m)}return v.length!==b&&(v.subarray?v=v.subarray(0,b):v.length=b),s.applyFromCharCode(v)})(f=s.transformTo(l.uint8array?"uint8array":"array",f))},s.inherits(_,u),_.prototype.processChunk=function(f){var S=s.transformTo(l.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(l.uint8array){var p=S;(S=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),S.set(p,this.leftOver.length)}else S=this.leftOver.concat(S);this.leftOver=null}var b=(function(h,E){var v;for((E=E||h.length)>h.length&&(E=h.length),v=E-1;0<=v&&(192&h[v])==128;)v--;return v<0||v===0?E:v+d[h[v]]>E?v:E})(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:f.meta})},_.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=_,s.inherits(w,u),w.prototype.processChunk=function(f){this.push({data:i.utf8encode(f.data),meta:f.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(p){return p}function g(p,b){for(var m=0;m<p.length;++m)b[m]=255&p.charCodeAt(m);return b}n("setimmediate"),i.newBlob=function(p,b){i.checkSupport("blob");try{return new Blob([p],{type:b})}catch{try{var m=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return m.append(p),m.getBlob(b)}catch{throw new Error("Bug : can't construct the Blob.")}}};var _={stringifyByChunk:function(p,b,m){var h=[],E=0,v=p.length;if(v<=m)return String.fromCharCode.apply(null,p);for(;E<v;)b==="array"||b==="nodebuffer"?h.push(String.fromCharCode.apply(null,p.slice(E,Math.min(E+m,v)))):h.push(String.fromCharCode.apply(null,p.subarray(E,Math.min(E+m,v)))),E+=m;return h.join("")},stringifyByChar:function(p){for(var b="",m=0;m<p.length;m++)b+=String.fromCharCode(p[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(p){var b=65536,m=i.getTypeOf(p),h=!0;if(m==="uint8array"?h=_.applyCanBeUsed.uint8array:m==="nodebuffer"&&(h=_.applyCanBeUsed.nodebuffer),h)for(;1<b;)try{return _.stringifyByChunk(p,m,b)}catch{b=Math.floor(b/2)}return _.stringifyByChar(p)}function f(p,b){for(var m=0;m<p.length;m++)b[m]=p[m];return b}i.applyFromCharCode=w;var S={};S.string={string:d,array:function(p){return g(p,new Array(p.length))},arraybuffer:function(p){return S.string.uint8array(p).buffer},uint8array:function(p){return g(p,new Uint8Array(p.length))},nodebuffer:function(p){return g(p,o.allocBuffer(p.length))}},S.array={string:w,array:d,arraybuffer:function(p){return new Uint8Array(p).buffer},uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return o.newBufferFrom(p)}},S.arraybuffer={string:function(p){return w(new Uint8Array(p))},array:function(p){return f(new Uint8Array(p),new Array(p.byteLength))},arraybuffer:d,uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return o.newBufferFrom(new Uint8Array(p))}},S.uint8array={string:w,array:function(p){return f(p,new Array(p.length))},arraybuffer:function(p){return p.buffer},uint8array:d,nodebuffer:function(p){return o.newBufferFrom(p)}},S.nodebuffer={string:w,array:function(p){return f(p,new Array(p.length))},arraybuffer:function(p){return S.nodebuffer.uint8array(p).buffer},uint8array:function(p){return f(p,new Uint8Array(p.length))},nodebuffer:d},i.transformTo=function(p,b){if(b=b||"",!p)return b;i.checkSupport(p);var m=i.getTypeOf(b);return S[m][p](b)},i.resolve=function(p){for(var b=p.split("/"),m=[],h=0;h<b.length;h++){var E=b[h];E==="."||E===""&&h!==0&&h!==b.length-1||(E===".."?m.pop():m.push(E))}return m.join("/")},i.getTypeOf=function(p){return typeof p=="string"?"string":Object.prototype.toString.call(p)==="[object Array]"?"array":s.nodebuffer&&o.isBuffer(p)?"nodebuffer":s.uint8array&&p instanceof Uint8Array?"uint8array":s.arraybuffer&&p instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(p){if(!s[p.toLowerCase()])throw new Error(p+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(p){var b,m,h="";for(m=0;m<(p||"").length;m++)h+="\\x"+((b=p.charCodeAt(m))<16?"0":"")+b.toString(16).toUpperCase();return h},i.delay=function(p,b,m){setImmediate(function(){p.apply(m||null,b||[])})},i.inherits=function(p,b){function m(){}m.prototype=b.prototype,p.prototype=new m},i.extend=function(){var p,b,m={};for(p=0;p<arguments.length;p++)for(b in arguments[p])Object.prototype.hasOwnProperty.call(arguments[p],b)&&m[b]===void 0&&(m[b]=arguments[p][b]);return m},i.prepareContent=function(p,b,m,h,E){return u.Promise.resolve(b).then(function(v){return s.blob&&(v instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(v))!==-1)&&typeof FileReader<"u"?new u.Promise(function(x,T){var M=new FileReader;M.onload=function(F){x(F.target.result)},M.onerror=function(F){T(F.target.error)},M.readAsArrayBuffer(v)}):v}).then(function(v){var x=i.getTypeOf(v);return x?(x==="arraybuffer"?v=i.transformTo("uint8array",v):x==="string"&&(E?v=l.decode(v):m&&h!==!0&&(v=(function(T){return g(T,s.uint8array?new Uint8Array(T.length):new Array(T.length))})(v))),v):u.Promise.reject(new Error("Can't read the data of '"+p+"'. 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(_){if(!this.reader.readAndCheckSignature(_)){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(_)+")")}},isSignature:function(_,w){var f=this.reader.index;this.reader.setIndex(_);var S=this.reader.readString(4)===w;return this.reader.setIndex(f),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 _=this.reader.readData(this.zipCommentLength),w=d.uint8array?"uint8array":"array",f=l.transformTo(w,_);this.zipComment=this.loadOptions.decodeFileName(f)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var _,w,f,S=this.zip64EndOfCentralSize-44;0<S;)_=this.reader.readInt(2),w=this.reader.readInt(4),f=this.reader.readData(w),this.zip64ExtensibleData[_]={id:_,length:w,value:f}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var _,w;for(_=0;_<this.files.length;_++)w=this.files[_],this.reader.setIndex(w.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),w.readLocalPart(this.reader),w.handleUTF8(),w.processAttributes()},readCentralDir:function(){var _;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(_=new u({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(_);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var _=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(_<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(_);var w=_;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,(_=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(_),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 f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var S=w-f;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(_){this.reader=s(_)},load:function(_){this.prepareReader(_),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=g},{"./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"),g=n("./compressions"),_=n("./support");function w(f,S){this.options=f,this.loadOptions=S}w.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var S,p;if(f.skip(22),this.fileNameLength=f.readInt(2),p=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.skip(p),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 g)if(Object.prototype.hasOwnProperty.call(g,m)&&g[m].magic===b)return g[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,f.readData(this.compressedSize))},readCentralPart:function(f){this.versionMadeBy=f.readInt(2),f.skip(2),this.bitFlag=f.readInt(2),this.compressionMethod=f.readString(2),this.date=f.readDate(),this.crc32=f.readInt(4),this.compressedSize=f.readInt(4),this.uncompressedSize=f.readInt(4);var S=f.readInt(2);if(this.extraFieldsLength=f.readInt(2),this.fileCommentLength=f.readInt(2),this.diskNumberStart=f.readInt(2),this.internalFileAttributes=f.readInt(2),this.externalFileAttributes=f.readInt(4),this.localHeaderOffset=f.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");f.skip(S),this.readExtraFields(f),this.parseZIP64ExtraField(f),this.fileComment=f.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var f=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=s(this.extraFields[1].value);this.uncompressedSize===l.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===l.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===l.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===l.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var S,p,b,m=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<m;)S=f.readInt(2),p=f.readInt(2),b=f.readData(p),this.extraFields[S]={id:S,length:p,value:b};f.setIndex(m)},handleUTF8:function(){var f=_.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 p=l.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(p)}var b=this.findExtraFieldUnicodeComment();if(b!==null)this.fileCommentStr=b;else{var m=l.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(m)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var S=s(f.value);return S.readInt(1)!==1||u(this.fileName)!==S.readInt(4)?null:d.utf8decode(S.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var S=s(f.value);return S.readInt(1)!==1||u(this.fileComment)!==S.readInt(4)?null:d.utf8decode(S.readData(f.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,p,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=p,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"),g=n("./stream/GenericWorker");s.prototype={internalStream:function(S){var p=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"),p=this._decompressWorker();var h=!this._dataBinary;h&&!m&&(p=p.pipe(new u.Utf8EncodeWorker)),!h&&m&&(p=p.pipe(new u.Utf8DecodeWorker))}catch(E){(p=new g("error")).error(E)}return new l(p,b,"")},async:function(S,p){return this.internalStream(S).accumulate(p)},nodeStream:function(S,p){return this.internalStream(S||"nodebuffer").toNodejsStream(p)},_compressWorker:function(S,p){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,p)},_decompressWorker:function(){return this._data instanceof d?this._data.getContentWorker():this._data instanceof g?this._data:new o(this._data)}};for(var _=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],w=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<_.length;f++)s.prototype[_[f]]=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,g=new u(S),_=s.document.createTextNode("");g.observe(_,{characterData:!0}),l=function(){_.data=d=++d%2}}else if(s.setImmediate||s.MessageChannel===void 0)l="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var p=s.document.createElement("script");p.onreadystatechange=function(){S(),p.onreadystatechange=null,p.parentNode.removeChild(p),p=null},s.document.documentElement.appendChild(p)}:function(){setTimeout(S,0)};else{var w=new s.MessageChannel;w.port1.onmessage=S,l=function(){w.port2.postMessage(0)}}var f=[];function S(){var p,b;o=!0;for(var m=f.length;m;){for(b=f,f=[],p=-1;++p<m;)b[p]();m=f.length}o=!1}r.exports=function(p){f.push(p)!==1||o||l()}}).call(this,typeof ot<"u"?ot: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"],g=["PENDING"];function _(m){if(typeof m!="function")throw new TypeError("resolver must be a function");this.state=g,this.queue=[],this.outcome=void 0,m!==l&&p(this,m)}function w(m,h,E){this.promise=m,typeof h=="function"&&(this.onFulfilled=h,this.callFulfilled=this.otherCallFulfilled),typeof E=="function"&&(this.onRejected=E,this.callRejected=this.otherCallRejected)}function f(m,h,E){s(function(){var v;try{v=h(E)}catch(x){return o.reject(m,x)}v===m?o.reject(m,new TypeError("Cannot resolve promise with itself")):o.resolve(m,v)})}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 p(m,h){var E=!1;function v(M){E||(E=!0,o.reject(m,M))}function x(M){E||(E=!0,o.resolve(m,M))}var T=b(function(){h(x,v)});T.status==="error"&&v(T.value)}function b(m,h){var E={};try{E.value=m(h),E.status="success"}catch(v){E.status="error",E.value=v}return E}(r.exports=_).prototype.finally=function(m){if(typeof m!="function")return this;var h=this.constructor;return this.then(function(E){return h.resolve(m()).then(function(){return E})},function(E){return h.resolve(m()).then(function(){throw E})})},_.prototype.catch=function(m){return this.then(null,m)},_.prototype.then=function(m,h){if(typeof m!="function"&&this.state===d||typeof h!="function"&&this.state===u)return this;var E=new this.constructor(l);return this.state!==g?f(E,this.state===d?m:h,this.outcome):this.queue.push(new w(E,m,h)),E},w.prototype.callFulfilled=function(m){o.resolve(this.promise,m)},w.prototype.otherCallFulfilled=function(m){f(this.promise,this.onFulfilled,m)},w.prototype.callRejected=function(m){o.reject(this.promise,m)},w.prototype.otherCallRejected=function(m){f(this.promise,this.onRejected,m)},o.resolve=function(m,h){var E=b(S,h);if(E.status==="error")return o.reject(m,E.value);var v=E.value;if(v)p(m,v);else{m.state=d,m.outcome=h;for(var x=-1,T=m.queue.length;++x<T;)m.queue[x].callFulfilled(h)}return m},o.reject=function(m,h){m.state=u,m.outcome=h;for(var E=-1,v=m.queue.length;++E<v;)m.queue[E].callRejected(h);return m},_.resolve=function(m){return m instanceof this?m:o.resolve(new this(l),m)},_.reject=function(m){var h=new this(l);return o.reject(h,m)},_.all=function(m){var h=this;if(Object.prototype.toString.call(m)!=="[object Array]")return this.reject(new TypeError("must be an array"));var E=m.length,v=!1;if(!E)return this.resolve([]);for(var x=new Array(E),T=0,M=-1,F=new this(l);++M<E;)D(m[M],M);return F;function D(G,te){h.resolve(G).then(function(I){x[te]=I,++T!==E||v||(v=!0,o.resolve(F,x))},function(I){v||(v=!0,o.reject(F,I))})}},_.race=function(m){var h=this;if(Object.prototype.toString.call(m)!=="[object Array]")return this.reject(new TypeError("must be an array"));var E=m.length,v=!1;if(!E)return this.resolve([]);for(var x=-1,T=new this(l);++x<E;)M=m[x],h.resolve(M).then(function(F){v||(v=!0,o.resolve(T,F))},function(F){v||(v=!0,o.reject(T,F))});var M;return T}},{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"),g=Object.prototype.toString,_=0,w=-1,f=0,S=8;function p(m){if(!(this instanceof p))return new p(m);this.options=l.assign({level:w,method:S,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,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 E=s.deflateInit2(this.strm,h.level,h.method,h.windowBits,h.memLevel,h.strategy);if(E!==_)throw new Error(u[E]);if(h.header&&s.deflateSetHeader(this.strm,h.header),h.dictionary){var v;if(v=typeof h.dictionary=="string"?o.string2buf(h.dictionary):g.call(h.dictionary)==="[object ArrayBuffer]"?new Uint8Array(h.dictionary):h.dictionary,(E=s.deflateSetDictionary(this.strm,v))!==_)throw new Error(u[E]);this._dict_set=!0}}function b(m,h){var E=new p(h);if(E.push(m,!0),E.err)throw E.msg||u[E.err];return E.result}p.prototype.push=function(m,h){var E,v,x=this.strm,T=this.options.chunkSize;if(this.ended)return!1;v=h===~~h?h:h===!0?4:0,typeof m=="string"?x.input=o.string2buf(m):g.call(m)==="[object ArrayBuffer]"?x.input=new Uint8Array(m):x.input=m,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new l.Buf8(T),x.next_out=0,x.avail_out=T),(E=s.deflate(x,v))!==1&&E!==_)return this.onEnd(E),!(this.ended=!0);x.avail_out!==0&&(x.avail_in!==0||v!==4&&v!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(l.shrinkBuf(x.output,x.next_out))):this.onData(l.shrinkBuf(x.output,x.next_out)))}while((0<x.avail_in||x.avail_out===0)&&E!==1);return v===4?(E=s.deflateEnd(this.strm),this.onEnd(E),this.ended=!0,E===_):v!==2||(this.onEnd(_),!(x.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===_&&(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=p,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"),g=n("./zlib/zstream"),_=n("./zlib/gzheader"),w=Object.prototype.toString;function f(p){if(!(this instanceof f))return new f(p);this.options=l.assign({chunkSize:16384,windowBits:0,to:""},p||{});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)||p&&p.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 g,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 _,s.inflateGetHeader(this.strm,this.header)}function S(p,b){var m=new f(b);if(m.push(p,!0),m.err)throw m.msg||d[m.err];return m.result}f.prototype.push=function(p,b){var m,h,E,v,x,T,M=this.strm,F=this.options.chunkSize,D=this.options.dictionary,G=!1;if(this.ended)return!1;h=b===~~b?b:b===!0?u.Z_FINISH:u.Z_NO_FLUSH,typeof p=="string"?M.input=o.binstring2buf(p):w.call(p)==="[object ArrayBuffer]"?M.input=new Uint8Array(p):M.input=p,M.next_in=0,M.avail_in=M.input.length;do{if(M.avail_out===0&&(M.output=new l.Buf8(F),M.next_out=0,M.avail_out=F),(m=s.inflate(M,u.Z_NO_FLUSH))===u.Z_NEED_DICT&&D&&(T=typeof D=="string"?o.string2buf(D):w.call(D)==="[object ArrayBuffer]"?new Uint8Array(D):D,m=s.inflateSetDictionary(this.strm,T)),m===u.Z_BUF_ERROR&&G===!0&&(m=u.Z_OK,G=!1),m!==u.Z_STREAM_END&&m!==u.Z_OK)return this.onEnd(m),!(this.ended=!0);M.next_out&&(M.avail_out!==0&&m!==u.Z_STREAM_END&&(M.avail_in!==0||h!==u.Z_FINISH&&h!==u.Z_SYNC_FLUSH)||(this.options.to==="string"?(E=o.utf8border(M.output,M.next_out),v=M.next_out-E,x=o.buf2string(M.output,E),M.next_out=v,M.avail_out=F-v,v&&l.arraySet(M.output,M.output,E,v,0),this.onData(x)):this.onData(l.shrinkBuf(M.output,M.next_out)))),M.avail_in===0&&M.avail_out===0&&(G=!0)}while((0<M.avail_in||M.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),!(M.avail_out=0))},f.prototype.onData=function(p){this.chunks.push(p)},f.prototype.onEnd=function(p){p===u.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=l.flattenChunks(this.chunks)),this.chunks=[],this.err=p,this.msg=this.strm.msg},i.Inflate=f,i.inflate=S,i.inflateRaw=function(p,b){return(b=b||{}).raw=!0,S(p,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 g=d.shift();if(g){if(typeof g!="object")throw new TypeError(g+"must be non-object");for(var _ in g)g.hasOwnProperty(_)&&(u[_]=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,g+_),w);else for(var f=0;f<_;f++)u[w+f]=d[g+f]},flattenChunks:function(u){var d,g,_,w,f,S;for(d=_=0,g=u.length;d<g;d++)_+=u[d].length;for(S=new Uint8Array(_),d=w=0,g=u.length;d<g;d++)f=u[d],S.set(f,w),w+=f.length;return S}},o={arraySet:function(u,d,g,_,w){for(var f=0;f<_;f++)u[w+f]=d[g+f]},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&&(_.subarray&&o||!_.subarray&&l))return String.fromCharCode.apply(null,s.shrinkBuf(_,w));for(var f="",S=0;S<w;S++)f+=String.fromCharCode(_[S]);return f}u[254]=u[254]=1,i.string2buf=function(_){var w,f,S,p,b,m=_.length,h=0;for(p=0;p<m;p++)(64512&(f=_.charCodeAt(p)))==55296&&p+1<m&&(64512&(S=_.charCodeAt(p+1)))==56320&&(f=65536+(f-55296<<10)+(S-56320),p++),h+=f<128?1:f<2048?2:f<65536?3:4;for(w=new s.Buf8(h),p=b=0;b<h;p++)(64512&(f=_.charCodeAt(p)))==55296&&p+1<m&&(64512&(S=_.charCodeAt(p+1)))==56320&&(f=65536+(f-55296<<10)+(S-56320),p++),f<128?w[b++]=f:(f<2048?w[b++]=192|f>>>6:(f<65536?w[b++]=224|f>>>12:(w[b++]=240|f>>>18,w[b++]=128|f>>>12&63),w[b++]=128|f>>>6&63),w[b++]=128|63&f);return w},i.buf2binstring=function(_){return g(_,_.length)},i.binstring2buf=function(_){for(var w=new s.Buf8(_.length),f=0,S=w.length;f<S;f++)w[f]=_.charCodeAt(f);return w},i.buf2string=function(_,w){var f,S,p,b,m=w||_.length,h=new Array(2*m);for(f=S=0;f<m;)if((p=_[f++])<128)h[S++]=p;else if(4<(b=u[p]))h[S++]=65533,f+=b-1;else{for(p&=b===2?31:b===3?15:7;1<b&&f<m;)p=p<<6|63&_[f++],b--;1<b?h[S++]=65533:p<65536?h[S++]=p:(p-=65536,h[S++]=55296|p>>10&1023,h[S++]=56320|1023&p)}return g(h,S)},i.utf8border=function(_,w){var f;for((w=w||_.length)>_.length&&(w=_.length),f=w-1;0<=f&&(192&_[f])==128;)f--;return f<0||f===0?w:f+u[_[f]]>w?f:w}},{"./common":41}],43:[function(n,r,i){r.exports=function(s,l,o,u){for(var d=65535&s|0,g=s>>>16&65535|0,_=0;o!==0;){for(o-=_=2e3<o?2e3:o;g=g+(d=d+l[u++]|0)|0,--_;);d%=65521,g%=65521}return d|g<<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 g=s,_=d+u;l^=-1;for(var w=d;w<_;w++)l=l>>>8^g[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"),g=n("./messages"),_=0,w=4,f=0,S=-2,p=-1,b=4,m=2,h=8,E=9,v=286,x=30,T=19,M=2*v+1,F=15,D=3,G=258,te=G+D+1,I=42,j=113,c=1,U=2,N=3,z=4;function q(a,$){return a.msg=g[$],$}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,P=$.pending;P>a.avail_out&&(P=a.avail_out),P!==0&&(l.arraySet(a.output,$.pending_buf,$.pending_out,P,a.next_out),a.next_out+=P,$.pending_out+=P,a.total_out+=P,a.avail_out-=P,$.pending-=P,$.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 V(a,$){a.pending_buf[a.pending++]=$>>>8&255,a.pending_buf[a.pending++]=255&$}function W(a,$){var P,O,y=a.max_chain_length,k=a.strstart,H=a.prev_length,Z=a.nice_match,C=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+G,de=X[k+H-1],ue=X[k+H];a.prev_length>=a.good_match&&(y>>=2),Z>a.lookahead&&(Z=a.lookahead);do if(X[(P=$)+H]===ue&&X[P+H-1]===de&&X[P]===X[k]&&X[++P]===X[k+1]){k+=2,P++;do;while(X[++k]===X[++P]&&X[++k]===X[++P]&&X[++k]===X[++P]&&X[++k]===X[++P]&&X[++k]===X[++P]&&X[++k]===X[++P]&&X[++k]===X[++P]&&X[++k]===X[++P]&&k<ne);if(O=G-(ne-k),k=ne-G,H<O){if(a.match_start=$,Z<=(H=O))break;de=X[k+H-1],ue=X[k+H]}}while(($=K[$&Q])>C&&--y!=0);return H<=a.lookahead?H:a.lookahead}function ae(a){var $,P,O,y,k,H,Z,C,X,Q,K=a.w_size;do{if(y=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,$=P=a.hash_size;O=a.head[--$],a.head[$]=K<=O?O-K:0,--P;);for($=P=K;O=a.prev[--$],a.prev[$]=K<=O?O-K:0,--P;);y+=K}if(a.strm.avail_in===0)break;if(H=a.strm,Z=a.window,C=a.strstart+a.lookahead,X=y,Q=void 0,Q=H.avail_in,X<Q&&(Q=X),P=Q===0?0:(H.avail_in-=Q,l.arraySet(Z,H.input,H.next_in,Q,C),H.state.wrap===1?H.adler=u(H.adler,Z,Q,C):H.state.wrap===2&&(H.adler=d(H.adler,Z,Q,C)),H.next_in+=Q,H.total_in+=Q,Q),a.lookahead+=P,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 P,O;;){if(a.lookahead<te){if(ae(a),a.lookahead<te&&$===_)return c;if(a.lookahead===0)break}if(P=0,a.lookahead>=D&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+D-1])&a.hash_mask,P=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),P!==0&&a.strstart-P<=a.w_size-te&&(a.match_length=W(a,P)),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,P=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:z):a.last_lit&&(R(a,!1),a.strm.avail_out===0)?c:U}function re(a,$){for(var P,O,y;;){if(a.lookahead<te){if(ae(a),a.lookahead<te&&$===_)return c;if(a.lookahead===0)break}if(P=0,a.lookahead>=D&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+D-1])&a.hash_mask,P=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,P!==0&&a.prev_length<a.max_lazy_match&&a.strstart-P<=a.w_size-te&&(a.match_length=W(a,P),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(y=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<=y&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+D-1])&a.hash_mask,P=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:z):a.last_lit&&(R(a,!1),a.strm.avail_out===0)?c:U}function se(a,$,P,O,y){this.good_length=a,this.max_lazy=$,this.nice_length=P,this.max_chain=O,this.func=y}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*M),this.dyn_dtree=new l.Buf16(2*(2*x+1)),this.bl_tree=new l.Buf16(2*(2*T+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*v+1),J(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new l.Buf16(2*v+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?I:j,a.adler=$.wrap===2?0:1,$.last_flush=_,o._tr_init($),f):q(a,S)}function fe(a){var $=pe(a);return $===f&&(function(P){P.window_size=2*P.w_size,J(P.head),P.max_lazy_match=s[P.level].max_lazy,P.good_match=s[P.level].good_length,P.nice_match=s[P.level].nice_length,P.max_chain_length=s[P.level].max_chain,P.strstart=0,P.block_start=0,P.lookahead=0,P.insert=0,P.match_length=P.prev_length=D-1,P.match_available=0,P.ins_h=0})(a.state),$}function ge(a,$,P,O,y,k){if(!a)return S;var H=1;if($===p&&($=6),O<0?(H=0,O=-O):15<O&&(H=2,O-=16),y<1||E<y||P!==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=y+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<<y+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=P,fe(a)}s=[new se(0,0,0,0,function(a,$){var P=65535;for(P>a.pending_buf_size-5&&(P=a.pending_buf_size-5);;){if(a.lookahead<=1){if(ae(a),a.lookahead===0&&$===_)return c;if(a.lookahead===0)break}a.strstart+=a.lookahead,a.lookahead=0;var O=a.block_start+P;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:z):(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=$,f):S},i.deflate=function(a,$){var P,O,y,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,P=O.last_flush,O.last_flush=$,O.status===I)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,V(O,H),O.strstart!==0&&(V(O,a.adler>>>16),V(O,65535&a.adler)),a.adler=1}if(O.status===69)if(O.gzhead.extra){for(y=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>y&&(a.adler=d(a.adler,O.pending_buf,O.pending-y,y)),A(a),y=O.pending,O.pending!==O.pending_buf_size));)Y(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>y&&(a.adler=d(a.adler,O.pending_buf,O.pending-y,y)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){y=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>y&&(a.adler=d(a.adler,O.pending_buf,O.pending-y,y)),A(a),y=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>y&&(a.adler=d(a.adler,O.pending_buf,O.pending-y,y)),k===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){y=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>y&&(a.adler=d(a.adler,O.pending_buf,O.pending-y,y)),A(a),y=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>y&&(a.adler=d(a.adler,O.pending_buf,O.pending-y,y)),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,f}else if(a.avail_in===0&&B($)<=B(P)&&$!==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||$!==_&&O.status!==666){var Z=O.strategy===2?(function(C,X){for(var Q;;){if(C.lookahead===0&&(ae(C),C.lookahead===0)){if(X===_)return c;break}if(C.match_length=0,Q=o._tr_tally(C,0,C.window[C.strstart]),C.lookahead--,C.strstart++,Q&&(R(C,!1),C.strm.avail_out===0))return c}return C.insert=0,X===w?(R(C,!0),C.strm.avail_out===0?N:z):C.last_lit&&(R(C,!1),C.strm.avail_out===0)?c:U})(O,$):O.strategy===3?(function(C,X){for(var Q,K,ne,de,ue=C.window;;){if(C.lookahead<=G){if(ae(C),C.lookahead<=G&&X===_)return c;if(C.lookahead===0)break}if(C.match_length=0,C.lookahead>=D&&0<C.strstart&&(K=ue[ne=C.strstart-1])===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]){de=C.strstart+G;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);C.match_length=G-(de-ne),C.match_length>C.lookahead&&(C.match_length=C.lookahead)}if(C.match_length>=D?(Q=o._tr_tally(C,1,C.match_length-D),C.lookahead-=C.match_length,C.strstart+=C.match_length,C.match_length=0):(Q=o._tr_tally(C,0,C.window[C.strstart]),C.lookahead--,C.strstart++),Q&&(R(C,!1),C.strm.avail_out===0))return c}return C.insert=0,X===w?(R(C,!0),C.strm.avail_out===0?N:z):C.last_lit&&(R(C,!1),C.strm.avail_out===0)?c:U})(O,$):s[O.level].func(O,$);if(Z!==N&&Z!==z||(O.status=666),Z===c||Z===N)return a.avail_out===0&&(O.last_flush=-1),f;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,f}return $!==w?f: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)):(V(O,a.adler>>>16),V(O,65535&a.adler)),A(a),0<O.wrap&&(O.wrap=-O.wrap),O.pending!==0?f:1)},i.deflateEnd=function(a){var $;return a&&a.state?($=a.state.status)!==I&&$!==69&&$!==73&&$!==91&&$!==103&&$!==j&&$!==666?q(a,S):(a.state=null,$===j?q(a,-3):f):S},i.deflateSetDictionary=function(a,$){var P,O,y,k,H,Z,C,X,Q=$.length;if(!a||!a.state||(k=(P=a.state).wrap)===2||k===1&&P.status!==I||P.lookahead)return S;for(k===1&&(a.adler=u(a.adler,$,Q,0)),P.wrap=0,Q>=P.w_size&&(k===0&&(J(P.head),P.strstart=0,P.block_start=0,P.insert=0),X=new l.Buf8(P.w_size),l.arraySet(X,$,Q-P.w_size,P.w_size,0),$=X,Q=P.w_size),H=a.avail_in,Z=a.next_in,C=a.input,a.avail_in=Q,a.next_in=0,a.input=$,ae(P);P.lookahead>=D;){for(O=P.strstart,y=P.lookahead-(D-1);P.ins_h=(P.ins_h<<P.hash_shift^P.window[O+D-1])&P.hash_mask,P.prev[O&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=O,O++,--y;);P.strstart=O,P.lookahead=D-1,ae(P)}return P.strstart+=P.lookahead,P.block_start=P.strstart,P.insert=P.lookahead,P.lookahead=0,P.match_length=P.prev_length=D-1,P.match_available=0,a.next_in=Z,a.input=C,a.avail_in=H,P.wrap=k,f},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,f,S,p,b,m,h,E,v,x,T,M,F,D,G,te,I,j,c,U;o=s.state,u=s.next_in,c=s.input,d=u+(s.avail_in-5),g=s.next_out,U=s.output,_=g-(l-s.avail_out),w=g+(s.avail_out-257),f=o.dmax,S=o.wsize,p=o.whave,b=o.wnext,m=o.window,h=o.hold,E=o.bits,v=o.lencode,x=o.distcode,T=(1<<o.lenbits)-1,M=(1<<o.distbits)-1;e:do{E<15&&(h+=c[u++]<<E,E+=8,h+=c[u++]<<E,E+=8),F=v[h&T];t:for(;;){if(h>>>=D=F>>>24,E-=D,(D=F>>>16&255)===0)U[g++]=65535&F;else{if(!(16&D)){if((64&D)==0){F=v[(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}G=65535&F,(D&=15)&&(E<D&&(h+=c[u++]<<E,E+=8),G+=h&(1<<D)-1,h>>>=D,E-=D),E<15&&(h+=c[u++]<<E,E+=8,h+=c[u++]<<E,E+=8),F=x[h&M];n:for(;;){if(h>>>=D=F>>>24,E-=D,!(16&(D=F>>>16&255))){if((64&D)==0){F=x[(65535&F)+(h&(1<<D)-1)];continue n}s.msg="invalid distance code",o.mode=30;break e}if(te=65535&F,E<(D&=15)&&(h+=c[u++]<<E,(E+=8)<D&&(h+=c[u++]<<E,E+=8)),f<(te+=h&(1<<D)-1)){s.msg="invalid distance too far back",o.mode=30;break e}if(h>>>=D,E-=D,(D=g-_)<te){if(p<(D=te-D)&&o.sane){s.msg="invalid distance too far back",o.mode=30;break e}if(j=m,(I=0)===b){if(I+=S-D,D<G){for(G-=D;U[g++]=m[I++],--D;);I=g-te,j=U}}else if(b<D){if(I+=S+b-D,(D-=b)<G){for(G-=D;U[g++]=m[I++],--D;);if(I=0,b<G){for(G-=D=b;U[g++]=m[I++],--D;);I=g-te,j=U}}}else if(I+=b-D,D<G){for(G-=D;U[g++]=m[I++],--D;);I=g-te,j=U}for(;2<G;)U[g++]=j[I++],U[g++]=j[I++],U[g++]=j[I++],G-=3;G&&(U[g++]=j[I++],1<G&&(U[g++]=j[I++]))}else{for(I=g-te;U[g++]=U[I++],U[g++]=U[I++],U[g++]=U[I++],2<(G-=3););G&&(U[g++]=U[I++],1<G&&(U[g++]=U[I++]))}break}}break}}while(u<d&&g<w);u-=G=E>>3,h&=(1<<(E-=G<<3))-1,s.next_in=u,s.next_out=g,s.avail_in=u<d?d-u+5:5-(u-d),s.avail_out=g<w?w-g+257:257-(g-w),o.hold=h,o.bits=E}},{}],49:[function(n,r,i){var s=n("../utils/common"),l=n("./adler32"),o=n("./crc32"),u=n("./inffast"),d=n("./inftrees"),g=1,_=2,w=0,f=-2,S=1,p=852,b=592;function m(I){return(I>>>24&255)+(I>>>8&65280)+((65280&I)<<8)+((255&I)<<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 E(I){var j;return I&&I.state?(j=I.state,I.total_in=I.total_out=j.total=0,I.msg="",j.wrap&&(I.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(p),j.distcode=j.distdyn=new s.Buf32(b),j.sane=1,j.back=-1,w):f}function v(I){var j;return I&&I.state?((j=I.state).wsize=0,j.whave=0,j.wnext=0,E(I)):f}function x(I,j){var c,U;return I&&I.state?(U=I.state,j<0?(c=0,j=-j):(c=1+(j>>4),j<48&&(j&=15)),j&&(j<8||15<j)?f:(U.window!==null&&U.wbits!==j&&(U.window=null),U.wrap=c,U.wbits=j,v(I))):f}function T(I,j){var c,U;return I?(U=new h,(I.state=U).window=null,(c=x(I,j))!==w&&(I.state=null),c):f}var M,F,D=!0;function G(I){if(D){var j;for(M=new s.Buf32(512),F=new s.Buf32(32),j=0;j<144;)I.lens[j++]=8;for(;j<256;)I.lens[j++]=9;for(;j<280;)I.lens[j++]=7;for(;j<288;)I.lens[j++]=8;for(d(g,I.lens,0,288,M,0,I.work,{bits:9}),j=0;j<32;)I.lens[j++]=5;d(_,I.lens,0,32,F,0,I.work,{bits:5}),D=!1}I.lencode=M,I.lenbits=9,I.distcode=F,I.distbits=5}function te(I,j,c,U){var N,z=I.state;return z.window===null&&(z.wsize=1<<z.wbits,z.wnext=0,z.whave=0,z.window=new s.Buf8(z.wsize)),U>=z.wsize?(s.arraySet(z.window,j,c-z.wsize,z.wsize,0),z.wnext=0,z.whave=z.wsize):(U<(N=z.wsize-z.wnext)&&(N=U),s.arraySet(z.window,j,c-U,N,z.wnext),(U-=N)?(s.arraySet(z.window,j,c-U,U,0),z.wnext=U,z.whave=z.wsize):(z.wnext+=N,z.wnext===z.wsize&&(z.wnext=0),z.whave<z.wsize&&(z.whave+=N))),0}i.inflateReset=v,i.inflateReset2=x,i.inflateResetKeep=E,i.inflateInit=function(I){return T(I,15)},i.inflateInit2=T,i.inflate=function(I,j){var c,U,N,z,q,B,J,A,R,Y,V,W,ae,ie,re,se,ce,pe,fe,ge,a,$,P,O,y=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(!I||!I.state||!I.output||!I.input&&I.avail_in!==0)return f;(c=I.state).mode===12&&(c.mode=13),q=I.next_out,N=I.output,J=I.avail_out,z=I.next_in,U=I.input,B=I.avail_in,A=c.hold,R=c.bits,Y=B,V=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[z++]<<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){I.msg="incorrect header check",c.mode=30;break}if((15&A)!=8){I.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){I.msg="invalid window size",c.mode=30;break}c.dmax=1<<a,I.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[z++]<<R,R+=8}if(c.flags=A,(255&c.flags)!=8){I.msg="unknown compression method",c.mode=30;break}if(57344&c.flags){I.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[z++]<<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[z++]<<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[z++]<<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,z,W,a)),512&c.flags&&(c.check=o(c.check,U,W,z)),B-=W,z+=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[z+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,z)),B-=W,z+=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[z+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,z)),B-=W,z+=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[z++]<<R,R+=8}if(A!==(65535&c.check)){I.msg="header crc mismatch",c.mode=30;break}R=A=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0),I.adler=c.check=0,c.mode=12;break;case 10:for(;R<32;){if(B===0)break e;B--,A+=U[z++]<<R,R+=8}I.adler=c.check=m(A),R=A=0,c.mode=11;case 11:if(c.havedict===0)return I.next_out=q,I.avail_out=J,I.next_in=z,I.avail_in=B,c.hold=A,c.bits=R,2;I.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[z++]<<R,R+=8}switch(c.last=1&A,R-=1,3&(A>>>=1)){case 0:c.mode=14;break;case 1:if(G(c),c.mode=20,j!==6)break;A>>>=2,R-=2;break e;case 2:c.mode=17;break;case 3:I.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[z++]<<R,R+=8}if((65535&A)!=(A>>>16^65535)){I.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,z,W,q),B-=W,z+=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[z++]<<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){I.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[z++]<<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,P={bits:c.lenbits},$=d(0,c.lens,0,19,c.lencode,0,c.work,P),c.lenbits=P.bits,$){I.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=(y=c.lencode[A&(1<<c.lenbits)-1])>>>16&255,ce=65535&y,!((re=y>>>24)<=R);){if(B===0)break e;B--,A+=U[z++]<<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[z++]<<R,R+=8}if(A>>>=re,R-=re,c.have===0){I.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[z++]<<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[z++]<<R,R+=8}R-=re,a=0,W=11+(127&(A>>>=re)),A>>>=7,R-=7}if(c.have+W>c.nlen+c.ndist){I.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){I.msg="invalid code -- missing end-of-block",c.mode=30;break}if(c.lenbits=9,P={bits:c.lenbits},$=d(g,c.lens,0,c.nlen,c.lencode,0,c.work,P),c.lenbits=P.bits,$){I.msg="invalid literal/lengths set",c.mode=30;break}if(c.distbits=6,c.distcode=c.distdyn,P={bits:c.distbits},$=d(_,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,P),c.distbits=P.bits,$){I.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){I.next_out=q,I.avail_out=J,I.next_in=z,I.avail_in=B,c.hold=A,c.bits=R,u(I,V),q=I.next_out,N=I.output,J=I.avail_out,z=I.next_in,U=I.input,B=I.avail_in,A=c.hold,R=c.bits,c.mode===12&&(c.back=-1);break}for(c.back=0;se=(y=c.lencode[A&(1<<c.lenbits)-1])>>>16&255,ce=65535&y,!((re=y>>>24)<=R);){if(B===0)break e;B--,A+=U[z++]<<R,R+=8}if(se&&(240&se)==0){for(pe=re,fe=se,ge=ce;se=(y=c.lencode[ge+((A&(1<<pe+fe)-1)>>pe)])>>>16&255,ce=65535&y,!(pe+(re=y>>>24)<=R);){if(B===0)break e;B--,A+=U[z++]<<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){I.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[z++]<<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=(y=c.distcode[A&(1<<c.distbits)-1])>>>16&255,ce=65535&y,!((re=y>>>24)<=R);){if(B===0)break e;B--,A+=U[z++]<<R,R+=8}if((240&se)==0){for(pe=re,fe=se,ge=ce;se=(y=c.distcode[ge+((A&(1<<pe+fe)-1)>>pe)])>>>16&255,ce=65535&y,!(pe+(re=y>>>24)<=R);){if(B===0)break e;B--,A+=U[z++]<<R,R+=8}A>>>=pe,R-=pe,c.back+=pe}if(A>>>=re,R-=re,c.back+=re,64&se){I.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[z++]<<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){I.msg="invalid distance too far back",c.mode=30;break}c.mode=25;case 25:if(J===0)break e;if(W=V-J,c.offset>W){if((W=c.offset-W)>c.whave&&c.sane){I.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[z++]<<R,R+=8}if(V-=J,I.total_out+=V,c.total+=V,V&&(I.adler=c.check=c.flags?o(c.check,N,V,q-V):l(c.check,N,V,q-V)),V=J,(c.flags?A:m(A))!==c.check){I.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[z++]<<R,R+=8}if(A!==(4294967295&c.total)){I.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 f}return I.next_out=q,I.avail_out=J,I.next_in=z,I.avail_in=B,c.hold=A,c.bits=R,(c.wsize||V!==I.avail_out&&c.mode<30&&(c.mode<27||j!==4))&&te(I,I.output,I.next_out,V-I.avail_out)?(c.mode=31,-4):(Y-=I.avail_in,V-=I.avail_out,I.total_in+=Y,I.total_out+=V,c.total+=V,c.wrap&&V&&(I.adler=c.check=c.flags?o(c.check,N,V,I.next_out-V):l(c.check,N,V,I.next_out-V)),I.data_type=c.bits+(c.last?64:0)+(c.mode===12?128:0)+(c.mode===20||c.mode===15?256:0),(Y==0&&V===0||j===4)&&$===w&&($=-5),$)},i.inflateEnd=function(I){if(!I||!I.state)return f;var j=I.state;return j.window&&(j.window=null),I.state=null,w},i.inflateGetHeader=function(I,j){var c;return I&&I.state?(2&(c=I.state).wrap)==0?f:((c.head=j).done=!1,w):f},i.inflateSetDictionary=function(I,j){var c,U=j.length;return I&&I.state?(c=I.state).wrap!==0&&c.mode!==11?f:c.mode===11&&l(1,j,U,0)!==c.check?-3:te(I,j,U,U)?(c.mode=31,-4):(c.havedict=1,w):f},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,f,S,p,b,m){var h,E,v,x,T,M,F,D,G,te=m.bits,I=0,j=0,c=0,U=0,N=0,z=0,q=0,B=0,J=0,A=0,R=null,Y=0,V=new s.Buf16(16),W=new s.Buf16(16),ae=null,ie=0;for(I=0;I<=15;I++)V[I]=0;for(j=0;j<f;j++)V[_[w+j]]++;for(N=te,U=15;1<=U&&V[U]===0;U--);if(U<N&&(N=U),U===0)return S[p++]=20971520,S[p++]=20971520,m.bits=1,0;for(c=1;c<U&&V[c]===0;c++);for(N<c&&(N=c),I=B=1;I<=15;I++)if(B<<=1,(B-=V[I])<0)return-1;if(0<B&&(g===0||U!==1))return-1;for(W[1]=0,I=1;I<15;I++)W[I+1]=W[I]+V[I];for(j=0;j<f;j++)_[w+j]!==0&&(b[W[_[w+j]]++]=j);if(M=g===0?(R=ae=b,19):g===1?(R=l,Y-=257,ae=o,ie-=257,256):(R=u,ae=d,-1),I=c,T=p,q=j=A=0,v=-1,x=(J=1<<(z=N))-1,g===1&&852<J||g===2&&592<J)return 1;for(;;){for(F=I-q,G=b[j]<M?(D=0,b[j]):b[j]>M?(D=ae[ie+b[j]],R[Y+b[j]]):(D=96,0),h=1<<I-q,c=E=1<<z;S[T+(A>>q)+(E-=h)]=F<<24|D<<16|G|0,E!==0;);for(h=1<<I-1;A&h;)h>>=1;if(h!==0?(A&=h-1,A+=h):A=0,j++,--V[I]==0){if(I===U)break;I=_[w+b[j]]}if(N<I&&(A&x)!==v){for(q===0&&(q=N),T+=c,B=1<<(z=I-q);z+q<U&&!((B-=V[z+q])<=0);)z++,B<<=1;if(J+=1<<z,g===1&&852<J||g===2&&592<J)return 1;S[v=A&x]=N<<24|z<<16|T-p|0}}return A!==0&&(S[T+A]=I-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(y){for(var k=y.length;0<=--k;)y[k]=0}var d=0,g=29,_=256,w=_+1+g,f=30,S=19,p=2*w+1,b=15,m=16,h=7,E=256,v=16,x=17,T=18,M=[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],G=[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 I=new Array(2*f);u(I);var j=new Array(512);u(j);var c=new Array(256);u(c);var U=new Array(g);u(U);var N,z,q,B=new Array(f);function J(y,k,H,Z,C){this.static_tree=y,this.extra_bits=k,this.extra_base=H,this.elems=Z,this.max_length=C,this.has_stree=y&&y.length}function A(y,k){this.dyn_tree=y,this.max_code=0,this.stat_desc=k}function R(y){return y<256?j[y]:j[256+(y>>>7)]}function Y(y,k){y.pending_buf[y.pending++]=255&k,y.pending_buf[y.pending++]=k>>>8&255}function V(y,k,H){y.bi_valid>m-H?(y.bi_buf|=k<<y.bi_valid&65535,Y(y,y.bi_buf),y.bi_buf=k>>m-y.bi_valid,y.bi_valid+=H-m):(y.bi_buf|=k<<y.bi_valid&65535,y.bi_valid+=H)}function W(y,k,H){V(y,H[2*k],H[2*k+1])}function ae(y,k){for(var H=0;H|=1&y,y>>>=1,H<<=1,0<--k;);return H>>>1}function ie(y,k,H){var Z,C,X=new Array(b+1),Q=0;for(Z=1;Z<=b;Z++)X[Z]=Q=Q+H[Z-1]<<1;for(C=0;C<=k;C++){var K=y[2*C+1];K!==0&&(y[2*C]=ae(X[K]++,K))}}function re(y){var k;for(k=0;k<w;k++)y.dyn_ltree[2*k]=0;for(k=0;k<f;k++)y.dyn_dtree[2*k]=0;for(k=0;k<S;k++)y.bl_tree[2*k]=0;y.dyn_ltree[2*E]=1,y.opt_len=y.static_len=0,y.last_lit=y.matches=0}function se(y){8<y.bi_valid?Y(y,y.bi_buf):0<y.bi_valid&&(y.pending_buf[y.pending++]=y.bi_buf),y.bi_buf=0,y.bi_valid=0}function ce(y,k,H,Z){var C=2*k,X=2*H;return y[C]<y[X]||y[C]===y[X]&&Z[k]<=Z[H]}function pe(y,k,H){for(var Z=y.heap[H],C=H<<1;C<=y.heap_len&&(C<y.heap_len&&ce(k,y.heap[C+1],y.heap[C],y.depth)&&C++,!ce(k,Z,y.heap[C],y.depth));)y.heap[H]=y.heap[C],H=C,C<<=1;y.heap[H]=Z}function fe(y,k,H){var Z,C,X,Q,K=0;if(y.last_lit!==0)for(;Z=y.pending_buf[y.d_buf+2*K]<<8|y.pending_buf[y.d_buf+2*K+1],C=y.pending_buf[y.l_buf+K],K++,Z===0?W(y,C,k):(W(y,(X=c[C])+_+1,k),(Q=M[X])!==0&&V(y,C-=U[X],Q),W(y,X=R(--Z),H),(Q=F[X])!==0&&V(y,Z-=B[X],Q)),K<y.last_lit;);W(y,E,k)}function ge(y,k){var H,Z,C,X=k.dyn_tree,Q=k.stat_desc.static_tree,K=k.stat_desc.has_stree,ne=k.stat_desc.elems,de=-1;for(y.heap_len=0,y.heap_max=p,H=0;H<ne;H++)X[2*H]!==0?(y.heap[++y.heap_len]=de=H,y.depth[H]=0):X[2*H+1]=0;for(;y.heap_len<2;)X[2*(C=y.heap[++y.heap_len]=de<2?++de:0)]=1,y.depth[C]=0,y.opt_len--,K&&(y.static_len-=Q[2*C+1]);for(k.max_code=de,H=y.heap_len>>1;1<=H;H--)pe(y,X,H);for(C=ne;H=y.heap[1],y.heap[1]=y.heap[y.heap_len--],pe(y,X,1),Z=y.heap[1],y.heap[--y.heap_max]=H,y.heap[--y.heap_max]=Z,X[2*C]=X[2*H]+X[2*Z],y.depth[C]=(y.depth[H]>=y.depth[Z]?y.depth[H]:y.depth[Z])+1,X[2*H+1]=X[2*Z+1]=C,y.heap[1]=C++,pe(y,X,1),2<=y.heap_len;);y.heap[--y.heap_max]=y.heap[1],(function(ue,we){var We,xe,He,he,rt,Et,Ae=we.dyn_tree,Ht=we.max_code,Or=we.stat_desc.static_tree,xr=we.stat_desc.has_stree,vr=we.stat_desc.extra_bits,Zt=we.stat_desc.extra_base,Ze=we.stat_desc.max_length,it=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<p;We++)Ze<(he=Ae[2*Ae[2*(xe=ue.heap[We])+1]+1]+1)&&(he=Ze,it++),Ae[2*xe+1]=he,Ht<xe||(ue.bl_count[he]++,rt=0,Zt<=xe&&(rt=vr[xe-Zt]),Et=Ae[2*xe],ue.opt_len+=Et*(he+rt),xr&&(ue.static_len+=Et*(Or[2*xe+1]+rt)));if(it!==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]--,it-=2}while(0<it);for(he=Ze;he!==0;he--)for(xe=ue.bl_count[he];xe!==0;)Ht<(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),xe--)}})(y,k),ie(X,de,y.bl_count)}function a(y,k,H){var Z,C,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++)C=Q,Q=k[2*(Z+1)+1],++K<ne&&C===Q||(K<de?y.bl_tree[2*C]+=K:C!==0?(C!==X&&y.bl_tree[2*C]++,y.bl_tree[2*v]++):K<=10?y.bl_tree[2*x]++:y.bl_tree[2*T]++,X=C,de=(K=0)===Q?(ne=138,3):C===Q?(ne=6,3):(ne=7,4))}function $(y,k,H){var Z,C,X=-1,Q=k[1],K=0,ne=7,de=4;for(Q===0&&(ne=138,de=3),Z=0;Z<=H;Z++)if(C=Q,Q=k[2*(Z+1)+1],!(++K<ne&&C===Q)){if(K<de)for(;W(y,C,y.bl_tree),--K!=0;);else C!==0?(C!==X&&(W(y,C,y.bl_tree),K--),W(y,v,y.bl_tree),V(y,K-3,2)):K<=10?(W(y,x,y.bl_tree),V(y,K-3,3)):(W(y,T,y.bl_tree),V(y,K-11,7));X=C,de=(K=0)===Q?(ne=138,3):C===Q?(ne=6,3):(ne=7,4)}}u(B);var P=!1;function O(y,k,H,Z){V(y,(d<<1)+(Z?1:0),3),(function(C,X,Q,K){se(C),Y(C,Q),Y(C,~Q),s.arraySet(C.pending_buf,C.window,X,Q,C.pending),C.pending+=Q})(y,k,H)}i._tr_init=function(y){P||((function(){var k,H,Z,C,X,Q=new Array(b+1);for(C=Z=0;C<g-1;C++)for(U[C]=Z,k=0;k<1<<M[C];k++)c[Z++]=C;for(c[Z-1]=C,C=X=0;C<16;C++)for(B[C]=X,k=0;k<1<<F[C];k++)j[X++]=C;for(X>>=7;C<f;C++)for(B[C]=X<<7,k=0;k<1<<F[C]-7;k++)j[256+X++]=C;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<f;k++)I[2*k+1]=5,I[2*k]=ae(k,5);N=new J(te,M,_+1,w,b),z=new J(I,F,0,f,b),q=new J(new Array(0),D,0,S,h)})(),P=!0),y.l_desc=new A(y.dyn_ltree,N),y.d_desc=new A(y.dyn_dtree,z),y.bl_desc=new A(y.bl_tree,q),y.bi_buf=0,y.bi_valid=0,re(y)},i._tr_stored_block=O,i._tr_flush_block=function(y,k,H,Z){var C,X,Q=0;0<y.level?(y.strm.data_type===2&&(y.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<_;ne++)if(K.dyn_ltree[2*ne]!==0)return o;return l})(y)),ge(y,y.l_desc),ge(y,y.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*G[ne]+1]===0;ne--);return K.opt_len+=3*(ne+1)+5+5+4,ne})(y),C=y.opt_len+3+7>>>3,(X=y.static_len+3+7>>>3)<=C&&(C=X)):C=X=H+5,H+4<=C&&k!==-1?O(y,k,H,Z):y.strategy===4||X===C?(V(y,2+(Z?1:0),3),fe(y,te,I)):(V(y,4+(Z?1:0),3),(function(K,ne,de,ue){var we;for(V(K,ne-257,5),V(K,de-1,5),V(K,ue-4,4),we=0;we<ue;we++)V(K,K.bl_tree[2*G[we]+1],3);$(K,K.dyn_ltree,ne-1),$(K,K.dyn_dtree,de-1)})(y,y.l_desc.max_code+1,y.d_desc.max_code+1,Q+1),fe(y,y.dyn_ltree,y.dyn_dtree)),re(y),Z&&se(y)},i._tr_tally=function(y,k,H){return y.pending_buf[y.d_buf+2*y.last_lit]=k>>>8&255,y.pending_buf[y.d_buf+2*y.last_lit+1]=255&k,y.pending_buf[y.l_buf+y.last_lit]=255&H,y.last_lit++,k===0?y.dyn_ltree[2*H]++:(y.matches++,k--,y.dyn_ltree[2*(c[H]+_+1)]++,y.dyn_dtree[2*R(k)]++),y.last_lit===y.lit_bufsize-1},i._tr_align=function(y){V(y,2,3),W(y,E,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)})(y)}},{"../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,f={},S=!1,p=l.document,b=Object.getPrototypeOf&&Object.getPrototypeOf(l);b=b&&b.setTimeout?b:l,u={}.toString.call(l.process)==="[object process]"?function(v){kr.nextTick(function(){h(v)})}:(function(){if(l.postMessage&&!l.importScripts){var v=!0,x=l.onmessage;return l.onmessage=function(){v=!1},l.postMessage("","*"),l.onmessage=x,v}})()?(_="setImmediate$"+Math.random()+"$",l.addEventListener?l.addEventListener("message",E,!1):l.attachEvent("onmessage",E),function(v){l.postMessage(_+v,"*")}):l.MessageChannel?((g=new MessageChannel).port1.onmessage=function(v){h(v.data)},function(v){g.port2.postMessage(v)}):p&&"onreadystatechange"in p.createElement("script")?(d=p.documentElement,function(v){var x=p.createElement("script");x.onreadystatechange=function(){h(v),x.onreadystatechange=null,d.removeChild(x),x=null},d.appendChild(x)}):function(v){setTimeout(h,0,v)},b.setImmediate=function(v){typeof v!="function"&&(v=new Function(""+v));for(var x=new Array(arguments.length-1),T=0;T<x.length;T++)x[T]=arguments[T+1];var M={callback:v,args:x};return f[w]=M,u(w),w++},b.clearImmediate=m}function m(v){delete f[v]}function h(v){if(S)setTimeout(h,0,v);else{var x=f[v];if(x){S=!0;try{(function(T){var M=T.callback,F=T.args;switch(F.length){case 0:M();break;case 1:M(F[0]);break;case 2:M(F[0],F[1]);break;case 3:M(F[0],F[1],F[2]);break;default:M.apply(o,F)}})(x)}finally{m(v),S=!1}}}}function E(v){v.source===l&&typeof v.data=="string"&&v.data.indexOf(_)===0&&h(+v.data.slice(_.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof ot<"u"?ot:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(wt)),wt.exports}var Ui=Li();const wn=an(Ui);function ji(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 Bi(e){const t=new wn,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(Mi(e.operations),null,2)),t}async function Fi(e,t){const r=await Bi(e).generateAsync({type:"blob"}),i=await t.createWritable();await i.write(r),await i.close()}async function $i(e,t,n){const r=new wn;return await r.loadAsync(e),Wi(r,t,n)}async function Wi(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");let o;l&&(o=JSON.parse(await l.async("string")));const u=e.file("operations.json");if(!u)throw new Error("Operations history not found");const d=JSON.parse(await u.async("string")),g=dt(d),_=ji(g);if(_.length){const f=_.map(S=>S.message);throw new Error(f.join(`
22
- `))}let w=yn(s,g,t,void 0,o,{},n);return o&&(w={...w,header:o}),w}const me={Remove:"remove",Replace:"replace",Add:"add"},On=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),Hi=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),ct=Symbol.iterator,Ee={mutable:"mutable",immutable:"immutable"},Nt={};function qe(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function qt(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 zt(e){return Object.getPrototypeOf(e)===Set.prototype}function Pt(e){return Object.getPrototypeOf(e)===Map.prototype}function ye(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?.[On]}function Lt(e){var t;const n=le(e);return n?(t=n.copy)!==null&&t!==void 0?t:n.original:e}function Oe(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,Ee))===Ee.immutable||typeof n=="function")}function xn(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||qe(n,s)))return null;t.push(s)}if(e.parent)return xn(e.parent,t);t.reverse();try{Zi(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 et(e,t,n){Ue(e)===2?e.set(t,n):e[t]=n}function Ot(e,t){const n=le(e);return(n?ye(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 Pe(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 Zi(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 Gi(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 vn(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set){if(!zt(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(!Pt(e)){const r=Object.getPrototypeOf(e).constructor;return new r(e)}return new Map(e)}else if(t?.mark&&(n=t.mark(e,Ee),n!==void 0)&&n!==Ee.mutable){if(n===Ee.immutable)return Gi(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=vn(e.original,e.options))}function Je(e){if(!Oe(e))return Lt(e);if(Array.isArray(e))return e.map(Je);if(e instanceof Map){const n=Array.from(e.entries()).map(([r,i])=>[r,Je(i)]);if(!Pt(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(Je);if(!zt(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]=Je(e[n]);return t}function pt(e){return Me(e)?Je(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 Yt(){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 g=r[d];return typeof u=="object"&&(g instanceof Map||g instanceof Set)?Array.from(g.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=Yt;break;case 3:for(const o of e)Fe(o,o,n,r,i);e.add=e.clear=e.delete=Yt;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 Ut(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 In(e,t,n){if(Me(e)||!Oe(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),Ut(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;et(r?i:e,s,d)}else In(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 Xi(e,t){const n=e.type===3?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&In(De(n,t),e.finalities.handledSet,e.options)}function vt(e){e.type===3&&e.copy&&(e.copy.clear(),e.setMap.forEach(t=>{e.copy.add(Lt(t))}))}function It(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const s=xn(e);s&&t(e,s,n,r)}e.finalized=!0}}function jt(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),vt(e),It(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)),et(u,t,d)}}),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),Oe(n,e.options)&&e.finalities.draft.push(()=>{const s=e.type===3?e.setMap:e.copy;ke(De(s,t),n)&&Xi(e,t)})}function Ki(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 g=t.concat([d]),_=Pe(g,i);n.push({op:me.Replace,path:_,value:pt(u[d])}),r.push({op:me.Replace,path:_,value:pt(s[d])})}for(let d=s.length;d<u.length;d+=1){const g=t.concat([d]),_=Pe(g,i);n.push({op:me.Add,path:_,value:pt(u[d])})}if(s.length<u.length){const{arrayLengthAssignment:d=!0}=o.enablePatches;if(d){const g=t.concat(["length"]),_=Pe(g,i);r.push({op:me.Replace,path:_,value:s.length})}else for(let g=u.length;s.length<g;g-=1){const _=t.concat([g-1]),w=Pe(_,i);r.push({op:me.Remove,path:w})}}}function Ji({original:e,copy:t,assignedMap:n},r,i,s,l){n.forEach((o,u)=>{const d=De(e,u),g=pt(De(t,u)),_=o?qe(e,u)?me.Replace:me.Add:me.Remove;if(ke(d,g)&&_===me.Replace)return;const w=r.concat(u),f=Pe(w,l);i.push(_===me.Remove?{op:_,path:f}:{op:_,path:f,value:g}),s.push(_===me.Add?{op:me.Remove,path:f}:_===me.Remove?{op:me.Add,path:f,value:d}:{op:me.Replace,path:f,value:d})})}function qi({original:e,copy:t},n,r,i,s){let l=0;e.forEach(o=>{if(!t.has(o)){const u=n.concat([l]),d=Pe(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=Pe(u,s);r.push({op:me.Add,path:d,value:o}),i.unshift({op:me.Remove,path:d,value:o})}l+=1})}function Ye(e,t,n,r){const{pathAsArray:i=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return Ji(e,t,n,r,i);case 1:return Ki(e,t,n,r,i);case 3:return qi(e,t,n,r,i)}}let At=!1;const ft=(e,t,n=!1)=>{if(typeof e=="object"&&e!==null&&(!Oe(e,t)||n)&&!At)throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")};function Yi(e){At=!0;let t;try{t=e()}finally{At=!1}return t}const Rt={get size(){return ye(le(this)).size},has(e){return ye(le(this)).has(e)},set(e,t){const n=le(this),r=ye(n);return(!r.has(e)||!ke(r.get(e),t))&&(_e(n),Ie(n),n.assignedMap.set(e,!0),n.copy.set(e,t),jt(n,e,t,Ye)),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);ye(n).forEach((r,i)=>{e.call(t,this.get(i),i,this)})},get(e){var t,n;const r=le(this),i=ye(r).get(e),s=((n=(t=r.options).mark)===null||n===void 0?void 0:n.call(t,i,Ee))===Ee.mutable;if(r.options.strict&&ft(i,r.options,s),s||r.finalized||!Oe(i,r.options)||i!==r.original.get(e))return i;const l=Nt.createDraft({original:i,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return _e(r),r.copy.set(e,l),l},keys(){return ye(le(this)).keys()},values(){const e=this.keys();return{[ct]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[ct]:()=>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]}}}},[ct](){return this.entries()}},Qi=Reflect.ownKeys(Rt),Qt=(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,Ee))===Ee.mutable;if(e.options.strict&&ft(l,e.options,d),!d&&!u&&Oe(l,e.options)&&!e.finalized&&e.original.has(l)){const g=Nt.createDraft({original:l,parentDraft:e,key:l,finalities:e.finalities,options:e.options});e.setMap.set(l,g),o=g}else u&&(o=u.proxy);return{done:!1,value:n?o:[o,o]}},ht={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),jt(t,e,e,Ye)),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:Qt(e,t,{isValuesIterator:!0})}},entries(){const e=le(this);_e(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:Qt(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[ct](){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(ht,{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 eo=Reflect.ownKeys(ht),An={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===On)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,Ee),l===Ee.mutable)return e.options.strict&&ft(d,e.options,!0),d}const o=ye(e);if(o instanceof Map&&Qi.includes(t))return t==="size"?Object.getOwnPropertyDescriptor(Rt,"size").get.call(e.proxy):Rt[t].bind(e.proxy);if(o instanceof Set&&eo.includes(t))return t==="size"?Object.getOwnPropertyDescriptor(ht,"size").get.call(e.proxy):ht[t].bind(e.proxy);if(!qe(o,t)){const d=qt(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&&ft(u,e.options),e.finalized||!Oe(u,e.options))return u;if(u===Ot(e.original,t)){if(_e(e),e.copy[t]=Bt({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=qt(ye(e),t);if(s?.set)return s.set.call(e.proxy,n),!0;const l=Ot(ye(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||qe(e.original,t))||(_e(e),Ie(e),qe(e.original,t)&&ke(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,jt(e,t,n,Ye)),!0)},has(e,t){return t in ye(e)},ownKeys(e){return Reflect.ownKeys(ye(e))},getOwnPropertyDescriptor(e,t){const n=ye(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?An.set.call(this,e,t,void 0,e.proxy):(Ot(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 Bt(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,An);if(i.revoke.push(d),o.proxy=u,n){const g=n;g.finalities.draft.push((_,w)=>{var f,S;const p=le(u);let b=g.type===3?g.setMap:g.copy;const m=De(b,r),h=le(m);if(h){let E=h.original;h.operated&&(E=Lt(m)),vt(h),It(h,Ye,_,w),g.options.enableAutoFreeze&&(g.options.updatedValues=(f=g.options.updatedValues)!==null&&f!==void 0?f:new WeakMap,g.options.updatedValues.set(E,h.original)),et(b,r,E)}(S=p.callbacks)===null||S===void 0||S.forEach(E=>{E(_,w)})})}else{const g=le(u);g.finalities.draft.push((_,w)=>{vt(g),It(g,Ye,_,w)})}return u}Nt.createDraft=Bt;function to(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 no(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,Ee))===Ee.mutable||!Oe(e,t)?e:Bt({original:e,parentDraft:null,finalities:r,options:t});return[o,(u=[])=>{const[d,g,_]=to(o,u,i,s,t.enableAutoFreeze);return t.enablePatches?[d,g,_]:d}]}function kt(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:i=!0}=e;Ut(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 g=Array.from(o);o.clear(),g.forEach(_=>o.add(s===_?d:_))}else et(o,s,d)}else typeof l=="object"&&l!==null&&(e.value=l,e.isRoot=!1,kt(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 Rn(e){var t;const n=le(e);if(!Oe(e,n?.options))return e;const r=Ue(e);if(n&&!n.operated)return n.original;let i;function s(){i=r===2?Pt(e)?new Map(e):new(Object.getPrototypeOf(e)).constructor(e):r===3?Array.from(n.setMap.values()):vn(e,n?.options)}if(n){n.finalized=!0;try{s()}finally{n.finalized=!1}}else i=e;if(Ut(i,(l,o)=>{if(n&&ke(De(n.original,l),o))return;const u=Rn(o);u!==o&&(i===e&&s(),et(i,l,u))}),r===3){const l=(t=n?.original)!==null&&t!==void 0?t:i;return zt(l)?new Set(i):new(Object.getPrototypeOf(l)).constructor(i)}return i}function en(e){if(!Me(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return Rn(e)}const ro=e=>function t(n,r,i){var s,l,o;if(typeof n=="function"&&typeof r!="function")return function(x,...T){return t(x,M=>n.call(this,M,...T),r)};const u=n,d=r;let g=i;if(typeof r!="function"&&(g=r),g!==void 0&&Object.prototype.toString.call(g)!=="[object Object]")throw new Error(`Invalid options: ${g}, 'options' should be an object.`);g=Object.assign(Object.assign({},e),g);const _=Me(u)?en(u):u,w=Array.isArray(g.mark)?((x,T)=>{for(const M of g.mark){if(typeof M!="function")throw new Error(`Invalid mark: ${M}, 'mark' should be a function.`);const F=M(x,T);if(F)return F}}):g.mark,f=(s=g.enablePatches)!==null&&s!==void 0?s:!1,S=(l=g.strict)!==null&&l!==void 0?l:!1,b={enableAutoFreeze:(o=g.enableAutoFreeze)!==null&&o!==void 0?o:!1,mark:w,strict:S,enablePatches:f};if(!Oe(_,b)&&typeof _=="object"&&_!==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]=no(_,b);if(typeof r!="function"){if(!Oe(_,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 E;try{E=d(m)}catch(x){throw xt(le(m)),x}const v=x=>{const T=le(m);if(!Me(x)){if(x!==void 0&&!ke(x,m)&&T?.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=x?.[Hi];if(F){const D=F[0];return b.strict&&typeof x=="object"&&x!==null&&kt({rootDraft:T,value:x,useRawReturn:!0}),h([D])}if(x!==void 0)return typeof x=="object"&&x!==null&&kt({rootDraft:T,value:x}),h([x])}if(x===m||x===void 0)return h([]);const M=le(x);if(b===M.options){if(M.operated)throw new Error("Cannot return a modified child draft.");return h([en(x)])}return h([x])};return E instanceof Promise?E.then(v,x=>{throw xt(le(m)),x}):v(E)},Ft=ro();Object.prototype.constructor.toString();function io(e,t){return{...e,header:{...e.header,name:t}}}function oo(e,t,n){const{scope:r}=t;return Ft({document:e,action:t,skip:n,reuseLastOperationIndex:!1},s=>{const l=[...e.operations[r]],o=Te(l);s.action=gn(r);const u=o.at(-1);let d=u?.index??-1;const g=u?.action.type!=="NOOP";g?d=d+1:s.reuseLastOperationIndex=!0;const _=g?[...o,{index:d,skip:0}]:o;if(s.skip=Ti(_),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 so(e,t,n){const{scope:r,input:i}=t;return Ft({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 mt(e,t,n,r,i,s=kn,l={},o){const u=Tn(n,s);return yn(e,t,u,r,i,l,o)}function lo(e,t,n=!1,r=0){if(["UNDO","REDO","PRUNE"].includes(t.type))return e;const i=t.scope;let s=[];e.operations[i]&&(s=e.operations[i].slice());const o=s.sort((g,_)=>g.index-_.index).at(-1)?.index??-1,u=n?o:o+1,d=mi(t,u,r);return s.push(d),{...e,operations:{...e.operations,[i]:s}}}function uo(e,t,n=!1,r=0){const i=t.action.scope,s=e.operations[i],l=s?s.slice():[],u=l.sort((_,w)=>_.index-w.index).at(-1)?.index??-1,d=n?u:u+1;if(t.index-r>d)throw new Error(`Missing operations: expected ${d} with skip 0 or equivalent, got index ${t.index} with skip ${r}`);const g=gi(t,r);return l.push(g),{...e,operations:{...e.operations,[i]:l}}}function co(e,t,n=!1,r=0,i){let s;return i?s=uo(e,i,n,r):s=lo(e,t,n,r),s=Sn(s,t.scope),s}function po(e,t,n){const r=ii().parse(t);switch(r.type){case"SET_NAME":return io(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){switch(t.type){case"UNDO":return oo(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=Mt){const l=t.scope,o=e.operations[l];if(!o)return e;const u=o.at(-1);if(!u)return e;const d=dt({...e.operations,[l]:Di(o,u)});let g;const w=d[l]?.at(-1);if(i&&w?.resultingState)g=s(w.resultingState);else{const{state:f}=mt(e.initialState,d,n,void 0,void 0,void 0,void 0,{reuseOperationResultingState:i,operationResultingStateParser:s});g=f[l]}return{...e,state:{...e.state,[l]:g},operations:dt({...e.operations})}}function mo(e,t,n,r=!1,i=Mt){const s=e.operations[t];if(!s)return e;const l=[...s],o=Te(l);o.pop();const u=dt({...e.operations}),d=u[t];if(!d)return e;const g=[...d],_=Ni(Re(o),g),w=mt(e.initialState,u,n,void 0,void 0,void 0,void 0,{reuseOperationResultingState:r,operationResultingStateParser:i}),f=Te([...e.clipboard,..._].filter(S=>S.action.type!=="NOOP")).reverse();return{...w,clipboard:f}}function kn(e,t,n,r,i={}){const{skip:s,ignoreSkipOperations:l=!1,reuseOperationResultingState:o=!1,operationResultingStateParser:u,pruneOnSkip:d=!0}=i;let g=hi(t),_=s??i.replayOptions?.operation.skip??0,w={...e},f=!1;const S=!l&&_>0;if(vi(g)){const{skip:E,action:v,document:x,reuseLastOperationIndex:T}=fo(e,g,_);g=v,_=E,w=x,f=T}else w={...w,clipboard:[]};if(_n(g)&&(w=po(w,g,n)),w=co(w,g,f,_,i.replayOptions?.operation),Ii(t))return mo(w,t.scope,n);if(S){const E=ho(w,g,n,_,o,u);d?w=E:w={...E,operations:w.operations}}if(w=Ft(w,E=>{try{const v=n(E.state,g,r);v&&Yi(()=>{E.state=v})}catch(v){const x=w.operations[g.scope];if(!x)throw new Error(`No operations found for scope: ${g.scope}`);const T=x.length-1,M=E.operations[g.scope];if(!M)throw new Error(`No operations found in draft for scope: ${g.scope}`);if(M[T].error=v.message,M[T].skip=0,S){E.state={...e.state};const F=e.operations[g.scope];if(!F)throw new Error(`No operations found for scope: ${g.scope}`);E.operations={...e.operations,[g.scope]:[...F,{...M[T]}]}}}}),["UNDO","REDO","PRUNE"].includes(g.type))return w;const p=g.scope||"global";let b=Ct(w,p);i.replayOptions?.operation.hash&&i.replayOptions.operation.hash!==""&&(b=i.replayOptions.operation.hash);const h=w.operations[p]?.at(-1);return h&&(h.hash=b,o&&(h.resultingState=JSON.stringify(w.state[p]))),w}function Tn(e,t=kn){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=mt(e.initialState,{...e.operations,global:o.concat(l)},n),g=d.state,_=d.header.name,w=o.length,f=o.length?o[o.length-1].timestampUtcMs:u.length?u[0].timestampUtcMs:new Date().toISOString(),S=mn({name:_,...g},l.length);return mt(e.initialState,{...e.operations,global:[...o,{skip:0,...S,action:S,timestampUtcMs:f,index:w,hash:Ct({state:g},"global")},...u.map((p,b)=>({...p,index:w+b+1}))]},n)}const _o="sha1",bo="base64";function Dn(){return{}}function Cn(){return{version:0,hash:{algorithm:_o,encoding:bo}}}function $t(){return{auth:Dn(),document:Cn()}}function yo(e){return{...Dn(),...e}}function Eo(e){return{...Cn(),...e}}function So(e,t){return{auth:yo(e),document:Eo(t)}}function Mn(){return ee({__typename:be("AddChangeLogItemInput").optional(),content:L(),id:L(),insertBefore:L().nullable()})}function Nn(){return ee({description:L().nullish(),id:L(),name:L()})}function zn(){return ee({errorCode:L().nullish(),errorDescription:L().nullish(),errorName:L().nullish(),errorTemplate:L().nullish(),id:L(),operationId:L()})}function wo(){return ee({example:L(),id:L(),operationId:L()})}function Pn(){return ee({description:L().nullish(),id:L(),moduleId:L(),name:L(),reducer:L().nullish(),schema:L().nullish(),template:L().nullish(),scope:Le().nullish()})}function Ln(){return ee({scope:L(),example:L(),id:L(),insertBefore:L().nullish()})}function Oo(){return ee({__typename:be("Author").optional(),name:L(),website:L().nullable()})}function Un(){return ee({__typename:be("CodeExample").optional(),id:L(),value:L()})}function jn(){return ee({__typename:be("DeleteChangeLogItemInput").optional(),id:L()})}function Bn(){return ee({id:L()})}function Fn(){return ee({id:L()})}function xo(){return ee({id:L()})}function $n(){return ee({id:L()})}function Wn(){return ee({scope:L(),id:L()})}function vo(){return ee({__typename:be("DocumentModelGlobalState").optional(),author:Oo(),description:L(),extension:L(),id:L(),name:L(),specifications:Se(Io())})}function Io(){return ee({__typename:be("DocumentSpecification").optional(),changeLog:Se(L()),modules:Se(Ao()),state:Do(),version:$e().int()})}function Ao(){return ee({__typename:be("ModuleSpecification").optional(),description:L().nullable(),id:L(),name:L(),operations:Se(Ro())})}function Hn(){return ee({newModuleId:L(),operationId:L()})}function Ro(){return ee({__typename:be("OperationSpecification").optional(),description:L().nullable(),errors:Se(ko()),examples:Se(Un()),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 Zn(){return ee({__typename:be("ReorderChangeLogItemsInput").optional(),order:Se(L())})}function Gn(){return ee({moduleId:L(),order:Se(L())})}function Vn(){return ee({order:Se(L())})}function Xn(){return ee({operationId:L(),order:Se(L())})}function To(){return ee({operationId:L(),order:Se(L())})}function Kn(){return ee({scope:L(),order:Se(L())})}function Jn(){return ee({authorName:L()})}function qn(){return ee({authorWebsite:L()})}function Yn(){return ee({scope:L(),initialValue:L()})}function Qn(){return ee({description:L()})}function er(){return ee({extension:L()})}function tr(){return ee({id:L()})}function nr(){return ee({name:L()})}function rr(){return ee({description:L().nullish(),id:L()})}function ir(){return ee({id:L(),name:L().nullish()})}function or(){return ee({description:L().nullish(),id:L()})}function sr(){return ee({errorCode:L().nullish(),id:L()})}function ar(){return ee({errorDescription:L().nullish(),id:L()})}function lr(){return ee({errorName:L().nullish(),id:L()})}function ur(){return ee({errorTemplate:L().nullish(),id:L()})}function cr(){return ee({id:L(),name:L().nullish()})}function pr(){return ee({id:L(),scope:Le()})}function dr(){return ee({id:L(),reducer:L().nullish()})}function fr(){return ee({id:L(),schema:L().nullish()})}function hr(){return ee({id:L(),template:L().nullish()})}function mr(){return ee({scope:L(),schema:L()})}function tn(){return ee({__typename:be("State").optional(),examples:Se(Un()),initialValue:L(),schema:L()})}function Do(){return ee({global:tn(),local:tn()})}function gr(){return ee({__typename:be("UpdateChangeLogItemInput").optional(),id:L(),newContent:L()})}function Co(){return ee({example:L(),id:L()})}function _r(){return ee({scope:L(),id:L(),newExample:L()})}const Mo=e=>oe("SET_NAME",e,void 0,fn,"global"),No=e=>oe("SET_MODEL_NAME",{...e},void 0,nr,"global"),zo=e=>oe("SET_MODEL_ID",{...e},void 0,tr,"global"),Po=e=>oe("SET_MODEL_EXTENSION",{...e},void 0,er,"global"),Lo=e=>oe("SET_MODEL_DESCRIPTION",{...e},void 0,Qn,"global"),Uo=e=>oe("SET_AUTHOR_NAME",{...e},void 0,Jn,"global"),jo=e=>oe("SET_AUTHOR_WEBSITE",{...e},void 0,qn,"global"),Bo=e=>oe("ADD_MODULE",{...e},void 0,Nn,"global"),Fo=e=>oe("SET_MODULE_NAME",{...e},void 0,ir,"global"),$o=e=>oe("SET_MODULE_DESCRIPTION",{...e},void 0,rr,"global"),Wo=e=>oe("DELETE_MODULE",{...e},void 0,Bn,"global"),Ho=e=>oe("REORDER_MODULES",{...e},void 0,Vn,"global"),Zo=e=>oe("ADD_OPERATION",{...e},void 0,Pn,"global"),Go=e=>oe("SET_OPERATION_NAME",{...e},void 0,cr,"global"),Vo=e=>oe("SET_OPERATION_SCOPE",{...e},void 0,pr,"global"),Xo=e=>oe("SET_OPERATION_SCHEMA",{...e},void 0,fr,"global"),Ko=e=>oe("SET_OPERATION_DESCRIPTION",{...e},void 0,or,"global"),Jo=e=>oe("SET_OPERATION_TEMPLATE",{...e},void 0,hr,"global"),qo=e=>oe("SET_OPERATION_REDUCER",{...e},void 0,dr,"global"),Yo=e=>oe("MOVE_OPERATION",{...e},void 0,Hn,"global"),Qo=e=>oe("DELETE_OPERATION",{...e},void 0,$n,"global"),es=e=>oe("REORDER_MODULE_OPERATIONS",{...e},void 0,Gn,"global"),ts=e=>oe("ADD_OPERATION_ERROR",{...e},void 0,zn,"global"),ns=e=>oe("SET_OPERATION_ERROR_CODE",{...e},void 0,sr,"global"),rs=e=>oe("SET_OPERATION_ERROR_NAME",{...e},void 0,lr,"global"),is=e=>oe("SET_OPERATION_ERROR_DESCRIPTION",{...e},void 0,ar,"global"),os=e=>oe("SET_OPERATION_ERROR_TEMPLATE",{...e},void 0,ur,"global"),ss=e=>oe("DELETE_OPERATION_ERROR",{...e},void 0,Fn,"global"),as=e=>oe("REORDER_OPERATION_ERRORS",{...e},void 0,Xn,"global"),ls=e=>oe("SET_STATE_SCHEMA",{...e},void 0,mr,"global"),us=e=>oe("SET_INITIAL_STATE",{...e},void 0,Yn,"global"),cs=e=>oe("ADD_STATE_EXAMPLE",{...e},void 0,Ln,"global"),ps=e=>oe("UPDATE_STATE_EXAMPLE",{...e},void 0,_r,"global"),ds=e=>oe("DELETE_STATE_EXAMPLE",{...e},void 0,Wn,"global"),fs=e=>oe("REORDER_STATE_EXAMPLES",{...e},void 0,Kn,"global"),hs=e=>oe("ADD_CHANGE_LOG_ITEM",{...e},void 0,Mn,"global"),ms=e=>oe("UPDATE_CHANGE_LOG_ITEM",{...e},void 0,gr,"global"),gs=e=>oe("DELETE_CHANGE_LOG_ITEM",{...e},void 0,jn,"global"),_s=e=>oe("REORDER_CHANGE_LOG_ITEMS",{...e},void 0,Zn,"global"),bs=()=>oe("RELEASE_NEW_VERSION",{},void 0,void 0,"global"),ys={setName:Mo,undo:pi,redo:di,prune:fi,loadState:mn,noop:gn},Es={setModelName:No,setModelId:zo,setModelExtension:Po,setModelDescription:Lo,setAuthorName:Uo,setAuthorWebsite:jo,addModule:Bo,setModuleName:Fo,setModuleDescription:$o,deleteModule:Wo,reorderModules:Ho,addOperation:Zo,setOperationName:Go,setOperationScope:Vo,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},Ss={...ys,...Es},ws="phdm",Os={},xs={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},vs={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}`),z.pop(),`{${V}}`}case"number":return isFinite(N)?String(N):E?E(N):"null";case"boolean":return N===!0?"true":"false";case"undefined":return;case"bigint":if(x)return String(N);default:return E?E(N):void 0}}function j(U,N,z){switch(typeof N){case"string":return o(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,z);if(N===null)return"null"}if(z.indexOf(N)!==-1)return v;let q="";const B=N.length!==void 0;if(B&&Array.isArray(N)){if(N.length===0)return"[]";if(F<z.length+1)return'"[Array]"';z.push(N);const V=Math.min(N.length,D);let W=0;for(;W<V-1;W++){const ie=j(String(W),N[W],z);q+=ie!==void 0?ie:"null",q+=","}const ae=j(String(W),N[W],z);if(q+=ae!==void 0?ae:"null",N.length-1>D){const ie=N.length-D-1;q+=`,"... ${S(ie)} not stringified"`}return z.pop(),`[${q}]`}let J=Object.keys(N);const A=J.length;if(A===0)return"{}";if(F<z.length+1)return'"[Object]"';let R="",Y=Math.min(A,D);B&&u(N)&&(q+=d(N,",",D),J=J.slice(N.length),Y-=N.length,R=","),T&&(J=l(J,M)),z.push(N);for(let V=0;V<Y;V++){const W=J[V],ae=j(W,N[W],z);ae!==void 0&&(q+=`${R}${o(W)}:${ae}`,R=",")}if(A>D){const V=A-D;q+=`${R}"...":"${S(V)} not stringified"`}return z.pop(),`{${q}}`}case"number":return isFinite(N)?String(N):E?E(N):"null";case"boolean":return N===!0?"true":"false";case"undefined":return;case"bigint":if(x)return String(N);default:return E?E(N):void 0}}function c(U,N,z){if(arguments.length>1){let q="";if(typeof z=="number"?q=" ".repeat(Math.min(z,10)):typeof z=="string"&&(q=z.slice(0,10)),N!=null){if(typeof N=="function")return G("",{"":U},[],N,q,"");if(Array.isArray(N))return te("",U,[],p(N),q,"")}if(q.length!==0)return I("",U,[],q,"")}return j("",U,[])}return c}})(st,st.exports)),st.exports}var Cr=Dr();const _t=ln(Cr);_t.configure;const Vt=_t,Mr=[1518500249,1859775393,-1894007588,-899497514];function Nr(e){return new zr}class zr{constructor(){this.A=1732584193,this.B=-271733879,this.C=-1732584194,this.D=271733878,this.E=-1009589776,this._size=0,this._sp=0,(!at||Ge>=8e3)&&(at=new ArrayBuffer(8e3),Ge=0),this._byte=new Uint8Array(at,Ge,80),this._word=new Int32Array(at,Ge,20),Ge+=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,o=0;if(i&&!(n&3)&&!(this._size%64)){const s=new Int32Array(t.buffer,n,i*16);for(;i--;)this._int32(s,o>>2),o+=64;this._size+=o}if(t.BYTES_PER_ELEMENT!==1&&t.buffer){const s=new Uint8Array(t.buffer,n+o,r-o);return this._uint8(s)}return o===r?this:this._uint8(t,o)}_uint8(t,n){const{_byte:r,_word:i}=this,o=t.length;for(n=n|0;n<o;){const l=this._size%64;let s=l;for(;n<o&&s<64;)r[s++]=t[n++];s>=64&&this._int32(i),this._size+=s-l}return this}_utf8(t){const{_byte:n,_word:r}=this,i=t.length;let o=this._sp;for(let l=0;l<i;){const s=this._size%64;let u=s;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):o?(d=((o&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,o=0):o=d}u>=64&&(this._int32(r),r[0]=r[16]),this._size+=u-s}return this._sp=o,this}_int32(t,n){let{A:r,B:i,C:o,D:l,E:s}=this,u=0;for(n=n|0;u<16;)Ne[u++]=Ce(t[n++]);for(u=16;u<80;u++)Ne[u]=Ur(Ne[u-3]^Ne[u-8]^Ne[u-14]^Ne[u-16]);for(u=0;u<80;u++){const d=u/20|0,g=jr(r)+Fr(d,i,o,l)+s+Ne[u]+Mr[d]|0;s=l,l=o,o=Br(i),i=r,r=g}this.A=r+this.A|0,this.B=i+this.B|0,this.C=o+this.C|0,this.D=l+this.D|0,this.E=s+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 o=this._size*8,l=(o&4294967295)>>>0,s=(o-l)/4294967296;return s&&(r[14]=Ce(s)),l&&(r[15]=Ce(l)),this._int32(r),t==="hex"?this._hex():this._bin()}_hex(){const{A:t,B:n,C:r,D:i,E:o}=this;return Ve(t)+Ve(n)+Ve(r)+Ve(i)+Ve(o)}_bin(){const{A:t,B:n,C:r,D:i,E:o,_byte:l,_word:s}=this;return s[0]=Ce(t),s[1]=Ce(n),s[2]=Ce(r),s[3]=Ce(i),s[4]=Ce(o),l.slice(0,20)}}const Ne=new Int32Array(80);let at,Ge=0;const Ve=e=>(e+4294967296).toString(16).substr(-8),Pr=(e=>e<<24&4278190080|e<<8&16711680|e>>8&65280|e>>24&255),Lr=(e=>e),Ce=$r()?Lr:Pr,Ur=e=>e<<1|e>>>31,jr=e=>e<<5|e>>>27,Br=e=>e<<30|e>>>2;function Fr(e,t,n,r){return e===0?t&n|~t&r:e===2?t&n|t&r|n&r:t^n^r}function $r(){return new Uint8Array(new Uint16Array([65279]).buffer)[0]===254}const un=(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=Zr(e,t);return n==="hex"?Hr(i):Wr(i)};function Wr(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Hr(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function Zr(e,t="sha1"){if(!["sha1"].includes(t))throw new Error("Hashing algorithm not supported: Available: sha1");return Nr().update(e).digest()}function Gr(e){return(new Date(e).getTime()/1e3).toFixed(0)}function Vr({documentId:e,signer:t,action:n,previousStateHash:r}){const{scope:i,type:o}=n;return[Gr(new Date),t.app.key,un([e,i,o,_t(n.input)].join("")),r]}const Xr=new TextEncoder;function Kr(e){const t=e.join(""),n=`Signed Operation:
20
+ `+t.length.toString();return Xr.encode(n+t)}function Jr(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 cn 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 cn{issues;constructor(t){super(t),this.issues=t,this.name="InvalidActionInputZodError"}}class Yr 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 Qr=e=>e!=null;Rr().refine(e=>Qr(e));const ei=Qe(["LOAD_STATE"]),ti=Qe(["PRUNE"]),ni=Qe(["REDO"]),ri=Qe(["SET_NAME"]),ii=Qe(["UNDO"]);function Le(){return L()}function oi(){return Ar([si(),li(),ui(),ci(),pi()])}function si(){return ee({id:L(),timestampUtcMs:L(),input:Tt(()=>pn()),type:ei,scope:Le()})}function pn(){return ee({operations:$e(),state:Tt(()=>ai())})}function ai(){return ee({data:an().nullish(),name:L()})}function li(){return ee({id:L(),timestampUtcMs:L(),input:Tt(()=>dn()),type:ti,scope:Le()})}function dn(){return ee({end:$e().nullish(),start:$e().nullish()})}const fn=$e;function ui(){return ee({id:L(),timestampUtcMs:L().datetime(),input:fn(),type:ni,scope:Le()})}const hn=L;function ci(){return ee({id:L(),timestampUtcMs:L().datetime(),input:hn(),type:ri,scope:be("global")})}const mn=$e;function pi(){return ee({id:L(),timestampUtcMs:L().datetime(),input:mn(),type:ii,scope:Le()})}function Dt(e){return globalThis.crypto.randomUUID()}const di=(e=1,t="global")=>oe("UNDO",e,void 0,mn,t),fi=(e=1,t="global")=>oe("REDO",e,void 0,fn,t),hi=(e,t,n="global")=>oe("PRUNE",{start:e,end:t},void 0,dn,n),gn=(e,t)=>oe("LOAD_STATE",{state:e,operations:t},void 0,pn),_n=(e="global")=>oe("NOOP",void 0,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 o={id:Dt(),timestampUtcMs:new Date().toISOString(),type:e,input:t,scope:i};try{r?.().parse(o.input)}catch(l){throw l instanceof kr?new qr(l.issues):new cn(l)}return o}const mi=e=>({id:e.id,timestampUtcMs:e.timestampUtcMs,type:e.type,input:e.input,scope:e.scope,context:e.context,attachments:e.attachments}),gi=(e,t,n)=>({...e,action:e,id:Dt(),timestampUtcMs:new Date().toISOString(),hash:"",error:void 0,index:t,skip:n}),_i=(e,t)=>({...e,hash:"",error:void 0,skip:t}),bi=(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 Ei(e,t){const n=Vr(e),r=Kr(n),i=await t(r);return[...n,`0x${Jr(i)}`]}async function la(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 s=l.at(-1);if(!s)throw new Error("Action was not applied");const u=l.at(-2)?.hash??"",d=await Ei({documentId:n.header.id,signer:r,action:e,previousStateHash:u},i),g={signer:yi(r.user,r.app,[...r.signatures,d])};return bi(s,g)}const Si=e=>`${e.documentType}:${e.createdAtUtcIso}:${e.nonce}`;function wi(e){let t;return{async publicKey(){return e},async sign(n){throw new Error("verification-only signer cannot sign data")},async signAction(n,r){throw new Error("verification-only signer cannot sign actions")},async verify(n,r){t||(t=await crypto.subtle.importKey("jwk",e,{name:"ECDSA",namedCurve:"P-256"},!0,["verify"]));let i;try{i=await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},t,new Uint8Array(r),new Uint8Array(n))}catch{throw new Error("invalid signature")}if(!i)throw new Error("invalid signature")}}}const Oi=e=>wi(e.sig.publicKey),xi=async(e,t,n)=>{const r=Si(e),o=new TextEncoder().encode(r),l=Uint8Array.from(atob(t),s=>s.charCodeAt(0));await n.verify(o,l)},ua=async e=>{const t=Oi(e);return xi({documentType:e.documentType,createdAtUtcIso:e.createdAtUtcIso,nonce:e.sig.nonce},e.id,t)},vi=(e=Dt(),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 Ii(e){return["UNDO","REDO"].includes(e.type)}function Ai(e){return e.type==="UNDO"}function bn(e){return["SET_NAME","UNDO","REDO","PRUNE","LOAD_STATE"].includes(e.type)}function yn(e,t){const n=e(t);return{header:vi(),state:n,initialState:n,operations:{global:[],local:[]},clipboard:[]}}function Ct(e,t="global"){const n=_t(e.state[t]||"");return un(n)}const Ri=e=>e;function En(e,t,n,r,i,o={},l){const{checkHashes:s=!0,reuseOperationResultingState:u,operationResultingStateParser:d=Mt}=l||{};let g=e;const _=[],w=new Set([...Object.keys(t),"global","local"]),f={};for(const v of w)f[v]=[];if(u)for(const[v,x]of Object.entries(t)){if(!x)continue;const T=x.findLastIndex(F=>!!F.resultingState);if(T<0){_.push(...x);continue}const M=x[T];if(!(!M||!M.resultingState))try{const F=d(M.resultingState);g={...g,[v]:F};const D=f[v];D&&D.push(...x.slice(0,T+1)),_.push(...x.slice(T+1))}catch{_.push(...x)}}else _.push(...Object.values(t).flatMap(v=>v||[]));const S=yn(Ri,g);i?.slug&&(S.header.slug=i.slug),S.initialState=e,S.operations=f;let p=S;if(_.length)p=_.reduce((v,x)=>n(v,x.action,r,{ignoreSkipOperations:!0,checkHashes:s,replayOptions:{operation:x}}),S);else for(const v of Object.values(f)){if(!v)continue;const x=v.at(-1);x&&(p=wn(p,x.action.scope))}if(!s)for(const v of Object.keys(p.state))for(let x=_.length-1;x>=0;x--){const T=_[x];if(T.action.scope===v){if(T.hash!==Ct(p,v))throw new Yr(v,p,T);break}}const b=new Set([...Object.keys(p.operations),...Object.keys(t),"global","local"]),m={};for(const v of b)m[v]=[];const h=Array.from(b).reduce((v,x)=>{const T=p.operations[x]||[];return{...v,[x]:[...T.map((M,F)=>({...M,timestamp:t[x]?.[F]?.timestampUtcMs??M.timestampUtcMs}))]}},m),E=i?i.lastModifiedAtUtcIso:Object.values(h).reduce((v,x)=>{if(!x)return v;const T=x.at(-1);return T&&T.timestampUtcMs>v?T.timestampUtcMs:v},S.header.lastModifiedAtUtcIso);return i&&(p.header={...i,revision:p.header.revision,lastModifiedAtUtcIso:E}),{...p,operations:h}}function Mt(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 Xt;(function(e){e.UNEXPECTED_INDEX="UNEXPECTED_INDEX"})(Xt||(Xt={}));var Kt;(function(e){e.DUPLICATED_INDEX="DUPLICATED_INDEX",e.MISSING_INDEX="MISSING_INDEX"})(Kt||(Kt={}));function Re(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 ca(e,t,n){return[...t,...n].sort((r,i)=>new Date(r.timestampUtcMs||"").getTime()-new Date(i.timestampUtcMs||"").getTime()).map((r,i)=>({...r,index:e.index+i,skip:i===0?e.skip:0}))}function Sn(e,t){const n=e,r=t,i={index:n.index,skip:n.skip,type:n.type??null,scope:n.scope??null,input:n.input??null},o={index:r.index,skip:r.skip,type:r.type??null,scope:r.scope??null,input:r.input??null};return Vt(i)===Vt(o)}function pa(e,t){const n=Re(Te(e.slice())),r=Re(Te(t.slice()));if(n.length<1)return[r,[]];const i=[];let o=!1;for(;r.length>0;){const l=r[0];let s=n.shift();for(;s&&ki(s,l);)i.push(s),s=n.shift();if(s?o||(Sn(s,l)?(r.shift(),i.push(s)):(n.unshift(s),o=!0)):o=!0,o){let u=r.shift();for(;u;)i.push(u),u=r.shift()}}if(!o){let l=n.shift();for(;l;)i.push(l),l=n.shift()}return[Re(i),n]}function ki(e,t){return e.index<t.index||e.index===t.index&&e.id===t.id&&e.skip<t.skip}function Ti(e,t){const n=[],r=[],i=[],o=Math.max(e.length,t.length);let l=!1;for(let s=0;s<o;s++){const u=e[s],d=t[s];u&&d?!l&&Sn(u,d)?n.push(u):(l=!0,r.push(u),i.push(d)):u?r.push(u):d&&i.push(d)}return[n,r,i]}function da(e,t,n){const[r,i,o]=Ti(Re(e),Re(t)),l=St(r),s=1+Math.max(l,St(i),St(o)),u=Mi(o,i),d=n({index:s,skip:s-(l+1)},i,u);return r.concat(d)}function St(e){const t=e[e.length-1];return t?t.index:-1}function Di(e){if(e.length<1)return-1;const t=Re(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 fa(e){return e.reduce((n,r)=>(n[r.action.scope]||(n[r.action.scope]=[]),n[r.action.scope]?.push(r),n),{})}function ha(e,t){return e.filter(n=>!t.some(r=>n.action.type==="NOOP"&&n.skip===0&&n.index===r.index||n.index===r.index&&n.skip===r.skip&&n.action.scope===r.action.scope&&n.hash===r.hash&&n.action.type===r.action.type))}function Ci(e,t){const r=Te(e).at(-1)?.index??-1,i=r+1,o={...t,index:t.index??i};if(o.index<r)throw new Error(`The skip header operation index must be greater than or equal to ${r}`);return Re(Te([...e,o])).slice(0,-1)}function dt(e){return Object.entries(e).reduce((n,r)=>{const[i,o]=r;return o?{...n,[i]:Re(Te(o))}:n},{})}function Mi(e,t){return e.filter(n=>n.id?!t.some(r=>r.id===n.id):!0)}function Ni(e){return e?Object.entries(e).reduce((n,[r,i])=>i?{...n,[r]:i.map(o=>{const{resultingState:l,...s}=o;return s})}:n,{}):{}}function zi(e,t){return e.filter(n=>!t.some(r=>n.index===r.index))}function Pi(e){return Te(Object.values(e.operations).flatMap(n=>n||[])).at(-1)?.timestampUtcMs||e.header.lastModifiedAtUtcIso}function Li(e,t){return(e.operations[t]?.at(-1)?.index??-1??-1)+1}function wn(e,t){const n={...e.header,revision:{...e.header.revision,[t]:Li(e,t)},lastModifiedAtUtcIso:Pi(e)};return{...e,header:n}}function lt(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:{}},Jt;function Ui(){return Jt||(Jt=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(r,i,o){function l(d,g){if(!i[d]){if(!r[d]){var _=typeof lt=="function"&&lt;if(!g&&_)return _(d,!0);if(s)return s(d,!0);var w=new Error("Cannot find module '"+d+"'");throw w.code="MODULE_NOT_FOUND",w}var f=i[d]={exports:{}};r[d][0].call(f.exports,function(S){var p=r[d][1][S];return l(p||S)},f,f.exports,n,r,i,o)}return i[d].exports}for(var s=typeof lt=="function"&&lt,u=0;u<o.length;u++)l(o[u]);return l})({1:[function(n,r,i){var o=n("./utils"),l=n("./support"),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(u){for(var d,g,_,w,f,S,p,b=[],m=0,h=u.length,E=h,v=o.getTypeOf(u)!=="string";m<u.length;)E=h-m,_=v?(d=u[m++],g=m<h?u[m++]:0,m<h?u[m++]:0):(d=u.charCodeAt(m++),g=m<h?u.charCodeAt(m++):0,m<h?u.charCodeAt(m++):0),w=d>>2,f=(3&d)<<4|g>>4,S=1<E?(15&g)<<2|_>>6:64,p=2<E?63&_:64,b.push(s.charAt(w)+s.charAt(f)+s.charAt(S)+s.charAt(p));return b.join("")},i.decode=function(u){var d,g,_,w,f,S,p=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,E=3*(u=u.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(u.charAt(u.length-1)===s.charAt(64)&&E--,u.charAt(u.length-2)===s.charAt(64)&&E--,E%1!=0)throw new Error("Invalid base64 input, bad content length.");for(h=l.uint8array?new Uint8Array(0|E):new Array(0|E);p<u.length;)d=s.indexOf(u.charAt(p++))<<2|(w=s.indexOf(u.charAt(p++)))>>4,g=(15&w)<<4|(f=s.indexOf(u.charAt(p++)))>>2,_=(3&f)<<6|(S=s.indexOf(u.charAt(p++))),h[b++]=d,f!==64&&(h[b++]=g),S!==64&&(h[b++]=_);return h}},{"./support":30,"./utils":32}],2:[function(n,r,i){var o=n("./external"),l=n("./stream/DataWorker"),s=n("./stream/Crc32Probe"),u=n("./stream/DataLengthProbe");function d(g,_,w,f,S){this.compressedSize=g,this.uncompressedSize=_,this.crc32=w,this.compression=f,this.compressedContent=S}d.prototype={getContentWorker:function(){var g=new l(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("data_length")),_=this;return g.on("end",function(){if(this.streamInfo.data_length!==_.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),g},getCompressedWorker:function(){return new l(o.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 g.pipe(new s).pipe(new u("uncompressedSize")).pipe(_.compressWorker(w)).pipe(new u("compressedSize")).withStreamInfo("compression",_)},r.exports=d},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,i){var o=n("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},i.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,i){var o=n("./utils"),l=(function(){for(var s,u=[],d=0;d<256;d++){s=d;for(var g=0;g<8;g++)s=1&s?3988292384^s>>>1:s>>>1;u[d]=s}return u})();r.exports=function(s,u){return s!==void 0&&s.length?o.getTypeOf(s)!=="string"?(function(d,g,_,w){var f=l,S=w+_;d^=-1;for(var p=w;p<S;p++)d=d>>>8^f[255&(d^g[p])];return-1^d})(0|u,s,s.length,0):(function(d,g,_,w){var f=l,S=w+_;d^=-1;for(var p=w;p<S;p++)d=d>>>8^f[255&(d^g.charCodeAt(p))];return-1^d})(0|u,s,s.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 o=null;o=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:o}},{lie:37}],7:[function(n,r,i){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",l=n("pako"),s=n("./utils"),u=n("./stream/GenericWorker"),d=o?"uint8array":"array";function g(_,w){u.call(this,"FlateWorker/"+_),this._pako=null,this._pakoAction=_,this._pakoOptions=w,this.meta={}}i.magic="\b\0",s.inherits(g,u),g.prototype.processChunk=function(_){this.meta=_.meta,this._pako===null&&this._createPako(),this._pako.push(s.transformTo(d,_.data),!1)},g.prototype.flush=function(){u.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},g.prototype.cleanUp=function(){u.prototype.cleanUp.call(this),this._pako=null},g.prototype._createPako=function(){this._pako=new l[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var _=this;this._pako.onData=function(w){_.push({data:w,meta:_.meta})}},i.compressWorker=function(_){return new g("Deflate",_)},i.uncompressWorker=function(){return new g("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,i){function o(f,S){var p,b="";for(p=0;p<S;p++)b+=String.fromCharCode(255&f),f>>>=8;return b}function l(f,S,p,b,m,h){var E,v,x=f.file,T=f.compression,M=h!==d.utf8encode,F=s.transformTo("string",h(x.name)),D=s.transformTo("string",d.utf8encode(x.name)),G=x.comment,te=s.transformTo("string",h(G)),I=s.transformTo("string",d.utf8encode(G)),j=D.length!==x.name.length,c=I.length!==G.length,U="",N="",z="",q=x.dir,B=x.date,J={crc32:0,compressedSize:0,uncompressedSize:0};S&&!p||(J.crc32=f.crc32,J.compressedSize=f.compressedSize,J.uncompressedSize=f.uncompressedSize);var A=0;S&&(A|=8),M||!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})(x.unixPermissions,q)):(Y=20,R|=(function(W){return 63&(W||0)})(x.dosPermissions)),E=B.getUTCHours(),E<<=6,E|=B.getUTCMinutes(),E<<=5,E|=B.getUTCSeconds()/2,v=B.getUTCFullYear()-1980,v<<=4,v|=B.getUTCMonth()+1,v<<=5,v|=B.getUTCDate(),j&&(N=o(1,1)+o(g(F),4)+D,U+="up"+o(N.length,2)+N),c&&(z=o(1,1)+o(g(te),4)+I,U+="uc"+o(z.length,2)+z);var V="";return V+=`
21
+ \0`,V+=o(A,2),V+=T.magic,V+=o(E,2),V+=o(v,2),V+=o(J.crc32,4),V+=o(J.compressedSize,4),V+=o(J.uncompressedSize,4),V+=o(F.length,2),V+=o(U.length,2),{fileRecord:_.LOCAL_FILE_HEADER+V+F+U,dirRecord:_.CENTRAL_FILE_HEADER+o(Y,2)+V+o(te.length,2)+"\0\0\0\0"+o(R,4)+o(b,4)+F+U+te}}var s=n("../utils"),u=n("../stream/GenericWorker"),d=n("../utf8"),g=n("../crc32"),_=n("../signature");function w(f,S,p,b){u.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=S,this.zipPlatform=p,this.encodeFileName=b,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(w,u),w.prototype.push=function(f){var S=f.meta.percent||0,p=this.entriesCount,b=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,u.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:p?(S+100*(p-b-1))/p:100}}))},w.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var S=this.streamFiles&&!f.file.dir;if(S){var p=l(f,S,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},w.prototype.closedSource=function(f){this.accumulate=!1;var S=this.streamFiles&&!f.file.dir,p=l(f,S,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),S)this.push({data:(function(b){return _.DATA_DESCRIPTOR+o(b.crc32,4)+o(b.compressedSize,4)+o(b.uncompressedSize,4)})(f),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},w.prototype.flush=function(){for(var f=this.bytesWritten,S=0;S<this.dirRecords.length;S++)this.push({data:this.dirRecords[S],meta:{percent:100}});var p=this.bytesWritten-f,b=(function(m,h,E,v,x){var T=s.transformTo("string",x(v));return _.CENTRAL_DIRECTORY_END+"\0\0\0\0"+o(m,2)+o(m,2)+o(h,4)+o(E,4)+o(T.length,2)+T})(this.dirRecords.length,p,f,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(f){this._sources.push(f);var S=this;return f.on("data",function(p){S.processChunk(p)}),f.on("end",function(){S.closedSource(S.previous.streamInfo),S._sources.length?S.prepareNextSource():S.end()}),f.on("error",function(p){S.error(p)}),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(f){var S=this._sources;if(!u.prototype.error.call(this,f))return!1;for(var p=0;p<S.length;p++)try{S[p].error(f)}catch{}return!0},w.prototype.lock=function(){u.prototype.lock.call(this);for(var f=this._sources,S=0;S<f.length;S++)f[S].lock()},r.exports=w},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,i){var o=n("../compressions"),l=n("./ZipFileWorker");i.generateWorker=function(s,u,d){var g=new l(u.streamFiles,d,u.platform,u.encodeFileName),_=0;try{s.forEach(function(w,f){_++;var S=(function(h,E){var v=h||E,x=o[v];if(!x)throw new Error(v+" is not a valid compression method !");return x})(f.options.compression,u.compression),p=f.options.compressionOptions||u.compressionOptions||{},b=f.dir,m=f.date;f._compressWorker(S,p).withStreamInfo("file",{name:w,dir:b,date:m,comment:f.comment||"",unixPermissions:f.unixPermissions,dosPermissions:f.dosPermissions}).pipe(g)}),g.entriesCount=_}catch(w){g.error(w)}return g}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,i){function o(){if(!(this instanceof o))return new o;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 o;for(var s in this)typeof this[s]!="function"&&(l[s]=this[s]);return l}}(o.prototype=n("./object")).loadAsync=n("./load"),o.support=n("./support"),o.defaults=n("./defaults"),o.version="3.10.1",o.loadAsync=function(l,s){return new o().loadAsync(l,s)},o.external=n("./external"),r.exports=o},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,i){var o=n("./utils"),l=n("./external"),s=n("./utf8"),u=n("./zipEntries"),d=n("./stream/Crc32Probe"),g=n("./nodejsUtils");function _(w){return new l.Promise(function(f,S){var p=w.decompressed.getContentWorker().pipe(new d);p.on("error",function(b){S(b)}).on("end",function(){p.streamInfo.crc32!==w.decompressed.crc32?S(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}r.exports=function(w,f){var S=this;return f=o.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:s.utf8decode}),g.isNode&&g.isStream(w)?l.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):o.prepareContent("the loaded zip file",w,!0,f.optimizedBinaryString,f.base64).then(function(p){var b=new u(f);return b.load(p),b}).then(function(p){var b=[l.Promise.resolve(p)],m=p.files;if(f.checkCRC32)for(var h=0;h<m.length;h++)b.push(_(m[h]));return l.Promise.all(b)}).then(function(p){for(var b=p.shift(),m=b.files,h=0;h<m.length;h++){var E=m[h],v=E.fileNameStr,x=o.resolve(E.fileNameStr);S.file(x,E.decompressed,{binary:!0,optimizedBinaryString:!0,date:E.date,dir:E.dir,comment:E.fileCommentStr.length?E.fileCommentStr:null,unixPermissions:E.unixPermissions,dosPermissions:E.dosPermissions,createFolders:f.createFolders}),E.dir||(S.file(x).unsafeOriginalName=v)}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 o=n("../utils"),l=n("../stream/GenericWorker");function s(u,d){l.call(this,"Nodejs stream input adapter for "+u),this._upstreamEnded=!1,this._bindStream(d)}o.inherits(s,l),s.prototype._bindStream=function(u){var d=this;(this._stream=u).pause(),u.on("data",function(g){d.push({data:g,meta:{percent:0}})}).on("error",function(g){d.isPaused?this.generatedError=g:d.error(g)}).on("end",function(){d.isPaused?d._upstreamEnded=!0:d.end()})},s.prototype.pause=function(){return!!l.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,i){var o=n("readable-stream").Readable;function l(s,u,d){o.call(this,u),this._helper=s;var g=this;s.on("data",function(_,w){g.push(_)||g._helper.pause(),d&&d(w)}).on("error",function(_){g.emit("error",_)}).on("end",function(){g.push(null)})}n("../utils").inherits(l,o),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(o,l){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(o,l);if(typeof o=="number")throw new Error('The "data" argument must not be a number');return new Buffer(o,l)},allocBuffer:function(o){if(Buffer.alloc)return Buffer.alloc(o);var l=new Buffer(o);return l.fill(0),l},isBuffer:function(o){return Buffer.isBuffer(o)},isStream:function(o){return o&&typeof o.on=="function"&&typeof o.pause=="function"&&typeof o.resume=="function"}}},{}],15:[function(n,r,i){function o(x,T,M){var F,D=s.getTypeOf(T),G=s.extend(M||{},g);G.date=G.date||new Date,G.compression!==null&&(G.compression=G.compression.toUpperCase()),typeof G.unixPermissions=="string"&&(G.unixPermissions=parseInt(G.unixPermissions,8)),G.unixPermissions&&16384&G.unixPermissions&&(G.dir=!0),G.dosPermissions&&16&G.dosPermissions&&(G.dir=!0),G.dir&&(x=m(x)),G.createFolders&&(F=b(x))&&h.call(this,F,!0);var te=D==="string"&&G.binary===!1&&G.base64===!1;M&&M.binary!==void 0||(G.binary=!te),(T instanceof _&&T.uncompressedSize===0||G.dir||!T||T.length===0)&&(G.base64=!1,G.binary=!0,T="",G.compression="STORE",D="string");var I=null;I=T instanceof _||T instanceof u?T:S.isNode&&S.isStream(T)?new p(x,T):s.prepareContent(x,T,G.binary,G.optimizedBinaryString,G.base64);var j=new w(x,I,G);this.files[x]=j}var l=n("./utf8"),s=n("./utils"),u=n("./stream/GenericWorker"),d=n("./stream/StreamHelper"),g=n("./defaults"),_=n("./compressedObject"),w=n("./zipObject"),f=n("./generate"),S=n("./nodejsUtils"),p=n("./nodejs/NodejsStreamInputAdapter"),b=function(x){x.slice(-1)==="/"&&(x=x.substring(0,x.length-1));var T=x.lastIndexOf("/");return 0<T?x.substring(0,T):""},m=function(x){return x.slice(-1)!=="/"&&(x+="/"),x},h=function(x,T){return T=T!==void 0?T:g.createFolders,x=m(x),this.files[x]||o.call(this,x,null,{dir:!0,createFolders:T}),this.files[x]};function E(x){return Object.prototype.toString.call(x)==="[object RegExp]"}var v={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(x){var T,M,F;for(T in this.files)F=this.files[T],(M=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&x(M,F)},filter:function(x){var T=[];return this.forEach(function(M,F){x(M,F)&&T.push(F)}),T},file:function(x,T,M){if(arguments.length!==1)return x=this.root+x,o.call(this,x,T,M),this;if(E(x)){var F=x;return this.filter(function(G,te){return!te.dir&&F.test(G)})}var D=this.files[this.root+x];return D&&!D.dir?D:null},folder:function(x){if(!x)return this;if(E(x))return this.filter(function(D,G){return G.dir&&x.test(D)});var T=this.root+x,M=h.call(this,T),F=this.clone();return F.root=M.name,F},remove:function(x){x=this.root+x;var T=this.files[x];if(T||(x.slice(-1)!=="/"&&(x+="/"),T=this.files[x]),T&&!T.dir)delete this.files[x];else for(var M=this.filter(function(D,G){return G.name.slice(0,x.length)===x}),F=0;F<M.length;F++)delete this.files[M[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(x){var T,M={};try{if((M=s.extend(x||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:l.utf8encode})).type=M.type.toLowerCase(),M.compression=M.compression.toUpperCase(),M.type==="binarystring"&&(M.type="string"),!M.type)throw new Error("No output type specified.");s.checkSupport(M.type),M.platform!=="darwin"&&M.platform!=="freebsd"&&M.platform!=="linux"&&M.platform!=="sunos"||(M.platform="UNIX"),M.platform==="win32"&&(M.platform="DOS");var F=M.comment||this.comment||"";T=f.generateWorker(this,M,F)}catch(D){(T=new u("error")).error(D)}return new d(T,M.type||"string",M.mimeType)},generateAsync:function(x,T){return this.generateInternalStream(x).accumulate(T)},generateNodeStream:function(x,T){return(x=x||{}).type||(x.type="nodebuffer"),this.generateInternalStream(x).toNodejsStream(T)}};r.exports=v},{"./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 o=n("./DataReader");function l(s){o.call(this,s);for(var u=0;u<this.data.length;u++)s[u]=255&s[u]}n("../utils").inherits(l,o),l.prototype.byteAt=function(s){return this.data[this.zero+s]},l.prototype.lastIndexOfSignature=function(s){for(var u=s.charCodeAt(0),d=s.charCodeAt(1),g=s.charCodeAt(2),_=s.charCodeAt(3),w=this.length-4;0<=w;--w)if(this.data[w]===u&&this.data[w+1]===d&&this.data[w+2]===g&&this.data[w+3]===_)return w-this.zero;return-1},l.prototype.readAndCheckSignature=function(s){var u=s.charCodeAt(0),d=s.charCodeAt(1),g=s.charCodeAt(2),_=s.charCodeAt(3),w=this.readData(4);return u===w[0]&&d===w[1]&&g===w[2]&&_===w[3]},l.prototype.readData=function(s){if(this.checkOffset(s),s===0)return[];var u=this.data.slice(this.zero+this.index,this.zero+this.index+s);return this.index+=s,u},r.exports=l},{"../utils":32,"./DataReader":18}],18:[function(n,r,i){var o=n("../utils");function l(s){this.data=s,this.length=s.length,this.index=0,this.zero=0}l.prototype={checkOffset:function(s){this.checkIndex(this.index+s)},checkIndex:function(s){if(this.length<this.zero+s||s<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+s+"). Corrupted zip ?")},setIndex:function(s){this.checkIndex(s),this.index=s},skip:function(s){this.setIndex(this.index+s)},byteAt:function(){},readInt:function(s){var u,d=0;for(this.checkOffset(s),u=this.index+s-1;u>=this.index;u--)d=(d<<8)+this.byteAt(u);return this.index+=s,d},readString:function(s){return o.transformTo("string",this.readData(s))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var s=this.readInt(4);return new Date(Date.UTC(1980+(s>>25&127),(s>>21&15)-1,s>>16&31,s>>11&31,s>>5&63,(31&s)<<1))}},r.exports=l},{"../utils":32}],19:[function(n,r,i){var o=n("./Uint8ArrayReader");function l(s){o.call(this,s)}n("../utils").inherits(l,o),l.prototype.readData=function(s){this.checkOffset(s);var u=this.data.slice(this.zero+this.index,this.zero+this.index+s);return this.index+=s,u},r.exports=l},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,i){var o=n("./DataReader");function l(s){o.call(this,s)}n("../utils").inherits(l,o),l.prototype.byteAt=function(s){return this.data.charCodeAt(this.zero+s)},l.prototype.lastIndexOfSignature=function(s){return this.data.lastIndexOf(s)-this.zero},l.prototype.readAndCheckSignature=function(s){return s===this.readData(4)},l.prototype.readData=function(s){this.checkOffset(s);var u=this.data.slice(this.zero+this.index,this.zero+this.index+s);return this.index+=s,u},r.exports=l},{"../utils":32,"./DataReader":18}],21:[function(n,r,i){var o=n("./ArrayReader");function l(s){o.call(this,s)}n("../utils").inherits(l,o),l.prototype.readData=function(s){if(this.checkOffset(s),s===0)return new Uint8Array(0);var u=this.data.subarray(this.zero+this.index,this.zero+this.index+s);return this.index+=s,u},r.exports=l},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,i){var o=n("../utils"),l=n("../support"),s=n("./ArrayReader"),u=n("./StringReader"),d=n("./NodeBufferReader"),g=n("./Uint8ArrayReader");r.exports=function(_){var w=o.getTypeOf(_);return o.checkSupport(w),w!=="string"||l.uint8array?w==="nodebuffer"?new d(_):l.uint8array?new g(o.transformTo("uint8array",_)):new s(o.transformTo("array",_)):new u(_)}},{"../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 o=n("./GenericWorker"),l=n("../utils");function s(u){o.call(this,"ConvertWorker to "+u),this.destType=u}l.inherits(s,o),s.prototype.processChunk=function(u){this.push({data:l.transformTo(this.destType,u.data),meta:u.meta})},r.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,i){var o=n("./GenericWorker"),l=n("../crc32");function s(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(s,o),s.prototype.processChunk=function(u){this.streamInfo.crc32=l(u.data,this.streamInfo.crc32||0),this.push(u)},r.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,i){var o=n("../utils"),l=n("./GenericWorker");function s(u){l.call(this,"DataLengthProbe for "+u),this.propName=u,this.withStreamInfo(u,0)}o.inherits(s,l),s.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=s},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,i){var o=n("../utils"),l=n("./GenericWorker");function s(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(g){d.dataIsReady=!0,d.data=g,d.max=g&&g.length||0,d.type=o.getTypeOf(g),d.isPaused||d._tickAndRepeat()},function(g){d.error(g)})}o.inherits(s,l),s.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.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=s},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,i){function o(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}o.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,s){return this._listeners[l].push(s),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(l,s){if(this._listeners[l])for(var u=0;u<this._listeners[l].length;u++)this._listeners[l][u].call(this,s)},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 s=this;return l.on("data",function(u){s.processChunk(u)}),l.on("end",function(){s.end()}),l.on("error",function(u){s.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,s){return this.extraStreamInfo[l]=s,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=o},{}],29:[function(n,r,i){var o=n("../utils"),l=n("./ConvertWorker"),s=n("./GenericWorker"),u=n("../base64"),d=n("../support"),g=n("../external"),_=null;if(d.nodestream)try{_=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function w(S,p){return new g.Promise(function(b,m){var h=[],E=S._internalType,v=S._outputType,x=S._mimeType;S.on("data",function(T,M){h.push(T),p&&p(M)}).on("error",function(T){h=[],m(T)}).on("end",function(){try{var T=(function(M,F,D){switch(M){case"blob":return o.newBlob(o.transformTo("arraybuffer",F),D);case"base64":return u.encode(F);default:return o.transformTo(M,F)}})(v,(function(M,F){var D,G=0,te=null,I=0;for(D=0;D<F.length;D++)I+=F[D].length;switch(M){case"string":return F.join("");case"array":return Array.prototype.concat.apply([],F);case"uint8array":for(te=new Uint8Array(I),D=0;D<F.length;D++)te.set(F[D],G),G+=F[D].length;return te;case"nodebuffer":return Buffer.concat(F);default:throw new Error("concat : unsupported type '"+M+"'")}})(E,h),x);b(T)}catch(M){m(M)}h=[]}).resume()})}function f(S,p,b){var m=p;switch(p){case"blob":case"arraybuffer":m="uint8array";break;case"base64":m="string"}try{this._internalType=m,this._outputType=p,this._mimeType=b,o.checkSupport(m),this._worker=S.pipe(new l(m)),S.lock()}catch(h){this._worker=new s("error"),this._worker.error(h)}}f.prototype={accumulate:function(S){return w(this,S)},on:function(S,p){var b=this;return S==="data"?this._worker.on(S,function(m){p.call(b,m.data,m.meta)}):this._worker.on(S,function(){o.delay(p,arguments,b)}),this},resume:function(){return o.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(S){if(o.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new _(this,{objectMode:this._outputType!=="nodebuffer"},S)}},r.exports=f},{"../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 o=new ArrayBuffer(0);try{i.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var l=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);l.append(o),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 o=n("./utils"),l=n("./support"),s=n("./nodejsUtils"),u=n("./stream/GenericWorker"),d=new Array(256),g=0;g<256;g++)d[g]=252<=g?6:248<=g?5:240<=g?4:224<=g?3:192<=g?2:1;d[254]=d[254]=1;function _(){u.call(this,"utf-8 decode"),this.leftOver=null}function w(){u.call(this,"utf-8 encode")}i.utf8encode=function(f){return l.nodebuffer?s.newBufferFrom(f,"utf-8"):(function(S){var p,b,m,h,E,v=S.length,x=0;for(h=0;h<v;h++)(64512&(b=S.charCodeAt(h)))==55296&&h+1<v&&(64512&(m=S.charCodeAt(h+1)))==56320&&(b=65536+(b-55296<<10)+(m-56320),h++),x+=b<128?1:b<2048?2:b<65536?3:4;for(p=l.uint8array?new Uint8Array(x):new Array(x),h=E=0;E<x;h++)(64512&(b=S.charCodeAt(h)))==55296&&h+1<v&&(64512&(m=S.charCodeAt(h+1)))==56320&&(b=65536+(b-55296<<10)+(m-56320),h++),b<128?p[E++]=b:(b<2048?p[E++]=192|b>>>6:(b<65536?p[E++]=224|b>>>12:(p[E++]=240|b>>>18,p[E++]=128|b>>>12&63),p[E++]=128|b>>>6&63),p[E++]=128|63&b);return p})(f)},i.utf8decode=function(f){return l.nodebuffer?o.transformTo("nodebuffer",f).toString("utf-8"):(function(S){var p,b,m,h,E=S.length,v=new Array(2*E);for(p=b=0;p<E;)if((m=S[p++])<128)v[b++]=m;else if(4<(h=d[m]))v[b++]=65533,p+=h-1;else{for(m&=h===2?31:h===3?15:7;1<h&&p<E;)m=m<<6|63&S[p++],h--;1<h?v[b++]=65533:m<65536?v[b++]=m:(m-=65536,v[b++]=55296|m>>10&1023,v[b++]=56320|1023&m)}return v.length!==b&&(v.subarray?v=v.subarray(0,b):v.length=b),o.applyFromCharCode(v)})(f=o.transformTo(l.uint8array?"uint8array":"array",f))},o.inherits(_,u),_.prototype.processChunk=function(f){var S=o.transformTo(l.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(l.uint8array){var p=S;(S=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),S.set(p,this.leftOver.length)}else S=this.leftOver.concat(S);this.leftOver=null}var b=(function(h,E){var v;for((E=E||h.length)>h.length&&(E=h.length),v=E-1;0<=v&&(192&h[v])==128;)v--;return v<0||v===0?E:v+d[h[v]]>E?v:E})(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:f.meta})},_.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=_,o.inherits(w,u),w.prototype.processChunk=function(f){this.push({data:i.utf8encode(f.data),meta:f.meta})},i.Utf8EncodeWorker=w},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,i){var o=n("./support"),l=n("./base64"),s=n("./nodejsUtils"),u=n("./external");function d(p){return p}function g(p,b){for(var m=0;m<p.length;++m)b[m]=255&p.charCodeAt(m);return b}n("setimmediate"),i.newBlob=function(p,b){i.checkSupport("blob");try{return new Blob([p],{type:b})}catch{try{var m=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return m.append(p),m.getBlob(b)}catch{throw new Error("Bug : can't construct the Blob.")}}};var _={stringifyByChunk:function(p,b,m){var h=[],E=0,v=p.length;if(v<=m)return String.fromCharCode.apply(null,p);for(;E<v;)b==="array"||b==="nodebuffer"?h.push(String.fromCharCode.apply(null,p.slice(E,Math.min(E+m,v)))):h.push(String.fromCharCode.apply(null,p.subarray(E,Math.min(E+m,v)))),E+=m;return h.join("")},stringifyByChar:function(p){for(var b="",m=0;m<p.length;m++)b+=String.fromCharCode(p[m]);return b},applyCanBeUsed:{uint8array:(function(){try{return o.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return o.nodebuffer&&String.fromCharCode.apply(null,s.allocBuffer(1)).length===1}catch{return!1}})()}};function w(p){var b=65536,m=i.getTypeOf(p),h=!0;if(m==="uint8array"?h=_.applyCanBeUsed.uint8array:m==="nodebuffer"&&(h=_.applyCanBeUsed.nodebuffer),h)for(;1<b;)try{return _.stringifyByChunk(p,m,b)}catch{b=Math.floor(b/2)}return _.stringifyByChar(p)}function f(p,b){for(var m=0;m<p.length;m++)b[m]=p[m];return b}i.applyFromCharCode=w;var S={};S.string={string:d,array:function(p){return g(p,new Array(p.length))},arraybuffer:function(p){return S.string.uint8array(p).buffer},uint8array:function(p){return g(p,new Uint8Array(p.length))},nodebuffer:function(p){return g(p,s.allocBuffer(p.length))}},S.array={string:w,array:d,arraybuffer:function(p){return new Uint8Array(p).buffer},uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return s.newBufferFrom(p)}},S.arraybuffer={string:function(p){return w(new Uint8Array(p))},array:function(p){return f(new Uint8Array(p),new Array(p.byteLength))},arraybuffer:d,uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return s.newBufferFrom(new Uint8Array(p))}},S.uint8array={string:w,array:function(p){return f(p,new Array(p.length))},arraybuffer:function(p){return p.buffer},uint8array:d,nodebuffer:function(p){return s.newBufferFrom(p)}},S.nodebuffer={string:w,array:function(p){return f(p,new Array(p.length))},arraybuffer:function(p){return S.nodebuffer.uint8array(p).buffer},uint8array:function(p){return f(p,new Uint8Array(p.length))},nodebuffer:d},i.transformTo=function(p,b){if(b=b||"",!p)return b;i.checkSupport(p);var m=i.getTypeOf(b);return S[m][p](b)},i.resolve=function(p){for(var b=p.split("/"),m=[],h=0;h<b.length;h++){var E=b[h];E==="."||E===""&&h!==0&&h!==b.length-1||(E===".."?m.pop():m.push(E))}return m.join("/")},i.getTypeOf=function(p){return typeof p=="string"?"string":Object.prototype.toString.call(p)==="[object Array]"?"array":o.nodebuffer&&s.isBuffer(p)?"nodebuffer":o.uint8array&&p instanceof Uint8Array?"uint8array":o.arraybuffer&&p instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(p){if(!o[p.toLowerCase()])throw new Error(p+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(p){var b,m,h="";for(m=0;m<(p||"").length;m++)h+="\\x"+((b=p.charCodeAt(m))<16?"0":"")+b.toString(16).toUpperCase();return h},i.delay=function(p,b,m){setImmediate(function(){p.apply(m||null,b||[])})},i.inherits=function(p,b){function m(){}m.prototype=b.prototype,p.prototype=new m},i.extend=function(){var p,b,m={};for(p=0;p<arguments.length;p++)for(b in arguments[p])Object.prototype.hasOwnProperty.call(arguments[p],b)&&m[b]===void 0&&(m[b]=arguments[p][b]);return m},i.prepareContent=function(p,b,m,h,E){return u.Promise.resolve(b).then(function(v){return o.blob&&(v instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(v))!==-1)&&typeof FileReader<"u"?new u.Promise(function(x,T){var M=new FileReader;M.onload=function(F){x(F.target.result)},M.onerror=function(F){T(F.target.error)},M.readAsArrayBuffer(v)}):v}).then(function(v){var x=i.getTypeOf(v);return x?(x==="arraybuffer"?v=i.transformTo("uint8array",v):x==="string"&&(E?v=l.decode(v):m&&h!==!0&&(v=(function(T){return g(T,o.uint8array?new Uint8Array(T.length):new Array(T.length))})(v))),v):u.Promise.reject(new Error("Can't read the data of '"+p+"'. 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 o=n("./reader/readerFor"),l=n("./utils"),s=n("./signature"),u=n("./zipEntry"),d=n("./support");function g(_){this.files=[],this.loadOptions=_}g.prototype={checkSignature:function(_){if(!this.reader.readAndCheckSignature(_)){this.reader.index-=4;var w=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+l.pretty(w)+", expected "+l.pretty(_)+")")}},isSignature:function(_,w){var f=this.reader.index;this.reader.setIndex(_);var S=this.reader.readString(4)===w;return this.reader.setIndex(f),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 _=this.reader.readData(this.zipCommentLength),w=d.uint8array?"uint8array":"array",f=l.transformTo(w,_);this.zipComment=this.loadOptions.decodeFileName(f)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var _,w,f,S=this.zip64EndOfCentralSize-44;0<S;)_=this.reader.readInt(2),w=this.reader.readInt(4),f=this.reader.readData(w),this.zip64ExtensibleData[_]={id:_,length:w,value:f}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var _,w;for(_=0;_<this.files.length;_++)w=this.files[_],this.reader.setIndex(w.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),w.readLocalPart(this.reader),w.handleUTF8(),w.processAttributes()},readCentralDir:function(){var _;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(_=new u({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(_);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var _=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(_<0)throw this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(_);var w=_;if(this.checkSignature(s.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,(_=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(_),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.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(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var S=w-f;if(0<S)this.isSignature(w,s.CENTRAL_FILE_HEADER)||(this.reader.zero=S);else if(S<0)throw new Error("Corrupted zip: missing "+Math.abs(S)+" bytes.")},prepareReader:function(_){this.reader=o(_)},load:function(_){this.prepareReader(_),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=g},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,i){var o=n("./reader/readerFor"),l=n("./utils"),s=n("./compressedObject"),u=n("./crc32"),d=n("./utf8"),g=n("./compressions"),_=n("./support");function w(f,S){this.options=f,this.loadOptions=S}w.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var S,p;if(f.skip(22),this.fileNameLength=f.readInt(2),p=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.skip(p),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 g)if(Object.prototype.hasOwnProperty.call(g,m)&&g[m].magic===b)return g[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 s(this.compressedSize,this.uncompressedSize,this.crc32,S,f.readData(this.compressedSize))},readCentralPart:function(f){this.versionMadeBy=f.readInt(2),f.skip(2),this.bitFlag=f.readInt(2),this.compressionMethod=f.readString(2),this.date=f.readDate(),this.crc32=f.readInt(4),this.compressedSize=f.readInt(4),this.uncompressedSize=f.readInt(4);var S=f.readInt(2);if(this.extraFieldsLength=f.readInt(2),this.fileCommentLength=f.readInt(2),this.diskNumberStart=f.readInt(2),this.internalFileAttributes=f.readInt(2),this.externalFileAttributes=f.readInt(4),this.localHeaderOffset=f.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");f.skip(S),this.readExtraFields(f),this.parseZIP64ExtraField(f),this.fileComment=f.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var f=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=o(this.extraFields[1].value);this.uncompressedSize===l.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===l.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===l.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===l.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var S,p,b,m=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<m;)S=f.readInt(2),p=f.readInt(2),b=f.readData(p),this.extraFields[S]={id:S,length:p,value:b};f.setIndex(m)},handleUTF8:function(){var f=_.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 p=l.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(p)}var b=this.findExtraFieldUnicodeComment();if(b!==null)this.fileCommentStr=b;else{var m=l.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(m)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var S=o(f.value);return S.readInt(1)!==1||u(this.fileName)!==S.readInt(4)?null:d.utf8decode(S.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var S=o(f.value);return S.readInt(1)!==1||u(this.fileComment)!==S.readInt(4)?null:d.utf8decode(S.readData(f.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 o(S,p,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=p,this._dataBinary=b.binary,this.options={compression:b.compression,compressionOptions:b.compressionOptions}}var l=n("./stream/StreamHelper"),s=n("./stream/DataWorker"),u=n("./utf8"),d=n("./compressedObject"),g=n("./stream/GenericWorker");o.prototype={internalStream:function(S){var p=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"),p=this._decompressWorker();var h=!this._dataBinary;h&&!m&&(p=p.pipe(new u.Utf8EncodeWorker)),!h&&m&&(p=p.pipe(new u.Utf8DecodeWorker))}catch(E){(p=new g("error")).error(E)}return new l(p,b,"")},async:function(S,p){return this.internalStream(S).accumulate(p)},nodeStream:function(S,p){return this.internalStream(S||"nodebuffer").toNodejsStream(p)},_compressWorker:function(S,p){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,p)},_decompressWorker:function(){return this._data instanceof d?this._data.getContentWorker():this._data instanceof g?this._data:new s(this._data)}};for(var _=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],w=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<_.length;f++)o.prototype[_[f]]=w;r.exports=o},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,i){(function(o){var l,s,u=o.MutationObserver||o.WebKitMutationObserver;if(u){var d=0,g=new u(S),_=o.document.createTextNode("");g.observe(_,{characterData:!0}),l=function(){_.data=d=++d%2}}else if(o.setImmediate||o.MessageChannel===void 0)l="document"in o&&"onreadystatechange"in o.document.createElement("script")?function(){var p=o.document.createElement("script");p.onreadystatechange=function(){S(),p.onreadystatechange=null,p.parentNode.removeChild(p),p=null},o.document.documentElement.appendChild(p)}:function(){setTimeout(S,0)};else{var w=new o.MessageChannel;w.port1.onmessage=S,l=function(){w.port2.postMessage(0)}}var f=[];function S(){var p,b;s=!0;for(var m=f.length;m;){for(b=f,f=[],p=-1;++p<m;)b[p]();m=f.length}s=!1}r.exports=function(p){f.push(p)!==1||s||l()}}).call(this,typeof ot<"u"?ot:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,i){var o=n("immediate");function l(){}var s={},u=["REJECTED"],d=["FULFILLED"],g=["PENDING"];function _(m){if(typeof m!="function")throw new TypeError("resolver must be a function");this.state=g,this.queue=[],this.outcome=void 0,m!==l&&p(this,m)}function w(m,h,E){this.promise=m,typeof h=="function"&&(this.onFulfilled=h,this.callFulfilled=this.otherCallFulfilled),typeof E=="function"&&(this.onRejected=E,this.callRejected=this.otherCallRejected)}function f(m,h,E){o(function(){var v;try{v=h(E)}catch(x){return s.reject(m,x)}v===m?s.reject(m,new TypeError("Cannot resolve promise with itself")):s.resolve(m,v)})}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 p(m,h){var E=!1;function v(M){E||(E=!0,s.reject(m,M))}function x(M){E||(E=!0,s.resolve(m,M))}var T=b(function(){h(x,v)});T.status==="error"&&v(T.value)}function b(m,h){var E={};try{E.value=m(h),E.status="success"}catch(v){E.status="error",E.value=v}return E}(r.exports=_).prototype.finally=function(m){if(typeof m!="function")return this;var h=this.constructor;return this.then(function(E){return h.resolve(m()).then(function(){return E})},function(E){return h.resolve(m()).then(function(){throw E})})},_.prototype.catch=function(m){return this.then(null,m)},_.prototype.then=function(m,h){if(typeof m!="function"&&this.state===d||typeof h!="function"&&this.state===u)return this;var E=new this.constructor(l);return this.state!==g?f(E,this.state===d?m:h,this.outcome):this.queue.push(new w(E,m,h)),E},w.prototype.callFulfilled=function(m){s.resolve(this.promise,m)},w.prototype.otherCallFulfilled=function(m){f(this.promise,this.onFulfilled,m)},w.prototype.callRejected=function(m){s.reject(this.promise,m)},w.prototype.otherCallRejected=function(m){f(this.promise,this.onRejected,m)},s.resolve=function(m,h){var E=b(S,h);if(E.status==="error")return s.reject(m,E.value);var v=E.value;if(v)p(m,v);else{m.state=d,m.outcome=h;for(var x=-1,T=m.queue.length;++x<T;)m.queue[x].callFulfilled(h)}return m},s.reject=function(m,h){m.state=u,m.outcome=h;for(var E=-1,v=m.queue.length;++E<v;)m.queue[E].callRejected(h);return m},_.resolve=function(m){return m instanceof this?m:s.resolve(new this(l),m)},_.reject=function(m){var h=new this(l);return s.reject(h,m)},_.all=function(m){var h=this;if(Object.prototype.toString.call(m)!=="[object Array]")return this.reject(new TypeError("must be an array"));var E=m.length,v=!1;if(!E)return this.resolve([]);for(var x=new Array(E),T=0,M=-1,F=new this(l);++M<E;)D(m[M],M);return F;function D(G,te){h.resolve(G).then(function(I){x[te]=I,++T!==E||v||(v=!0,s.resolve(F,x))},function(I){v||(v=!0,s.reject(F,I))})}},_.race=function(m){var h=this;if(Object.prototype.toString.call(m)!=="[object Array]")return this.reject(new TypeError("must be an array"));var E=m.length,v=!1;if(!E)return this.resolve([]);for(var x=-1,T=new this(l);++x<E;)M=m[x],h.resolve(M).then(function(F){v||(v=!0,s.resolve(T,F))},function(F){v||(v=!0,s.reject(T,F))});var M;return T}},{immediate:36}],38:[function(n,r,i){var o={};(0,n("./lib/utils/common").assign)(o,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=o},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,i){var o=n("./zlib/deflate"),l=n("./utils/common"),s=n("./utils/strings"),u=n("./zlib/messages"),d=n("./zlib/zstream"),g=Object.prototype.toString,_=0,w=-1,f=0,S=8;function p(m){if(!(this instanceof p))return new p(m);this.options=l.assign({level:w,method:S,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,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 E=o.deflateInit2(this.strm,h.level,h.method,h.windowBits,h.memLevel,h.strategy);if(E!==_)throw new Error(u[E]);if(h.header&&o.deflateSetHeader(this.strm,h.header),h.dictionary){var v;if(v=typeof h.dictionary=="string"?s.string2buf(h.dictionary):g.call(h.dictionary)==="[object ArrayBuffer]"?new Uint8Array(h.dictionary):h.dictionary,(E=o.deflateSetDictionary(this.strm,v))!==_)throw new Error(u[E]);this._dict_set=!0}}function b(m,h){var E=new p(h);if(E.push(m,!0),E.err)throw E.msg||u[E.err];return E.result}p.prototype.push=function(m,h){var E,v,x=this.strm,T=this.options.chunkSize;if(this.ended)return!1;v=h===~~h?h:h===!0?4:0,typeof m=="string"?x.input=s.string2buf(m):g.call(m)==="[object ArrayBuffer]"?x.input=new Uint8Array(m):x.input=m,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new l.Buf8(T),x.next_out=0,x.avail_out=T),(E=o.deflate(x,v))!==1&&E!==_)return this.onEnd(E),!(this.ended=!0);x.avail_out!==0&&(x.avail_in!==0||v!==4&&v!==2)||(this.options.to==="string"?this.onData(s.buf2binstring(l.shrinkBuf(x.output,x.next_out))):this.onData(l.shrinkBuf(x.output,x.next_out)))}while((0<x.avail_in||x.avail_out===0)&&E!==1);return v===4?(E=o.deflateEnd(this.strm),this.onEnd(E),this.ended=!0,E===_):v!==2||(this.onEnd(_),!(x.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===_&&(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=p,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 o=n("./zlib/inflate"),l=n("./utils/common"),s=n("./utils/strings"),u=n("./zlib/constants"),d=n("./zlib/messages"),g=n("./zlib/zstream"),_=n("./zlib/gzheader"),w=Object.prototype.toString;function f(p){if(!(this instanceof f))return new f(p);this.options=l.assign({chunkSize:16384,windowBits:0,to:""},p||{});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)||p&&p.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 g,this.strm.avail_out=0;var m=o.inflateInit2(this.strm,b.windowBits);if(m!==u.Z_OK)throw new Error(d[m]);this.header=new _,o.inflateGetHeader(this.strm,this.header)}function S(p,b){var m=new f(b);if(m.push(p,!0),m.err)throw m.msg||d[m.err];return m.result}f.prototype.push=function(p,b){var m,h,E,v,x,T,M=this.strm,F=this.options.chunkSize,D=this.options.dictionary,G=!1;if(this.ended)return!1;h=b===~~b?b:b===!0?u.Z_FINISH:u.Z_NO_FLUSH,typeof p=="string"?M.input=s.binstring2buf(p):w.call(p)==="[object ArrayBuffer]"?M.input=new Uint8Array(p):M.input=p,M.next_in=0,M.avail_in=M.input.length;do{if(M.avail_out===0&&(M.output=new l.Buf8(F),M.next_out=0,M.avail_out=F),(m=o.inflate(M,u.Z_NO_FLUSH))===u.Z_NEED_DICT&&D&&(T=typeof D=="string"?s.string2buf(D):w.call(D)==="[object ArrayBuffer]"?new Uint8Array(D):D,m=o.inflateSetDictionary(this.strm,T)),m===u.Z_BUF_ERROR&&G===!0&&(m=u.Z_OK,G=!1),m!==u.Z_STREAM_END&&m!==u.Z_OK)return this.onEnd(m),!(this.ended=!0);M.next_out&&(M.avail_out!==0&&m!==u.Z_STREAM_END&&(M.avail_in!==0||h!==u.Z_FINISH&&h!==u.Z_SYNC_FLUSH)||(this.options.to==="string"?(E=s.utf8border(M.output,M.next_out),v=M.next_out-E,x=s.buf2string(M.output,E),M.next_out=v,M.avail_out=F-v,v&&l.arraySet(M.output,M.output,E,v,0),this.onData(x)):this.onData(l.shrinkBuf(M.output,M.next_out)))),M.avail_in===0&&M.avail_out===0&&(G=!0)}while((0<M.avail_in||M.avail_out===0)&&m!==u.Z_STREAM_END);return m===u.Z_STREAM_END&&(h=u.Z_FINISH),h===u.Z_FINISH?(m=o.inflateEnd(this.strm),this.onEnd(m),this.ended=!0,m===u.Z_OK):h!==u.Z_SYNC_FLUSH||(this.onEnd(u.Z_OK),!(M.avail_out=0))},f.prototype.onData=function(p){this.chunks.push(p)},f.prototype.onEnd=function(p){p===u.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=l.flattenChunks(this.chunks)),this.chunks=[],this.err=p,this.msg=this.strm.msg},i.Inflate=f,i.inflate=S,i.inflateRaw=function(p,b){return(b=b||{}).raw=!0,S(p,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 o=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 g=d.shift();if(g){if(typeof g!="object")throw new TypeError(g+"must be non-object");for(var _ in g)g.hasOwnProperty(_)&&(u[_]=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,g+_),w);else for(var f=0;f<_;f++)u[w+f]=d[g+f]},flattenChunks:function(u){var d,g,_,w,f,S;for(d=_=0,g=u.length;d<g;d++)_+=u[d].length;for(S=new Uint8Array(_),d=w=0,g=u.length;d<g;d++)f=u[d],S.set(f,w),w+=f.length;return S}},s={arraySet:function(u,d,g,_,w){for(var f=0;f<_;f++)u[w+f]=d[g+f]},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,s))},i.setTyped(o)},{}],42:[function(n,r,i){var o=n("./common"),l=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch{l=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{s=!1}for(var u=new o.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&&(_.subarray&&s||!_.subarray&&l))return String.fromCharCode.apply(null,o.shrinkBuf(_,w));for(var f="",S=0;S<w;S++)f+=String.fromCharCode(_[S]);return f}u[254]=u[254]=1,i.string2buf=function(_){var w,f,S,p,b,m=_.length,h=0;for(p=0;p<m;p++)(64512&(f=_.charCodeAt(p)))==55296&&p+1<m&&(64512&(S=_.charCodeAt(p+1)))==56320&&(f=65536+(f-55296<<10)+(S-56320),p++),h+=f<128?1:f<2048?2:f<65536?3:4;for(w=new o.Buf8(h),p=b=0;b<h;p++)(64512&(f=_.charCodeAt(p)))==55296&&p+1<m&&(64512&(S=_.charCodeAt(p+1)))==56320&&(f=65536+(f-55296<<10)+(S-56320),p++),f<128?w[b++]=f:(f<2048?w[b++]=192|f>>>6:(f<65536?w[b++]=224|f>>>12:(w[b++]=240|f>>>18,w[b++]=128|f>>>12&63),w[b++]=128|f>>>6&63),w[b++]=128|63&f);return w},i.buf2binstring=function(_){return g(_,_.length)},i.binstring2buf=function(_){for(var w=new o.Buf8(_.length),f=0,S=w.length;f<S;f++)w[f]=_.charCodeAt(f);return w},i.buf2string=function(_,w){var f,S,p,b,m=w||_.length,h=new Array(2*m);for(f=S=0;f<m;)if((p=_[f++])<128)h[S++]=p;else if(4<(b=u[p]))h[S++]=65533,f+=b-1;else{for(p&=b===2?31:b===3?15:7;1<b&&f<m;)p=p<<6|63&_[f++],b--;1<b?h[S++]=65533:p<65536?h[S++]=p:(p-=65536,h[S++]=55296|p>>10&1023,h[S++]=56320|1023&p)}return g(h,S)},i.utf8border=function(_,w){var f;for((w=w||_.length)>_.length&&(w=_.length),f=w-1;0<=f&&(192&_[f])==128;)f--;return f<0||f===0?w:f+u[_[f]]>w?f:w}},{"./common":41}],43:[function(n,r,i){r.exports=function(o,l,s,u){for(var d=65535&o|0,g=o>>>16&65535|0,_=0;s!==0;){for(s-=_=2e3<s?2e3:s;g=g+(d=d+l[u++]|0)|0,--_;);d%=65521,g%=65521}return d|g<<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 o=(function(){for(var l,s=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;s[u]=l}return s})();r.exports=function(l,s,u,d){var g=o,_=d+u;l^=-1;for(var w=d;w<_;w++)l=l>>>8^g[255&(l^s[w])];return-1^l}},{}],46:[function(n,r,i){var o,l=n("../utils/common"),s=n("./trees"),u=n("./adler32"),d=n("./crc32"),g=n("./messages"),_=0,w=4,f=0,S=-2,p=-1,b=4,m=2,h=8,E=9,v=286,x=30,T=19,M=2*v+1,F=15,D=3,G=258,te=G+D+1,I=42,j=113,c=1,U=2,N=3,z=4;function q(a,$){return a.msg=g[$],$}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,P=$.pending;P>a.avail_out&&(P=a.avail_out),P!==0&&(l.arraySet(a.output,$.pending_buf,$.pending_out,P,a.next_out),a.next_out+=P,$.pending_out+=P,a.total_out+=P,a.avail_out-=P,$.pending-=P,$.pending===0&&($.pending_out=0))}function R(a,$){s._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 V(a,$){a.pending_buf[a.pending++]=$>>>8&255,a.pending_buf[a.pending++]=255&$}function W(a,$){var P,O,y=a.max_chain_length,k=a.strstart,H=a.prev_length,Z=a.nice_match,C=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+G,de=X[k+H-1],ue=X[k+H];a.prev_length>=a.good_match&&(y>>=2),Z>a.lookahead&&(Z=a.lookahead);do if(X[(P=$)+H]===ue&&X[P+H-1]===de&&X[P]===X[k]&&X[++P]===X[k+1]){k+=2,P++;do;while(X[++k]===X[++P]&&X[++k]===X[++P]&&X[++k]===X[++P]&&X[++k]===X[++P]&&X[++k]===X[++P]&&X[++k]===X[++P]&&X[++k]===X[++P]&&X[++k]===X[++P]&&k<ne);if(O=G-(ne-k),k=ne-G,H<O){if(a.match_start=$,Z<=(H=O))break;de=X[k+H-1],ue=X[k+H]}}while(($=K[$&Q])>C&&--y!=0);return H<=a.lookahead?H:a.lookahead}function ae(a){var $,P,O,y,k,H,Z,C,X,Q,K=a.w_size;do{if(y=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,$=P=a.hash_size;O=a.head[--$],a.head[$]=K<=O?O-K:0,--P;);for($=P=K;O=a.prev[--$],a.prev[$]=K<=O?O-K:0,--P;);y+=K}if(a.strm.avail_in===0)break;if(H=a.strm,Z=a.window,C=a.strstart+a.lookahead,X=y,Q=void 0,Q=H.avail_in,X<Q&&(Q=X),P=Q===0?0:(H.avail_in-=Q,l.arraySet(Z,H.input,H.next_in,Q,C),H.state.wrap===1?H.adler=u(H.adler,Z,Q,C):H.state.wrap===2&&(H.adler=d(H.adler,Z,Q,C)),H.next_in+=Q,H.total_in+=Q,Q),a.lookahead+=P,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 P,O;;){if(a.lookahead<te){if(ae(a),a.lookahead<te&&$===_)return c;if(a.lookahead===0)break}if(P=0,a.lookahead>=D&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+D-1])&a.hash_mask,P=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),P!==0&&a.strstart-P<=a.w_size-te&&(a.match_length=W(a,P)),a.match_length>=D)if(O=s._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,P=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=s._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:z):a.last_lit&&(R(a,!1),a.strm.avail_out===0)?c:U}function re(a,$){for(var P,O,y;;){if(a.lookahead<te){if(ae(a),a.lookahead<te&&$===_)return c;if(a.lookahead===0)break}if(P=0,a.lookahead>=D&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+D-1])&a.hash_mask,P=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,P!==0&&a.prev_length<a.max_lazy_match&&a.strstart-P<=a.w_size-te&&(a.match_length=W(a,P),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(y=a.strstart+a.lookahead-D,O=s._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<=y&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+D-1])&a.hash_mask,P=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=s._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=s._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:z):a.last_lit&&(R(a,!1),a.strm.avail_out===0)?c:U}function se(a,$,P,O,y){this.good_length=a,this.max_lazy=$,this.nice_length=P,this.max_chain=O,this.func=y}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*M),this.dyn_dtree=new l.Buf16(2*(2*x+1)),this.bl_tree=new l.Buf16(2*(2*T+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*v+1),J(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new l.Buf16(2*v+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?I:j,a.adler=$.wrap===2?0:1,$.last_flush=_,s._tr_init($),f):q(a,S)}function fe(a){var $=pe(a);return $===f&&(function(P){P.window_size=2*P.w_size,J(P.head),P.max_lazy_match=o[P.level].max_lazy,P.good_match=o[P.level].good_length,P.nice_match=o[P.level].nice_length,P.max_chain_length=o[P.level].max_chain,P.strstart=0,P.block_start=0,P.lookahead=0,P.insert=0,P.match_length=P.prev_length=D-1,P.match_available=0,P.ins_h=0})(a.state),$}function ge(a,$,P,O,y,k){if(!a)return S;var H=1;if($===p&&($=6),O<0?(H=0,O=-O):15<O&&(H=2,O-=16),y<1||E<y||P!==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=y+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<<y+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=P,fe(a)}o=[new se(0,0,0,0,function(a,$){var P=65535;for(P>a.pending_buf_size-5&&(P=a.pending_buf_size-5);;){if(a.lookahead<=1){if(ae(a),a.lookahead===0&&$===_)return c;if(a.lookahead===0)break}a.strstart+=a.lookahead,a.lookahead=0;var O=a.block_start+P;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:z):(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=$,f):S},i.deflate=function(a,$){var P,O,y,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,P=O.last_flush,O.last_flush=$,O.status===I)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,V(O,H),O.strstart!==0&&(V(O,a.adler>>>16),V(O,65535&a.adler)),a.adler=1}if(O.status===69)if(O.gzhead.extra){for(y=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>y&&(a.adler=d(a.adler,O.pending_buf,O.pending-y,y)),A(a),y=O.pending,O.pending!==O.pending_buf_size));)Y(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>y&&(a.adler=d(a.adler,O.pending_buf,O.pending-y,y)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){y=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>y&&(a.adler=d(a.adler,O.pending_buf,O.pending-y,y)),A(a),y=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>y&&(a.adler=d(a.adler,O.pending_buf,O.pending-y,y)),k===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){y=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>y&&(a.adler=d(a.adler,O.pending_buf,O.pending-y,y)),A(a),y=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>y&&(a.adler=d(a.adler,O.pending_buf,O.pending-y,y)),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,f}else if(a.avail_in===0&&B($)<=B(P)&&$!==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||$!==_&&O.status!==666){var Z=O.strategy===2?(function(C,X){for(var Q;;){if(C.lookahead===0&&(ae(C),C.lookahead===0)){if(X===_)return c;break}if(C.match_length=0,Q=s._tr_tally(C,0,C.window[C.strstart]),C.lookahead--,C.strstart++,Q&&(R(C,!1),C.strm.avail_out===0))return c}return C.insert=0,X===w?(R(C,!0),C.strm.avail_out===0?N:z):C.last_lit&&(R(C,!1),C.strm.avail_out===0)?c:U})(O,$):O.strategy===3?(function(C,X){for(var Q,K,ne,de,ue=C.window;;){if(C.lookahead<=G){if(ae(C),C.lookahead<=G&&X===_)return c;if(C.lookahead===0)break}if(C.match_length=0,C.lookahead>=D&&0<C.strstart&&(K=ue[ne=C.strstart-1])===ue[++ne]&&K===ue[++ne]&&K===ue[++ne]){de=C.strstart+G;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);C.match_length=G-(de-ne),C.match_length>C.lookahead&&(C.match_length=C.lookahead)}if(C.match_length>=D?(Q=s._tr_tally(C,1,C.match_length-D),C.lookahead-=C.match_length,C.strstart+=C.match_length,C.match_length=0):(Q=s._tr_tally(C,0,C.window[C.strstart]),C.lookahead--,C.strstart++),Q&&(R(C,!1),C.strm.avail_out===0))return c}return C.insert=0,X===w?(R(C,!0),C.strm.avail_out===0?N:z):C.last_lit&&(R(C,!1),C.strm.avail_out===0)?c:U})(O,$):o[O.level].func(O,$);if(Z!==N&&Z!==z||(O.status=666),Z===c||Z===N)return a.avail_out===0&&(O.last_flush=-1),f;if(Z===U&&($===1?s._tr_align(O):$!==5&&(s._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,f}return $!==w?f: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)):(V(O,a.adler>>>16),V(O,65535&a.adler)),A(a),0<O.wrap&&(O.wrap=-O.wrap),O.pending!==0?f:1)},i.deflateEnd=function(a){var $;return a&&a.state?($=a.state.status)!==I&&$!==69&&$!==73&&$!==91&&$!==103&&$!==j&&$!==666?q(a,S):(a.state=null,$===j?q(a,-3):f):S},i.deflateSetDictionary=function(a,$){var P,O,y,k,H,Z,C,X,Q=$.length;if(!a||!a.state||(k=(P=a.state).wrap)===2||k===1&&P.status!==I||P.lookahead)return S;for(k===1&&(a.adler=u(a.adler,$,Q,0)),P.wrap=0,Q>=P.w_size&&(k===0&&(J(P.head),P.strstart=0,P.block_start=0,P.insert=0),X=new l.Buf8(P.w_size),l.arraySet(X,$,Q-P.w_size,P.w_size,0),$=X,Q=P.w_size),H=a.avail_in,Z=a.next_in,C=a.input,a.avail_in=Q,a.next_in=0,a.input=$,ae(P);P.lookahead>=D;){for(O=P.strstart,y=P.lookahead-(D-1);P.ins_h=(P.ins_h<<P.hash_shift^P.window[O+D-1])&P.hash_mask,P.prev[O&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=O,O++,--y;);P.strstart=O,P.lookahead=D-1,ae(P)}return P.strstart+=P.lookahead,P.block_start=P.strstart,P.insert=P.lookahead,P.lookahead=0,P.match_length=P.prev_length=D-1,P.match_available=0,a.next_in=Z,a.input=C,a.avail_in=H,P.wrap=k,f},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(o,l){var s,u,d,g,_,w,f,S,p,b,m,h,E,v,x,T,M,F,D,G,te,I,j,c,U;s=o.state,u=o.next_in,c=o.input,d=u+(o.avail_in-5),g=o.next_out,U=o.output,_=g-(l-o.avail_out),w=g+(o.avail_out-257),f=s.dmax,S=s.wsize,p=s.whave,b=s.wnext,m=s.window,h=s.hold,E=s.bits,v=s.lencode,x=s.distcode,T=(1<<s.lenbits)-1,M=(1<<s.distbits)-1;e:do{E<15&&(h+=c[u++]<<E,E+=8,h+=c[u++]<<E,E+=8),F=v[h&T];t:for(;;){if(h>>>=D=F>>>24,E-=D,(D=F>>>16&255)===0)U[g++]=65535&F;else{if(!(16&D)){if((64&D)==0){F=v[(65535&F)+(h&(1<<D)-1)];continue t}if(32&D){s.mode=12;break e}o.msg="invalid literal/length code",s.mode=30;break e}G=65535&F,(D&=15)&&(E<D&&(h+=c[u++]<<E,E+=8),G+=h&(1<<D)-1,h>>>=D,E-=D),E<15&&(h+=c[u++]<<E,E+=8,h+=c[u++]<<E,E+=8),F=x[h&M];n:for(;;){if(h>>>=D=F>>>24,E-=D,!(16&(D=F>>>16&255))){if((64&D)==0){F=x[(65535&F)+(h&(1<<D)-1)];continue n}o.msg="invalid distance code",s.mode=30;break e}if(te=65535&F,E<(D&=15)&&(h+=c[u++]<<E,(E+=8)<D&&(h+=c[u++]<<E,E+=8)),f<(te+=h&(1<<D)-1)){o.msg="invalid distance too far back",s.mode=30;break e}if(h>>>=D,E-=D,(D=g-_)<te){if(p<(D=te-D)&&s.sane){o.msg="invalid distance too far back",s.mode=30;break e}if(j=m,(I=0)===b){if(I+=S-D,D<G){for(G-=D;U[g++]=m[I++],--D;);I=g-te,j=U}}else if(b<D){if(I+=S+b-D,(D-=b)<G){for(G-=D;U[g++]=m[I++],--D;);if(I=0,b<G){for(G-=D=b;U[g++]=m[I++],--D;);I=g-te,j=U}}}else if(I+=b-D,D<G){for(G-=D;U[g++]=m[I++],--D;);I=g-te,j=U}for(;2<G;)U[g++]=j[I++],U[g++]=j[I++],U[g++]=j[I++],G-=3;G&&(U[g++]=j[I++],1<G&&(U[g++]=j[I++]))}else{for(I=g-te;U[g++]=U[I++],U[g++]=U[I++],U[g++]=U[I++],2<(G-=3););G&&(U[g++]=U[I++],1<G&&(U[g++]=U[I++]))}break}}break}}while(u<d&&g<w);u-=G=E>>3,h&=(1<<(E-=G<<3))-1,o.next_in=u,o.next_out=g,o.avail_in=u<d?d-u+5:5-(u-d),o.avail_out=g<w?w-g+257:257-(g-w),s.hold=h,s.bits=E}},{}],49:[function(n,r,i){var o=n("../utils/common"),l=n("./adler32"),s=n("./crc32"),u=n("./inffast"),d=n("./inftrees"),g=1,_=2,w=0,f=-2,S=1,p=852,b=592;function m(I){return(I>>>24&255)+(I>>>8&65280)+((65280&I)<<8)+((255&I)<<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 o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function E(I){var j;return I&&I.state?(j=I.state,I.total_in=I.total_out=j.total=0,I.msg="",j.wrap&&(I.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 o.Buf32(p),j.distcode=j.distdyn=new o.Buf32(b),j.sane=1,j.back=-1,w):f}function v(I){var j;return I&&I.state?((j=I.state).wsize=0,j.whave=0,j.wnext=0,E(I)):f}function x(I,j){var c,U;return I&&I.state?(U=I.state,j<0?(c=0,j=-j):(c=1+(j>>4),j<48&&(j&=15)),j&&(j<8||15<j)?f:(U.window!==null&&U.wbits!==j&&(U.window=null),U.wrap=c,U.wbits=j,v(I))):f}function T(I,j){var c,U;return I?(U=new h,(I.state=U).window=null,(c=x(I,j))!==w&&(I.state=null),c):f}var M,F,D=!0;function G(I){if(D){var j;for(M=new o.Buf32(512),F=new o.Buf32(32),j=0;j<144;)I.lens[j++]=8;for(;j<256;)I.lens[j++]=9;for(;j<280;)I.lens[j++]=7;for(;j<288;)I.lens[j++]=8;for(d(g,I.lens,0,288,M,0,I.work,{bits:9}),j=0;j<32;)I.lens[j++]=5;d(_,I.lens,0,32,F,0,I.work,{bits:5}),D=!1}I.lencode=M,I.lenbits=9,I.distcode=F,I.distbits=5}function te(I,j,c,U){var N,z=I.state;return z.window===null&&(z.wsize=1<<z.wbits,z.wnext=0,z.whave=0,z.window=new o.Buf8(z.wsize)),U>=z.wsize?(o.arraySet(z.window,j,c-z.wsize,z.wsize,0),z.wnext=0,z.whave=z.wsize):(U<(N=z.wsize-z.wnext)&&(N=U),o.arraySet(z.window,j,c-U,N,z.wnext),(U-=N)?(o.arraySet(z.window,j,c-U,U,0),z.wnext=U,z.whave=z.wsize):(z.wnext+=N,z.wnext===z.wsize&&(z.wnext=0),z.whave<z.wsize&&(z.whave+=N))),0}i.inflateReset=v,i.inflateReset2=x,i.inflateResetKeep=E,i.inflateInit=function(I){return T(I,15)},i.inflateInit2=T,i.inflate=function(I,j){var c,U,N,z,q,B,J,A,R,Y,V,W,ae,ie,re,se,ce,pe,fe,ge,a,$,P,O,y=0,k=new o.Buf8(4),H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!I||!I.state||!I.output||!I.input&&I.avail_in!==0)return f;(c=I.state).mode===12&&(c.mode=13),q=I.next_out,N=I.output,J=I.avail_out,z=I.next_in,U=I.input,B=I.avail_in,A=c.hold,R=c.bits,Y=B,V=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[z++]<<R,R+=8}if(2&c.wrap&&A===35615){k[c.check=0]=255&A,k[1]=A>>>8&255,c.check=s(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){I.msg="incorrect header check",c.mode=30;break}if((15&A)!=8){I.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){I.msg="invalid window size",c.mode=30;break}c.dmax=1<<a,I.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[z++]<<R,R+=8}if(c.flags=A,(255&c.flags)!=8){I.msg="unknown compression method",c.mode=30;break}if(57344&c.flags){I.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=s(c.check,k,2,0)),R=A=0,c.mode=3;case 3:for(;R<32;){if(B===0)break e;B--,A+=U[z++]<<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=s(c.check,k,4,0)),R=A=0,c.mode=4;case 4:for(;R<16;){if(B===0)break e;B--,A+=U[z++]<<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=s(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[z++]<<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=s(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)),o.arraySet(c.head.extra,U,z,W,a)),512&c.flags&&(c.check=s(c.check,U,W,z)),B-=W,z+=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[z+W++],c.head&&a&&c.length<65536&&(c.head.name+=String.fromCharCode(a)),a&&W<B;);if(512&c.flags&&(c.check=s(c.check,U,W,z)),B-=W,z+=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[z+W++],c.head&&a&&c.length<65536&&(c.head.comment+=String.fromCharCode(a)),a&&W<B;);if(512&c.flags&&(c.check=s(c.check,U,W,z)),B-=W,z+=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[z++]<<R,R+=8}if(A!==(65535&c.check)){I.msg="header crc mismatch",c.mode=30;break}R=A=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0),I.adler=c.check=0,c.mode=12;break;case 10:for(;R<32;){if(B===0)break e;B--,A+=U[z++]<<R,R+=8}I.adler=c.check=m(A),R=A=0,c.mode=11;case 11:if(c.havedict===0)return I.next_out=q,I.avail_out=J,I.next_in=z,I.avail_in=B,c.hold=A,c.bits=R,2;I.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[z++]<<R,R+=8}switch(c.last=1&A,R-=1,3&(A>>>=1)){case 0:c.mode=14;break;case 1:if(G(c),c.mode=20,j!==6)break;A>>>=2,R-=2;break e;case 2:c.mode=17;break;case 3:I.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[z++]<<R,R+=8}if((65535&A)!=(A>>>16^65535)){I.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;o.arraySet(N,U,z,W,q),B-=W,z+=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[z++]<<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){I.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[z++]<<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,P={bits:c.lenbits},$=d(0,c.lens,0,19,c.lencode,0,c.work,P),c.lenbits=P.bits,$){I.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=(y=c.lencode[A&(1<<c.lenbits)-1])>>>16&255,ce=65535&y,!((re=y>>>24)<=R);){if(B===0)break e;B--,A+=U[z++]<<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[z++]<<R,R+=8}if(A>>>=re,R-=re,c.have===0){I.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[z++]<<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[z++]<<R,R+=8}R-=re,a=0,W=11+(127&(A>>>=re)),A>>>=7,R-=7}if(c.have+W>c.nlen+c.ndist){I.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){I.msg="invalid code -- missing end-of-block",c.mode=30;break}if(c.lenbits=9,P={bits:c.lenbits},$=d(g,c.lens,0,c.nlen,c.lencode,0,c.work,P),c.lenbits=P.bits,$){I.msg="invalid literal/lengths set",c.mode=30;break}if(c.distbits=6,c.distcode=c.distdyn,P={bits:c.distbits},$=d(_,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,P),c.distbits=P.bits,$){I.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){I.next_out=q,I.avail_out=J,I.next_in=z,I.avail_in=B,c.hold=A,c.bits=R,u(I,V),q=I.next_out,N=I.output,J=I.avail_out,z=I.next_in,U=I.input,B=I.avail_in,A=c.hold,R=c.bits,c.mode===12&&(c.back=-1);break}for(c.back=0;se=(y=c.lencode[A&(1<<c.lenbits)-1])>>>16&255,ce=65535&y,!((re=y>>>24)<=R);){if(B===0)break e;B--,A+=U[z++]<<R,R+=8}if(se&&(240&se)==0){for(pe=re,fe=se,ge=ce;se=(y=c.lencode[ge+((A&(1<<pe+fe)-1)>>pe)])>>>16&255,ce=65535&y,!(pe+(re=y>>>24)<=R);){if(B===0)break e;B--,A+=U[z++]<<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){I.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[z++]<<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=(y=c.distcode[A&(1<<c.distbits)-1])>>>16&255,ce=65535&y,!((re=y>>>24)<=R);){if(B===0)break e;B--,A+=U[z++]<<R,R+=8}if((240&se)==0){for(pe=re,fe=se,ge=ce;se=(y=c.distcode[ge+((A&(1<<pe+fe)-1)>>pe)])>>>16&255,ce=65535&y,!(pe+(re=y>>>24)<=R);){if(B===0)break e;B--,A+=U[z++]<<R,R+=8}A>>>=pe,R-=pe,c.back+=pe}if(A>>>=re,R-=re,c.back+=re,64&se){I.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[z++]<<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){I.msg="invalid distance too far back",c.mode=30;break}c.mode=25;case 25:if(J===0)break e;if(W=V-J,c.offset>W){if((W=c.offset-W)>c.whave&&c.sane){I.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[z++]<<R,R+=8}if(V-=J,I.total_out+=V,c.total+=V,V&&(I.adler=c.check=c.flags?s(c.check,N,V,q-V):l(c.check,N,V,q-V)),V=J,(c.flags?A:m(A))!==c.check){I.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[z++]<<R,R+=8}if(A!==(4294967295&c.total)){I.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 f}return I.next_out=q,I.avail_out=J,I.next_in=z,I.avail_in=B,c.hold=A,c.bits=R,(c.wsize||V!==I.avail_out&&c.mode<30&&(c.mode<27||j!==4))&&te(I,I.output,I.next_out,V-I.avail_out)?(c.mode=31,-4):(Y-=I.avail_in,V-=I.avail_out,I.total_in+=Y,I.total_out+=V,c.total+=V,c.wrap&&V&&(I.adler=c.check=c.flags?s(c.check,N,V,I.next_out-V):l(c.check,N,V,I.next_out-V)),I.data_type=c.bits+(c.last?64:0)+(c.mode===12?128:0)+(c.mode===20||c.mode===15?256:0),(Y==0&&V===0||j===4)&&$===w&&($=-5),$)},i.inflateEnd=function(I){if(!I||!I.state)return f;var j=I.state;return j.window&&(j.window=null),I.state=null,w},i.inflateGetHeader=function(I,j){var c;return I&&I.state?(2&(c=I.state).wrap)==0?f:((c.head=j).done=!1,w):f},i.inflateSetDictionary=function(I,j){var c,U=j.length;return I&&I.state?(c=I.state).wrap!==0&&c.mode!==11?f:c.mode===11&&l(1,j,U,0)!==c.check?-3:te(I,j,U,U)?(c.mode=31,-4):(c.havedict=1,w):f},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,i){var o=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],s=[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,f,S,p,b,m){var h,E,v,x,T,M,F,D,G,te=m.bits,I=0,j=0,c=0,U=0,N=0,z=0,q=0,B=0,J=0,A=0,R=null,Y=0,V=new o.Buf16(16),W=new o.Buf16(16),ae=null,ie=0;for(I=0;I<=15;I++)V[I]=0;for(j=0;j<f;j++)V[_[w+j]]++;for(N=te,U=15;1<=U&&V[U]===0;U--);if(U<N&&(N=U),U===0)return S[p++]=20971520,S[p++]=20971520,m.bits=1,0;for(c=1;c<U&&V[c]===0;c++);for(N<c&&(N=c),I=B=1;I<=15;I++)if(B<<=1,(B-=V[I])<0)return-1;if(0<B&&(g===0||U!==1))return-1;for(W[1]=0,I=1;I<15;I++)W[I+1]=W[I]+V[I];for(j=0;j<f;j++)_[w+j]!==0&&(b[W[_[w+j]]++]=j);if(M=g===0?(R=ae=b,19):g===1?(R=l,Y-=257,ae=s,ie-=257,256):(R=u,ae=d,-1),I=c,T=p,q=j=A=0,v=-1,x=(J=1<<(z=N))-1,g===1&&852<J||g===2&&592<J)return 1;for(;;){for(F=I-q,G=b[j]<M?(D=0,b[j]):b[j]>M?(D=ae[ie+b[j]],R[Y+b[j]]):(D=96,0),h=1<<I-q,c=E=1<<z;S[T+(A>>q)+(E-=h)]=F<<24|D<<16|G|0,E!==0;);for(h=1<<I-1;A&h;)h>>=1;if(h!==0?(A&=h-1,A+=h):A=0,j++,--V[I]==0){if(I===U)break;I=_[w+b[j]]}if(N<I&&(A&x)!==v){for(q===0&&(q=N),T+=c,B=1<<(z=I-q);z+q<U&&!((B-=V[z+q])<=0);)z++,B<<=1;if(J+=1<<z,g===1&&852<J||g===2&&592<J)return 1;S[v=A&x]=N<<24|z<<16|T-p|0}}return A!==0&&(S[T+A]=I-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 o=n("../utils/common"),l=0,s=1;function u(y){for(var k=y.length;0<=--k;)y[k]=0}var d=0,g=29,_=256,w=_+1+g,f=30,S=19,p=2*w+1,b=15,m=16,h=7,E=256,v=16,x=17,T=18,M=[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],G=[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 I=new Array(2*f);u(I);var j=new Array(512);u(j);var c=new Array(256);u(c);var U=new Array(g);u(U);var N,z,q,B=new Array(f);function J(y,k,H,Z,C){this.static_tree=y,this.extra_bits=k,this.extra_base=H,this.elems=Z,this.max_length=C,this.has_stree=y&&y.length}function A(y,k){this.dyn_tree=y,this.max_code=0,this.stat_desc=k}function R(y){return y<256?j[y]:j[256+(y>>>7)]}function Y(y,k){y.pending_buf[y.pending++]=255&k,y.pending_buf[y.pending++]=k>>>8&255}function V(y,k,H){y.bi_valid>m-H?(y.bi_buf|=k<<y.bi_valid&65535,Y(y,y.bi_buf),y.bi_buf=k>>m-y.bi_valid,y.bi_valid+=H-m):(y.bi_buf|=k<<y.bi_valid&65535,y.bi_valid+=H)}function W(y,k,H){V(y,H[2*k],H[2*k+1])}function ae(y,k){for(var H=0;H|=1&y,y>>>=1,H<<=1,0<--k;);return H>>>1}function ie(y,k,H){var Z,C,X=new Array(b+1),Q=0;for(Z=1;Z<=b;Z++)X[Z]=Q=Q+H[Z-1]<<1;for(C=0;C<=k;C++){var K=y[2*C+1];K!==0&&(y[2*C]=ae(X[K]++,K))}}function re(y){var k;for(k=0;k<w;k++)y.dyn_ltree[2*k]=0;for(k=0;k<f;k++)y.dyn_dtree[2*k]=0;for(k=0;k<S;k++)y.bl_tree[2*k]=0;y.dyn_ltree[2*E]=1,y.opt_len=y.static_len=0,y.last_lit=y.matches=0}function se(y){8<y.bi_valid?Y(y,y.bi_buf):0<y.bi_valid&&(y.pending_buf[y.pending++]=y.bi_buf),y.bi_buf=0,y.bi_valid=0}function ce(y,k,H,Z){var C=2*k,X=2*H;return y[C]<y[X]||y[C]===y[X]&&Z[k]<=Z[H]}function pe(y,k,H){for(var Z=y.heap[H],C=H<<1;C<=y.heap_len&&(C<y.heap_len&&ce(k,y.heap[C+1],y.heap[C],y.depth)&&C++,!ce(k,Z,y.heap[C],y.depth));)y.heap[H]=y.heap[C],H=C,C<<=1;y.heap[H]=Z}function fe(y,k,H){var Z,C,X,Q,K=0;if(y.last_lit!==0)for(;Z=y.pending_buf[y.d_buf+2*K]<<8|y.pending_buf[y.d_buf+2*K+1],C=y.pending_buf[y.l_buf+K],K++,Z===0?W(y,C,k):(W(y,(X=c[C])+_+1,k),(Q=M[X])!==0&&V(y,C-=U[X],Q),W(y,X=R(--Z),H),(Q=F[X])!==0&&V(y,Z-=B[X],Q)),K<y.last_lit;);W(y,E,k)}function ge(y,k){var H,Z,C,X=k.dyn_tree,Q=k.stat_desc.static_tree,K=k.stat_desc.has_stree,ne=k.stat_desc.elems,de=-1;for(y.heap_len=0,y.heap_max=p,H=0;H<ne;H++)X[2*H]!==0?(y.heap[++y.heap_len]=de=H,y.depth[H]=0):X[2*H+1]=0;for(;y.heap_len<2;)X[2*(C=y.heap[++y.heap_len]=de<2?++de:0)]=1,y.depth[C]=0,y.opt_len--,K&&(y.static_len-=Q[2*C+1]);for(k.max_code=de,H=y.heap_len>>1;1<=H;H--)pe(y,X,H);for(C=ne;H=y.heap[1],y.heap[1]=y.heap[y.heap_len--],pe(y,X,1),Z=y.heap[1],y.heap[--y.heap_max]=H,y.heap[--y.heap_max]=Z,X[2*C]=X[2*H]+X[2*Z],y.depth[C]=(y.depth[H]>=y.depth[Z]?y.depth[H]:y.depth[Z])+1,X[2*H+1]=X[2*Z+1]=C,y.heap[1]=C++,pe(y,X,1),2<=y.heap_len;);y.heap[--y.heap_max]=y.heap[1],(function(ue,we){var We,xe,He,he,rt,Et,Ae=we.dyn_tree,Ht=we.max_code,xr=we.stat_desc.static_tree,vr=we.stat_desc.has_stree,Ir=we.stat_desc.extra_bits,Zt=we.stat_desc.extra_base,Ze=we.stat_desc.max_length,it=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<p;We++)Ze<(he=Ae[2*Ae[2*(xe=ue.heap[We])+1]+1]+1)&&(he=Ze,it++),Ae[2*xe+1]=he,Ht<xe||(ue.bl_count[he]++,rt=0,Zt<=xe&&(rt=Ir[xe-Zt]),Et=Ae[2*xe],ue.opt_len+=Et*(he+rt),vr&&(ue.static_len+=Et*(xr[2*xe+1]+rt)));if(it!==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]--,it-=2}while(0<it);for(he=Ze;he!==0;he--)for(xe=ue.bl_count[he];xe!==0;)Ht<(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),xe--)}})(y,k),ie(X,de,y.bl_count)}function a(y,k,H){var Z,C,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++)C=Q,Q=k[2*(Z+1)+1],++K<ne&&C===Q||(K<de?y.bl_tree[2*C]+=K:C!==0?(C!==X&&y.bl_tree[2*C]++,y.bl_tree[2*v]++):K<=10?y.bl_tree[2*x]++:y.bl_tree[2*T]++,X=C,de=(K=0)===Q?(ne=138,3):C===Q?(ne=6,3):(ne=7,4))}function $(y,k,H){var Z,C,X=-1,Q=k[1],K=0,ne=7,de=4;for(Q===0&&(ne=138,de=3),Z=0;Z<=H;Z++)if(C=Q,Q=k[2*(Z+1)+1],!(++K<ne&&C===Q)){if(K<de)for(;W(y,C,y.bl_tree),--K!=0;);else C!==0?(C!==X&&(W(y,C,y.bl_tree),K--),W(y,v,y.bl_tree),V(y,K-3,2)):K<=10?(W(y,x,y.bl_tree),V(y,K-3,3)):(W(y,T,y.bl_tree),V(y,K-11,7));X=C,de=(K=0)===Q?(ne=138,3):C===Q?(ne=6,3):(ne=7,4)}}u(B);var P=!1;function O(y,k,H,Z){V(y,(d<<1)+(Z?1:0),3),(function(C,X,Q,K){se(C),Y(C,Q),Y(C,~Q),o.arraySet(C.pending_buf,C.window,X,Q,C.pending),C.pending+=Q})(y,k,H)}i._tr_init=function(y){P||((function(){var k,H,Z,C,X,Q=new Array(b+1);for(C=Z=0;C<g-1;C++)for(U[C]=Z,k=0;k<1<<M[C];k++)c[Z++]=C;for(c[Z-1]=C,C=X=0;C<16;C++)for(B[C]=X,k=0;k<1<<F[C];k++)j[X++]=C;for(X>>=7;C<f;C++)for(B[C]=X<<7,k=0;k<1<<F[C]-7;k++)j[256+X++]=C;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<f;k++)I[2*k+1]=5,I[2*k]=ae(k,5);N=new J(te,M,_+1,w,b),z=new J(I,F,0,f,b),q=new J(new Array(0),D,0,S,h)})(),P=!0),y.l_desc=new A(y.dyn_ltree,N),y.d_desc=new A(y.dyn_dtree,z),y.bl_desc=new A(y.bl_tree,q),y.bi_buf=0,y.bi_valid=0,re(y)},i._tr_stored_block=O,i._tr_flush_block=function(y,k,H,Z){var C,X,Q=0;0<y.level?(y.strm.data_type===2&&(y.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 s;for(ne=32;ne<_;ne++)if(K.dyn_ltree[2*ne]!==0)return s;return l})(y)),ge(y,y.l_desc),ge(y,y.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*G[ne]+1]===0;ne--);return K.opt_len+=3*(ne+1)+5+5+4,ne})(y),C=y.opt_len+3+7>>>3,(X=y.static_len+3+7>>>3)<=C&&(C=X)):C=X=H+5,H+4<=C&&k!==-1?O(y,k,H,Z):y.strategy===4||X===C?(V(y,2+(Z?1:0),3),fe(y,te,I)):(V(y,4+(Z?1:0),3),(function(K,ne,de,ue){var we;for(V(K,ne-257,5),V(K,de-1,5),V(K,ue-4,4),we=0;we<ue;we++)V(K,K.bl_tree[2*G[we]+1],3);$(K,K.dyn_ltree,ne-1),$(K,K.dyn_dtree,de-1)})(y,y.l_desc.max_code+1,y.d_desc.max_code+1,Q+1),fe(y,y.dyn_ltree,y.dyn_dtree)),re(y),Z&&se(y)},i._tr_tally=function(y,k,H){return y.pending_buf[y.d_buf+2*y.last_lit]=k>>>8&255,y.pending_buf[y.d_buf+2*y.last_lit+1]=255&k,y.pending_buf[y.l_buf+y.last_lit]=255&H,y.last_lit++,k===0?y.dyn_ltree[2*H]++:(y.matches++,k--,y.dyn_ltree[2*(c[H]+_+1)]++,y.dyn_dtree[2*R(k)]++),y.last_lit===y.lit_bufsize-1},i._tr_align=function(y){V(y,2,3),W(y,E,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)})(y)}},{"../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(o){(function(l,s){if(!l.setImmediate){var u,d,g,_,w=1,f={},S=!1,p=l.document,b=Object.getPrototypeOf&&Object.getPrototypeOf(l);b=b&&b.setTimeout?b:l,u={}.toString.call(l.process)==="[object process]"?function(v){Tr.nextTick(function(){h(v)})}:(function(){if(l.postMessage&&!l.importScripts){var v=!0,x=l.onmessage;return l.onmessage=function(){v=!1},l.postMessage("","*"),l.onmessage=x,v}})()?(_="setImmediate$"+Math.random()+"$",l.addEventListener?l.addEventListener("message",E,!1):l.attachEvent("onmessage",E),function(v){l.postMessage(_+v,"*")}):l.MessageChannel?((g=new MessageChannel).port1.onmessage=function(v){h(v.data)},function(v){g.port2.postMessage(v)}):p&&"onreadystatechange"in p.createElement("script")?(d=p.documentElement,function(v){var x=p.createElement("script");x.onreadystatechange=function(){h(v),x.onreadystatechange=null,d.removeChild(x),x=null},d.appendChild(x)}):function(v){setTimeout(h,0,v)},b.setImmediate=function(v){typeof v!="function"&&(v=new Function(""+v));for(var x=new Array(arguments.length-1),T=0;T<x.length;T++)x[T]=arguments[T+1];var M={callback:v,args:x};return f[w]=M,u(w),w++},b.clearImmediate=m}function m(v){delete f[v]}function h(v){if(S)setTimeout(h,0,v);else{var x=f[v];if(x){S=!0;try{(function(T){var M=T.callback,F=T.args;switch(F.length){case 0:M();break;case 1:M(F[0]);break;case 2:M(F[0],F[1]);break;case 3:M(F[0],F[1],F[2]);break;default:M.apply(s,F)}})(x)}finally{m(v),S=!1}}}}function E(v){v.source===l&&typeof v.data=="string"&&v.data.indexOf(_)===0&&h(+v.data.slice(_.length))}})(typeof self>"u"?o===void 0?this:o:self)}).call(this,typeof ot<"u"?ot:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(wt)),wt.exports}var ji=Ui();const On=ln(ji);function Bi(e){const t=[],n=Object.keys(e);for(const r of n){const i=e[r];if(!i)continue;const o=i.sort((s,u)=>s.index-u.index);let l=-1;for(let s=0;s<o.length;s++)l=l+1+o[s].skip,o[s].index!==l&&t.push({message:`Invalid operation index ${o[s].index} at position ${s}`,details:{position:s,operation:o[s],scope:o[s].action.scope}})}return t}function Fi(e){const t=new On,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(Ni(e.operations),null,2)),t}async function $i(e,t){const r=await Fi(e).generateAsync({type:"blob"}),i=await t.createWritable();await i.write(r),await i.close()}async function Wi(e,t,n){const r=new On;return await r.loadAsync(e),Hi(r,t,n)}async function Hi(e,t,n){const r=e.file("state.json");if(!r)throw new Error("Initial state not found");const i=await r.async("string"),o=JSON.parse(i),l=e.file("header.json");let s;l&&(s=JSON.parse(await l.async("string")));const u=e.file("operations.json");if(!u)throw new Error("Operations history not found");const d=JSON.parse(await u.async("string")),g=dt(d),_=Bi(g);if(_.length){const f=_.map(S=>S.message);throw new Error(f.join(`
22
+ `))}let w=En(o,g,t,void 0,s,{},n);return s&&(w={...w,header:s}),w}const me={Remove:"remove",Replace:"replace",Add:"add"},xn=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),Zi=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),ct=Symbol.iterator,Ee={mutable:"mutable",immutable:"immutable"},Nt={};function qe(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function qt(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 zt(e){return Object.getPrototypeOf(e)===Set.prototype}function Pt(e){return Object.getPrototypeOf(e)===Map.prototype}function ye(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?.[xn]}function Lt(e){var t;const n=le(e);return n?(t=n.copy)!==null&&t!==void 0?t:n.original:e}function Oe(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,Ee))===Ee.immutable||typeof n=="function")}function vn(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,o=i?Array.from(e.parent.setMap.keys()).indexOf(e.key):e.key;if(!(i&&n.size>o||qe(n,o)))return null;t.push(o)}if(e.parent)return vn(e.parent,t);t.reverse();try{Gi(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 et(e,t,n){Ue(e)===2?e.set(t,n):e[t]=n}function Ot(e,t){const n=le(e);return(n?ye(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 Pe(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 Gi(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 Vi(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 Xi=Object.prototype.propertyIsEnumerable;function In(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set){if(!zt(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(!Pt(e)){const r=Object.getPrototypeOf(e).constructor;return new r(e)}return new Map(e)}else if(t?.mark&&(n=t.mark(e,Ee),n!==void 0)&&n!==Ee.mutable){if(n===Ee.immutable)return Vi(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=>{Xi.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=In(e.original,e.options))}function Je(e){if(!Oe(e))return Lt(e);if(Array.isArray(e))return e.map(Je);if(e instanceof Map){const n=Array.from(e.entries()).map(([r,i])=>[r,Je(i)]);if(!Pt(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(Je);if(!zt(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]=Je(e[n]);return t}function pt(e){return Me(e)?Je(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 Yt(){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 s=r.indexOf(l);if(l&&typeof l=="object"&&s!==-1)throw r[0]===l?new Error("Forbids circular reference"):new Error(`Forbids circular reference: ~/${i.slice(0,s).map((u,d)=>{if(typeof u=="symbol")return`[${u.toString()}]`;const g=r[d];return typeof u=="object"&&(g instanceof Map||g instanceof Set)?Array.from(g.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[s,u]of e)Fe(s,s,n,r,i),Fe(u,s,n,r,i);e.set=e.clear=e.delete=Yt;break;case 3:for(const s of e)Fe(s,s,n,r,i);e.add=e.clear=e.delete=Yt;break;case 1:Object.freeze(e);let l=0;for(const s of e)Fe(s,l,n,r,i),l+=1;break;default:Object.freeze(e),Object.keys(e).forEach(s=>{const u=e[s];Fe(u,s,n,r,i)})}r.pop(),i.pop()}function Ut(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 An(e,t,n){if(Me(e)||!Oe(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),Ut(e,(o,l)=>{var s;if(Me(l)){const u=le(l);_e(u);const d=!((s=u.assignedMap)===null||s===void 0)&&s.size||u.operated?u.copy:u.original;et(r?i:e,o,d)}else An(l,t,n)}),i){const o=e,l=Array.from(o);o.clear(),l.forEach(s=>{o.add(i.has(s)?i.get(s):s)})}}function Ki(e,t){const n=e.type===3?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&An(De(n,t),e.finalities.handledSet,e.options)}function vt(e){e.type===3&&e.copy&&(e.copy.clear(),e.setMap.forEach(t=>{e.copy.add(Lt(t))}))}function It(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const o=vn(e);o&&t(e,o,n,r)}e.finalized=!0}}function jt(e,t,n,r){const i=le(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push((o,l)=>{var s;const u=e.type===3?e.setMap:e.copy;if(ke(De(u,t),n)){let d=i.original;i.copy&&(d=i.copy),vt(e),It(e,r,o,l),e.options.enableAutoFreeze&&(e.options.updatedValues=(s=e.options.updatedValues)!==null&&s!==void 0?s:new WeakMap,e.options.updatedValues.set(d,i.original)),et(u,t,d)}}),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),Oe(n,e.options)&&e.finalities.draft.push(()=>{const o=e.type===3?e.setMap:e.copy;ke(De(o,t),n)&&Ki(e,t)})}function Ji(e,t,n,r,i){let{original:o,assignedMap:l,options:s}=e,u=e.copy;u.length<o.length&&([o,u]=[u,o],[n,r]=[r,n]);for(let d=0;d<o.length;d+=1)if(l.get(d.toString())&&u[d]!==o[d]){const g=t.concat([d]),_=Pe(g,i);n.push({op:me.Replace,path:_,value:pt(u[d])}),r.push({op:me.Replace,path:_,value:pt(o[d])})}for(let d=o.length;d<u.length;d+=1){const g=t.concat([d]),_=Pe(g,i);n.push({op:me.Add,path:_,value:pt(u[d])})}if(o.length<u.length){const{arrayLengthAssignment:d=!0}=s.enablePatches;if(d){const g=t.concat(["length"]),_=Pe(g,i);r.push({op:me.Replace,path:_,value:o.length})}else for(let g=u.length;o.length<g;g-=1){const _=t.concat([g-1]),w=Pe(_,i);r.push({op:me.Remove,path:w})}}}function qi({original:e,copy:t,assignedMap:n},r,i,o,l){n.forEach((s,u)=>{const d=De(e,u),g=pt(De(t,u)),_=s?qe(e,u)?me.Replace:me.Add:me.Remove;if(ke(d,g)&&_===me.Replace)return;const w=r.concat(u),f=Pe(w,l);i.push(_===me.Remove?{op:_,path:f}:{op:_,path:f,value:g}),o.push(_===me.Add?{op:me.Remove,path:f}:_===me.Remove?{op:me.Add,path:f,value:d}:{op:me.Replace,path:f,value:d})})}function Yi({original:e,copy:t},n,r,i,o){let l=0;e.forEach(s=>{if(!t.has(s)){const u=n.concat([l]),d=Pe(u,o);r.push({op:me.Remove,path:d,value:s}),i.unshift({op:me.Add,path:d,value:s})}l+=1}),l=0,t.forEach(s=>{if(!e.has(s)){const u=n.concat([l]),d=Pe(u,o);r.push({op:me.Add,path:d,value:s}),i.unshift({op:me.Remove,path:d,value:s})}l+=1})}function Ye(e,t,n,r){const{pathAsArray:i=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return qi(e,t,n,r,i);case 1:return Ji(e,t,n,r,i);case 3:return Yi(e,t,n,r,i)}}let At=!1;const ft=(e,t,n=!1)=>{if(typeof e=="object"&&e!==null&&(!Oe(e,t)||n)&&!At)throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")};function Qi(e){At=!0;let t;try{t=e()}finally{At=!1}return t}const Rt={get size(){return ye(le(this)).size},has(e){return ye(le(this)).has(e)},set(e,t){const n=le(this),r=ye(n);return(!r.has(e)||!ke(r.get(e),t))&&(_e(n),Ie(n),n.assignedMap.set(e,!0),n.copy.set(e,t),jt(n,e,t,Ye)),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);ye(n).forEach((r,i)=>{e.call(t,this.get(i),i,this)})},get(e){var t,n;const r=le(this),i=ye(r).get(e),o=((n=(t=r.options).mark)===null||n===void 0?void 0:n.call(t,i,Ee))===Ee.mutable;if(r.options.strict&&ft(i,r.options,o),o||r.finalized||!Oe(i,r.options)||i!==r.original.get(e))return i;const l=Nt.createDraft({original:i,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return _e(r),r.copy.set(e,l),l},keys(){return ye(le(this)).keys()},values(){const e=this.keys();return{[ct]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[ct]:()=>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]}}}},[ct](){return this.entries()}},eo=Reflect.ownKeys(Rt),Qt=(e,t,{isValuesIterator:n})=>()=>{var r,i;const o=t.next();if(o.done)return o;const l=o.value;let s=e.setMap.get(l);const u=le(s),d=((i=(r=e.options).mark)===null||i===void 0?void 0:i.call(r,s,Ee))===Ee.mutable;if(e.options.strict&&ft(l,e.options,d),!d&&!u&&Oe(l,e.options)&&!e.finalized&&e.original.has(l)){const g=Nt.createDraft({original:l,parentDraft:e,key:l,finalities:e.finalities,options:e.options});e.setMap.set(l,g),s=g}else u&&(s=u.proxy);return{done:!1,value:n?s:[s,s]}},ht={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),jt(t,e,e,Ye)),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:Qt(e,t,{isValuesIterator:!0})}},entries(){const e=le(this);_e(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:Qt(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[ct](){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(ht,{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 to=Reflect.ownKeys(ht),Rn={get(e,t,n){var r,i;const o=(r=e.copy)===null||r===void 0?void 0:r[t];if(o&&e.finalities.draftsCache.has(o))return o;if(t===xn)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,Ee),l===Ee.mutable)return e.options.strict&&ft(d,e.options,!0),d}const s=ye(e);if(s instanceof Map&&eo.includes(t))return t==="size"?Object.getOwnPropertyDescriptor(Rt,"size").get.call(e.proxy):Rt[t].bind(e.proxy);if(s instanceof Set&&to.includes(t))return t==="size"?Object.getOwnPropertyDescriptor(ht,"size").get.call(e.proxy):ht[t].bind(e.proxy);if(!qe(s,t)){const d=qt(s,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=s[t];if(e.options.strict&&ft(u,e.options),e.finalized||!Oe(u,e.options))return u;if(u===Ot(e.original,t)){if(_e(e),e.copy[t]=Bt({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 o=qt(ye(e),t);if(o?.set)return o.set.call(e.proxy,n),!0;const l=Ot(ye(e),t),s=le(l);return s&&ke(s.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||qe(e.original,t))||(_e(e),Ie(e),qe(e.original,t)&&ke(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,jt(e,t,n,Ye)),!0)},has(e,t){return t in ye(e)},ownKeys(e){return Reflect.ownKeys(ye(e))},getOwnPropertyDescriptor(e,t){const n=ye(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?Rn.set.call(this,e,t,void 0,e.proxy):(Ot(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 Bt(e){const{original:t,parentDraft:n,key:r,finalities:i,options:o}=e,l=Ue(t),s={type:l,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:i,options:o,setMap:l===3?new Map(t.entries()):void 0};(r||"key"in e)&&(s.key=r);const{proxy:u,revoke:d}=Proxy.revocable(l===1?Object.assign([],s):s,Rn);if(i.revoke.push(d),s.proxy=u,n){const g=n;g.finalities.draft.push((_,w)=>{var f,S;const p=le(u);let b=g.type===3?g.setMap:g.copy;const m=De(b,r),h=le(m);if(h){let E=h.original;h.operated&&(E=Lt(m)),vt(h),It(h,Ye,_,w),g.options.enableAutoFreeze&&(g.options.updatedValues=(f=g.options.updatedValues)!==null&&f!==void 0?f:new WeakMap,g.options.updatedValues.set(E,h.original)),et(b,r,E)}(S=p.callbacks)===null||S===void 0||S.forEach(E=>{E(_,w)})})}else{const g=le(u);g.finalities.draft.push((_,w)=>{vt(g),It(g,Ye,_,w)})}return u}Nt.createDraft=Bt;function no(e,t,n,r,i){var o;const l=le(e),s=(o=l?.original)!==null&&o!==void 0?o: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:s}]:r]}function ro(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet,draftsCache:new WeakSet};let i,o;t.enablePatches&&(i=[],o=[]);const s=((n=t.mark)===null||n===void 0?void 0:n.call(t,e,Ee))===Ee.mutable||!Oe(e,t)?e:Bt({original:e,parentDraft:null,finalities:r,options:t});return[s,(u=[])=>{const[d,g,_]=no(s,u,i,o,t.enableAutoFreeze);return t.enablePatches?[d,g,_]:d}]}function kt(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:i=!0}=e;Ut(n,(o,l,s)=>{const u=le(l);if(u&&t&&u.finalities===t.finalities){e.isContainDraft=!0;const d=u.original;if(s instanceof Set){const g=Array.from(s);s.clear(),g.forEach(_=>s.add(o===_?d:_))}else et(s,o,d)}else typeof l=="object"&&l!==null&&(e.value=l,e.isRoot=!1,kt(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 kn(e){var t;const n=le(e);if(!Oe(e,n?.options))return e;const r=Ue(e);if(n&&!n.operated)return n.original;let i;function o(){i=r===2?Pt(e)?new Map(e):new(Object.getPrototypeOf(e)).constructor(e):r===3?Array.from(n.setMap.values()):In(e,n?.options)}if(n){n.finalized=!0;try{o()}finally{n.finalized=!1}}else i=e;if(Ut(i,(l,s)=>{if(n&&ke(De(n.original,l),s))return;const u=kn(s);u!==s&&(i===e&&o(),et(i,l,u))}),r===3){const l=(t=n?.original)!==null&&t!==void 0?t:i;return zt(l)?new Set(i):new(Object.getPrototypeOf(l)).constructor(i)}return i}function en(e){if(!Me(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return kn(e)}const io=e=>function t(n,r,i){var o,l,s;if(typeof n=="function"&&typeof r!="function")return function(x,...T){return t(x,M=>n.call(this,M,...T),r)};const u=n,d=r;let g=i;if(typeof r!="function"&&(g=r),g!==void 0&&Object.prototype.toString.call(g)!=="[object Object]")throw new Error(`Invalid options: ${g}, 'options' should be an object.`);g=Object.assign(Object.assign({},e),g);const _=Me(u)?en(u):u,w=Array.isArray(g.mark)?((x,T)=>{for(const M of g.mark){if(typeof M!="function")throw new Error(`Invalid mark: ${M}, 'mark' should be a function.`);const F=M(x,T);if(F)return F}}):g.mark,f=(o=g.enablePatches)!==null&&o!==void 0?o:!1,S=(l=g.strict)!==null&&l!==void 0?l:!1,b={enableAutoFreeze:(s=g.enableAutoFreeze)!==null&&s!==void 0?s:!1,mark:w,strict:S,enablePatches:f};if(!Oe(_,b)&&typeof _=="object"&&_!==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]=ro(_,b);if(typeof r!="function"){if(!Oe(_,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 E;try{E=d(m)}catch(x){throw xt(le(m)),x}const v=x=>{const T=le(m);if(!Me(x)){if(x!==void 0&&!ke(x,m)&&T?.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=x?.[Zi];if(F){const D=F[0];return b.strict&&typeof x=="object"&&x!==null&&kt({rootDraft:T,value:x,useRawReturn:!0}),h([D])}if(x!==void 0)return typeof x=="object"&&x!==null&&kt({rootDraft:T,value:x}),h([x])}if(x===m||x===void 0)return h([]);const M=le(x);if(b===M.options){if(M.operated)throw new Error("Cannot return a modified child draft.");return h([en(x)])}return h([x])};return E instanceof Promise?E.then(v,x=>{throw xt(le(m)),x}):v(E)},Ft=io();Object.prototype.constructor.toString();function oo(e,t){return{...e,header:{...e.header,name:t}}}function so(e,t,n){const{scope:r}=t;return Ft({document:e,action:t,skip:n,reuseLastOperationIndex:!1},o=>{const l=[...e.operations[r]],s=Te(l);o.action=_n(r);const u=s.at(-1);let d=u?.index??-1;const g=u?.action.type!=="NOOP";g?d=d+1:o.reuseLastOperationIndex=!0;const _=g?[...s,{index:d,skip:0}]:s;if(o.skip=Di(_),u&&o.skip>u.skip+1&&(o.skip=o.skip+1),o.skip<0)throw new Error("Cannot undo: you can't undo more operations than the ones in the scope history")})}function ao(e,t,n){const{scope:r,input:i}=t;return Ft({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 s=l.document.clipboard.findLastIndex(d=>d.action.scope===r);if(s<0)throw new Error(`Cannot redo: no operations in clipboard for scope "${r}"`);const u=l.document.clipboard.splice(s,1)[0];l.action={type:u.action.type,scope:u.action.scope,input:u.action.input}})}function lo(e,t){return{...e,header:{...e.header,name:t.state.name},state:t.state.data}}function mt(e,t,n,r,i,o=Tn,l={},s){const u=Dn(n,o);return En(e,t,u,r,i,l,s)}function uo(e,t,n=!1,r=0){if(["UNDO","REDO","PRUNE"].includes(t.type))return e;const i=t.scope;let o=[];e.operations[i]&&(o=e.operations[i].slice());const s=o.sort((g,_)=>g.index-_.index).at(-1)?.index??-1,u=n?s:s+1,d=gi(t,u,r);return o.push(d),{...e,operations:{...e.operations,[i]:o}}}function co(e,t,n=!1,r=0){const i=t.action.scope,o=e.operations[i],l=o?o.slice():[],u=l.sort((_,w)=>_.index-w.index).at(-1)?.index??-1,d=n?u:u+1;if(t.index-r>d)throw new Error(`Missing operations: expected ${d} with skip 0 or equivalent, got index ${t.index} with skip ${r}`);const g=_i(t,r);return l.push(g),{...e,operations:{...e.operations,[i]:l}}}function po(e,t,n=!1,r=0,i){let o;return i?o=co(e,i,n,r):o=uo(e,t,n,r),o=wn(o,t.scope),o}function fo(e,t,n){const r=oi().parse(t);switch(r.type){case"SET_NAME":return oo(e,r.input);case"PRUNE":return _o(e,r.input,n);case"LOAD_STATE":return lo(e,r.input);default:return e}}function ho(e,t,n){switch(t.type){case"UNDO":return so(e,t,n);case"REDO":return ao(e,t,n);default:return{document:e,action:t,skip:n,reuseLastOperationIndex:!1}}}function mo(e,t,n,r,i=!1,o=Mt){const l=t.scope,s=e.operations[l];if(!s)return e;const u=s.at(-1);if(!u)return e;const d=dt({...e.operations,[l]:Ci(s,u)});let g;const w=d[l]?.at(-1);if(i&&w?.resultingState)g=o(w.resultingState);else{const{state:f}=mt(e.initialState,d,n,void 0,void 0,void 0,void 0,{reuseOperationResultingState:i,operationResultingStateParser:o});g=f[l]}return{...e,state:{...e.state,[l]:g},operations:dt({...e.operations})}}function go(e,t,n,r=!1,i=Mt){const o=e.operations[t];if(!o)return e;const l=[...o],s=Te(l);s.pop();const u=dt({...e.operations}),d=u[t];if(!d)return e;const g=[...d],_=zi(Re(s),g),w=mt(e.initialState,u,n,void 0,void 0,void 0,void 0,{reuseOperationResultingState:r,operationResultingStateParser:i}),f=Te([...e.clipboard,..._].filter(S=>S.action.type!=="NOOP")).reverse();return{...w,clipboard:f}}function Tn(e,t,n,r,i={}){const{skip:o,ignoreSkipOperations:l=!1,reuseOperationResultingState:s=!1,operationResultingStateParser:u,pruneOnSkip:d=!0}=i;let g=mi(t),_=o??i.replayOptions?.operation.skip??0,w={...e},f=!1;const S=!l&&_>0;if(Ii(g)){const{skip:E,action:v,document:x,reuseLastOperationIndex:T}=ho(e,g,_);g=v,_=E,w=x,f=T}else w={...w,clipboard:[]};if(bn(g)&&(w=fo(w,g,n)),w=po(w,g,f,_,i.replayOptions?.operation),Ai(t))return go(w,t.scope,n);if(S){const E=mo(w,g,n,_,s,u);d?w=E:w={...E,operations:w.operations}}if(w=Ft(w,E=>{try{const v=n(E.state,g,r);v&&Qi(()=>{E.state=v})}catch(v){const x=w.operations[g.scope];if(!x)throw new Error(`No operations found for scope: ${g.scope}`);const T=x.length-1,M=E.operations[g.scope];if(!M)throw new Error(`No operations found in draft for scope: ${g.scope}`);if(M[T].error=v.message,M[T].skip=0,S){E.state={...e.state};const F=e.operations[g.scope];if(!F)throw new Error(`No operations found for scope: ${g.scope}`);E.operations={...e.operations,[g.scope]:[...F,{...M[T]}]}}}}),["UNDO","REDO","PRUNE"].includes(g.type))return w;const p=g.scope||"global";let b=Ct(w,p);i.replayOptions?.operation.hash&&i.replayOptions.operation.hash!==""&&(b=i.replayOptions.operation.hash);const h=w.operations[p]?.at(-1);return h&&(h.hash=b,s&&(h.resultingState=JSON.stringify(w.state[p]))),w}function Dn(e,t=Tn){return(r,i,o,l)=>t(r,i,e,o,l)}function _o(e,t,n){const r=e.operations.global;if(!r)throw new Error("No global operations found");let{start:i,end:o}=t;i=i||0,o=o||r.length;const l=r.slice(i,o),s=r.slice(0,i),u=r.slice(o),d=mt(e.initialState,{...e.operations,global:s.concat(l)},n),g=d.state,_=d.header.name,w=s.length,f=s.length?s[s.length-1].timestampUtcMs:u.length?u[0].timestampUtcMs:new Date().toISOString(),S=gn({name:_,...g},l.length);return mt(e.initialState,{...e.operations,global:[...s,{skip:0,...S,action:S,timestampUtcMs:f,index:w,hash:Ct({state:g},"global")},...u.map((p,b)=>({...p,index:w+b+1}))]},n)}const bo="sha1",yo="base64";function Cn(){return{}}function Mn(){return{version:0,hash:{algorithm:bo,encoding:yo}}}function $t(){return{auth:Cn(),document:Mn()}}function Eo(e){return{...Cn(),...e}}function So(e){return{...Mn(),...e}}function wo(e,t){return{auth:Eo(e),document:So(t)}}function Nn(){return ee({__typename:be("AddChangeLogItemInput").optional(),content:L(),id:L(),insertBefore:L().nullable()})}function zn(){return ee({description:L().nullish(),id:L(),name:L()})}function Pn(){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 Ln(){return ee({description:L().nullish(),id:L(),moduleId:L(),name:L(),reducer:L().nullish(),schema:L().nullish(),template:L().nullish(),scope:Le().nullish()})}function Un(){return ee({scope:L(),example:L(),id:L(),insertBefore:L().nullish()})}function xo(){return ee({__typename:be("Author").optional(),name:L(),website:L().nullable()})}function jn(){return ee({__typename:be("CodeExample").optional(),id:L(),value:L()})}function Bn(){return ee({__typename:be("DeleteChangeLogItemInput").optional(),id:L()})}function Fn(){return ee({id:L()})}function $n(){return ee({id:L()})}function vo(){return ee({id:L()})}function Wn(){return ee({id:L()})}function Hn(){return ee({scope:L(),id:L()})}function Io(){return ee({__typename:be("DocumentModelGlobalState").optional(),author:xo(),description:L(),extension:L(),id:L(),name:L(),specifications:Se(Ao())})}function Ao(){return ee({__typename:be("DocumentSpecification").optional(),changeLog:Se(L()),modules:Se(Ro()),state:Co(),version:$e().int()})}function Ro(){return ee({__typename:be("ModuleSpecification").optional(),description:L().nullable(),id:L(),name:L(),operations:Se(ko())})}function Zn(){return ee({newModuleId:L(),operationId:L()})}function ko(){return ee({__typename:be("OperationSpecification").optional(),description:L().nullable(),errors:Se(To()),examples:Se(jn()),id:L(),name:L().nullable(),reducer:L().nullable(),schema:L().nullable(),template:L().nullable(),scope:Le()})}function To(){return ee({__typename:be("OperationErrorSpecification").optional(),code:L().nullable(),description:L().nullable(),id:L(),name:L().nullable(),template:L().nullable()})}function Gn(){return ee({__typename:be("ReorderChangeLogItemsInput").optional(),order:Se(L())})}function Vn(){return ee({moduleId:L(),order:Se(L())})}function Xn(){return ee({order:Se(L())})}function Kn(){return ee({operationId:L(),order:Se(L())})}function Do(){return ee({operationId:L(),order:Se(L())})}function Jn(){return ee({scope:L(),order:Se(L())})}function qn(){return ee({authorName:L()})}function Yn(){return ee({authorWebsite:L()})}function Qn(){return ee({scope:L(),initialValue:L()})}function er(){return ee({description:L()})}function tr(){return ee({extension:L()})}function nr(){return ee({id:L()})}function rr(){return ee({name:L()})}function ir(){return ee({description:L().nullish(),id:L()})}function or(){return ee({id:L(),name:L().nullish()})}function sr(){return ee({description:L().nullish(),id:L()})}function ar(){return ee({errorCode:L().nullish(),id:L()})}function lr(){return ee({errorDescription:L().nullish(),id:L()})}function ur(){return ee({errorName:L().nullish(),id:L()})}function cr(){return ee({errorTemplate:L().nullish(),id:L()})}function pr(){return ee({id:L(),name:L().nullish()})}function dr(){return ee({id:L(),scope:Le()})}function fr(){return ee({id:L(),reducer:L().nullish()})}function hr(){return ee({id:L(),schema:L().nullish()})}function mr(){return ee({id:L(),template:L().nullish()})}function gr(){return ee({scope:L(),schema:L()})}function tn(){return ee({__typename:be("State").optional(),examples:Se(jn()),initialValue:L(),schema:L()})}function Co(){return ee({global:tn(),local:tn()})}function _r(){return ee({__typename:be("UpdateChangeLogItemInput").optional(),id:L(),newContent:L()})}function Mo(){return ee({example:L(),id:L()})}function br(){return ee({scope:L(),id:L(),newExample:L()})}const No=e=>oe("SET_NAME",e,void 0,hn,"global"),zo=e=>oe("SET_MODEL_NAME",{...e},void 0,rr,"global"),Po=e=>oe("SET_MODEL_ID",{...e},void 0,nr,"global"),Lo=e=>oe("SET_MODEL_EXTENSION",{...e},void 0,tr,"global"),Uo=e=>oe("SET_MODEL_DESCRIPTION",{...e},void 0,er,"global"),jo=e=>oe("SET_AUTHOR_NAME",{...e},void 0,qn,"global"),Bo=e=>oe("SET_AUTHOR_WEBSITE",{...e},void 0,Yn,"global"),Fo=e=>oe("ADD_MODULE",{...e},void 0,zn,"global"),$o=e=>oe("SET_MODULE_NAME",{...e},void 0,or,"global"),Wo=e=>oe("SET_MODULE_DESCRIPTION",{...e},void 0,ir,"global"),Ho=e=>oe("DELETE_MODULE",{...e},void 0,Fn,"global"),Zo=e=>oe("REORDER_MODULES",{...e},void 0,Xn,"global"),Go=e=>oe("ADD_OPERATION",{...e},void 0,Ln,"global"),Vo=e=>oe("SET_OPERATION_NAME",{...e},void 0,pr,"global"),Xo=e=>oe("SET_OPERATION_SCOPE",{...e},void 0,dr,"global"),Ko=e=>oe("SET_OPERATION_SCHEMA",{...e},void 0,hr,"global"),Jo=e=>oe("SET_OPERATION_DESCRIPTION",{...e},void 0,sr,"global"),qo=e=>oe("SET_OPERATION_TEMPLATE",{...e},void 0,mr,"global"),Yo=e=>oe("SET_OPERATION_REDUCER",{...e},void 0,fr,"global"),Qo=e=>oe("MOVE_OPERATION",{...e},void 0,Zn,"global"),es=e=>oe("DELETE_OPERATION",{...e},void 0,Wn,"global"),ts=e=>oe("REORDER_MODULE_OPERATIONS",{...e},void 0,Vn,"global"),ns=e=>oe("ADD_OPERATION_ERROR",{...e},void 0,Pn,"global"),rs=e=>oe("SET_OPERATION_ERROR_CODE",{...e},void 0,ar,"global"),is=e=>oe("SET_OPERATION_ERROR_NAME",{...e},void 0,ur,"global"),os=e=>oe("SET_OPERATION_ERROR_DESCRIPTION",{...e},void 0,lr,"global"),ss=e=>oe("SET_OPERATION_ERROR_TEMPLATE",{...e},void 0,cr,"global"),as=e=>oe("DELETE_OPERATION_ERROR",{...e},void 0,$n,"global"),ls=e=>oe("REORDER_OPERATION_ERRORS",{...e},void 0,Kn,"global"),us=e=>oe("SET_STATE_SCHEMA",{...e},void 0,gr,"global"),cs=e=>oe("SET_INITIAL_STATE",{...e},void 0,Qn,"global"),ps=e=>oe("ADD_STATE_EXAMPLE",{...e},void 0,Un,"global"),ds=e=>oe("UPDATE_STATE_EXAMPLE",{...e},void 0,br,"global"),fs=e=>oe("DELETE_STATE_EXAMPLE",{...e},void 0,Hn,"global"),hs=e=>oe("REORDER_STATE_EXAMPLES",{...e},void 0,Jn,"global"),ms=e=>oe("ADD_CHANGE_LOG_ITEM",{...e},void 0,Nn,"global"),gs=e=>oe("UPDATE_CHANGE_LOG_ITEM",{...e},void 0,_r,"global"),_s=e=>oe("DELETE_CHANGE_LOG_ITEM",{...e},void 0,Bn,"global"),bs=e=>oe("REORDER_CHANGE_LOG_ITEMS",{...e},void 0,Gn,"global"),ys=()=>oe("RELEASE_NEW_VERSION",{},void 0,void 0,"global"),Es={setName:No,undo:di,redo:fi,prune:hi,loadState:gn,noop:_n},Ss={setModelName:zo,setModelId:Po,setModelExtension:Lo,setModelDescription:Uo,setAuthorName:jo,setAuthorWebsite:Bo,addModule:Fo,setModuleName:$o,setModuleDescription:Wo,deleteModule:Ho,reorderModules:Zo,addOperation:Go,setOperationName:Vo,setOperationScope:Xo,setOperationSchema:Ko,setOperationDescription:Jo,setOperationTemplate:qo,setOperationReducer:Yo,moveOperation:Qo,deleteOperation:es,reorderModuleOperations:ts,addOperationError:ns,setOperationErrorCode:rs,setOperationErrorName:is,setOperationErrorDescription:os,setOperationErrorTemplate:ss,deleteOperationError:as,reorderOperationErrors:ls,setStateSchema:us,setInitialState:cs,addStateExample:ps,updateStateExample:ds,deleteStateExample:fs,reorderStateExamples:hs,addChangeLogItem:ms,updateChangeLogItem:gs,deleteChangeLogItem:_s,reorderChangeLogItems:bs,releaseNewVersion:ys},ws={...Es,...Ss},Os="phdm",xs={},vs={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},Is={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
  }
@@ -227,4 +227,4 @@ type DocumentModelGlobalState {
227
227
  }`,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 {
228
228
  scope: String!
229
229
  order: [ID!]!
230
- }`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""}]}]},br="powerhouse/document-model",Is=ee({id:L(),name:L(),createdAtUtcIso:L(),lastModifiedAtUtcIso:L(),documentType:L()}),As=ee({global:sn()}),Rs=Is.extend({documentType:be(br)}),gt=As.extend({global:vo()}),yr=ee({header:Rs,state:gt,initialState:gt});function ks(e){return gt.safeParse(e).success}function Ts(e){gt.parse(e)}function Ds(e){return yr.safeParse(e).success}function Cs(e){yr.parse(e)}function tt(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}},Xe={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(tt(t.input.order))}},ze={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(tt(t.input.order))}},ut={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(tt(t.input.order))}},ve={addOperationOperation(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.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){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(tt(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(tt(t.input.order));else throw new Error(`Invalid scope: ${t.input.scope}`)}},Ke={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){throw new Error('Reducer "releaseNewVersionOperation" not yet implemented')}},Ms=(e,t)=>{if(_n(t))return e;switch(t.type){case"SET_MODEL_NAME":nr().parse(t.input),je.setModelNameOperation(e.global,t);break;case"SET_MODEL_ID":tr().parse(t.input),je.setModelIdOperation(e.global,t);break;case"SET_MODEL_EXTENSION":er().parse(t.input),je.setModelExtensionOperation(e.global,t);break;case"SET_MODEL_DESCRIPTION":Qn().parse(t.input),je.setModelDescriptionOperation(e.global,t);break;case"SET_AUTHOR_NAME":Jn().parse(t.input),je.setAuthorNameOperation(e.global,t);break;case"SET_AUTHOR_WEBSITE":qn().parse(t.input),je.setAuthorWebsiteOperation(e.global,t);break;case"ADD_CHANGE_LOG_ITEM":Mn().parse(t.input),Ke.addChangeLogItemOperation(e.global,t);break;case"UPDATE_CHANGE_LOG_ITEM":gr().parse(t.input),Ke.updateChangeLogItemOperation(e.global,t);break;case"DELETE_CHANGE_LOG_ITEM":jn().parse(t.input),Ke.deleteChangeLogItemOperation(e.global,t);break;case"REORDER_CHANGE_LOG_ITEMS":Zn().parse(t.input),Ke.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");Ke.releaseNewVersionOperation(e.global,t);break;case"ADD_MODULE":Nn().parse(t.input),Xe.addModuleOperation(e.global,t);break;case"SET_MODULE_NAME":ir().parse(t.input),Xe.setModuleNameOperation(e.global,t);break;case"SET_MODULE_DESCRIPTION":rr().parse(t.input),Xe.setModuleDescriptionOperation(e.global,t);break;case"DELETE_MODULE":Bn().parse(t.input),Xe.deleteModuleOperation(e.global,t);break;case"REORDER_MODULES":Vn().parse(t.input),Xe.reorderModulesOperation(e.global,t);break;case"ADD_OPERATION_ERROR":zn().parse(t.input),ze.addOperationErrorOperation(e.global,t);break;case"SET_OPERATION_ERROR_CODE":sr().parse(t.input),ze.setOperationErrorCodeOperation(e.global,t);break;case"SET_OPERATION_ERROR_NAME":lr().parse(t.input),ze.setOperationErrorNameOperation(e.global,t);break;case"SET_OPERATION_ERROR_DESCRIPTION":ar().parse(t.input),ze.setOperationErrorDescriptionOperation(e.global,t);break;case"SET_OPERATION_ERROR_TEMPLATE":ur().parse(t.input),ze.setOperationErrorTemplateOperation(e.global,t);break;case"DELETE_OPERATION_ERROR":Fn().parse(t.input),ze.deleteOperationErrorOperation(e.global,t);break;case"REORDER_OPERATION_ERRORS":Xn().parse(t.input),ze.reorderOperationErrorsOperation(e.global,t);break;case"ADD_OPERATION_EXAMPLE":wo().parse(t.input),ut.addOperationExampleOperation(e.global,t);break;case"UPDATE_OPERATION_EXAMPLE":Co().parse(t.input),ut.updateOperationExampleOperation(e.global,t);break;case"DELETE_OPERATION_EXAMPLE":xo().parse(t.input),ut.deleteOperationExampleOperation(e.global,t);break;case"REORDER_OPERATION_EXAMPLES":To().parse(t.input),ut.reorderOperationExamplesOperation(e.global,t);break;case"ADD_OPERATION":Pn().parse(t.input),ve.addOperationOperation(e.global,t);break;case"SET_OPERATION_NAME":cr().parse(t.input),ve.setOperationNameOperation(e.global,t);break;case"SET_OPERATION_SCOPE":pr().parse(t.input),ve.setOperationScopeOperation(e.global,t);break;case"SET_OPERATION_SCHEMA":fr().parse(t.input),ve.setOperationSchemaOperation(e.global,t);break;case"SET_OPERATION_DESCRIPTION":or().parse(t.input),ve.setOperationDescriptionOperation(e.global,t);break;case"SET_OPERATION_TEMPLATE":hr().parse(t.input),ve.setOperationTemplateOperation(e.global,t);break;case"SET_OPERATION_REDUCER":dr().parse(t.input),ve.setOperationReducerOperation(e.global,t);break;case"MOVE_OPERATION":Hn().parse(t.input),ve.moveOperationOperation(e.global,t);break;case"DELETE_OPERATION":$n().parse(t.input),ve.deleteOperationOperation(e.global,t);break;case"REORDER_MODULE_OPERATIONS":Gn().parse(t.input),ve.reorderModuleOperationsOperation(e.global,t);break;case"SET_STATE_SCHEMA":mr().parse(t.input),Be.setStateSchemaOperation(e.global,t);break;case"SET_INITIAL_STATE":Yn().parse(t.input),Be.setInitialStateOperation(e.global,t);break;case"ADD_STATE_EXAMPLE":Ln().parse(t.input),Be.addStateExampleOperation(e.global,t);break;case"UPDATE_STATE_EXAMPLE":_r().parse(t.input),Be.updateStateExampleOperation(e.global,t);break;case"DELETE_STATE_EXAMPLE":Wn().parse(t.input),Be.deleteStateExampleOperation(e.global,t);break;case"REORDER_STATE_EXAMPLES":Kn().parse(t.input),Be.reorderStateExamplesOperation(e.global,t);break;default:return e}},Er=Tn(Ms),Ns=(e,t)=>Fi(e,t),zs=e=>$i(e,Er),Sr=e=>({...$t(),global:{...xs,...e?.global??{}},local:{...Os,...e?.local??{}}});function Ps(){return{...$t(),author:{name:"",website:""},description:"",extension:"",id:"",name:"",specifications:[]}}function Ls(){return{}}function Us(e){return{...Ps(),...e||{}}}function js(e){return{...Ls()}}function Bs(e,t,n){return{...So(e?.auth,e?.document),global:Us(t),local:js()}}function Fs(e){const t=bn(Sr,e);return t.header.documentType=br,t}const $s=e=>ks(e),Ws=e=>{Ts(e)},Hs=e=>Ds(e),Zs=e=>{Cs(e)},Gs={fileExtension:ws,createState:Sr,createDocument:Fs,loadFromInput:zs,saveToFileHandle:Ns,isStateOfType:$s,assertIsStateOfType:Ws,isDocumentOfType:Hs,assertIsDocumentOfType:Zs},pa={reducer:Er,documentModel:Bs($t(),vs),actions:Ss,utils:Gs},Vs=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),Xs=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),Ks=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),Js=/[^\p{L}\d]+/giu,nn="$1\0$2",rn="";function wr(e){let t=e.trim();t=t.replace(Vs,nn).replace(Xs,nn),t=t.replace(Js,"\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 qs(e){const t=wr(e);for(let n=0;n<t.length;n++){const r=t[n],i=Ks.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 Ys(e,t){const[n,r,i]=nt(e,t);return n+r.map(bt(t?.locale)).join(t?.delimiter??" ")+i}function on(e,t){const[n,r,i]=nt(e,t),s=bt(t?.locale),l=yt(t?.locale),o=t?.mergeAmbiguousCharacters?Wt(s,l):Qs(s,l);return n+r.map(o).join(t?.delimiter??"")+i}function da(e,t){const[n,r,i]=nt(e,t),s=bt(t?.locale),l=yt(t?.locale);return n+r.map(Wt(s,l)).join(" ")+i}function fa(e,t){const[n,r,i]=nt(e,t);return n+r.map(yt(t?.locale)).join("_")+i}function ha(e,t){const[n,r,i]=nt(e,t),s=bt(t?.locale),l=yt(t?.locale),o=Wt(s,l);return n+r.map((u,d)=>d===0?o(u):s(u)).join(" ")+i}function ma(e,t){return Ys(e,{delimiter:"_",...t})}function bt(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 Wt(e,t){return n=>`${t(n[0])}${e(n.slice(1))}`}function Qs(e,t){return(n,r)=>{const i=n[0];return(r>0&&i>="0"&&i<="9"?"_"+i:t(i))+e(n.slice(1))}}function nt(e,t={}){const n=t.split??(t.separateNumbers?qs:wr),r=t.prefixCharacters??rn,i=t.suffixCharacters??rn;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)]}function ga(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 _a(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=`type ${on(t)}${on(n)}State`;return e.includes(s)||i.push({message:`Invalid state schema name. Expected ${s}`,details:{schema:e}}),i}function ba(e){const t=[];e.length||t.push({message:"Modules are required",details:{modules:e}});const n=e.reduce((r,i)=>[...r,...ea(i)],[]);return[...t,...n]}function ea(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,...ta(i)],[]);return[...t,...n]}function ta(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}export{Bi as $,lt as A,As as B,ma as C,fa as D,ha as E,No as F,ls as G,zo as H,Lo as I,Po as J,Uo as K,jo as L,us as M,Bo as N,Fo as O,Wo as P,Go as Q,Xo as R,Ko as S,Qo as T,ts as U,ss as V,rs as W,Zo as X,da as Y,ia as Z,br as _,Tn as a,Ss as a0,ga as a1,_a as a2,ba as a3,di as a4,pi as a5,pa as a6,Is as b,oe as c,Fi as d,$i as e,bn as f,Dt as g,$t as h,_n as i,Bs as j,xi as k,Ct as l,ua as m,Re as n,aa as o,on as p,la as q,ca as r,Te as s,Ri as t,dt as u,oa as v,yn as w,Di as x,Ni as y,sa as z};
230
+ }`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""}]}]},yr="powerhouse/document-model",As=ee({id:L(),name:L(),createdAtUtcIso:L(),lastModifiedAtUtcIso:L(),documentType:L()}),Rs=ee({global:an()}),ks=As.extend({documentType:be(yr)}),gt=Rs.extend({global:Io()}),Er=ee({header:ks,state:gt,initialState:gt});function Ts(e){return gt.safeParse(e).success}function Ds(e){gt.parse(e)}function Cs(e){return Er.safeParse(e).success}function Ms(e){Er.parse(e)}const Ns=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),zs=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),Ps=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),Ls=/[^\p{L}\d]+/giu,nn="$1\0$2",rn="";function Sr(e){let t=e.trim();t=t.replace(Ns,nn).replace(zs,nn),t=t.replace(Ls,"\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 Us(e){const t=Sr(e);for(let n=0;n<t.length;n++){const r=t[n],i=Ps.exec(r);if(i){const o=i.index+(i[1]??i[2]).length;t.splice(n,1,r.slice(0,o),r.slice(o))}}return t}function js(e,t){const[n,r,i]=tt(e,t);return n+r.map(bt(t?.locale)).join(t?.delimiter??" ")+i}function on(e,t){const[n,r,i]=tt(e,t),o=bt(t?.locale),l=yt(t?.locale),s=t?.mergeAmbiguousCharacters?Wt(o,l):Bs(o,l);return n+r.map(s).join(t?.delimiter??"")+i}function ma(e,t){const[n,r,i]=tt(e,t),o=bt(t?.locale),l=yt(t?.locale);return n+r.map(Wt(o,l)).join(" ")+i}function ga(e,t){const[n,r,i]=tt(e,t);return n+r.map(yt(t?.locale)).join("_")+i}function _a(e,t){const[n,r,i]=tt(e,t),o=bt(t?.locale),l=yt(t?.locale),s=Wt(o,l);return n+r.map((u,d)=>d===0?s(u):o(u)).join(" ")+i}function ba(e,t){return js(e,{delimiter:"_",...t})}function bt(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 Wt(e,t){return n=>`${t(n[0])}${e(n.slice(1))}`}function Bs(e,t){return(n,r)=>{const i=n[0];return(r>0&&i>="0"&&i<="9"?"_"+i:t(i))+e(n.slice(1))}}function tt(e,t={}){const n=t.split??(t.separateNumbers?Us:Sr),r=t.prefixCharacters??rn,i=t.suffixCharacters??rn;let o=0,l=e.length;for(;o<e.length;){const s=e.charAt(o);if(!r.includes(s))break;o++}for(;l>o;){const s=l-1,u=e.charAt(s);if(!i.includes(u))break;l=s}return[e.slice(0,o),n(e.slice(o,l)),e.slice(l)]}const Fs=["UNDO","REDO","PRUNE","LOAD_STATE","SET_NAME","NOOP"];function $s(e){return Fs.includes(e.toUpperCase())}function Ws(e,t){const n=e.specifications[e.specifications.length-1];if(!n)return[];const r=[];for(const i of n.modules)for(const o of i.operations)t&&o.id===t||o.name&&r.push(o.name.toUpperCase());return r}function sn(e,t,n){if(!e)return;const r=e.toUpperCase();if($s(e))throw new Error(`Operation name "${e}" is reserved. Please use a different name.`);if(Ws(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 ya(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 Ea(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 o=`type ${on(t)}${on(n)}State`;return e.includes(o)||i.push({message:`Invalid state schema name. Expected ${o}`,details:{schema:e}}),i}function Sa(e){const t=[];e.length||t.push({message:"Modules are required",details:{modules:e}});const n=e.reduce((r,i)=>[...r,...Hs(i)],[]);return[...t,...n]}function Hs(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,...Zs(i)],[]);return[...t,...n]}function Zs(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 nt(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}},Xe={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(nt(t.input.order))}},ze={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 o=0;o<n.modules[r].operations[i].errors.length;o++)n.modules[r].operations[i].errors[o].id==t.input.id&&(n.modules[r].operations[i].errors[o].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 o=0;o<n.modules[r].operations[i].errors.length;o++)n.modules[r].operations[i].errors[o].id==t.input.id&&(n.modules[r].operations[i].errors[o].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 o=0;o<n.modules[r].operations[i].errors.length;o++)n.modules[r].operations[i].errors[o].id==t.input.id&&(n.modules[r].operations[i].errors[o].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 o=0;o<n.modules[r].operations[i].errors.length;o++)n.modules[r].operations[i].errors[o].id==t.input.id&&(n.modules[r].operations[i].errors[o].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(o=>o.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(nt(t.input.order))}},ut={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 o=0;o<n.modules[r].operations[i].examples.length;o++)n.modules[r].operations[i].examples[o].id==t.input.id&&(n.modules[r].operations[i].examples[o].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(o=>o.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(nt(t.input.order))}},ve={addOperationOperation(e,t){sn(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&&sn(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(o=>o.id==t.input.operationId?(n.push(o),!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(nt(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(nt(t.input.order));else throw new Error(`Invalid scope: ${t.input.scope}`)}},Ke={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){throw new Error('Reducer "releaseNewVersionOperation" not yet implemented')}},Gs=(e,t)=>{if(bn(t))return e;switch(t.type){case"SET_MODEL_NAME":rr().parse(t.input),je.setModelNameOperation(e.global,t);break;case"SET_MODEL_ID":nr().parse(t.input),je.setModelIdOperation(e.global,t);break;case"SET_MODEL_EXTENSION":tr().parse(t.input),je.setModelExtensionOperation(e.global,t);break;case"SET_MODEL_DESCRIPTION":er().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":Yn().parse(t.input),je.setAuthorWebsiteOperation(e.global,t);break;case"ADD_CHANGE_LOG_ITEM":Nn().parse(t.input),Ke.addChangeLogItemOperation(e.global,t);break;case"UPDATE_CHANGE_LOG_ITEM":_r().parse(t.input),Ke.updateChangeLogItemOperation(e.global,t);break;case"DELETE_CHANGE_LOG_ITEM":Bn().parse(t.input),Ke.deleteChangeLogItemOperation(e.global,t);break;case"REORDER_CHANGE_LOG_ITEMS":Gn().parse(t.input),Ke.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");Ke.releaseNewVersionOperation(e.global,t);break;case"ADD_MODULE":zn().parse(t.input),Xe.addModuleOperation(e.global,t);break;case"SET_MODULE_NAME":or().parse(t.input),Xe.setModuleNameOperation(e.global,t);break;case"SET_MODULE_DESCRIPTION":ir().parse(t.input),Xe.setModuleDescriptionOperation(e.global,t);break;case"DELETE_MODULE":Fn().parse(t.input),Xe.deleteModuleOperation(e.global,t);break;case"REORDER_MODULES":Xn().parse(t.input),Xe.reorderModulesOperation(e.global,t);break;case"ADD_OPERATION_ERROR":Pn().parse(t.input),ze.addOperationErrorOperation(e.global,t);break;case"SET_OPERATION_ERROR_CODE":ar().parse(t.input),ze.setOperationErrorCodeOperation(e.global,t);break;case"SET_OPERATION_ERROR_NAME":ur().parse(t.input),ze.setOperationErrorNameOperation(e.global,t);break;case"SET_OPERATION_ERROR_DESCRIPTION":lr().parse(t.input),ze.setOperationErrorDescriptionOperation(e.global,t);break;case"SET_OPERATION_ERROR_TEMPLATE":cr().parse(t.input),ze.setOperationErrorTemplateOperation(e.global,t);break;case"DELETE_OPERATION_ERROR":$n().parse(t.input),ze.deleteOperationErrorOperation(e.global,t);break;case"REORDER_OPERATION_ERRORS":Kn().parse(t.input),ze.reorderOperationErrorsOperation(e.global,t);break;case"ADD_OPERATION_EXAMPLE":Oo().parse(t.input),ut.addOperationExampleOperation(e.global,t);break;case"UPDATE_OPERATION_EXAMPLE":Mo().parse(t.input),ut.updateOperationExampleOperation(e.global,t);break;case"DELETE_OPERATION_EXAMPLE":vo().parse(t.input),ut.deleteOperationExampleOperation(e.global,t);break;case"REORDER_OPERATION_EXAMPLES":Do().parse(t.input),ut.reorderOperationExamplesOperation(e.global,t);break;case"ADD_OPERATION":Ln().parse(t.input),ve.addOperationOperation(e.global,t);break;case"SET_OPERATION_NAME":pr().parse(t.input),ve.setOperationNameOperation(e.global,t);break;case"SET_OPERATION_SCOPE":dr().parse(t.input),ve.setOperationScopeOperation(e.global,t);break;case"SET_OPERATION_SCHEMA":hr().parse(t.input),ve.setOperationSchemaOperation(e.global,t);break;case"SET_OPERATION_DESCRIPTION":sr().parse(t.input),ve.setOperationDescriptionOperation(e.global,t);break;case"SET_OPERATION_TEMPLATE":mr().parse(t.input),ve.setOperationTemplateOperation(e.global,t);break;case"SET_OPERATION_REDUCER":fr().parse(t.input),ve.setOperationReducerOperation(e.global,t);break;case"MOVE_OPERATION":Zn().parse(t.input),ve.moveOperationOperation(e.global,t);break;case"DELETE_OPERATION":Wn().parse(t.input),ve.deleteOperationOperation(e.global,t);break;case"REORDER_MODULE_OPERATIONS":Vn().parse(t.input),ve.reorderModuleOperationsOperation(e.global,t);break;case"SET_STATE_SCHEMA":gr().parse(t.input),Be.setStateSchemaOperation(e.global,t);break;case"SET_INITIAL_STATE":Qn().parse(t.input),Be.setInitialStateOperation(e.global,t);break;case"ADD_STATE_EXAMPLE":Un().parse(t.input),Be.addStateExampleOperation(e.global,t);break;case"UPDATE_STATE_EXAMPLE":br().parse(t.input),Be.updateStateExampleOperation(e.global,t);break;case"DELETE_STATE_EXAMPLE":Hn().parse(t.input),Be.deleteStateExampleOperation(e.global,t);break;case"REORDER_STATE_EXAMPLES":Jn().parse(t.input),Be.reorderStateExamplesOperation(e.global,t);break;default:return e}},wr=Dn(Gs),Vs=(e,t)=>$i(e,t),Xs=e=>Wi(e,wr),Or=e=>({...$t(),global:{...vs,...e?.global??{}},local:{...xs,...e?.local??{}}});function Ks(){return{...$t(),author:{name:"",website:""},description:"",extension:"",id:"",name:"",specifications:[]}}function Js(){return{}}function qs(e){return{...Ks(),...e||{}}}function Ys(e){return{...Js()}}function Qs(e,t,n){return{...wo(e?.auth,e?.document),global:qs(t),local:Ys()}}function ea(e){const t=yn(Or,e);return t.header.documentType=yr,t}const ta=e=>Ts(e),na=e=>{Ds(e)},ra=e=>Cs(e),ia=e=>{Ms(e)},oa={fileExtension:Os,createState:Or,createDocument:ea,loadFromInput:Xs,saveToFileHandle:Vs,isStateOfType:ta,assertIsStateOfType:na,isDocumentOfType:ra,assertIsDocumentOfType:ia},wa={reducer:wr,documentModel:Qs($t(),Is),actions:ws,utils:oa};export{Fi as $,lt as A,Rs as B,ba as C,ga as D,_a as E,zo as F,us as G,Po as H,Uo as I,Lo as J,jo as K,Bo as L,cs as M,Fo as N,$o as O,Ho as P,Vo as Q,Ko as R,Jo as S,es as T,ns as U,as as V,is as W,Go as X,ma as Y,la as Z,yr as _,Dn as a,ws as a0,ya as a1,Ea as a2,Sa as a3,fi as a4,di as a5,wa as a6,As as b,oe as c,$i as d,Wi as e,yn as f,Dt as g,$t as h,bn as i,Qs as j,vi as k,Ct as l,fa as m,Re as n,pa as o,on as p,da as q,ha as r,Te as s,ki as t,dt as u,ua as v,En as w,Ci as x,zi as y,ca as z};