document-model 1.0.8 → 1.0.10
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/types.d.ts +8 -0
- package/dist/browser/document/utils/base.d.ts +2 -2
- package/dist/browser/document-model/gen/operation/actions.d.ts +3 -2
- package/dist/browser/document-model/gen/operation/creators.d.ts +3 -2
- package/dist/browser/document-model/gen/operation/object.d.ts +2 -1
- package/dist/browser/document-model/gen/operation/operations.d.ts +2 -1
- package/dist/browser/document-model/gen/schema/types.d.ts +8 -0
- package/dist/browser/document-model/gen/schema/zod.d.ts +5 -1
- package/dist/browser/document-model/index.d.ts +1 -0
- 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-05592a17.js +22 -0
- package/dist/{node/internal/index-5b0ca13a.js → browser/internal/index-5dee4170.js} +1 -1
- package/dist/{node/internal/index-6a7277fe.js → browser/internal/index-a61bcd7c.js} +1 -1
- package/dist/browser/internal/{index-48f140bc.js → index-ea1557d4.js} +441 -373
- package/dist/browser/internal/{object-98a2cff6.js → object-35506f2f.js} +3 -3
- package/dist/browser/internal/{object-ceb8f869.js → object-70e4dae8.js} +1 -1
- package/dist/node/document/types.d.ts +8 -0
- package/dist/node/document/utils/base.d.ts +2 -2
- package/dist/node/document-model/gen/operation/actions.d.ts +3 -2
- package/dist/node/document-model/gen/operation/creators.d.ts +3 -2
- package/dist/node/document-model/gen/operation/object.d.ts +2 -1
- package/dist/node/document-model/gen/operation/operations.d.ts +2 -1
- package/dist/node/document-model/gen/schema/types.d.ts +8 -0
- package/dist/node/document-model/gen/schema/zod.d.ts +5 -1
- package/dist/node/document-model/index.d.ts +1 -0
- package/dist/node/document-model.cjs +1 -1
- package/dist/node/document-model.js +2 -2
- package/dist/node/document.cjs +1 -1
- package/dist/node/document.js +2 -2
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +3 -3
- package/dist/node/internal/{index-dfaca09a.js → index-0b946b7d.js} +441 -373
- package/dist/{browser/internal/index-ff22a5bb.js → node/internal/index-14934709.js} +1 -1
- package/dist/{browser/internal/index-9922a4fc.js → node/internal/index-7056a501.js} +1 -1
- package/dist/node/internal/index-fbe65e32.js +22 -0
- package/dist/node/internal/{object-10abe15d.js → object-8ed23327.js} +1 -1
- package/dist/node/internal/{object-6f942fcb.js → object-e24dafec.js} +16 -16
- package/package.json +1 -1
- package/dist/browser/internal/index-7d7d05c8.js +0 -22
- package/dist/node/internal/index-2e487f63.js +0 -22
|
@@ -1423,13 +1423,13 @@ function mi(n, a, s) {
|
|
|
1423
1423
|
function Ft(n) {
|
|
1424
1424
|
return [Pt, Z, Y, M, Wt].includes(n.type);
|
|
1425
1425
|
}
|
|
1426
|
-
function R(n, a, s, c) {
|
|
1426
|
+
function R(n, a, s, c, f = "global") {
|
|
1427
1427
|
if (!n)
|
|
1428
1428
|
throw new Error("Empty action type");
|
|
1429
1429
|
if (typeof n != "string")
|
|
1430
1430
|
throw new Error(`Invalid action type: ${n}`);
|
|
1431
|
-
const
|
|
1432
|
-
return c == null || c().parse(
|
|
1431
|
+
const m = { type: n, input: a, scope: f };
|
|
1432
|
+
return s && (m.attachments = s), c == null || c().parse(m), m;
|
|
1433
1433
|
}
|
|
1434
1434
|
function xi(n, a = mi) {
|
|
1435
1435
|
return (s, c) => a(s, c, n);
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
5
5
|
* @license MIT
|
|
6
|
-
*/(function(n){var a=W,s=lt,c=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=o,n.SlowBuffer=nr,n.INSPECT_MAX_BYTES=50;var f=2147483647;n.kMaxLength=f,o.TYPED_ARRAY_SUPPORT=m(),!o.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 m(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function u(e){if(e>f)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return F(e)}return x(e,t,r)}o.poolSize=8192;function x(e,t,r){if(typeof e=="string")return U(e,t);if(ArrayBuffer.isView(e))return O(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(I(e,ArrayBuffer)||e&&I(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(I(e,SharedArrayBuffer)||e&&I(e.buffer,SharedArrayBuffer)))return N(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var i=e.valueOf&&e.valueOf();if(i!=null&&i!==e)return o.from(i,t,r);var p=ir(e);if(p)return p;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return o.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}o.from=function(e,t,r){return x(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function w(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function v(e,t,r){return w(e),e<=0?u(e):t!==void 0?typeof r=="string"?u(e).fill(t,r):u(e).fill(t):u(e)}o.alloc=function(e,t,r){return v(e,t,r)};function F(e){return w(e),u(e<0?0:X(e)|0)}o.allocUnsafe=function(e){return F(e)},o.allocUnsafeSlow=function(e){return F(e)};function U(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=mt(e,t)|0,i=u(r),p=i.write(e,t);return p!==r&&(i=i.slice(0,p)),i}function B(e){for(var t=e.length<0?0:X(e.length)|0,r=u(t),i=0;i<t;i+=1)r[i]=e[i]&255;return r}function O(e){if(I(e,Uint8Array)){var t=new Uint8Array(e);return N(t.buffer,t.byteOffset,t.byteLength)}return B(e)}function N(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var i;return t===void 0&&r===void 0?i=new Uint8Array(e):r===void 0?i=new Uint8Array(e,t):i=new Uint8Array(e,t,r),Object.setPrototypeOf(i,o.prototype),i}function ir(e){if(o.isBuffer(e)){var t=X(e.length)|0,r=u(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||V(e.length)?u(0):B(e);if(e.type==="Buffer"&&Array.isArray(e.data))return B(e.data)}function X(e){if(e>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return e|0}function nr(e){return+e!=e&&(e=0),o.alloc(+e)}o.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==o.prototype},o.compare=function(t,r){if(I(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),I(r,Uint8Array)&&(r=o.from(r,r.offset,r.byteLength)),!o.isBuffer(t)||!o.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var i=t.length,p=r.length,l=0,h=Math.min(i,p);l<h;++l)if(t[l]!==r[l]){i=t[l],p=r[l];break}return i<p?-1:p<i?1:0},o.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}},o.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return o.alloc(0);var i;if(r===void 0)for(r=0,i=0;i<t.length;++i)r+=t[i].length;var p=o.allocUnsafe(r),l=0;for(i=0;i<t.length;++i){var h=t[i];if(I(h,Uint8Array))l+h.length>p.length?o.from(h).copy(p,l):Uint8Array.prototype.set.call(p,h,l);else if(o.isBuffer(h))h.copy(p,l);else throw new TypeError('"list" argument must be an Array of Buffers');l+=h.length}return p};function mt(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||I(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;for(var p=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return bt(e).length;default:if(p)return i?-1:G(e).length;t=(""+t).toLowerCase(),p=!0}}o.byteLength=mt;function ar(e,t,r){var i=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return xr(this,t,r);case"utf8":case"utf-8":return yt(this,t,r);case"ascii":return hr(this,t,r);case"latin1":case"binary":return mr(this,t,r);case"base64":return ur(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return dr(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}o.prototype._isBuffer=!0;function k(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}o.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 r=0;r<t;r+=2)k(this,r,r+1);return this},o.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 r=0;r<t;r+=4)k(this,r,r+3),k(this,r+1,r+2);return this},o.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 r=0;r<t;r+=8)k(this,r,r+7),k(this,r+1,r+6),k(this,r+2,r+5),k(this,r+3,r+4);return this},o.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?yt(this,0,t):ar.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:o.compare(this,t)===0},o.prototype.inspect=function(){var t="",r=n.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},c&&(o.prototype[c]=o.prototype.inspect),o.prototype.compare=function(t,r,i,p,l){if(I(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),i===void 0&&(i=t?t.length:0),p===void 0&&(p=0),l===void 0&&(l=this.length),r<0||i>t.length||p<0||l>this.length)throw new RangeError("out of range index");if(p>=l&&r>=i)return 0;if(p>=l)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,p>>>=0,l>>>=0,this===t)return 0;for(var h=l-p,y=i-r,g=Math.min(h,y),E=this.slice(p,l),A=t.slice(r,i),b=0;b<g;++b)if(E[b]!==A[b]){h=E[b],y=A[b];break}return h<y?-1:y<h?1:0};function xt(e,t,r,i,p){if(e.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,V(r)&&(r=p?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(p)return-1;r=e.length-1}else if(r<0)if(p)r=0;else return-1;if(typeof t=="string"&&(t=o.from(t,i)),o.isBuffer(t))return t.length===0?-1:dt(e,t,r,i,p);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?p?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):dt(e,[t],r,i,p);throw new TypeError("val must be string, number or Buffer")}function dt(e,t,r,i,p){var l=1,h=e.length,y=t.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(e.length<2||t.length<2)return-1;l=2,h/=2,y/=2,r/=2}function g(Ft,_t){return l===1?Ft[_t]:Ft.readUInt16BE(_t*l)}var E;if(p){var A=-1;for(E=r;E<h;E++)if(g(e,E)===g(t,A===-1?0:E-A)){if(A===-1&&(A=E),E-A+1===y)return A*l}else A!==-1&&(E-=E-A),A=-1}else for(r+y>h&&(r=h-y),E=r;E>=0;E--){for(var b=!0,$=0;$<y;$++)if(g(e,E+$)!==g(t,$)){b=!1;break}if(b)return E}return-1}o.prototype.includes=function(t,r,i){return this.indexOf(t,r,i)!==-1},o.prototype.indexOf=function(t,r,i){return xt(this,t,r,i,!0)},o.prototype.lastIndexOf=function(t,r,i){return xt(this,t,r,i,!1)};function or(e,t,r,i){r=Number(r)||0;var p=e.length-r;i?(i=Number(i),i>p&&(i=p)):i=p;var l=t.length;i>l/2&&(i=l/2);for(var h=0;h<i;++h){var y=parseInt(t.substr(h*2,2),16);if(V(y))return h;e[r+h]=y}return h}function pr(e,t,r,i){return q(G(t,e.length-r),e,r,i)}function sr(e,t,r,i){return q(gr(t),e,r,i)}function cr(e,t,r,i){return q(bt(t),e,r,i)}function lr(e,t,r,i){return q(vr(t,e.length-r),e,r,i)}o.prototype.write=function(t,r,i,p){if(r===void 0)p="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")p=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,p===void 0&&(p="utf8")):(p=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var l=this.length-r;if((i===void 0||i>l)&&(i=l),t.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");p||(p="utf8");for(var h=!1;;)switch(p){case"hex":return or(this,t,r,i);case"utf8":case"utf-8":return pr(this,t,r,i);case"ascii":case"latin1":case"binary":return sr(this,t,r,i);case"base64":return cr(this,t,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lr(this,t,r,i);default:if(h)throw new TypeError("Unknown encoding: "+p);p=(""+p).toLowerCase(),h=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ur(e,t,r){return t===0&&r===e.length?a.fromByteArray(e):a.fromByteArray(e.slice(t,r))}function yt(e,t,r){r=Math.min(e.length,r);for(var i=[],p=t;p<r;){var l=e[p],h=null,y=l>239?4:l>223?3:l>191?2:1;if(p+y<=r){var g,E,A,b;switch(y){case 1:l<128&&(h=l);break;case 2:g=e[p+1],(g&192)===128&&(b=(l&31)<<6|g&63,b>127&&(h=b));break;case 3:g=e[p+1],E=e[p+2],(g&192)===128&&(E&192)===128&&(b=(l&15)<<12|(g&63)<<6|E&63,b>2047&&(b<55296||b>57343)&&(h=b));break;case 4:g=e[p+1],E=e[p+2],A=e[p+3],(g&192)===128&&(E&192)===128&&(A&192)===128&&(b=(l&15)<<18|(g&63)<<12|(E&63)<<6|A&63,b>65535&&b<1114112&&(h=b))}}h===null?(h=65533,y=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|h&1023),i.push(h),p+=y}return fr(i)}var wt=4096;function fr(e){var t=e.length;if(t<=wt)return String.fromCharCode.apply(String,e);for(var r="",i=0;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=wt));return r}function hr(e,t,r){var i="";r=Math.min(e.length,r);for(var p=t;p<r;++p)i+=String.fromCharCode(e[p]&127);return i}function mr(e,t,r){var i="";r=Math.min(e.length,r);for(var p=t;p<r;++p)i+=String.fromCharCode(e[p]);return i}function xr(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var p="",l=t;l<r;++l)p+=Er[e[l]];return p}function dr(e,t,r){for(var i=e.slice(t,r),p="",l=0;l<i.length-1;l+=2)p+=String.fromCharCode(i[l]+i[l+1]*256);return p}o.prototype.slice=function(t,r){var i=this.length;t=~~t,r=r===void 0?i:~~r,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<t&&(r=t);var p=this.subarray(t,r);return Object.setPrototypeOf(p,o.prototype),p};function _(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||_(t,r,this.length);for(var p=this[t],l=1,h=0;++h<r&&(l*=256);)p+=this[t+h]*l;return p},o.prototype.readUintBE=o.prototype.readUIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||_(t,r,this.length);for(var p=this[t+--r],l=1;r>0&&(l*=256);)p+=this[t+--r]*l;return p},o.prototype.readUint8=o.prototype.readUInt8=function(t,r){return t=t>>>0,r||_(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||_(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||_(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||_(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||_(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||_(t,r,this.length);for(var p=this[t],l=1,h=0;++h<r&&(l*=256);)p+=this[t+h]*l;return l*=128,p>=l&&(p-=Math.pow(2,8*r)),p},o.prototype.readIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||_(t,r,this.length);for(var p=r,l=1,h=this[t+--p];p>0&&(l*=256);)h+=this[t+--p]*l;return l*=128,h>=l&&(h-=Math.pow(2,8*r)),h},o.prototype.readInt8=function(t,r){return t=t>>>0,r||_(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},o.prototype.readInt16LE=function(t,r){t=t>>>0,r||_(t,2,this.length);var i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i},o.prototype.readInt16BE=function(t,r){t=t>>>0,r||_(t,2,this.length);var i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i},o.prototype.readInt32LE=function(t,r){return t=t>>>0,r||_(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,r){return t=t>>>0,r||_(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,r){return t=t>>>0,r||_(t,4,this.length),s.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,r){return t=t>>>0,r||_(t,4,this.length),s.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||_(t,8,this.length),s.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||_(t,8,this.length),s.read(this,t,!1,52,8)};function S(e,t,r,i,p,l){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>p||t<l)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,r,i,p){if(t=+t,r=r>>>0,i=i>>>0,!p){var l=Math.pow(2,8*i)-1;S(this,t,r,i,l,0)}var h=1,y=0;for(this[r]=t&255;++y<i&&(h*=256);)this[r+y]=t/h&255;return r+i},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(t,r,i,p){if(t=+t,r=r>>>0,i=i>>>0,!p){var l=Math.pow(2,8*i)-1;S(this,t,r,i,l,0)}var h=i-1,y=1;for(this[r+h]=t&255;--h>=0&&(y*=256);)this[r+h]=t/y&255;return r+i},o.prototype.writeUint8=o.prototype.writeUInt8=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,1,255,0),this[r]=t&255,r+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4},o.prototype.writeIntLE=function(t,r,i,p){if(t=+t,r=r>>>0,!p){var l=Math.pow(2,8*i-1);S(this,t,r,i,l-1,-l)}var h=0,y=1,g=0;for(this[r]=t&255;++h<i&&(y*=256);)t<0&&g===0&&this[r+h-1]!==0&&(g=1),this[r+h]=(t/y>>0)-g&255;return r+i},o.prototype.writeIntBE=function(t,r,i,p){if(t=+t,r=r>>>0,!p){var l=Math.pow(2,8*i-1);S(this,t,r,i,l-1,-l)}var h=i-1,y=1,g=0;for(this[r+h]=t&255;--h>=0&&(y*=256);)t<0&&g===0&&this[r+h+1]!==0&&(g=1),this[r+h]=(t/y>>0)-g&255;return r+i},o.prototype.writeInt8=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1},o.prototype.writeInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2},o.prototype.writeInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2},o.prototype.writeInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},o.prototype.writeInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function gt(e,t,r,i,p,l){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function vt(e,t,r,i,p){return t=+t,r=r>>>0,p||gt(e,t,r,4),s.write(e,t,r,i,23,4),r+4}o.prototype.writeFloatLE=function(t,r,i){return vt(this,t,r,!0,i)},o.prototype.writeFloatBE=function(t,r,i){return vt(this,t,r,!1,i)};function Et(e,t,r,i,p){return t=+t,r=r>>>0,p||gt(e,t,r,8),s.write(e,t,r,i,52,8),r+8}o.prototype.writeDoubleLE=function(t,r,i){return Et(this,t,r,!0,i)},o.prototype.writeDoubleBE=function(t,r,i){return Et(this,t,r,!1,i)},o.prototype.copy=function(t,r,i,p){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(i||(i=0),!p&&p!==0&&(p=this.length),r>=t.length&&(r=t.length),r||(r=0),p>0&&p<i&&(p=i),p===i||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("sourceEnd out of bounds");p>this.length&&(p=this.length),t.length-r<p-i&&(p=t.length-r+i);var l=p-i;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,p):Uint8Array.prototype.set.call(t,this.subarray(i,p),r),l},o.prototype.fill=function(t,r,i,p){if(typeof t=="string"){if(typeof r=="string"?(p=r,r=0,i=this.length):typeof i=="string"&&(p=i,i=this.length),p!==void 0&&typeof p!="string")throw new TypeError("encoding must be a string");if(typeof p=="string"&&!o.isEncoding(p))throw new TypeError("Unknown encoding: "+p);if(t.length===1){var l=t.charCodeAt(0);(p==="utf8"&&l<128||p==="latin1")&&(t=l)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,t||(t=0);var h;if(typeof t=="number")for(h=r;h<i;++h)this[h]=t;else{var y=o.isBuffer(t)?t:o.from(t,p),g=y.length;if(g===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(h=0;h<i-r;++h)this[h+r]=y[h%g]}return this};var yr=/[^+/0-9A-Za-z-_]/g;function wr(e){if(e=e.split("=")[0],e=e.trim().replace(yr,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function G(e,t){t=t||1/0;for(var r,i=e.length,p=null,l=[],h=0;h<i;++h){if(r=e.charCodeAt(h),r>55295&&r<57344){if(!p){if(r>56319){(t-=3)>-1&&l.push(239,191,189);continue}else if(h+1===i){(t-=3)>-1&&l.push(239,191,189);continue}p=r;continue}if(r<56320){(t-=3)>-1&&l.push(239,191,189),p=r;continue}r=(p-55296<<10|r-56320)+65536}else p&&(t-=3)>-1&&l.push(239,191,189);if(p=null,r<128){if((t-=1)<0)break;l.push(r)}else if(r<2048){if((t-=2)<0)break;l.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;l.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;l.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return l}function gr(e){for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function vr(e,t){for(var r,i,p,l=[],h=0;h<e.length&&!((t-=2)<0);++h)r=e.charCodeAt(h),i=r>>8,p=r%256,l.push(p),l.push(i);return l}function bt(e){return a.toByteArray(wr(e))}function q(e,t,r,i){for(var p=0;p<i&&!(p+r>=t.length||p>=e.length);++p)t[p+r]=e[p];return p}function I(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function V(e){return e!==e}var Er=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var i=r*16,p=0;p<16;++p)t[i+p]=e[r]+e[p];return t}()})(Mt);/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(n,a){var s=Mt,c=s.Buffer;function f(u,o){for(var x in u)o[x]=u[x]}c.from&&c.alloc&&c.allocUnsafe&&c.allocUnsafeSlow?n.exports=s:(f(s,a),a.Buffer=m);function m(u,o,x){return c(u,o,x)}m.prototype=Object.create(c.prototype),f(c,m),m.from=function(u,o,x){if(typeof u=="number")throw new TypeError("Argument must not be a number");return c(u,o,x)},m.alloc=function(u,o,x){if(typeof u!="number")throw new TypeError("Argument must be a number");var w=c(u);return o!==void 0?typeof x=="string"?w.fill(o,x):w.fill(o):w.fill(0),w},m.allocUnsafe=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return c(u)},m.allocUnsafeSlow=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return s.SlowBuffer(u)}})(et,et.exports);var Ct=et.exports,Lt=Ct.Buffer;function H(n,a){this._block=Lt.alloc(n),this._finalSize=a,this._blockSize=n,this._len=0}H.prototype.update=function(n,a){typeof n=="string"&&(a=a||"utf8",n=Lt.from(n,a));for(var s=this._block,c=this._blockSize,f=n.length,m=this._len,u=0;u<f;){for(var o=m%c,x=Math.min(f-u,c-o),w=0;w<x;w++)s[o+w]=n[u+w];m+=x,u+=x,m%c===0&&this._update(s)}return this._len+=f,this};H.prototype.digest=function(n){var a=this._len%this._blockSize;this._block[a]=128,this._block.fill(0,a+1),a>=this._finalSize&&(this._update(this._block),this._block.fill(0));var s=this._len*8;if(s<=4294967295)this._block.writeUInt32BE(s,this._blockSize-4);else{var c=(s&4294967295)>>>0,f=(s-c)/4294967296;this._block.writeUInt32BE(f,this._blockSize-8),this._block.writeUInt32BE(c,this._blockSize-4)}this._update(this._block);var m=this._hash();return n?m.toString(n):m};H.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Wr=H,Hr=Nr,qt=Wr,Zr=Ct.Buffer,Kr=[1518500249,1859775393,-1894007588,-899497514],Yr=new Array(80);function L(){this.init(),this._w=Yr,qt.call(this,64,56)}Hr(L,qt);L.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Xr(n){return n<<1|n>>>31}function Gr(n){return n<<5|n>>>27}function Vr(n){return n<<30|n>>>2}function Qr(n,a,s,c){return n===0?a&s|~a&c:n===2?a&s|a&c|s&c:a^s^c}L.prototype._update=function(n){for(var a=this._w,s=this._a|0,c=this._b|0,f=this._c|0,m=this._d|0,u=this._e|0,o=0;o<16;++o)a[o]=n.readInt32BE(o*4);for(;o<80;++o)a[o]=Xr(a[o-3]^a[o-8]^a[o-14]^a[o-16]);for(var x=0;x<80;++x){var w=~~(x/20),v=Gr(s)+Qr(w,c,f,m)+u+a[x]+Kr[w]|0;u=m,m=f,f=Vr(c),c=s,s=v}this._a=s+this._a|0,this._b=c+this._b|0,this._c=f+this._c|0,this._d=m+this._d|0,this._e=u+this._e|0};L.prototype._hash=function(){var n=Zr.allocUnsafe(20);return n.writeInt32BE(this._a|0,0),n.writeInt32BE(this._b|0,4),n.writeInt32BE(this._c|0,8),n.writeInt32BE(this._d|0,12),n.writeInt32BE(this._e|0,16),n};var te=L;const re=Nt(te),ut=new Error("File system not available.");function ee(n,a,s){throw ut}function $t(n){throw ut}function ie(n){throw ut}const ne=async n=>$t();function ae(n){let a="";for(let s=0;s<n.length;s+=2)a+=String.fromCharCode(parseInt(n.substr(s,2),16));return btoa(a)}const Z=(n,a="sha1")=>{if(a!=="sha1")throw new Error("Only sha1 algorithm is available.");const s=new re;return ae(s.update(n).digest("hex"))},ft=async n=>{const a=new At,{name:s,revision:c,documentType:f,created:m,lastModified:u}=n,o={name:s,revision:c,documentType:f,created:m,lastModified:u};return a.file("header.json",JSON.stringify(o,null,2)),a.file("state.json",JSON.stringify(n.initialState||{},null,2)),a.file("operations.json",JSON.stringify(n.operations,null,2)),Object.keys(n.attachments).forEach(w=>{const{data:v,...F}=n.attachments[w];a.file(w,v,{base64:!0,createFolders:!0,comment:JSON.stringify(F)})}),a},Jt=async(n,a,s,c)=>{await(await ft(n)).generateAsync({type:"uint8array",streamFiles:!0});const m=c??n.name,u=`.${s}.zip`;return ee(a,m.endsWith(u)?m:`${m}${u}`)},oe=async(n,a)=>{const c=await(await ft(n)).generateAsync({type:"blob"}),f=await a.createWritable();await f.write(c),await f.close()},it=async(n,a)=>{const s=$t();return Pt(s,a)},Pt=async(n,a)=>{const s=new At;return await s.loadAsync(n),pe(s,a)};async function pe(n,a){const s=n.file("state.json");if(!s)throw new Error("Initial state not found");const c=await s.async("string"),f=JSON.parse(c),m=n.file("header.json");let u=null;m&&(u=JSON.parse(await m.async("string")));const o=n.file("operations.json");if(!o)throw new Error("Operations history not found");const x=JSON.parse(await o.async("string")),w={...f,...u,initialState:f,operations:[],attachments:{...f.attachments}};let v=x.slice(0,u==null?void 0:u.revision).reduce((F,U)=>a(F,U),w);return u&&(v={...v,...u,operations:[...v.operations,...x.slice(u.revision)]}),v}function Wt(n){const a=n.replace(/^.*\./,"")||void 0,s=n.replace(/^.*[/\\]/,"")||void 0;return{extension:a,fileName:s}}async function se(n){const{buffer:a,mimeType:s="application/octet-stream"}=await ie(),c=Wt(n),f=a.toString("base64");return{data:f,hash:Z(f),mimeType:s,...c}}async function ce(n){const a=await ne(),s=Or.getType(n)||"application/octet-stream",c=Wt(n),f=a.toString("base64");return{data:f,hash:Z(f),mimeType:s,...c}}function J(n,a,s){const c=Gt(n),f=Yt(s);return a.reduce((m,u)=>f(m,u),c)}function le(n,a){return{...n,name:a}}function ue(n,a,s){const c=Math.min(a,n.revision),f=n.operations.slice(0,n.revision-c);return{...J(n.initialState,f,s),operations:n.operations,revision:n.revision-c}}function fe(n,a,s){const c=n.operations.length-n.revision;if(!c)throw new Error("There is no UNDO operation to REDO");const f=a<c?a:c,m=n.operations.slice(0,n.revision+f);return{...J(n.initialState,m,s),operations:n.operations,revision:n.revision+f}}function he(n,a,s,c){a=a||0,s=s||n.operations.length;const f=n.operations.slice(a,s),m=n.operations.slice(0,a),u=n.operations.slice(s),o=J(n.initialState,m.concat(f),c),{name:x,state:w}=o;return J(n.initialState,[...m,ht({name:x,state:w},f.length),...u],c)}function me(n,a){return{...n,name:a.name,state:a.state??{}}}const Ht="SET_NAME",K="UNDO",Y="REDO",C="PRUNE",Zt="LOAD_STATE";function xe(n,a){return[K,Y,C].includes(a.type)?n.revision:n.revision+1}function de(n,a){return{...n,revision:xe(n,a),lastModified:new Date().toISOString()}}function ye(n,a){if([K,Y,C,C].includes(a.type))return n;const s=n.operations.slice(0,n.revision);return{...n,operations:[...s,{...a,index:s.length,timestamp:new Date().toISOString(),hash:""}]}}function we(n,a){let s=ye(n,a);return s=de(s,a),s}function ge(n,a,s){switch(kt().parse(a),a.type){case Ht:return le(n,a.input);case K:return ue(n,a.input,s);case Y:return fe(n,a.input,s);case C:return he(n,a.input.start,a.input.end,s);case Zt:return me(n,a.input.state);default:return n}}function Kt(n,a,s){let c=n;return nt(a)&&(c=ge(c,a,s)),c=we(c,a),c=R.produce(c,f=>{const m=s(f.state,a);if(m)return R.castDraft({...c,state:m})}),R.produce(c,f=>{f.operations[f.operations.length-1].hash=Vt(f),!nt(a)&&a.attachments&&a.attachments.forEach(m=>{const{hash:u,...o}=m;f.attachments[u]={...o}})})}function nt(n){return[Ht,K,Y,C,Zt].includes(n.type)}function D(n,a,s,c){if(!n)throw new Error("Empty action type");if(typeof n!="string")throw new Error(`Invalid action type: ${n}`);const f=s?{type:n,input:a,attachments:s}:{type:n,input:a};return c==null||c().parse(f),f}function Yt(n,a=Kt){return(s,c)=>a(s,c,n)}const Xt=(n,a)=>({name:"",documentType:"",revision:0,created:new Date().toISOString(),lastModified:new Date().toISOString(),attachments:{},...n,state:(a==null?void 0:a(n==null?void 0:n.state))??(n==null?void 0:n.state)??{}}),Gt=(n,a)=>{const s=Xt(n,a);return{...s,initialState:s,operations:[]}},Vt=n=>Z(_r(n.state)),ve=(n,a=1e3)=>{const s=Math.random()*a;return Z(`${(n??new Date).toISOString()}${s}`)};function M(n){return R.castImmutable(R.freeze(n,!0))}const Qt=n=>D("SET_NAME",n,void 0,st),tr=(n=1)=>D("UNDO",n,void 0,ct),rr=(n=1)=>D("REDO",n,void 0,pt),er=(n,a)=>D("PRUNE",{start:n,end:a},void 0,ot),ht=(n,a)=>D("LOAD_STATE",{state:n,operations:a},void 0,at),Ee=Object.freeze(Object.defineProperty({__proto__:null,loadState:ht,prune:er,redo:rr,setName:Qt,undo:tr},Symbol.toStringTag,{value:"Module"}));class be{constructor(a,s){Q(this,"_document");Q(this,"_reducer");this._reducer=a,this._document=s}dispatch(a){return this._document=this._reducer(this._document,a),this}saveToFile(a,s,c){return Jt(this._document,a,s,c)}async loadFromFile(a){this._document=await it(a,this._reducer)}static async stateFromFile(a,s){return await it(a,s)}get state(){return M(this._document.state)}get operations(){return M(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}get initialState(){return M(this._document.initialState)}toDocument(){return M(this._document)}getAttachment(a){return this._document.attachments[a]}setName(a){return this.dispatch(Qt(a)),this}undo(a){return this.dispatch(tr(a)),this}redo(a){return this.dispatch(rr(a)),this}prune(a,s){return this.dispatch(er(a,s)),this}loadState(a,s){return this.dispatch(ht(a,s)),this}}function Fe(n,a){a.forEach(s=>{Object.getOwnPropertyNames(s.prototype).forEach(c=>{Object.defineProperty(n.prototype,c,Object.getOwnPropertyDescriptor(s.prototype,c)||Object.create(null))})})}exports.BaseActions=Ee;exports.BaseDocument=be;exports.applyMixins=Fe;exports.baseReducer=Kt;exports.createAction=D;exports.createDocument=Gt;exports.createExtendedState=Xt;exports.createReducer=Yt;exports.createZip=ft;exports.getLocalFile=ce;exports.getRemoteFile=se;exports.hashDocument=Vt;exports.hashKey=ve;exports.isBaseAction=nt;exports.loadFromFile=it;exports.loadFromInput=Pt;exports.readOnly=M;exports.saveToFile=Jt;exports.saveToFileHandle=oe;exports.zod=Ir;
|
|
6
|
+
*/(function(n){var a=W,s=lt,c=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=o,n.SlowBuffer=nr,n.INSPECT_MAX_BYTES=50;var f=2147483647;n.kMaxLength=f,o.TYPED_ARRAY_SUPPORT=m(),!o.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 m(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function u(e){if(e>f)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return F(e)}return x(e,t,r)}o.poolSize=8192;function x(e,t,r){if(typeof e=="string")return U(e,t);if(ArrayBuffer.isView(e))return O(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(I(e,ArrayBuffer)||e&&I(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(I(e,SharedArrayBuffer)||e&&I(e.buffer,SharedArrayBuffer)))return N(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var i=e.valueOf&&e.valueOf();if(i!=null&&i!==e)return o.from(i,t,r);var p=ir(e);if(p)return p;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return o.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}o.from=function(e,t,r){return x(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function w(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function v(e,t,r){return w(e),e<=0?u(e):t!==void 0?typeof r=="string"?u(e).fill(t,r):u(e).fill(t):u(e)}o.alloc=function(e,t,r){return v(e,t,r)};function F(e){return w(e),u(e<0?0:X(e)|0)}o.allocUnsafe=function(e){return F(e)},o.allocUnsafeSlow=function(e){return F(e)};function U(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=mt(e,t)|0,i=u(r),p=i.write(e,t);return p!==r&&(i=i.slice(0,p)),i}function B(e){for(var t=e.length<0?0:X(e.length)|0,r=u(t),i=0;i<t;i+=1)r[i]=e[i]&255;return r}function O(e){if(I(e,Uint8Array)){var t=new Uint8Array(e);return N(t.buffer,t.byteOffset,t.byteLength)}return B(e)}function N(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var i;return t===void 0&&r===void 0?i=new Uint8Array(e):r===void 0?i=new Uint8Array(e,t):i=new Uint8Array(e,t,r),Object.setPrototypeOf(i,o.prototype),i}function ir(e){if(o.isBuffer(e)){var t=X(e.length)|0,r=u(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||V(e.length)?u(0):B(e);if(e.type==="Buffer"&&Array.isArray(e.data))return B(e.data)}function X(e){if(e>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return e|0}function nr(e){return+e!=e&&(e=0),o.alloc(+e)}o.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==o.prototype},o.compare=function(t,r){if(I(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),I(r,Uint8Array)&&(r=o.from(r,r.offset,r.byteLength)),!o.isBuffer(t)||!o.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var i=t.length,p=r.length,l=0,h=Math.min(i,p);l<h;++l)if(t[l]!==r[l]){i=t[l],p=r[l];break}return i<p?-1:p<i?1:0},o.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}},o.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return o.alloc(0);var i;if(r===void 0)for(r=0,i=0;i<t.length;++i)r+=t[i].length;var p=o.allocUnsafe(r),l=0;for(i=0;i<t.length;++i){var h=t[i];if(I(h,Uint8Array))l+h.length>p.length?o.from(h).copy(p,l):Uint8Array.prototype.set.call(p,h,l);else if(o.isBuffer(h))h.copy(p,l);else throw new TypeError('"list" argument must be an Array of Buffers');l+=h.length}return p};function mt(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||I(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;for(var p=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return bt(e).length;default:if(p)return i?-1:G(e).length;t=(""+t).toLowerCase(),p=!0}}o.byteLength=mt;function ar(e,t,r){var i=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return xr(this,t,r);case"utf8":case"utf-8":return yt(this,t,r);case"ascii":return hr(this,t,r);case"latin1":case"binary":return mr(this,t,r);case"base64":return ur(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return dr(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}o.prototype._isBuffer=!0;function k(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}o.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 r=0;r<t;r+=2)k(this,r,r+1);return this},o.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 r=0;r<t;r+=4)k(this,r,r+3),k(this,r+1,r+2);return this},o.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 r=0;r<t;r+=8)k(this,r,r+7),k(this,r+1,r+6),k(this,r+2,r+5),k(this,r+3,r+4);return this},o.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?yt(this,0,t):ar.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:o.compare(this,t)===0},o.prototype.inspect=function(){var t="",r=n.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},c&&(o.prototype[c]=o.prototype.inspect),o.prototype.compare=function(t,r,i,p,l){if(I(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),i===void 0&&(i=t?t.length:0),p===void 0&&(p=0),l===void 0&&(l=this.length),r<0||i>t.length||p<0||l>this.length)throw new RangeError("out of range index");if(p>=l&&r>=i)return 0;if(p>=l)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,p>>>=0,l>>>=0,this===t)return 0;for(var h=l-p,y=i-r,g=Math.min(h,y),E=this.slice(p,l),A=t.slice(r,i),b=0;b<g;++b)if(E[b]!==A[b]){h=E[b],y=A[b];break}return h<y?-1:y<h?1:0};function xt(e,t,r,i,p){if(e.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,V(r)&&(r=p?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(p)return-1;r=e.length-1}else if(r<0)if(p)r=0;else return-1;if(typeof t=="string"&&(t=o.from(t,i)),o.isBuffer(t))return t.length===0?-1:dt(e,t,r,i,p);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?p?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):dt(e,[t],r,i,p);throw new TypeError("val must be string, number or Buffer")}function dt(e,t,r,i,p){var l=1,h=e.length,y=t.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(e.length<2||t.length<2)return-1;l=2,h/=2,y/=2,r/=2}function g(Ft,_t){return l===1?Ft[_t]:Ft.readUInt16BE(_t*l)}var E;if(p){var A=-1;for(E=r;E<h;E++)if(g(e,E)===g(t,A===-1?0:E-A)){if(A===-1&&(A=E),E-A+1===y)return A*l}else A!==-1&&(E-=E-A),A=-1}else for(r+y>h&&(r=h-y),E=r;E>=0;E--){for(var b=!0,$=0;$<y;$++)if(g(e,E+$)!==g(t,$)){b=!1;break}if(b)return E}return-1}o.prototype.includes=function(t,r,i){return this.indexOf(t,r,i)!==-1},o.prototype.indexOf=function(t,r,i){return xt(this,t,r,i,!0)},o.prototype.lastIndexOf=function(t,r,i){return xt(this,t,r,i,!1)};function or(e,t,r,i){r=Number(r)||0;var p=e.length-r;i?(i=Number(i),i>p&&(i=p)):i=p;var l=t.length;i>l/2&&(i=l/2);for(var h=0;h<i;++h){var y=parseInt(t.substr(h*2,2),16);if(V(y))return h;e[r+h]=y}return h}function pr(e,t,r,i){return q(G(t,e.length-r),e,r,i)}function sr(e,t,r,i){return q(gr(t),e,r,i)}function cr(e,t,r,i){return q(bt(t),e,r,i)}function lr(e,t,r,i){return q(vr(t,e.length-r),e,r,i)}o.prototype.write=function(t,r,i,p){if(r===void 0)p="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")p=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,p===void 0&&(p="utf8")):(p=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var l=this.length-r;if((i===void 0||i>l)&&(i=l),t.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");p||(p="utf8");for(var h=!1;;)switch(p){case"hex":return or(this,t,r,i);case"utf8":case"utf-8":return pr(this,t,r,i);case"ascii":case"latin1":case"binary":return sr(this,t,r,i);case"base64":return cr(this,t,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lr(this,t,r,i);default:if(h)throw new TypeError("Unknown encoding: "+p);p=(""+p).toLowerCase(),h=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ur(e,t,r){return t===0&&r===e.length?a.fromByteArray(e):a.fromByteArray(e.slice(t,r))}function yt(e,t,r){r=Math.min(e.length,r);for(var i=[],p=t;p<r;){var l=e[p],h=null,y=l>239?4:l>223?3:l>191?2:1;if(p+y<=r){var g,E,A,b;switch(y){case 1:l<128&&(h=l);break;case 2:g=e[p+1],(g&192)===128&&(b=(l&31)<<6|g&63,b>127&&(h=b));break;case 3:g=e[p+1],E=e[p+2],(g&192)===128&&(E&192)===128&&(b=(l&15)<<12|(g&63)<<6|E&63,b>2047&&(b<55296||b>57343)&&(h=b));break;case 4:g=e[p+1],E=e[p+2],A=e[p+3],(g&192)===128&&(E&192)===128&&(A&192)===128&&(b=(l&15)<<18|(g&63)<<12|(E&63)<<6|A&63,b>65535&&b<1114112&&(h=b))}}h===null?(h=65533,y=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|h&1023),i.push(h),p+=y}return fr(i)}var wt=4096;function fr(e){var t=e.length;if(t<=wt)return String.fromCharCode.apply(String,e);for(var r="",i=0;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=wt));return r}function hr(e,t,r){var i="";r=Math.min(e.length,r);for(var p=t;p<r;++p)i+=String.fromCharCode(e[p]&127);return i}function mr(e,t,r){var i="";r=Math.min(e.length,r);for(var p=t;p<r;++p)i+=String.fromCharCode(e[p]);return i}function xr(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var p="",l=t;l<r;++l)p+=Er[e[l]];return p}function dr(e,t,r){for(var i=e.slice(t,r),p="",l=0;l<i.length-1;l+=2)p+=String.fromCharCode(i[l]+i[l+1]*256);return p}o.prototype.slice=function(t,r){var i=this.length;t=~~t,r=r===void 0?i:~~r,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<t&&(r=t);var p=this.subarray(t,r);return Object.setPrototypeOf(p,o.prototype),p};function _(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||_(t,r,this.length);for(var p=this[t],l=1,h=0;++h<r&&(l*=256);)p+=this[t+h]*l;return p},o.prototype.readUintBE=o.prototype.readUIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||_(t,r,this.length);for(var p=this[t+--r],l=1;r>0&&(l*=256);)p+=this[t+--r]*l;return p},o.prototype.readUint8=o.prototype.readUInt8=function(t,r){return t=t>>>0,r||_(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||_(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||_(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||_(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||_(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||_(t,r,this.length);for(var p=this[t],l=1,h=0;++h<r&&(l*=256);)p+=this[t+h]*l;return l*=128,p>=l&&(p-=Math.pow(2,8*r)),p},o.prototype.readIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||_(t,r,this.length);for(var p=r,l=1,h=this[t+--p];p>0&&(l*=256);)h+=this[t+--p]*l;return l*=128,h>=l&&(h-=Math.pow(2,8*r)),h},o.prototype.readInt8=function(t,r){return t=t>>>0,r||_(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},o.prototype.readInt16LE=function(t,r){t=t>>>0,r||_(t,2,this.length);var i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i},o.prototype.readInt16BE=function(t,r){t=t>>>0,r||_(t,2,this.length);var i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i},o.prototype.readInt32LE=function(t,r){return t=t>>>0,r||_(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,r){return t=t>>>0,r||_(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,r){return t=t>>>0,r||_(t,4,this.length),s.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,r){return t=t>>>0,r||_(t,4,this.length),s.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||_(t,8,this.length),s.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||_(t,8,this.length),s.read(this,t,!1,52,8)};function S(e,t,r,i,p,l){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>p||t<l)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,r,i,p){if(t=+t,r=r>>>0,i=i>>>0,!p){var l=Math.pow(2,8*i)-1;S(this,t,r,i,l,0)}var h=1,y=0;for(this[r]=t&255;++y<i&&(h*=256);)this[r+y]=t/h&255;return r+i},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(t,r,i,p){if(t=+t,r=r>>>0,i=i>>>0,!p){var l=Math.pow(2,8*i)-1;S(this,t,r,i,l,0)}var h=i-1,y=1;for(this[r+h]=t&255;--h>=0&&(y*=256);)this[r+h]=t/y&255;return r+i},o.prototype.writeUint8=o.prototype.writeUInt8=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,1,255,0),this[r]=t&255,r+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4},o.prototype.writeIntLE=function(t,r,i,p){if(t=+t,r=r>>>0,!p){var l=Math.pow(2,8*i-1);S(this,t,r,i,l-1,-l)}var h=0,y=1,g=0;for(this[r]=t&255;++h<i&&(y*=256);)t<0&&g===0&&this[r+h-1]!==0&&(g=1),this[r+h]=(t/y>>0)-g&255;return r+i},o.prototype.writeIntBE=function(t,r,i,p){if(t=+t,r=r>>>0,!p){var l=Math.pow(2,8*i-1);S(this,t,r,i,l-1,-l)}var h=i-1,y=1,g=0;for(this[r+h]=t&255;--h>=0&&(y*=256);)t<0&&g===0&&this[r+h+1]!==0&&(g=1),this[r+h]=(t/y>>0)-g&255;return r+i},o.prototype.writeInt8=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1},o.prototype.writeInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2},o.prototype.writeInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2},o.prototype.writeInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},o.prototype.writeInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||S(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function gt(e,t,r,i,p,l){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function vt(e,t,r,i,p){return t=+t,r=r>>>0,p||gt(e,t,r,4),s.write(e,t,r,i,23,4),r+4}o.prototype.writeFloatLE=function(t,r,i){return vt(this,t,r,!0,i)},o.prototype.writeFloatBE=function(t,r,i){return vt(this,t,r,!1,i)};function Et(e,t,r,i,p){return t=+t,r=r>>>0,p||gt(e,t,r,8),s.write(e,t,r,i,52,8),r+8}o.prototype.writeDoubleLE=function(t,r,i){return Et(this,t,r,!0,i)},o.prototype.writeDoubleBE=function(t,r,i){return Et(this,t,r,!1,i)},o.prototype.copy=function(t,r,i,p){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(i||(i=0),!p&&p!==0&&(p=this.length),r>=t.length&&(r=t.length),r||(r=0),p>0&&p<i&&(p=i),p===i||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("sourceEnd out of bounds");p>this.length&&(p=this.length),t.length-r<p-i&&(p=t.length-r+i);var l=p-i;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,p):Uint8Array.prototype.set.call(t,this.subarray(i,p),r),l},o.prototype.fill=function(t,r,i,p){if(typeof t=="string"){if(typeof r=="string"?(p=r,r=0,i=this.length):typeof i=="string"&&(p=i,i=this.length),p!==void 0&&typeof p!="string")throw new TypeError("encoding must be a string");if(typeof p=="string"&&!o.isEncoding(p))throw new TypeError("Unknown encoding: "+p);if(t.length===1){var l=t.charCodeAt(0);(p==="utf8"&&l<128||p==="latin1")&&(t=l)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,t||(t=0);var h;if(typeof t=="number")for(h=r;h<i;++h)this[h]=t;else{var y=o.isBuffer(t)?t:o.from(t,p),g=y.length;if(g===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(h=0;h<i-r;++h)this[h+r]=y[h%g]}return this};var yr=/[^+/0-9A-Za-z-_]/g;function wr(e){if(e=e.split("=")[0],e=e.trim().replace(yr,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function G(e,t){t=t||1/0;for(var r,i=e.length,p=null,l=[],h=0;h<i;++h){if(r=e.charCodeAt(h),r>55295&&r<57344){if(!p){if(r>56319){(t-=3)>-1&&l.push(239,191,189);continue}else if(h+1===i){(t-=3)>-1&&l.push(239,191,189);continue}p=r;continue}if(r<56320){(t-=3)>-1&&l.push(239,191,189),p=r;continue}r=(p-55296<<10|r-56320)+65536}else p&&(t-=3)>-1&&l.push(239,191,189);if(p=null,r<128){if((t-=1)<0)break;l.push(r)}else if(r<2048){if((t-=2)<0)break;l.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;l.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;l.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return l}function gr(e){for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function vr(e,t){for(var r,i,p,l=[],h=0;h<e.length&&!((t-=2)<0);++h)r=e.charCodeAt(h),i=r>>8,p=r%256,l.push(p),l.push(i);return l}function bt(e){return a.toByteArray(wr(e))}function q(e,t,r,i){for(var p=0;p<i&&!(p+r>=t.length||p>=e.length);++p)t[p+r]=e[p];return p}function I(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function V(e){return e!==e}var Er=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var i=r*16,p=0;p<16;++p)t[i+p]=e[r]+e[p];return t}()})(Mt);/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(n,a){var s=Mt,c=s.Buffer;function f(u,o){for(var x in u)o[x]=u[x]}c.from&&c.alloc&&c.allocUnsafe&&c.allocUnsafeSlow?n.exports=s:(f(s,a),a.Buffer=m);function m(u,o,x){return c(u,o,x)}m.prototype=Object.create(c.prototype),f(c,m),m.from=function(u,o,x){if(typeof u=="number")throw new TypeError("Argument must not be a number");return c(u,o,x)},m.alloc=function(u,o,x){if(typeof u!="number")throw new TypeError("Argument must be a number");var w=c(u);return o!==void 0?typeof x=="string"?w.fill(o,x):w.fill(o):w.fill(0),w},m.allocUnsafe=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return c(u)},m.allocUnsafeSlow=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return s.SlowBuffer(u)}})(et,et.exports);var Ct=et.exports,Lt=Ct.Buffer;function H(n,a){this._block=Lt.alloc(n),this._finalSize=a,this._blockSize=n,this._len=0}H.prototype.update=function(n,a){typeof n=="string"&&(a=a||"utf8",n=Lt.from(n,a));for(var s=this._block,c=this._blockSize,f=n.length,m=this._len,u=0;u<f;){for(var o=m%c,x=Math.min(f-u,c-o),w=0;w<x;w++)s[o+w]=n[u+w];m+=x,u+=x,m%c===0&&this._update(s)}return this._len+=f,this};H.prototype.digest=function(n){var a=this._len%this._blockSize;this._block[a]=128,this._block.fill(0,a+1),a>=this._finalSize&&(this._update(this._block),this._block.fill(0));var s=this._len*8;if(s<=4294967295)this._block.writeUInt32BE(s,this._blockSize-4);else{var c=(s&4294967295)>>>0,f=(s-c)/4294967296;this._block.writeUInt32BE(f,this._blockSize-8),this._block.writeUInt32BE(c,this._blockSize-4)}this._update(this._block);var m=this._hash();return n?m.toString(n):m};H.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Wr=H,Hr=Nr,qt=Wr,Zr=Ct.Buffer,Kr=[1518500249,1859775393,-1894007588,-899497514],Yr=new Array(80);function L(){this.init(),this._w=Yr,qt.call(this,64,56)}Hr(L,qt);L.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Xr(n){return n<<1|n>>>31}function Gr(n){return n<<5|n>>>27}function Vr(n){return n<<30|n>>>2}function Qr(n,a,s,c){return n===0?a&s|~a&c:n===2?a&s|a&c|s&c:a^s^c}L.prototype._update=function(n){for(var a=this._w,s=this._a|0,c=this._b|0,f=this._c|0,m=this._d|0,u=this._e|0,o=0;o<16;++o)a[o]=n.readInt32BE(o*4);for(;o<80;++o)a[o]=Xr(a[o-3]^a[o-8]^a[o-14]^a[o-16]);for(var x=0;x<80;++x){var w=~~(x/20),v=Gr(s)+Qr(w,c,f,m)+u+a[x]+Kr[w]|0;u=m,m=f,f=Vr(c),c=s,s=v}this._a=s+this._a|0,this._b=c+this._b|0,this._c=f+this._c|0,this._d=m+this._d|0,this._e=u+this._e|0};L.prototype._hash=function(){var n=Zr.allocUnsafe(20);return n.writeInt32BE(this._a|0,0),n.writeInt32BE(this._b|0,4),n.writeInt32BE(this._c|0,8),n.writeInt32BE(this._d|0,12),n.writeInt32BE(this._e|0,16),n};var te=L;const re=Nt(te),ut=new Error("File system not available.");function ee(n,a,s){throw ut}function $t(n){throw ut}function ie(n){throw ut}const ne=async n=>$t();function ae(n){let a="";for(let s=0;s<n.length;s+=2)a+=String.fromCharCode(parseInt(n.substr(s,2),16));return btoa(a)}const Z=(n,a="sha1")=>{if(a!=="sha1")throw new Error("Only sha1 algorithm is available.");const s=new re;return ae(s.update(n).digest("hex"))},ft=async n=>{const a=new At,{name:s,revision:c,documentType:f,created:m,lastModified:u}=n,o={name:s,revision:c,documentType:f,created:m,lastModified:u};return a.file("header.json",JSON.stringify(o,null,2)),a.file("state.json",JSON.stringify(n.initialState||{},null,2)),a.file("operations.json",JSON.stringify(n.operations,null,2)),Object.keys(n.attachments).forEach(w=>{const{data:v,...F}=n.attachments[w];a.file(w,v,{base64:!0,createFolders:!0,comment:JSON.stringify(F)})}),a},Jt=async(n,a,s,c)=>{await(await ft(n)).generateAsync({type:"uint8array",streamFiles:!0});const m=c??n.name,u=`.${s}.zip`;return ee(a,m.endsWith(u)?m:`${m}${u}`)},oe=async(n,a)=>{const c=await(await ft(n)).generateAsync({type:"blob"}),f=await a.createWritable();await f.write(c),await f.close()},it=async(n,a)=>{const s=$t();return Pt(s,a)},Pt=async(n,a)=>{const s=new At;return await s.loadAsync(n),pe(s,a)};async function pe(n,a){const s=n.file("state.json");if(!s)throw new Error("Initial state not found");const c=await s.async("string"),f=JSON.parse(c),m=n.file("header.json");let u=null;m&&(u=JSON.parse(await m.async("string")));const o=n.file("operations.json");if(!o)throw new Error("Operations history not found");const x=JSON.parse(await o.async("string")),w={...f,...u,initialState:f,operations:[],attachments:{...f.attachments}};let v=x.slice(0,u==null?void 0:u.revision).reduce((F,U)=>a(F,U),w);return u&&(v={...v,...u,operations:[...v.operations,...x.slice(u.revision)]}),v}function Wt(n){const a=n.replace(/^.*\./,"")||void 0,s=n.replace(/^.*[/\\]/,"")||void 0;return{extension:a,fileName:s}}async function se(n){const{buffer:a,mimeType:s="application/octet-stream"}=await ie(),c=Wt(n),f=a.toString("base64");return{data:f,hash:Z(f),mimeType:s,...c}}async function ce(n){const a=await ne(),s=Or.getType(n)||"application/octet-stream",c=Wt(n),f=a.toString("base64");return{data:f,hash:Z(f),mimeType:s,...c}}function J(n,a,s){const c=Gt(n),f=Yt(s);return a.reduce((m,u)=>f(m,u),c)}function le(n,a){return{...n,name:a}}function ue(n,a,s){const c=Math.min(a,n.revision),f=n.operations.slice(0,n.revision-c);return{...J(n.initialState,f,s),operations:n.operations,revision:n.revision-c}}function fe(n,a,s){const c=n.operations.length-n.revision;if(!c)throw new Error("There is no UNDO operation to REDO");const f=a<c?a:c,m=n.operations.slice(0,n.revision+f);return{...J(n.initialState,m,s),operations:n.operations,revision:n.revision+f}}function he(n,a,s,c){a=a||0,s=s||n.operations.length;const f=n.operations.slice(a,s),m=n.operations.slice(0,a),u=n.operations.slice(s),o=J(n.initialState,m.concat(f),c),{name:x,state:w}=o;return J(n.initialState,[...m,ht({name:x,state:w},f.length),...u],c)}function me(n,a){return{...n,name:a.name,state:a.state??{}}}const Ht="SET_NAME",K="UNDO",Y="REDO",C="PRUNE",Zt="LOAD_STATE";function xe(n,a){return[K,Y,C].includes(a.type)?n.revision:n.revision+1}function de(n,a){return{...n,revision:xe(n,a),lastModified:new Date().toISOString()}}function ye(n,a){if([K,Y,C,C].includes(a.type))return n;const s=n.operations.slice(0,n.revision);return{...n,operations:[...s,{...a,index:s.length,timestamp:new Date().toISOString(),hash:""}]}}function we(n,a){let s=ye(n,a);return s=de(s,a),s}function ge(n,a,s){switch(kt().parse(a),a.type){case Ht:return le(n,a.input);case K:return ue(n,a.input,s);case Y:return fe(n,a.input,s);case C:return he(n,a.input.start,a.input.end,s);case Zt:return me(n,a.input.state);default:return n}}function Kt(n,a,s){let c=n;return nt(a)&&(c=ge(c,a,s)),c=we(c,a),c=R.produce(c,f=>{const m=s(f.state,a);if(m)return R.castDraft({...c,state:m})}),R.produce(c,f=>{f.operations[f.operations.length-1].hash=Vt(f),!nt(a)&&a.attachments&&a.attachments.forEach(m=>{const{hash:u,...o}=m;f.attachments[u]={...o}})})}function nt(n){return[Ht,K,Y,C,Zt].includes(n.type)}function D(n,a,s,c,f="global"){if(!n)throw new Error("Empty action type");if(typeof n!="string")throw new Error(`Invalid action type: ${n}`);const m={type:n,input:a,scope:f};return s&&(m.attachments=s),c==null||c().parse(m),m}function Yt(n,a=Kt){return(s,c)=>a(s,c,n)}const Xt=(n,a)=>({name:"",documentType:"",revision:0,created:new Date().toISOString(),lastModified:new Date().toISOString(),attachments:{},...n,state:(a==null?void 0:a(n==null?void 0:n.state))??(n==null?void 0:n.state)??{}}),Gt=(n,a)=>{const s=Xt(n,a);return{...s,initialState:s,operations:[]}},Vt=n=>Z(_r(n.state)),ve=(n,a=1e3)=>{const s=Math.random()*a;return Z(`${(n??new Date).toISOString()}${s}`)};function M(n){return R.castImmutable(R.freeze(n,!0))}const Qt=n=>D("SET_NAME",n,void 0,st),tr=(n=1)=>D("UNDO",n,void 0,ct),rr=(n=1)=>D("REDO",n,void 0,pt),er=(n,a)=>D("PRUNE",{start:n,end:a},void 0,ot),ht=(n,a)=>D("LOAD_STATE",{state:n,operations:a},void 0,at),Ee=Object.freeze(Object.defineProperty({__proto__:null,loadState:ht,prune:er,redo:rr,setName:Qt,undo:tr},Symbol.toStringTag,{value:"Module"}));class be{constructor(a,s){Q(this,"_document");Q(this,"_reducer");this._reducer=a,this._document=s}dispatch(a){return this._document=this._reducer(this._document,a),this}saveToFile(a,s,c){return Jt(this._document,a,s,c)}async loadFromFile(a){this._document=await it(a,this._reducer)}static async stateFromFile(a,s){return await it(a,s)}get state(){return M(this._document.state)}get operations(){return M(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}get initialState(){return M(this._document.initialState)}toDocument(){return M(this._document)}getAttachment(a){return this._document.attachments[a]}setName(a){return this.dispatch(Qt(a)),this}undo(a){return this.dispatch(tr(a)),this}redo(a){return this.dispatch(rr(a)),this}prune(a,s){return this.dispatch(er(a,s)),this}loadState(a,s){return this.dispatch(ht(a,s)),this}}function Fe(n,a){a.forEach(s=>{Object.getOwnPropertyNames(s.prototype).forEach(c=>{Object.defineProperty(n.prototype,c,Object.getOwnPropertyDescriptor(s.prototype,c)||Object.create(null))})})}exports.BaseActions=Ee;exports.BaseDocument=be;exports.applyMixins=Fe;exports.baseReducer=Kt;exports.createAction=D;exports.createDocument=Gt;exports.createExtendedState=Xt;exports.createReducer=Yt;exports.createZip=ft;exports.getLocalFile=ce;exports.getRemoteFile=se;exports.hashDocument=Vt;exports.hashKey=ve;exports.isBaseAction=nt;exports.loadFromFile=it;exports.loadFromInput=Pt;exports.readOnly=M;exports.saveToFile=Jt;exports.saveToFileHandle=oe;exports.zod=Ir;
|
|
@@ -20,6 +20,8 @@ export type Action<T extends string = string, I = unknown> = {
|
|
|
20
20
|
input: I;
|
|
21
21
|
/** The attachments included in the action. */
|
|
22
22
|
attachments?: AttachmentInput[] | undefined;
|
|
23
|
+
/** The scope of the action, can either be 'global' or 'local'. Defaults to 'global' */
|
|
24
|
+
scope?: OperationScope;
|
|
23
25
|
};
|
|
24
26
|
export type ActionWithAttachment<T extends string = string, I = unknown> = Action<T, I> & {
|
|
25
27
|
attachments: AttachmentInput[];
|
|
@@ -46,6 +48,12 @@ export type Reducer<State, A extends Action> = (state: Document<State, A>, actio
|
|
|
46
48
|
*/
|
|
47
49
|
export type ImmutableReducer<State, A extends Action> = (state: Draft<Document<State, A>>, action: A | BaseAction) => Document<State, A> | void;
|
|
48
50
|
export type ImmutableStateReducer<State, A extends Action> = (state: Draft<State>, action: A) => State | void;
|
|
51
|
+
/**
|
|
52
|
+
* Scope of an operation.
|
|
53
|
+
* Global: The operation is synchronized everywhere in the network. This is the default document operation.
|
|
54
|
+
* Local: The operation is applied only locally (to a local state). Used for local settings such as a drive's local path
|
|
55
|
+
*/
|
|
56
|
+
export type OperationScope = 'global' | 'local';
|
|
49
57
|
/**
|
|
50
58
|
* An operation that was applied to a {@link Document}.
|
|
51
59
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { baseReducer } from '../reducer';
|
|
2
|
-
import { Action, BaseAction, Document, ExtendedState, ImmutableStateReducer, Reducer, Immutable } from '../types';
|
|
2
|
+
import { Action, BaseAction, Document, ExtendedState, ImmutableStateReducer, Reducer, Immutable, OperationScope } from '../types';
|
|
3
3
|
export declare function isBaseAction(action: Action): action is BaseAction;
|
|
4
4
|
/**
|
|
5
5
|
* Helper function to be used by action creators.
|
|
@@ -19,7 +19,7 @@ export declare function isBaseAction(action: Action): action is BaseAction;
|
|
|
19
19
|
*/
|
|
20
20
|
export declare function createAction<A extends Action>(type: A['type'], input?: A['input'], attachments?: Action['attachments'], validator?: () => {
|
|
21
21
|
parse(v: unknown): A;
|
|
22
|
-
}): A;
|
|
22
|
+
}, scope?: OperationScope): A;
|
|
23
23
|
/**
|
|
24
24
|
* Helper function to create a document model reducer.
|
|
25
25
|
*
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Action } from '../../../document';
|
|
2
|
-
import { AddOperationInput, SetOperationNameInput, SetOperationSchemaInput, SetOperationDescriptionInput, SetOperationTemplateInput, SetOperationReducerInput, MoveOperationInput, DeleteOperationInput, ReorderModuleOperationsInput } from '../types';
|
|
2
|
+
import { AddOperationInput, SetOperationNameInput, SetOperationSchemaInput, SetOperationDescriptionInput, SetOperationTemplateInput, SetOperationReducerInput, MoveOperationInput, DeleteOperationInput, ReorderModuleOperationsInput, SetOperationScopeInput } from '../types';
|
|
3
3
|
export type AddOperationAction = Action<'ADD_OPERATION', AddOperationInput>;
|
|
4
4
|
export type SetOperationNameAction = Action<'SET_OPERATION_NAME', SetOperationNameInput>;
|
|
5
|
+
export type SetOperationScopeAction = Action<'SET_OPERATION_SCOPE', SetOperationScopeInput>;
|
|
5
6
|
export type SetOperationSchemaAction = Action<'SET_OPERATION_SCHEMA', SetOperationSchemaInput>;
|
|
6
7
|
export type SetOperationDescriptionAction = Action<'SET_OPERATION_DESCRIPTION', SetOperationDescriptionInput>;
|
|
7
8
|
export type SetOperationTemplateAction = Action<'SET_OPERATION_TEMPLATE', SetOperationTemplateInput>;
|
|
@@ -9,4 +10,4 @@ export type SetOperationReducerAction = Action<'SET_OPERATION_REDUCER', SetOpera
|
|
|
9
10
|
export type MoveOperationAction = Action<'MOVE_OPERATION', MoveOperationInput>;
|
|
10
11
|
export type DeleteOperationAction = Action<'DELETE_OPERATION', DeleteOperationInput>;
|
|
11
12
|
export type ReorderModuleOperationsAction = Action<'REORDER_MODULE_OPERATIONS', ReorderModuleOperationsInput>;
|
|
12
|
-
export type DocumentModelOperationAction = AddOperationAction | SetOperationNameAction | SetOperationSchemaAction | SetOperationDescriptionAction | SetOperationTemplateAction | SetOperationReducerAction | MoveOperationAction | DeleteOperationAction | ReorderModuleOperationsAction;
|
|
13
|
+
export type DocumentModelOperationAction = AddOperationAction | SetOperationNameAction | SetOperationScopeAction | SetOperationSchemaAction | SetOperationDescriptionAction | SetOperationTemplateAction | SetOperationReducerAction | MoveOperationAction | DeleteOperationAction | ReorderModuleOperationsAction;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { AddOperationInput, SetOperationNameInput, SetOperationSchemaInput, SetOperationDescriptionInput, SetOperationTemplateInput, SetOperationReducerInput, MoveOperationInput, DeleteOperationInput, ReorderModuleOperationsInput } from '../types';
|
|
2
|
-
import { AddOperationAction, SetOperationNameAction, SetOperationSchemaAction, SetOperationDescriptionAction, SetOperationTemplateAction, SetOperationReducerAction, MoveOperationAction, DeleteOperationAction, ReorderModuleOperationsAction } from './actions';
|
|
1
|
+
import { AddOperationInput, SetOperationNameInput, SetOperationSchemaInput, SetOperationDescriptionInput, SetOperationTemplateInput, SetOperationReducerInput, MoveOperationInput, DeleteOperationInput, ReorderModuleOperationsInput, SetOperationScopeInput } from '../types';
|
|
2
|
+
import { AddOperationAction, SetOperationNameAction, SetOperationSchemaAction, SetOperationDescriptionAction, SetOperationTemplateAction, SetOperationReducerAction, MoveOperationAction, DeleteOperationAction, ReorderModuleOperationsAction, SetOperationScopeAction } from './actions';
|
|
3
3
|
export declare const addOperation: (input: AddOperationInput) => AddOperationAction;
|
|
4
4
|
export declare const setOperationName: (input: SetOperationNameInput) => SetOperationNameAction;
|
|
5
|
+
export declare const setOperationScope: (input: SetOperationScopeInput) => SetOperationScopeAction;
|
|
5
6
|
export declare const setOperationSchema: (input: SetOperationSchemaInput) => SetOperationSchemaAction;
|
|
6
7
|
export declare const setOperationDescription: (input: SetOperationDescriptionInput) => SetOperationDescriptionAction;
|
|
7
8
|
export declare const setOperationTemplate: (input: SetOperationTemplateInput) => SetOperationTemplateAction;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
|
-
import { AddOperationInput, SetOperationNameInput, SetOperationSchemaInput, SetOperationDescriptionInput, SetOperationTemplateInput, SetOperationReducerInput, MoveOperationInput, DeleteOperationInput, ReorderModuleOperationsInput, DocumentModelState } from '../types';
|
|
2
|
+
import { AddOperationInput, SetOperationNameInput, SetOperationSchemaInput, SetOperationDescriptionInput, SetOperationTemplateInput, SetOperationReducerInput, MoveOperationInput, DeleteOperationInput, ReorderModuleOperationsInput, DocumentModelState, SetOperationScopeInput } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
4
|
export default class DocumentModel_Operation extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
5
5
|
addOperation(input: AddOperationInput): this;
|
|
6
6
|
setOperationName(input: SetOperationNameInput): this;
|
|
7
|
+
setOperationScope(input: SetOperationScopeInput): this;
|
|
7
8
|
setOperationSchema(input: SetOperationSchemaInput): this;
|
|
8
9
|
setOperationDescription(input: SetOperationDescriptionInput): this;
|
|
9
10
|
setOperationTemplate(input: SetOperationTemplateInput): this;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { AddOperationAction, SetOperationNameAction, SetOperationSchemaAction, SetOperationDescriptionAction, SetOperationTemplateAction, SetOperationReducerAction, MoveOperationAction, DeleteOperationAction, ReorderModuleOperationsAction } from './actions';
|
|
1
|
+
import { AddOperationAction, SetOperationNameAction, SetOperationSchemaAction, SetOperationDescriptionAction, SetOperationTemplateAction, SetOperationReducerAction, MoveOperationAction, DeleteOperationAction, ReorderModuleOperationsAction, SetOperationScopeAction } from './actions';
|
|
2
2
|
import { DocumentModelState } from '../types';
|
|
3
3
|
export interface DocumentModelOperationOperations {
|
|
4
4
|
addOperationOperation: (state: DocumentModelState, action: AddOperationAction) => void;
|
|
5
5
|
setOperationNameOperation: (state: DocumentModelState, action: SetOperationNameAction) => void;
|
|
6
|
+
setOperationScopeOperation: (state: DocumentModelState, action: SetOperationScopeAction) => void;
|
|
6
7
|
setOperationSchemaOperation: (state: DocumentModelState, action: SetOperationSchemaAction) => void;
|
|
7
8
|
setOperationDescriptionOperation: (state: DocumentModelState, action: SetOperationDescriptionAction) => void;
|
|
8
9
|
setOperationTemplateOperation: (state: DocumentModelState, action: SetOperationTemplateAction) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OperationScope } from "../../../document";
|
|
1
2
|
export type Maybe<T> = T | null;
|
|
2
3
|
export type InputMaybe<T> = T | null | undefined;
|
|
3
4
|
export type Exact<T extends {
|
|
@@ -74,6 +75,7 @@ export type AddOperationInput = {
|
|
|
74
75
|
reducer?: InputMaybe<Scalars['String']['input']>;
|
|
75
76
|
schema?: InputMaybe<Scalars['String']['input']>;
|
|
76
77
|
template?: InputMaybe<Scalars['String']['input']>;
|
|
78
|
+
scope?: InputMaybe<OperationScope>;
|
|
77
79
|
};
|
|
78
80
|
export type AddStateExampleInput = {
|
|
79
81
|
example: Scalars['String']['input'];
|
|
@@ -119,6 +121,7 @@ export type DocumentModelState = {
|
|
|
119
121
|
name: Scalars['String']['output'];
|
|
120
122
|
specifications: Array<DocumentSpecification>;
|
|
121
123
|
};
|
|
124
|
+
export type DocumentModelMeta = unknown;
|
|
122
125
|
export type DocumentSpecification = {
|
|
123
126
|
__typename?: 'DocumentSpecification';
|
|
124
127
|
changeLog: Array<Scalars['String']['output']>;
|
|
@@ -315,6 +318,7 @@ export type Operation = {
|
|
|
315
318
|
reducer: Maybe<Scalars['String']['output']>;
|
|
316
319
|
schema: Maybe<Scalars['String']['output']>;
|
|
317
320
|
template: Maybe<Scalars['String']['output']>;
|
|
321
|
+
scope: OperationScope;
|
|
318
322
|
};
|
|
319
323
|
export type OperationError = {
|
|
320
324
|
__typename?: 'OperationError';
|
|
@@ -399,6 +403,10 @@ export type SetOperationNameInput = {
|
|
|
399
403
|
id: Scalars['ID']['input'];
|
|
400
404
|
name?: InputMaybe<Scalars['String']['input']>;
|
|
401
405
|
};
|
|
406
|
+
export type SetOperationScopeInput = {
|
|
407
|
+
id: Scalars['ID']['input'];
|
|
408
|
+
scope: InputMaybe<OperationScope>;
|
|
409
|
+
};
|
|
402
410
|
export type SetOperationReducerInput = {
|
|
403
411
|
id: Scalars['ID']['input'];
|
|
404
412
|
reducer?: InputMaybe<Scalars['String']['input']>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { AddChangeLogItemInput, AddModuleInput, AddOperationErrorInput, AddOperationExampleInput, AddOperationInput, AddStateExampleInput, Author, CodeExample, DeleteChangeLogItemInput, DeleteModuleInput, DeleteOperationErrorInput, DeleteOperationExampleInput, DeleteOperationInput, DeleteStateExampleInput, DocumentModelState, DocumentSpecification, Module, MoveOperationInput, Operation, OperationError, ReorderChangeLogItemsInput, ReorderModuleOperationsInput, ReorderModulesInput, ReorderOperationErrorsInput, ReorderOperationExamplesInput, ReorderStateExamplesInput, SetAuthorNameInput, SetAuthorWebsiteInput, SetInitialStateInput, SetModelDescriptionInput, SetModelExtensionInput, SetModelIdInput, SetModelNameInput, SetModuleDescriptionInput, SetModuleNameInput, SetOperationDescriptionInput, SetOperationErrorCodeInput, SetOperationErrorDescriptionInput, SetOperationErrorNameInput, SetOperationErrorTemplateInput, SetOperationNameInput, SetOperationReducerInput, SetOperationSchemaInput, SetOperationTemplateInput, SetStateSchemaInput, State, UpdateChangeLogItemInput, UpdateOperationExampleInput, UpdateStateExampleInput } from '.';
|
|
2
|
+
import { AddChangeLogItemInput, AddModuleInput, AddOperationErrorInput, AddOperationExampleInput, AddOperationInput, AddStateExampleInput, Author, CodeExample, DeleteChangeLogItemInput, DeleteModuleInput, DeleteOperationErrorInput, DeleteOperationExampleInput, DeleteOperationInput, DeleteStateExampleInput, DocumentModelState, DocumentSpecification, Module, MoveOperationInput, Operation, OperationError, ReorderChangeLogItemsInput, ReorderModuleOperationsInput, ReorderModulesInput, ReorderOperationErrorsInput, ReorderOperationExamplesInput, ReorderStateExamplesInput, SetAuthorNameInput, SetAuthorWebsiteInput, SetInitialStateInput, SetModelDescriptionInput, SetModelExtensionInput, SetModelIdInput, SetModelNameInput, SetModuleDescriptionInput, SetModuleNameInput, SetOperationDescriptionInput, SetOperationErrorCodeInput, SetOperationErrorDescriptionInput, SetOperationErrorNameInput, SetOperationErrorTemplateInput, SetOperationNameInput, SetOperationReducerInput, SetOperationSchemaInput, SetOperationScopeInput, SetOperationTemplateInput, SetStateSchemaInput, State, UpdateChangeLogItemInput, UpdateOperationExampleInput, UpdateStateExampleInput } from '.';
|
|
3
3
|
type Properties<T> = Required<{
|
|
4
4
|
[K in keyof T]: z.ZodType<T[K], any, T[K]>;
|
|
5
5
|
}>;
|
|
@@ -88,6 +88,7 @@ export declare function DocumentModelInputSchema(): z.ZodUnion<[z.ZodObject<Requ
|
|
|
88
88
|
reducer?: z.ZodType<import("./types").InputMaybe<string>, any, import("./types").InputMaybe<string>> | undefined;
|
|
89
89
|
schema?: z.ZodType<import("./types").InputMaybe<string>, any, import("./types").InputMaybe<string>> | undefined;
|
|
90
90
|
template?: z.ZodType<import("./types").InputMaybe<string>, any, import("./types").InputMaybe<string>> | undefined;
|
|
91
|
+
scope?: z.ZodType<import("./types").InputMaybe<import("../../../document").OperationScope>, any, import("./types").InputMaybe<import("../../../document").OperationScope>> | undefined;
|
|
91
92
|
}>, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
92
93
|
id: string;
|
|
93
94
|
name: string;
|
|
@@ -96,6 +97,7 @@ export declare function DocumentModelInputSchema(): z.ZodUnion<[z.ZodObject<Requ
|
|
|
96
97
|
reducer?: import("./types").InputMaybe<string>;
|
|
97
98
|
schema?: import("./types").InputMaybe<string>;
|
|
98
99
|
template?: import("./types").InputMaybe<string>;
|
|
100
|
+
scope?: import("./types").InputMaybe<import("../../../document").OperationScope>;
|
|
99
101
|
}, {
|
|
100
102
|
id: string;
|
|
101
103
|
name: string;
|
|
@@ -104,6 +106,7 @@ export declare function DocumentModelInputSchema(): z.ZodUnion<[z.ZodObject<Requ
|
|
|
104
106
|
reducer?: import("./types").InputMaybe<string>;
|
|
105
107
|
schema?: import("./types").InputMaybe<string>;
|
|
106
108
|
template?: import("./types").InputMaybe<string>;
|
|
109
|
+
scope?: import("./types").InputMaybe<import("../../../document").OperationScope>;
|
|
107
110
|
}>, z.ZodObject<Required<{
|
|
108
111
|
example: z.ZodType<string, any, string>;
|
|
109
112
|
id: z.ZodType<string, any, string>;
|
|
@@ -417,6 +420,7 @@ export declare function SetOperationErrorDescriptionInputSchema(): z.ZodObject<P
|
|
|
417
420
|
export declare function SetOperationErrorNameInputSchema(): z.ZodObject<Properties<SetOperationErrorNameInput>>;
|
|
418
421
|
export declare function SetOperationErrorTemplateInputSchema(): z.ZodObject<Properties<SetOperationErrorTemplateInput>>;
|
|
419
422
|
export declare function SetOperationNameInputSchema(): z.ZodObject<Properties<SetOperationNameInput>>;
|
|
423
|
+
export declare function SetOperationScopeInputSchema(): z.ZodObject<Properties<SetOperationScopeInput>>;
|
|
420
424
|
export declare function SetOperationReducerInputSchema(): z.ZodObject<Properties<SetOperationReducerInput>>;
|
|
421
425
|
export declare function SetOperationSchemaInputSchema(): z.ZodObject<Properties<SetOperationSchemaInput>>;
|
|
422
426
|
export declare function SetOperationTemplateInputSchema(): z.ZodObject<Properties<SetOperationTemplateInput>>;
|
|
@@ -48,6 +48,7 @@ declare const actions: {
|
|
|
48
48
|
reorderOperationExamples: (input: import("./gen").ReorderOperationExamplesInput) => import("./gen").ReorderOperationExamplesAction;
|
|
49
49
|
addOperation: (input: import("./gen").AddOperationInput) => import("./gen").AddOperationAction;
|
|
50
50
|
setOperationName: (input: import("./gen").SetOperationNameInput) => import("./gen").SetOperationNameAction;
|
|
51
|
+
setOperationScope: (input: import("./gen").SetOperationScopeInput) => import("./gen").SetOperationScopeAction;
|
|
51
52
|
setOperationSchema: (input: import("./gen").SetOperationSchemaInput) => import("./gen").SetOperationSchemaAction;
|
|
52
53
|
setOperationDescription: (input: import("./gen").SetOperationDescriptionInput) => import("./gen").SetOperationDescriptionAction;
|
|
53
54
|
setOperationTemplate: (input: import("./gen").SetOperationTemplateInput) => import("./gen").SetOperationTemplateAction;
|
|
@@ -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-8ed23327.js");require("json-stringify-deterministic");require("immer");require("crypto");require("fs");require("https");require("path");require("jszip");const e=require("./internal/index-fbe65e32.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,4 +1,4 @@
|
|
|
1
|
-
import "./internal/object-
|
|
1
|
+
import "./internal/object-e24dafec.js";
|
|
2
2
|
import "json-stringify-deterministic";
|
|
3
3
|
import "immer";
|
|
4
4
|
import "crypto";
|
|
@@ -6,7 +6,7 @@ import "fs";
|
|
|
6
6
|
import "https";
|
|
7
7
|
import "path";
|
|
8
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-
|
|
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-0b946b7d.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-8ed23327.js"),r=require("./internal/index-14934709.js");require("json-stringify-deterministic");require("immer");require("jszip");require("crypto");require("fs");require("https");require("path");require("zod");exports.BaseDocument=e.BaseDocument;exports.actions=e.BaseActions;exports.applyMixins=e.applyMixins;exports.baseReducer=e.baseReducer;exports.z=e.zod;exports.utils=r.index;
|
package/dist/node/document.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as n, h as u, g as x, p as f, z as l } from "./internal/object-
|
|
2
|
-
import { i as b } from "./internal/index-
|
|
1
|
+
import { B as n, h as u, g as x, p as f, z as l } from "./internal/object-e24dafec.js";
|
|
2
|
+
import { i as b } from "./internal/index-7056a501.js";
|
|
3
3
|
import "json-stringify-deterministic";
|
|
4
4
|
import "immer";
|
|
5
5
|
import "jszip";
|
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-14934709.js"),o=require("./internal/index-fbe65e32.js");require("./internal/object-8ed23327.js");require("json-stringify-deterministic");require("immer");require("jszip");require("crypto");require("fs");require("https");require("path");require("zod");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,6 +1,6 @@
|
|
|
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-7056a501.js";
|
|
2
|
+
import { D as t } from "./internal/index-0b946b7d.js";
|
|
3
|
+
import "./internal/object-e24dafec.js";
|
|
4
4
|
import "json-stringify-deterministic";
|
|
5
5
|
import "immer";
|
|
6
6
|
import "jszip";
|