@powerhousedao/connect 5.1.0-dev.14 → 5.1.0-dev.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +1 -0
- package/dist/assets/AddDriveModal-DMsV1EmF.js +1 -0
- package/dist/assets/ClearStorageModal-DafDf0wL.js +1 -0
- package/dist/assets/{CookiesPolicyModal-5_BRvQDX.js → CookiesPolicyModal-B9Y0d37w.js} +1 -1
- package/dist/assets/CreateDocumentModal-D0SKdOXB.js +1 -0
- package/dist/assets/{DebugSettingsModal-DBfAh2Eh.js → DebugSettingsModal-tOM2XB2b.js} +1 -1
- package/dist/assets/{DeleteDriveModal-DIUpemGO.js → DeleteDriveModal-yoRkT35j.js} +1 -1
- package/dist/assets/DeleteItemModal-Dt8DO-KD.js +1 -0
- package/dist/assets/DisclaimerModal-COFvcRh_.js +1 -0
- package/dist/assets/DriveSettingsModal-IUW8Ts0N.js +1 -0
- package/dist/assets/{ExportDocumentWithErrorsModal-D7qO9eBa.js → ExportDocumentWithErrorsModal-BI5K4xSx.js} +1 -1
- package/dist/assets/SettingsModal-DNLQ3XWD.js +1 -0
- package/dist/assets/UpgradeDriveModal-DZM-Trrz.js +1 -0
- package/dist/assets/{design_system-BhKGDCS0.js → design_system-DqNZEqDD.js} +1 -1
- package/dist/assets/design_system_connect-BjQGcLwx.js +45 -0
- package/dist/assets/{design_system_ui-C3aqsmWB.js → design_system_ui-De2zUQd1.js} +1 -1
- package/dist/assets/{document_drive-CVkeqJ3l.js → document_drive-BsYzrAhx.js} +25 -14
- package/dist/assets/{document_engineering-eUuDlZni.js → document_engineering-JV34gYVQ.js} +1 -1
- package/dist/assets/document_model-Bd0luV_q.js +249 -0
- package/dist/assets/{document_model_editor-BC-st-IQ.js → document_model_editor-Bx2qqpJe.js} +4 -4
- package/dist/assets/{drive_explorer-BaIkalJI.js → drive_explorer-BcIgTAMa.js} +2 -2
- package/dist/assets/{graphql-editor-BlmNBact.js → graphql-editor-Bm6_XoNb.js} +1 -1
- package/dist/assets/{hooks-BfOXK-zZ.js → hooks-BC8CMcBw.js} +1 -1
- package/dist/assets/index-BilHslhO.css +1 -0
- package/dist/assets/index-DOzcEQt2.js +20 -0
- package/dist/assets/index-DodubZxC.js +25 -0
- package/dist/assets/{json-editor-BNVktqFS.js → json-editor-DaSaDya3.js} +1 -1
- package/dist/assets/nodefs-CXVsiugn.js +1 -0
- package/dist/assets/opfs-ahp-BogfyFy7.js +3 -0
- package/dist/assets/pg_dump-CW0pN9tG.wasm +0 -0
- package/dist/assets/reactor_browser-uV2brlos.js +127 -0
- package/dist/assets/state-schemas-D7JU3kP-.js +2 -0
- package/dist/assets/{zod-C6yxFxyo.js → zod-BLAKdWrH.js} +1 -1
- package/dist/index.html +11 -11
- package/lib/package.copy.json +8 -7
- package/lib/src/components/modal/modals/AddDriveModal.d.ts.map +1 -1
- package/lib/src/components/modal/modals/AddDriveModal.js +35 -27
- package/lib/src/components/modal/modals/AddDriveModal.js.map +1 -1
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.d.ts +2 -0
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.d.ts.map +1 -0
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.js +26 -0
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.js.map +1 -0
- package/lib/src/components/modal/modals/InspectorModal/index.d.ts +2 -0
- package/lib/src/components/modal/modals/InspectorModal/index.d.ts.map +1 -0
- package/lib/src/components/modal/modals/InspectorModal/index.js +2 -0
- package/lib/src/components/modal/modals/InspectorModal/index.js.map +1 -0
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.d.ts +32 -0
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.d.ts.map +1 -0
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.js +105 -0
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.js.map +1 -0
- package/lib/src/components/modal/modals/InspectorModal/useRemotesInspector.d.ts +4 -0
- package/lib/src/components/modal/modals/InspectorModal/useRemotesInspector.d.ts.map +1 -0
- package/lib/src/components/modal/modals/InspectorModal/useRemotesInspector.js +12 -0
- package/lib/src/components/modal/modals/InspectorModal/useRemotesInspector.js.map +1 -0
- package/lib/src/components/modal/modals-container.d.ts.map +1 -1
- package/lib/src/components/modal/modals-container.js +4 -0
- package/lib/src/components/modal/modals-container.js.map +1 -1
- package/lib/src/components/sidebar.d.ts.map +1 -1
- package/lib/src/components/sidebar.js +6 -2
- package/lib/src/components/sidebar.js.map +1 -1
- package/lib/src/connect.config.d.ts +2 -0
- package/lib/src/connect.config.d.ts.map +1 -1
- package/lib/src/connect.config.js +1 -0
- package/lib/src/connect.config.js.map +1 -1
- package/lib/src/feature-flags.d.ts +5 -0
- package/lib/src/feature-flags.d.ts.map +1 -1
- package/lib/src/feature-flags.js +20 -4
- package/lib/src/feature-flags.js.map +1 -1
- package/lib/src/hooks/useClientErrorHandler.d.ts.map +1 -1
- package/lib/src/hooks/useClientErrorHandler.js +13 -2
- package/lib/src/hooks/useClientErrorHandler.js.map +1 -1
- package/lib/src/store/reactor.d.ts.map +1 -1
- package/lib/src/store/reactor.js +83 -35
- package/lib/src/store/reactor.js.map +1 -1
- package/lib/src/utils/reactor.d.ts +2 -2
- package/lib/src/utils/reactor.d.ts.map +1 -1
- package/lib/src/utils/reactor.js +11 -6
- package/lib/src/utils/reactor.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/vite.config.d.ts.map +1 -1
- package/lib/vite.config.js +4 -0
- package/lib/vite.config.js.map +1 -1
- package/package.copy.json +8 -7
- package/package.json +15 -14
- package/dist/assets/AddDriveModal-CsIreDDx.js +0 -1
- package/dist/assets/ClearStorageModal-Bs5PhQCc.js +0 -1
- package/dist/assets/CreateDocumentModal-B3udEHXg.js +0 -1
- package/dist/assets/DeleteItemModal-BZbGh1xf.js +0 -1
- package/dist/assets/DisclaimerModal-D2gxfl7h.js +0 -1
- package/dist/assets/DriveSettingsModal-_e3BPDnF.js +0 -1
- package/dist/assets/SettingsModal-BJrrCDcV.js +0 -1
- package/dist/assets/UpgradeDriveModal-B6vhpQEb.js +0 -1
- package/dist/assets/design_system_connect-sfj_xHKm.js +0 -104
- package/dist/assets/document_model-LXEZCDPq.js +0 -230
- package/dist/assets/index-DTv9ZECM.js +0 -20
- package/dist/assets/index-XUlAOLkX.css +0 -1
- package/dist/assets/nodefs-Bkhld2-E.js +0 -1
- package/dist/assets/opfs-ahp-DFuHy9sL.js +0 -3
- package/dist/assets/reactor_browser-Tquh5mPC.js +0 -25
- package/dist/assets/state-schemas-cdssPgbf.js +0 -2
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import{g as gr,p as ao,c as xt}from"./react-DQSxOgtG.js";function U(e,t,n){function r(a,u){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,u);const l=s.prototype,h=Object.keys(l);for(let _=0;_<h.length;_++){const b=h[_];b in a||(a[b]=l[b].bind(a))}}const i=n?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function s(a){var u;const l=n?.Parent?new o:this;r(l,a),(u=l._zod).deferred??(u.deferred=[]);for(const h of l._zod.deferred)h();return l}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class rt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class _r extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const br={};function Ge(e){return br}function uo(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function rn(e,t){return typeof t=="bigint"?t.toString():t}function fn(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function hn(e){return e==null}function mn(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function co(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let i=(r.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(r)){const u=r.match(/\d?e-(\d?)/);u?.[1]&&(i=Number.parseInt(u[1]))}const o=n>i?n:i,s=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return s%a/10**o}const Mn=Symbol("evaluating");function he(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Mn)return r===void 0&&(r=Mn,r=n()),r},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function Xe(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Je(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function $n(e){return JSON.stringify(e)}function lo(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const yr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Mt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const po=fn(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function _t(e){if(Mt(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Mt(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function wr(e){return _t(e)?{...e}:Array.isArray(e)?[...e]:e}const fo=new Set(["string","number","symbol"]);function it(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Be(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function ne(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ho(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const mo={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function go(e,t){const n=e._zod.def,r=Je(e._zod.def,{get shape(){const i={};for(const o in t){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(i[o]=n.shape[o])}return Xe(this,"shape",i),i},checks:[]});return Be(e,r)}function _o(e,t){const n=e._zod.def,r=Je(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const o in t){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&delete i[o]}return Xe(this,"shape",i),i},checks:[]});return Be(e,r)}function bo(e,t){if(!_t(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const i=Je(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return Xe(this,"shape",o),o},checks:[]});return Be(e,i)}function yo(e,t){if(!_t(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return Xe(this,"shape",r),r},checks:e._zod.def.checks};return Be(e,n)}function wo(e,t){const n=Je(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Xe(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Be(e,n)}function Eo(e,t,n){const r=Je(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=e?new e({type:"optional",innerType:i[s]}):i[s])}else for(const s in i)o[s]=e?new e({type:"optional",innerType:i[s]}):i[s];return Xe(this,"shape",o),o},checks:[]});return Be(t,r)}function vo(e,t,n){const r=Je(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const s in n){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=new e({type:"nonoptional",innerType:i[s]}))}else for(const s in i)o[s]=new e({type:"nonoptional",innerType:i[s]});return Xe(this,"shape",o),o},checks:[]});return Be(t,r)}function nt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Er(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function It(e){return typeof e=="string"?e:e?.message}function Ke(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const i=It(e.inst?._zod.def?.error?.(e))??It(t?.error?.(e))??It(n.customError?.(e))??It(n.localeError?.(e))??"Invalid input";r.message=i}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function gn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function bt(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const vr=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,rn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Sr=U("$ZodError",vr),Or=U("$ZodError",vr,{Parent:Error});function So(e,t=n=>n.message){const n={},r=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Oo(e,t=n=>n.message){const n={_errors:[]},r=i=>{for(const o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>r({issues:s}));else if(o.code==="invalid_key")r({issues:o.issues});else if(o.code==="invalid_element")r({issues:o.issues});else if(o.path.length===0)n._errors.push(t(o));else{let s=n,a=0;for(;a<o.path.length;){const u=o.path[a];a===o.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(t(o))):s[u]=s[u]||{_errors:[]},s=s[u],a++}}};return r(e),n}const _n=e=>(t,n,r,i)=>{const o=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new rt;if(s.issues.length){const a=new(i?.Err??e)(s.issues.map(u=>Ke(u,o,Ge())));throw yr(a,i?.callee),a}return s.value},bn=e=>async(t,n,r,i)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new(i?.Err??e)(s.issues.map(u=>Ke(u,o,Ge())));throw yr(a,i?.callee),a}return s.value},Ht=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new rt;return o.issues.length?{success:!1,error:new(e??Sr)(o.issues.map(s=>Ke(s,i,Ge())))}:{success:!0,data:o.value}},xo=Ht(Or),Vt=e=>async(t,n,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(s=>Ke(s,i,Ge())))}:{success:!0,data:o.value}},Io=Vt(Or),ko=e=>(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return _n(e)(t,n,i)},Ao=e=>(t,n,r)=>_n(e)(t,n,r),zo=e=>async(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return bn(e)(t,n,i)},To=e=>async(t,n,r)=>bn(e)(t,n,r),Ro=e=>(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ht(e)(t,n,i)},Do=e=>(t,n,r)=>Ht(e)(t,n,r),Co=e=>async(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Vt(e)(t,n,i)},No=e=>async(t,n,r)=>Vt(e)(t,n,r),Po=/^[cC][^\s-]{8,}$/,Mo=/^[0-9a-z]+$/,$o=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Zo=/^[0-9a-vA-V]{20}$/,Lo=/^[A-Za-z0-9]{27}$/,jo=/^[a-zA-Z0-9_-]{21}$/,Uo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Fo=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Zn=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Bo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Wo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Ho(){return new RegExp(Wo,"u")}const Vo=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Go=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ko=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Xo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Jo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,xr=/^[A-Za-z0-9_-]*$/,Yo=/^\+(?:[0-9]){6,14}[0-9]$/,Ir="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",qo=new RegExp(`^${Ir}$`);function kr(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Qo(e){return new RegExp(`^${kr(e)}$`)}function es(e){const t=kr({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Ir}T(?:${r})$`)}const ts=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ns=/^-?\d+$/,rs=/^-?\d+(?:\.\d+)?/,is=/^(?:true|false)$/i,os=/^[^A-Z]*$/,ss=/^[^a-z]*$/,Ie=U("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ar={number:"number",bigint:"bigint",object:"date"},zr=U("$ZodCheckLessThan",(e,t)=>{Ie.init(e,t);const n=Ar[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Tr=U("$ZodCheckGreaterThan",(e,t)=>{Ie.init(e,t);const n=Ar[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),as=U("$ZodCheckMultipleOf",(e,t)=>{Ie.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):co(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),us=U("$ZodCheckNumberFormat",(e,t)=>{Ie.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=mo[t.format];e._zod.onattach.push(s=>{const a=s._zod.bag;a.format=t.format,a.minimum=i,a.maximum=o,n&&(a.pattern=ns)}),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inst:e})}}),cs=U("$ZodCheckMaxLength",(e,t)=>{var n;Ie.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!hn(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const i=r.value;if(i.length<=t.maximum)return;const s=gn(i);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),ls=U("$ZodCheckMinLength",(e,t)=>{var n;Ie.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!hn(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const s=gn(i);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),ps=U("$ZodCheckLengthEquals",(e,t)=>{var n;Ie.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!hn(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=r=>{const i=r.value,o=i.length;if(o===t.length)return;const s=gn(i),a=o>t.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Gt=U("$ZodCheckStringFormat",(e,t)=>{var n,r;Ie.init(e,t),e._zod.onattach.push(i=>{const o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ds=U("$ZodCheckRegex",(e,t)=>{Gt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),fs=U("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=os),Gt.init(e,t)}),hs=U("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ss),Gt.init(e,t)}),ms=U("$ZodCheckIncludes",(e,t)=>{Ie.init(e,t);const n=it(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),gs=U("$ZodCheckStartsWith",(e,t)=>{Ie.init(e,t);const n=new RegExp(`^${it(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),_s=U("$ZodCheckEndsWith",(e,t)=>{Ie.init(e,t);const n=new RegExp(`.*${it(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),bs=U("$ZodCheckOverwrite",(e,t)=>{Ie.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class ys{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
2
|
+
`).filter(s=>s),i=Math.min(...r.map(s=>s.length-s.trimStart().length)),o=r.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(const s of o)this.content.push(s)}compile(){const t=Function,n=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...n,i.join(`
|
|
3
|
+
`))}}const ws={major:4,minor:1,patch:13},ge=U("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ws;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const o of i._zod.onattach)o(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const i=(s,a,u)=>{let l=nt(s),h;for(const _ of a){if(_._zod.def.when){if(!_._zod.def.when(s))continue}else if(l)continue;const b=s.issues.length,d=_._zod.check(s);if(d instanceof Promise&&u?.async===!1)throw new rt;if(h||d instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await d,s.issues.length!==b&&(l||(l=nt(s,b)))});else{if(s.issues.length===b)continue;l||(l=nt(s,b))}}return h?h.then(()=>s):s},o=(s,a,u)=>{if(nt(s))return s.aborted=!0,s;const l=i(a,r,u);if(l instanceof Promise){if(u.async===!1)throw new rt;return l.then(h=>e._zod.parse(h,u))}return e._zod.parse(l,u)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){const l=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(h=>o(h,s,a)):o(l,s,a)}const u=e._zod.parse(s,a);if(u instanceof Promise){if(a.async===!1)throw new rt;return u.then(l=>i(l,r,a))}return i(u,r,a)}}e["~standard"]={validate:i=>{try{const o=xo(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return Io(e,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),yn=U("$ZodString",(e,t)=>{ge.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ts(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),_e=U("$ZodStringFormat",(e,t)=>{Gt.init(e,t),yn.init(e,t)}),Es=U("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Fo),_e.init(e,t)}),vs=U("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Zn(r))}else t.pattern??(t.pattern=Zn());_e.init(e,t)}),Ss=U("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Bo),_e.init(e,t)}),Os=U("$ZodURL",(e,t)=>{_e.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),xs=U("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ho()),_e.init(e,t)}),Is=U("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=jo),_e.init(e,t)}),ks=U("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Po),_e.init(e,t)}),As=U("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Mo),_e.init(e,t)}),zs=U("$ZodULID",(e,t)=>{t.pattern??(t.pattern=$o),_e.init(e,t)}),Ts=U("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Zo),_e.init(e,t)}),Rs=U("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Lo),_e.init(e,t)}),Ds=U("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=es(t)),_e.init(e,t)}),Cs=U("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=qo),_e.init(e,t)}),Ns=U("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Qo(t)),_e.init(e,t)}),Ps=U("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Uo),_e.init(e,t)}),Ms=U("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Vo),_e.init(e,t),e._zod.bag.format="ipv4"}),$s=U("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Go),_e.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Zs=U("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ko),_e.init(e,t)}),Ls=U("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Xo),_e.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[i,o]=r;if(!o)throw new Error;const s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Rr(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const js=U("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Jo),_e.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Rr(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Us(e){if(!xr.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Rr(n)}const Fs=U("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=xr),_e.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Us(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Bs=U("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Yo),_e.init(e,t)});function Ws(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}const Hs=U("$ZodJWT",(e,t)=>{_e.init(e,t),e._zod.check=n=>{Ws(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Dr=U("$ZodNumber",(e,t)=>{ge.init(e,t),e._zod.pattern=e._zod.bag.pattern??rs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;const o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),Vs=U("$ZodNumberFormat",(e,t)=>{us.init(e,t),Dr.init(e,t)}),Gs=U("$ZodBoolean",(e,t)=>{ge.init(e,t),e._zod.pattern=is,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const i=n.value;return typeof i=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),Ks=U("$ZodAny",(e,t)=>{ge.init(e,t),e._zod.parse=n=>n}),Xs=U("$ZodUnknown",(e,t)=>{ge.init(e,t),e._zod.parse=n=>n}),Js=U("$ZodNever",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ln(e,t,n){e.issues.length&&t.issues.push(...Er(n,e.issues)),t.value[n]=e.value}const Ys=U("$ZodArray",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const o=[];for(let s=0;s<i.length;s++){const a=i[s],u=t.element._zod.run({value:a,issues:[]},r);u instanceof Promise?o.push(u.then(l=>Ln(l,n,s))):Ln(u,n,s)}return o.length?Promise.all(o).then(()=>n):n}});function $t(e,t,n,r){e.issues.length&&t.issues.push(...Er(n,e.issues)),e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Cr(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=ho(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Nr(e,t,n,r,i,o){const s=[],a=i.keySet,u=i.catchall._zod,l=u.def.type;for(const h in t){if(a.has(h))continue;if(l==="never"){s.push(h);continue}const _=u.run({value:t[h],issues:[]},r);_ instanceof Promise?e.push(_.then(b=>$t(b,n,h,t))):$t(_,n,h,t)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const qs=U("$ZodObject",(e,t)=>{if(ge.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...a};return Object.defineProperty(t,"shape",{value:u}),u}})}const r=fn(()=>Cr(t));he(e._zod,"propValues",()=>{const a=t.shape,u={};for(const l in a){const h=a[l]._zod;if(h.values){u[l]??(u[l]=new Set);for(const _ of h.values)u[l].add(_)}}return u});const i=Mt,o=t.catchall;let s;e._zod.parse=(a,u)=>{s??(s=r.value);const l=a.value;if(!i(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};const h=[],_=s.shape;for(const b of s.keys){const y=_[b]._zod.run({value:l[b],issues:[]},u);y instanceof Promise?h.push(y.then(f=>$t(f,a,b,l))):$t(y,a,b,l)}return o?Nr(h,l,a,u,r.value,e):h.length?Promise.all(h).then(()=>a):a}}),Qs=U("$ZodObjectJIT",(e,t)=>{qs.init(e,t);const n=e._zod.parse,r=fn(()=>Cr(t)),i=b=>{const d=new ys(["shape","payload","ctx"]),y=r.value,f=w=>{const x=$n(w);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};d.write("const input = payload.value;");const E=Object.create(null);let g=0;for(const w of y.keys)E[w]=`key_${g++}`;d.write("const newResult = {};");for(const w of y.keys){const x=E[w],O=$n(w);d.write(`const ${x} = ${f(w)};`),d.write(`
|
|
4
|
+
if (${x}.issues.length) {
|
|
5
|
+
payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
|
|
6
|
+
...iss,
|
|
7
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
8
|
+
})));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
if (${x}.value === undefined) {
|
|
13
|
+
if (${O} in input) {
|
|
14
|
+
newResult[${O}] = undefined;
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
newResult[${O}] = ${x}.value;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
`)}d.write("payload.value = newResult;"),d.write("return payload;");const m=d.compile();return(w,x)=>m(b,w,x)};let o;const s=Mt,a=!br.jitless,l=a&&po.value,h=t.catchall;let _;e._zod.parse=(b,d)=>{_??(_=r.value);const y=b.value;return s(y)?a&&l&&d?.async===!1&&d.jitless!==!0?(o||(o=i(t.shape)),b=o(b,d),h?Nr([],y,b,d,_,e):b):n(b,d):(b.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),b)}});function jn(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const i=e.filter(o=>!nt(o));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(s=>Ke(s,r,Ge())))}),t)}const ea=U("$ZodUnion",(e,t)=>{ge.init(e,t),he(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),he(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),he(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),he(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){const i=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>mn(o.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(n)return r(i,o);let s=!1;const a=[];for(const u of t.options){const l=u._zod.run({value:i.value,issues:[]},o);if(l instanceof Promise)a.push(l),s=!0;else{if(l.issues.length===0)return l;a.push(l)}}return s?Promise.all(a).then(u=>jn(u,i,e,o)):jn(a,i,e,o)}}),ta=U("$ZodIntersection",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{const i=n.value,o=t.left._zod.run({value:i,issues:[]},r),s=t.right._zod.run({value:i,issues:[]},r);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([u,l])=>Un(n,u,l)):Un(n,o,s)}});function on(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(_t(e)&&_t(t)){const n=Object.keys(t),r=Object.keys(e).filter(o=>n.indexOf(o)!==-1),i={...e,...t};for(const o of r){const s=on(e[o],t[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};i[o]=s.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=e[r],o=t[r],s=on(i,o);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Un(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),nt(e))return e;const r=on(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const na=U("$ZodEnum",(e,t)=>{ge.init(e,t);const n=uo(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(i=>fo.has(typeof i)).map(i=>typeof i=="string"?it(i):i.toString()).join("|")})$`),e._zod.parse=(i,o)=>{const s=i.value;return r.has(s)||i.issues.push({code:"invalid_value",values:n,input:s,inst:e}),i}}),ra=U("$ZodLiteral",(e,t)=>{if(ge.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?it(r):r?it(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,i)=>{const o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),ia=U("$ZodTransform",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new _r(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(n.value=s,n));if(i instanceof Promise)throw new rt;return n.value=i,n}});function Fn(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const oa=U("$ZodOptional",(e,t)=>{ge.init(e,t),e._zod.optin="optional",e._zod.optout="optional",he(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),he(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${mn(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>Fn(o,n.value)):Fn(i,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),sa=U("$ZodNullable",(e,t)=>{ge.init(e,t),he(e._zod,"optin",()=>t.innerType._zod.optin),he(e._zod,"optout",()=>t.innerType._zod.optout),he(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${mn(n.source)}|null)$`):void 0}),he(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),aa=U("$ZodDefault",(e,t)=>{ge.init(e,t),e._zod.optin="optional",he(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>Bn(o,t)):Bn(i,t)}});function Bn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ua=U("$ZodPrefault",(e,t)=>{ge.init(e,t),e._zod.optin="optional",he(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),ca=U("$ZodNonOptional",(e,t)=>{ge.init(e,t),he(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>Wn(o,e)):Wn(i,e)}});function Wn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const la=U("$ZodCatch",(e,t)=>{ge.init(e,t),he(e._zod,"optin",()=>t.innerType._zod.optin),he(e._zod,"optout",()=>t.innerType._zod.optout),he(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>Ke(s,r,Ge()))},input:n.value}),n.issues=[]),n)):(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(o=>Ke(o,r,Ge()))},input:n.value}),n.issues=[]),n)}}),pa=U("$ZodPipe",(e,t)=>{ge.init(e,t),he(e._zod,"values",()=>t.in._zod.values),he(e._zod,"optin",()=>t.in._zod.optin),he(e._zod,"optout",()=>t.out._zod.optout),he(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const o=t.out._zod.run(n,r);return o instanceof Promise?o.then(s=>kt(s,t.in,r)):kt(o,t.in,r)}const i=t.in._zod.run(n,r);return i instanceof Promise?i.then(o=>kt(o,t.out,r)):kt(i,t.out,r)}});function kt(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const da=U("$ZodReadonly",(e,t)=>{ge.init(e,t),he(e._zod,"propValues",()=>t.innerType._zod.propValues),he(e._zod,"values",()=>t.innerType._zod.values),he(e._zod,"optin",()=>t.innerType?._zod?.optin),he(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(Hn):Hn(i)}});function Hn(e){return e.value=Object.freeze(e.value),e}const fa=U("$ZodLazy",(e,t)=>{ge.init(e,t),he(e._zod,"innerType",()=>t.getter()),he(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),he(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),he(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),he(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),ha=U("$ZodCustom",(e,t)=>{Ie.init(e,t),ge.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(o=>Vn(o,n,r,e));Vn(i,n,r,e)}});function Vn(e,t,n,r){if(!e){const i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(bt(i))}}var Gn;class ma{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const i={...r,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function ga(){return new ma}(Gn=globalThis).__zod_globalRegistry??(Gn.__zod_globalRegistry=ga());const At=globalThis.__zod_globalRegistry;function _a(e,t){return new e({type:"string",...ne(t)})}function ba(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ne(t)})}function Kn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ne(t)})}function ya(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ne(t)})}function wa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ne(t)})}function Ea(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ne(t)})}function va(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ne(t)})}function Sa(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ne(t)})}function Oa(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ne(t)})}function xa(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ne(t)})}function Ia(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ne(t)})}function ka(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ne(t)})}function Aa(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ne(t)})}function za(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ne(t)})}function Ta(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ne(t)})}function Ra(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ne(t)})}function Da(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ne(t)})}function Ca(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ne(t)})}function Na(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ne(t)})}function Pa(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ne(t)})}function Ma(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ne(t)})}function $a(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ne(t)})}function Za(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ne(t)})}function La(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ne(t)})}function ja(e,t){return new e({type:"string",format:"date",check:"string_format",...ne(t)})}function Ua(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ne(t)})}function Fa(e,t){return new e({type:"string",format:"duration",check:"string_format",...ne(t)})}function Ba(e,t){return new e({type:"number",checks:[],...ne(t)})}function Wa(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ne(t)})}function Ha(e,t){return new e({type:"boolean",...ne(t)})}function Va(e){return new e({type:"any"})}function Ga(e){return new e({type:"unknown"})}function Ka(e,t){return new e({type:"never",...ne(t)})}function Xn(e,t){return new zr({check:"less_than",...ne(t),value:e,inclusive:!1})}function qt(e,t){return new zr({check:"less_than",...ne(t),value:e,inclusive:!0})}function Jn(e,t){return new Tr({check:"greater_than",...ne(t),value:e,inclusive:!1})}function Qt(e,t){return new Tr({check:"greater_than",...ne(t),value:e,inclusive:!0})}function Yn(e,t){return new as({check:"multiple_of",...ne(t),value:e})}function Pr(e,t){return new cs({check:"max_length",...ne(t),maximum:e})}function Zt(e,t){return new ls({check:"min_length",...ne(t),minimum:e})}function Mr(e,t){return new ps({check:"length_equals",...ne(t),length:e})}function Xa(e,t){return new ds({check:"string_format",format:"regex",...ne(t),pattern:e})}function Ja(e){return new fs({check:"string_format",format:"lowercase",...ne(e)})}function Ya(e){return new hs({check:"string_format",format:"uppercase",...ne(e)})}function qa(e,t){return new ms({check:"string_format",format:"includes",...ne(t),includes:e})}function Qa(e,t){return new gs({check:"string_format",format:"starts_with",...ne(t),prefix:e})}function eu(e,t){return new _s({check:"string_format",format:"ends_with",...ne(t),suffix:e})}function st(e){return new bs({check:"overwrite",tx:e})}function tu(e){return st(t=>t.normalize(e))}function nu(){return st(e=>e.trim())}function ru(){return st(e=>e.toLowerCase())}function iu(){return st(e=>e.toUpperCase())}function ou(){return st(e=>lo(e))}function su(e,t,n){return new e({type:"array",element:t,...ne(n)})}function au(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ne(n)})}function uu(e){const t=cu(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(bt(r,n.value,t._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),n.issues.push(bt(i))}},e(n.value,n)));return t}function cu(e,t){const n=new Ie({check:"custom",...ne(t)});return n._zod.check=e,n}const lu=U("ZodISODateTime",(e,t)=>{Ds.init(e,t),ye.init(e,t)});function pu(e){return La(lu,e)}const du=U("ZodISODate",(e,t)=>{Cs.init(e,t),ye.init(e,t)});function fu(e){return ja(du,e)}const hu=U("ZodISOTime",(e,t)=>{Ns.init(e,t),ye.init(e,t)});function mu(e){return Ua(hu,e)}const gu=U("ZodISODuration",(e,t)=>{Ps.init(e,t),ye.init(e,t)});function _u(e){return Fa(gu,e)}const $r=(e,t)=>{Sr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Oo(e,n)},flatten:{value:n=>So(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,rn,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,rn,2)}},isEmpty:{get(){return e.issues.length===0}}})},bu=U("ZodError",$r),Re=U("ZodError",$r,{Parent:Error}),yu=_n(Re),wu=bn(Re),Eu=Ht(Re),vu=Vt(Re),Su=ko(Re),Ou=Ao(Re),xu=zo(Re),Iu=To(Re),ku=Ro(Re),Au=Do(Re),zu=Co(Re),Tu=No(Re),be=U("ZodType",(e,t)=>(ge.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Je(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]})),e.clone=(n,r)=>Be(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>yu(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Eu(e,n,r),e.parseAsync=async(n,r)=>wu(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>vu(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Su(e,n,r),e.decode=(n,r)=>Ou(e,n,r),e.encodeAsync=async(n,r)=>xu(e,n,r),e.decodeAsync=async(n,r)=>Iu(e,n,r),e.safeEncode=(n,r)=>ku(e,n,r),e.safeDecode=(n,r)=>Au(e,n,r),e.safeEncodeAsync=async(n,r)=>zu(e,n,r),e.safeDecodeAsync=async(n,r)=>Tu(e,n,r),e.refine=(n,r)=>e.check(Sc(n,r)),e.superRefine=n=>e.check(Oc(n)),e.overwrite=n=>e.check(st(n)),e.optional=()=>er(e),e.nullable=()=>tr(e),e.nullish=()=>er(tr(e)),e.nonoptional=n=>mc(e,n),e.array=()=>xe(e),e.or=n=>jr([e,n]),e.and=n=>sc(e,n),e.transform=n=>nr(e,cc(n)),e.default=n=>dc(e,n),e.prefault=n=>hc(e,n),e.catch=n=>_c(e,n),e.pipe=n=>nr(e,n),e.readonly=()=>wc(e),e.describe=n=>{const r=e.clone();return At.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return At.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return At.get(e);const r=e.clone();return At.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Zr=U("_ZodString",(e,t)=>{yn.init(e,t),be.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(Xa(...r)),e.includes=(...r)=>e.check(qa(...r)),e.startsWith=(...r)=>e.check(Qa(...r)),e.endsWith=(...r)=>e.check(eu(...r)),e.min=(...r)=>e.check(Zt(...r)),e.max=(...r)=>e.check(Pr(...r)),e.length=(...r)=>e.check(Mr(...r)),e.nonempty=(...r)=>e.check(Zt(1,...r)),e.lowercase=r=>e.check(Ja(r)),e.uppercase=r=>e.check(Ya(r)),e.trim=()=>e.check(nu()),e.normalize=(...r)=>e.check(tu(...r)),e.toLowerCase=()=>e.check(ru()),e.toUpperCase=()=>e.check(iu()),e.slugify=()=>e.check(ou())}),Ru=U("ZodString",(e,t)=>{yn.init(e,t),Zr.init(e,t),e.email=n=>e.check(ba(Du,n)),e.url=n=>e.check(Sa(Cu,n)),e.jwt=n=>e.check(Za(Ku,n)),e.emoji=n=>e.check(Oa(Nu,n)),e.guid=n=>e.check(Kn(qn,n)),e.uuid=n=>e.check(ya(zt,n)),e.uuidv4=n=>e.check(wa(zt,n)),e.uuidv6=n=>e.check(Ea(zt,n)),e.uuidv7=n=>e.check(va(zt,n)),e.nanoid=n=>e.check(xa(Pu,n)),e.guid=n=>e.check(Kn(qn,n)),e.cuid=n=>e.check(Ia(Mu,n)),e.cuid2=n=>e.check(ka($u,n)),e.ulid=n=>e.check(Aa(Zu,n)),e.base64=n=>e.check(Pa(Hu,n)),e.base64url=n=>e.check(Ma(Vu,n)),e.xid=n=>e.check(za(Lu,n)),e.ksuid=n=>e.check(Ta(ju,n)),e.ipv4=n=>e.check(Ra(Uu,n)),e.ipv6=n=>e.check(Da(Fu,n)),e.cidrv4=n=>e.check(Ca(Bu,n)),e.cidrv6=n=>e.check(Na(Wu,n)),e.e164=n=>e.check($a(Gu,n)),e.datetime=n=>e.check(pu(n)),e.date=n=>e.check(fu(n)),e.time=n=>e.check(mu(n)),e.duration=n=>e.check(_u(n))});function $(e){return _a(Ru,e)}const ye=U("ZodStringFormat",(e,t)=>{_e.init(e,t),Zr.init(e,t)}),Du=U("ZodEmail",(e,t)=>{Ss.init(e,t),ye.init(e,t)}),qn=U("ZodGUID",(e,t)=>{Es.init(e,t),ye.init(e,t)}),zt=U("ZodUUID",(e,t)=>{vs.init(e,t),ye.init(e,t)}),Cu=U("ZodURL",(e,t)=>{Os.init(e,t),ye.init(e,t)}),Nu=U("ZodEmoji",(e,t)=>{xs.init(e,t),ye.init(e,t)}),Pu=U("ZodNanoID",(e,t)=>{Is.init(e,t),ye.init(e,t)}),Mu=U("ZodCUID",(e,t)=>{ks.init(e,t),ye.init(e,t)}),$u=U("ZodCUID2",(e,t)=>{As.init(e,t),ye.init(e,t)}),Zu=U("ZodULID",(e,t)=>{zs.init(e,t),ye.init(e,t)}),Lu=U("ZodXID",(e,t)=>{Ts.init(e,t),ye.init(e,t)}),ju=U("ZodKSUID",(e,t)=>{Rs.init(e,t),ye.init(e,t)}),Uu=U("ZodIPv4",(e,t)=>{Ms.init(e,t),ye.init(e,t)}),Fu=U("ZodIPv6",(e,t)=>{$s.init(e,t),ye.init(e,t)}),Bu=U("ZodCIDRv4",(e,t)=>{Zs.init(e,t),ye.init(e,t)}),Wu=U("ZodCIDRv6",(e,t)=>{Ls.init(e,t),ye.init(e,t)}),Hu=U("ZodBase64",(e,t)=>{js.init(e,t),ye.init(e,t)}),Vu=U("ZodBase64URL",(e,t)=>{Fs.init(e,t),ye.init(e,t)}),Gu=U("ZodE164",(e,t)=>{Bs.init(e,t),ye.init(e,t)}),Ku=U("ZodJWT",(e,t)=>{Hs.init(e,t),ye.init(e,t)}),Lr=U("ZodNumber",(e,t)=>{Dr.init(e,t),be.init(e,t),e.gt=(r,i)=>e.check(Jn(r,i)),e.gte=(r,i)=>e.check(Qt(r,i)),e.min=(r,i)=>e.check(Qt(r,i)),e.lt=(r,i)=>e.check(Xn(r,i)),e.lte=(r,i)=>e.check(qt(r,i)),e.max=(r,i)=>e.check(qt(r,i)),e.int=r=>e.check(Qn(r)),e.safe=r=>e.check(Qn(r)),e.positive=r=>e.check(Jn(0,r)),e.nonnegative=r=>e.check(Qt(0,r)),e.negative=r=>e.check(Xn(0,r)),e.nonpositive=r=>e.check(qt(0,r)),e.multipleOf=(r,i)=>e.check(Yn(r,i)),e.step=(r,i)=>e.check(Yn(r,i)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ot(e){return Ba(Lr,e)}const Xu=U("ZodNumberFormat",(e,t)=>{Vs.init(e,t),Lr.init(e,t)});function Qn(e){return Wa(Xu,e)}const Ju=U("ZodBoolean",(e,t)=>{Gs.init(e,t),be.init(e,t)});function Yd(e){return Ha(Ju,e)}const Yu=U("ZodAny",(e,t)=>{Ks.init(e,t),be.init(e,t)});function qu(){return Va(Yu)}const Qu=U("ZodUnknown",(e,t)=>{Xs.init(e,t),be.init(e,t)});function Lt(){return Ga(Qu)}const ec=U("ZodNever",(e,t)=>{Js.init(e,t),be.init(e,t)});function tc(e){return Ka(ec,e)}const nc=U("ZodArray",(e,t)=>{Ys.init(e,t),be.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(Zt(n,r)),e.nonempty=n=>e.check(Zt(1,n)),e.max=(n,r)=>e.check(Pr(n,r)),e.length=(n,r)=>e.check(Mr(n,r)),e.unwrap=()=>e.element});function xe(e,t){return su(nc,e,t)}const rc=U("ZodObject",(e,t)=>{Qs.init(e,t),be.init(e,t),he(e,"shape",()=>t.shape),e.keyof=()=>at(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Lt()}),e.loose=()=>e.clone({...e._zod.def,catchall:Lt()}),e.strict=()=>e.clone({...e._zod.def,catchall:tc()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>bo(e,n),e.safeExtend=n=>yo(e,n),e.merge=n=>wo(e,n),e.pick=n=>go(e,n),e.omit=n=>_o(e,n),e.partial=(...n)=>Eo(Ur,e,n[0]),e.required=(...n)=>vo(Fr,e,n[0])});function te(e,t){const n={type:"object",shape:e??{},...ne(t)};return new rc(n)}const ic=U("ZodUnion",(e,t)=>{ea.init(e,t),be.init(e,t),e.options=t.options});function jr(e,t){return new ic({type:"union",options:e,...ne(t)})}const oc=U("ZodIntersection",(e,t)=>{ta.init(e,t),be.init(e,t)});function sc(e,t){return new oc({type:"intersection",left:e,right:t})}const sn=U("ZodEnum",(e,t)=>{na.init(e,t),be.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{const o={};for(const s of r)if(n.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new sn({...t,checks:[],...ne(i),entries:o})},e.exclude=(r,i)=>{const o={...t.entries};for(const s of r)if(n.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new sn({...t,checks:[],...ne(i),entries:o})}});function at(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new sn({type:"enum",entries:n,...ne(t)})}const ac=U("ZodLiteral",(e,t)=>{ra.init(e,t),be.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ke(e,t){return new ac({type:"literal",values:Array.isArray(e)?e:[e],...ne(t)})}const uc=U("ZodTransform",(e,t)=>{ia.init(e,t),be.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new _r(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(bt(o,n.value,t));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(bt(s))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(o=>(n.value=o,n)):(n.value=i,n)}});function cc(e){return new uc({type:"transform",transform:e})}const Ur=U("ZodOptional",(e,t)=>{oa.init(e,t),be.init(e,t),e.unwrap=()=>e._zod.def.innerType});function er(e){return new Ur({type:"optional",innerType:e})}const lc=U("ZodNullable",(e,t)=>{sa.init(e,t),be.init(e,t),e.unwrap=()=>e._zod.def.innerType});function tr(e){return new lc({type:"nullable",innerType:e})}const pc=U("ZodDefault",(e,t)=>{aa.init(e,t),be.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dc(e,t){return new pc({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():wr(t)}})}const fc=U("ZodPrefault",(e,t)=>{ua.init(e,t),be.init(e,t),e.unwrap=()=>e._zod.def.innerType});function hc(e,t){return new fc({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():wr(t)}})}const Fr=U("ZodNonOptional",(e,t)=>{ca.init(e,t),be.init(e,t),e.unwrap=()=>e._zod.def.innerType});function mc(e,t){return new Fr({type:"nonoptional",innerType:e,...ne(t)})}const gc=U("ZodCatch",(e,t)=>{la.init(e,t),be.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _c(e,t){return new gc({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const bc=U("ZodPipe",(e,t)=>{pa.init(e,t),be.init(e,t),e.in=t.in,e.out=t.out});function nr(e,t){return new bc({type:"pipe",in:e,out:t})}const yc=U("ZodReadonly",(e,t)=>{da.init(e,t),be.init(e,t),e.unwrap=()=>e._zod.def.innerType});function wc(e){return new yc({type:"readonly",innerType:e})}const Ec=U("ZodLazy",(e,t)=>{fa.init(e,t),be.init(e,t),e.unwrap=()=>e._zod.def.getter()});function wn(e){return new Ec({type:"lazy",getter:e})}const vc=U("ZodCustom",(e,t)=>{ha.init(e,t),be.init(e,t)});function Sc(e,t={}){return au(vc,e,t)}function Oc(e){return uu(e)}var Tt={exports:{}},rr;function xc(){return rr||(rr=1,(function(e,t){const{hasOwnProperty:n}=Object.prototype,r=g();r.configure=g,r.stringify=r,r.default=r,t.stringify=r,t.configure=g,e.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function o(m){return m.length<5e3&&!i.test(m)?`"${m}"`:JSON.stringify(m)}function s(m,w){if(m.length>200||w)return m.sort(w);for(let x=1;x<m.length;x++){const O=m[x];let T=x;for(;T!==0&&m[T-1]>O;)m[T]=m[T-1],T--;m[T]=O}return m}const a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u(m){return a.call(m)!==void 0&&m.length!==0}function l(m,w,x){m.length<x&&(x=m.length);const O=w===","?"":" ";let T=`"0":${O}${m[0]}`;for(let C=1;C<x;C++)T+=`${w}"${C}":${O}${m[C]}`;return T}function h(m){if(n.call(m,"circularValue")){const w=m.circularValue;if(typeof w=="string")return`"${w}"`;if(w==null)return w;if(w===Error||w===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 _(m){let w;if(n.call(m,"deterministic")&&(w=m.deterministic,typeof w!="boolean"&&typeof w!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return w===void 0?!0:w}function b(m,w){let x;if(n.call(m,w)&&(x=m[w],typeof x!="boolean"))throw new TypeError(`The "${w}" argument must be of type boolean`);return x===void 0?!0:x}function d(m,w){let x;if(n.call(m,w)){if(x=m[w],typeof x!="number")throw new TypeError(`The "${w}" argument must be of type number`);if(!Number.isInteger(x))throw new TypeError(`The "${w}" argument must be an integer`);if(x<1)throw new RangeError(`The "${w}" argument must be >= 1`)}return x===void 0?1/0:x}function y(m){return m===1?"1 item":`${m} items`}function f(m){const w=new Set;for(const x of m)(typeof x=="string"||typeof x=="number")&&w.add(String(x));return w}function E(m){if(n.call(m,"strict")){const w=m.strict;if(typeof w!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(w)return x=>{let O=`Object can not safely be stringified. Received type ${typeof x}`;throw typeof x!="function"&&(O+=` (${x.toString()})`),new Error(O)}}}function g(m){m={...m};const w=E(m);w&&(m.bigint===void 0&&(m.bigint=!1),"circularValue"in m||(m.circularValue=Error));const x=h(m),O=b(m,"bigint"),T=_(m),C=typeof T=="function"?T:void 0,F=d(m,"maximumDepth"),R=d(m,"maximumBreadth");function G(Z,N,P,q,j,Y){let k=N[Z];switch(typeof k=="object"&&k!==null&&typeof k.toJSON=="function"&&(k=k.toJSON(Z)),k=q.call(N,Z,k),typeof k){case"string":return o(k);case"object":{if(k===null)return"null";if(P.indexOf(k)!==-1)return x;let A="",Q=",";const K=Y;if(Array.isArray(k)){if(k.length===0)return"[]";if(F<P.length+1)return'"[Array]"';P.push(k),j!==""&&(Y+=j,A+=`
|
|
21
|
+
${Y}`,Q=`,
|
|
22
|
+
${Y}`);const de=Math.min(k.length,R);let fe=0;for(;fe<de-1;fe++){const Se=G(String(fe),k,P,q,j,Y);A+=Se!==void 0?Se:"null",A+=Q}const we=G(String(fe),k,P,q,j,Y);if(A+=we!==void 0?we:"null",k.length-1>R){const Se=k.length-R-1;A+=`${Q}"... ${y(Se)} not stringified"`}return j!==""&&(A+=`
|
|
23
|
+
${K}`),P.pop(),`[${A}]`}let W=Object.keys(k);const ce=W.length;if(ce===0)return"{}";if(F<P.length+1)return'"[Object]"';let se="",oe="";j!==""&&(Y+=j,Q=`,
|
|
24
|
+
${Y}`,se=" ");const ue=Math.min(ce,R);T&&!u(k)&&(W=s(W,C)),P.push(k);for(let de=0;de<ue;de++){const fe=W[de],we=G(fe,k,P,q,j,Y);we!==void 0&&(A+=`${oe}${o(fe)}:${se}${we}`,oe=Q)}if(ce>R){const de=ce-R;A+=`${oe}"...":${se}"${y(de)} not stringified"`,oe=Q}return j!==""&&oe.length>1&&(A=`
|
|
25
|
+
${Y}${A}
|
|
26
|
+
${K}`),P.pop(),`{${A}}`}case"number":return isFinite(k)?String(k):w?w(k):"null";case"boolean":return k===!0?"true":"false";case"undefined":return;case"bigint":if(O)return String(k);default:return w?w(k):void 0}}function re(Z,N,P,q,j,Y){switch(typeof N=="object"&&N!==null&&typeof N.toJSON=="function"&&(N=N.toJSON(Z)),typeof N){case"string":return o(N);case"object":{if(N===null)return"null";if(P.indexOf(N)!==-1)return x;const k=Y;let A="",Q=",";if(Array.isArray(N)){if(N.length===0)return"[]";if(F<P.length+1)return'"[Array]"';P.push(N),j!==""&&(Y+=j,A+=`
|
|
27
|
+
${Y}`,Q=`,
|
|
28
|
+
${Y}`);const ce=Math.min(N.length,R);let se=0;for(;se<ce-1;se++){const ue=re(String(se),N[se],P,q,j,Y);A+=ue!==void 0?ue:"null",A+=Q}const oe=re(String(se),N[se],P,q,j,Y);if(A+=oe!==void 0?oe:"null",N.length-1>R){const ue=N.length-R-1;A+=`${Q}"... ${y(ue)} not stringified"`}return j!==""&&(A+=`
|
|
29
|
+
${k}`),P.pop(),`[${A}]`}P.push(N);let K="";j!==""&&(Y+=j,Q=`,
|
|
30
|
+
${Y}`,K=" ");let W="";for(const ce of q){const se=re(ce,N[ce],P,q,j,Y);se!==void 0&&(A+=`${W}${o(ce)}:${K}${se}`,W=Q)}return j!==""&&W.length>1&&(A=`
|
|
31
|
+
${Y}${A}
|
|
32
|
+
${k}`),P.pop(),`{${A}}`}case"number":return isFinite(N)?String(N):w?w(N):"null";case"boolean":return N===!0?"true":"false";case"undefined":return;case"bigint":if(O)return String(N);default:return w?w(N):void 0}}function I(Z,N,P,q,j){switch(typeof N){case"string":return o(N);case"object":{if(N===null)return"null";if(typeof N.toJSON=="function"){if(N=N.toJSON(Z),typeof N!="object")return I(Z,N,P,q,j);if(N===null)return"null"}if(P.indexOf(N)!==-1)return x;const Y=j;if(Array.isArray(N)){if(N.length===0)return"[]";if(F<P.length+1)return'"[Array]"';P.push(N),j+=q;let se=`
|
|
33
|
+
${j}`;const oe=`,
|
|
34
|
+
${j}`,ue=Math.min(N.length,R);let de=0;for(;de<ue-1;de++){const we=I(String(de),N[de],P,q,j);se+=we!==void 0?we:"null",se+=oe}const fe=I(String(de),N[de],P,q,j);if(se+=fe!==void 0?fe:"null",N.length-1>R){const we=N.length-R-1;se+=`${oe}"... ${y(we)} not stringified"`}return se+=`
|
|
35
|
+
${Y}`,P.pop(),`[${se}]`}let k=Object.keys(N);const A=k.length;if(A===0)return"{}";if(F<P.length+1)return'"[Object]"';j+=q;const Q=`,
|
|
36
|
+
${j}`;let K="",W="",ce=Math.min(A,R);u(N)&&(K+=l(N,Q,R),k=k.slice(N.length),ce-=N.length,W=Q),T&&(k=s(k,C)),P.push(N);for(let se=0;se<ce;se++){const oe=k[se],ue=I(oe,N[oe],P,q,j);ue!==void 0&&(K+=`${W}${o(oe)}: ${ue}`,W=Q)}if(A>R){const se=A-R;K+=`${W}"...": "${y(se)} not stringified"`,W=Q}return W!==""&&(K=`
|
|
37
|
+
${j}${K}
|
|
38
|
+
${Y}`),P.pop(),`{${K}}`}case"number":return isFinite(N)?String(N):w?w(N):"null";case"boolean":return N===!0?"true":"false";case"undefined":return;case"bigint":if(O)return String(N);default:return w?w(N):void 0}}function L(Z,N,P){switch(typeof N){case"string":return o(N);case"object":{if(N===null)return"null";if(typeof N.toJSON=="function"){if(N=N.toJSON(Z),typeof N!="object")return L(Z,N,P);if(N===null)return"null"}if(P.indexOf(N)!==-1)return x;let q="";const j=N.length!==void 0;if(j&&Array.isArray(N)){if(N.length===0)return"[]";if(F<P.length+1)return'"[Array]"';P.push(N);const K=Math.min(N.length,R);let W=0;for(;W<K-1;W++){const se=L(String(W),N[W],P);q+=se!==void 0?se:"null",q+=","}const ce=L(String(W),N[W],P);if(q+=ce!==void 0?ce:"null",N.length-1>R){const se=N.length-R-1;q+=`,"... ${y(se)} not stringified"`}return P.pop(),`[${q}]`}let Y=Object.keys(N);const k=Y.length;if(k===0)return"{}";if(F<P.length+1)return'"[Object]"';let A="",Q=Math.min(k,R);j&&u(N)&&(q+=l(N,",",R),Y=Y.slice(N.length),Q-=N.length,A=","),T&&(Y=s(Y,C)),P.push(N);for(let K=0;K<Q;K++){const W=Y[K],ce=L(W,N[W],P);ce!==void 0&&(q+=`${A}${o(W)}:${ce}`,A=",")}if(k>R){const K=k-R;q+=`${A}"...":"${y(K)} not stringified"`}return P.pop(),`{${q}}`}case"number":return isFinite(N)?String(N):w?w(N):"null";case"boolean":return N===!0?"true":"false";case"undefined":return;case"bigint":if(O)return String(N);default:return w?w(N):void 0}}function p(Z,N,P){if(arguments.length>1){let q="";if(typeof P=="number"?q=" ".repeat(Math.min(P,10)):typeof P=="string"&&(q=P.slice(0,10)),N!=null){if(typeof N=="function")return G("",{"":Z},[],N,q,"");if(Array.isArray(N))return re("",Z,[],f(N),q,"")}if(q.length!==0)return I("",Z,[],q,"")}return L("",Z,[])}return p}})(Tt,Tt.exports)),Tt.exports}var Ic=xc();const Kt=gr(Ic);Kt.configure;const ir=Kt,kc=[1518500249,1859775393,-1894007588,-899497514];function Ac(e){return new zc}class zc{constructor(){this.A=1732584193,this.B=-271733879,this.C=-1732584194,this.D=271733878,this.E=-1009589776,this._size=0,this._sp=0,(!Rt||pt>=8e3)&&(Rt=new ArrayBuffer(8e3),pt=0),this._byte=new Uint8Array(Rt,pt,80),this._word=new Int32Array(Rt,pt,20),pt+=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 a=new Int32Array(t.buffer,n,i*16);for(;i--;)this._int32(a,o>>2),o+=64;this._size+=o}if(t.BYTES_PER_ELEMENT!==1&&t.buffer){const a=new Uint8Array(t.buffer,n+o,r-o);return this._uint8(a)}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 s=this._size%64;let a=s;for(;n<o&&a<64;)r[a++]=t[n++];a>=64&&this._int32(i),this._size+=a-s}return this}_utf8(t){const{_byte:n,_word:r}=this,i=t.length;let o=this._sp;for(let s=0;s<i;){const a=this._size%64;let u=a;for(;s<i&&u<64;){let l=t.charCodeAt(s++)|0;l<128?n[u++]=l:l<2048?(n[u++]=192|l>>>6,n[u++]=128|l&63):l<55296||l>57343?(n[u++]=224|l>>>12,n[u++]=128|l>>>6&63,n[u++]=128|l&63):o?(l=((o&1023)<<10)+(l&1023)+65536,n[u++]=240|l>>>18,n[u++]=128|l>>>12&63,n[u++]=128|l>>>6&63,n[u++]=128|l&63,o=0):o=l}u>=64&&(this._int32(r),r[0]=r[16]),this._size+=u-a}return this._sp=o,this}_int32(t,n){let{A:r,B:i,C:o,D:s,E:a}=this,u=0;for(n=n|0;u<16;)We[u++]=Ue(t[n++]);for(u=16;u<80;u++)We[u]=Dc(We[u-3]^We[u-8]^We[u-14]^We[u-16]);for(u=0;u<80;u++){const l=u/20|0,h=Cc(r)+Pc(l,i,o,s)+a+We[u]+kc[l]|0;a=s,s=o,o=Nc(i),i=r,r=h}this.A=r+this.A|0,this.B=i+this.B|0,this.C=o+this.C|0,this.D=s+this.D|0,this.E=a+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,s=(o&4294967295)>>>0,a=(o-s)/4294967296;return a&&(r[14]=Ue(a)),s&&(r[15]=Ue(s)),this._int32(r),t==="hex"?this._hex():this._bin()}_hex(){const{A:t,B:n,C:r,D:i,E:o}=this;return dt(t)+dt(n)+dt(r)+dt(i)+dt(o)}_bin(){const{A:t,B:n,C:r,D:i,E:o,_byte:s,_word:a}=this;return a[0]=Ue(t),a[1]=Ue(n),a[2]=Ue(r),a[3]=Ue(i),a[4]=Ue(o),s.slice(0,20)}}const We=new Int32Array(80);let Rt,pt=0;const dt=e=>(e+4294967296).toString(16).substr(-8),Tc=(e=>e<<24&4278190080|e<<8&16711680|e>>8&65280|e>>24&255),Rc=(e=>e),Ue=Mc()?Rc:Tc,Dc=e=>e<<1|e>>>31,Cc=e=>e<<5|e>>>27,Nc=e=>e<<30|e>>>2;function Pc(e,t,n,r){return e===0?t&n|~t&r:e===2?t&n|t&r|n&r:t^n^r}function Mc(){return new Uint8Array(new Uint16Array([65279]).buffer)[0]===254}const Br=(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=Lc(e,t);return n==="hex"?Zc(i):$c(i)};function $c(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Zc(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function Lc(e,t="sha1"){if(!["sha1"].includes(t))throw new Error("Hashing algorithm not supported: Available: sha1");return Ac().update(e).digest()}function jc(e){return(new Date(e).getTime()/1e3).toFixed(0)}function Uc({documentId:e,signer:t,action:n,previousStateHash:r}){const{scope:i,type:o}=n;return[jc(new Date),t.app.key,Br([e,i,o,Kt(n.input)].join("")),r]}const Fc=new TextEncoder;function Bc(e){const t=e.join(""),n=`Signed Operation:
|
|
39
|
+
`+t.length.toString();return Fc.encode(n+t)}function Wc(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 Wr 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 Hc extends Wr{issues;constructor(t){super(t),this.issues=t,this.name="InvalidActionInputZodError"}}class Vc 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,scope:t,operation:r})}get document(){return this._document}get scope(){return this._scope}get operation(){return this._operation}}const Gc=e=>e!=null;qu().refine(e=>Gc(e));const Kc=at(["LOAD_STATE"]),Xc=at(["PRUNE"]),Jc=at(["REDO"]),Yc=at(["SET_NAME"]),qc=at(["UNDO"]);function Ye(){return $()}function Qc(){return jr([el(),nl(),rl(),il(),ol()])}function el(){return te({id:$(),timestampUtcMs:$(),input:wn(()=>Hr()),type:Kc,scope:Ye()})}function Hr(){return te({operations:ot(),state:wn(()=>tl())})}function tl(){return te({data:Lt().nullish(),name:$()})}function nl(){return te({id:$(),timestampUtcMs:$(),input:wn(()=>Vr()),type:Xc,scope:Ye()})}function Vr(){return te({end:ot().nullish(),start:ot().nullish()})}const Gr=ot;function rl(){return te({id:$(),timestampUtcMs:$().datetime(),input:Gr(),type:Jc,scope:Ye()})}const Kr=$;function il(){return te({id:$(),timestampUtcMs:$().datetime(),input:Kr(),type:Yc,scope:ke("global")})}const Xr=ot;function ol(){return te({id:$(),timestampUtcMs:$().datetime(),input:Xr(),type:qc,scope:Ye()})}function En(e){return globalThis.crypto.randomUUID()}const sl=(e=1,t="global")=>ae("UNDO",e,void 0,Xr,t),al=(e=1,t="global")=>ae("REDO",e,void 0,Gr,t),ul=(e,t,n="global")=>ae("PRUNE",{start:e,end:t},void 0,Vr,n),Jr=(e,t)=>ae("LOAD_STATE",{state:e,operations:t},void 0,Hr),Yr=(e="global")=>ae("NOOP",void 0,void 0,void 0,e);function ae(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:En(),timestampUtcMs:new Date().toISOString(),type:e,input:t,scope:i};try{r?.().parse(o.input)}catch(s){throw s instanceof bu?new Hc(s.issues):new Wr(s)}return o}const cl=e=>({id:e.id,timestampUtcMs:e.timestampUtcMs,type:e.type,input:e.input,scope:e.scope,context:e.context,attachments:e.attachments}),ll=(e,t,n)=>({...e,action:e,id:En(),timestampUtcMs:new Date().toISOString(),hash:"",error:void 0,index:t,skip:n}),pl=(e,t)=>({...e,hash:"",error:void 0,skip:t}),dl=(e,t)=>{if(!e.action)throw new Error("Operation has no action");return{...e,action:{...e.action,context:t}}},fl=(e,t,n=[])=>({user:e,app:t,signatures:n});async function hl(e,t){const n=Uc(e),r=Bc(n),i=await t(r);return[...n,`0x${Wc(i)}`]}async function qd(e,t,n,r,i){const s=t(n,e,void 0,{reuseOperationResultingState:!0}).operations[e.scope];if(!s)throw new Error(`No operations found for scope: ${e.scope}`);const a=s.at(-1);if(!a)throw new Error("Action was not applied");const u=s.at(-2)?.hash??"",l=await hl({documentId:n.header.id,signer:r,action:e,previousStateHash:u},i),h={signer:fl(r.user,r.app,[...r.signatures,l])};return dl(a,h)}const ml=e=>`${e.documentType}:${e.createdAtUtcIso}:${e.nonce}`;class gl{#e;subtleCrypto;publicCryptoKey;constructor(t){this.#e=t,this.subtleCrypto=this.#t()}#t(){return new Promise((t,n)=>{t(crypto.subtle)})}async publicKey(){return this.#e}async sign(t){throw new Error("PublicKeySigner only supports verification")}async verify(t,n){const r=await this.subtleCrypto;this.publicCryptoKey||(this.publicCryptoKey=await r.importKey("jwk",this.#e,{name:"Ed25519",namedCurve:"Ed25519"},!0,["verify"]));let i;try{i=await r.verify("Ed25519",this.publicCryptoKey,new Uint8Array(n),new Uint8Array(t))}catch{throw new Error("invalid signature")}if(!i)throw new Error("invalid signature")}}const _l=async e=>new gl(e.sig.publicKey),bl=async(e,t,n)=>{const r=ml(e),o=new TextEncoder().encode(r),s=Uint8Array.from(atob(t),a=>a.charCodeAt(0));await n.verify(o,s)},Qd=async e=>{const t=await _l(e);return await bl({documentType:e.documentType,createdAtUtcIso:e.createdAtUtcIso,nonce:e.sig.nonce},e.id,t)},yl=(e=En(),t="")=>({id:e,sig:{publicKey:{},nonce:""},documentType:t,createdAtUtcIso:new Date().toISOString(),slug:"",name:"",branch:"main",revision:{document:0},lastModifiedAtUtcIso:new Date().toISOString(),meta:{}});function wl(e){return["UNDO","REDO"].includes(e.type)}function El(e){return e.type==="UNDO"}function qr(e){return["SET_NAME","UNDO","REDO","PRUNE","LOAD_STATE"].includes(e.type)}function Qr(e,t){const n=e(t);return{header:yl(),state:n,initialState:n,operations:{global:[],local:[]},clipboard:[]}}function vn(e,t="global"){const n=Kt(e.state[t]||"");return Br(n)}const vl=e=>e;function ei(e,t,n,r,i,o={},s){const{checkHashes:a=!0,reuseOperationResultingState:u,operationResultingStateParser:l=Sn}=s||{};let h=e;const _=[],b=new Set([...Object.keys(t),"global","local"]),d={};for(const x of b)d[x]=[];if(u)for(const[x,O]of Object.entries(t)){if(!O)continue;const T=O.findLastIndex(F=>!!F.resultingState);if(T<0){_.push(...O);continue}const C=O[T];if(!(!C||!C.resultingState))try{const F=l(C.resultingState);h={...h,[x]:F};const R=d[x];R&&R.push(...O.slice(0,T+1)),_.push(...O.slice(T+1))}catch{_.push(...O)}}else _.push(...Object.values(t).flatMap(x=>x||[]));const y=Qr(vl,h);i?.slug&&(y.header.slug=i.slug),y.initialState=e,y.operations=d;let f=y;if(_.length)f=_.reduce((x,O)=>n(x,O.action,r,{ignoreSkipOperations:!0,checkHashes:a,replayOptions:{operation:O}}),y);else for(const x of Object.values(d)){if(!x)continue;const O=x.at(-1);O&&(f=ni(f,O.action.scope))}if(!a)for(const x of Object.keys(f.state))for(let O=_.length-1;O>=0;O--){const T=_[O];if(T.action.scope===x){if(T.hash!==vn(f,x))throw new Vc(x,f,T);break}}const E=new Set([...Object.keys(f.operations),...Object.keys(t),"global","local"]),g={};for(const x of E)g[x]=[];const m=Array.from(E).reduce((x,O)=>{const T=f.operations[O]||[];return{...x,[O]:[...T.map((C,F)=>({...C,timestamp:t[O]?.[F]?.timestampUtcMs??C.timestampUtcMs}))]}},g),w=i?i.lastModifiedAtUtcIso:Object.values(m).reduce((x,O)=>{if(!O)return x;const T=O.at(-1);return T&&T.timestampUtcMs>x?T.timestampUtcMs:x},y.header.lastModifiedAtUtcIso);return i&&(f.header={...i,revision:f.header.revision,lastModifiedAtUtcIso:w}),{...f,operations:m}}function Sn(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 or;(function(e){e.UNEXPECTED_INDEX="UNEXPECTED_INDEX"})(or||(or={}));var sr;(function(e){e.DUPLICATED_INDEX="DUPLICATED_INDEX",e.MISSING_INDEX="MISSING_INDEX"})(sr||(sr={}));function $e(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 Le(e){return e.slice().sort((t,n)=>t.skip-n.skip).sort((t,n)=>t.index-n.index)}function ef(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 ti(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 ir(i)===ir(o)}function tf(e,t){const n=$e(Le(e.slice())),r=$e(Le(t.slice()));if(n.length<1)return[r,[]];const i=[];let o=!1;for(;r.length>0;){const s=r[0];let a=n.shift();for(;a&&Sl(a,s);)i.push(a),a=n.shift();if(a?o||(ti(a,s)?(r.shift(),i.push(a)):(n.unshift(a),o=!0)):o=!0,o){let u=r.shift();for(;u;)i.push(u),u=r.shift()}}if(!o){let s=n.shift();for(;s;)i.push(s),s=n.shift()}return[$e(i),n]}function Sl(e,t){return e.index<t.index||e.index===t.index&&e.id===t.id&&e.skip<t.skip}function Ol(e,t){const n=[],r=[],i=[],o=Math.max(e.length,t.length);let s=!1;for(let a=0;a<o;a++){const u=e[a],l=t[a];u&&l?!s&&ti(u,l)?n.push(u):(s=!0,r.push(u),i.push(l)):u?r.push(u):l&&i.push(l)}return[n,r,i]}function nf(e,t,n){const[r,i,o]=Ol($e(e),$e(t)),s=en(r),a=1+Math.max(s,en(i),en(o)),u=kl(o,i),l=n({index:a,skip:a-(s+1)},i,u);return r.concat(l)}function en(e){const t=e[e.length-1];return t?t.index:-1}function xl(e){if(e.length<1)return-1;const t=$e(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 rf(e){return e.reduce((n,r)=>(n[r.action.scope]||(n[r.action.scope]=[]),n[r.action.scope]?.push(r),n),{})}function of(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 Il(e,t){const r=Le(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 $e(Le([...e,o])).slice(0,-1)}function jt(e){return Object.entries(e).reduce((n,r)=>{const[i,o]=r;return o?{...n,[i]:$e(Le(o))}:n},{})}function kl(e,t){return e.filter(n=>n.id?!t.some(r=>r.id===n.id):!0)}function Al(e){return e?Object.entries(e).reduce((n,[r,i])=>i?{...n,[r]:i.map(o=>{const{resultingState:s,...a}=o;return a})}:n,{}):{}}function zl(e,t){return e.filter(n=>!t.some(r=>n.index===r.index))}function Tl(e){return Le(Object.values(e.operations).flatMap(n=>n||[])).at(-1)?.timestampUtcMs||e.header.lastModifiedAtUtcIso}function Rl(e,t){return(e.operations[t]?.at(-1)?.index??-1??-1)+1}function ni(e,t){const n={...e.header,revision:{...e.header.revision,[t]:Rl(e,t)},lastModifiedAtUtcIso:Tl(e)};return{...e,header:n}}function Dt(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 tn={exports:{}},ar;function Dl(){return ar||(ar=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(r,i,o){function s(l,h){if(!i[l]){if(!r[l]){var _=typeof Dt=="function"&&Dt;if(!h&&_)return _(l,!0);if(a)return a(l,!0);var b=new Error("Cannot find module '"+l+"'");throw b.code="MODULE_NOT_FOUND",b}var d=i[l]={exports:{}};r[l][0].call(d.exports,function(y){var f=r[l][1][y];return s(f||y)},d,d.exports,n,r,i,o)}return i[l].exports}for(var a=typeof Dt=="function"&&Dt,u=0;u<o.length;u++)s(o[u]);return s})({1:[function(n,r,i){var o=n("./utils"),s=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(u){for(var l,h,_,b,d,y,f,E=[],g=0,m=u.length,w=m,x=o.getTypeOf(u)!=="string";g<u.length;)w=m-g,_=x?(l=u[g++],h=g<m?u[g++]:0,g<m?u[g++]:0):(l=u.charCodeAt(g++),h=g<m?u.charCodeAt(g++):0,g<m?u.charCodeAt(g++):0),b=l>>2,d=(3&l)<<4|h>>4,y=1<w?(15&h)<<2|_>>6:64,f=2<w?63&_:64,E.push(a.charAt(b)+a.charAt(d)+a.charAt(y)+a.charAt(f));return E.join("")},i.decode=function(u){var l,h,_,b,d,y,f=0,E=0,g="data:";if(u.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var m,w=3*(u=u.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(u.charAt(u.length-1)===a.charAt(64)&&w--,u.charAt(u.length-2)===a.charAt(64)&&w--,w%1!=0)throw new Error("Invalid base64 input, bad content length.");for(m=s.uint8array?new Uint8Array(0|w):new Array(0|w);f<u.length;)l=a.indexOf(u.charAt(f++))<<2|(b=a.indexOf(u.charAt(f++)))>>4,h=(15&b)<<4|(d=a.indexOf(u.charAt(f++)))>>2,_=(3&d)<<6|(y=a.indexOf(u.charAt(f++))),m[E++]=l,d!==64&&(m[E++]=h),y!==64&&(m[E++]=_);return m}},{"./support":30,"./utils":32}],2:[function(n,r,i){var o=n("./external"),s=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),u=n("./stream/DataLengthProbe");function l(h,_,b,d,y){this.compressedSize=h,this.uncompressedSize=_,this.crc32=b,this.compression=d,this.compressedContent=y}l.prototype={getContentWorker:function(){var h=new s(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("data_length")),_=this;return h.on("end",function(){if(this.streamInfo.data_length!==_.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new s(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},l.createWorkerFrom=function(h,_,b){return h.pipe(new a).pipe(new u("uncompressedSize")).pipe(_.compressWorker(b)).pipe(new u("compressedSize")).withStreamInfo("compression",_)},r.exports=l},{"./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"),s=(function(){for(var a,u=[],l=0;l<256;l++){a=l;for(var h=0;h<8;h++)a=1&a?3988292384^a>>>1:a>>>1;u[l]=a}return u})();r.exports=function(a,u){return a!==void 0&&a.length?o.getTypeOf(a)!=="string"?(function(l,h,_,b){var d=s,y=b+_;l^=-1;for(var f=b;f<y;f++)l=l>>>8^d[255&(l^h[f])];return-1^l})(0|u,a,a.length,0):(function(l,h,_,b){var d=s,y=b+_;l^=-1;for(var f=b;f<y;f++)l=l>>>8^d[255&(l^h.charCodeAt(f))];return-1^l})(0|u,a,a.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",s=n("pako"),a=n("./utils"),u=n("./stream/GenericWorker"),l=o?"uint8array":"array";function h(_,b){u.call(this,"FlateWorker/"+_),this._pako=null,this._pakoAction=_,this._pakoOptions=b,this.meta={}}i.magic="\b\0",a.inherits(h,u),h.prototype.processChunk=function(_){this.meta=_.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(l,_.data),!1)},h.prototype.flush=function(){u.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){u.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var _=this;this._pako.onData=function(b){_.push({data:b,meta:_.meta})}},i.compressWorker=function(_){return new h("Deflate",_)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,i){function o(d,y){var f,E="";for(f=0;f<y;f++)E+=String.fromCharCode(255&d),d>>>=8;return E}function s(d,y,f,E,g,m){var w,x,O=d.file,T=d.compression,C=m!==l.utf8encode,F=a.transformTo("string",m(O.name)),R=a.transformTo("string",l.utf8encode(O.name)),G=O.comment,re=a.transformTo("string",m(G)),I=a.transformTo("string",l.utf8encode(G)),L=R.length!==O.name.length,p=I.length!==G.length,Z="",N="",P="",q=O.dir,j=O.date,Y={crc32:0,compressedSize:0,uncompressedSize:0};y&&!f||(Y.crc32=d.crc32,Y.compressedSize=d.compressedSize,Y.uncompressedSize=d.uncompressedSize);var k=0;y&&(k|=8),C||!L&&!p||(k|=2048);var A=0,Q=0;q&&(A|=16),g==="UNIX"?(Q=798,A|=(function(W,ce){var se=W;return W||(se=ce?16893:33204),(65535&se)<<16})(O.unixPermissions,q)):(Q=20,A|=(function(W){return 63&(W||0)})(O.dosPermissions)),w=j.getUTCHours(),w<<=6,w|=j.getUTCMinutes(),w<<=5,w|=j.getUTCSeconds()/2,x=j.getUTCFullYear()-1980,x<<=4,x|=j.getUTCMonth()+1,x<<=5,x|=j.getUTCDate(),L&&(N=o(1,1)+o(h(F),4)+R,Z+="up"+o(N.length,2)+N),p&&(P=o(1,1)+o(h(re),4)+I,Z+="uc"+o(P.length,2)+P);var K="";return K+=`
|
|
40
|
+
\0`,K+=o(k,2),K+=T.magic,K+=o(w,2),K+=o(x,2),K+=o(Y.crc32,4),K+=o(Y.compressedSize,4),K+=o(Y.uncompressedSize,4),K+=o(F.length,2),K+=o(Z.length,2),{fileRecord:_.LOCAL_FILE_HEADER+K+F+Z,dirRecord:_.CENTRAL_FILE_HEADER+o(Q,2)+K+o(re.length,2)+"\0\0\0\0"+o(A,4)+o(E,4)+F+Z+re}}var a=n("../utils"),u=n("../stream/GenericWorker"),l=n("../utf8"),h=n("../crc32"),_=n("../signature");function b(d,y,f,E){u.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=f,this.encodeFileName=E,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(b,u),b.prototype.push=function(d){var y=d.meta.percent||0,f=this.entriesCount,E=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,u.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:f?(y+100*(f-E-1))/f:100}}))},b.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var y=this.streamFiles&&!d.file.dir;if(y){var f=s(d,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:f.fileRecord,meta:{percent:0}})}else this.accumulate=!0},b.prototype.closedSource=function(d){this.accumulate=!1;var y=this.streamFiles&&!d.file.dir,f=s(d,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(f.dirRecord),y)this.push({data:(function(E){return _.DATA_DESCRIPTOR+o(E.crc32,4)+o(E.compressedSize,4)+o(E.uncompressedSize,4)})(d),meta:{percent:100}});else for(this.push({data:f.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},b.prototype.flush=function(){for(var d=this.bytesWritten,y=0;y<this.dirRecords.length;y++)this.push({data:this.dirRecords[y],meta:{percent:100}});var f=this.bytesWritten-d,E=(function(g,m,w,x,O){var T=a.transformTo("string",O(x));return _.CENTRAL_DIRECTORY_END+"\0\0\0\0"+o(g,2)+o(g,2)+o(m,4)+o(w,4)+o(T.length,2)+T})(this.dirRecords.length,f,d,this.zipComment,this.encodeFileName);this.push({data:E,meta:{percent:100}})},b.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},b.prototype.registerPrevious=function(d){this._sources.push(d);var y=this;return d.on("data",function(f){y.processChunk(f)}),d.on("end",function(){y.closedSource(y.previous.streamInfo),y._sources.length?y.prepareNextSource():y.end()}),d.on("error",function(f){y.error(f)}),this},b.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))},b.prototype.error=function(d){var y=this._sources;if(!u.prototype.error.call(this,d))return!1;for(var f=0;f<y.length;f++)try{y[f].error(d)}catch{}return!0},b.prototype.lock=function(){u.prototype.lock.call(this);for(var d=this._sources,y=0;y<d.length;y++)d[y].lock()},r.exports=b},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,i){var o=n("../compressions"),s=n("./ZipFileWorker");i.generateWorker=function(a,u,l){var h=new s(u.streamFiles,l,u.platform,u.encodeFileName),_=0;try{a.forEach(function(b,d){_++;var y=(function(m,w){var x=m||w,O=o[x];if(!O)throw new Error(x+" is not a valid compression method !");return O})(d.options.compression,u.compression),f=d.options.compressionOptions||u.compressionOptions||{},E=d.dir,g=d.date;d._compressWorker(y,f).withStreamInfo("file",{name:b,dir:E,date:g,comment:d.comment||"",unixPermissions:d.unixPermissions,dosPermissions:d.dosPermissions}).pipe(h)}),h.entriesCount=_}catch(b){h.error(b)}return h}},{"../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 s=new o;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(o.prototype=n("./object")).loadAsync=n("./load"),o.support=n("./support"),o.defaults=n("./defaults"),o.version="3.10.1",o.loadAsync=function(s,a){return new o().loadAsync(s,a)},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"),s=n("./external"),a=n("./utf8"),u=n("./zipEntries"),l=n("./stream/Crc32Probe"),h=n("./nodejsUtils");function _(b){return new s.Promise(function(d,y){var f=b.decompressed.getContentWorker().pipe(new l);f.on("error",function(E){y(E)}).on("end",function(){f.streamInfo.crc32!==b.decompressed.crc32?y(new Error("Corrupted zip : CRC32 mismatch")):d()}).resume()})}r.exports=function(b,d){var y=this;return d=o.extend(d||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),h.isNode&&h.isStream(b)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):o.prepareContent("the loaded zip file",b,!0,d.optimizedBinaryString,d.base64).then(function(f){var E=new u(d);return E.load(f),E}).then(function(f){var E=[s.Promise.resolve(f)],g=f.files;if(d.checkCRC32)for(var m=0;m<g.length;m++)E.push(_(g[m]));return s.Promise.all(E)}).then(function(f){for(var E=f.shift(),g=E.files,m=0;m<g.length;m++){var w=g[m],x=w.fileNameStr,O=o.resolve(w.fileNameStr);y.file(O,w.decompressed,{binary:!0,optimizedBinaryString:!0,date:w.date,dir:w.dir,comment:w.fileCommentStr.length?w.fileCommentStr:null,unixPermissions:w.unixPermissions,dosPermissions:w.dosPermissions,createFolders:d.createFolders}),w.dir||(y.file(O).unsafeOriginalName=x)}return E.zipComment.length&&(y.comment=E.zipComment),y})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,i){var o=n("../utils"),s=n("../stream/GenericWorker");function a(u,l){s.call(this,"Nodejs stream input adapter for "+u),this._upstreamEnded=!1,this._bindStream(l)}o.inherits(a,s),a.prototype._bindStream=function(u){var l=this;(this._stream=u).pause(),u.on("data",function(h){l.push({data:h,meta:{percent:0}})}).on("error",function(h){l.isPaused?this.generatedError=h:l.error(h)}).on("end",function(){l.isPaused?l._upstreamEnded=!0:l.end()})},a.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,i){var o=n("readable-stream").Readable;function s(a,u,l){o.call(this,u),this._helper=a;var h=this;a.on("data",function(_,b){h.push(_)||h._helper.pause(),l&&l(b)}).on("error",function(_){h.emit("error",_)}).on("end",function(){h.push(null)})}n("../utils").inherits(s,o),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,i){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(o,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(o,s);if(typeof o=="number")throw new Error('The "data" argument must not be a number');return new Buffer(o,s)},allocBuffer:function(o){if(Buffer.alloc)return Buffer.alloc(o);var s=new Buffer(o);return s.fill(0),s},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(O,T,C){var F,R=a.getTypeOf(T),G=a.extend(C||{},h);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&&(O=g(O)),G.createFolders&&(F=E(O))&&m.call(this,F,!0);var re=R==="string"&&G.binary===!1&&G.base64===!1;C&&C.binary!==void 0||(G.binary=!re),(T instanceof _&&T.uncompressedSize===0||G.dir||!T||T.length===0)&&(G.base64=!1,G.binary=!0,T="",G.compression="STORE",R="string");var I=null;I=T instanceof _||T instanceof u?T:y.isNode&&y.isStream(T)?new f(O,T):a.prepareContent(O,T,G.binary,G.optimizedBinaryString,G.base64);var L=new b(O,I,G);this.files[O]=L}var s=n("./utf8"),a=n("./utils"),u=n("./stream/GenericWorker"),l=n("./stream/StreamHelper"),h=n("./defaults"),_=n("./compressedObject"),b=n("./zipObject"),d=n("./generate"),y=n("./nodejsUtils"),f=n("./nodejs/NodejsStreamInputAdapter"),E=function(O){O.slice(-1)==="/"&&(O=O.substring(0,O.length-1));var T=O.lastIndexOf("/");return 0<T?O.substring(0,T):""},g=function(O){return O.slice(-1)!=="/"&&(O+="/"),O},m=function(O,T){return T=T!==void 0?T:h.createFolders,O=g(O),this.files[O]||o.call(this,O,null,{dir:!0,createFolders:T}),this.files[O]};function w(O){return Object.prototype.toString.call(O)==="[object RegExp]"}var x={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(O){var T,C,F;for(T in this.files)F=this.files[T],(C=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&O(C,F)},filter:function(O){var T=[];return this.forEach(function(C,F){O(C,F)&&T.push(F)}),T},file:function(O,T,C){if(arguments.length!==1)return O=this.root+O,o.call(this,O,T,C),this;if(w(O)){var F=O;return this.filter(function(G,re){return!re.dir&&F.test(G)})}var R=this.files[this.root+O];return R&&!R.dir?R:null},folder:function(O){if(!O)return this;if(w(O))return this.filter(function(R,G){return G.dir&&O.test(R)});var T=this.root+O,C=m.call(this,T),F=this.clone();return F.root=C.name,F},remove:function(O){O=this.root+O;var T=this.files[O];if(T||(O.slice(-1)!=="/"&&(O+="/"),T=this.files[O]),T&&!T.dir)delete this.files[O];else for(var C=this.filter(function(R,G){return G.name.slice(0,O.length)===O}),F=0;F<C.length;F++)delete this.files[C[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(O){var T,C={};try{if((C=a.extend(O||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=C.type.toLowerCase(),C.compression=C.compression.toUpperCase(),C.type==="binarystring"&&(C.type="string"),!C.type)throw new Error("No output type specified.");a.checkSupport(C.type),C.platform!=="darwin"&&C.platform!=="freebsd"&&C.platform!=="linux"&&C.platform!=="sunos"||(C.platform="UNIX"),C.platform==="win32"&&(C.platform="DOS");var F=C.comment||this.comment||"";T=d.generateWorker(this,C,F)}catch(R){(T=new u("error")).error(R)}return new l(T,C.type||"string",C.mimeType)},generateAsync:function(O,T){return this.generateInternalStream(O).accumulate(T)},generateNodeStream:function(O,T){return(O=O||{}).type||(O.type="nodebuffer"),this.generateInternalStream(O).toNodejsStream(T)}};r.exports=x},{"./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 s(a){o.call(this,a);for(var u=0;u<this.data.length;u++)a[u]=255&a[u]}n("../utils").inherits(s,o),s.prototype.byteAt=function(a){return this.data[this.zero+a]},s.prototype.lastIndexOfSignature=function(a){for(var u=a.charCodeAt(0),l=a.charCodeAt(1),h=a.charCodeAt(2),_=a.charCodeAt(3),b=this.length-4;0<=b;--b)if(this.data[b]===u&&this.data[b+1]===l&&this.data[b+2]===h&&this.data[b+3]===_)return b-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var u=a.charCodeAt(0),l=a.charCodeAt(1),h=a.charCodeAt(2),_=a.charCodeAt(3),b=this.readData(4);return u===b[0]&&l===b[1]&&h===b[2]&&_===b[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var u=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,u},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,i){var o=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var u,l=0;for(this.checkOffset(a),u=this.index+a-1;u>=this.index;u--)l=(l<<8)+this.byteAt(u);return this.index+=a,l},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=s},{"../utils":32}],19:[function(n,r,i){var o=n("./Uint8ArrayReader");function s(a){o.call(this,a)}n("../utils").inherits(s,o),s.prototype.readData=function(a){this.checkOffset(a);var u=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,u},r.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,i){var o=n("./DataReader");function s(a){o.call(this,a)}n("../utils").inherits(s,o),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var u=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,u},r.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,r,i){var o=n("./ArrayReader");function s(a){o.call(this,a)}n("../utils").inherits(s,o),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var u=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,u},r.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,i){var o=n("../utils"),s=n("../support"),a=n("./ArrayReader"),u=n("./StringReader"),l=n("./NodeBufferReader"),h=n("./Uint8ArrayReader");r.exports=function(_){var b=o.getTypeOf(_);return o.checkSupport(b),b!=="string"||s.uint8array?b==="nodebuffer"?new l(_):s.uint8array?new h(o.transformTo("uint8array",_)):new a(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"),s=n("../utils");function a(u){o.call(this,"ConvertWorker to "+u),this.destType=u}s.inherits(a,o),a.prototype.processChunk=function(u){this.push({data:s.transformTo(this.destType,u.data),meta:u.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,i){var o=n("./GenericWorker"),s=n("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,o),a.prototype.processChunk=function(u){this.streamInfo.crc32=s(u.data,this.streamInfo.crc32||0),this.push(u)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,i){var o=n("../utils"),s=n("./GenericWorker");function a(u){s.call(this,"DataLengthProbe for "+u),this.propName=u,this.withStreamInfo(u,0)}o.inherits(a,s),a.prototype.processChunk=function(u){if(u){var l=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=l+u.data.length}s.prototype.processChunk.call(this,u)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,i){var o=n("../utils"),s=n("./GenericWorker");function a(u){s.call(this,"DataWorker");var l=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,u.then(function(h){l.dataIsReady=!0,l.data=h,l.max=h&&h.length||0,l.type=o.getTypeOf(h),l.isPaused||l._tickAndRepeat()},function(h){l.error(h)})}o.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var u=null,l=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,l);break;case"uint8array":u=this.data.subarray(this.index,l);break;case"array":case"nodebuffer":u=this.data.slice(this.index,l)}return this.index=l,this.push({data:u,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,i){function o(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var u=0;u<this._listeners[s].length;u++)this._listeners[s][u].call(this,a)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var a=this;return s.on("data",function(u){a.processChunk(u)}),s.on("end",function(){a.end()}),s.on("error",function(u){a.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 s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,a){return this.extraStreamInfo[s]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},r.exports=o},{}],29:[function(n,r,i){var o=n("../utils"),s=n("./ConvertWorker"),a=n("./GenericWorker"),u=n("../base64"),l=n("../support"),h=n("../external"),_=null;if(l.nodestream)try{_=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function b(y,f){return new h.Promise(function(E,g){var m=[],w=y._internalType,x=y._outputType,O=y._mimeType;y.on("data",function(T,C){m.push(T),f&&f(C)}).on("error",function(T){m=[],g(T)}).on("end",function(){try{var T=(function(C,F,R){switch(C){case"blob":return o.newBlob(o.transformTo("arraybuffer",F),R);case"base64":return u.encode(F);default:return o.transformTo(C,F)}})(x,(function(C,F){var R,G=0,re=null,I=0;for(R=0;R<F.length;R++)I+=F[R].length;switch(C){case"string":return F.join("");case"array":return Array.prototype.concat.apply([],F);case"uint8array":for(re=new Uint8Array(I),R=0;R<F.length;R++)re.set(F[R],G),G+=F[R].length;return re;case"nodebuffer":return Buffer.concat(F);default:throw new Error("concat : unsupported type '"+C+"'")}})(w,m),O);E(T)}catch(C){g(C)}m=[]}).resume()})}function d(y,f,E){var g=f;switch(f){case"blob":case"arraybuffer":g="uint8array";break;case"base64":g="string"}try{this._internalType=g,this._outputType=f,this._mimeType=E,o.checkSupport(g),this._worker=y.pipe(new s(g)),y.lock()}catch(m){this._worker=new a("error"),this._worker.error(m)}}d.prototype={accumulate:function(y){return b(this,y)},on:function(y,f){var E=this;return y==="data"?this._worker.on(y,function(g){f.call(E,g.data,g.meta)}):this._worker.on(y,function(){o.delay(f,arguments,E)}),this},resume:function(){return o.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(y){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"},y)}},r.exports=d},{"../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 s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(o),i.blob=s.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"),s=n("./support"),a=n("./nodejsUtils"),u=n("./stream/GenericWorker"),l=new Array(256),h=0;h<256;h++)l[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;l[254]=l[254]=1;function _(){u.call(this,"utf-8 decode"),this.leftOver=null}function b(){u.call(this,"utf-8 encode")}i.utf8encode=function(d){return s.nodebuffer?a.newBufferFrom(d,"utf-8"):(function(y){var f,E,g,m,w,x=y.length,O=0;for(m=0;m<x;m++)(64512&(E=y.charCodeAt(m)))==55296&&m+1<x&&(64512&(g=y.charCodeAt(m+1)))==56320&&(E=65536+(E-55296<<10)+(g-56320),m++),O+=E<128?1:E<2048?2:E<65536?3:4;for(f=s.uint8array?new Uint8Array(O):new Array(O),m=w=0;w<O;m++)(64512&(E=y.charCodeAt(m)))==55296&&m+1<x&&(64512&(g=y.charCodeAt(m+1)))==56320&&(E=65536+(E-55296<<10)+(g-56320),m++),E<128?f[w++]=E:(E<2048?f[w++]=192|E>>>6:(E<65536?f[w++]=224|E>>>12:(f[w++]=240|E>>>18,f[w++]=128|E>>>12&63),f[w++]=128|E>>>6&63),f[w++]=128|63&E);return f})(d)},i.utf8decode=function(d){return s.nodebuffer?o.transformTo("nodebuffer",d).toString("utf-8"):(function(y){var f,E,g,m,w=y.length,x=new Array(2*w);for(f=E=0;f<w;)if((g=y[f++])<128)x[E++]=g;else if(4<(m=l[g]))x[E++]=65533,f+=m-1;else{for(g&=m===2?31:m===3?15:7;1<m&&f<w;)g=g<<6|63&y[f++],m--;1<m?x[E++]=65533:g<65536?x[E++]=g:(g-=65536,x[E++]=55296|g>>10&1023,x[E++]=56320|1023&g)}return x.length!==E&&(x.subarray?x=x.subarray(0,E):x.length=E),o.applyFromCharCode(x)})(d=o.transformTo(s.uint8array?"uint8array":"array",d))},o.inherits(_,u),_.prototype.processChunk=function(d){var y=o.transformTo(s.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var f=y;(y=new Uint8Array(f.length+this.leftOver.length)).set(this.leftOver,0),y.set(f,this.leftOver.length)}else y=this.leftOver.concat(y);this.leftOver=null}var E=(function(m,w){var x;for((w=w||m.length)>m.length&&(w=m.length),x=w-1;0<=x&&(192&m[x])==128;)x--;return x<0||x===0?w:x+l[m[x]]>w?x:w})(y),g=y;E!==y.length&&(s.uint8array?(g=y.subarray(0,E),this.leftOver=y.subarray(E,y.length)):(g=y.slice(0,E),this.leftOver=y.slice(E,y.length))),this.push({data:i.utf8decode(g),meta:d.meta})},_.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=_,o.inherits(b,u),b.prototype.processChunk=function(d){this.push({data:i.utf8encode(d.data),meta:d.meta})},i.Utf8EncodeWorker=b},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,i){var o=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),u=n("./external");function l(f){return f}function h(f,E){for(var g=0;g<f.length;++g)E[g]=255&f.charCodeAt(g);return E}n("setimmediate"),i.newBlob=function(f,E){i.checkSupport("blob");try{return new Blob([f],{type:E})}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(f),g.getBlob(E)}catch{throw new Error("Bug : can't construct the Blob.")}}};var _={stringifyByChunk:function(f,E,g){var m=[],w=0,x=f.length;if(x<=g)return String.fromCharCode.apply(null,f);for(;w<x;)E==="array"||E==="nodebuffer"?m.push(String.fromCharCode.apply(null,f.slice(w,Math.min(w+g,x)))):m.push(String.fromCharCode.apply(null,f.subarray(w,Math.min(w+g,x)))),w+=g;return m.join("")},stringifyByChar:function(f){for(var E="",g=0;g<f.length;g++)E+=String.fromCharCode(f[g]);return E},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,a.allocBuffer(1)).length===1}catch{return!1}})()}};function b(f){var E=65536,g=i.getTypeOf(f),m=!0;if(g==="uint8array"?m=_.applyCanBeUsed.uint8array:g==="nodebuffer"&&(m=_.applyCanBeUsed.nodebuffer),m)for(;1<E;)try{return _.stringifyByChunk(f,g,E)}catch{E=Math.floor(E/2)}return _.stringifyByChar(f)}function d(f,E){for(var g=0;g<f.length;g++)E[g]=f[g];return E}i.applyFromCharCode=b;var y={};y.string={string:l,array:function(f){return h(f,new Array(f.length))},arraybuffer:function(f){return y.string.uint8array(f).buffer},uint8array:function(f){return h(f,new Uint8Array(f.length))},nodebuffer:function(f){return h(f,a.allocBuffer(f.length))}},y.array={string:b,array:l,arraybuffer:function(f){return new Uint8Array(f).buffer},uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return a.newBufferFrom(f)}},y.arraybuffer={string:function(f){return b(new Uint8Array(f))},array:function(f){return d(new Uint8Array(f),new Array(f.byteLength))},arraybuffer:l,uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return a.newBufferFrom(new Uint8Array(f))}},y.uint8array={string:b,array:function(f){return d(f,new Array(f.length))},arraybuffer:function(f){return f.buffer},uint8array:l,nodebuffer:function(f){return a.newBufferFrom(f)}},y.nodebuffer={string:b,array:function(f){return d(f,new Array(f.length))},arraybuffer:function(f){return y.nodebuffer.uint8array(f).buffer},uint8array:function(f){return d(f,new Uint8Array(f.length))},nodebuffer:l},i.transformTo=function(f,E){if(E=E||"",!f)return E;i.checkSupport(f);var g=i.getTypeOf(E);return y[g][f](E)},i.resolve=function(f){for(var E=f.split("/"),g=[],m=0;m<E.length;m++){var w=E[m];w==="."||w===""&&m!==0&&m!==E.length-1||(w===".."?g.pop():g.push(w))}return g.join("/")},i.getTypeOf=function(f){return typeof f=="string"?"string":Object.prototype.toString.call(f)==="[object Array]"?"array":o.nodebuffer&&a.isBuffer(f)?"nodebuffer":o.uint8array&&f instanceof Uint8Array?"uint8array":o.arraybuffer&&f instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(f){if(!o[f.toLowerCase()])throw new Error(f+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(f){var E,g,m="";for(g=0;g<(f||"").length;g++)m+="\\x"+((E=f.charCodeAt(g))<16?"0":"")+E.toString(16).toUpperCase();return m},i.delay=function(f,E,g){setImmediate(function(){f.apply(g||null,E||[])})},i.inherits=function(f,E){function g(){}g.prototype=E.prototype,f.prototype=new g},i.extend=function(){var f,E,g={};for(f=0;f<arguments.length;f++)for(E in arguments[f])Object.prototype.hasOwnProperty.call(arguments[f],E)&&g[E]===void 0&&(g[E]=arguments[f][E]);return g},i.prepareContent=function(f,E,g,m,w){return u.Promise.resolve(E).then(function(x){return o.blob&&(x instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(x))!==-1)&&typeof FileReader<"u"?new u.Promise(function(O,T){var C=new FileReader;C.onload=function(F){O(F.target.result)},C.onerror=function(F){T(F.target.error)},C.readAsArrayBuffer(x)}):x}).then(function(x){var O=i.getTypeOf(x);return O?(O==="arraybuffer"?x=i.transformTo("uint8array",x):O==="string"&&(w?x=s.decode(x):g&&m!==!0&&(x=(function(T){return h(T,o.uint8array?new Uint8Array(T.length):new Array(T.length))})(x))),x):u.Promise.reject(new Error("Can't read the data of '"+f+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,i){var o=n("./reader/readerFor"),s=n("./utils"),a=n("./signature"),u=n("./zipEntry"),l=n("./support");function h(_){this.files=[],this.loadOptions=_}h.prototype={checkSignature:function(_){if(!this.reader.readAndCheckSignature(_)){this.reader.index-=4;var b=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(b)+", expected "+s.pretty(_)+")")}},isSignature:function(_,b){var d=this.reader.index;this.reader.setIndex(_);var y=this.reader.readString(4)===b;return this.reader.setIndex(d),y},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),b=l.uint8array?"uint8array":"array",d=s.transformTo(b,_);this.zipComment=this.loadOptions.decodeFileName(d)},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 _,b,d,y=this.zip64EndOfCentralSize-44;0<y;)_=this.reader.readInt(2),b=this.reader.readInt(4),d=this.reader.readData(b),this.zip64ExtensibleData[_]={id:_,length:b,value:d}},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 _,b;for(_=0;_<this.files.length;_++)b=this.files[_],this.reader.setIndex(b.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),b.readLocalPart(this.reader),b.handleUTF8(),b.processAttributes()},readCentralDir:function(){var _;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.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(a.CENTRAL_DIRECTORY_END);if(_<0)throw this.isSignature(0,a.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 b=_;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(_=this.reader.lastIndexOfSignature(a.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(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.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(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var d=this.centralDirOffset+this.centralDirSize;this.zip64&&(d+=20,d+=12+this.zip64EndOfCentralSize);var y=b-d;if(0<y)this.isSignature(b,a.CENTRAL_FILE_HEADER)||(this.reader.zero=y);else if(y<0)throw new Error("Corrupted zip: missing "+Math.abs(y)+" bytes.")},prepareReader:function(_){this.reader=o(_)},load:function(_){this.prepareReader(_),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,i){var o=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),u=n("./crc32"),l=n("./utf8"),h=n("./compressions"),_=n("./support");function b(d,y){this.options=d,this.loadOptions=y}b.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(d){var y,f;if(d.skip(22),this.fileNameLength=d.readInt(2),f=d.readInt(2),this.fileName=d.readData(this.fileNameLength),d.skip(f),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((y=(function(E){for(var g in h)if(Object.prototype.hasOwnProperty.call(h,g)&&h[g].magic===E)return h[g];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,y,d.readData(this.compressedSize))},readCentralPart:function(d){this.versionMadeBy=d.readInt(2),d.skip(2),this.bitFlag=d.readInt(2),this.compressionMethod=d.readString(2),this.date=d.readDate(),this.crc32=d.readInt(4),this.compressedSize=d.readInt(4),this.uncompressedSize=d.readInt(4);var y=d.readInt(2);if(this.extraFieldsLength=d.readInt(2),this.fileCommentLength=d.readInt(2),this.diskNumberStart=d.readInt(2),this.internalFileAttributes=d.readInt(2),this.externalFileAttributes=d.readInt(4),this.localHeaderOffset=d.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");d.skip(y),this.readExtraFields(d),this.parseZIP64ExtraField(d),this.fileComment=d.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var d=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=o(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var y,f,E,g=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4<g;)y=d.readInt(2),f=d.readInt(2),E=d.readData(f),this.extraFields[y]={id:y,length:f,value:E};d.setIndex(g)},handleUTF8:function(){var d=_.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=l.utf8decode(this.fileName),this.fileCommentStr=l.utf8decode(this.fileComment);else{var y=this.findExtraFieldUnicodePath();if(y!==null)this.fileNameStr=y;else{var f=s.transformTo(d,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(f)}var E=this.findExtraFieldUnicodeComment();if(E!==null)this.fileCommentStr=E;else{var g=s.transformTo(d,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var d=this.extraFields[28789];if(d){var y=o(d.value);return y.readInt(1)!==1||u(this.fileName)!==y.readInt(4)?null:l.utf8decode(y.readData(d.length-5))}return null},findExtraFieldUnicodeComment:function(){var d=this.extraFields[25461];if(d){var y=o(d.value);return y.readInt(1)!==1||u(this.fileComment)!==y.readInt(4)?null:l.utf8decode(y.readData(d.length-5))}return null}},r.exports=b},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,i){function o(y,f,E){this.name=y,this.dir=E.dir,this.date=E.date,this.comment=E.comment,this.unixPermissions=E.unixPermissions,this.dosPermissions=E.dosPermissions,this._data=f,this._dataBinary=E.binary,this.options={compression:E.compression,compressionOptions:E.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),u=n("./utf8"),l=n("./compressedObject"),h=n("./stream/GenericWorker");o.prototype={internalStream:function(y){var f=null,E="string";try{if(!y)throw new Error("No output type specified.");var g=(E=y.toLowerCase())==="string"||E==="text";E!=="binarystring"&&E!=="text"||(E="string"),f=this._decompressWorker();var m=!this._dataBinary;m&&!g&&(f=f.pipe(new u.Utf8EncodeWorker)),!m&&g&&(f=f.pipe(new u.Utf8DecodeWorker))}catch(w){(f=new h("error")).error(w)}return new s(f,E,"")},async:function(y,f){return this.internalStream(y).accumulate(f)},nodeStream:function(y,f){return this.internalStream(y||"nodebuffer").toNodejsStream(f)},_compressWorker:function(y,f){if(this._data instanceof l&&this._data.compression.magic===y.magic)return this._data.getCompressedWorker();var E=this._decompressWorker();return this._dataBinary||(E=E.pipe(new u.Utf8EncodeWorker)),l.createWorkerFrom(E,y,f)},_decompressWorker:function(){return this._data instanceof l?this._data.getContentWorker():this._data instanceof h?this._data:new a(this._data)}};for(var _=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],b=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<_.length;d++)o.prototype[_[d]]=b;r.exports=o},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,i){(function(o){var s,a,u=o.MutationObserver||o.WebKitMutationObserver;if(u){var l=0,h=new u(y),_=o.document.createTextNode("");h.observe(_,{characterData:!0}),s=function(){_.data=l=++l%2}}else if(o.setImmediate||o.MessageChannel===void 0)s="document"in o&&"onreadystatechange"in o.document.createElement("script")?function(){var f=o.document.createElement("script");f.onreadystatechange=function(){y(),f.onreadystatechange=null,f.parentNode.removeChild(f),f=null},o.document.documentElement.appendChild(f)}:function(){setTimeout(y,0)};else{var b=new o.MessageChannel;b.port1.onmessage=y,s=function(){b.port2.postMessage(0)}}var d=[];function y(){var f,E;a=!0;for(var g=d.length;g;){for(E=d,d=[],f=-1;++f<g;)E[f]();g=d.length}a=!1}r.exports=function(f){d.push(f)!==1||a||s()}}).call(this,typeof xt<"u"?xt:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,i){var o=n("immediate");function s(){}var a={},u=["REJECTED"],l=["FULFILLED"],h=["PENDING"];function _(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,g!==s&&f(this,g)}function b(g,m,w){this.promise=g,typeof m=="function"&&(this.onFulfilled=m,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function d(g,m,w){o(function(){var x;try{x=m(w)}catch(O){return a.reject(g,O)}x===g?a.reject(g,new TypeError("Cannot resolve promise with itself")):a.resolve(g,x)})}function y(g){var m=g&&g.then;if(g&&(typeof g=="object"||typeof g=="function")&&typeof m=="function")return function(){m.apply(g,arguments)}}function f(g,m){var w=!1;function x(C){w||(w=!0,a.reject(g,C))}function O(C){w||(w=!0,a.resolve(g,C))}var T=E(function(){m(O,x)});T.status==="error"&&x(T.value)}function E(g,m){var w={};try{w.value=g(m),w.status="success"}catch(x){w.status="error",w.value=x}return w}(r.exports=_).prototype.finally=function(g){if(typeof g!="function")return this;var m=this.constructor;return this.then(function(w){return m.resolve(g()).then(function(){return w})},function(w){return m.resolve(g()).then(function(){throw w})})},_.prototype.catch=function(g){return this.then(null,g)},_.prototype.then=function(g,m){if(typeof g!="function"&&this.state===l||typeof m!="function"&&this.state===u)return this;var w=new this.constructor(s);return this.state!==h?d(w,this.state===l?g:m,this.outcome):this.queue.push(new b(w,g,m)),w},b.prototype.callFulfilled=function(g){a.resolve(this.promise,g)},b.prototype.otherCallFulfilled=function(g){d(this.promise,this.onFulfilled,g)},b.prototype.callRejected=function(g){a.reject(this.promise,g)},b.prototype.otherCallRejected=function(g){d(this.promise,this.onRejected,g)},a.resolve=function(g,m){var w=E(y,m);if(w.status==="error")return a.reject(g,w.value);var x=w.value;if(x)f(g,x);else{g.state=l,g.outcome=m;for(var O=-1,T=g.queue.length;++O<T;)g.queue[O].callFulfilled(m)}return g},a.reject=function(g,m){g.state=u,g.outcome=m;for(var w=-1,x=g.queue.length;++w<x;)g.queue[w].callRejected(m);return g},_.resolve=function(g){return g instanceof this?g:a.resolve(new this(s),g)},_.reject=function(g){var m=new this(s);return a.reject(m,g)},_.all=function(g){var m=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=g.length,x=!1;if(!w)return this.resolve([]);for(var O=new Array(w),T=0,C=-1,F=new this(s);++C<w;)R(g[C],C);return F;function R(G,re){m.resolve(G).then(function(I){O[re]=I,++T!==w||x||(x=!0,a.resolve(F,O))},function(I){x||(x=!0,a.reject(F,I))})}},_.race=function(g){var m=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=g.length,x=!1;if(!w)return this.resolve([]);for(var O=-1,T=new this(s);++O<w;)C=g[O],m.resolve(C).then(function(F){x||(x=!0,a.resolve(T,F))},function(F){x||(x=!0,a.reject(T,F))});var C;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"),s=n("./utils/common"),a=n("./utils/strings"),u=n("./zlib/messages"),l=n("./zlib/zstream"),h=Object.prototype.toString,_=0,b=-1,d=0,y=8;function f(g){if(!(this instanceof f))return new f(g);this.options=s.assign({level:b,method:y,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},g||{});var m=this.options;m.raw&&0<m.windowBits?m.windowBits=-m.windowBits:m.gzip&&0<m.windowBits&&m.windowBits<16&&(m.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var w=o.deflateInit2(this.strm,m.level,m.method,m.windowBits,m.memLevel,m.strategy);if(w!==_)throw new Error(u[w]);if(m.header&&o.deflateSetHeader(this.strm,m.header),m.dictionary){var x;if(x=typeof m.dictionary=="string"?a.string2buf(m.dictionary):h.call(m.dictionary)==="[object ArrayBuffer]"?new Uint8Array(m.dictionary):m.dictionary,(w=o.deflateSetDictionary(this.strm,x))!==_)throw new Error(u[w]);this._dict_set=!0}}function E(g,m){var w=new f(m);if(w.push(g,!0),w.err)throw w.msg||u[w.err];return w.result}f.prototype.push=function(g,m){var w,x,O=this.strm,T=this.options.chunkSize;if(this.ended)return!1;x=m===~~m?m:m===!0?4:0,typeof g=="string"?O.input=a.string2buf(g):h.call(g)==="[object ArrayBuffer]"?O.input=new Uint8Array(g):O.input=g,O.next_in=0,O.avail_in=O.input.length;do{if(O.avail_out===0&&(O.output=new s.Buf8(T),O.next_out=0,O.avail_out=T),(w=o.deflate(O,x))!==1&&w!==_)return this.onEnd(w),!(this.ended=!0);O.avail_out!==0&&(O.avail_in!==0||x!==4&&x!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(O.output,O.next_out))):this.onData(s.shrinkBuf(O.output,O.next_out)))}while((0<O.avail_in||O.avail_out===0)&&w!==1);return x===4?(w=o.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===_):x!==2||(this.onEnd(_),!(O.avail_out=0))},f.prototype.onData=function(g){this.chunks.push(g)},f.prototype.onEnd=function(g){g===_&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},i.Deflate=f,i.deflate=E,i.deflateRaw=function(g,m){return(m=m||{}).raw=!0,E(g,m)},i.gzip=function(g,m){return(m=m||{}).gzip=!0,E(g,m)}},{"./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"),s=n("./utils/common"),a=n("./utils/strings"),u=n("./zlib/constants"),l=n("./zlib/messages"),h=n("./zlib/zstream"),_=n("./zlib/gzheader"),b=Object.prototype.toString;function d(f){if(!(this instanceof d))return new d(f);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},f||{});var E=this.options;E.raw&&0<=E.windowBits&&E.windowBits<16&&(E.windowBits=-E.windowBits,E.windowBits===0&&(E.windowBits=-15)),!(0<=E.windowBits&&E.windowBits<16)||f&&f.windowBits||(E.windowBits+=32),15<E.windowBits&&E.windowBits<48&&(15&E.windowBits)==0&&(E.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var g=o.inflateInit2(this.strm,E.windowBits);if(g!==u.Z_OK)throw new Error(l[g]);this.header=new _,o.inflateGetHeader(this.strm,this.header)}function y(f,E){var g=new d(E);if(g.push(f,!0),g.err)throw g.msg||l[g.err];return g.result}d.prototype.push=function(f,E){var g,m,w,x,O,T,C=this.strm,F=this.options.chunkSize,R=this.options.dictionary,G=!1;if(this.ended)return!1;m=E===~~E?E:E===!0?u.Z_FINISH:u.Z_NO_FLUSH,typeof f=="string"?C.input=a.binstring2buf(f):b.call(f)==="[object ArrayBuffer]"?C.input=new Uint8Array(f):C.input=f,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new s.Buf8(F),C.next_out=0,C.avail_out=F),(g=o.inflate(C,u.Z_NO_FLUSH))===u.Z_NEED_DICT&&R&&(T=typeof R=="string"?a.string2buf(R):b.call(R)==="[object ArrayBuffer]"?new Uint8Array(R):R,g=o.inflateSetDictionary(this.strm,T)),g===u.Z_BUF_ERROR&&G===!0&&(g=u.Z_OK,G=!1),g!==u.Z_STREAM_END&&g!==u.Z_OK)return this.onEnd(g),!(this.ended=!0);C.next_out&&(C.avail_out!==0&&g!==u.Z_STREAM_END&&(C.avail_in!==0||m!==u.Z_FINISH&&m!==u.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=a.utf8border(C.output,C.next_out),x=C.next_out-w,O=a.buf2string(C.output,w),C.next_out=x,C.avail_out=F-x,x&&s.arraySet(C.output,C.output,w,x,0),this.onData(O)):this.onData(s.shrinkBuf(C.output,C.next_out)))),C.avail_in===0&&C.avail_out===0&&(G=!0)}while((0<C.avail_in||C.avail_out===0)&&g!==u.Z_STREAM_END);return g===u.Z_STREAM_END&&(m=u.Z_FINISH),m===u.Z_FINISH?(g=o.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===u.Z_OK):m!==u.Z_SYNC_FLUSH||(this.onEnd(u.Z_OK),!(C.avail_out=0))},d.prototype.onData=function(f){this.chunks.push(f)},d.prototype.onEnd=function(f){f===u.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg},i.Inflate=d,i.inflate=y,i.inflateRaw=function(f,E){return(E=E||{}).raw=!0,y(f,E)},i.ungzip=y},{"./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 l=Array.prototype.slice.call(arguments,1);l.length;){var h=l.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var _ in h)h.hasOwnProperty(_)&&(u[_]=h[_])}}return u},i.shrinkBuf=function(u,l){return u.length===l?u:u.subarray?u.subarray(0,l):(u.length=l,u)};var s={arraySet:function(u,l,h,_,b){if(l.subarray&&u.subarray)u.set(l.subarray(h,h+_),b);else for(var d=0;d<_;d++)u[b+d]=l[h+d]},flattenChunks:function(u){var l,h,_,b,d,y;for(l=_=0,h=u.length;l<h;l++)_+=u[l].length;for(y=new Uint8Array(_),l=b=0,h=u.length;l<h;l++)d=u[l],y.set(d,b),b+=d.length;return y}},a={arraySet:function(u,l,h,_,b){for(var d=0;d<_;d++)u[b+d]=l[h+d]},flattenChunks:function(u){return[].concat.apply([],u)}};i.setTyped=function(u){u?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,s)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,a))},i.setTyped(o)},{}],42:[function(n,r,i){var o=n("./common"),s=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var u=new o.Buf8(256),l=0;l<256;l++)u[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function h(_,b){if(b<65537&&(_.subarray&&a||!_.subarray&&s))return String.fromCharCode.apply(null,o.shrinkBuf(_,b));for(var d="",y=0;y<b;y++)d+=String.fromCharCode(_[y]);return d}u[254]=u[254]=1,i.string2buf=function(_){var b,d,y,f,E,g=_.length,m=0;for(f=0;f<g;f++)(64512&(d=_.charCodeAt(f)))==55296&&f+1<g&&(64512&(y=_.charCodeAt(f+1)))==56320&&(d=65536+(d-55296<<10)+(y-56320),f++),m+=d<128?1:d<2048?2:d<65536?3:4;for(b=new o.Buf8(m),f=E=0;E<m;f++)(64512&(d=_.charCodeAt(f)))==55296&&f+1<g&&(64512&(y=_.charCodeAt(f+1)))==56320&&(d=65536+(d-55296<<10)+(y-56320),f++),d<128?b[E++]=d:(d<2048?b[E++]=192|d>>>6:(d<65536?b[E++]=224|d>>>12:(b[E++]=240|d>>>18,b[E++]=128|d>>>12&63),b[E++]=128|d>>>6&63),b[E++]=128|63&d);return b},i.buf2binstring=function(_){return h(_,_.length)},i.binstring2buf=function(_){for(var b=new o.Buf8(_.length),d=0,y=b.length;d<y;d++)b[d]=_.charCodeAt(d);return b},i.buf2string=function(_,b){var d,y,f,E,g=b||_.length,m=new Array(2*g);for(d=y=0;d<g;)if((f=_[d++])<128)m[y++]=f;else if(4<(E=u[f]))m[y++]=65533,d+=E-1;else{for(f&=E===2?31:E===3?15:7;1<E&&d<g;)f=f<<6|63&_[d++],E--;1<E?m[y++]=65533:f<65536?m[y++]=f:(f-=65536,m[y++]=55296|f>>10&1023,m[y++]=56320|1023&f)}return h(m,y)},i.utf8border=function(_,b){var d;for((b=b||_.length)>_.length&&(b=_.length),d=b-1;0<=d&&(192&_[d])==128;)d--;return d<0||d===0?b:d+u[_[d]]>b?d:b}},{"./common":41}],43:[function(n,r,i){r.exports=function(o,s,a,u){for(var l=65535&o|0,h=o>>>16&65535|0,_=0;a!==0;){for(a-=_=2e3<a?2e3:a;h=h+(l=l+s[u++]|0)|0,--_;);l%=65521,h%=65521}return l|h<<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 s,a=[],u=0;u<256;u++){s=u;for(var l=0;l<8;l++)s=1&s?3988292384^s>>>1:s>>>1;a[u]=s}return a})();r.exports=function(s,a,u,l){var h=o,_=l+u;s^=-1;for(var b=l;b<_;b++)s=s>>>8^h[255&(s^a[b])];return-1^s}},{}],46:[function(n,r,i){var o,s=n("../utils/common"),a=n("./trees"),u=n("./adler32"),l=n("./crc32"),h=n("./messages"),_=0,b=4,d=0,y=-2,f=-1,E=4,g=2,m=8,w=9,x=286,O=30,T=19,C=2*x+1,F=15,R=3,G=258,re=G+R+1,I=42,L=113,p=1,Z=2,N=3,P=4;function q(c,B){return c.msg=h[B],B}function j(c){return(c<<1)-(4<c?9:0)}function Y(c){for(var B=c.length;0<=--B;)c[B]=0}function k(c){var B=c.state,M=B.pending;M>c.avail_out&&(M=c.avail_out),M!==0&&(s.arraySet(c.output,B.pending_buf,B.pending_out,M,c.next_out),c.next_out+=M,B.pending_out+=M,c.total_out+=M,c.avail_out-=M,B.pending-=M,B.pending===0&&(B.pending_out=0))}function A(c,B){a._tr_flush_block(c,0<=c.block_start?c.block_start:-1,c.strstart-c.block_start,B),c.block_start=c.strstart,k(c.strm)}function Q(c,B){c.pending_buf[c.pending++]=B}function K(c,B){c.pending_buf[c.pending++]=B>>>8&255,c.pending_buf[c.pending++]=255&B}function W(c,B){var M,S,v=c.max_chain_length,z=c.strstart,H=c.prev_length,V=c.nice_match,D=c.strstart>c.w_size-re?c.strstart-(c.w_size-re):0,X=c.window,ee=c.w_mask,J=c.prev,ie=c.strstart+G,me=X[z+H-1],pe=X[z+H];c.prev_length>=c.good_match&&(v>>=2),V>c.lookahead&&(V=c.lookahead);do if(X[(M=B)+H]===pe&&X[M+H-1]===me&&X[M]===X[z]&&X[++M]===X[z+1]){z+=2,M++;do;while(X[++z]===X[++M]&&X[++z]===X[++M]&&X[++z]===X[++M]&&X[++z]===X[++M]&&X[++z]===X[++M]&&X[++z]===X[++M]&&X[++z]===X[++M]&&X[++z]===X[++M]&&z<ie);if(S=G-(ie-z),z=ie-G,H<S){if(c.match_start=B,V<=(H=S))break;me=X[z+H-1],pe=X[z+H]}}while((B=J[B&ee])>D&&--v!=0);return H<=c.lookahead?H:c.lookahead}function ce(c){var B,M,S,v,z,H,V,D,X,ee,J=c.w_size;do{if(v=c.window_size-c.lookahead-c.strstart,c.strstart>=J+(J-re)){for(s.arraySet(c.window,c.window,J,J,0),c.match_start-=J,c.strstart-=J,c.block_start-=J,B=M=c.hash_size;S=c.head[--B],c.head[B]=J<=S?S-J:0,--M;);for(B=M=J;S=c.prev[--B],c.prev[B]=J<=S?S-J:0,--M;);v+=J}if(c.strm.avail_in===0)break;if(H=c.strm,V=c.window,D=c.strstart+c.lookahead,X=v,ee=void 0,ee=H.avail_in,X<ee&&(ee=X),M=ee===0?0:(H.avail_in-=ee,s.arraySet(V,H.input,H.next_in,ee,D),H.state.wrap===1?H.adler=u(H.adler,V,ee,D):H.state.wrap===2&&(H.adler=l(H.adler,V,ee,D)),H.next_in+=ee,H.total_in+=ee,ee),c.lookahead+=M,c.lookahead+c.insert>=R)for(z=c.strstart-c.insert,c.ins_h=c.window[z],c.ins_h=(c.ins_h<<c.hash_shift^c.window[z+1])&c.hash_mask;c.insert&&(c.ins_h=(c.ins_h<<c.hash_shift^c.window[z+R-1])&c.hash_mask,c.prev[z&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=z,z++,c.insert--,!(c.lookahead+c.insert<R)););}while(c.lookahead<re&&c.strm.avail_in!==0)}function se(c,B){for(var M,S;;){if(c.lookahead<re){if(ce(c),c.lookahead<re&&B===_)return p;if(c.lookahead===0)break}if(M=0,c.lookahead>=R&&(c.ins_h=(c.ins_h<<c.hash_shift^c.window[c.strstart+R-1])&c.hash_mask,M=c.prev[c.strstart&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=c.strstart),M!==0&&c.strstart-M<=c.w_size-re&&(c.match_length=W(c,M)),c.match_length>=R)if(S=a._tr_tally(c,c.strstart-c.match_start,c.match_length-R),c.lookahead-=c.match_length,c.match_length<=c.max_lazy_match&&c.lookahead>=R){for(c.match_length--;c.strstart++,c.ins_h=(c.ins_h<<c.hash_shift^c.window[c.strstart+R-1])&c.hash_mask,M=c.prev[c.strstart&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=c.strstart,--c.match_length!=0;);c.strstart++}else c.strstart+=c.match_length,c.match_length=0,c.ins_h=c.window[c.strstart],c.ins_h=(c.ins_h<<c.hash_shift^c.window[c.strstart+1])&c.hash_mask;else S=a._tr_tally(c,0,c.window[c.strstart]),c.lookahead--,c.strstart++;if(S&&(A(c,!1),c.strm.avail_out===0))return p}return c.insert=c.strstart<R-1?c.strstart:R-1,B===b?(A(c,!0),c.strm.avail_out===0?N:P):c.last_lit&&(A(c,!1),c.strm.avail_out===0)?p:Z}function oe(c,B){for(var M,S,v;;){if(c.lookahead<re){if(ce(c),c.lookahead<re&&B===_)return p;if(c.lookahead===0)break}if(M=0,c.lookahead>=R&&(c.ins_h=(c.ins_h<<c.hash_shift^c.window[c.strstart+R-1])&c.hash_mask,M=c.prev[c.strstart&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=c.strstart),c.prev_length=c.match_length,c.prev_match=c.match_start,c.match_length=R-1,M!==0&&c.prev_length<c.max_lazy_match&&c.strstart-M<=c.w_size-re&&(c.match_length=W(c,M),c.match_length<=5&&(c.strategy===1||c.match_length===R&&4096<c.strstart-c.match_start)&&(c.match_length=R-1)),c.prev_length>=R&&c.match_length<=c.prev_length){for(v=c.strstart+c.lookahead-R,S=a._tr_tally(c,c.strstart-1-c.prev_match,c.prev_length-R),c.lookahead-=c.prev_length-1,c.prev_length-=2;++c.strstart<=v&&(c.ins_h=(c.ins_h<<c.hash_shift^c.window[c.strstart+R-1])&c.hash_mask,M=c.prev[c.strstart&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=c.strstart),--c.prev_length!=0;);if(c.match_available=0,c.match_length=R-1,c.strstart++,S&&(A(c,!1),c.strm.avail_out===0))return p}else if(c.match_available){if((S=a._tr_tally(c,0,c.window[c.strstart-1]))&&A(c,!1),c.strstart++,c.lookahead--,c.strm.avail_out===0)return p}else c.match_available=1,c.strstart++,c.lookahead--}return c.match_available&&(S=a._tr_tally(c,0,c.window[c.strstart-1]),c.match_available=0),c.insert=c.strstart<R-1?c.strstart:R-1,B===b?(A(c,!0),c.strm.avail_out===0?N:P):c.last_lit&&(A(c,!1),c.strm.avail_out===0)?p:Z}function ue(c,B,M,S,v){this.good_length=c,this.max_lazy=B,this.nice_length=M,this.max_chain=S,this.func=v}function de(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=m,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*C),this.dyn_dtree=new s.Buf16(2*(2*O+1)),this.bl_tree=new s.Buf16(2*(2*T+1)),Y(this.dyn_ltree),Y(this.dyn_dtree),Y(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(F+1),this.heap=new s.Buf16(2*x+1),Y(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*x+1),Y(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 fe(c){var B;return c&&c.state?(c.total_in=c.total_out=0,c.data_type=g,(B=c.state).pending=0,B.pending_out=0,B.wrap<0&&(B.wrap=-B.wrap),B.status=B.wrap?I:L,c.adler=B.wrap===2?0:1,B.last_flush=_,a._tr_init(B),d):q(c,y)}function we(c){var B=fe(c);return B===d&&(function(M){M.window_size=2*M.w_size,Y(M.head),M.max_lazy_match=o[M.level].max_lazy,M.good_match=o[M.level].good_length,M.nice_match=o[M.level].nice_length,M.max_chain_length=o[M.level].max_chain,M.strstart=0,M.block_start=0,M.lookahead=0,M.insert=0,M.match_length=M.prev_length=R-1,M.match_available=0,M.ins_h=0})(c.state),B}function Se(c,B,M,S,v,z){if(!c)return y;var H=1;if(B===f&&(B=6),S<0?(H=0,S=-S):15<S&&(H=2,S-=16),v<1||w<v||M!==m||S<8||15<S||B<0||9<B||z<0||E<z)return q(c,y);S===8&&(S=9);var V=new de;return(c.state=V).strm=c,V.wrap=H,V.gzhead=null,V.w_bits=S,V.w_size=1<<V.w_bits,V.w_mask=V.w_size-1,V.hash_bits=v+7,V.hash_size=1<<V.hash_bits,V.hash_mask=V.hash_size-1,V.hash_shift=~~((V.hash_bits+R-1)/R),V.window=new s.Buf8(2*V.w_size),V.head=new s.Buf16(V.hash_size),V.prev=new s.Buf16(V.w_size),V.lit_bufsize=1<<v+6,V.pending_buf_size=4*V.lit_bufsize,V.pending_buf=new s.Buf8(V.pending_buf_size),V.d_buf=1*V.lit_bufsize,V.l_buf=3*V.lit_bufsize,V.level=B,V.strategy=z,V.method=M,we(c)}o=[new ue(0,0,0,0,function(c,B){var M=65535;for(M>c.pending_buf_size-5&&(M=c.pending_buf_size-5);;){if(c.lookahead<=1){if(ce(c),c.lookahead===0&&B===_)return p;if(c.lookahead===0)break}c.strstart+=c.lookahead,c.lookahead=0;var S=c.block_start+M;if((c.strstart===0||c.strstart>=S)&&(c.lookahead=c.strstart-S,c.strstart=S,A(c,!1),c.strm.avail_out===0)||c.strstart-c.block_start>=c.w_size-re&&(A(c,!1),c.strm.avail_out===0))return p}return c.insert=0,B===b?(A(c,!0),c.strm.avail_out===0?N:P):(c.strstart>c.block_start&&(A(c,!1),c.strm.avail_out),p)}),new ue(4,4,8,4,se),new ue(4,5,16,8,se),new ue(4,6,32,32,se),new ue(4,4,16,16,oe),new ue(8,16,32,32,oe),new ue(8,16,128,128,oe),new ue(8,32,128,256,oe),new ue(32,128,258,1024,oe),new ue(32,258,258,4096,oe)],i.deflateInit=function(c,B){return Se(c,B,m,15,8,0)},i.deflateInit2=Se,i.deflateReset=we,i.deflateResetKeep=fe,i.deflateSetHeader=function(c,B){return c&&c.state?c.state.wrap!==2?y:(c.state.gzhead=B,d):y},i.deflate=function(c,B){var M,S,v,z;if(!c||!c.state||5<B||B<0)return c?q(c,y):y;if(S=c.state,!c.output||!c.input&&c.avail_in!==0||S.status===666&&B!==b)return q(c,c.avail_out===0?-5:y);if(S.strm=c,M=S.last_flush,S.last_flush=B,S.status===I)if(S.wrap===2)c.adler=0,Q(S,31),Q(S,139),Q(S,8),S.gzhead?(Q(S,(S.gzhead.text?1:0)+(S.gzhead.hcrc?2:0)+(S.gzhead.extra?4:0)+(S.gzhead.name?8:0)+(S.gzhead.comment?16:0)),Q(S,255&S.gzhead.time),Q(S,S.gzhead.time>>8&255),Q(S,S.gzhead.time>>16&255),Q(S,S.gzhead.time>>24&255),Q(S,S.level===9?2:2<=S.strategy||S.level<2?4:0),Q(S,255&S.gzhead.os),S.gzhead.extra&&S.gzhead.extra.length&&(Q(S,255&S.gzhead.extra.length),Q(S,S.gzhead.extra.length>>8&255)),S.gzhead.hcrc&&(c.adler=l(c.adler,S.pending_buf,S.pending,0)),S.gzindex=0,S.status=69):(Q(S,0),Q(S,0),Q(S,0),Q(S,0),Q(S,0),Q(S,S.level===9?2:2<=S.strategy||S.level<2?4:0),Q(S,3),S.status=L);else{var H=m+(S.w_bits-8<<4)<<8;H|=(2<=S.strategy||S.level<2?0:S.level<6?1:S.level===6?2:3)<<6,S.strstart!==0&&(H|=32),H+=31-H%31,S.status=L,K(S,H),S.strstart!==0&&(K(S,c.adler>>>16),K(S,65535&c.adler)),c.adler=1}if(S.status===69)if(S.gzhead.extra){for(v=S.pending;S.gzindex<(65535&S.gzhead.extra.length)&&(S.pending!==S.pending_buf_size||(S.gzhead.hcrc&&S.pending>v&&(c.adler=l(c.adler,S.pending_buf,S.pending-v,v)),k(c),v=S.pending,S.pending!==S.pending_buf_size));)Q(S,255&S.gzhead.extra[S.gzindex]),S.gzindex++;S.gzhead.hcrc&&S.pending>v&&(c.adler=l(c.adler,S.pending_buf,S.pending-v,v)),S.gzindex===S.gzhead.extra.length&&(S.gzindex=0,S.status=73)}else S.status=73;if(S.status===73)if(S.gzhead.name){v=S.pending;do{if(S.pending===S.pending_buf_size&&(S.gzhead.hcrc&&S.pending>v&&(c.adler=l(c.adler,S.pending_buf,S.pending-v,v)),k(c),v=S.pending,S.pending===S.pending_buf_size)){z=1;break}z=S.gzindex<S.gzhead.name.length?255&S.gzhead.name.charCodeAt(S.gzindex++):0,Q(S,z)}while(z!==0);S.gzhead.hcrc&&S.pending>v&&(c.adler=l(c.adler,S.pending_buf,S.pending-v,v)),z===0&&(S.gzindex=0,S.status=91)}else S.status=91;if(S.status===91)if(S.gzhead.comment){v=S.pending;do{if(S.pending===S.pending_buf_size&&(S.gzhead.hcrc&&S.pending>v&&(c.adler=l(c.adler,S.pending_buf,S.pending-v,v)),k(c),v=S.pending,S.pending===S.pending_buf_size)){z=1;break}z=S.gzindex<S.gzhead.comment.length?255&S.gzhead.comment.charCodeAt(S.gzindex++):0,Q(S,z)}while(z!==0);S.gzhead.hcrc&&S.pending>v&&(c.adler=l(c.adler,S.pending_buf,S.pending-v,v)),z===0&&(S.status=103)}else S.status=103;if(S.status===103&&(S.gzhead.hcrc?(S.pending+2>S.pending_buf_size&&k(c),S.pending+2<=S.pending_buf_size&&(Q(S,255&c.adler),Q(S,c.adler>>8&255),c.adler=0,S.status=L)):S.status=L),S.pending!==0){if(k(c),c.avail_out===0)return S.last_flush=-1,d}else if(c.avail_in===0&&j(B)<=j(M)&&B!==b)return q(c,-5);if(S.status===666&&c.avail_in!==0)return q(c,-5);if(c.avail_in!==0||S.lookahead!==0||B!==_&&S.status!==666){var V=S.strategy===2?(function(D,X){for(var ee;;){if(D.lookahead===0&&(ce(D),D.lookahead===0)){if(X===_)return p;break}if(D.match_length=0,ee=a._tr_tally(D,0,D.window[D.strstart]),D.lookahead--,D.strstart++,ee&&(A(D,!1),D.strm.avail_out===0))return p}return D.insert=0,X===b?(A(D,!0),D.strm.avail_out===0?N:P):D.last_lit&&(A(D,!1),D.strm.avail_out===0)?p:Z})(S,B):S.strategy===3?(function(D,X){for(var ee,J,ie,me,pe=D.window;;){if(D.lookahead<=G){if(ce(D),D.lookahead<=G&&X===_)return p;if(D.lookahead===0)break}if(D.match_length=0,D.lookahead>=R&&0<D.strstart&&(J=pe[ie=D.strstart-1])===pe[++ie]&&J===pe[++ie]&&J===pe[++ie]){me=D.strstart+G;do;while(J===pe[++ie]&&J===pe[++ie]&&J===pe[++ie]&&J===pe[++ie]&&J===pe[++ie]&&J===pe[++ie]&&J===pe[++ie]&&J===pe[++ie]&&ie<me);D.match_length=G-(me-ie),D.match_length>D.lookahead&&(D.match_length=D.lookahead)}if(D.match_length>=R?(ee=a._tr_tally(D,1,D.match_length-R),D.lookahead-=D.match_length,D.strstart+=D.match_length,D.match_length=0):(ee=a._tr_tally(D,0,D.window[D.strstart]),D.lookahead--,D.strstart++),ee&&(A(D,!1),D.strm.avail_out===0))return p}return D.insert=0,X===b?(A(D,!0),D.strm.avail_out===0?N:P):D.last_lit&&(A(D,!1),D.strm.avail_out===0)?p:Z})(S,B):o[S.level].func(S,B);if(V!==N&&V!==P||(S.status=666),V===p||V===N)return c.avail_out===0&&(S.last_flush=-1),d;if(V===Z&&(B===1?a._tr_align(S):B!==5&&(a._tr_stored_block(S,0,0,!1),B===3&&(Y(S.head),S.lookahead===0&&(S.strstart=0,S.block_start=0,S.insert=0))),k(c),c.avail_out===0))return S.last_flush=-1,d}return B!==b?d:S.wrap<=0?1:(S.wrap===2?(Q(S,255&c.adler),Q(S,c.adler>>8&255),Q(S,c.adler>>16&255),Q(S,c.adler>>24&255),Q(S,255&c.total_in),Q(S,c.total_in>>8&255),Q(S,c.total_in>>16&255),Q(S,c.total_in>>24&255)):(K(S,c.adler>>>16),K(S,65535&c.adler)),k(c),0<S.wrap&&(S.wrap=-S.wrap),S.pending!==0?d:1)},i.deflateEnd=function(c){var B;return c&&c.state?(B=c.state.status)!==I&&B!==69&&B!==73&&B!==91&&B!==103&&B!==L&&B!==666?q(c,y):(c.state=null,B===L?q(c,-3):d):y},i.deflateSetDictionary=function(c,B){var M,S,v,z,H,V,D,X,ee=B.length;if(!c||!c.state||(z=(M=c.state).wrap)===2||z===1&&M.status!==I||M.lookahead)return y;for(z===1&&(c.adler=u(c.adler,B,ee,0)),M.wrap=0,ee>=M.w_size&&(z===0&&(Y(M.head),M.strstart=0,M.block_start=0,M.insert=0),X=new s.Buf8(M.w_size),s.arraySet(X,B,ee-M.w_size,M.w_size,0),B=X,ee=M.w_size),H=c.avail_in,V=c.next_in,D=c.input,c.avail_in=ee,c.next_in=0,c.input=B,ce(M);M.lookahead>=R;){for(S=M.strstart,v=M.lookahead-(R-1);M.ins_h=(M.ins_h<<M.hash_shift^M.window[S+R-1])&M.hash_mask,M.prev[S&M.w_mask]=M.head[M.ins_h],M.head[M.ins_h]=S,S++,--v;);M.strstart=S,M.lookahead=R-1,ce(M)}return M.strstart+=M.lookahead,M.block_start=M.strstart,M.insert=M.lookahead,M.lookahead=0,M.match_length=M.prev_length=R-1,M.match_available=0,c.next_in=V,c.input=D,c.avail_in=H,M.wrap=z,d},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,s){var a,u,l,h,_,b,d,y,f,E,g,m,w,x,O,T,C,F,R,G,re,I,L,p,Z;a=o.state,u=o.next_in,p=o.input,l=u+(o.avail_in-5),h=o.next_out,Z=o.output,_=h-(s-o.avail_out),b=h+(o.avail_out-257),d=a.dmax,y=a.wsize,f=a.whave,E=a.wnext,g=a.window,m=a.hold,w=a.bits,x=a.lencode,O=a.distcode,T=(1<<a.lenbits)-1,C=(1<<a.distbits)-1;e:do{w<15&&(m+=p[u++]<<w,w+=8,m+=p[u++]<<w,w+=8),F=x[m&T];t:for(;;){if(m>>>=R=F>>>24,w-=R,(R=F>>>16&255)===0)Z[h++]=65535&F;else{if(!(16&R)){if((64&R)==0){F=x[(65535&F)+(m&(1<<R)-1)];continue t}if(32&R){a.mode=12;break e}o.msg="invalid literal/length code",a.mode=30;break e}G=65535&F,(R&=15)&&(w<R&&(m+=p[u++]<<w,w+=8),G+=m&(1<<R)-1,m>>>=R,w-=R),w<15&&(m+=p[u++]<<w,w+=8,m+=p[u++]<<w,w+=8),F=O[m&C];n:for(;;){if(m>>>=R=F>>>24,w-=R,!(16&(R=F>>>16&255))){if((64&R)==0){F=O[(65535&F)+(m&(1<<R)-1)];continue n}o.msg="invalid distance code",a.mode=30;break e}if(re=65535&F,w<(R&=15)&&(m+=p[u++]<<w,(w+=8)<R&&(m+=p[u++]<<w,w+=8)),d<(re+=m&(1<<R)-1)){o.msg="invalid distance too far back",a.mode=30;break e}if(m>>>=R,w-=R,(R=h-_)<re){if(f<(R=re-R)&&a.sane){o.msg="invalid distance too far back",a.mode=30;break e}if(L=g,(I=0)===E){if(I+=y-R,R<G){for(G-=R;Z[h++]=g[I++],--R;);I=h-re,L=Z}}else if(E<R){if(I+=y+E-R,(R-=E)<G){for(G-=R;Z[h++]=g[I++],--R;);if(I=0,E<G){for(G-=R=E;Z[h++]=g[I++],--R;);I=h-re,L=Z}}}else if(I+=E-R,R<G){for(G-=R;Z[h++]=g[I++],--R;);I=h-re,L=Z}for(;2<G;)Z[h++]=L[I++],Z[h++]=L[I++],Z[h++]=L[I++],G-=3;G&&(Z[h++]=L[I++],1<G&&(Z[h++]=L[I++]))}else{for(I=h-re;Z[h++]=Z[I++],Z[h++]=Z[I++],Z[h++]=Z[I++],2<(G-=3););G&&(Z[h++]=Z[I++],1<G&&(Z[h++]=Z[I++]))}break}}break}}while(u<l&&h<b);u-=G=w>>3,m&=(1<<(w-=G<<3))-1,o.next_in=u,o.next_out=h,o.avail_in=u<l?l-u+5:5-(u-l),o.avail_out=h<b?b-h+257:257-(h-b),a.hold=m,a.bits=w}},{}],49:[function(n,r,i){var o=n("../utils/common"),s=n("./adler32"),a=n("./crc32"),u=n("./inffast"),l=n("./inftrees"),h=1,_=2,b=0,d=-2,y=1,f=852,E=592;function g(I){return(I>>>24&255)+(I>>>8&65280)+((65280&I)<<8)+((255&I)<<24)}function m(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new 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 w(I){var L;return I&&I.state?(L=I.state,I.total_in=I.total_out=L.total=0,I.msg="",L.wrap&&(I.adler=1&L.wrap),L.mode=y,L.last=0,L.havedict=0,L.dmax=32768,L.head=null,L.hold=0,L.bits=0,L.lencode=L.lendyn=new o.Buf32(f),L.distcode=L.distdyn=new o.Buf32(E),L.sane=1,L.back=-1,b):d}function x(I){var L;return I&&I.state?((L=I.state).wsize=0,L.whave=0,L.wnext=0,w(I)):d}function O(I,L){var p,Z;return I&&I.state?(Z=I.state,L<0?(p=0,L=-L):(p=1+(L>>4),L<48&&(L&=15)),L&&(L<8||15<L)?d:(Z.window!==null&&Z.wbits!==L&&(Z.window=null),Z.wrap=p,Z.wbits=L,x(I))):d}function T(I,L){var p,Z;return I?(Z=new m,(I.state=Z).window=null,(p=O(I,L))!==b&&(I.state=null),p):d}var C,F,R=!0;function G(I){if(R){var L;for(C=new o.Buf32(512),F=new o.Buf32(32),L=0;L<144;)I.lens[L++]=8;for(;L<256;)I.lens[L++]=9;for(;L<280;)I.lens[L++]=7;for(;L<288;)I.lens[L++]=8;for(l(h,I.lens,0,288,C,0,I.work,{bits:9}),L=0;L<32;)I.lens[L++]=5;l(_,I.lens,0,32,F,0,I.work,{bits:5}),R=!1}I.lencode=C,I.lenbits=9,I.distcode=F,I.distbits=5}function re(I,L,p,Z){var N,P=I.state;return P.window===null&&(P.wsize=1<<P.wbits,P.wnext=0,P.whave=0,P.window=new o.Buf8(P.wsize)),Z>=P.wsize?(o.arraySet(P.window,L,p-P.wsize,P.wsize,0),P.wnext=0,P.whave=P.wsize):(Z<(N=P.wsize-P.wnext)&&(N=Z),o.arraySet(P.window,L,p-Z,N,P.wnext),(Z-=N)?(o.arraySet(P.window,L,p-Z,Z,0),P.wnext=Z,P.whave=P.wsize):(P.wnext+=N,P.wnext===P.wsize&&(P.wnext=0),P.whave<P.wsize&&(P.whave+=N))),0}i.inflateReset=x,i.inflateReset2=O,i.inflateResetKeep=w,i.inflateInit=function(I){return T(I,15)},i.inflateInit2=T,i.inflate=function(I,L){var p,Z,N,P,q,j,Y,k,A,Q,K,W,ce,se,oe,ue,de,fe,we,Se,c,B,M,S,v=0,z=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 d;(p=I.state).mode===12&&(p.mode=13),q=I.next_out,N=I.output,Y=I.avail_out,P=I.next_in,Z=I.input,j=I.avail_in,k=p.hold,A=p.bits,Q=j,K=Y,B=b;e:for(;;)switch(p.mode){case y:if(p.wrap===0){p.mode=13;break}for(;A<16;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}if(2&p.wrap&&k===35615){z[p.check=0]=255&k,z[1]=k>>>8&255,p.check=a(p.check,z,2,0),A=k=0,p.mode=2;break}if(p.flags=0,p.head&&(p.head.done=!1),!(1&p.wrap)||(((255&k)<<8)+(k>>8))%31){I.msg="incorrect header check",p.mode=30;break}if((15&k)!=8){I.msg="unknown compression method",p.mode=30;break}if(A-=4,c=8+(15&(k>>>=4)),p.wbits===0)p.wbits=c;else if(c>p.wbits){I.msg="invalid window size",p.mode=30;break}p.dmax=1<<c,I.adler=p.check=1,p.mode=512&k?10:12,A=k=0;break;case 2:for(;A<16;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}if(p.flags=k,(255&p.flags)!=8){I.msg="unknown compression method",p.mode=30;break}if(57344&p.flags){I.msg="unknown header flags set",p.mode=30;break}p.head&&(p.head.text=k>>8&1),512&p.flags&&(z[0]=255&k,z[1]=k>>>8&255,p.check=a(p.check,z,2,0)),A=k=0,p.mode=3;case 3:for(;A<32;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}p.head&&(p.head.time=k),512&p.flags&&(z[0]=255&k,z[1]=k>>>8&255,z[2]=k>>>16&255,z[3]=k>>>24&255,p.check=a(p.check,z,4,0)),A=k=0,p.mode=4;case 4:for(;A<16;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}p.head&&(p.head.xflags=255&k,p.head.os=k>>8),512&p.flags&&(z[0]=255&k,z[1]=k>>>8&255,p.check=a(p.check,z,2,0)),A=k=0,p.mode=5;case 5:if(1024&p.flags){for(;A<16;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}p.length=k,p.head&&(p.head.extra_len=k),512&p.flags&&(z[0]=255&k,z[1]=k>>>8&255,p.check=a(p.check,z,2,0)),A=k=0}else p.head&&(p.head.extra=null);p.mode=6;case 6:if(1024&p.flags&&(j<(W=p.length)&&(W=j),W&&(p.head&&(c=p.head.extra_len-p.length,p.head.extra||(p.head.extra=new Array(p.head.extra_len)),o.arraySet(p.head.extra,Z,P,W,c)),512&p.flags&&(p.check=a(p.check,Z,W,P)),j-=W,P+=W,p.length-=W),p.length))break e;p.length=0,p.mode=7;case 7:if(2048&p.flags){if(j===0)break e;for(W=0;c=Z[P+W++],p.head&&c&&p.length<65536&&(p.head.name+=String.fromCharCode(c)),c&&W<j;);if(512&p.flags&&(p.check=a(p.check,Z,W,P)),j-=W,P+=W,c)break e}else p.head&&(p.head.name=null);p.length=0,p.mode=8;case 8:if(4096&p.flags){if(j===0)break e;for(W=0;c=Z[P+W++],p.head&&c&&p.length<65536&&(p.head.comment+=String.fromCharCode(c)),c&&W<j;);if(512&p.flags&&(p.check=a(p.check,Z,W,P)),j-=W,P+=W,c)break e}else p.head&&(p.head.comment=null);p.mode=9;case 9:if(512&p.flags){for(;A<16;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}if(k!==(65535&p.check)){I.msg="header crc mismatch",p.mode=30;break}A=k=0}p.head&&(p.head.hcrc=p.flags>>9&1,p.head.done=!0),I.adler=p.check=0,p.mode=12;break;case 10:for(;A<32;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}I.adler=p.check=g(k),A=k=0,p.mode=11;case 11:if(p.havedict===0)return I.next_out=q,I.avail_out=Y,I.next_in=P,I.avail_in=j,p.hold=k,p.bits=A,2;I.adler=p.check=1,p.mode=12;case 12:if(L===5||L===6)break e;case 13:if(p.last){k>>>=7&A,A-=7&A,p.mode=27;break}for(;A<3;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}switch(p.last=1&k,A-=1,3&(k>>>=1)){case 0:p.mode=14;break;case 1:if(G(p),p.mode=20,L!==6)break;k>>>=2,A-=2;break e;case 2:p.mode=17;break;case 3:I.msg="invalid block type",p.mode=30}k>>>=2,A-=2;break;case 14:for(k>>>=7&A,A-=7&A;A<32;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}if((65535&k)!=(k>>>16^65535)){I.msg="invalid stored block lengths",p.mode=30;break}if(p.length=65535&k,A=k=0,p.mode=15,L===6)break e;case 15:p.mode=16;case 16:if(W=p.length){if(j<W&&(W=j),Y<W&&(W=Y),W===0)break e;o.arraySet(N,Z,P,W,q),j-=W,P+=W,Y-=W,q+=W,p.length-=W;break}p.mode=12;break;case 17:for(;A<14;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}if(p.nlen=257+(31&k),k>>>=5,A-=5,p.ndist=1+(31&k),k>>>=5,A-=5,p.ncode=4+(15&k),k>>>=4,A-=4,286<p.nlen||30<p.ndist){I.msg="too many length or distance symbols",p.mode=30;break}p.have=0,p.mode=18;case 18:for(;p.have<p.ncode;){for(;A<3;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}p.lens[H[p.have++]]=7&k,k>>>=3,A-=3}for(;p.have<19;)p.lens[H[p.have++]]=0;if(p.lencode=p.lendyn,p.lenbits=7,M={bits:p.lenbits},B=l(0,p.lens,0,19,p.lencode,0,p.work,M),p.lenbits=M.bits,B){I.msg="invalid code lengths set",p.mode=30;break}p.have=0,p.mode=19;case 19:for(;p.have<p.nlen+p.ndist;){for(;ue=(v=p.lencode[k&(1<<p.lenbits)-1])>>>16&255,de=65535&v,!((oe=v>>>24)<=A);){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}if(de<16)k>>>=oe,A-=oe,p.lens[p.have++]=de;else{if(de===16){for(S=oe+2;A<S;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}if(k>>>=oe,A-=oe,p.have===0){I.msg="invalid bit length repeat",p.mode=30;break}c=p.lens[p.have-1],W=3+(3&k),k>>>=2,A-=2}else if(de===17){for(S=oe+3;A<S;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}A-=oe,c=0,W=3+(7&(k>>>=oe)),k>>>=3,A-=3}else{for(S=oe+7;A<S;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}A-=oe,c=0,W=11+(127&(k>>>=oe)),k>>>=7,A-=7}if(p.have+W>p.nlen+p.ndist){I.msg="invalid bit length repeat",p.mode=30;break}for(;W--;)p.lens[p.have++]=c}}if(p.mode===30)break;if(p.lens[256]===0){I.msg="invalid code -- missing end-of-block",p.mode=30;break}if(p.lenbits=9,M={bits:p.lenbits},B=l(h,p.lens,0,p.nlen,p.lencode,0,p.work,M),p.lenbits=M.bits,B){I.msg="invalid literal/lengths set",p.mode=30;break}if(p.distbits=6,p.distcode=p.distdyn,M={bits:p.distbits},B=l(_,p.lens,p.nlen,p.ndist,p.distcode,0,p.work,M),p.distbits=M.bits,B){I.msg="invalid distances set",p.mode=30;break}if(p.mode=20,L===6)break e;case 20:p.mode=21;case 21:if(6<=j&&258<=Y){I.next_out=q,I.avail_out=Y,I.next_in=P,I.avail_in=j,p.hold=k,p.bits=A,u(I,K),q=I.next_out,N=I.output,Y=I.avail_out,P=I.next_in,Z=I.input,j=I.avail_in,k=p.hold,A=p.bits,p.mode===12&&(p.back=-1);break}for(p.back=0;ue=(v=p.lencode[k&(1<<p.lenbits)-1])>>>16&255,de=65535&v,!((oe=v>>>24)<=A);){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}if(ue&&(240&ue)==0){for(fe=oe,we=ue,Se=de;ue=(v=p.lencode[Se+((k&(1<<fe+we)-1)>>fe)])>>>16&255,de=65535&v,!(fe+(oe=v>>>24)<=A);){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}k>>>=fe,A-=fe,p.back+=fe}if(k>>>=oe,A-=oe,p.back+=oe,p.length=de,ue===0){p.mode=26;break}if(32&ue){p.back=-1,p.mode=12;break}if(64&ue){I.msg="invalid literal/length code",p.mode=30;break}p.extra=15&ue,p.mode=22;case 22:if(p.extra){for(S=p.extra;A<S;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}p.length+=k&(1<<p.extra)-1,k>>>=p.extra,A-=p.extra,p.back+=p.extra}p.was=p.length,p.mode=23;case 23:for(;ue=(v=p.distcode[k&(1<<p.distbits)-1])>>>16&255,de=65535&v,!((oe=v>>>24)<=A);){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}if((240&ue)==0){for(fe=oe,we=ue,Se=de;ue=(v=p.distcode[Se+((k&(1<<fe+we)-1)>>fe)])>>>16&255,de=65535&v,!(fe+(oe=v>>>24)<=A);){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}k>>>=fe,A-=fe,p.back+=fe}if(k>>>=oe,A-=oe,p.back+=oe,64&ue){I.msg="invalid distance code",p.mode=30;break}p.offset=de,p.extra=15&ue,p.mode=24;case 24:if(p.extra){for(S=p.extra;A<S;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}p.offset+=k&(1<<p.extra)-1,k>>>=p.extra,A-=p.extra,p.back+=p.extra}if(p.offset>p.dmax){I.msg="invalid distance too far back",p.mode=30;break}p.mode=25;case 25:if(Y===0)break e;if(W=K-Y,p.offset>W){if((W=p.offset-W)>p.whave&&p.sane){I.msg="invalid distance too far back",p.mode=30;break}ce=W>p.wnext?(W-=p.wnext,p.wsize-W):p.wnext-W,W>p.length&&(W=p.length),se=p.window}else se=N,ce=q-p.offset,W=p.length;for(Y<W&&(W=Y),Y-=W,p.length-=W;N[q++]=se[ce++],--W;);p.length===0&&(p.mode=21);break;case 26:if(Y===0)break e;N[q++]=p.length,Y--,p.mode=21;break;case 27:if(p.wrap){for(;A<32;){if(j===0)break e;j--,k|=Z[P++]<<A,A+=8}if(K-=Y,I.total_out+=K,p.total+=K,K&&(I.adler=p.check=p.flags?a(p.check,N,K,q-K):s(p.check,N,K,q-K)),K=Y,(p.flags?k:g(k))!==p.check){I.msg="incorrect data check",p.mode=30;break}A=k=0}p.mode=28;case 28:if(p.wrap&&p.flags){for(;A<32;){if(j===0)break e;j--,k+=Z[P++]<<A,A+=8}if(k!==(4294967295&p.total)){I.msg="incorrect length check",p.mode=30;break}A=k=0}p.mode=29;case 29:B=1;break e;case 30:B=-3;break e;case 31:return-4;case 32:default:return d}return I.next_out=q,I.avail_out=Y,I.next_in=P,I.avail_in=j,p.hold=k,p.bits=A,(p.wsize||K!==I.avail_out&&p.mode<30&&(p.mode<27||L!==4))&&re(I,I.output,I.next_out,K-I.avail_out)?(p.mode=31,-4):(Q-=I.avail_in,K-=I.avail_out,I.total_in+=Q,I.total_out+=K,p.total+=K,p.wrap&&K&&(I.adler=p.check=p.flags?a(p.check,N,K,I.next_out-K):s(p.check,N,K,I.next_out-K)),I.data_type=p.bits+(p.last?64:0)+(p.mode===12?128:0)+(p.mode===20||p.mode===15?256:0),(Q==0&&K===0||L===4)&&B===b&&(B=-5),B)},i.inflateEnd=function(I){if(!I||!I.state)return d;var L=I.state;return L.window&&(L.window=null),I.state=null,b},i.inflateGetHeader=function(I,L){var p;return I&&I.state?(2&(p=I.state).wrap)==0?d:((p.head=L).done=!1,b):d},i.inflateSetDictionary=function(I,L){var p,Z=L.length;return I&&I.state?(p=I.state).wrap!==0&&p.mode!==11?d:p.mode===11&&s(1,L,Z,0)!==p.check?-3:re(I,L,Z,Z)?(p.mode=31,-4):(p.havedict=1,b):d},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"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[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],l=[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(h,_,b,d,y,f,E,g){var m,w,x,O,T,C,F,R,G,re=g.bits,I=0,L=0,p=0,Z=0,N=0,P=0,q=0,j=0,Y=0,k=0,A=null,Q=0,K=new o.Buf16(16),W=new o.Buf16(16),ce=null,se=0;for(I=0;I<=15;I++)K[I]=0;for(L=0;L<d;L++)K[_[b+L]]++;for(N=re,Z=15;1<=Z&&K[Z]===0;Z--);if(Z<N&&(N=Z),Z===0)return y[f++]=20971520,y[f++]=20971520,g.bits=1,0;for(p=1;p<Z&&K[p]===0;p++);for(N<p&&(N=p),I=j=1;I<=15;I++)if(j<<=1,(j-=K[I])<0)return-1;if(0<j&&(h===0||Z!==1))return-1;for(W[1]=0,I=1;I<15;I++)W[I+1]=W[I]+K[I];for(L=0;L<d;L++)_[b+L]!==0&&(E[W[_[b+L]]++]=L);if(C=h===0?(A=ce=E,19):h===1?(A=s,Q-=257,ce=a,se-=257,256):(A=u,ce=l,-1),I=p,T=f,q=L=k=0,x=-1,O=(Y=1<<(P=N))-1,h===1&&852<Y||h===2&&592<Y)return 1;for(;;){for(F=I-q,G=E[L]<C?(R=0,E[L]):E[L]>C?(R=ce[se+E[L]],A[Q+E[L]]):(R=96,0),m=1<<I-q,p=w=1<<P;y[T+(k>>q)+(w-=m)]=F<<24|R<<16|G|0,w!==0;);for(m=1<<I-1;k&m;)m>>=1;if(m!==0?(k&=m-1,k+=m):k=0,L++,--K[I]==0){if(I===Z)break;I=_[b+E[L]]}if(N<I&&(k&O)!==x){for(q===0&&(q=N),T+=p,j=1<<(P=I-q);P+q<Z&&!((j-=K[P+q])<=0);)P++,j<<=1;if(Y+=1<<P,h===1&&852<Y||h===2&&592<Y)return 1;y[x=k&O]=N<<24|P<<16|T-f|0}}return k!==0&&(y[T+k]=I-q<<24|64<<16|0),g.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"),s=0,a=1;function u(v){for(var z=v.length;0<=--z;)v[z]=0}var l=0,h=29,_=256,b=_+1+h,d=30,y=19,f=2*b+1,E=15,g=16,m=7,w=256,x=16,O=17,T=18,C=[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],R=[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],re=new Array(2*(b+2));u(re);var I=new Array(2*d);u(I);var L=new Array(512);u(L);var p=new Array(256);u(p);var Z=new Array(h);u(Z);var N,P,q,j=new Array(d);function Y(v,z,H,V,D){this.static_tree=v,this.extra_bits=z,this.extra_base=H,this.elems=V,this.max_length=D,this.has_stree=v&&v.length}function k(v,z){this.dyn_tree=v,this.max_code=0,this.stat_desc=z}function A(v){return v<256?L[v]:L[256+(v>>>7)]}function Q(v,z){v.pending_buf[v.pending++]=255&z,v.pending_buf[v.pending++]=z>>>8&255}function K(v,z,H){v.bi_valid>g-H?(v.bi_buf|=z<<v.bi_valid&65535,Q(v,v.bi_buf),v.bi_buf=z>>g-v.bi_valid,v.bi_valid+=H-g):(v.bi_buf|=z<<v.bi_valid&65535,v.bi_valid+=H)}function W(v,z,H){K(v,H[2*z],H[2*z+1])}function ce(v,z){for(var H=0;H|=1&v,v>>>=1,H<<=1,0<--z;);return H>>>1}function se(v,z,H){var V,D,X=new Array(E+1),ee=0;for(V=1;V<=E;V++)X[V]=ee=ee+H[V-1]<<1;for(D=0;D<=z;D++){var J=v[2*D+1];J!==0&&(v[2*D]=ce(X[J]++,J))}}function oe(v){var z;for(z=0;z<b;z++)v.dyn_ltree[2*z]=0;for(z=0;z<d;z++)v.dyn_dtree[2*z]=0;for(z=0;z<y;z++)v.bl_tree[2*z]=0;v.dyn_ltree[2*w]=1,v.opt_len=v.static_len=0,v.last_lit=v.matches=0}function ue(v){8<v.bi_valid?Q(v,v.bi_buf):0<v.bi_valid&&(v.pending_buf[v.pending++]=v.bi_buf),v.bi_buf=0,v.bi_valid=0}function de(v,z,H,V){var D=2*z,X=2*H;return v[D]<v[X]||v[D]===v[X]&&V[z]<=V[H]}function fe(v,z,H){for(var V=v.heap[H],D=H<<1;D<=v.heap_len&&(D<v.heap_len&&de(z,v.heap[D+1],v.heap[D],v.depth)&&D++,!de(z,V,v.heap[D],v.depth));)v.heap[H]=v.heap[D],H=D,D<<=1;v.heap[H]=V}function we(v,z,H){var V,D,X,ee,J=0;if(v.last_lit!==0)for(;V=v.pending_buf[v.d_buf+2*J]<<8|v.pending_buf[v.d_buf+2*J+1],D=v.pending_buf[v.l_buf+J],J++,V===0?W(v,D,z):(W(v,(X=p[D])+_+1,z),(ee=C[X])!==0&&K(v,D-=Z[X],ee),W(v,X=A(--V),H),(ee=F[X])!==0&&K(v,V-=j[X],ee)),J<v.last_lit;);W(v,w,z)}function Se(v,z){var H,V,D,X=z.dyn_tree,ee=z.stat_desc.static_tree,J=z.stat_desc.has_stree,ie=z.stat_desc.elems,me=-1;for(v.heap_len=0,v.heap_max=f,H=0;H<ie;H++)X[2*H]!==0?(v.heap[++v.heap_len]=me=H,v.depth[H]=0):X[2*H+1]=0;for(;v.heap_len<2;)X[2*(D=v.heap[++v.heap_len]=me<2?++me:0)]=1,v.depth[D]=0,v.opt_len--,J&&(v.static_len-=ee[2*D+1]);for(z.max_code=me,H=v.heap_len>>1;1<=H;H--)fe(v,X,H);for(D=ie;H=v.heap[1],v.heap[1]=v.heap[v.heap_len--],fe(v,X,1),V=v.heap[1],v.heap[--v.heap_max]=H,v.heap[--v.heap_max]=V,X[2*D]=X[2*H]+X[2*V],v.depth[D]=(v.depth[H]>=v.depth[V]?v.depth[H]:v.depth[V])+1,X[2*H+1]=X[2*V+1]=D,v.heap[1]=D++,fe(v,X,1),2<=v.heap_len;);v.heap[--v.heap_max]=v.heap[1],(function(pe,Te){var ut,Ce,ct,Ee,St,Yt,Me=Te.dyn_tree,Nn=Te.max_code,io=Te.stat_desc.static_tree,oo=Te.stat_desc.has_stree,so=Te.stat_desc.extra_bits,Pn=Te.stat_desc.extra_base,lt=Te.stat_desc.max_length,Ot=0;for(Ee=0;Ee<=E;Ee++)pe.bl_count[Ee]=0;for(Me[2*pe.heap[pe.heap_max]+1]=0,ut=pe.heap_max+1;ut<f;ut++)lt<(Ee=Me[2*Me[2*(Ce=pe.heap[ut])+1]+1]+1)&&(Ee=lt,Ot++),Me[2*Ce+1]=Ee,Nn<Ce||(pe.bl_count[Ee]++,St=0,Pn<=Ce&&(St=so[Ce-Pn]),Yt=Me[2*Ce],pe.opt_len+=Yt*(Ee+St),oo&&(pe.static_len+=Yt*(io[2*Ce+1]+St)));if(Ot!==0){do{for(Ee=lt-1;pe.bl_count[Ee]===0;)Ee--;pe.bl_count[Ee]--,pe.bl_count[Ee+1]+=2,pe.bl_count[lt]--,Ot-=2}while(0<Ot);for(Ee=lt;Ee!==0;Ee--)for(Ce=pe.bl_count[Ee];Ce!==0;)Nn<(ct=pe.heap[--ut])||(Me[2*ct+1]!==Ee&&(pe.opt_len+=(Ee-Me[2*ct+1])*Me[2*ct],Me[2*ct+1]=Ee),Ce--)}})(v,z),se(X,me,v.bl_count)}function c(v,z,H){var V,D,X=-1,ee=z[1],J=0,ie=7,me=4;for(ee===0&&(ie=138,me=3),z[2*(H+1)+1]=65535,V=0;V<=H;V++)D=ee,ee=z[2*(V+1)+1],++J<ie&&D===ee||(J<me?v.bl_tree[2*D]+=J:D!==0?(D!==X&&v.bl_tree[2*D]++,v.bl_tree[2*x]++):J<=10?v.bl_tree[2*O]++:v.bl_tree[2*T]++,X=D,me=(J=0)===ee?(ie=138,3):D===ee?(ie=6,3):(ie=7,4))}function B(v,z,H){var V,D,X=-1,ee=z[1],J=0,ie=7,me=4;for(ee===0&&(ie=138,me=3),V=0;V<=H;V++)if(D=ee,ee=z[2*(V+1)+1],!(++J<ie&&D===ee)){if(J<me)for(;W(v,D,v.bl_tree),--J!=0;);else D!==0?(D!==X&&(W(v,D,v.bl_tree),J--),W(v,x,v.bl_tree),K(v,J-3,2)):J<=10?(W(v,O,v.bl_tree),K(v,J-3,3)):(W(v,T,v.bl_tree),K(v,J-11,7));X=D,me=(J=0)===ee?(ie=138,3):D===ee?(ie=6,3):(ie=7,4)}}u(j);var M=!1;function S(v,z,H,V){K(v,(l<<1)+(V?1:0),3),(function(D,X,ee,J){ue(D),Q(D,ee),Q(D,~ee),o.arraySet(D.pending_buf,D.window,X,ee,D.pending),D.pending+=ee})(v,z,H)}i._tr_init=function(v){M||((function(){var z,H,V,D,X,ee=new Array(E+1);for(D=V=0;D<h-1;D++)for(Z[D]=V,z=0;z<1<<C[D];z++)p[V++]=D;for(p[V-1]=D,D=X=0;D<16;D++)for(j[D]=X,z=0;z<1<<F[D];z++)L[X++]=D;for(X>>=7;D<d;D++)for(j[D]=X<<7,z=0;z<1<<F[D]-7;z++)L[256+X++]=D;for(H=0;H<=E;H++)ee[H]=0;for(z=0;z<=143;)re[2*z+1]=8,z++,ee[8]++;for(;z<=255;)re[2*z+1]=9,z++,ee[9]++;for(;z<=279;)re[2*z+1]=7,z++,ee[7]++;for(;z<=287;)re[2*z+1]=8,z++,ee[8]++;for(se(re,b+1,ee),z=0;z<d;z++)I[2*z+1]=5,I[2*z]=ce(z,5);N=new Y(re,C,_+1,b,E),P=new Y(I,F,0,d,E),q=new Y(new Array(0),R,0,y,m)})(),M=!0),v.l_desc=new k(v.dyn_ltree,N),v.d_desc=new k(v.dyn_dtree,P),v.bl_desc=new k(v.bl_tree,q),v.bi_buf=0,v.bi_valid=0,oe(v)},i._tr_stored_block=S,i._tr_flush_block=function(v,z,H,V){var D,X,ee=0;0<v.level?(v.strm.data_type===2&&(v.strm.data_type=(function(J){var ie,me=4093624447;for(ie=0;ie<=31;ie++,me>>>=1)if(1&me&&J.dyn_ltree[2*ie]!==0)return s;if(J.dyn_ltree[18]!==0||J.dyn_ltree[20]!==0||J.dyn_ltree[26]!==0)return a;for(ie=32;ie<_;ie++)if(J.dyn_ltree[2*ie]!==0)return a;return s})(v)),Se(v,v.l_desc),Se(v,v.d_desc),ee=(function(J){var ie;for(c(J,J.dyn_ltree,J.l_desc.max_code),c(J,J.dyn_dtree,J.d_desc.max_code),Se(J,J.bl_desc),ie=y-1;3<=ie&&J.bl_tree[2*G[ie]+1]===0;ie--);return J.opt_len+=3*(ie+1)+5+5+4,ie})(v),D=v.opt_len+3+7>>>3,(X=v.static_len+3+7>>>3)<=D&&(D=X)):D=X=H+5,H+4<=D&&z!==-1?S(v,z,H,V):v.strategy===4||X===D?(K(v,2+(V?1:0),3),we(v,re,I)):(K(v,4+(V?1:0),3),(function(J,ie,me,pe){var Te;for(K(J,ie-257,5),K(J,me-1,5),K(J,pe-4,4),Te=0;Te<pe;Te++)K(J,J.bl_tree[2*G[Te]+1],3);B(J,J.dyn_ltree,ie-1),B(J,J.dyn_dtree,me-1)})(v,v.l_desc.max_code+1,v.d_desc.max_code+1,ee+1),we(v,v.dyn_ltree,v.dyn_dtree)),oe(v),V&&ue(v)},i._tr_tally=function(v,z,H){return v.pending_buf[v.d_buf+2*v.last_lit]=z>>>8&255,v.pending_buf[v.d_buf+2*v.last_lit+1]=255&z,v.pending_buf[v.l_buf+v.last_lit]=255&H,v.last_lit++,z===0?v.dyn_ltree[2*H]++:(v.matches++,z--,v.dyn_ltree[2*(p[H]+_+1)]++,v.dyn_dtree[2*A(z)]++),v.last_lit===v.lit_bufsize-1},i._tr_align=function(v){K(v,2,3),W(v,w,re),(function(z){z.bi_valid===16?(Q(z,z.bi_buf),z.bi_buf=0,z.bi_valid=0):8<=z.bi_valid&&(z.pending_buf[z.pending++]=255&z.bi_buf,z.bi_buf>>=8,z.bi_valid-=8)})(v)}},{"../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(s,a){if(!s.setImmediate){var u,l,h,_,b=1,d={},y=!1,f=s.document,E=Object.getPrototypeOf&&Object.getPrototypeOf(s);E=E&&E.setTimeout?E:s,u={}.toString.call(s.process)==="[object process]"?function(x){ao.nextTick(function(){m(x)})}:(function(){if(s.postMessage&&!s.importScripts){var x=!0,O=s.onmessage;return s.onmessage=function(){x=!1},s.postMessage("","*"),s.onmessage=O,x}})()?(_="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",w,!1):s.attachEvent("onmessage",w),function(x){s.postMessage(_+x,"*")}):s.MessageChannel?((h=new MessageChannel).port1.onmessage=function(x){m(x.data)},function(x){h.port2.postMessage(x)}):f&&"onreadystatechange"in f.createElement("script")?(l=f.documentElement,function(x){var O=f.createElement("script");O.onreadystatechange=function(){m(x),O.onreadystatechange=null,l.removeChild(O),O=null},l.appendChild(O)}):function(x){setTimeout(m,0,x)},E.setImmediate=function(x){typeof x!="function"&&(x=new Function(""+x));for(var O=new Array(arguments.length-1),T=0;T<O.length;T++)O[T]=arguments[T+1];var C={callback:x,args:O};return d[b]=C,u(b),b++},E.clearImmediate=g}function g(x){delete d[x]}function m(x){if(y)setTimeout(m,0,x);else{var O=d[x];if(O){y=!0;try{(function(T){var C=T.callback,F=T.args;switch(F.length){case 0:C();break;case 1:C(F[0]);break;case 2:C(F[0],F[1]);break;case 3:C(F[0],F[1],F[2]);break;default:C.apply(a,F)}})(O)}finally{g(x),y=!1}}}}function w(x){x.source===s&&typeof x.data=="string"&&x.data.indexOf(_)===0&&m(+x.data.slice(_.length))}})(typeof self>"u"?o===void 0?this:o:self)}).call(this,typeof xt<"u"?xt:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(tn)),tn.exports}var Cl=Dl();const ri=gr(Cl);function Nl(e){const t=[],n=Object.keys(e);for(const r of n){const i=e[r];if(!i)continue;const o=i.sort((a,u)=>a.index-u.index);let s=-1;for(let a=0;a<o.length;a++)s=s+1+o[a].skip,o[a].index!==s&&t.push({message:`Invalid operation index ${o[a].index} at position ${a}`,details:{position:a,operation:o[a],scope:o[a].action.scope}})}return t}function Pl(e){const t=new ri,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(Al(e.operations),null,2)),t}async function Ml(e,t){const r=await Pl(e).generateAsync({type:"blob"}),i=await t.createWritable();await i.write(r),await i.close()}async function $l(e,t,n){const r=new ri;return await r.loadAsync(e),Zl(r,t,n)}async function Zl(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),s=e.file("header.json");let a;s&&(a=JSON.parse(await s.async("string")));const u=e.file("operations.json");if(!u)throw new Error("Operations history not found");const l=JSON.parse(await u.async("string")),h=jt(l),_=Nl(h);if(_.length){const d=_.map(y=>y.message);throw new Error(d.join(`
|
|
41
|
+
`))}let b=ei(o,h,t,void 0,a,{},n);return a&&(b={...b,header:a}),b}const ve={Remove:"remove",Replace:"replace",Add:"add"},ii=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),Ll=Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),Nt=Symbol.iterator,ze={mutable:"mutable",immutable:"immutable"},On={};function gt(e,t){return e instanceof Map?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ur(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 xn(e){return Object.getPrototypeOf(e)===Set.prototype}function In(e){return Object.getPrototypeOf(e)===Map.prototype}function Ae(e){var t;return(t=e.copy)!==null&&t!==void 0?t:e.original}function Fe(e){return!!le(e)}function le(e){return typeof e!="object"?null:e?.[ii]}function kn(e){var t;const n=le(e);return n?(t=n.copy)!==null&&t!==void 0?t:n.original:e}function De(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,ze))===ze.immutable||typeof n=="function")}function oi(e,t=[]){if(Object.hasOwnProperty.call(e,"key")){const n=e.parent.copy,r=le(je(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||gt(n,o)))return null;t.push(o)}if(e.parent)return oi(e.parent,t);t.reverse();try{jl(e.copy,t)}catch{return null}return t}function qe(e){return Array.isArray(e)?1:e instanceof Map?2:e instanceof Set?3:0}function je(e,t){return qe(e)===2?e.get(t):e[t]}function wt(e,t,n){qe(e)===2?e.set(t,n):e[t]=n}function nn(e,t){const n=le(e);return(n?Ae(n):e)[t]}function Ze(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function an(e){if(e)for(;e.finalities.revoke.length>0;)e.finalities.revoke.pop()()}function Ve(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 jl(e,t){for(let n=0;n<t.length-1;n+=1){const r=t[n];if(e=je(qe(e)===3?Array.from(e):e,r),typeof e!="object")throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}return e}function Ul(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 Fl=Object.prototype.propertyIsEnumerable;function si(e,t){let n;if(Array.isArray(e))return Array.prototype.concat.call(e);if(e instanceof Set){if(!xn(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(!In(e)){const r=Object.getPrototypeOf(e).constructor;return new r(e)}return new Map(e)}else if(t?.mark&&(n=t.mark(e,ze),n!==void 0)&&n!==ze.mutable){if(n===ze.immutable)return Ul(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=>{Fl.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 Oe(e){e.copy||(e.copy=si(e.original,e.options))}function mt(e){if(!De(e))return kn(e);if(Array.isArray(e))return e.map(mt);if(e instanceof Map){const n=Array.from(e.entries()).map(([r,i])=>[r,mt(i)]);if(!In(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(mt);if(!xn(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]=mt(e[n]);return t}function Pt(e){return Fe(e)?mt(e):e}function Pe(e){var t;e.assignedMap=(t=e.assignedMap)!==null&&t!==void 0?t:new Map,e.operated||(e.operated=!0,e.parent&&Pe(e.parent))}function cr(){throw new Error("Cannot modify frozen object")}function tt(e,t,n,r,i){{n=n??new WeakMap,r=r??[],i=i??[];const s=n.has(e)?n.get(e):e;if(r.length>0){const a=r.indexOf(s);if(s&&typeof s=="object"&&a!==-1)throw r[0]===s?new Error("Forbids circular reference"):new Error(`Forbids circular reference: ~/${i.slice(0,a).map((u,l)=>{if(typeof u=="symbol")return`[${u.toString()}]`;const h=r[l];return typeof u=="object"&&(h instanceof Map||h instanceof Set)?Array.from(h.keys()).indexOf(u):u}).join("/")}`);r.push(s),i.push(t)}else r.push(s)}if(Object.isFrozen(e)||Fe(e)){r.pop(),i.pop();return}switch(qe(e)){case 2:for(const[a,u]of e)tt(a,a,n,r,i),tt(u,a,n,r,i);e.set=e.clear=e.delete=cr;break;case 3:for(const a of e)tt(a,a,n,r,i);e.add=e.clear=e.delete=cr;break;case 1:Object.freeze(e);let s=0;for(const a of e)tt(a,s,n,r,i),s+=1;break;default:Object.freeze(e),Object.keys(e).forEach(a=>{const u=e[a];tt(u,a,n,r,i)})}r.pop(),i.pop()}function An(e,t){const n=qe(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 ai(e,t,n){if(Fe(e)||!De(e,n)||t.has(e)||Object.isFrozen(e))return;const r=e instanceof Set,i=r?new Map:void 0;if(t.add(e),An(e,(o,s)=>{var a;if(Fe(s)){const u=le(s);Oe(u);const l=!((a=u.assignedMap)===null||a===void 0)&&a.size||u.operated?u.copy:u.original;wt(r?i:e,o,l)}else ai(s,t,n)}),i){const o=e,s=Array.from(o);o.clear(),s.forEach(a=>{o.add(i.has(a)?i.get(a):a)})}}function Bl(e,t){const n=e.type===3?e.setMap:e.copy;e.finalities.revoke.length>1&&e.assignedMap.get(t)&&n&&ai(je(n,t),e.finalities.handledSet,e.options)}function un(e){e.type===3&&e.copy&&(e.copy.clear(),e.setMap.forEach(t=>{e.copy.add(kn(t))}))}function cn(e,t,n,r){if(e.operated&&e.assignedMap&&e.assignedMap.size>0&&!e.finalized){if(n&&r){const o=oi(e);o&&t(e,o,n,r)}e.finalized=!0}}function zn(e,t,n,r){const i=le(n);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push((o,s)=>{var a;const u=e.type===3?e.setMap:e.copy;if(Ze(je(u,t),n)){let l=i.original;i.copy&&(l=i.copy),un(e),cn(e,r,o,s),e.options.enableAutoFreeze&&(e.options.updatedValues=(a=e.options.updatedValues)!==null&&a!==void 0?a:new WeakMap,e.options.updatedValues.set(l,i.original)),wt(u,t,l)}}),e.options.enableAutoFreeze&&i.finalities!==e.finalities&&(e.options.enableAutoFreeze=!1)),De(n,e.options)&&e.finalities.draft.push(()=>{const o=e.type===3?e.setMap:e.copy;Ze(je(o,t),n)&&Bl(e,t)})}function Wl(e,t,n,r,i){let{original:o,assignedMap:s,options:a}=e,u=e.copy;u.length<o.length&&([o,u]=[u,o],[n,r]=[r,n]);for(let l=0;l<o.length;l+=1)if(s.get(l.toString())&&u[l]!==o[l]){const h=t.concat([l]),_=Ve(h,i);n.push({op:ve.Replace,path:_,value:Pt(u[l])}),r.push({op:ve.Replace,path:_,value:Pt(o[l])})}for(let l=o.length;l<u.length;l+=1){const h=t.concat([l]),_=Ve(h,i);n.push({op:ve.Add,path:_,value:Pt(u[l])})}if(o.length<u.length){const{arrayLengthAssignment:l=!0}=a.enablePatches;if(l){const h=t.concat(["length"]),_=Ve(h,i);r.push({op:ve.Replace,path:_,value:o.length})}else for(let h=u.length;o.length<h;h-=1){const _=t.concat([h-1]),b=Ve(_,i);r.push({op:ve.Remove,path:b})}}}function Hl({original:e,copy:t,assignedMap:n},r,i,o,s){n.forEach((a,u)=>{const l=je(e,u),h=Pt(je(t,u)),_=a?gt(e,u)?ve.Replace:ve.Add:ve.Remove;if(Ze(l,h)&&_===ve.Replace)return;const b=r.concat(u),d=Ve(b,s);i.push(_===ve.Remove?{op:_,path:d}:{op:_,path:d,value:h}),o.push(_===ve.Add?{op:ve.Remove,path:d}:_===ve.Remove?{op:ve.Add,path:d,value:l}:{op:ve.Replace,path:d,value:l})})}function Vl({original:e,copy:t},n,r,i,o){let s=0;e.forEach(a=>{if(!t.has(a)){const u=n.concat([s]),l=Ve(u,o);r.push({op:ve.Remove,path:l,value:a}),i.unshift({op:ve.Add,path:l,value:a})}s+=1}),s=0,t.forEach(a=>{if(!e.has(a)){const u=n.concat([s]),l=Ve(u,o);r.push({op:ve.Add,path:l,value:a}),i.unshift({op:ve.Remove,path:l,value:a})}s+=1})}function yt(e,t,n,r){const{pathAsArray:i=!0}=e.options.enablePatches;switch(e.type){case 0:case 2:return Hl(e,t,n,r,i);case 1:return Wl(e,t,n,r,i);case 3:return Vl(e,t,n,r,i)}}let ln=!1;const Ut=(e,t,n=!1)=>{if(typeof e=="object"&&e!==null&&(!De(e,t)||n)&&!ln)throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")};function Gl(e){ln=!0;let t;try{t=e()}finally{ln=!1}return t}const pn={get size(){return Ae(le(this)).size},has(e){return Ae(le(this)).has(e)},set(e,t){const n=le(this),r=Ae(n);return(!r.has(e)||!Ze(r.get(e),t))&&(Oe(n),Pe(n),n.assignedMap.set(e,!0),n.copy.set(e,t),zn(n,e,t,yt)),this},delete(e){if(!this.has(e))return!1;const t=le(this);return Oe(t),Pe(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){Oe(e),Pe(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);Ae(n).forEach((r,i)=>{e.call(t,this.get(i),i,this)})},get(e){var t,n;const r=le(this),i=Ae(r).get(e),o=((n=(t=r.options).mark)===null||n===void 0?void 0:n.call(t,i,ze))===ze.mutable;if(r.options.strict&&Ut(i,r.options,o),o||r.finalized||!De(i,r.options)||i!==r.original.get(e))return i;const s=On.createDraft({original:i,parentDraft:r,key:e,finalities:r.finalities,options:r.options});return Oe(r),r.copy.set(e,s),s},keys(){return Ae(le(this)).keys()},values(){const e=this.keys();return{[Nt]:()=>this.values(),next:()=>{const t=e.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const e=this.keys();return{[Nt]:()=>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]}}}},[Nt](){return this.entries()}},Kl=Reflect.ownKeys(pn),lr=(e,t,{isValuesIterator:n})=>()=>{var r,i;const o=t.next();if(o.done)return o;const s=o.value;let a=e.setMap.get(s);const u=le(a),l=((i=(r=e.options).mark)===null||i===void 0?void 0:i.call(r,a,ze))===ze.mutable;if(e.options.strict&&Ut(s,e.options,l),!l&&!u&&De(s,e.options)&&!e.finalized&&e.original.has(s)){const h=On.createDraft({original:s,parentDraft:e,key:s,finalities:e.finalities,options:e.options});e.setMap.set(s,h),a=h}else u&&(a=u.proxy);return{done:!1,value:n?a:[a,a]}},Ft={get size(){return le(this).setMap.size},has(e){const t=le(this);if(t.setMap.has(e))return!0;Oe(t);const n=le(e);return!!(n&&t.setMap.has(n.original))},add(e){const t=le(this);return this.has(e)||(Oe(t),Pe(t),t.assignedMap.set(e,!0),t.setMap.set(e,e),zn(t,e,e,yt)),this},delete(e){if(!this.has(e))return!1;const t=le(this);Oe(t),Pe(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);Oe(e),Pe(e);for(const t of e.original)e.assignedMap.set(t,!1);e.setMap.clear()},values(){const e=le(this);Oe(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:lr(e,t,{isValuesIterator:!0})}},entries(){const e=le(this);Oe(e);const t=e.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:lr(e,t,{isValuesIterator:!1})}},keys(){return this.values()},[Nt](){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(Ft,{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 Xl=Reflect.ownKeys(Ft),ui={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===ii)return e;let s;if(e.options.mark){const l=t==="size"&&(e.original instanceof Map||e.original instanceof Set)?Reflect.get(e.original,t):Reflect.get(e.original,t,n);if(s=e.options.mark(l,ze),s===ze.mutable)return e.options.strict&&Ut(l,e.options,!0),l}const a=Ae(e);if(a instanceof Map&&Kl.includes(t))return t==="size"?Object.getOwnPropertyDescriptor(pn,"size").get.call(e.proxy):pn[t].bind(e.proxy);if(a instanceof Set&&Xl.includes(t))return t==="size"?Object.getOwnPropertyDescriptor(Ft,"size").get.call(e.proxy):Ft[t].bind(e.proxy);if(!gt(a,t)){const l=ur(a,t);return l?"value"in l?l.value:(i=l.get)===null||i===void 0?void 0:i.call(e.proxy):void 0}const u=a[t];if(e.options.strict&&Ut(u,e.options),e.finalized||!De(u,e.options))return u;if(u===nn(e.original,t)){if(Oe(e),e.copy[t]=Tn({original:e.original[t],parentDraft:e,key:e.type===1?Number(t):t,finalities:e.finalities,options:e.options}),typeof s=="function"){const l=le(e.copy[t]);return Oe(l),Pe(l),l.copy}return e.copy[t]}return Fe(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=ur(Ae(e),t);if(o?.set)return o.set.call(e.proxy,n),!0;const s=nn(Ae(e),t),a=le(s);return a&&Ze(a.original,n)?(e.copy[t]=n,e.assignedMap=(r=e.assignedMap)!==null&&r!==void 0?r:new Map,e.assignedMap.set(t,!1),!0):(Ze(n,s)&&(n!==void 0||gt(e.original,t))||(Oe(e),Pe(e),gt(e.original,t)&&Ze(n,e.original[t])?e.assignedMap.delete(t):e.assignedMap.set(t,!0),e.copy[t]=n,zn(e,t,n,yt)),!0)},has(e,t){return t in Ae(e)},ownKeys(e){return Reflect.ownKeys(Ae(e))},getOwnPropertyDescriptor(e,t){const n=Ae(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?ui.set.call(this,e,t,void 0,e.proxy):(nn(e.original,t)!==void 0||t in e.original?(Oe(e),Pe(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 Tn(e){const{original:t,parentDraft:n,key:r,finalities:i,options:o}=e,s=qe(t),a={type:s,finalized:!1,parent:n,original:t,copy:null,proxy:null,finalities:i,options:o,setMap:s===3?new Map(t.entries()):void 0};(r||"key"in e)&&(a.key=r);const{proxy:u,revoke:l}=Proxy.revocable(s===1?Object.assign([],a):a,ui);if(i.revoke.push(l),a.proxy=u,n){const h=n;h.finalities.draft.push((_,b)=>{var d,y;const f=le(u);let E=h.type===3?h.setMap:h.copy;const g=je(E,r),m=le(g);if(m){let w=m.original;m.operated&&(w=kn(g)),un(m),cn(m,yt,_,b),h.options.enableAutoFreeze&&(h.options.updatedValues=(d=h.options.updatedValues)!==null&&d!==void 0?d:new WeakMap,h.options.updatedValues.set(w,m.original)),wt(E,r,w)}(y=f.callbacks)===null||y===void 0||y.forEach(w=>{w(_,b)})})}else{const h=le(u);h.finalities.draft.push((_,b)=>{un(h),cn(h,yt,_,b)})}return u}On.createDraft=Tn;function Jl(e,t,n,r,i){var o;const s=le(e),a=(o=s?.original)!==null&&o!==void 0?o:e,u=!!t.length;if(s?.operated)for(;s.finalities.draft.length>0;)s.finalities.draft.pop()(n,r);const l=u?t[0]:s?s.operated?s.copy:s.original:e;return s&&an(s),i&&tt(l,l,s?.options.updatedValues),[l,n&&u?[{op:ve.Replace,path:[],value:t[0]}]:n,r&&u?[{op:ve.Replace,path:[],value:a}]:r]}function Yl(e,t){var n;const r={draft:[],revoke:[],handledSet:new WeakSet,draftsCache:new WeakSet};let i,o;t.enablePatches&&(i=[],o=[]);const a=((n=t.mark)===null||n===void 0?void 0:n.call(t,e,ze))===ze.mutable||!De(e,t)?e:Tn({original:e,parentDraft:null,finalities:r,options:t});return[a,(u=[])=>{const[l,h,_]=Jl(a,u,i,o,t.enableAutoFreeze);return t.enablePatches?[l,h,_]:l}]}function dn(e){const{rootDraft:t,value:n,useRawReturn:r=!1,isRoot:i=!0}=e;An(n,(o,s,a)=>{const u=le(s);if(u&&t&&u.finalities===t.finalities){e.isContainDraft=!0;const l=u.original;if(a instanceof Set){const h=Array.from(a);a.clear(),h.forEach(_=>a.add(o===_?l:_))}else wt(a,o,l)}else typeof s=="object"&&s!==null&&(e.value=s,e.isRoot=!1,dn(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 ci(e){var t;const n=le(e);if(!De(e,n?.options))return e;const r=qe(e);if(n&&!n.operated)return n.original;let i;function o(){i=r===2?In(e)?new Map(e):new(Object.getPrototypeOf(e)).constructor(e):r===3?Array.from(n.setMap.values()):si(e,n?.options)}if(n){n.finalized=!0;try{o()}finally{n.finalized=!1}}else i=e;if(An(i,(s,a)=>{if(n&&Ze(je(n.original,s),a))return;const u=ci(a);u!==a&&(i===e&&o(),wt(i,s,u))}),r===3){const s=(t=n?.original)!==null&&t!==void 0?t:i;return xn(s)?new Set(i):new(Object.getPrototypeOf(s)).constructor(i)}return i}function pr(e){if(!Fe(e))throw new Error(`current() is only used for Draft, parameter: ${e}`);return ci(e)}const ql=e=>function t(n,r,i){var o,s,a;if(typeof n=="function"&&typeof r!="function")return function(O,...T){return t(O,C=>n.call(this,C,...T),r)};const u=n,l=r;let h=i;if(typeof r!="function"&&(h=r),h!==void 0&&Object.prototype.toString.call(h)!=="[object Object]")throw new Error(`Invalid options: ${h}, 'options' should be an object.`);h=Object.assign(Object.assign({},e),h);const _=Fe(u)?pr(u):u,b=Array.isArray(h.mark)?((O,T)=>{for(const C of h.mark){if(typeof C!="function")throw new Error(`Invalid mark: ${C}, 'mark' should be a function.`);const F=C(O,T);if(F)return F}}):h.mark,d=(o=h.enablePatches)!==null&&o!==void 0?o:!1,y=(s=h.strict)!==null&&s!==void 0?s:!1,E={enableAutoFreeze:(a=h.enableAutoFreeze)!==null&&a!==void 0?a:!1,mark:b,strict:y,enablePatches:d};if(!De(_,E)&&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[g,m]=Yl(_,E);if(typeof r!="function"){if(!De(_,E))throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");return[g,m]}let w;try{w=l(g)}catch(O){throw an(le(g)),O}const x=O=>{const T=le(g);if(!Fe(O)){if(O!==void 0&&!Ze(O,g)&&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=O?.[Ll];if(F){const R=F[0];return E.strict&&typeof O=="object"&&O!==null&&dn({rootDraft:T,value:O,useRawReturn:!0}),m([R])}if(O!==void 0)return typeof O=="object"&&O!==null&&dn({rootDraft:T,value:O}),m([O])}if(O===g||O===void 0)return m([]);const C=le(O);if(E===C.options){if(C.operated)throw new Error("Cannot return a modified child draft.");return m([pr(O)])}return m([O])};return w instanceof Promise?w.then(x,O=>{throw an(le(g)),O}):x(w)},Rn=ql();Object.prototype.constructor.toString();function Ql(e,t){return{...e,header:{...e.header,name:t}}}function ep(e,t,n){const{scope:r}=t;return Rn({document:e,action:t,skip:n,reuseLastOperationIndex:!1},o=>{const s=[...e.operations[r]],a=Le(s);o.action=Yr(r);const u=a.at(-1);let l=u?.index??-1;const h=u?.action.type!=="NOOP";h?l=l+1:o.reuseLastOperationIndex=!0;const _=h?[...a,{index:l,skip:0}]:a;if(o.skip=xl(_),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 tp(e,t,n){const{scope:r,input:i}=t;return Rn({document:e,action:t,skip:n,reuseLastOperationIndex:!1},s=>{if(s.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(s.document.clipboard.length<1)throw new Error("Cannot redo: no operations in the clipboard");const a=s.document.clipboard.findLastIndex(l=>l.action.scope===r);if(a<0)throw new Error(`Cannot redo: no operations in clipboard for scope "${r}"`);const u=s.document.clipboard.splice(a,1)[0];s.action={type:u.action.type,scope:u.action.scope,input:u.action.input}})}function np(e,t){return{...e,header:{...e.header,name:t.state.name},state:t.state.data}}function Bt(e,t,n,r,i,o=li,s={},a){const u=pi(n,o);return ei(e,t,u,r,i,s,a)}function rp(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 a=o.sort((h,_)=>h.index-_.index).at(-1)?.index??-1,u=n?a:a+1,l=ll(t,u,r);return o.push(l),{...e,operations:{...e.operations,[i]:o}}}function ip(e,t,n=!1,r=0){const i=t.action.scope,o=e.operations[i],s=o?o.slice():[],u=s.sort((_,b)=>_.index-b.index).at(-1)?.index??-1,l=n?u:u+1;if(t.index-r>l)throw new Error(`Missing operations: expected ${l} with skip 0 or equivalent, got index ${t.index} with skip ${r}`);const h=pl(t,r);return s.push(h),{...e,operations:{...e.operations,[i]:s}}}function op(e,t,n=!1,r=0,i){let o;return i?o=ip(e,i,n,r):o=rp(e,t,n,r),o=ni(o,t.scope),o}function sp(e,t,n){const r=Qc().parse(t);switch(r.type){case"SET_NAME":return Ql(e,r.input);case"PRUNE":return lp(e,r.input,n);case"LOAD_STATE":return np(e,r.input);default:return e}}function ap(e,t,n){switch(t.type){case"UNDO":return ep(e,t,n);case"REDO":return tp(e,t,n);default:return{document:e,action:t,skip:n,reuseLastOperationIndex:!1}}}function up(e,t,n,r,i=!1,o=Sn){const s=t.scope,a=e.operations[s];if(!a)return e;const u=a.at(-1);if(!u)return e;const l=jt({...e.operations,[s]:Il(a,u)});let h;const b=l[s]?.at(-1);if(i&&b?.resultingState)h=o(b.resultingState);else{const{state:d}=Bt(e.initialState,l,n,void 0,void 0,void 0,void 0,{reuseOperationResultingState:i,operationResultingStateParser:o});h=d[s]}return{...e,state:{...e.state,[s]:h},operations:jt({...e.operations})}}function cp(e,t,n,r=!1,i=Sn){const o=e.operations[t];if(!o)return e;const s=[...o],a=Le(s);a.pop();const u=jt({...e.operations}),l=u[t];if(!l)return e;const h=[...l],_=zl($e(a),h),b=Bt(e.initialState,u,n,void 0,void 0,void 0,void 0,{reuseOperationResultingState:r,operationResultingStateParser:i}),d=Le([...e.clipboard,..._].filter(y=>y.action.type!=="NOOP")).reverse();return{...b,clipboard:d}}function li(e,t,n,r,i={}){const{skip:o,ignoreSkipOperations:s=!1,reuseOperationResultingState:a=!1,operationResultingStateParser:u,pruneOnSkip:l=!0}=i;let h=cl(t),_=o??i.replayOptions?.operation.skip??0,b={...e},d=!1;const y=!s&&_>0;if(wl(h)){const{skip:w,action:x,document:O,reuseLastOperationIndex:T}=ap(e,h,_);h=x,_=w,b=O,d=T}else b={...b,clipboard:[]};if(qr(h)&&(b=sp(b,h,n)),b=op(b,h,d,_,i.replayOptions?.operation),El(t))return cp(b,t.scope,n);if(y){const w=up(b,h,n,_,a,u);l?b=w:b={...w,operations:b.operations}}if(b=Rn(b,w=>{try{const x=n(w.state,h,r);x&&Gl(()=>{w.state=x})}catch(x){const O=b.operations[h.scope];if(!O)throw new Error(`No operations found for scope: ${h.scope}`);const T=O.length-1,C=w.operations[h.scope];if(!C)throw new Error(`No operations found in draft for scope: ${h.scope}`);if(C[T].error=x.message,C[T].skip=0,y){w.state={...e.state};const F=e.operations[h.scope];if(!F)throw new Error(`No operations found for scope: ${h.scope}`);w.operations={...e.operations,[h.scope]:[...F,{...C[T]}]}}}}),["UNDO","REDO","PRUNE"].includes(h.type))return b;const f=h.scope||"global";let E=vn(b,f);i.replayOptions?.operation.hash&&i.replayOptions.operation.hash!==""&&(E=i.replayOptions.operation.hash);const m=b.operations[f]?.at(-1);return m&&(m.hash=E,a&&(m.resultingState=JSON.stringify(b.state[f]))),b}function pi(e,t=li){return(r,i,o,s)=>t(r,i,e,o,s)}function lp(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 s=r.slice(i,o),a=r.slice(0,i),u=r.slice(o),l=Bt(e.initialState,{...e.operations,global:a.concat(s)},n),h=l.state,_=l.header.name,b=a.length,d=a.length?a[a.length-1].timestampUtcMs:u.length?u[0].timestampUtcMs:new Date().toISOString(),y=Jr({name:_,...h},s.length);return Bt(e.initialState,{...e.operations,global:[...a,{skip:0,...y,action:y,timestampUtcMs:d,index:b,hash:vn({state:h},"global")},...u.map((f,E)=>({...f,index:b+E+1}))]},n)}const pp="sha1",dp="base64";function di(){return{}}function fi(){return{version:"1.0.0",hash:{algorithm:pp,encoding:dp}}}function Dn(){return{auth:di(),document:fi()}}function fp(e){return{...di(),...e}}function hp(e){return{...fi(),...e}}function mp(e,t){return{auth:fp(e),document:hp(t)}}function hi(){return te({__typename:ke("AddChangeLogItemInput").optional(),content:$(),id:$(),insertBefore:$().nullable()})}function mi(){return te({description:$().nullish(),id:$(),name:$()})}function gi(){return te({errorCode:$().nullish(),errorDescription:$().nullish(),errorName:$().nullish(),errorTemplate:$().nullish(),id:$(),operationId:$()})}function gp(){return te({example:$(),id:$(),operationId:$()})}function _i(){return te({description:$().nullish(),id:$(),moduleId:$(),name:$(),reducer:$().nullish(),schema:$().nullish(),template:$().nullish(),scope:Ye().nullish()})}function bi(){return te({scope:$(),example:$(),id:$(),insertBefore:$().nullish()})}function _p(){return te({__typename:ke("Author").optional(),name:$(),website:$().nullable()})}function yi(){return te({__typename:ke("CodeExample").optional(),id:$(),value:$()})}function wi(){return te({__typename:ke("DeleteChangeLogItemInput").optional(),id:$()})}function Ei(){return te({id:$()})}function vi(){return te({id:$()})}function bp(){return te({id:$()})}function Si(){return te({id:$()})}function Oi(){return te({scope:$(),id:$()})}function yp(){return te({__typename:ke("DocumentModelGlobalState").optional(),author:_p(),description:$(),extension:$(),id:$(),name:$(),specifications:xe(wp())})}function wp(){return te({__typename:ke("DocumentSpecification").optional(),changeLog:xe($()),modules:xe(Ep()),state:xp(),version:ot().int()})}function Ep(){return te({__typename:ke("ModuleSpecification").optional(),description:$().nullable(),id:$(),name:$(),operations:xe(vp())})}function xi(){return te({newModuleId:$(),operationId:$()})}function vp(){return te({__typename:ke("OperationSpecification").optional(),description:$().nullable(),errors:xe(Sp()),examples:xe(yi()),id:$(),name:$().nullable(),reducer:$().nullable(),schema:$().nullable(),template:$().nullable(),scope:Ye()})}function Sp(){return te({__typename:ke("OperationErrorSpecification").optional(),code:$().nullable(),description:$().nullable(),id:$(),name:$().nullable(),template:$().nullable()})}function Ii(){return te({__typename:ke("ReorderChangeLogItemsInput").optional(),order:xe($())})}function ki(){return te({moduleId:$(),order:xe($())})}function Ai(){return te({order:xe($())})}function zi(){return te({operationId:$(),order:xe($())})}function Op(){return te({operationId:$(),order:xe($())})}function Ti(){return te({scope:$(),order:xe($())})}function Ri(){return te({authorName:$()})}function Di(){return te({authorWebsite:$()})}function Ci(){return te({scope:$(),initialValue:$()})}function Ni(){return te({description:$()})}function Pi(){return te({extension:$()})}function Mi(){return te({id:$()})}function $i(){return te({name:$()})}function Zi(){return te({description:$().nullish(),id:$()})}function Li(){return te({id:$(),name:$().nullish()})}function ji(){return te({description:$().nullish(),id:$()})}function Ui(){return te({errorCode:$().nullish(),id:$()})}function Fi(){return te({errorDescription:$().nullish(),id:$()})}function Bi(){return te({errorName:$().nullish(),id:$()})}function Wi(){return te({errorTemplate:$().nullish(),id:$()})}function Hi(){return te({id:$(),name:$().nullish()})}function Vi(){return te({id:$(),scope:Ye()})}function Gi(){return te({id:$(),reducer:$().nullish()})}function Ki(){return te({id:$(),schema:$().nullish()})}function Xi(){return te({id:$(),template:$().nullish()})}function Ji(){return te({scope:$(),schema:$()})}function dr(){return te({__typename:ke("State").optional(),examples:xe(yi()),initialValue:$(),schema:$()})}function xp(){return te({global:dr(),local:dr()})}function Yi(){return te({__typename:ke("UpdateChangeLogItemInput").optional(),id:$(),newContent:$()})}function Ip(){return te({example:$(),id:$()})}function qi(){return te({scope:$(),id:$(),newExample:$()})}const kp=e=>ae("SET_NAME",e,void 0,Kr,"global"),Ap=e=>ae("SET_MODEL_NAME",{...e},void 0,$i,"global"),zp=e=>ae("SET_MODEL_ID",{...e},void 0,Mi,"global"),Tp=e=>ae("SET_MODEL_EXTENSION",{...e},void 0,Pi,"global"),Rp=e=>ae("SET_MODEL_DESCRIPTION",{...e},void 0,Ni,"global"),Dp=e=>ae("SET_AUTHOR_NAME",{...e},void 0,Ri,"global"),Cp=e=>ae("SET_AUTHOR_WEBSITE",{...e},void 0,Di,"global"),Np=e=>ae("ADD_MODULE",{...e},void 0,mi,"global"),Pp=e=>ae("SET_MODULE_NAME",{...e},void 0,Li,"global"),Mp=e=>ae("SET_MODULE_DESCRIPTION",{...e},void 0,Zi,"global"),$p=e=>ae("DELETE_MODULE",{...e},void 0,Ei,"global"),Zp=e=>ae("REORDER_MODULES",{...e},void 0,Ai,"global"),Lp=e=>ae("ADD_OPERATION",{...e},void 0,_i,"global"),jp=e=>ae("SET_OPERATION_NAME",{...e},void 0,Hi,"global"),Up=e=>ae("SET_OPERATION_SCOPE",{...e},void 0,Vi,"global"),Fp=e=>ae("SET_OPERATION_SCHEMA",{...e},void 0,Ki,"global"),Bp=e=>ae("SET_OPERATION_DESCRIPTION",{...e},void 0,ji,"global"),Wp=e=>ae("SET_OPERATION_TEMPLATE",{...e},void 0,Xi,"global"),Hp=e=>ae("SET_OPERATION_REDUCER",{...e},void 0,Gi,"global"),Vp=e=>ae("MOVE_OPERATION",{...e},void 0,xi,"global"),Gp=e=>ae("DELETE_OPERATION",{...e},void 0,Si,"global"),Kp=e=>ae("REORDER_MODULE_OPERATIONS",{...e},void 0,ki,"global"),Xp=e=>ae("ADD_OPERATION_ERROR",{...e},void 0,gi,"global"),Jp=e=>ae("SET_OPERATION_ERROR_CODE",{...e},void 0,Ui,"global"),Yp=e=>ae("SET_OPERATION_ERROR_NAME",{...e},void 0,Bi,"global"),qp=e=>ae("SET_OPERATION_ERROR_DESCRIPTION",{...e},void 0,Fi,"global"),Qp=e=>ae("SET_OPERATION_ERROR_TEMPLATE",{...e},void 0,Wi,"global"),ed=e=>ae("DELETE_OPERATION_ERROR",{...e},void 0,vi,"global"),td=e=>ae("REORDER_OPERATION_ERRORS",{...e},void 0,zi,"global"),nd=e=>ae("SET_STATE_SCHEMA",{...e},void 0,Ji,"global"),rd=e=>ae("SET_INITIAL_STATE",{...e},void 0,Ci,"global"),id=e=>ae("ADD_STATE_EXAMPLE",{...e},void 0,bi,"global"),od=e=>ae("UPDATE_STATE_EXAMPLE",{...e},void 0,qi,"global"),sd=e=>ae("DELETE_STATE_EXAMPLE",{...e},void 0,Oi,"global"),ad=e=>ae("REORDER_STATE_EXAMPLES",{...e},void 0,Ti,"global"),ud=e=>ae("ADD_CHANGE_LOG_ITEM",{...e},void 0,hi,"global"),cd=e=>ae("UPDATE_CHANGE_LOG_ITEM",{...e},void 0,Yi,"global"),ld=e=>ae("DELETE_CHANGE_LOG_ITEM",{...e},void 0,wi,"global"),pd=e=>ae("REORDER_CHANGE_LOG_ITEMS",{...e},void 0,Ii,"global"),dd=()=>ae("RELEASE_NEW_VERSION",{},void 0,void 0,"global"),fd={setName:kp,undo:sl,redo:al,prune:ul,loadState:Jr,noop:Yr},hd={setModelName:Ap,setModelId:zp,setModelExtension:Tp,setModelDescription:Rp,setAuthorName:Dp,setAuthorWebsite:Cp,addModule:Np,setModuleName:Pp,setModuleDescription:Mp,deleteModule:$p,reorderModules:Zp,addOperation:Lp,setOperationName:jp,setOperationScope:Up,setOperationSchema:Fp,setOperationDescription:Bp,setOperationTemplate:Wp,setOperationReducer:Hp,moveOperation:Vp,deleteOperation:Gp,reorderModuleOperations:Kp,addOperationError:Xp,setOperationErrorCode:Jp,setOperationErrorName:Yp,setOperationErrorDescription:qp,setOperationErrorTemplate:Qp,deleteOperationError:ed,reorderOperationErrors:td,setStateSchema:nd,setInitialState:rd,addStateExample:id,updateStateExample:od,deleteStateExample:sd,reorderStateExamples:ad,addChangeLogItem:ud,updateChangeLogItem:cd,deleteChangeLogItem:ld,reorderChangeLogItems:pd,releaseNewVersion:dd},md={...fd,...hd},gd="phdm",_d={},bd={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},yd={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 {
|
|
42
|
+
id: ID!
|
|
43
|
+
value: String!
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type OperationError {
|
|
47
|
+
id: ID!
|
|
48
|
+
code: String
|
|
49
|
+
name: String
|
|
50
|
+
description: String
|
|
51
|
+
template: String
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
type Operation {
|
|
55
|
+
id: ID!
|
|
56
|
+
name: String
|
|
57
|
+
schema: String
|
|
58
|
+
description: String
|
|
59
|
+
template: String
|
|
60
|
+
errors: [OperationError!]!
|
|
61
|
+
examples: [CodeExample!]!
|
|
62
|
+
reducer: String
|
|
63
|
+
scope: String
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
type Module {
|
|
67
|
+
id: ID!
|
|
68
|
+
name: String!
|
|
69
|
+
description: String
|
|
70
|
+
operations: [Operation!]!
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
type State {
|
|
74
|
+
schema: String!
|
|
75
|
+
initialValue: String!
|
|
76
|
+
examples: [CodeExample!]!
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
type ScopeState {
|
|
80
|
+
global: State!
|
|
81
|
+
local: State!
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
type Author {
|
|
85
|
+
name: String!
|
|
86
|
+
website: String
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
type DocumentSpecification {
|
|
90
|
+
version: Int!
|
|
91
|
+
state: ScopeState!
|
|
92
|
+
modules: [Module!]!
|
|
93
|
+
changeLog: [String!]!
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
type DocumentModelGlobalState {
|
|
97
|
+
name: String!
|
|
98
|
+
id: String!
|
|
99
|
+
extension: String!
|
|
100
|
+
description: String!
|
|
101
|
+
author: Author!
|
|
102
|
+
specifications: [DocumentSpecification!]!
|
|
103
|
+
}`,initialValue:`{
|
|
104
|
+
"id": "",
|
|
105
|
+
"name": "",
|
|
106
|
+
"extension": "",
|
|
107
|
+
"description": "",
|
|
108
|
+
"author": {
|
|
109
|
+
"name": "",
|
|
110
|
+
"website": ""
|
|
111
|
+
},
|
|
112
|
+
"specifications": [
|
|
113
|
+
{
|
|
114
|
+
"version": 1,
|
|
115
|
+
"changeLog": [],
|
|
116
|
+
"state": {
|
|
117
|
+
"schema": "",
|
|
118
|
+
"initialValue": "",
|
|
119
|
+
"examples": []
|
|
120
|
+
},
|
|
121
|
+
"modules": []
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}`,examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[{name:"header",operations:[{name:"SET_MODEL_NAME",id:"",description:"Sets the name of the document model",schema:`input SetModelNameInput {
|
|
125
|
+
name: String!
|
|
126
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_MODEL_ID",id:"",description:"Sets the unique identifier for the document model",schema:`input SetModelIdInput {
|
|
127
|
+
id: String!
|
|
128
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_MODEL_EXTENSION",id:"",description:"Sets the file extension associated with this document model",schema:`input SetModelExtensionInput {
|
|
129
|
+
extension: String!
|
|
130
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_MODEL_DESCRIPTION",id:"",description:"Sets the description text for the document model",schema:`input SetModelDescriptionInput {
|
|
131
|
+
description: String!
|
|
132
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_AUTHOR_NAME",id:"",description:"Sets the name of the document model author",schema:`input SetAuthorNameInput {
|
|
133
|
+
authorName: String!
|
|
134
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_AUTHOR_WEBSITE",id:"",description:"Sets the website URL of the document model author",schema:`input SetAuthorWebsiteInput {
|
|
135
|
+
authorWebsite: String!
|
|
136
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"versioning",operations:[{name:"ADD_CHANGE_LOG_ITEM",id:"",description:"Adds a new item to the document model changelog",schema:`input AddChangeLogItemInput {
|
|
137
|
+
id: ID!
|
|
138
|
+
insertBefore: ID
|
|
139
|
+
content: String!
|
|
140
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UPDATE_CHANGE_LOG_ITEM",id:"",description:"Updates an existing changelog item",schema:`input UpdateChangeLogItemInput {
|
|
141
|
+
id: ID!
|
|
142
|
+
newContent: String!
|
|
143
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DELETE_CHANGE_LOG_ITEM",id:"",description:"Removes an item from the document model changelog",schema:`input DeleteChangeLogItemInput {
|
|
144
|
+
id: ID!
|
|
145
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"REORDER_CHANGE_LOG_ITEMS",id:"",description:"Changes the order of changelog items",schema:`input ReorderChangeLogItemsInput {
|
|
146
|
+
order: [ID!]!
|
|
147
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"RELEASE_NEW_VERSION",schema:null,id:"",description:"Creates a new version of the document model specification",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"module",operations:[{name:"ADD_MODULE",id:"",description:"Adds a new module to the document model specification",schema:`input AddModuleInput {
|
|
148
|
+
id: ID!
|
|
149
|
+
name: String!
|
|
150
|
+
description: String
|
|
151
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_MODULE_NAME",id:"",description:"Sets the name of an existing module",schema:`input SetModuleNameInput {
|
|
152
|
+
id: ID!
|
|
153
|
+
name: String
|
|
154
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_MODULE_DESCRIPTION",id:"",description:"Sets the description of an existing module",schema:`input SetModuleDescriptionInput {
|
|
155
|
+
id: ID!
|
|
156
|
+
description: String
|
|
157
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DELETE_MODULE",id:"",description:"Removes a module from the document model specification",schema:`input DeleteModuleInput {
|
|
158
|
+
id: ID!
|
|
159
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"REORDER_MODULES",id:"",description:"Changes the order of modules in the document model specification",schema:`input ReorderModulesInput {
|
|
160
|
+
order: [ID!]!
|
|
161
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"operation-error",operations:[{name:"ADD_OPERATION_ERROR",id:"",description:"Adds a new error definition to an operation",schema:`input AddOperationErrorInput {
|
|
162
|
+
operationId: ID!
|
|
163
|
+
id: ID!
|
|
164
|
+
errorCode: String
|
|
165
|
+
errorName: String
|
|
166
|
+
errorDescription: String
|
|
167
|
+
errorTemplate: String
|
|
168
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_ERROR_CODE",id:"",description:"Sets the error code for an operation error",schema:`input SetOperationErrorCodeInput {
|
|
169
|
+
id: ID!
|
|
170
|
+
errorCode: String
|
|
171
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_ERROR_NAME",id:"",description:"Sets the name of an operation error",schema:`input SetOperationErrorNameInput {
|
|
172
|
+
id: ID!
|
|
173
|
+
errorName: String
|
|
174
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_ERROR_DESCRIPTION",id:"",description:"Sets the description of an operation error",schema:`input SetOperationErrorDescriptionInput {
|
|
175
|
+
id: ID!
|
|
176
|
+
errorDescription: String
|
|
177
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_ERROR_TEMPLATE",id:"",description:"Sets the template for an operation error",schema:`input SetOperationErrorTemplateInput {
|
|
178
|
+
id: ID!
|
|
179
|
+
errorTemplate: String
|
|
180
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DELETE_OPERATION_ERROR",id:"",description:"Removes an error definition from an operation",schema:`input DeleteOperationErrorInput {
|
|
181
|
+
id: ID!
|
|
182
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"REORDER_OPERATION_ERRORS",id:"",description:"Changes the order of error definitions for an operation",schema:`input ReorderOperationErrorsInput {
|
|
183
|
+
operationId: ID!
|
|
184
|
+
order: [ID!]!
|
|
185
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"operation-example",operations:[{name:"ADD_OPERATION_EXAMPLE",id:"",description:"Adds a new code example to an operation",schema:`input AddOperationExampleInput {
|
|
186
|
+
operationId: ID!
|
|
187
|
+
id: ID!
|
|
188
|
+
example: String!
|
|
189
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UPDATE_OPERATION_EXAMPLE",id:"",description:"Updates an existing code example for an operation",schema:`input UpdateOperationExampleInput {
|
|
190
|
+
id: ID!
|
|
191
|
+
example: String!
|
|
192
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DELETE_OPERATION_EXAMPLE",id:"",description:"Removes a code example from an operation",schema:`input DeleteOperationExampleInput {
|
|
193
|
+
id: ID!
|
|
194
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"REORDER_OPERATION_EXAMPLES",id:"",description:"Changes the order of code examples for an operation",schema:`input ReorderOperationExamplesInput {
|
|
195
|
+
operationId: ID!
|
|
196
|
+
order: [ID!]!
|
|
197
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"operation",operations:[{name:"ADD_OPERATION",id:"",description:"Adds a new operation to a module",schema:`input AddOperationInput {
|
|
198
|
+
moduleId: ID!
|
|
199
|
+
id: ID!
|
|
200
|
+
name: String!
|
|
201
|
+
schema: String
|
|
202
|
+
description: String
|
|
203
|
+
template: String
|
|
204
|
+
reducer: String
|
|
205
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_NAME",id:"",description:"Sets the name of an operation",schema:`input SetOperationNameInput {
|
|
206
|
+
id: ID!
|
|
207
|
+
name: String
|
|
208
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_SCHEMA",id:"",description:"Sets the GraphQL schema definition for an operation's input",schema:`input SetOperationSchemaInput {
|
|
209
|
+
id: ID!
|
|
210
|
+
schema: String
|
|
211
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_DESCRIPTION",id:"",description:"Sets the description of an operation",schema:`input SetOperationDescriptionInput {
|
|
212
|
+
id: ID!
|
|
213
|
+
description: String
|
|
214
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_TEMPLATE",id:"",description:"Sets the template code for an operation",schema:`input SetOperationTemplateInput {
|
|
215
|
+
id: ID!
|
|
216
|
+
template: String
|
|
217
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_OPERATION_REDUCER",id:"",description:"Sets the reducer function code for an operation",schema:`input SetOperationReducerInput {
|
|
218
|
+
id: ID!
|
|
219
|
+
reducer: String
|
|
220
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"MOVE_OPERATION",id:"",description:"Moves an operation from one module to another",schema:`input MoveOperationInput {
|
|
221
|
+
operationId: ID!
|
|
222
|
+
newModuleId: ID!
|
|
223
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DELETE_OPERATION",id:"",description:"Removes an operation from a module",schema:`input DeleteOperationInput {
|
|
224
|
+
id: ID!
|
|
225
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"REORDER_MODULE_OPERATIONS",id:"",description:"Changes the order of operations within a module",schema:`input ReorderModuleOperationsInput {
|
|
226
|
+
moduleId: ID!
|
|
227
|
+
order: [ID!]!
|
|
228
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"state",operations:[{name:"SET_STATE_SCHEMA",id:"",description:"Sets the GraphQL schema definition for document state",schema:`input SetStateSchemaInput {
|
|
229
|
+
scope: String!
|
|
230
|
+
schema: String!
|
|
231
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SET_INITIAL_STATE",id:"",description:"Sets the initial state value for a document scope",schema:`input SetInitialStateInput {
|
|
232
|
+
scope: String!
|
|
233
|
+
initialValue: String!
|
|
234
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ADD_STATE_EXAMPLE",id:"",description:"Adds a new state example to a document scope",schema:`input AddStateExampleInput {
|
|
235
|
+
scope: String!
|
|
236
|
+
id: ID!
|
|
237
|
+
insertBefore: ID
|
|
238
|
+
example: String!
|
|
239
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UPDATE_STATE_EXAMPLE",id:"",description:"Updates an existing state example for a document scope",schema:`input UpdateStateExampleInput {
|
|
240
|
+
scope: String!
|
|
241
|
+
id: ID!
|
|
242
|
+
newExample: String!
|
|
243
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DELETE_STATE_EXAMPLE",id:"",description:"Removes a state example from a document scope",schema:`input DeleteStateExampleInput {
|
|
244
|
+
scope: String!
|
|
245
|
+
id: ID!
|
|
246
|
+
}`,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 {
|
|
247
|
+
scope: String!
|
|
248
|
+
order: [ID!]!
|
|
249
|
+
}`,template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""}]}]},Qi="powerhouse/document-model",wd=te({id:$(),name:$(),createdAtUtcIso:$(),lastModifiedAtUtcIso:$(),documentType:$()}),Ed=te({global:Lt()}),vd=wd.extend({documentType:ke(Qi)}),Wt=Ed.extend({global:yp()}),eo=te({header:vd,state:Wt,initialState:Wt});function Sd(e){return Wt.safeParse(e).success}function Od(e){Wt.parse(e)}function xd(e){return eo.safeParse(e).success}function Id(e){eo.parse(e)}function Et(e){const t={};return e.forEach((n,r)=>t[n]=r),(n,r)=>(t[r.id]||999999)-(t[n.id]||999999)}const Qe={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}},ft={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(Et(t.input.order))}},He={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(Et(t.input.order))}},Ct={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(Et(t.input.order))}},Ne={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(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(Et(t.input.order))}},et={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(Et(t.input.order));else throw new Error(`Invalid scope: ${t.input.scope}`)}},ht={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')}},kd=(e,t)=>{if(qr(t))return e;switch(t.type){case"SET_MODEL_NAME":$i().parse(t.input),Qe.setModelNameOperation(e.global,t);break;case"SET_MODEL_ID":Mi().parse(t.input),Qe.setModelIdOperation(e.global,t);break;case"SET_MODEL_EXTENSION":Pi().parse(t.input),Qe.setModelExtensionOperation(e.global,t);break;case"SET_MODEL_DESCRIPTION":Ni().parse(t.input),Qe.setModelDescriptionOperation(e.global,t);break;case"SET_AUTHOR_NAME":Ri().parse(t.input),Qe.setAuthorNameOperation(e.global,t);break;case"SET_AUTHOR_WEBSITE":Di().parse(t.input),Qe.setAuthorWebsiteOperation(e.global,t);break;case"ADD_CHANGE_LOG_ITEM":hi().parse(t.input),ht.addChangeLogItemOperation(e.global,t);break;case"UPDATE_CHANGE_LOG_ITEM":Yi().parse(t.input),ht.updateChangeLogItemOperation(e.global,t);break;case"DELETE_CHANGE_LOG_ITEM":wi().parse(t.input),ht.deleteChangeLogItemOperation(e.global,t);break;case"REORDER_CHANGE_LOG_ITEMS":Ii().parse(t.input),ht.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");ht.releaseNewVersionOperation(e.global,t);break;case"ADD_MODULE":mi().parse(t.input),ft.addModuleOperation(e.global,t);break;case"SET_MODULE_NAME":Li().parse(t.input),ft.setModuleNameOperation(e.global,t);break;case"SET_MODULE_DESCRIPTION":Zi().parse(t.input),ft.setModuleDescriptionOperation(e.global,t);break;case"DELETE_MODULE":Ei().parse(t.input),ft.deleteModuleOperation(e.global,t);break;case"REORDER_MODULES":Ai().parse(t.input),ft.reorderModulesOperation(e.global,t);break;case"ADD_OPERATION_ERROR":gi().parse(t.input),He.addOperationErrorOperation(e.global,t);break;case"SET_OPERATION_ERROR_CODE":Ui().parse(t.input),He.setOperationErrorCodeOperation(e.global,t);break;case"SET_OPERATION_ERROR_NAME":Bi().parse(t.input),He.setOperationErrorNameOperation(e.global,t);break;case"SET_OPERATION_ERROR_DESCRIPTION":Fi().parse(t.input),He.setOperationErrorDescriptionOperation(e.global,t);break;case"SET_OPERATION_ERROR_TEMPLATE":Wi().parse(t.input),He.setOperationErrorTemplateOperation(e.global,t);break;case"DELETE_OPERATION_ERROR":vi().parse(t.input),He.deleteOperationErrorOperation(e.global,t);break;case"REORDER_OPERATION_ERRORS":zi().parse(t.input),He.reorderOperationErrorsOperation(e.global,t);break;case"ADD_OPERATION_EXAMPLE":gp().parse(t.input),Ct.addOperationExampleOperation(e.global,t);break;case"UPDATE_OPERATION_EXAMPLE":Ip().parse(t.input),Ct.updateOperationExampleOperation(e.global,t);break;case"DELETE_OPERATION_EXAMPLE":bp().parse(t.input),Ct.deleteOperationExampleOperation(e.global,t);break;case"REORDER_OPERATION_EXAMPLES":Op().parse(t.input),Ct.reorderOperationExamplesOperation(e.global,t);break;case"ADD_OPERATION":_i().parse(t.input),Ne.addOperationOperation(e.global,t);break;case"SET_OPERATION_NAME":Hi().parse(t.input),Ne.setOperationNameOperation(e.global,t);break;case"SET_OPERATION_SCOPE":Vi().parse(t.input),Ne.setOperationScopeOperation(e.global,t);break;case"SET_OPERATION_SCHEMA":Ki().parse(t.input),Ne.setOperationSchemaOperation(e.global,t);break;case"SET_OPERATION_DESCRIPTION":ji().parse(t.input),Ne.setOperationDescriptionOperation(e.global,t);break;case"SET_OPERATION_TEMPLATE":Xi().parse(t.input),Ne.setOperationTemplateOperation(e.global,t);break;case"SET_OPERATION_REDUCER":Gi().parse(t.input),Ne.setOperationReducerOperation(e.global,t);break;case"MOVE_OPERATION":xi().parse(t.input),Ne.moveOperationOperation(e.global,t);break;case"DELETE_OPERATION":Si().parse(t.input),Ne.deleteOperationOperation(e.global,t);break;case"REORDER_MODULE_OPERATIONS":ki().parse(t.input),Ne.reorderModuleOperationsOperation(e.global,t);break;case"SET_STATE_SCHEMA":Ji().parse(t.input),et.setStateSchemaOperation(e.global,t);break;case"SET_INITIAL_STATE":Ci().parse(t.input),et.setInitialStateOperation(e.global,t);break;case"ADD_STATE_EXAMPLE":bi().parse(t.input),et.addStateExampleOperation(e.global,t);break;case"UPDATE_STATE_EXAMPLE":qi().parse(t.input),et.updateStateExampleOperation(e.global,t);break;case"DELETE_STATE_EXAMPLE":Oi().parse(t.input),et.deleteStateExampleOperation(e.global,t);break;case"REORDER_STATE_EXAMPLES":Ti().parse(t.input),et.reorderStateExamplesOperation(e.global,t);break;default:return e}},to=pi(kd),Ad=(e,t)=>Ml(e,t),zd=e=>$l(e,to),no=e=>({...Dn(),global:{...bd,...e?.global??{}},local:{..._d,...e?.local??{}}});function Td(){return{...Dn(),author:{name:"",website:""},description:"",extension:"",id:"",name:"",specifications:[]}}function Rd(){return{}}function Dd(e){return{...Td(),...e||{}}}function Cd(e){return{...Rd()}}function Nd(e,t,n){return{...mp(e?.auth,e?.document),global:Dd(t),local:Cd()}}function Pd(e){const t=Qr(no,e);return t.header.documentType=Qi,t}const Md=e=>Sd(e),$d=e=>{Od(e)},Zd=e=>xd(e),Ld=e=>{Id(e)},jd={fileExtension:gd,createState:no,createDocument:Pd,loadFromInput:zd,saveToFileHandle:Ad,isStateOfType:Md,assertIsStateOfType:$d,isDocumentOfType:Zd,assertIsDocumentOfType:Ld},sf={reducer:to,documentModel:Nd(Dn(),yd),actions:md,utils:jd},Ud=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),Fd=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),Bd=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),Wd=/[^\p{L}\d]+/giu,fr="$1\0$2",hr="";function ro(e){let t=e.trim();t=t.replace(Ud,fr).replace(Fd,fr),t=t.replace(Wd,"\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 Hd(e){const t=ro(e);for(let n=0;n<t.length;n++){const r=t[n],i=Bd.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 Vd(e,t){const[n,r,i]=vt(e,t);return n+r.map(Xt(t?.locale)).join(t?.delimiter??" ")+i}function mr(e,t){const[n,r,i]=vt(e,t),o=Xt(t?.locale),s=Jt(t?.locale),a=t?.mergeAmbiguousCharacters?Cn(o,s):Gd(o,s);return n+r.map(a).join(t?.delimiter??"")+i}function af(e,t){const[n,r,i]=vt(e,t),o=Xt(t?.locale),s=Jt(t?.locale);return n+r.map(Cn(o,s)).join(" ")+i}function uf(e,t){const[n,r,i]=vt(e,t);return n+r.map(Jt(t?.locale)).join("_")+i}function cf(e,t){const[n,r,i]=vt(e,t),o=Xt(t?.locale),s=Jt(t?.locale),a=Cn(o,s);return n+r.map((u,l)=>l===0?a(u):o(u)).join(" ")+i}function lf(e,t){return Vd(e,{delimiter:"_",...t})}function Xt(e){return e===!1?t=>t.toLowerCase():t=>t.toLocaleLowerCase(e)}function Jt(e){return e===!1?t=>t.toUpperCase():t=>t.toLocaleUpperCase(e)}function Cn(e,t){return n=>`${t(n[0])}${e(n.slice(1))}`}function Gd(e,t){return(n,r)=>{const i=n[0];return(r>0&&i>="0"&&i<="9"?"_"+i:t(i))+e(n.slice(1))}}function vt(e,t={}){const n=t.split??(t.separateNumbers?Hd:ro),r=t.prefixCharacters??hr,i=t.suffixCharacters??hr;let o=0,s=e.length;for(;o<e.length;){const a=e.charAt(o);if(!r.includes(a))break;o++}for(;s>o;){const a=s-1,u=e.charAt(a);if(!i.includes(u))break;s=a}return[e.slice(0,o),n(e.slice(o,s)),e.slice(s)]}function pf(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 df(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 ${mr(t)}${mr(n)}State`;return e.includes(o)||i.push({message:`Invalid state schema name. Expected ${o}`,details:{schema:e}}),i}function ff(e){const t=[];e.length||t.push({message:"Modules are required",details:{modules:e}});const n=e.reduce((r,i)=>[...r,...Kd(i)],[]);return[...t,...n]}function Kd(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,...Xd(i)],[]);return[...t,...n]}function Xd(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{Gp as $,nf as A,Ed as B,Sl as C,jt as D,ei as E,Il as F,zl as G,ef as H,Dt as I,lf as J,uf as K,cf as L,Ap as M,nd as N,zp as O,Rp as P,Tp as Q,Dp as R,Cp as S,rd as T,Np as U,Pp as V,$p as W,jp as X,Fp as Y,Bp as Z,at as _,xe as a,Xp as a0,ed as a1,Yp as a2,Lp as a3,af as a4,qd as a5,Qi as a6,Pl as a7,md as a8,pf as a9,df as aa,ff as ab,al as ac,sl as ad,sf as ae,Yd as b,qu as c,ae as d,pi as e,wd as f,Ml as g,$l as h,qr as i,Qr as j,En as k,ke as l,Dn as m,Nd as n,te as o,mr as p,yl as q,vn as r,$ as s,rf as t,jr as u,Qd as v,of as w,$e as x,Le as y,tf as z};
|