document-model 1.0.25 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/document-model.cjs +1 -1
- package/dist/browser/document-model.js +2 -2
- package/dist/browser/document.cjs +1 -1
- package/dist/browser/document.js +2 -2
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +3 -3
- package/dist/browser/internal/{index-TAPWNyA9.js → index-99f8b333.js} +16 -6
- package/dist/{node/internal/index-FmPDtpIY.js → browser/internal/index-df4df518.js} +1 -1
- package/dist/{node/internal/index-lh4jt_0f.js → browser/internal/index-e019b5aa.js} +1 -1
- package/dist/browser/internal/{index-3haD_DrE.js → index-ff67644b.js} +1 -1
- package/dist/browser/internal/{object-jGU_rY7z.js → object-4b5800c0.js} +348 -352
- package/dist/browser/internal/{object-1BuggAcr.js → object-be1b0c52.js} +2 -2
- package/dist/browser/src/document/schema/index.d.ts +2 -2
- package/dist/browser/src/document/schema/types.d.ts +8 -12
- package/dist/browser/src/document/signal.d.ts +1 -0
- package/dist/browser/src/document/utils/index.d.ts +1 -0
- package/dist/browser/src/document-model/custom/reducers/versioning.d.ts +4 -4
- package/dist/browser/vitest.config.d.ts +2 -0
- package/dist/node/document-model.cjs +1 -1
- package/dist/node/document-model.js +3 -3
- package/dist/node/document.cjs +1 -1
- package/dist/node/document.js +3 -3
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +4 -4
- package/dist/{browser/internal/index-7bSWIChK.js → node/internal/index-2d55ed8c.js} +1 -1
- package/dist/node/internal/{index-pZl431ni.js → index-433d6a9b.js} +1 -1
- package/dist/{browser/internal/index-DQNkZhvL.js → node/internal/index-78c035e1.js} +1 -1
- package/dist/node/internal/{index-GpOpKG2W.js → index-a46dcf07.js} +17 -7
- package/dist/node/internal/{object-evJm9vYN.js → object-305e4c59.js} +244 -248
- package/dist/node/internal/object-ff6617a2.js +1 -0
- package/dist/node/src/document/schema/index.d.ts +2 -2
- package/dist/node/src/document/schema/types.d.ts +8 -12
- package/dist/node/src/document/signal.d.ts +1 -0
- package/dist/node/src/document/utils/index.d.ts +1 -0
- package/dist/node/src/document-model/custom/reducers/versioning.d.ts +4 -4
- package/dist/node/vitest.config.d.ts +2 -0
- package/package.json +23 -17
- package/dist/browser/jest.config.d.ts +0 -8
- package/dist/node/internal/object-pZF_UDWv.js +0 -1
- package/dist/node/jest.config.d.ts +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var Oe=Object.defineProperty;var Te=(i,o,p)=>o in i?Oe(i,o,{enumerable:!0,configurable:!0,writable:!0,value:p}):i[o]=p;var K=(i,o,p)=>(Te(i,typeof o!="symbol"?o+"":o,p),p);const z=require("immer"),ze=require("json-stringify-deterministic"),g=require("zod"),Ot=require("jszip"),Tt=i=>i!=null,De=g.z.any().refine(i=>Tt(i)),zt=g.z.enum(["LOAD_STATE"]),Dt=g.z.enum(["PRUNE"]),Nt=g.z.enum(["REDO"]),Rt=g.z.enum(["SET_NAME"]),Mt=g.z.enum(["UNDO"]);function Ne(){return g.z.object({__typename:g.z.literal("Action").optional(),type:g.z.string()})}function P(){return g.z.literal("global").or(g.z.literal("local"))}function Ct(){return g.z.union([Lt(),$t(),Pt(),Jt(),Wt()])}function Re(){return g.z.object({__typename:g.z.literal("DocumentFile").optional(),data:g.z.string(),extension:g.z.string().nullable(),fileName:g.z.string().nullable(),mimeType:g.z.string()})}function Lt(){return g.z.object({input:g.z.lazy(()=>st()),type:zt,scope:P()})}function st(){return g.z.object({operations:g.z.number(),state:g.z.lazy(()=>qt())})}function qt(){return g.z.object({data:g.z.unknown().nullish(),name:g.z.string()})}function Me(){return g.z.object({__typename:g.z.literal("Operation").optional(),hash:g.z.string(),index:g.z.number(),timestamp:g.z.string().datetime(),type:g.z.string()})}function $t(){return g.z.object({input:g.z.lazy(()=>ct()),type:Dt,scope:P()})}function ct(){return g.z.object({end:g.z.number().nullish(),start:g.z.number().nullish()})}const lt=g.z.number;function Pt(){return g.z.object({input:lt(),type:Nt,scope:P()})}const ut=g.z.string;function Jt(){return g.z.object({input:ut(),type:Rt,scope:g.z.literal("global")})}function Ce(){return g.z.object({__typename:g.z.literal("SetNameOperation").optional(),hash:g.z.string(),index:g.z.number(),input:g.z.string(),timestamp:g.z.string().datetime(),type:g.z.string()})}const ft=g.z.number;function Wt(){return g.z.object({input:ft(),type:Mt,scope:P()})}const Le=Object.freeze(Object.defineProperty({__proto__:null,ActionSchema:Ne,BaseActionSchema:Ct,DocumentFileSchema:Re,LoadStateActionInputSchema:st,LoadStateActionSchema:Lt,LoadStateActionStateInputSchema:qt,Load_StateSchema:zt,OperationSchema:Me,OperationScopeSchema:P,PruneActionInputSchema:ct,PruneActionSchema:$t,PruneSchema:Dt,RedoActionInputSchema:lt,RedoActionSchema:Pt,RedoSchema:Nt,SetNameActionInputSchema:ut,SetNameActionSchema:Jt,SetNameOperationSchema:Ce,Set_NameSchema:Rt,UndoActionInputSchema:ft,UndoActionSchema:Wt,UndoSchema:Mt,definedNonNullAnySchema:De,isDefinedNonNullAny:Tt},Symbol.toStringTag,{value:"Module"}));function qe(i,o){return{...i,name:o}}function $e(i,o,p){const{scope:c,input:u}=o,h={document:i,action:o,skip:p};return z.produce(h,l=>{if(l.document.operations[c].length<1)throw new Error(`Cannot undo: no operations in history for scope "${c}"`);if(u<1)throw new Error("Invalid UNDO action: input value must be greater than 0");if(l.skip>0)throw new Error("Cannot undo: skip value from reducer cannot be used with UNDO action");const[a]=l.document.operations[c].slice(-1),x=a.type==="NOOP"&&a.skip>0;if(l.skip+=u,x&&(l.skip+=a.skip,l.document.operations[c].pop()),l.document.operations[c].length<l.skip)throw new Error("Cannot undo: you can't undo more operations than the ones in the scope history");const d=l.document.operations[c].length-1;let E=u,w=x?d-a.skip:d;for(;E>0&&w>=0;){const v=l.document.operations[c][w];v.type==="NOOP"&&v.skip>0?(w=w-(v.skip+1),l.skip+=v.skip+1):(l.document.clipboard.push({...v}),E--,w--)}l.action=vt(c)})}function Pe(i,o,p){const{scope:c,input:u}=o,h={document:i,action:o,skip:p};return z.produce(h,l=>{if(l.skip>0)throw new Error("Cannot redo: skip value from reducer cannot be used with REDO action");if(u>1)throw new Error("Cannot redo: you can only redo one operation at a time");if(u<1)throw new Error("Invalid REDO action: invalid redo input value");if(l.document.clipboard.length<1)throw new Error("Cannot redo: no operations in the clipboard");const a=l.document.clipboard.findLastIndex(d=>d.scope===c);if(a<0)throw new Error(`Cannot redo: no operations in clipboard for scope "${c}"`);const x=l.document.clipboard.splice(a,1)[0];l.action=z.castDraft({type:x.type,scope:x.scope,input:x.input})})}function Je(i,o,p){const{scope:c}=o,u=i.operations[c];let{input:{start:h,end:l}}=o;h=h||0,l=l||u.length;const a=u.slice(h,l),x=u.slice(0,h),d=u.slice(l),E=Y(i.initialState,{...i.operations,[c]:x.concat(a)},p),{name:w,state:v}=E,y=x.length,U=x.length?x[x.length-1].timestamp:d.length?d[0].timestamp:new Date().toISOString();return Y(i.initialState,{...i.operations,[c]:[...x,{...yt({name:w,state:v},a.length),timestamp:U,index:y,hash:gt({state:v},"global")},...d.map((I,q)=>({...I,index:y+q+1}))]},p)}function We(i,o){return{...i,name:o.name,state:o.state??{global:{},local:{}}}}const Ht="SET_NAME",C="UNDO",L="REDO",J="PRUNE",Zt="LOAD_STATE";function Kt(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function V(){this._types=Object.create(null),this._extensions=Object.create(null);for(let i=0;i<arguments.length;i++)this.define(arguments[i]);this.define=this.define.bind(this),this.getType=this.getType.bind(this),this.getExtension=this.getExtension.bind(this)}V.prototype.define=function(i,o){for(let p in i){let c=i[p].map(function(u){return u.toLowerCase()});p=p.toLowerCase();for(let u=0;u<c.length;u++){const h=c[u];if(h[0]!=="*"){if(!o&&h in this._types)throw new Error('Attempt to change mapping for "'+h+'" extension from "'+this._types[h]+'" to "'+p+'". Pass `force=true` to allow this, otherwise remove "'+h+'" from the list of extensions for "'+p+'".');this._types[h]=p}}if(o||!this._extensions[p]){const u=c[0];this._extensions[p]=u[0]!=="*"?u:u.substr(1)}}};V.prototype.getType=function(i){i=String(i);let o=i.replace(/^.*[/\\]/,"").toLowerCase(),p=o.replace(/^.*\./,"").toLowerCase(),c=o.length<i.length;return(p.length<o.length-1||!c)&&this._types[p]||null};V.prototype.getExtension=function(i){return i=/^\s*([^;\s]*)/.test(i)&&RegExp.$1,i&&this._extensions[i.toLowerCase()]||null};var He=V,Ze={"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["es","ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avif":["avif"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};let Ke=He;var Ye=new Ke(Ze);const Ve=Kt(Ye);var it={exports:{}};typeof Object.create=="function"?it.exports=function(o,p){p&&(o.super_=p,o.prototype=Object.create(p.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}))}:it.exports=function(o,p){if(p){o.super_=p;var c=function(){};c.prototype=p.prototype,o.prototype=new c,o.prototype.constructor=o}};var Xe=it.exports,nt={exports:{}},Yt={},X={};X.byteLength=tr;X.toByteArray=rr;X.fromByteArray=or;var T=[],j=[],Ge=typeof Uint8Array<"u"?Uint8Array:Array,rt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var M=0,Qe=rt.length;M<Qe;++M)T[M]=rt[M],j[rt.charCodeAt(M)]=M;j[45]=62;j[95]=63;function Vt(i){var o=i.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var p=i.indexOf("=");p===-1&&(p=o);var c=p===o?0:4-p%4;return[p,c]}function tr(i){var o=Vt(i),p=o[0],c=o[1];return(p+c)*3/4-c}function er(i,o,p){return(o+p)*3/4-p}function rr(i){var o,p=Vt(i),c=p[0],u=p[1],h=new Ge(er(i,c,u)),l=0,a=u>0?c-4:c,x;for(x=0;x<a;x+=4)o=j[i.charCodeAt(x)]<<18|j[i.charCodeAt(x+1)]<<12|j[i.charCodeAt(x+2)]<<6|j[i.charCodeAt(x+3)],h[l++]=o>>16&255,h[l++]=o>>8&255,h[l++]=o&255;return u===2&&(o=j[i.charCodeAt(x)]<<2|j[i.charCodeAt(x+1)]>>4,h[l++]=o&255),u===1&&(o=j[i.charCodeAt(x)]<<10|j[i.charCodeAt(x+1)]<<4|j[i.charCodeAt(x+2)]>>2,h[l++]=o>>8&255,h[l++]=o&255),h}function ir(i){return T[i>>18&63]+T[i>>12&63]+T[i>>6&63]+T[i&63]}function nr(i,o,p){for(var c,u=[],h=o;h<p;h+=3)c=(i[h]<<16&16711680)+(i[h+1]<<8&65280)+(i[h+2]&255),u.push(ir(c));return u.join("")}function or(i){for(var o,p=i.length,c=p%3,u=[],h=16383,l=0,a=p-c;l<a;l+=h)u.push(nr(i,l,l+h>a?a:l+h));return c===1?(o=i[p-1],u.push(T[o>>2]+T[o<<4&63]+"==")):c===2&&(o=(i[p-2]<<8)+i[p-1],u.push(T[o>>10]+T[o>>4&63]+T[o<<2&63]+"=")),u.join("")}var ht={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ht.read=function(i,o,p,c,u){var h,l,a=u*8-c-1,x=(1<<a)-1,d=x>>1,E=-7,w=p?u-1:0,v=p?-1:1,y=i[o+w];for(w+=v,h=y&(1<<-E)-1,y>>=-E,E+=a;E>0;h=h*256+i[o+w],w+=v,E-=8);for(l=h&(1<<-E)-1,h>>=-E,E+=c;E>0;l=l*256+i[o+w],w+=v,E-=8);if(h===0)h=1-d;else{if(h===x)return l?NaN:(y?-1:1)*(1/0);l=l+Math.pow(2,c),h=h-d}return(y?-1:1)*l*Math.pow(2,h-c)};ht.write=function(i,o,p,c,u,h){var l,a,x,d=h*8-u-1,E=(1<<d)-1,w=E>>1,v=u===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=c?0:h-1,U=c?1:-1,I=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(a=isNaN(o)?1:0,l=E):(l=Math.floor(Math.log(o)/Math.LN2),o*(x=Math.pow(2,-l))<1&&(l--,x*=2),l+w>=1?o+=v/x:o+=v*Math.pow(2,1-w),o*x>=2&&(l++,x/=2),l+w>=E?(a=0,l=E):l+w>=1?(a=(o*x-1)*Math.pow(2,u),l=l+w):(a=o*Math.pow(2,w-1)*Math.pow(2,u),l=0));u>=8;i[p+y]=a&255,y+=U,a/=256,u-=8);for(l=l<<u|a,d+=u;d>0;i[p+y]=l&255,y+=U,l/=256,d-=8);i[p+y-U]|=I*128};/*!
|
|
1
|
+
"use strict";var Oe=Object.defineProperty;var Te=(i,o,p)=>o in i?Oe(i,o,{enumerable:!0,configurable:!0,writable:!0,value:p}):i[o]=p;var K=(i,o,p)=>(Te(i,typeof o!="symbol"?o+"":o,p),p);const z=require("immer"),ze=require("json-stringify-deterministic"),g=require("zod"),Ot=require("jszip"),Tt=i=>i!=null,De=g.z.any().refine(i=>Tt(i)),zt=g.z.enum(["LOAD_STATE"]),Dt=g.z.enum(["PRUNE"]),Nt=g.z.enum(["REDO"]),Rt=g.z.enum(["SET_NAME"]),Mt=g.z.enum(["UNDO"]);function Ne(){return g.z.object({__typename:g.z.literal("Action").optional(),type:g.z.string()})}function P(){return g.z.literal("global").or(g.z.literal("local"))}function Ct(){return g.z.union([Lt(),$t(),Pt(),Jt(),Wt()])}function Re(){return g.z.object({__typename:g.z.literal("DocumentFile").optional(),data:g.z.string(),extension:g.z.string().nullable(),fileName:g.z.string().nullable(),mimeType:g.z.string()})}function Lt(){return g.z.object({input:g.z.lazy(()=>st()),type:zt,scope:P()})}function st(){return g.z.object({operations:g.z.number(),state:g.z.lazy(()=>qt())})}function qt(){return g.z.object({data:g.z.unknown().nullish(),name:g.z.string()})}function Me(){return g.z.object({__typename:g.z.literal("Operation").optional(),hash:g.z.string(),index:g.z.number(),timestamp:g.z.string().datetime(),type:g.z.string()})}function $t(){return g.z.object({input:g.z.lazy(()=>ct()),type:Dt,scope:P()})}function ct(){return g.z.object({end:g.z.number().nullish(),start:g.z.number().nullish()})}const lt=g.z.number;function Pt(){return g.z.object({input:lt(),type:Nt,scope:P()})}const ut=g.z.string;function Jt(){return g.z.object({input:ut(),type:Rt,scope:g.z.literal("global")})}function Ce(){return g.z.object({__typename:g.z.literal("SetNameOperation").optional(),hash:g.z.string(),index:g.z.number(),input:g.z.string(),timestamp:g.z.string().datetime(),type:g.z.string()})}const ft=g.z.number;function Wt(){return g.z.object({input:ft(),type:Mt,scope:P()})}const Le=Object.freeze(Object.defineProperty({__proto__:null,ActionSchema:Ne,BaseActionSchema:Ct,DocumentFileSchema:Re,LoadStateActionInputSchema:st,LoadStateActionSchema:Lt,LoadStateActionStateInputSchema:qt,Load_StateSchema:zt,OperationSchema:Me,OperationScopeSchema:P,PruneActionInputSchema:ct,PruneActionSchema:$t,PruneSchema:Dt,RedoActionInputSchema:lt,RedoActionSchema:Pt,RedoSchema:Nt,SetNameActionInputSchema:ut,SetNameActionSchema:Jt,SetNameOperationSchema:Ce,Set_NameSchema:Rt,UndoActionInputSchema:ft,UndoActionSchema:Wt,UndoSchema:Mt,definedNonNullAnySchema:De,isDefinedNonNullAny:Tt},Symbol.toStringTag,{value:"Module"}));function qe(i,o){return{...i,name:o}}function $e(i,o,p){const{scope:c,input:u}=o,h={document:i,action:o,skip:p};return z.produce(h,l=>{if(l.document.operations[c].length<1)throw new Error(`Cannot undo: no operations in history for scope "${c}"`);if(u<1)throw new Error("Invalid UNDO action: input value must be greater than 0");if(l.skip>0)throw new Error("Cannot undo: skip value from reducer cannot be used with UNDO action");const[a]=l.document.operations[c].slice(-1),x=a.type==="NOOP"&&a.skip>0;if(l.skip+=u,x&&(l.skip+=a.skip,l.document.operations[c].pop()),l.document.operations[c].length<l.skip)throw new Error("Cannot undo: you can't undo more operations than the ones in the scope history");const d=l.document.operations[c].length-1;let E=u,w=x?d-a.skip:d;for(;E>0&&w>=0;){const v=l.document.operations[c][w];v.type==="NOOP"&&v.skip>0?(w=w-(v.skip+1),l.skip+=v.skip+1):(l.document.clipboard.push({...v}),E--,w--)}l.action=yt(c)})}function Pe(i,o,p){const{scope:c,input:u}=o,h={document:i,action:o,skip:p};return z.produce(h,l=>{if(l.skip>0)throw new Error("Cannot redo: skip value from reducer cannot be used with REDO action");if(u>1)throw new Error("Cannot redo: you can only redo one operation at a time");if(u<1)throw new Error("Invalid REDO action: invalid redo input value");if(l.document.clipboard.length<1)throw new Error("Cannot redo: no operations in the clipboard");const a=l.document.clipboard.findLastIndex(d=>d.scope===c);if(a<0)throw new Error(`Cannot redo: no operations in clipboard for scope "${c}"`);const x=l.document.clipboard.splice(a,1)[0];l.action=z.castDraft({type:x.type,scope:x.scope,input:x.input})})}function Je(i,o,p){const{scope:c}=o,u=i.operations[c];let{input:{start:h,end:l}}=o;h=h||0,l=l||u.length;const a=u.slice(h,l),x=u.slice(0,h),d=u.slice(l),E=Y(i.initialState,{...i.operations,[c]:x.concat(a)},p),{name:w,state:v}=E,y=x.length,U=x.length?x[x.length-1].timestamp:d.length?d[0].timestamp:new Date().toISOString();return Y(i.initialState,{...i.operations,[c]:[...x,{...wt({name:w,state:v},a.length),timestamp:U,index:y,hash:dt({state:v},"global")},...d.map((I,q)=>({...I,index:y+q+1}))]},p)}function We(i,o){return{...i,name:o.name,state:o.state??{global:{},local:{}}}}const Ht="SET_NAME",C="UNDO",L="REDO",J="PRUNE",Zt="LOAD_STATE";function He(i,o){const p=i.revision[o.scope];return[C,L,J].includes(o.type)?p:p+1}function Ze(i,o){return{...i,revision:{...i.revision,[o.scope]:He(i,o)},lastModified:new Date().toISOString()}}function Ke(i,o,p=0){if([C,L,J].includes(o.type))return i;const{scope:c}=o,u=i.operations[c].slice(0,i.revision[c]);return u.push({...o,index:u.length,timestamp:new Date().toISOString(),hash:"",scope:c,skip:p}),{...i,operations:{...i.operations,[c]:u}}}function Ye(i,o,p=0){let c=Ke(i,o,p);return c=Ze(c,o),c}function Ve(i,o,p){switch(Ct().parse(o),o.type){case Ht:return qe(i,o.input);case J:return Je(i,o,p);case Zt:return We(i,o.input.state);default:return i}}function Kt(i,o,p){switch(o.type){case C:return $e(i,o,p);case L:return Pe(i,o,p);default:return{document:i,action:o,skip:p}}}function ht(i,o,p,c,u={}){const{skip:h,ignoreSkipOperations:l=!1}=u;let a={...o},x=h||0,d=i,E=[...i.clipboard];if(ot(a)){const{skip:w,action:v,document:y}=Kt(i,a,x);a=v,x=w,d=y,E=[...d.clipboard]}return at(a)&&(d=Ve(d,a,p)),x>0&&!l&&(d=Y(d.initialState,d.operations,p,void 0,void 0,void 0,{[a.scope]:x})),d=Ye(d,a,x),d=z.produce(d,w=>{const v=p(w.state,a,c),y=ot(o)?[...E]:[];if(v)return z.castDraft({...d,clipboard:[...y],state:v});w.clipboard=z.castDraft([...y])}),z.produce(d,w=>{if([C,L,J].includes(a.type))return w;const v=a.scope||"global";w.operations[v][w.operations[v].length-1].hash=dt(w,v),!at(a)&&a.attachments&&a.attachments.forEach(y=>{const{hash:U,...I}=y;w.attachments[U]={...I}})})}function Yt(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var it={exports:{}};typeof Object.create=="function"?it.exports=function(o,p){p&&(o.super_=p,o.prototype=Object.create(p.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}))}:it.exports=function(o,p){if(p){o.super_=p;var c=function(){};c.prototype=p.prototype,o.prototype=new c,o.prototype.constructor=o}};var Xe=it.exports,nt={exports:{}},Vt={},V={};V.byteLength=tr;V.toByteArray=rr;V.fromByteArray=or;var T=[],j=[],Ge=typeof Uint8Array<"u"?Uint8Array:Array,rt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var M=0,Qe=rt.length;M<Qe;++M)T[M]=rt[M],j[rt.charCodeAt(M)]=M;j["-".charCodeAt(0)]=62;j["_".charCodeAt(0)]=63;function Xt(i){var o=i.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var p=i.indexOf("=");p===-1&&(p=o);var c=p===o?0:4-p%4;return[p,c]}function tr(i){var o=Xt(i),p=o[0],c=o[1];return(p+c)*3/4-c}function er(i,o,p){return(o+p)*3/4-p}function rr(i){var o,p=Xt(i),c=p[0],u=p[1],h=new Ge(er(i,c,u)),l=0,a=u>0?c-4:c,x;for(x=0;x<a;x+=4)o=j[i.charCodeAt(x)]<<18|j[i.charCodeAt(x+1)]<<12|j[i.charCodeAt(x+2)]<<6|j[i.charCodeAt(x+3)],h[l++]=o>>16&255,h[l++]=o>>8&255,h[l++]=o&255;return u===2&&(o=j[i.charCodeAt(x)]<<2|j[i.charCodeAt(x+1)]>>4,h[l++]=o&255),u===1&&(o=j[i.charCodeAt(x)]<<10|j[i.charCodeAt(x+1)]<<4|j[i.charCodeAt(x+2)]>>2,h[l++]=o>>8&255,h[l++]=o&255),h}function ir(i){return T[i>>18&63]+T[i>>12&63]+T[i>>6&63]+T[i&63]}function nr(i,o,p){for(var c,u=[],h=o;h<p;h+=3)c=(i[h]<<16&16711680)+(i[h+1]<<8&65280)+(i[h+2]&255),u.push(ir(c));return u.join("")}function or(i){for(var o,p=i.length,c=p%3,u=[],h=16383,l=0,a=p-c;l<a;l+=h)u.push(nr(i,l,l+h>a?a:l+h));return c===1?(o=i[p-1],u.push(T[o>>2]+T[o<<4&63]+"==")):c===2&&(o=(i[p-2]<<8)+i[p-1],u.push(T[o>>10]+T[o>>4&63]+T[o<<2&63]+"=")),u.join("")}var mt={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */mt.read=function(i,o,p,c,u){var h,l,a=u*8-c-1,x=(1<<a)-1,d=x>>1,E=-7,w=p?u-1:0,v=p?-1:1,y=i[o+w];for(w+=v,h=y&(1<<-E)-1,y>>=-E,E+=a;E>0;h=h*256+i[o+w],w+=v,E-=8);for(l=h&(1<<-E)-1,h>>=-E,E+=c;E>0;l=l*256+i[o+w],w+=v,E-=8);if(h===0)h=1-d;else{if(h===x)return l?NaN:(y?-1:1)*(1/0);l=l+Math.pow(2,c),h=h-d}return(y?-1:1)*l*Math.pow(2,h-c)};mt.write=function(i,o,p,c,u,h){var l,a,x,d=h*8-u-1,E=(1<<d)-1,w=E>>1,v=u===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=c?0:h-1,U=c?1:-1,I=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(a=isNaN(o)?1:0,l=E):(l=Math.floor(Math.log(o)/Math.LN2),o*(x=Math.pow(2,-l))<1&&(l--,x*=2),l+w>=1?o+=v/x:o+=v*Math.pow(2,1-w),o*x>=2&&(l++,x/=2),l+w>=E?(a=0,l=E):l+w>=1?(a=(o*x-1)*Math.pow(2,u),l=l+w):(a=o*Math.pow(2,w-1)*Math.pow(2,u),l=0));u>=8;i[p+y]=a&255,y+=U,a/=256,u-=8);for(l=l<<u|a,d+=u;d>0;i[p+y]=l&255,y+=U,l/=256,d-=8);i[p+y-U]|=I*128};/*!
|
|
2
2
|
* The buffer module from node.js, for the browser.
|
|
3
3
|
*
|
|
4
4
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
5
5
|
* @license MIT
|
|
6
|
-
*/(function(i){var o=X,p=ht,c=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;i.Buffer=a,i.SlowBuffer=me,i.INSPECT_MAX_BYTES=50;var u=2147483647;i.kMaxLength=u,a.TYPED_ARRAY_SUPPORT=h(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function h(){try{var r=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function l(r){if(r>u)throw new RangeError('The value "'+r+'" is invalid for option "size"');var t=new Uint8Array(r);return Object.setPrototypeOf(t,a.prototype),t}function a(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return w(r)}return x(r,t,e)}a.poolSize=8192;function x(r,t,e){if(typeof r=="string")return v(r,t);if(ArrayBuffer.isView(r))return U(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(O(r,ArrayBuffer)||r&&O(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(O(r,SharedArrayBuffer)||r&&O(r.buffer,SharedArrayBuffer)))return I(r,t,e);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return a.from(n,t,e);var s=q(r);if(s)return s;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return a.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}a.from=function(r,t,e){return x(r,t,e)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function d(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function E(r,t,e){return d(r),r<=0?l(r):t!==void 0?typeof e=="string"?l(r).fill(t,e):l(r).fill(t):l(r)}a.alloc=function(r,t,e){return E(r,t,e)};function w(r){return d(r),l(r<0?0:R(r)|0)}a.allocUnsafe=function(r){return w(r)},a.allocUnsafeSlow=function(r){return w(r)};function v(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var e=bt(r,t)|0,n=l(e),s=n.write(r,t);return s!==e&&(n=n.slice(0,s)),n}function y(r){for(var t=r.length<0?0:R(r.length)|0,e=l(t),n=0;n<t;n+=1)e[n]=r[n]&255;return e}function U(r){if(O(r,Uint8Array)){var t=new Uint8Array(r);return I(t.buffer,t.byteOffset,t.byteLength)}return y(r)}function I(r,t,e){if(t<0||r.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');var n;return t===void 0&&e===void 0?n=new Uint8Array(r):e===void 0?n=new Uint8Array(r,t):n=new Uint8Array(r,t,e),Object.setPrototypeOf(n,a.prototype),n}function q(r){if(a.isBuffer(r)){var t=R(r.length)|0,e=l(t);return e.length===0||r.copy(e,0,0,t),e}if(r.length!==void 0)return typeof r.length!="number"||et(r.length)?l(0):y(r);if(r.type==="Buffer"&&Array.isArray(r.data))return y(r.data)}function R(r){if(r>=u)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u.toString(16)+" bytes");return r|0}function me(r){return+r!=r&&(r=0),a.alloc(+r)}a.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==a.prototype},a.compare=function(t,e){if(O(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),O(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var n=t.length,s=e.length,f=0,m=Math.min(n,s);f<m;++f)if(t[f]!==e[f]){n=t[f],s=e[f];break}return n<s?-1:s<n?1:0},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var s=a.allocUnsafe(e),f=0;for(n=0;n<t.length;++n){var m=t[n];if(O(m,Uint8Array))f+m.length>s.length?a.from(m).copy(s,f):Uint8Array.prototype.set.call(s,m,f);else if(a.isBuffer(m))m.copy(s,f);else throw new TypeError('"list" argument must be an Array of Buffers');f+=m.length}return s};function bt(r,t){if(a.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||O(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);var e=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&e===0)return 0;for(var s=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return tt(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return It(r).length;default:if(s)return n?-1:tt(r).length;t=(""+t).toLowerCase(),s=!0}}a.byteLength=bt;function xe(r,t,e){var n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return Ae(this,t,e);case"utf8":case"utf-8":return _t(this,t,e);case"ascii":return Fe(this,t,e);case"latin1":case"binary":return _e(this,t,e);case"base64":return be(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Se(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}a.prototype._isBuffer=!0;function D(r,t,e){var n=r[t];r[t]=r[e],r[e]=n}a.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)D(this,e,e+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)D(this,e,e+3),D(this,e+1,e+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)D(this,e,e+7),D(this,e+1,e+6),D(this,e+2,e+5),D(this,e+3,e+4);return this},a.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?_t(this,0,t):xe.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0},a.prototype.inspect=function(){var t="",e=i.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},c&&(a.prototype[c]=a.prototype.inspect),a.prototype.compare=function(t,e,n,s,f){if(O(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),s===void 0&&(s=0),f===void 0&&(f=this.length),e<0||n>t.length||s<0||f>this.length)throw new RangeError("out of range index");if(s>=f&&e>=n)return 0;if(s>=f)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,s>>>=0,f>>>=0,this===t)return 0;for(var m=f-s,b=n-e,F=Math.min(m,b),_=this.slice(s,f),B=t.slice(e,n),A=0;A<F;++A)if(_[A]!==B[A]){m=_[A],b=B[A];break}return m<b?-1:b<m?1:0};function Et(r,t,e,n,s){if(r.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,et(e)&&(e=s?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(s)return-1;e=r.length-1}else if(e<0)if(s)e=0;else return-1;if(typeof t=="string"&&(t=a.from(t,n)),a.isBuffer(t))return t.length===0?-1:Ft(r,t,e,n,s);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?s?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):Ft(r,[t],e,n,s);throw new TypeError("val must be string, number or Buffer")}function Ft(r,t,e,n,s){var f=1,m=r.length,b=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;f=2,m/=2,b/=2,e/=2}function F(jt,Ut){return f===1?jt[Ut]:jt.readUInt16BE(Ut*f)}var _;if(s){var B=-1;for(_=e;_<m;_++)if(F(r,_)===F(t,B===-1?0:_-B)){if(B===-1&&(B=_),_-B+1===b)return B*f}else B!==-1&&(_-=_-B),B=-1}else for(e+b>m&&(e=m-b),_=e;_>=0;_--){for(var A=!0,Z=0;Z<b;Z++)if(F(r,_+Z)!==F(t,Z)){A=!1;break}if(A)return _}return-1}a.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1},a.prototype.indexOf=function(t,e,n){return Et(this,t,e,n,!0)},a.prototype.lastIndexOf=function(t,e,n){return Et(this,t,e,n,!1)};function de(r,t,e,n){e=Number(e)||0;var s=r.length-e;n?(n=Number(n),n>s&&(n=s)):n=s;var f=t.length;n>f/2&&(n=f/2);for(var m=0;m<n;++m){var b=parseInt(t.substr(m*2,2),16);if(et(b))return m;r[e+m]=b}return m}function ge(r,t,e,n){return H(tt(t,r.length-e),r,e,n)}function we(r,t,e,n){return H(Ie(t),r,e,n)}function ye(r,t,e,n){return H(It(t),r,e,n)}function ve(r,t,e,n){return H(je(t,r.length-e),r,e,n)}a.prototype.write=function(t,e,n,s){if(e===void 0)s="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")s=e,n=this.length,e=0;else if(isFinite(e))e=e>>>0,isFinite(n)?(n=n>>>0,s===void 0&&(s="utf8")):(s=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var f=this.length-e;if((n===void 0||n>f)&&(n=f),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");s||(s="utf8");for(var m=!1;;)switch(s){case"hex":return de(this,t,e,n);case"utf8":case"utf-8":return ge(this,t,e,n);case"ascii":case"latin1":case"binary":return we(this,t,e,n);case"base64":return ye(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ve(this,t,e,n);default:if(m)throw new TypeError("Unknown encoding: "+s);s=(""+s).toLowerCase(),m=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function be(r,t,e){return t===0&&e===r.length?o.fromByteArray(r):o.fromByteArray(r.slice(t,e))}function _t(r,t,e){e=Math.min(r.length,e);for(var n=[],s=t;s<e;){var f=r[s],m=null,b=f>239?4:f>223?3:f>191?2:1;if(s+b<=e){var F,_,B,A;switch(b){case 1:f<128&&(m=f);break;case 2:F=r[s+1],(F&192)===128&&(A=(f&31)<<6|F&63,A>127&&(m=A));break;case 3:F=r[s+1],_=r[s+2],(F&192)===128&&(_&192)===128&&(A=(f&15)<<12|(F&63)<<6|_&63,A>2047&&(A<55296||A>57343)&&(m=A));break;case 4:F=r[s+1],_=r[s+2],B=r[s+3],(F&192)===128&&(_&192)===128&&(B&192)===128&&(A=(f&15)<<18|(F&63)<<12|(_&63)<<6|B&63,A>65535&&A<1114112&&(m=A))}}m===null?(m=65533,b=1):m>65535&&(m-=65536,n.push(m>>>10&1023|55296),m=56320|m&1023),n.push(m),s+=b}return Ee(n)}var At=4096;function Ee(r){var t=r.length;if(t<=At)return String.fromCharCode.apply(String,r);for(var e="",n=0;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=At));return e}function Fe(r,t,e){var n="";e=Math.min(r.length,e);for(var s=t;s<e;++s)n+=String.fromCharCode(r[s]&127);return n}function _e(r,t,e){var n="";e=Math.min(r.length,e);for(var s=t;s<e;++s)n+=String.fromCharCode(r[s]);return n}function Ae(r,t,e){var n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);for(var s="",f=t;f<e;++f)s+=Ue[r[f]];return s}function Se(r,t,e){for(var n=r.slice(t,e),s="",f=0;f<n.length-1;f+=2)s+=String.fromCharCode(n[f]+n[f+1]*256);return s}a.prototype.slice=function(t,e){var n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);var s=this.subarray(t,e);return Object.setPrototypeOf(s,a.prototype),s};function S(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||S(t,e,this.length);for(var s=this[t],f=1,m=0;++m<e&&(f*=256);)s+=this[t+m]*f;return s},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||S(t,e,this.length);for(var s=this[t+--e],f=1;e>0&&(f*=256);)s+=this[t+--e]*f;return s},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t=t>>>0,e||S(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||S(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||S(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||S(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||S(t,e,this.length);for(var s=this[t],f=1,m=0;++m<e&&(f*=256);)s+=this[t+m]*f;return f*=128,s>=f&&(s-=Math.pow(2,8*e)),s},a.prototype.readIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||S(t,e,this.length);for(var s=e,f=1,m=this[t+--s];s>0&&(f*=256);)m+=this[t+--s]*f;return f*=128,m>=f&&(m-=Math.pow(2,8*e)),m},a.prototype.readInt8=function(t,e){return t=t>>>0,e||S(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},a.prototype.readInt16LE=function(t,e){t=t>>>0,e||S(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n},a.prototype.readInt16BE=function(t,e){t=t>>>0,e||S(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n},a.prototype.readInt32LE=function(t,e){return t=t>>>0,e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t=t>>>0,e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t=t>>>0,e||S(t,4,this.length),p.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t=t>>>0,e||S(t,4,this.length),p.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||S(t,8,this.length),p.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||S(t,8,this.length),p.read(this,t,!1,52,8)};function k(r,t,e,n,s,f){if(!a.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<f)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,n,s){if(t=+t,e=e>>>0,n=n>>>0,!s){var f=Math.pow(2,8*n)-1;k(this,t,e,n,f,0)}var m=1,b=0;for(this[e]=t&255;++b<n&&(m*=256);)this[e+b]=t/m&255;return e+n},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,n,s){if(t=+t,e=e>>>0,n=n>>>0,!s){var f=Math.pow(2,8*n)-1;k(this,t,e,n,f,0)}var m=n-1,b=1;for(this[e+m]=t&255;--m>=0&&(b*=256);)this[e+m]=t/b&255;return e+n},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,1,255,0),this[e]=t&255,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4},a.prototype.writeIntLE=function(t,e,n,s){if(t=+t,e=e>>>0,!s){var f=Math.pow(2,8*n-1);k(this,t,e,n,f-1,-f)}var m=0,b=1,F=0;for(this[e]=t&255;++m<n&&(b*=256);)t<0&&F===0&&this[e+m-1]!==0&&(F=1),this[e+m]=(t/b>>0)-F&255;return e+n},a.prototype.writeIntBE=function(t,e,n,s){if(t=+t,e=e>>>0,!s){var f=Math.pow(2,8*n-1);k(this,t,e,n,f-1,-f)}var m=n-1,b=1,F=0;for(this[e+m]=t&255;--m>=0&&(b*=256);)t<0&&F===0&&this[e+m+1]!==0&&(F=1),this[e+m]=(t/b>>0)-F&255;return e+n},a.prototype.writeInt8=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1},a.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2},a.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function St(r,t,e,n,s,f){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Bt(r,t,e,n,s){return t=+t,e=e>>>0,s||St(r,t,e,4),p.write(r,t,e,n,23,4),e+4}a.prototype.writeFloatLE=function(t,e,n){return Bt(this,t,e,!0,n)},a.prototype.writeFloatBE=function(t,e,n){return Bt(this,t,e,!1,n)};function kt(r,t,e,n,s){return t=+t,e=e>>>0,s||St(r,t,e,8),p.write(r,t,e,n,52,8),e+8}a.prototype.writeDoubleLE=function(t,e,n){return kt(this,t,e,!0,n)},a.prototype.writeDoubleBE=function(t,e,n){return kt(this,t,e,!1,n)},a.prototype.copy=function(t,e,n,s){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!s&&s!==0&&(s=this.length),e>=t.length&&(e=t.length),e||(e=0),s>0&&s<n&&(s=n),s===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("sourceEnd out of bounds");s>this.length&&(s=this.length),t.length-e<s-n&&(s=t.length-e+n);var f=s-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,n,s):Uint8Array.prototype.set.call(t,this.subarray(n,s),e),f},a.prototype.fill=function(t,e,n,s){if(typeof t=="string"){if(typeof e=="string"?(s=e,e=0,n=this.length):typeof n=="string"&&(s=n,n=this.length),s!==void 0&&typeof s!="string")throw new TypeError("encoding must be a string");if(typeof s=="string"&&!a.isEncoding(s))throw new TypeError("Unknown encoding: "+s);if(t.length===1){var f=t.charCodeAt(0);(s==="utf8"&&f<128||s==="latin1")&&(t=f)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);var m;if(typeof t=="number")for(m=e;m<n;++m)this[m]=t;else{var b=a.isBuffer(t)?t:a.from(t,s),F=b.length;if(F===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(m=0;m<n-e;++m)this[m+e]=b[m%F]}return this};var Be=/[^+/0-9A-Za-z-_]/g;function ke(r){if(r=r.split("=")[0],r=r.trim().replace(Be,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function tt(r,t){t=t||1/0;for(var e,n=r.length,s=null,f=[],m=0;m<n;++m){if(e=r.charCodeAt(m),e>55295&&e<57344){if(!s){if(e>56319){(t-=3)>-1&&f.push(239,191,189);continue}else if(m+1===n){(t-=3)>-1&&f.push(239,191,189);continue}s=e;continue}if(e<56320){(t-=3)>-1&&f.push(239,191,189),s=e;continue}e=(s-55296<<10|e-56320)+65536}else s&&(t-=3)>-1&&f.push(239,191,189);if(s=null,e<128){if((t-=1)<0)break;f.push(e)}else if(e<2048){if((t-=2)<0)break;f.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;f.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;f.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return f}function Ie(r){for(var t=[],e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function je(r,t){for(var e,n,s,f=[],m=0;m<r.length&&!((t-=2)<0);++m)e=r.charCodeAt(m),n=e>>8,s=e%256,f.push(s),f.push(n);return f}function It(r){return o.toByteArray(ke(r))}function H(r,t,e,n){for(var s=0;s<n&&!(s+e>=t.length||s>=r.length);++s)t[s+e]=r[s];return s}function O(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function et(r){return r!==r}var Ue=function(){for(var r="0123456789abcdef",t=new Array(256),e=0;e<16;++e)for(var n=e*16,s=0;s<16;++s)t[n+s]=r[e]+r[s];return t}()})(Yt);/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(i,o){var p=Yt,c=p.Buffer;function u(l,a){for(var x in l)a[x]=l[x]}c.from&&c.alloc&&c.allocUnsafe&&c.allocUnsafeSlow?i.exports=p:(u(p,o),o.Buffer=h);function h(l,a,x){return c(l,a,x)}h.prototype=Object.create(c.prototype),u(c,h),h.from=function(l,a,x){if(typeof l=="number")throw new TypeError("Argument must not be a number");return c(l,a,x)},h.alloc=function(l,a,x){if(typeof l!="number")throw new TypeError("Argument must be a number");var d=c(l);return a!==void 0?typeof x=="string"?d.fill(a,x):d.fill(a):d.fill(0),d},h.allocUnsafe=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return c(l)},h.allocUnsafeSlow=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return p.SlowBuffer(l)}})(nt,nt.exports);var Xt=nt.exports,Gt=Xt.Buffer;function G(i,o){this._block=Gt.alloc(i),this._finalSize=o,this._blockSize=i,this._len=0}G.prototype.update=function(i,o){typeof i=="string"&&(o=o||"utf8",i=Gt.from(i,o));for(var p=this._block,c=this._blockSize,u=i.length,h=this._len,l=0;l<u;){for(var a=h%c,x=Math.min(u-l,c-a),d=0;d<x;d++)p[a+d]=i[l+d];h+=x,l+=x,h%c===0&&this._update(p)}return this._len+=u,this};G.prototype.digest=function(i){var o=this._len%this._blockSize;this._block[o]=128,this._block.fill(0,o+1),o>=this._finalSize&&(this._update(this._block),this._block.fill(0));var p=this._len*8;if(p<=4294967295)this._block.writeUInt32BE(p,this._blockSize-4);else{var c=(p&4294967295)>>>0,u=(p-c)/4294967296;this._block.writeUInt32BE(u,this._blockSize-8),this._block.writeUInt32BE(c,this._blockSize-4)}this._update(this._block);var h=this._hash();return i?h.toString(i):h};G.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var ar=G,pr=Xe,Qt=ar,sr=Xt.Buffer,cr=[1518500249,1859775393,-1894007588,-899497514],lr=new Array(80);function W(){this.init(),this._w=lr,Qt.call(this,64,56)}pr(W,Qt);W.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function ur(i){return i<<1|i>>>31}function fr(i){return i<<5|i>>>27}function hr(i){return i<<30|i>>>2}function mr(i,o,p,c){return i===0?o&p|~o&c:i===2?o&p|o&c|p&c:o^p^c}W.prototype._update=function(i){for(var o=this._w,p=this._a|0,c=this._b|0,u=this._c|0,h=this._d|0,l=this._e|0,a=0;a<16;++a)o[a]=i.readInt32BE(a*4);for(;a<80;++a)o[a]=ur(o[a-3]^o[a-8]^o[a-14]^o[a-16]);for(var x=0;x<80;++x){var d=~~(x/20),E=fr(p)+mr(d,c,u,h)+l+o[x]+cr[d]|0;l=h,h=u,u=hr(c),c=p,p=E}this._a=p+this._a|0,this._b=c+this._b|0,this._c=u+this._c|0,this._d=h+this._d|0,this._e=l+this._e|0};W.prototype._hash=function(){var i=sr.allocUnsafe(20);return i.writeInt32BE(this._a|0,0),i.writeInt32BE(this._b|0,4),i.writeInt32BE(this._c|0,8),i.writeInt32BE(this._d|0,12),i.writeInt32BE(this._e|0,16),i};var xr=W;const dr=Kt(xr),mt=new Error("File system not available.");function gr(i,o,p){throw mt}function te(i){throw mt}function wr(i){throw mt}const yr=async i=>te();function vr(i){let o="";for(let p=0;p<i.length;p+=2)o+=String.fromCharCode(parseInt(i.substr(p,2),16));return btoa(o)}const Q=(i,o="sha1")=>{if(o!=="sha1")throw new Error("Only sha1 algorithm is available.");const p=new dr;return vr(p.update(i).digest("hex"))},xt=async i=>{const o=new Ot,{name:p,revision:c,documentType:u,created:h,lastModified:l}=i,a={name:p,revision:c,documentType:u,created:h,lastModified:l};return o.file("header.json",JSON.stringify(a,null,2)),o.file("state.json",JSON.stringify(i.initialState||{},null,2)),o.file("operations.json",JSON.stringify(i.operations,null,2)),Object.keys(i.attachments).forEach(d=>{const{data:E,...w}=i.attachments[d];o.file(d,E,{base64:!0,createFolders:!0,comment:JSON.stringify(w)})}),o},ee=async(i,o,p,c)=>{await(await xt(i)).generateAsync({type:"uint8array",streamFiles:!0});const h=c??i.name,l=`.${p}.zip`;return gr(o,h.endsWith(l)?h:`${h}${l}`)},br=async(i,o)=>{const c=await(await xt(i)).generateAsync({type:"blob"}),u=await o.createWritable();await u.write(c),await u.close()},ot=async(i,o)=>{const p=te();return re(p,o)},re=async(i,o)=>{const p=new Ot;return await p.loadAsync(i),Er(p,o)};async function Er(i,o){const p=i.file("state.json");if(!p)throw new Error("Initial state not found");const c=await p.async("string"),u=JSON.parse(c),h=i.file("header.json");let l;h&&(l=JSON.parse(await h.async("string")));const a=i.file("operations.json");if(!a)throw new Error("Operations history not found");const x=JSON.parse(await a.async("string"));let d=wt(u,x,o,void 0,l);return l&&(d={...d,...l}),d}function ie(i){const o=i.replace(/^.*\./,"")||void 0,p=i.replace(/^.*[/\\]/,"")||void 0;return{extension:o,fileName:p}}async function Fr(i){const{buffer:o,mimeType:p="application/octet-stream"}=await wr(),c=ie(i),u=o.toString("base64");return{data:u,hash:Q(u),mimeType:p,...c}}async function _r(i){const o=await yr(),p=Ve.getType(i)||"application/octet-stream",c=ie(i),u=o.toString("base64");return{data:u,hash:Q(u),mimeType:p,...c}}function Ar(i,o){const p=i.revision[o.scope];return[C,L,J].includes(o.type)?p:p+1}function Sr(i,o){return{...i,revision:{...i.revision,[o.scope]:Ar(i,o)},lastModified:new Date().toISOString()}}function Br(i,o,p=0){if([C,L,J].includes(o.type))return i;const{scope:c}=o,u=i.operations[c].slice(0,i.revision[c]);return u.push({...o,index:u.length,timestamp:new Date().toISOString(),hash:"",scope:c,skip:p}),{...i,operations:{...i.operations,[c]:u}}}function kr(i,o,p=0){let c=Br(i,o,p);return c=Sr(c,o),c}function Ir(i,o,p){switch(Ct().parse(o),o.type){case Ht:return qe(i,o.input);case J:return Je(i,o,p);case Zt:return We(i,o.input.state);default:return i}}function ne(i,o,p){switch(o.type){case C:return $e(i,o,p);case L:return Pe(i,o,p);default:return{document:i,action:o,skip:p}}}function dt(i,o,p,c,u={}){const{skip:h,ignoreSkipOperations:l=!1}=u;let a={...o},x=h||0,d=i,E=[...i.clipboard];if(at(a)){const{skip:w,action:v,document:y}=ne(i,a,x);a=v,x=w,d=y,E=[...d.clipboard]}return pt(a)&&(d=Ir(d,a,p)),x>0&&!l&&(d=Y(d.initialState,d.operations,p,void 0,void 0,void 0,{[a.scope]:x})),d=kr(d,a,x),d=z.produce(d,w=>{const v=p(w.state,a,c),y=at(o)?[...E]:[];if(v)return z.castDraft({...d,clipboard:[...y],state:v});w.clipboard=z.castDraft([...y])}),z.produce(d,w=>{if([C,L,J].includes(a.type))return w;const v=a.scope||"global";w.operations[v][w.operations[v].length-1].hash=gt(w,v),!pt(a)&&a.attachments&&a.attachments.forEach(y=>{const{hash:U,...I}=y;w.attachments[U]={...I}})})}function at(i){return[C,L].includes(i.type)}function pt(i){return[Ht,C,L,J,Zt].includes(i.type)}function N(i,o,p,c,u="global"){if(!i)throw new Error("Empty action type");if(typeof i!="string")throw new Error(`Invalid action type: ${i}`);const h={type:i,input:o,scope:u};p&&(h.attachments=p);try{c==null||c().parse(h.input)}catch(l){throw new Error(`Invalid action input: ${l}`)}return h}function oe(i,o=dt){return(p,c,u,h)=>o(p,c,i,u,h)}const ae=(i,o)=>({name:"",documentType:"",revision:{global:0,local:0},created:new Date().toISOString(),lastModified:new Date().toISOString(),attachments:{},...i,state:(o==null?void 0:o(i==null?void 0:i.state))??(i==null?void 0:i.state)??{global:{},local:{}}}),pe=(i,o)=>{const p=ae(i,o);return{...p,initialState:p,operations:{global:[],local:[]},clipboard:[]}},gt=(i,o="global")=>Q(ze(i.state[o])),jr=(i,o=1e3)=>{const p=Math.random()*o;return Q(`${(i??new Date).toISOString()}${p}`)};function $(i){return z.castImmutable(z.freeze(i,!0))}function se(i,o){const p=[...i];let c=o||0,u=p.length>0?p[p.length-1].index:0;const h=[];for(const l of p.reverse()){if(c>0){const d=u-l.index;c-=d}if(c<0)throw new Error("Invalid operation index, missing operations");const a={ignore:c>0,operation:l},x=l.skip>0?l.skip+1:0;if(x>0&&x>c){const d=x-c;c=c+d}u=l.index,h.push(a)}return h.reverse()}function Ur(i){return Object.values(i).flatMap(o=>o).sort((o,p)=>new Date(o.timestamp).getTime()-new Date(p.timestamp).getTime())}function ce(i){return Object.values(i).flatMap(o=>o).sort((o,p)=>new Date(o.operation.timestamp).getTime()-new Date(p.operation.timestamp).getTime())}function Y(i,o,p,c,u,h=dt,l={}){const a=oe(p,h);return wt(i,o,a,c,u,l)}function wt(i,o,p,c,u,h={}){const l=pe(i),a=Object.keys(o).reduce((w,v)=>{const y=v;return{...w,[y]:o[y].slice(0,u==null?void 0:u.revision[y])}},{}),x=Object.keys(a).reduce((w,v)=>{const y=v;return{...w,[y]:se(a[y],h[y])}},{}),d=ce(x).reduce((w,{ignore:v,operation:y})=>v?p(w,vt(y.scope),c,{skip:y.skip,ignoreSkipOperations:!0}):p(w,y,c,{skip:y.skip,ignoreSkipOperations:!0}),l),E=Object.keys(d.operations).reduce((w,v)=>{const y=v,U=u&&u.revision[y]<o[y].length?o[y].slice(u.revision[y]):[];return{...w,[y]:[...d.operations[y].map((I,q)=>{var R;return{...I,timestamp:((R=o[y][q])==null?void 0:R.timestamp)??I.timestamp}}),...U]}},{global:[],local:[]});return{...d,operations:E}}const le=i=>N("SET_NAME",i,void 0,ut,void 0),ue=(i=1,o="global")=>N("UNDO",i,void 0,ft,o),fe=(i=1,o="global")=>N("REDO",i,void 0,lt,o),he=(i,o,p="global")=>N("PRUNE",{start:i,end:o},void 0,ct,p),yt=(i,o)=>N("LOAD_STATE",{state:i,operations:o},void 0,st),vt=(i="global")=>N("NOOP",{},void 0,void 0,i),Or=Object.freeze(Object.defineProperty({__proto__:null,loadState:yt,noop:vt,prune:he,redo:fe,setName:le,undo:ue},Symbol.toStringTag,{value:"Module"}));class Tr{constructor(o,p,c){K(this,"_document");K(this,"_reducer");K(this,"_signalDispatch");this._reducer=o,this._document=p,this._signalDispatch=c}dispatch(o,p){return this._document=this._reducer(this._document,o,this._signalDispatch,p),this}saveToFile(o,p,c){return ee(this._document,o,p,c)}async loadFromFile(o){this._document=await ot(o,this._reducer)}static async stateFromFile(o,p){return await ot(o,p)}get state(){return $(this._document.state)}get operations(){return $(this._document.operations)}get name(){return this._document.name}get documentType(){return this._document.documentType}get created(){return this._document.created}get lastModified(){return this._document.lastModified}get revision(){return this._document.revision.global}getRevision(o){return this._document.revision[o]}get initialState(){return $(this._document.initialState)}toDocument(){return $(this._document)}getAttachment(o){return this._document.attachments[o]}setName(o){return this.dispatch(le(o)),this}undo(o){return this.dispatch(ue(o)),this}redo(o){return this.dispatch(fe(o)),this}prune(o,p){return this.dispatch(he(o,p)),this}loadState(o,p){return this.dispatch(yt(o,p)),this}}function zr(i,o){o.forEach(p=>{Object.getOwnPropertyNames(p.prototype).forEach(c=>{Object.defineProperty(i.prototype,c,Object.getOwnPropertyDescriptor(p.prototype,c)||Object.create(null))})})}exports.BaseActions=Or;exports.BaseDocument=Tr;exports.applyMixins=zr;exports.baseReducer=dt;exports.createAction=N;exports.createDocument=pe;exports.createExtendedState=ae;exports.createReducer=oe;exports.createZip=xt;exports.getLocalFile=_r;exports.getRemoteFile=Fr;exports.hashDocument=gt;exports.hashKey=jr;exports.isBaseAction=pt;exports.isUndoRedo=at;exports.loadFromFile=ot;exports.loadFromInput=re;exports.mapSkippedOperations=se;exports.processUndoRedo=ne;exports.readOnly=$;exports.replayDocument=wt;exports.replayOperations=Y;exports.saveToFile=ee;exports.saveToFileHandle=br;exports.sortMappedOperations=ce;exports.sortOperations=Ur;exports.zod=Le;
|
|
6
|
+
*/(function(i){var o=V,p=mt,c=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;i.Buffer=a,i.SlowBuffer=me,i.INSPECT_MAX_BYTES=50;var u=2147483647;i.kMaxLength=u,a.TYPED_ARRAY_SUPPORT=h(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function h(){try{var r=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function l(r){if(r>u)throw new RangeError('The value "'+r+'" is invalid for option "size"');var t=new Uint8Array(r);return Object.setPrototypeOf(t,a.prototype),t}function a(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return w(r)}return x(r,t,e)}a.poolSize=8192;function x(r,t,e){if(typeof r=="string")return v(r,t);if(ArrayBuffer.isView(r))return U(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(O(r,ArrayBuffer)||r&&O(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(O(r,SharedArrayBuffer)||r&&O(r.buffer,SharedArrayBuffer)))return I(r,t,e);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return a.from(n,t,e);var s=q(r);if(s)return s;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return a.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}a.from=function(r,t,e){return x(r,t,e)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function d(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function E(r,t,e){return d(r),r<=0?l(r):t!==void 0?typeof e=="string"?l(r).fill(t,e):l(r).fill(t):l(r)}a.alloc=function(r,t,e){return E(r,t,e)};function w(r){return d(r),l(r<0?0:R(r)|0)}a.allocUnsafe=function(r){return w(r)},a.allocUnsafeSlow=function(r){return w(r)};function v(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var e=bt(r,t)|0,n=l(e),s=n.write(r,t);return s!==e&&(n=n.slice(0,s)),n}function y(r){for(var t=r.length<0?0:R(r.length)|0,e=l(t),n=0;n<t;n+=1)e[n]=r[n]&255;return e}function U(r){if(O(r,Uint8Array)){var t=new Uint8Array(r);return I(t.buffer,t.byteOffset,t.byteLength)}return y(r)}function I(r,t,e){if(t<0||r.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');var n;return t===void 0&&e===void 0?n=new Uint8Array(r):e===void 0?n=new Uint8Array(r,t):n=new Uint8Array(r,t,e),Object.setPrototypeOf(n,a.prototype),n}function q(r){if(a.isBuffer(r)){var t=R(r.length)|0,e=l(t);return e.length===0||r.copy(e,0,0,t),e}if(r.length!==void 0)return typeof r.length!="number"||et(r.length)?l(0):y(r);if(r.type==="Buffer"&&Array.isArray(r.data))return y(r.data)}function R(r){if(r>=u)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u.toString(16)+" bytes");return r|0}function me(r){return+r!=r&&(r=0),a.alloc(+r)}a.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==a.prototype},a.compare=function(t,e){if(O(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),O(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var n=t.length,s=e.length,f=0,m=Math.min(n,s);f<m;++f)if(t[f]!==e[f]){n=t[f],s=e[f];break}return n<s?-1:s<n?1:0},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var s=a.allocUnsafe(e),f=0;for(n=0;n<t.length;++n){var m=t[n];if(O(m,Uint8Array))f+m.length>s.length?a.from(m).copy(s,f):Uint8Array.prototype.set.call(s,m,f);else if(a.isBuffer(m))m.copy(s,f);else throw new TypeError('"list" argument must be an Array of Buffers');f+=m.length}return s};function bt(r,t){if(a.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||O(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);var e=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&e===0)return 0;for(var s=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return tt(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return It(r).length;default:if(s)return n?-1:tt(r).length;t=(""+t).toLowerCase(),s=!0}}a.byteLength=bt;function xe(r,t,e){var n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return Ae(this,t,e);case"utf8":case"utf-8":return _t(this,t,e);case"ascii":return Fe(this,t,e);case"latin1":case"binary":return _e(this,t,e);case"base64":return be(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Se(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}a.prototype._isBuffer=!0;function D(r,t,e){var n=r[t];r[t]=r[e],r[e]=n}a.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)D(this,e,e+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)D(this,e,e+3),D(this,e+1,e+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)D(this,e,e+7),D(this,e+1,e+6),D(this,e+2,e+5),D(this,e+3,e+4);return this},a.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?_t(this,0,t):xe.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0},a.prototype.inspect=function(){var t="",e=i.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},c&&(a.prototype[c]=a.prototype.inspect),a.prototype.compare=function(t,e,n,s,f){if(O(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),s===void 0&&(s=0),f===void 0&&(f=this.length),e<0||n>t.length||s<0||f>this.length)throw new RangeError("out of range index");if(s>=f&&e>=n)return 0;if(s>=f)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,s>>>=0,f>>>=0,this===t)return 0;for(var m=f-s,b=n-e,F=Math.min(m,b),_=this.slice(s,f),B=t.slice(e,n),A=0;A<F;++A)if(_[A]!==B[A]){m=_[A],b=B[A];break}return m<b?-1:b<m?1:0};function Et(r,t,e,n,s){if(r.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,et(e)&&(e=s?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(s)return-1;e=r.length-1}else if(e<0)if(s)e=0;else return-1;if(typeof t=="string"&&(t=a.from(t,n)),a.isBuffer(t))return t.length===0?-1:Ft(r,t,e,n,s);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?s?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):Ft(r,[t],e,n,s);throw new TypeError("val must be string, number or Buffer")}function Ft(r,t,e,n,s){var f=1,m=r.length,b=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;f=2,m/=2,b/=2,e/=2}function F(jt,Ut){return f===1?jt[Ut]:jt.readUInt16BE(Ut*f)}var _;if(s){var B=-1;for(_=e;_<m;_++)if(F(r,_)===F(t,B===-1?0:_-B)){if(B===-1&&(B=_),_-B+1===b)return B*f}else B!==-1&&(_-=_-B),B=-1}else for(e+b>m&&(e=m-b),_=e;_>=0;_--){for(var A=!0,Z=0;Z<b;Z++)if(F(r,_+Z)!==F(t,Z)){A=!1;break}if(A)return _}return-1}a.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1},a.prototype.indexOf=function(t,e,n){return Et(this,t,e,n,!0)},a.prototype.lastIndexOf=function(t,e,n){return Et(this,t,e,n,!1)};function de(r,t,e,n){e=Number(e)||0;var s=r.length-e;n?(n=Number(n),n>s&&(n=s)):n=s;var f=t.length;n>f/2&&(n=f/2);for(var m=0;m<n;++m){var b=parseInt(t.substr(m*2,2),16);if(et(b))return m;r[e+m]=b}return m}function ge(r,t,e,n){return H(tt(t,r.length-e),r,e,n)}function we(r,t,e,n){return H(Ie(t),r,e,n)}function ye(r,t,e,n){return H(It(t),r,e,n)}function ve(r,t,e,n){return H(je(t,r.length-e),r,e,n)}a.prototype.write=function(t,e,n,s){if(e===void 0)s="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")s=e,n=this.length,e=0;else if(isFinite(e))e=e>>>0,isFinite(n)?(n=n>>>0,s===void 0&&(s="utf8")):(s=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var f=this.length-e;if((n===void 0||n>f)&&(n=f),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");s||(s="utf8");for(var m=!1;;)switch(s){case"hex":return de(this,t,e,n);case"utf8":case"utf-8":return ge(this,t,e,n);case"ascii":case"latin1":case"binary":return we(this,t,e,n);case"base64":return ye(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ve(this,t,e,n);default:if(m)throw new TypeError("Unknown encoding: "+s);s=(""+s).toLowerCase(),m=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function be(r,t,e){return t===0&&e===r.length?o.fromByteArray(r):o.fromByteArray(r.slice(t,e))}function _t(r,t,e){e=Math.min(r.length,e);for(var n=[],s=t;s<e;){var f=r[s],m=null,b=f>239?4:f>223?3:f>191?2:1;if(s+b<=e){var F,_,B,A;switch(b){case 1:f<128&&(m=f);break;case 2:F=r[s+1],(F&192)===128&&(A=(f&31)<<6|F&63,A>127&&(m=A));break;case 3:F=r[s+1],_=r[s+2],(F&192)===128&&(_&192)===128&&(A=(f&15)<<12|(F&63)<<6|_&63,A>2047&&(A<55296||A>57343)&&(m=A));break;case 4:F=r[s+1],_=r[s+2],B=r[s+3],(F&192)===128&&(_&192)===128&&(B&192)===128&&(A=(f&15)<<18|(F&63)<<12|(_&63)<<6|B&63,A>65535&&A<1114112&&(m=A))}}m===null?(m=65533,b=1):m>65535&&(m-=65536,n.push(m>>>10&1023|55296),m=56320|m&1023),n.push(m),s+=b}return Ee(n)}var At=4096;function Ee(r){var t=r.length;if(t<=At)return String.fromCharCode.apply(String,r);for(var e="",n=0;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=At));return e}function Fe(r,t,e){var n="";e=Math.min(r.length,e);for(var s=t;s<e;++s)n+=String.fromCharCode(r[s]&127);return n}function _e(r,t,e){var n="";e=Math.min(r.length,e);for(var s=t;s<e;++s)n+=String.fromCharCode(r[s]);return n}function Ae(r,t,e){var n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);for(var s="",f=t;f<e;++f)s+=Ue[r[f]];return s}function Se(r,t,e){for(var n=r.slice(t,e),s="",f=0;f<n.length-1;f+=2)s+=String.fromCharCode(n[f]+n[f+1]*256);return s}a.prototype.slice=function(t,e){var n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);var s=this.subarray(t,e);return Object.setPrototypeOf(s,a.prototype),s};function S(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||S(t,e,this.length);for(var s=this[t],f=1,m=0;++m<e&&(f*=256);)s+=this[t+m]*f;return s},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||S(t,e,this.length);for(var s=this[t+--e],f=1;e>0&&(f*=256);)s+=this[t+--e]*f;return s},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t=t>>>0,e||S(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||S(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||S(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||S(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||S(t,e,this.length);for(var s=this[t],f=1,m=0;++m<e&&(f*=256);)s+=this[t+m]*f;return f*=128,s>=f&&(s-=Math.pow(2,8*e)),s},a.prototype.readIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||S(t,e,this.length);for(var s=e,f=1,m=this[t+--s];s>0&&(f*=256);)m+=this[t+--s]*f;return f*=128,m>=f&&(m-=Math.pow(2,8*e)),m},a.prototype.readInt8=function(t,e){return t=t>>>0,e||S(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},a.prototype.readInt16LE=function(t,e){t=t>>>0,e||S(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n},a.prototype.readInt16BE=function(t,e){t=t>>>0,e||S(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n},a.prototype.readInt32LE=function(t,e){return t=t>>>0,e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t=t>>>0,e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t=t>>>0,e||S(t,4,this.length),p.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t=t>>>0,e||S(t,4,this.length),p.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||S(t,8,this.length),p.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||S(t,8,this.length),p.read(this,t,!1,52,8)};function k(r,t,e,n,s,f){if(!a.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<f)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,n,s){if(t=+t,e=e>>>0,n=n>>>0,!s){var f=Math.pow(2,8*n)-1;k(this,t,e,n,f,0)}var m=1,b=0;for(this[e]=t&255;++b<n&&(m*=256);)this[e+b]=t/m&255;return e+n},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,n,s){if(t=+t,e=e>>>0,n=n>>>0,!s){var f=Math.pow(2,8*n)-1;k(this,t,e,n,f,0)}var m=n-1,b=1;for(this[e+m]=t&255;--m>=0&&(b*=256);)this[e+m]=t/b&255;return e+n},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,1,255,0),this[e]=t&255,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4},a.prototype.writeIntLE=function(t,e,n,s){if(t=+t,e=e>>>0,!s){var f=Math.pow(2,8*n-1);k(this,t,e,n,f-1,-f)}var m=0,b=1,F=0;for(this[e]=t&255;++m<n&&(b*=256);)t<0&&F===0&&this[e+m-1]!==0&&(F=1),this[e+m]=(t/b>>0)-F&255;return e+n},a.prototype.writeIntBE=function(t,e,n,s){if(t=+t,e=e>>>0,!s){var f=Math.pow(2,8*n-1);k(this,t,e,n,f-1,-f)}var m=n-1,b=1,F=0;for(this[e+m]=t&255;--m>=0&&(b*=256);)t<0&&F===0&&this[e+m+1]!==0&&(F=1),this[e+m]=(t/b>>0)-F&255;return e+n},a.prototype.writeInt8=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1},a.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2},a.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||k(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function St(r,t,e,n,s,f){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Bt(r,t,e,n,s){return t=+t,e=e>>>0,s||St(r,t,e,4),p.write(r,t,e,n,23,4),e+4}a.prototype.writeFloatLE=function(t,e,n){return Bt(this,t,e,!0,n)},a.prototype.writeFloatBE=function(t,e,n){return Bt(this,t,e,!1,n)};function kt(r,t,e,n,s){return t=+t,e=e>>>0,s||St(r,t,e,8),p.write(r,t,e,n,52,8),e+8}a.prototype.writeDoubleLE=function(t,e,n){return kt(this,t,e,!0,n)},a.prototype.writeDoubleBE=function(t,e,n){return kt(this,t,e,!1,n)},a.prototype.copy=function(t,e,n,s){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!s&&s!==0&&(s=this.length),e>=t.length&&(e=t.length),e||(e=0),s>0&&s<n&&(s=n),s===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("sourceEnd out of bounds");s>this.length&&(s=this.length),t.length-e<s-n&&(s=t.length-e+n);var f=s-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,n,s):Uint8Array.prototype.set.call(t,this.subarray(n,s),e),f},a.prototype.fill=function(t,e,n,s){if(typeof t=="string"){if(typeof e=="string"?(s=e,e=0,n=this.length):typeof n=="string"&&(s=n,n=this.length),s!==void 0&&typeof s!="string")throw new TypeError("encoding must be a string");if(typeof s=="string"&&!a.isEncoding(s))throw new TypeError("Unknown encoding: "+s);if(t.length===1){var f=t.charCodeAt(0);(s==="utf8"&&f<128||s==="latin1")&&(t=f)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);var m;if(typeof t=="number")for(m=e;m<n;++m)this[m]=t;else{var b=a.isBuffer(t)?t:a.from(t,s),F=b.length;if(F===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(m=0;m<n-e;++m)this[m+e]=b[m%F]}return this};var Be=/[^+/0-9A-Za-z-_]/g;function ke(r){if(r=r.split("=")[0],r=r.trim().replace(Be,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function tt(r,t){t=t||1/0;for(var e,n=r.length,s=null,f=[],m=0;m<n;++m){if(e=r.charCodeAt(m),e>55295&&e<57344){if(!s){if(e>56319){(t-=3)>-1&&f.push(239,191,189);continue}else if(m+1===n){(t-=3)>-1&&f.push(239,191,189);continue}s=e;continue}if(e<56320){(t-=3)>-1&&f.push(239,191,189),s=e;continue}e=(s-55296<<10|e-56320)+65536}else s&&(t-=3)>-1&&f.push(239,191,189);if(s=null,e<128){if((t-=1)<0)break;f.push(e)}else if(e<2048){if((t-=2)<0)break;f.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;f.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;f.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return f}function Ie(r){for(var t=[],e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function je(r,t){for(var e,n,s,f=[],m=0;m<r.length&&!((t-=2)<0);++m)e=r.charCodeAt(m),n=e>>8,s=e%256,f.push(s),f.push(n);return f}function It(r){return o.toByteArray(ke(r))}function H(r,t,e,n){for(var s=0;s<n&&!(s+e>=t.length||s>=r.length);++s)t[s+e]=r[s];return s}function O(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function et(r){return r!==r}var Ue=function(){for(var r="0123456789abcdef",t=new Array(256),e=0;e<16;++e)for(var n=e*16,s=0;s<16;++s)t[n+s]=r[e]+r[s];return t}()})(Vt);/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(i,o){var p=Vt,c=p.Buffer;function u(l,a){for(var x in l)a[x]=l[x]}c.from&&c.alloc&&c.allocUnsafe&&c.allocUnsafeSlow?i.exports=p:(u(p,o),o.Buffer=h);function h(l,a,x){return c(l,a,x)}h.prototype=Object.create(c.prototype),u(c,h),h.from=function(l,a,x){if(typeof l=="number")throw new TypeError("Argument must not be a number");return c(l,a,x)},h.alloc=function(l,a,x){if(typeof l!="number")throw new TypeError("Argument must be a number");var d=c(l);return a!==void 0?typeof x=="string"?d.fill(a,x):d.fill(a):d.fill(0),d},h.allocUnsafe=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return c(l)},h.allocUnsafeSlow=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return p.SlowBuffer(l)}})(nt,nt.exports);var Gt=nt.exports,Qt=Gt.Buffer;function X(i,o){this._block=Qt.alloc(i),this._finalSize=o,this._blockSize=i,this._len=0}X.prototype.update=function(i,o){typeof i=="string"&&(o=o||"utf8",i=Qt.from(i,o));for(var p=this._block,c=this._blockSize,u=i.length,h=this._len,l=0;l<u;){for(var a=h%c,x=Math.min(u-l,c-a),d=0;d<x;d++)p[a+d]=i[l+d];h+=x,l+=x,h%c===0&&this._update(p)}return this._len+=u,this};X.prototype.digest=function(i){var o=this._len%this._blockSize;this._block[o]=128,this._block.fill(0,o+1),o>=this._finalSize&&(this._update(this._block),this._block.fill(0));var p=this._len*8;if(p<=4294967295)this._block.writeUInt32BE(p,this._blockSize-4);else{var c=(p&4294967295)>>>0,u=(p-c)/4294967296;this._block.writeUInt32BE(u,this._blockSize-8),this._block.writeUInt32BE(c,this._blockSize-4)}this._update(this._block);var h=this._hash();return i?h.toString(i):h};X.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var ar=X,pr=Xe,te=ar,sr=Gt.Buffer,cr=[1518500249,1859775393,-1894007588,-899497514],lr=new Array(80);function W(){this.init(),this._w=lr,te.call(this,64,56)}pr(W,te);W.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function ur(i){return i<<1|i>>>31}function fr(i){return i<<5|i>>>27}function hr(i){return i<<30|i>>>2}function mr(i,o,p,c){return i===0?o&p|~o&c:i===2?o&p|o&c|p&c:o^p^c}W.prototype._update=function(i){for(var o=this._w,p=this._a|0,c=this._b|0,u=this._c|0,h=this._d|0,l=this._e|0,a=0;a<16;++a)o[a]=i.readInt32BE(a*4);for(;a<80;++a)o[a]=ur(o[a-3]^o[a-8]^o[a-14]^o[a-16]);for(var x=0;x<80;++x){var d=~~(x/20),E=fr(p)+mr(d,c,u,h)+l+o[x]+cr[d]|0;l=h,h=u,u=hr(c),c=p,p=E}this._a=p+this._a|0,this._b=c+this._b|0,this._c=u+this._c|0,this._d=h+this._d|0,this._e=l+this._e|0};W.prototype._hash=function(){var i=sr.allocUnsafe(20);return i.writeInt32BE(this._a|0,0),i.writeInt32BE(this._b|0,4),i.writeInt32BE(this._c|0,8),i.writeInt32BE(this._d|0,12),i.writeInt32BE(this._e|0,16),i};var xr=W;const dr=Yt(xr),xt=new Error("File system not available.");function gr(i,o,p){throw xt}function ee(i){throw xt}function wr(i){throw xt}const yr=async i=>ee();function vr(i){let o="";for(let p=0;p<i.length;p+=2)o+=String.fromCharCode(parseInt(i.substr(p,2),16));return btoa(o)}const G=(i,o="sha1")=>{if(o!=="sha1")throw new Error("Only sha1 algorithm is available.");const p=new dr;return vr(p.update(i).digest("hex"))};function ot(i){return[C,L].includes(i.type)}function at(i){return[Ht,C,L,J,Zt].includes(i.type)}function N(i,o,p,c,u="global"){if(!i)throw new Error("Empty action type");if(typeof i!="string")throw new Error(`Invalid action type: ${i}`);const h={type:i,input:o,scope:u};p&&(h.attachments=p);try{c==null||c().parse(h.input)}catch(l){throw new Error(`Invalid action input: ${l}`)}return h}function re(i,o=ht){return(p,c,u,h)=>o(p,c,i,u,h)}const ie=(i,o)=>({name:"",documentType:"",revision:{global:0,local:0},created:new Date().toISOString(),lastModified:new Date().toISOString(),attachments:{},...i,state:(o==null?void 0:o(i==null?void 0:i.state))??(i==null?void 0:i.state)??{global:{},local:{}}}),ne=(i,o)=>{const p=ie(i,o);return{...p,initialState:p,operations:{global:[],local:[]},clipboard:[]}},dt=(i,o="global")=>G(ze(i.state[o])),br=(i,o=1e3)=>{const p=Math.random()*o;return G(`${(i??new Date).toISOString()}${p}`)};function $(i){return z.castImmutable(z.freeze(i,!0))}function oe(i,o){const p=[...i];let c=o||0,u=p.length>0?p[p.length-1].index:0;const h=[];for(const l of p.reverse()){if(c>0){const d=u-l.index;c-=d}if(c<0)throw new Error("Invalid operation index, missing operations");const a={ignore:c>0,operation:l},x=l.skip>0?l.skip+1:0;if(x>0&&x>c){const d=x-c;c=c+d}u=l.index,h.push(a)}return h.reverse()}function Er(i){return Object.values(i).flatMap(o=>o).sort((o,p)=>new Date(o.timestamp).getTime()-new Date(p.timestamp).getTime())}function ae(i){return Object.values(i).flatMap(o=>o).sort((o,p)=>new Date(o.operation.timestamp).getTime()-new Date(p.operation.timestamp).getTime())}function Y(i,o,p,c,u,h=ht,l={}){const a=re(p,h);return gt(i,o,a,c,u,l)}function gt(i,o,p,c,u,h={}){const l=ne(i),a=Object.keys(o).reduce((w,v)=>{const y=v;return{...w,[y]:o[y].slice(0,u==null?void 0:u.revision[y])}},{}),x=Object.keys(a).reduce((w,v)=>{const y=v;return{...w,[y]:oe(a[y],h[y])}},{}),d=ae(x).reduce((w,{ignore:v,operation:y})=>v?p(w,yt(y.scope),c,{skip:y.skip,ignoreSkipOperations:!0}):p(w,y,c,{skip:y.skip,ignoreSkipOperations:!0}),l),E=Object.keys(d.operations).reduce((w,v)=>{const y=v,U=u&&u.revision[y]<o[y].length?o[y].slice(u.revision[y]):[];return{...w,[y]:[...d.operations[y].map((I,q)=>{var R;return{...I,timestamp:((R=o[y][q])==null?void 0:R.timestamp)??I.timestamp}}),...U]}},{global:[],local:[]});return{...d,operations:E}}const pe=i=>N("SET_NAME",i,void 0,ut,void 0),se=(i=1,o="global")=>N("UNDO",i,void 0,ft,o),ce=(i=1,o="global")=>N("REDO",i,void 0,lt,o),le=(i,o,p="global")=>N("PRUNE",{start:i,end:o},void 0,ct,p),wt=(i,o)=>N("LOAD_STATE",{state:i,operations:o},void 0,st),yt=(i="global")=>N("NOOP",{},void 0,void 0,i),Fr=Object.freeze(Object.defineProperty({__proto__:null,loadState:wt,noop:yt,prune:le,redo:ce,setName:pe,undo:se},Symbol.toStringTag,{value:"Module"}));function Q(){this._types=Object.create(null),this._extensions=Object.create(null);for(let i=0;i<arguments.length;i++)this.define(arguments[i]);this.define=this.define.bind(this),this.getType=this.getType.bind(this),this.getExtension=this.getExtension.bind(this)}Q.prototype.define=function(i,o){for(let p in i){let c=i[p].map(function(u){return u.toLowerCase()});p=p.toLowerCase();for(let u=0;u<c.length;u++){const h=c[u];if(h[0]!=="*"){if(!o&&h in this._types)throw new Error('Attempt to change mapping for "'+h+'" extension from "'+this._types[h]+'" to "'+p+'". Pass `force=true` to allow this, otherwise remove "'+h+'" from the list of extensions for "'+p+'".');this._types[h]=p}}if(o||!this._extensions[p]){const u=c[0];this._extensions[p]=u[0]!=="*"?u:u.substr(1)}}};Q.prototype.getType=function(i){i=String(i);let o=i.replace(/^.*[/\\]/,"").toLowerCase(),p=o.replace(/^.*\./,"").toLowerCase(),c=o.length<i.length;return(p.length<o.length-1||!c)&&this._types[p]||null};Q.prototype.getExtension=function(i){return i=/^\s*([^;\s]*)/.test(i)&&RegExp.$1,i&&this._extensions[i.toLowerCase()]||null};var _r=Q,Ar={"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["es","ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avif":["avif"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};let Sr=_r;var Br=new Sr(Ar);const kr=Yt(Br),vt=async i=>{const o=new Ot,{name:p,revision:c,documentType:u,created:h,lastModified:l}=i,a={name:p,revision:c,documentType:u,created:h,lastModified:l};return o.file("header.json",JSON.stringify(a,null,2)),o.file("state.json",JSON.stringify(i.initialState||{},null,2)),o.file("operations.json",JSON.stringify(i.operations,null,2)),Object.keys(i.attachments).forEach(d=>{const{data:E,...w}=i.attachments[d];o.file(d,E,{base64:!0,createFolders:!0,comment:JSON.stringify(w)})}),o},ue=async(i,o,p,c)=>{await(await vt(i)).generateAsync({type:"uint8array",streamFiles:!0});const h=c??i.name,l=`.${p}.zip`;return gr(o,h.endsWith(l)?h:`${h}${l}`)},Ir=async(i,o)=>{const c=await(await vt(i)).generateAsync({type:"blob"}),u=await o.createWritable();await u.write(c),await u.close()},pt=async(i,o)=>{const p=ee();return fe(p,o)},fe=async(i,o)=>{const p=new Ot;return await p.loadAsync(i),jr(p,o)};async function jr(i,o){const p=i.file("state.json");if(!p)throw new Error("Initial state not found");const c=await p.async("string"),u=JSON.parse(c),h=i.file("header.json");let l;h&&(l=JSON.parse(await h.async("string")));const a=i.file("operations.json");if(!a)throw new Error("Operations history not found");const x=JSON.parse(await a.async("string"));let d=gt(u,x,o,void 0,l);return l&&(d={...d,...l}),d}function he(i){const o=i.replace(/^.*\./,"")||void 0,p=i.replace(/^.*[/\\]/,"")||void 0;return{extension:o,fileName:p}}async function Ur(i){const{buffer:o,mimeType:p="application/octet-stream"}=await wr(),c=he(i),u=o.toString("base64");return{data:u,hash:G(u),mimeType:p,...c}}async function Or(i){const o=await yr(),p=kr.getType(i)||"application/octet-stream",c=he(i),u=o.toString("base64");return{data:u,hash:G(u),mimeType:p,...c}}class Tr{constructor(o,p,c){K(this,"_document");K(this,"_reducer");K(this,"_signalDispatch");this._reducer=o,this._document=p,this._signalDispatch=c}dispatch(o,p){return this._document=this._reducer(this._document,o,this._signalDispatch,p),this}saveToFile(o,p,c){return ue(this._document,o,p,c)}async loadFromFile(o){this._document=await pt(o,this._reducer)}static async stateFromFile(o,p){return await pt(o,p)}get state(){return $(this._document.state)}get operations(){return $(this._document.operations)}get name(){return this._document.name}get documentType(){return this._document.documentType}get created(){return this._document.created}get lastModified(){return this._document.lastModified}get revision(){return this._document.revision.global}getRevision(o){return this._document.revision[o]}get initialState(){return $(this._document.initialState)}toDocument(){return $(this._document)}getAttachment(o){return this._document.attachments[o]}setName(o){return this.dispatch(pe(o)),this}undo(o){return this.dispatch(se(o)),this}redo(o){return this.dispatch(ce(o)),this}prune(o,p){return this.dispatch(le(o,p)),this}loadState(o,p){return this.dispatch(wt(o,p)),this}}function zr(i,o){o.forEach(p=>{Object.getOwnPropertyNames(p.prototype).forEach(c=>{Object.defineProperty(i.prototype,c,Object.getOwnPropertyDescriptor(p.prototype,c)||Object.create(null))})})}exports.BaseActions=Fr;exports.BaseDocument=Tr;exports.applyMixins=zr;exports.baseReducer=ht;exports.createAction=N;exports.createDocument=ne;exports.createExtendedState=ie;exports.createReducer=re;exports.createZip=vt;exports.getLocalFile=Or;exports.getRemoteFile=Ur;exports.hashDocument=dt;exports.hashKey=br;exports.isBaseAction=at;exports.isUndoRedo=ot;exports.loadFromFile=pt;exports.loadFromInput=fe;exports.mapSkippedOperations=oe;exports.processUndoRedo=Kt;exports.readOnly=$;exports.replayDocument=gt;exports.replayOperations=Y;exports.saveToFile=ue;exports.saveToFileHandle=Ir;exports.sortMappedOperations=ae;exports.sortOperations=Er;exports.zod=Le;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * as z from
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * as z from './zod';
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { OperationScope } from '..';
|
|
2
2
|
export type Maybe<T> = T | null;
|
|
3
3
|
export type InputMaybe<T> = T | null | undefined;
|
|
4
|
-
export type Exact<T extends {
|
|
5
|
-
[key: string]: unknown;
|
|
6
|
-
}> = {
|
|
4
|
+
export type Exact<T extends Record<string, unknown>> = {
|
|
7
5
|
[K in keyof T]: T[K];
|
|
8
6
|
};
|
|
9
7
|
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
@@ -12,9 +10,7 @@ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
|
12
10
|
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
|
|
13
11
|
[SubKey in K]: Maybe<T[SubKey]>;
|
|
14
12
|
};
|
|
15
|
-
export type MakeEmpty<T extends {
|
|
16
|
-
[key: string]: unknown;
|
|
17
|
-
}, K extends keyof T> = {
|
|
13
|
+
export type MakeEmpty<T extends Record<string, unknown>, K extends keyof T> = {
|
|
18
14
|
[_ in K]?: never;
|
|
19
15
|
};
|
|
20
16
|
export type Incremental<T> = T | {
|
|
@@ -92,7 +88,7 @@ export type IOperation = {
|
|
|
92
88
|
export type Load_State = 'LOAD_STATE';
|
|
93
89
|
export type LoadStateAction = {
|
|
94
90
|
input: LoadStateActionInput;
|
|
95
|
-
type: Load_State
|
|
91
|
+
type: Load_State;
|
|
96
92
|
scope: OperationScope;
|
|
97
93
|
};
|
|
98
94
|
export type LoadStateActionInput = {
|
|
@@ -136,7 +132,7 @@ export type Operation = IOperation & {
|
|
|
136
132
|
export type Prune = 'PRUNE';
|
|
137
133
|
export type PruneAction = {
|
|
138
134
|
input: PruneActionInput;
|
|
139
|
-
type: Prune
|
|
135
|
+
type: Prune;
|
|
140
136
|
scope: OperationScope;
|
|
141
137
|
};
|
|
142
138
|
export type PruneActionInput = {
|
|
@@ -150,13 +146,13 @@ export type Query = {
|
|
|
150
146
|
export type Redo = 'REDO';
|
|
151
147
|
export type RedoAction = {
|
|
152
148
|
input: Scalars['Int']['input'];
|
|
153
|
-
type: Redo
|
|
149
|
+
type: Redo;
|
|
154
150
|
scope: OperationScope;
|
|
155
151
|
};
|
|
156
152
|
export type Set_Name = 'SET_NAME';
|
|
157
153
|
export type SetNameAction = {
|
|
158
154
|
input: Scalars['String']['input'];
|
|
159
|
-
type: Set_Name
|
|
155
|
+
type: Set_Name;
|
|
160
156
|
scope: 'global';
|
|
161
157
|
};
|
|
162
158
|
export type SetNameOperation = IOperation & {
|
|
@@ -170,12 +166,12 @@ export type SetNameOperation = IOperation & {
|
|
|
170
166
|
export type Undo = 'UNDO';
|
|
171
167
|
export type UndoAction = {
|
|
172
168
|
input: Scalars['Int']['input'];
|
|
173
|
-
type: Undo
|
|
169
|
+
type: Undo;
|
|
174
170
|
scope: OperationScope;
|
|
175
171
|
};
|
|
176
172
|
export type NOOP = 'NOOP';
|
|
177
173
|
export type NOOPAction = {
|
|
178
174
|
input: Scalars['Unknown']['input'];
|
|
179
|
-
type: NOOP
|
|
175
|
+
type: NOOP;
|
|
180
176
|
scope: OperationScope;
|
|
181
177
|
};
|
|
@@ -22,6 +22,7 @@ export type DeleteChildDocumentSignal = ISignal<'DELETE_CHILD_DOCUMENT', DeleteC
|
|
|
22
22
|
export type CopyChildDocumentInput = {
|
|
23
23
|
id: string;
|
|
24
24
|
newId: string;
|
|
25
|
+
synchronizationUnits: SynchronizationUnit[];
|
|
25
26
|
};
|
|
26
27
|
export type CopyChildDocumentSignal = ISignal<'COPY_CHILD_DOCUMENT', CopyChildDocumentInput>;
|
|
27
28
|
export type Signal = CreateChildDocumentSignal | DeleteChildDocumentSignal | CopyChildDocumentSignal;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export * from './base';
|
|
2
|
+
export { createAction, createDocument, createExtendedState, createReducer, hashDocument, hashKey, isBaseAction, mapSkippedOperations, readOnly, replayDocument, replayOperations, sortMappedOperations, sortOperations, } from './base';
|
|
2
3
|
export * from './file';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This is a scaffold file meant for customization:
|
|
3
|
-
* - modify it by implementing the reducer functions
|
|
4
|
-
* - delete the file and run the code generator again to have it reset
|
|
5
|
-
*/
|
|
2
|
+
* This is a scaffold file meant for customization:
|
|
3
|
+
* - modify it by implementing the reducer functions
|
|
4
|
+
* - delete the file and run the code generator again to have it reset
|
|
5
|
+
*/
|
|
6
6
|
import { DocumentModelVersioningOperations } from '../../gen/versioning/operations';
|
|
7
7
|
export declare const reducer: DocumentModelVersioningOperations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./internal/object-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./internal/object-ff6617a2.js");require("immer");require("json-stringify-deterministic");require("crypto");require("fs");require("https");require("path");require("jszip");const e=require("./internal/index-433d6a9b.js");require("zod");exports.Document=e.Document;exports.DocumentModel=e.DocumentModel$1;exports.actions=e.actions;exports.documentModel=e.documentModel;exports.module=e.module;exports.reducer=e.reducer;exports.utils=e.utils;exports.z=e.zod;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "./internal/object-
|
|
1
|
+
import "./internal/object-305e4c59.js";
|
|
2
2
|
import "immer";
|
|
3
3
|
import "json-stringify-deterministic";
|
|
4
|
-
import "jszip";
|
|
5
4
|
import "crypto";
|
|
6
5
|
import "fs";
|
|
7
6
|
import "https";
|
|
8
7
|
import "path";
|
|
9
|
-
import
|
|
8
|
+
import "jszip";
|
|
9
|
+
import { b as d, a as l, c as n, d as D, m as M, r as b, u as f, z as x } from "./internal/index-a46dcf07.js";
|
|
10
10
|
import "zod";
|
|
11
11
|
export {
|
|
12
12
|
d as Document,
|
package/dist/node/document.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./internal/object-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./internal/object-ff6617a2.js"),r=require("./internal/index-78c035e1.js");require("immer");require("json-stringify-deterministic");require("zod");require("crypto");require("fs");require("https");require("path");require("jszip");exports.BaseDocument=e.BaseDocument;exports.actions=e.BaseActions;exports.applyMixins=e.applyMixins;exports.baseReducer=e.baseReducer;exports.processUndoRedo=e.processUndoRedo;exports.z=e.zod;exports.utils=r.index;
|
package/dist/node/document.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { B as n, h as x, g as d, x as u, y as f, z as l } from "./internal/object-
|
|
2
|
-
import { i as B } from "./internal/index-
|
|
1
|
+
import { B as n, h as x, g as d, x as u, y as f, z as l } from "./internal/object-305e4c59.js";
|
|
2
|
+
import { i as B } from "./internal/index-2d55ed8c.js";
|
|
3
3
|
import "immer";
|
|
4
4
|
import "json-stringify-deterministic";
|
|
5
5
|
import "zod";
|
|
6
|
-
import "jszip";
|
|
7
6
|
import "crypto";
|
|
8
7
|
import "fs";
|
|
9
8
|
import "https";
|
|
10
9
|
import "path";
|
|
10
|
+
import "jszip";
|
|
11
11
|
export {
|
|
12
12
|
n as BaseDocument,
|
|
13
13
|
x as actions,
|
package/dist/node/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./internal/index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./internal/index-78c035e1.js"),o=require("./internal/index-433d6a9b.js");require("./internal/object-ff6617a2.js");require("immer");require("json-stringify-deterministic");require("zod");require("crypto");require("fs");require("https");require("path");require("jszip");const u={"powerhouse/document":e.Document,"powerhouse/document-model":o.DocumentModel},r={Document:e.Document,DocumentModel:o.DocumentModel};exports.Document=e.Document;exports.DocumentModel=o.DocumentModel;exports.DocumentModels=u;exports.default=r;
|
package/dist/node/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { D as o } from "./internal/index-
|
|
2
|
-
import { D as t } from "./internal/index-
|
|
3
|
-
import "./internal/object-
|
|
1
|
+
import { D as o } from "./internal/index-2d55ed8c.js";
|
|
2
|
+
import { D as t } from "./internal/index-a46dcf07.js";
|
|
3
|
+
import "./internal/object-305e4c59.js";
|
|
4
4
|
import "immer";
|
|
5
5
|
import "json-stringify-deterministic";
|
|
6
6
|
import "zod";
|
|
7
|
-
import "jszip";
|
|
8
7
|
import "crypto";
|
|
9
8
|
import "fs";
|
|
10
9
|
import "https";
|
|
11
10
|
import "path";
|
|
11
|
+
import "jszip";
|
|
12
12
|
const a = {
|
|
13
13
|
"powerhouse/document": o,
|
|
14
14
|
"powerhouse/document-model": t
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as e, b as a, a as s, c as o, j as t, k as r, m as n, n as i, o as c, i as l, p, l as d, e as u, q as m, r as y, t as O, u as b, s as _, d as g, v as F, w as f, B as D, h as S, g as h, x as j, y as v, z as x } from "./object-
|
|
1
|
+
import { f as e, b as a, a as s, c as o, j as t, k as r, m as n, n as i, o as c, i as l, p, l as d, e as u, q as m, r as y, t as O, u as b, s as _, d as g, v as F, w as f, B as D, h as S, g as h, x as j, y as v, z as x } from "./object-305e4c59.js";
|
|
2
2
|
const z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3
3
|
__proto__: null,
|
|
4
4
|
createAction: e,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var mt=Object.defineProperty;var Et=(t,e,r)=>e in t?mt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var me=(t,e,r)=>(Et(t,typeof e!="symbol"?e+"":e,r),r);const s=require("./object-
|
|
1
|
+
"use strict";var mt=Object.defineProperty;var Et=(t,e,r)=>e in t?mt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var me=(t,e,r)=>(Et(t,typeof e!="symbol"?e+"":e,r),r);const s=require("./object-ff6617a2.js");require("immer");require("json-stringify-deterministic");require("crypto");require("fs");require("https");require("path");require("jszip");const o=require("zod"),ht=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),_={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:[],modules:[{name:"header",operations:[{name:"SetModelName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetModelId",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetModelExtension",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetModelDescription",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetAuthorName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetAuthorWebsite",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"versioning",operations:[{name:"AddChangeLogItem",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UpdateChangeLogItem",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteChangeLogItem",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderChangeLogItems",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReleaseNewVersion",schema:null,id:"",description:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"module",operations:[{name:"AddModule",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetModuleName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetModuleDescription",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteModule",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderModules",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"operation-error",operations:[{name:"AddOperationError",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationErrorCode",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationErrorName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationErrorDescription",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationErrorTemplate",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteOperationError",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderOperationErrors",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"operation-example",operations:[{name:"AddOperationExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UpdateOperationExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteOperationExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderOperationExamples",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"operation",operations:[{name:"AddOperation",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationSchema",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationDescription",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationTemplate",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationReducer",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"MoveOperation",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteOperation",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderModuleOperations",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"state",operations:[{name:"SetStateSchema",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetInitialState",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"AddStateExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UpdateStateExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteStateExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderStateExamples",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""}],state:{global:{schema:"",initialValue:`{
|
|
2
2
|
"id": "",
|
|
3
3
|
"name": "",
|
|
4
4
|
"extension": "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./object-
|
|
1
|
+
"use strict";const e=require("./object-ff6617a2.js"),o=Object.freeze(Object.defineProperty({__proto__:null,createAction:e.createAction,createDocument:e.createDocument,createExtendedState:e.createExtendedState,createReducer:e.createReducer,createZip:e.createZip,getLocalFile:e.getLocalFile,getRemoteFile:e.getRemoteFile,hashDocument:e.hashDocument,hashKey:e.hashKey,isBaseAction:e.isBaseAction,isUndoRedo:e.isUndoRedo,loadFromFile:e.loadFromFile,loadFromInput:e.loadFromInput,mapSkippedOperations:e.mapSkippedOperations,readOnly:e.readOnly,replayDocument:e.replayDocument,replayOperations:e.replayOperations,saveToFile:e.saveToFile,saveToFileHandle:e.saveToFileHandle,sortMappedOperations:e.sortMappedOperations,sortOperations:e.sortOperations},Symbol.toStringTag,{value:"Module"})),t=Object.freeze(Object.defineProperty({__proto__:null,BaseDocument:e.BaseDocument,actions:e.BaseActions,applyMixins:e.applyMixins,baseReducer:e.baseReducer,processUndoRedo:e.processUndoRedo,utils:o,z:e.zod},Symbol.toStringTag,{value:"Module"}));exports.Document=t;exports.index=o;
|