tiny-essentials 1.12.1 → 1.12.2
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/legacy/firebase/index.mjs +5 -5
- package/dist/v1/TinyBasicsEs.js +1 -1257
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyEssentials.js +336 -146
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyUploadClicker.js +330 -147
- package/dist/v1/TinyUploadClicker.min.js +1 -1
- package/dist/v1/basics/index.cjs +0 -23
- package/dist/v1/basics/index.d.mts +1 -23
- package/dist/v1/basics/index.mjs +1 -2
- package/dist/v1/fileManager/asyncFuncs.cjs +272 -0
- package/dist/v1/fileManager/asyncFuncs.d.mts +93 -0
- package/dist/v1/fileManager/asyncFuncs.mjs +236 -0
- package/dist/v1/fileManager/index.cjs +35 -0
- package/dist/v1/fileManager/index.d.mts +30 -0
- package/dist/v1/fileManager/index.mjs +3 -0
- package/dist/v1/{basics/fileManager.cjs → fileManager/normalFuncs.cjs} +10 -105
- package/dist/v1/{basics/fileManager.d.mts → fileManager/normalFuncs.d.mts} +3 -56
- package/dist/v1/{basics/fileManager.mjs → fileManager/normalFuncs.mjs} +48 -131
- package/dist/v1/index.cjs +30 -23
- package/dist/v1/index.d.mts +29 -23
- package/dist/v1/index.mjs +3 -2
- package/dist/v1/libs/TinyUploadClicker.cjs +1 -0
- package/docs/v1/README.md +3 -1
- package/docs/v1/{basics/fileManager.md → fileManager/main.md} +12 -0
- package/package.json +5 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see TinyUploadClicker.min.js.LICENSE.txt */
|
|
2
|
-
(()=>{var t={41:()=>{},251:(t,e)=>{e.read=function(t,e,r,n,i){var o,f,s=8*i-n-1,u=(1<<s)-1,a=u>>1,h=-7,c=r?i-1:0,l=r?-1:1,p=t[e+c];for(c+=l,o=p&(1<<-h)-1,p>>=-h,h+=s;h>0;o=256*o+t[e+c],c+=l,h-=8);for(f=o&(1<<-h)-1,o>>=-h,h+=n;h>0;f=256*f+t[e+c],c+=l,h-=8);if(0===o)o=1-a;else{if(o===u)return f?NaN:1/0*(p?-1:1);f+=Math.pow(2,n),o-=a}return(p?-1:1)*f*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var f,s,u,a=8*o-i-1,h=(1<<a)-1,c=h>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,y=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,f=h):(f=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-f))<1&&(f--,u*=2),(e+=f+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(f++,u/=2),f+c>=h?(s=0,f=h):f+c>=1?(s=(e*u-1)*Math.pow(2,i),f+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),f=0));i>=8;t[r+p]=255&s,p+=y,s/=256,i-=8);for(f=f<<i|s,a+=i;a>0;t[r+p]=255&f,p+=y,f/=256,a-=8);t[r+p-y]|=128*g}},287:(t,e,r)=>{"use strict";var n=r(526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=u,e.IS=50;var f=2147483647;function s(t){if(t>f)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return a(t,e,r)}function a(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|g(t,e),n=s(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(_(t,Uint8Array)){var e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(_(t,ArrayBuffer)||t&&_(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(_(t,SharedArrayBuffer)||t&&_(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);var i=function(t){if(u.isBuffer(t)){var e=0|y(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||D(t.length)?s(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return h(t),s(t<0?0:0|y(t))}function l(t){for(var e=t.length<0?0:0|y(t.length),r=s(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function y(t){if(t>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||_(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(i)return n?-1:F(t).length;e=(""+e).toLowerCase(),i=!0}}function d(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return O(this,e,r);case"base64":return U(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function w(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),D(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){var o,f=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;f=2,s/=2,u/=2,r/=2}function a(t,e){return 1===f?t[e]:t.readUInt16BE(e*f)}if(i){var h=-1;for(o=r;o<s;o++)if(a(t,o)===a(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*f}else-1!==h&&(o-=o-h),h=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var c=!0,l=0;l<u;l++)if(a(t,o+l)!==a(e,l)){c=!1;break}if(c)return o}return-1}function m(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var f=0;f<n;++f){var s=parseInt(e.substr(2*f,2),16);if(D(s))return f;t[r+f]=s}return f}function E(t,e,r,n){return H(F(e,t.length-r),t,r,n)}function A(t,e,r,n){return H(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function T(t,e,r,n){return H(z(e),t,r,n)}function C(t,e,r,n){return H(function(t,e){for(var r,n,i,o=[],f=0;f<t.length&&!((e-=2)<0);++f)n=(r=t.charCodeAt(f))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function U(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function B(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,f,s,u,a=t[i],h=null,c=a>239?4:a>223?3:a>191?2:1;if(i+c<=r)switch(c){case 1:a<128&&(h=a);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&a)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],f=t[i+2],128==(192&o)&&128==(192&f)&&(u=(15&a)<<12|(63&o)<<6|63&f)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],f=t[i+2],s=t[i+3],128==(192&o)&&128==(192&f)&&128==(192&s)&&(u=(15&a)<<18|(63&o)<<12|(63&f)<<6|63&s)>65535&&u<1114112&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(t){var e=t.length;if(e<=L)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=L));return r}(n)}u.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return a(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return h(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},u.allocUnsafe=function(t){return c(t)},u.allocUnsafeSlow=function(t){return c(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(_(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),_(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.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}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(_(o,Uint8Array))i+o.length>n.length?u.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else{if(!u.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.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)w(this,e,e+1);return this},u.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)w(this,e,e+3),w(this,e+1,e+2);return this},u.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)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},u.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?B(this,0,t):d.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(_(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),f=(r>>>=0)-(e>>>=0),s=Math.min(o,f),a=this.slice(n,i),h=t.slice(e,r),c=0;c<s;++c)if(a[c]!==h[c]){o=a[c],f=h[c];break}return o<f?-1:f<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return v(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return v(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":case"latin1":case"binary":return A(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var L=4096;function k(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function O(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function x(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=q[t[o]];return i}function I(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function S(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function R(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function P(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return t>>>=0,e||S(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||S(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||S(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||S(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||M(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||M(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var o=0,f=1,s=0;for(this[e]=255&t;++o<r&&(f*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/f|0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var o=r-1,f=1,s=0;for(this[e+o]=255&t;--o>=0&&(f*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/f|0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(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]=255&t,e+4},u.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return P(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return P(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var f=u.isBuffer(t)?t:u.from(t,n),s=f.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=f[o%s]}return this};var N=/[^+/0-9A-Za-z-_]/g;function F(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],f=0;f<n;++f){if((r=t.charCodeAt(f))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(f+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function z(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(N,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function _(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function D(t){return t!=t}var q=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()},526:(t,e)=>{"use strict";e.byteLength=function(t){var e=s(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=s(t),f=o[0],u=o[1],a=new i(function(t,e,r){return 3*(e+r)/4-r}(0,f,u)),h=0,c=u>0?f-4:f;for(r=0;r<c;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],a[h++]=e>>16&255,a[h++]=e>>8&255,a[h++]=255&e;return 2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,a[h++]=255&e),1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,a[h++]=e>>8&255,a[h++]=255&e),a},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],f=16383,s=0,a=n-i;s<a;s+=f)o.push(u(t,s,s+f>a?a:s+f));return 1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0;f<64;++f)r[f]=o[f],n[o.charCodeAt(f)]=f;function s(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function u(t,e,n){for(var i,o,f=[],s=e;s<n;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),f.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return f.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},606:t=>{var e,r,n=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function f(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var s,u=[],a=!1,h=-1;function c(){a&&s&&(a=!1,s.length?u=s.concat(u):h=-1,u.length&&l())}function l(){if(!a){var t=f(c);a=!0;for(var e=u.length;e;){for(s=u,u=[];++h<e;)s&&s[h].run();h=-1,e=u.length}s=null,a=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{return r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function y(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new p(t,e)),1!==u.length||a||f(l)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=y,n.addListener=y,n.once=y,n.off=y,n.removeListener=y,n.removeAllListeners=y,n.emit=y,n.prependListener=y,n.prependOnceListener=y,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},975:(t,e,r)=>{"use strict";var n=r(606);function i(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function o(t,e){for(var r,n="",i=0,o=-1,f=0,s=0;s<=t.length;++s){if(s<t.length)r=t.charCodeAt(s);else{if(47===r)break;r=47}if(47===r){if(o===s-1||1===f);else if(o!==s-1&&2===f){if(n.length<2||2!==i||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var u=n.lastIndexOf("/");if(u!==n.length-1){-1===u?(n="",i=0):i=(n=n.slice(0,u)).length-1-n.lastIndexOf("/"),o=s,f=0;continue}}else if(2===n.length||1===n.length){n="",i=0,o=s,f=0;continue}e&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+t.slice(o+1,s):n=t.slice(o+1,s),i=s-o-1;o=s,f=0}else 46===r&&-1!==f?++f:f=-1}return n}var f={resolve:function(){for(var t,e="",r=!1,f=arguments.length-1;f>=-1&&!r;f--){var s;f>=0?s=arguments[f]:(void 0===t&&(t=n.cwd()),s=t),i(s),0!==s.length&&(e=s+"/"+e,r=47===s.charCodeAt(0))}return e=o(e,!r),r?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(t){if(i(t),0===t.length)return".";var e=47===t.charCodeAt(0),r=47===t.charCodeAt(t.length-1);return 0!==(t=o(t,!e)).length||e||(t="."),t.length>0&&r&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return i(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e<arguments.length;++e){var r=arguments[e];i(r),r.length>0&&(void 0===t?t=r:t+="/"+r)}return void 0===t?".":f.normalize(t)},relative:function(t,e){if(i(t),i(e),t===e)return"";if((t=f.resolve(t))===(e=f.resolve(e)))return"";for(var r=1;r<t.length&&47===t.charCodeAt(r);++r);for(var n=t.length,o=n-r,s=1;s<e.length&&47===e.charCodeAt(s);++s);for(var u=e.length-s,a=o<u?o:u,h=-1,c=0;c<=a;++c){if(c===a){if(u>a){if(47===e.charCodeAt(s+c))return e.slice(s+c+1);if(0===c)return e.slice(s+c)}else o>a&&(47===t.charCodeAt(r+c)?h=c:0===c&&(h=0));break}var l=t.charCodeAt(r+c);if(l!==e.charCodeAt(s+c))break;47===l&&(h=c)}var p="";for(c=r+h+1;c<=n;++c)c!==n&&47!==t.charCodeAt(c)||(0===p.length?p+="..":p+="/..");return p.length>0?p+e.slice(s+h):(s+=h,47===e.charCodeAt(s)&&++s,e.slice(s))},_makeLong:function(t){return t},dirname:function(t){if(i(t),0===t.length)return".";for(var e=t.charCodeAt(0),r=47===e,n=-1,o=!0,f=t.length-1;f>=1;--f)if(47===(e=t.charCodeAt(f))){if(!o){n=f;break}}else o=!1;return-1===n?r?"/":".":r&&1===n?"//":t.slice(0,n)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');i(t);var r,n=0,o=-1,f=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var s=e.length-1,u=-1;for(r=t.length-1;r>=0;--r){var a=t.charCodeAt(r);if(47===a){if(!f){n=r+1;break}}else-1===u&&(f=!1,u=r+1),s>=0&&(a===e.charCodeAt(s)?-1==--s&&(o=r):(s=-1,o=u))}return n===o?o=u:-1===o&&(o=t.length),t.slice(n,o)}for(r=t.length-1;r>=0;--r)if(47===t.charCodeAt(r)){if(!f){n=r+1;break}}else-1===o&&(f=!1,o=r+1);return-1===o?"":t.slice(n,o)},extname:function(t){i(t);for(var e=-1,r=0,n=-1,o=!0,f=0,s=t.length-1;s>=0;--s){var u=t.charCodeAt(s);if(47!==u)-1===n&&(o=!1,n=s+1),46===u?-1===e?e=s:1!==f&&(f=1):-1!==e&&(f=-1);else if(!o){r=s+1;break}}return-1===e||-1===n||0===f||1===f&&e===n-1&&e===r+1?"":t.slice(e,n)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var r=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+n:r+"/"+n:n}(0,t)},parse:function(t){i(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var r,n=t.charCodeAt(0),o=47===n;o?(e.root="/",r=1):r=0;for(var f=-1,s=0,u=-1,a=!0,h=t.length-1,c=0;h>=r;--h)if(47!==(n=t.charCodeAt(h)))-1===u&&(a=!1,u=h+1),46===n?-1===f?f=h:1!==c&&(c=1):-1!==f&&(c=-1);else if(!a){s=h+1;break}return-1===f||-1===u||0===c||1===c&&f===u-1&&f===s+1?-1!==u&&(e.base=e.name=0===s&&o?t.slice(1,u):t.slice(s,u)):(0===s&&o?(e.name=t.slice(1,f),e.base=t.slice(1,u)):(e.name=t.slice(s,f),e.base=t.slice(s,u)),e.ext=t.slice(f,u)),s>0?e.dir=t.slice(0,s-1):o&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};f.posix=f,t.exports=f}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var n={};(()=>{"use strict";r.d(n,{TinyUploadClicker:()=>s});var t=r(287);const e="undefined"!=typeof window&&void 0!==window.document,i={items:{},order:[]};function o(t,e){const r=[],n=Array.isArray(t)?t:Object.entries(t);for(const[t,o]of n)if(!i.items.hasOwnProperty(t)){i.items[t]=o;let n="number"==typeof e?e:-1;if(-1===n){const t=i.order.indexOf("object");n=t>-1?t:i.order.length}n=Math.min(Math.max(0,n),i.order.length),i.order.splice(n,0,t),r.push(t)}return r}function f(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"===Object.prototype.toString.call(t)}o([["undefined",t=>void 0===t],["null",t=>null===t],["boolean",t=>"boolean"==typeof t],["number",t=>"number"==typeof t&&!Number.isNaN(t)],["bigint",t=>"bigint"==typeof t],["string",t=>"string"==typeof t],["symbol",t=>"symbol"==typeof t],["function",t=>"function"==typeof t],["array",t=>Array.isArray(t)]]),e||o([["buffer",e=>void 0!==t.hp&&t.hp.isBuffer(e)]]),e&&o([["file",t=>"undefined"!=typeof File&&t instanceof File]]),o([["date",t=>t instanceof Date],["regexp",t=>t instanceof RegExp],["map",t=>t instanceof Map],["set",t=>t instanceof Set],["weakmap",t=>t instanceof WeakMap],["weakset",t=>t instanceof WeakSet],["promise",t=>t instanceof Promise]]),e&&o([["htmlelement",t=>"undefined"!=typeof HTMLElement&&t instanceof HTMLElement]]),o([["object",t=>f(t)]]),r(41),r(975);const s=class{#t;#e=[];#r=new WeakMap;#n;constructor(t){if(!f(t))throw new TypeError('TinyUploadClicker: "options" must be a valid object.');this.#t={multiple:!1,accept:"",inputAttributes:{},inputStyles:{display:"none"},onClick:null,onFileLoad:null,...t};const{triggers:e}=t;if(!(Array.isArray(e)||"string"==typeof e||e instanceof HTMLElement))throw new TypeError('TinyUploadClicker: "triggers" is required and must be a string, HTMLElement, or an array of them.');const r=(Array.isArray(this.#t.triggers)?this.#t.triggers:[this.#t.triggers]).map((t=>{if("string"==typeof t){const e=document.querySelector(t);if(!e)throw new Error(`TinyUploadClicker: No element found for selector "${t}".`);return e}if(!(t instanceof HTMLElement))throw new TypeError("TinyUploadClicker: All triggers must be either strings (selectors) or HTMLElements.");return t}));if(void 0!==t.accept&&"string"!=typeof t.accept&&!Array.isArray(t.accept))throw new TypeError('TinyUploadClicker: "accept" must be a string or an array of strings.');if(void 0!==t.onClick&&"function"!=typeof t.onClick&&null!==t.onClick)throw new TypeError('TinyUploadClicker: "onClick" must be a function or null.');if(void 0!==t.onFileLoad&&"function"!=typeof t.onFileLoad&&null!==t.onFileLoad)throw new TypeError('TinyUploadClicker: "onFileLoad" must be a function or null.');if(void 0!==t.inputAttributes&&!f(t.inputAttributes))throw new TypeError('TinyUploadClicker: "inputAttributes" must be an object.');if(void 0!==t.inputStyles&&!f(t.inputStyles))throw new TypeError('TinyUploadClicker: "inputStyles" must be an object.');this.#n=this.#i.bind(this),this.#e=r,this.#e.forEach((t=>{if(!(t instanceof HTMLElement))return;const e=document.createElement("input");e.type="file",this.#t.multiple&&(e.multiple=!0),"string"==typeof this.#t.accept?e.accept=this.#t.accept:Array.isArray(this.#t.accept)&&(e.accept=this.#t.accept.join(","));const r=this.#t.inputAttributes;if(r&&"object"==typeof r)for(const[t,n]of Object.entries(r))e.setAttribute(t,n);Object.assign(e.style,this.#t.inputStyles||{display:"none"}),e.addEventListener("change",(()=>{e.files&&"function"==typeof this.#t.onFileLoad&&this.#t.onFileLoad(e.files,t),e.value=""})),document.body.appendChild(e),this.#r.set(t,e),t.addEventListener("click",this.#n)}))}#i(t){const e=t.currentTarget;if(!(e instanceof HTMLElement))return;const r=this.#r.get(e);r&&("function"==typeof this.#t.onClick&&this.#t.onClick(e),r.click())}destroy(){for(const t of this.#e){if(!(t instanceof HTMLElement))return;t.removeEventListener("click",this.#n);const e=this.#r.get(t);e&&e.parentNode&&e.remove(),this.#r.delete(t)}this.#e=[]}}})(),window.TinyUploadClicker=n.TinyUploadClicker})();
|
|
2
|
+
(()=>{var t={133:()=>{},251:(t,e)=>{e.read=function(t,e,r,n,i){var o,f,s=8*i-n-1,u=(1<<s)-1,a=u>>1,h=-7,c=r?i-1:0,l=r?-1:1,p=t[e+c];for(c+=l,o=p&(1<<-h)-1,p>>=-h,h+=s;h>0;o=256*o+t[e+c],c+=l,h-=8);for(f=o&(1<<-h)-1,o>>=-h,h+=n;h>0;f=256*f+t[e+c],c+=l,h-=8);if(0===o)o=1-a;else{if(o===u)return f?NaN:1/0*(p?-1:1);f+=Math.pow(2,n),o-=a}return(p?-1:1)*f*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var f,s,u,a=8*o-i-1,h=(1<<a)-1,c=h>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,y=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,f=h):(f=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-f))<1&&(f--,u*=2),(e+=f+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(f++,u/=2),f+c>=h?(s=0,f=h):f+c>=1?(s=(e*u-1)*Math.pow(2,i),f+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),f=0));i>=8;t[r+p]=255&s,p+=y,s/=256,i-=8);for(f=f<<i|s,a+=i;a>0;t[r+p]=255&f,p+=y,f/=256,a-=8);t[r+p-y]|=128*g}},287:(t,e,r)=>{"use strict";var n=r(526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=u,e.IS=50;var f=2147483647;function s(t){if(t>f)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return a(t,e,r)}function a(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|g(t,e),n=s(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(_(t,Uint8Array)){var e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(_(t,ArrayBuffer)||t&&_(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(_(t,SharedArrayBuffer)||t&&_(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);var i=function(t){if(u.isBuffer(t)){var e=0|y(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||D(t.length)?s(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return h(t),s(t<0?0:0|y(t))}function l(t){for(var e=t.length<0?0:0|y(t.length),r=s(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function y(t){if(t>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||_(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(i)return n?-1:F(t).length;e=(""+e).toLowerCase(),i=!0}}function d(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return O(this,e,r);case"base64":return U(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function w(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),D(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){var o,f=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;f=2,s/=2,u/=2,r/=2}function a(t,e){return 1===f?t[e]:t.readUInt16BE(e*f)}if(i){var h=-1;for(o=r;o<s;o++)if(a(t,o)===a(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*f}else-1!==h&&(o-=o-h),h=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var c=!0,l=0;l<u;l++)if(a(t,o+l)!==a(e,l)){c=!1;break}if(c)return o}return-1}function m(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var f=0;f<n;++f){var s=parseInt(e.substr(2*f,2),16);if(D(s))return f;t[r+f]=s}return f}function E(t,e,r,n){return H(F(e,t.length-r),t,r,n)}function A(t,e,r,n){return H(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function T(t,e,r,n){return H(z(e),t,r,n)}function C(t,e,r,n){return H(function(t,e){for(var r,n,i,o=[],f=0;f<t.length&&!((e-=2)<0);++f)n=(r=t.charCodeAt(f))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function U(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function B(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,f,s,u,a=t[i],h=null,c=a>239?4:a>223?3:a>191?2:1;if(i+c<=r)switch(c){case 1:a<128&&(h=a);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&a)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],f=t[i+2],128==(192&o)&&128==(192&f)&&(u=(15&a)<<12|(63&o)<<6|63&f)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],f=t[i+2],s=t[i+3],128==(192&o)&&128==(192&f)&&128==(192&s)&&(u=(15&a)<<18|(63&o)<<12|(63&f)<<6|63&s)>65535&&u<1114112&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(t){var e=t.length;if(e<=L)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=L));return r}(n)}u.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return a(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return h(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},u.allocUnsafe=function(t){return c(t)},u.allocUnsafeSlow=function(t){return c(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(_(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),_(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.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}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(_(o,Uint8Array))i+o.length>n.length?u.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else{if(!u.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.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)w(this,e,e+1);return this},u.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)w(this,e,e+3),w(this,e+1,e+2);return this},u.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)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},u.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?B(this,0,t):d.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(_(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),f=(r>>>=0)-(e>>>=0),s=Math.min(o,f),a=this.slice(n,i),h=t.slice(e,r),c=0;c<s;++c)if(a[c]!==h[c]){o=a[c],f=h[c];break}return o<f?-1:f<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return v(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return v(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":case"latin1":case"binary":return A(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var L=4096;function k(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function O(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function x(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=q[t[o]];return i}function I(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function S(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function R(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function P(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return t>>>=0,e||S(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||S(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||S(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||S(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||M(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||M(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var o=0,f=1,s=0;for(this[e]=255&t;++o<r&&(f*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/f|0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var o=r-1,f=1,s=0;for(this[e+o]=255&t;--o>=0&&(f*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/f|0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(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]=255&t,e+4},u.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return P(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return P(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var f=u.isBuffer(t)?t:u.from(t,n),s=f.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=f[o%s]}return this};var N=/[^+/0-9A-Za-z-_]/g;function F(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],f=0;f<n;++f){if((r=t.charCodeAt(f))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(f+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function z(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(N,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function _(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function D(t){return t!=t}var q=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()},370:()=>{},526:(t,e)=>{"use strict";e.byteLength=function(t){var e=s(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=s(t),f=o[0],u=o[1],a=new i(function(t,e,r){return 3*(e+r)/4-r}(0,f,u)),h=0,c=u>0?f-4:f;for(r=0;r<c;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],a[h++]=e>>16&255,a[h++]=e>>8&255,a[h++]=255&e;return 2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,a[h++]=255&e),1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,a[h++]=e>>8&255,a[h++]=255&e),a},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],f=16383,s=0,a=n-i;s<a;s+=f)o.push(u(t,s,s+f>a?a:s+f));return 1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0;f<64;++f)r[f]=o[f],n[o.charCodeAt(f)]=f;function s(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function u(t,e,n){for(var i,o,f=[],s=e;s<n;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),f.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return f.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},606:t=>{var e,r,n=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function f(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var s,u=[],a=!1,h=-1;function c(){a&&s&&(a=!1,s.length?u=s.concat(u):h=-1,u.length&&l())}function l(){if(!a){var t=f(c);a=!0;for(var e=u.length;e;){for(s=u,u=[];++h<e;)s&&s[h].run();h=-1,e=u.length}s=null,a=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{return r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function y(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new p(t,e)),1!==u.length||a||f(l)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=y,n.addListener=y,n.once=y,n.off=y,n.removeListener=y,n.removeAllListeners=y,n.emit=y,n.prependListener=y,n.prependOnceListener=y,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},975:(t,e,r)=>{"use strict";var n=r(606);function i(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function o(t,e){for(var r,n="",i=0,o=-1,f=0,s=0;s<=t.length;++s){if(s<t.length)r=t.charCodeAt(s);else{if(47===r)break;r=47}if(47===r){if(o===s-1||1===f);else if(o!==s-1&&2===f){if(n.length<2||2!==i||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var u=n.lastIndexOf("/");if(u!==n.length-1){-1===u?(n="",i=0):i=(n=n.slice(0,u)).length-1-n.lastIndexOf("/"),o=s,f=0;continue}}else if(2===n.length||1===n.length){n="",i=0,o=s,f=0;continue}e&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+t.slice(o+1,s):n=t.slice(o+1,s),i=s-o-1;o=s,f=0}else 46===r&&-1!==f?++f:f=-1}return n}var f={resolve:function(){for(var t,e="",r=!1,f=arguments.length-1;f>=-1&&!r;f--){var s;f>=0?s=arguments[f]:(void 0===t&&(t=n.cwd()),s=t),i(s),0!==s.length&&(e=s+"/"+e,r=47===s.charCodeAt(0))}return e=o(e,!r),r?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(t){if(i(t),0===t.length)return".";var e=47===t.charCodeAt(0),r=47===t.charCodeAt(t.length-1);return 0!==(t=o(t,!e)).length||e||(t="."),t.length>0&&r&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return i(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e<arguments.length;++e){var r=arguments[e];i(r),r.length>0&&(void 0===t?t=r:t+="/"+r)}return void 0===t?".":f.normalize(t)},relative:function(t,e){if(i(t),i(e),t===e)return"";if((t=f.resolve(t))===(e=f.resolve(e)))return"";for(var r=1;r<t.length&&47===t.charCodeAt(r);++r);for(var n=t.length,o=n-r,s=1;s<e.length&&47===e.charCodeAt(s);++s);for(var u=e.length-s,a=o<u?o:u,h=-1,c=0;c<=a;++c){if(c===a){if(u>a){if(47===e.charCodeAt(s+c))return e.slice(s+c+1);if(0===c)return e.slice(s+c)}else o>a&&(47===t.charCodeAt(r+c)?h=c:0===c&&(h=0));break}var l=t.charCodeAt(r+c);if(l!==e.charCodeAt(s+c))break;47===l&&(h=c)}var p="";for(c=r+h+1;c<=n;++c)c!==n&&47!==t.charCodeAt(c)||(0===p.length?p+="..":p+="/..");return p.length>0?p+e.slice(s+h):(s+=h,47===e.charCodeAt(s)&&++s,e.slice(s))},_makeLong:function(t){return t},dirname:function(t){if(i(t),0===t.length)return".";for(var e=t.charCodeAt(0),r=47===e,n=-1,o=!0,f=t.length-1;f>=1;--f)if(47===(e=t.charCodeAt(f))){if(!o){n=f;break}}else o=!1;return-1===n?r?"/":".":r&&1===n?"//":t.slice(0,n)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');i(t);var r,n=0,o=-1,f=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var s=e.length-1,u=-1;for(r=t.length-1;r>=0;--r){var a=t.charCodeAt(r);if(47===a){if(!f){n=r+1;break}}else-1===u&&(f=!1,u=r+1),s>=0&&(a===e.charCodeAt(s)?-1==--s&&(o=r):(s=-1,o=u))}return n===o?o=u:-1===o&&(o=t.length),t.slice(n,o)}for(r=t.length-1;r>=0;--r)if(47===t.charCodeAt(r)){if(!f){n=r+1;break}}else-1===o&&(f=!1,o=r+1);return-1===o?"":t.slice(n,o)},extname:function(t){i(t);for(var e=-1,r=0,n=-1,o=!0,f=0,s=t.length-1;s>=0;--s){var u=t.charCodeAt(s);if(47!==u)-1===n&&(o=!1,n=s+1),46===u?-1===e?e=s:1!==f&&(f=1):-1!==e&&(f=-1);else if(!o){r=s+1;break}}return-1===e||-1===n||0===f||1===f&&e===n-1&&e===r+1?"":t.slice(e,n)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var r=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+n:r+"/"+n:n}(0,t)},parse:function(t){i(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var r,n=t.charCodeAt(0),o=47===n;o?(e.root="/",r=1):r=0;for(var f=-1,s=0,u=-1,a=!0,h=t.length-1,c=0;h>=r;--h)if(47!==(n=t.charCodeAt(h)))-1===u&&(a=!1,u=h+1),46===n?-1===f?f=h:1!==c&&(c=1):-1!==f&&(c=-1);else if(!a){s=h+1;break}return-1===f||-1===u||0===c||1===c&&f===u-1&&f===s+1?-1!==u&&(e.base=e.name=0===s&&o?t.slice(1,u):t.slice(s,u)):(0===s&&o?(e.name=t.slice(1,f),e.base=t.slice(1,u)):(e.name=t.slice(s,f),e.base=t.slice(s,u)),e.ext=t.slice(f,u)),s>0?e.dir=t.slice(0,s-1):o&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};f.posix=f,t.exports=f}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var n={};(()=>{"use strict";r.d(n,{TinyUploadClicker:()=>s});var t=r(287);const e="undefined"!=typeof window&&void 0!==window.document,i={items:{},order:[]};function o(t,e){const r=[],n=Array.isArray(t)?t:Object.entries(t);for(const[t,o]of n)if(!i.items.hasOwnProperty(t)){i.items[t]=o;let n="number"==typeof e?e:-1;if(-1===n){const t=i.order.indexOf("object");n=t>-1?t:i.order.length}n=Math.min(Math.max(0,n),i.order.length),i.order.splice(n,0,t),r.push(t)}return r}function f(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"===Object.prototype.toString.call(t)}o([["undefined",t=>void 0===t],["null",t=>null===t],["boolean",t=>"boolean"==typeof t],["number",t=>"number"==typeof t&&!Number.isNaN(t)],["bigint",t=>"bigint"==typeof t],["string",t=>"string"==typeof t],["symbol",t=>"symbol"==typeof t],["function",t=>"function"==typeof t],["array",t=>Array.isArray(t)]]),e||o([["buffer",e=>void 0!==t.hp&&t.hp.isBuffer(e)]]),e&&o([["file",t=>"undefined"!=typeof File&&t instanceof File]]),o([["date",t=>t instanceof Date],["regexp",t=>t instanceof RegExp],["map",t=>t instanceof Map],["set",t=>t instanceof Set],["weakmap",t=>t instanceof WeakMap],["weakset",t=>t instanceof WeakSet],["promise",t=>t instanceof Promise]]),e&&o([["htmlelement",t=>"undefined"!=typeof HTMLElement&&t instanceof HTMLElement]]),o([["object",t=>f(t)]]),r(133),r(975),r(370);const s=class{#t;#e=[];#r=new WeakMap;#n;constructor(t){if(!f(t))throw new TypeError('TinyUploadClicker: "options" must be a valid object.');this.#t={multiple:!1,accept:"",inputAttributes:{},inputStyles:{display:"none"},onClick:null,onFileLoad:null,...t};const{triggers:e}=t;if(!(Array.isArray(e)||"string"==typeof e||e instanceof HTMLElement))throw new TypeError('TinyUploadClicker: "triggers" is required and must be a string, HTMLElement, or an array of them.');const r=(Array.isArray(this.#t.triggers)?this.#t.triggers:[this.#t.triggers]).map((t=>{if("string"==typeof t){const e=document.querySelector(t);if(!e)throw new Error(`TinyUploadClicker: No element found for selector "${t}".`);return e}if(!(t instanceof HTMLElement))throw new TypeError("TinyUploadClicker: All triggers must be either strings (selectors) or HTMLElements.");return t}));if(void 0!==t.accept&&"string"!=typeof t.accept&&!Array.isArray(t.accept))throw new TypeError('TinyUploadClicker: "accept" must be a string or an array of strings.');if(void 0!==t.onClick&&"function"!=typeof t.onClick&&null!==t.onClick)throw new TypeError('TinyUploadClicker: "onClick" must be a function or null.');if(void 0!==t.onFileLoad&&"function"!=typeof t.onFileLoad&&null!==t.onFileLoad)throw new TypeError('TinyUploadClicker: "onFileLoad" must be a function or null.');if(void 0!==t.inputAttributes&&!f(t.inputAttributes))throw new TypeError('TinyUploadClicker: "inputAttributes" must be an object.');if(void 0!==t.inputStyles&&!f(t.inputStyles))throw new TypeError('TinyUploadClicker: "inputStyles" must be an object.');this.#n=this.#i.bind(this),this.#e=r,this.#e.forEach((t=>{if(!(t instanceof HTMLElement))return;const e=document.createElement("input");e.type="file",this.#t.multiple&&(e.multiple=!0),"string"==typeof this.#t.accept?e.accept=this.#t.accept:Array.isArray(this.#t.accept)&&(e.accept=this.#t.accept.join(","));const r=this.#t.inputAttributes;if(r&&"object"==typeof r)for(const[t,n]of Object.entries(r))e.setAttribute(t,n);Object.assign(e.style,this.#t.inputStyles||{display:"none"}),e.addEventListener("change",(()=>{e.files&&"function"==typeof this.#t.onFileLoad&&this.#t.onFileLoad(e.files,t),e.value=""})),document.body.appendChild(e),this.#r.set(t,e),t.addEventListener("click",this.#n)}))}#i(t){const e=t.currentTarget;if(!(e instanceof HTMLElement))return;const r=this.#r.get(e);r&&("function"==typeof this.#t.onClick&&this.#t.onClick(e),r.click())}destroy(){for(const t of this.#e){if(!(t instanceof HTMLElement))return;t.removeEventListener("click",this.#n);const e=this.#r.get(t);e&&e.parentNode&&e.remove(),this.#r.delete(t)}this.#e=[]}}})(),window.TinyUploadClicker=n.TinyUploadClicker})();
|
package/dist/v1/basics/index.cjs
CHANGED
|
@@ -9,7 +9,6 @@ var objFilter = require('./objFilter.cjs');
|
|
|
9
9
|
var fullScreen = require('./fullScreen.cjs');
|
|
10
10
|
var simpleMath = require('./simpleMath.cjs');
|
|
11
11
|
var text = require('./text.cjs');
|
|
12
|
-
var fileManager = require('./fileManager.cjs');
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
|
|
@@ -48,25 +47,3 @@ exports.ruleOfThree = simpleMath.ruleOfThree;
|
|
|
48
47
|
exports.addAiMarkerShortcut = text.addAiMarkerShortcut;
|
|
49
48
|
exports.toTitleCase = text.toTitleCase;
|
|
50
49
|
exports.toTitleCaseLowerFirst = text.toTitleCaseLowerFirst;
|
|
51
|
-
exports.backupFile = fileManager.backupFile;
|
|
52
|
-
exports.clearDirectory = fileManager.clearDirectory;
|
|
53
|
-
exports.dirExists = fileManager.dirExists;
|
|
54
|
-
exports.dirSize = fileManager.dirSize;
|
|
55
|
-
exports.ensureCopyFile = fileManager.ensureCopyFile;
|
|
56
|
-
exports.ensureDirectory = fileManager.ensureDirectory;
|
|
57
|
-
exports.fileExists = fileManager.fileExists;
|
|
58
|
-
exports.fileSize = fileManager.fileSize;
|
|
59
|
-
exports.getLatestBackupPath = fileManager.getLatestBackupPath;
|
|
60
|
-
exports.isDirEmpty = fileManager.isDirEmpty;
|
|
61
|
-
exports.listDirs = fileManager.listDirs;
|
|
62
|
-
exports.listFiles = fileManager.listFiles;
|
|
63
|
-
exports.readJsonFile = fileManager.readJsonFile;
|
|
64
|
-
exports.renameFileAddPrefixSuffix = fileManager.renameFileAddPrefixSuffix;
|
|
65
|
-
exports.renameFileBatch = fileManager.renameFileBatch;
|
|
66
|
-
exports.renameFileNormalizeCase = fileManager.renameFileNormalizeCase;
|
|
67
|
-
exports.renameFilePadNumbers = fileManager.renameFilePadNumbers;
|
|
68
|
-
exports.renameFileRegex = fileManager.renameFileRegex;
|
|
69
|
-
exports.restoreLatestBackup = fileManager.restoreLatestBackup;
|
|
70
|
-
exports.tryDeleteFile = fileManager.tryDeleteFile;
|
|
71
|
-
exports.writeJsonFile = fileManager.writeJsonFile;
|
|
72
|
-
exports.writeTextFile = fileManager.writeTextFile;
|
|
@@ -2,31 +2,9 @@ import { getHtmlElBorders } from './html.mjs';
|
|
|
2
2
|
import { getHtmlElBordersWidth } from './html.mjs';
|
|
3
3
|
import { getHtmlElMargin } from './html.mjs';
|
|
4
4
|
import { getHtmlElPadding } from './html.mjs';
|
|
5
|
-
import { getLatestBackupPath } from './fileManager.mjs';
|
|
6
5
|
import { fetchJson } from './html.mjs';
|
|
7
6
|
import { readJsonBlob } from './html.mjs';
|
|
8
7
|
import { saveJsonFile } from './html.mjs';
|
|
9
|
-
import { readJsonFile } from './fileManager.mjs';
|
|
10
|
-
import { writeJsonFile } from './fileManager.mjs';
|
|
11
|
-
import { ensureDirectory } from './fileManager.mjs';
|
|
12
|
-
import { clearDirectory } from './fileManager.mjs';
|
|
13
|
-
import { fileExists } from './fileManager.mjs';
|
|
14
|
-
import { dirExists } from './fileManager.mjs';
|
|
15
|
-
import { isDirEmpty } from './fileManager.mjs';
|
|
16
|
-
import { ensureCopyFile } from './fileManager.mjs';
|
|
17
|
-
import { tryDeleteFile } from './fileManager.mjs';
|
|
18
|
-
import { writeTextFile } from './fileManager.mjs';
|
|
19
|
-
import { listFiles } from './fileManager.mjs';
|
|
20
|
-
import { listDirs } from './fileManager.mjs';
|
|
21
|
-
import { fileSize } from './fileManager.mjs';
|
|
22
|
-
import { dirSize } from './fileManager.mjs';
|
|
23
|
-
import { backupFile } from './fileManager.mjs';
|
|
24
|
-
import { restoreLatestBackup } from './fileManager.mjs';
|
|
25
|
-
import { renameFileBatch } from './fileManager.mjs';
|
|
26
|
-
import { renameFileRegex } from './fileManager.mjs';
|
|
27
|
-
import { renameFileAddPrefixSuffix } from './fileManager.mjs';
|
|
28
|
-
import { renameFileNormalizeCase } from './fileManager.mjs';
|
|
29
|
-
import { renameFilePadNumbers } from './fileManager.mjs';
|
|
30
8
|
import { documentIsFullScreen } from './fullScreen.mjs';
|
|
31
9
|
import { isScreenFilled } from './fullScreen.mjs';
|
|
32
10
|
import { requestFullScreen } from './fullScreen.mjs';
|
|
@@ -55,5 +33,5 @@ import { getTimeDuration } from './clock.mjs';
|
|
|
55
33
|
import { shuffleArray } from './array.mjs';
|
|
56
34
|
import { toTitleCase } from './text.mjs';
|
|
57
35
|
import { toTitleCaseLowerFirst } from './text.mjs';
|
|
58
|
-
export { getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding,
|
|
36
|
+
export { getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding, fetchJson, readJsonBlob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, areHtmlElsColliding, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst };
|
|
59
37
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/v1/basics/index.mjs
CHANGED
|
@@ -7,5 +7,4 @@ import { countObj, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objTyp
|
|
|
7
7
|
import { documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, } from './fullScreen.mjs';
|
|
8
8
|
import { formatBytes, getAge, getSimplePerc, ruleOfThree } from './simpleMath.mjs';
|
|
9
9
|
import { addAiMarkerShortcut, toTitleCase, toTitleCaseLowerFirst } from './text.mjs';
|
|
10
|
-
|
|
11
|
-
export { getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding, getLatestBackupPath, fetchJson, readJsonBlob, saveJsonFile, readJsonFile, writeJsonFile, ensureDirectory, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, areHtmlElsColliding, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
10
|
+
export { getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding, fetchJson, readJsonBlob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, areHtmlElsColliding, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fs = require('fs');
|
|
4
|
+
var promises = require('fs/promises');
|
|
5
|
+
var path = require('path');
|
|
6
|
+
var normalFuncs = require('./normalFuncs.cjs');
|
|
7
|
+
|
|
8
|
+
/*========================*
|
|
9
|
+
* JSON Operations
|
|
10
|
+
*========================*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Reads and parses a JSON file.
|
|
14
|
+
* Throws an error if the file content is not valid JSON.
|
|
15
|
+
* @param {string} filePath
|
|
16
|
+
* @returns {Promise<any>}
|
|
17
|
+
*/
|
|
18
|
+
async function readJsonFileAsync(filePath) {
|
|
19
|
+
if (!fs.existsSync(filePath)) throw new Error(`File not found: ${filePath}`);
|
|
20
|
+
const content = await promises.readFile(filePath, 'utf-8');
|
|
21
|
+
return JSON.parse(content);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Saves an object as JSON to a file.
|
|
26
|
+
* Automatically creates the directory if it does not exist.
|
|
27
|
+
* @param {string} filePath
|
|
28
|
+
* @param {any} data
|
|
29
|
+
* @param {number} [spaces=2]
|
|
30
|
+
* @returns {Promise<void>}
|
|
31
|
+
*/
|
|
32
|
+
function writeJsonFileAsync(filePath, data, spaces = 2) {
|
|
33
|
+
const json = JSON.stringify(data, null, spaces);
|
|
34
|
+
return promises.writeFile(filePath, json, 'utf-8');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/*========================*
|
|
38
|
+
* Directory Management
|
|
39
|
+
*========================*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Clears all contents inside a directory but keeps the directory.
|
|
43
|
+
* @param {string} dirPath
|
|
44
|
+
*/
|
|
45
|
+
async function clearDirectoryAsync(dirPath) {
|
|
46
|
+
if (!fs.existsSync(dirPath)) return;
|
|
47
|
+
const files = await promises.readdir(dirPath);
|
|
48
|
+
|
|
49
|
+
/** @type {Record<string, import('fs').Stats>} */
|
|
50
|
+
const dataList = {};
|
|
51
|
+
const promises$1 = [];
|
|
52
|
+
|
|
53
|
+
for (const file of files) {
|
|
54
|
+
const fullPath = path.join(dirPath, file);
|
|
55
|
+
const lsResult = promises.lstat(fullPath);
|
|
56
|
+
|
|
57
|
+
lsResult.then((statData) => {
|
|
58
|
+
dataList[fullPath] = statData;
|
|
59
|
+
return statData;
|
|
60
|
+
});
|
|
61
|
+
promises$1.push(lsResult);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
await Promise.all(promises$1);
|
|
65
|
+
const promises2 = [];
|
|
66
|
+
for (const fullPath in dataList) {
|
|
67
|
+
const statData = dataList[fullPath];
|
|
68
|
+
if (statData.isDirectory()) {
|
|
69
|
+
promises2.push(promises.rm(fullPath, { recursive: true, force: true }));
|
|
70
|
+
} else {
|
|
71
|
+
promises2.push(promises.unlink(fullPath));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
await Promise.all(promises2);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/*========================*
|
|
79
|
+
* File Checks
|
|
80
|
+
*========================*/
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Checks whether a directory is empty.
|
|
84
|
+
* @param {string} dirPath
|
|
85
|
+
* @returns {Promise<boolean>}
|
|
86
|
+
*/
|
|
87
|
+
async function isDirEmptyAsync(dirPath) {
|
|
88
|
+
const data = await promises.readdir(dirPath);
|
|
89
|
+
return data.length === 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/*========================*
|
|
93
|
+
* File Operations
|
|
94
|
+
*========================*/
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Copies a file to a destination.
|
|
98
|
+
* @param {string} src
|
|
99
|
+
* @param {string} dest
|
|
100
|
+
* @param {number} [mode]
|
|
101
|
+
* @returns {Promise<void>}
|
|
102
|
+
*/
|
|
103
|
+
function ensureCopyFileAsync(src, dest, mode) {
|
|
104
|
+
normalFuncs.ensureDirectory(path.dirname(dest));
|
|
105
|
+
return promises.copyFile(src, dest, mode);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Deletes a file (If the file exists).
|
|
110
|
+
* @param {string} filePath
|
|
111
|
+
* @returns {Promise<boolean>}
|
|
112
|
+
*/
|
|
113
|
+
async function tryDeleteFileAsync(filePath) {
|
|
114
|
+
if (normalFuncs.fileExists(filePath)) {
|
|
115
|
+
await promises.unlink(filePath);
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/*========================*
|
|
122
|
+
* Text Operations
|
|
123
|
+
*========================*/
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Writes text to a file (Ensures that the directory exists, creating it recursively if needed).
|
|
127
|
+
* @param {string} filePath
|
|
128
|
+
* @param {string} content
|
|
129
|
+
* @param {import('fs').WriteFileOptions} [ops='utf-8']
|
|
130
|
+
* @returns {Promise<void>}
|
|
131
|
+
*/
|
|
132
|
+
function writeTextFileAsync(filePath, content, ops = 'utf-8') {
|
|
133
|
+
const dir = path.dirname(filePath);
|
|
134
|
+
normalFuncs.ensureDirectory(dir);
|
|
135
|
+
return promises.writeFile(filePath, content, ops);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/*========================*
|
|
139
|
+
* Directory Listings
|
|
140
|
+
*========================*/
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Lists all files and dirs in a directory (optionally recursive).
|
|
144
|
+
* @param {string} dirPath
|
|
145
|
+
* @param {boolean} [recursive=false]
|
|
146
|
+
* @returns {Promise<{ files: string[]; dirs: string[] }>}
|
|
147
|
+
*/
|
|
148
|
+
async function listFilesAsync(dirPath, recursive = false) {
|
|
149
|
+
/** @type {{ files: string[]; dirs: string[] }} */
|
|
150
|
+
const results = { files: [], dirs: [] };
|
|
151
|
+
if (!normalFuncs.dirExists(dirPath)) return results;
|
|
152
|
+
|
|
153
|
+
const entries = await promises.readdir(dirPath);
|
|
154
|
+
for (const entry of entries) {
|
|
155
|
+
const fullPath = path.join(dirPath, entry);
|
|
156
|
+
const statData = await promises.lstat(fullPath);
|
|
157
|
+
if (statData.isDirectory()) {
|
|
158
|
+
results.dirs.push(fullPath);
|
|
159
|
+
if (recursive) {
|
|
160
|
+
const results2 = await listFilesAsync(fullPath, true);
|
|
161
|
+
results.files.push(...results2.files);
|
|
162
|
+
results.dirs.push(...results2.dirs);
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
results.files.push(fullPath);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return results;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Lists all directories in a directory (optionally recursive).
|
|
173
|
+
* @param {string} dirPath
|
|
174
|
+
* @param {boolean} [recursive=false]
|
|
175
|
+
* @returns {Promise<string[]>}
|
|
176
|
+
*/
|
|
177
|
+
async function listDirsAsync(dirPath, recursive = false) {
|
|
178
|
+
/** @type {string[]} */
|
|
179
|
+
const results = [];
|
|
180
|
+
if (!normalFuncs.dirExists(dirPath)) return results;
|
|
181
|
+
|
|
182
|
+
const entries = await promises.readdir(dirPath);
|
|
183
|
+
for (const entry of entries) {
|
|
184
|
+
const fullPath = path.join(dirPath, entry);
|
|
185
|
+
const statData = await promises.lstat(fullPath);
|
|
186
|
+
if (statData.isDirectory()) {
|
|
187
|
+
results.push(fullPath);
|
|
188
|
+
if (recursive) {
|
|
189
|
+
results.push(...(await listDirsAsync(fullPath, true)));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return results;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/*========================*
|
|
197
|
+
* File Info
|
|
198
|
+
*========================*/
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Returns the size of a file in bytes.
|
|
202
|
+
* @param {string} filePath
|
|
203
|
+
* @returns {Promise<number>}
|
|
204
|
+
*/
|
|
205
|
+
async function fileSizeAsync(filePath) {
|
|
206
|
+
if (!normalFuncs.fileExists(filePath)) return 0;
|
|
207
|
+
const stats = await promises.stat(filePath);
|
|
208
|
+
return stats.size;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Returns the total size of a directory in bytes.
|
|
213
|
+
* @param {string} dirPath
|
|
214
|
+
* @returns {Promise<number>}
|
|
215
|
+
*/
|
|
216
|
+
async function dirSizeAsync(dirPath) {
|
|
217
|
+
let total = 0;
|
|
218
|
+
const { files } = await listFilesAsync(dirPath, true);
|
|
219
|
+
const promises = [];
|
|
220
|
+
for (const file of files) {
|
|
221
|
+
const result = fileSizeAsync(file);
|
|
222
|
+
result.then((item) => {
|
|
223
|
+
total += item;
|
|
224
|
+
return item;
|
|
225
|
+
});
|
|
226
|
+
promises.push(result);
|
|
227
|
+
}
|
|
228
|
+
await Promise.all(promises);
|
|
229
|
+
return total;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/*========================*
|
|
233
|
+
* Backup Utilities
|
|
234
|
+
*========================*/
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Restores the most recent backup of a file.
|
|
238
|
+
* @param {string} filePath
|
|
239
|
+
* @param {string} [ext='bak']
|
|
240
|
+
* @returns {Promise<void>}
|
|
241
|
+
*/
|
|
242
|
+
function restoreLatestBackupAsync(filePath, ext = 'bak') {
|
|
243
|
+
const latestBackup = normalFuncs.getLatestBackupPath(filePath, ext);
|
|
244
|
+
return ensureCopyFileAsync(latestBackup, filePath);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Creates a backup copy of a file with .bak timestamp suffix.
|
|
249
|
+
* @param {string} filePath
|
|
250
|
+
* @param {string} [ext='bak']
|
|
251
|
+
* @returns {Promise<void>}
|
|
252
|
+
*/
|
|
253
|
+
async function backupFileAsync(filePath, ext = 'bak') {
|
|
254
|
+
if (!normalFuncs.fileExists(filePath)) return;
|
|
255
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
256
|
+
const backupPath = `${filePath}.${ext}.${timestamp}`;
|
|
257
|
+
return ensureCopyFileAsync(filePath, backupPath);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
exports.backupFileAsync = backupFileAsync;
|
|
261
|
+
exports.clearDirectoryAsync = clearDirectoryAsync;
|
|
262
|
+
exports.dirSizeAsync = dirSizeAsync;
|
|
263
|
+
exports.ensureCopyFileAsync = ensureCopyFileAsync;
|
|
264
|
+
exports.fileSizeAsync = fileSizeAsync;
|
|
265
|
+
exports.isDirEmptyAsync = isDirEmptyAsync;
|
|
266
|
+
exports.listDirsAsync = listDirsAsync;
|
|
267
|
+
exports.listFilesAsync = listFilesAsync;
|
|
268
|
+
exports.readJsonFileAsync = readJsonFileAsync;
|
|
269
|
+
exports.restoreLatestBackupAsync = restoreLatestBackupAsync;
|
|
270
|
+
exports.tryDeleteFileAsync = tryDeleteFileAsync;
|
|
271
|
+
exports.writeJsonFileAsync = writeJsonFileAsync;
|
|
272
|
+
exports.writeTextFileAsync = writeTextFileAsync;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads and parses a JSON file.
|
|
3
|
+
* Throws an error if the file content is not valid JSON.
|
|
4
|
+
* @param {string} filePath
|
|
5
|
+
* @returns {Promise<any>}
|
|
6
|
+
*/
|
|
7
|
+
export function readJsonFileAsync(filePath: string): Promise<any>;
|
|
8
|
+
/**
|
|
9
|
+
* Saves an object as JSON to a file.
|
|
10
|
+
* Automatically creates the directory if it does not exist.
|
|
11
|
+
* @param {string} filePath
|
|
12
|
+
* @param {any} data
|
|
13
|
+
* @param {number} [spaces=2]
|
|
14
|
+
* @returns {Promise<void>}
|
|
15
|
+
*/
|
|
16
|
+
export function writeJsonFileAsync(filePath: string, data: any, spaces?: number): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Clears all contents inside a directory but keeps the directory.
|
|
19
|
+
* @param {string} dirPath
|
|
20
|
+
*/
|
|
21
|
+
export function clearDirectoryAsync(dirPath: string): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Checks whether a directory is empty.
|
|
24
|
+
* @param {string} dirPath
|
|
25
|
+
* @returns {Promise<boolean>}
|
|
26
|
+
*/
|
|
27
|
+
export function isDirEmptyAsync(dirPath: string): Promise<boolean>;
|
|
28
|
+
/**
|
|
29
|
+
* Copies a file to a destination.
|
|
30
|
+
* @param {string} src
|
|
31
|
+
* @param {string} dest
|
|
32
|
+
* @param {number} [mode]
|
|
33
|
+
* @returns {Promise<void>}
|
|
34
|
+
*/
|
|
35
|
+
export function ensureCopyFileAsync(src: string, dest: string, mode?: number): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Deletes a file (If the file exists).
|
|
38
|
+
* @param {string} filePath
|
|
39
|
+
* @returns {Promise<boolean>}
|
|
40
|
+
*/
|
|
41
|
+
export function tryDeleteFileAsync(filePath: string): Promise<boolean>;
|
|
42
|
+
/**
|
|
43
|
+
* Writes text to a file (Ensures that the directory exists, creating it recursively if needed).
|
|
44
|
+
* @param {string} filePath
|
|
45
|
+
* @param {string} content
|
|
46
|
+
* @param {import('fs').WriteFileOptions} [ops='utf-8']
|
|
47
|
+
* @returns {Promise<void>}
|
|
48
|
+
*/
|
|
49
|
+
export function writeTextFileAsync(filePath: string, content: string, ops?: import("fs").WriteFileOptions): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Lists all files and dirs in a directory (optionally recursive).
|
|
52
|
+
* @param {string} dirPath
|
|
53
|
+
* @param {boolean} [recursive=false]
|
|
54
|
+
* @returns {Promise<{ files: string[]; dirs: string[] }>}
|
|
55
|
+
*/
|
|
56
|
+
export function listFilesAsync(dirPath: string, recursive?: boolean): Promise<{
|
|
57
|
+
files: string[];
|
|
58
|
+
dirs: string[];
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* Lists all directories in a directory (optionally recursive).
|
|
62
|
+
* @param {string} dirPath
|
|
63
|
+
* @param {boolean} [recursive=false]
|
|
64
|
+
* @returns {Promise<string[]>}
|
|
65
|
+
*/
|
|
66
|
+
export function listDirsAsync(dirPath: string, recursive?: boolean): Promise<string[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the size of a file in bytes.
|
|
69
|
+
* @param {string} filePath
|
|
70
|
+
* @returns {Promise<number>}
|
|
71
|
+
*/
|
|
72
|
+
export function fileSizeAsync(filePath: string): Promise<number>;
|
|
73
|
+
/**
|
|
74
|
+
* Returns the total size of a directory in bytes.
|
|
75
|
+
* @param {string} dirPath
|
|
76
|
+
* @returns {Promise<number>}
|
|
77
|
+
*/
|
|
78
|
+
export function dirSizeAsync(dirPath: string): Promise<number>;
|
|
79
|
+
/**
|
|
80
|
+
* Restores the most recent backup of a file.
|
|
81
|
+
* @param {string} filePath
|
|
82
|
+
* @param {string} [ext='bak']
|
|
83
|
+
* @returns {Promise<void>}
|
|
84
|
+
*/
|
|
85
|
+
export function restoreLatestBackupAsync(filePath: string, ext?: string): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Creates a backup copy of a file with .bak timestamp suffix.
|
|
88
|
+
* @param {string} filePath
|
|
89
|
+
* @param {string} [ext='bak']
|
|
90
|
+
* @returns {Promise<void>}
|
|
91
|
+
*/
|
|
92
|
+
export function backupFileAsync(filePath: string, ext?: string): Promise<void>;
|
|
93
|
+
//# sourceMappingURL=asyncFuncs.d.mts.map
|