@prismatic-io/components-karbon 0.3.0 → 0.3.1
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/index.js +1 -1
- package/npm-dist/index.cjs +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -215,4 +215,4 @@ e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=
|
|
|
215
215
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
216
216
|
* @license MIT
|
|
217
217
|
*/
|
|
218
|
-
let t=Nm(),n=Pm(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;let i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.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 a(){try{let 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(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(K(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||fe(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(K(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).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}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(K(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return le(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return de(e).length;default:if(i)return r?-1:le(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return F(this,t,n);case`utf8`:case`utf-8`:return A(this,t,n);case`ascii`:return N(this,t,n);case`latin1`:case`binary`:return P(this,t,n);case`base64`:return k(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return I(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?A(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(K(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,fe(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:C(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):C(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function C(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function w(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(fe(r))return o;e[n+o]=r}return o}function T(e,t,n,r){return G(le(t,e.length-n),e,n,r)}function E(e,t,n,r){return G(W(t),e,n,r)}function D(e,t,n,r){return G(de(t),e,n,r)}function O(e,t,n,r){return G(ue(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return w(this,e,t,n);case`utf8`:case`utf-8`:return T(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return E(this,e,t,n);case`base64`:return D(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return O(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function k(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function A(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return M(r)}let j=4096;function M(e){let t=e.length;if(t<=j)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=j));return n}function N(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function P(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function F(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=pe[e[r]];return i}function I(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function L(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!1,52,8)};function R(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;R(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;R(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function z(e,t,n,r,i){ie(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function B(e,t,n,r,i){ie(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=me(function(e,t=0){return z(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=me(function(e,t=0){return B(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);R(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=me(function(e,t=0){return z(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=me(function(e,t=0){return B(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ee(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function V(e,t,r,i,a){return t=+t,r>>>=0,a||ee(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return V(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return V(this,e,t,!1,n)};function H(e,t,r,i,a){return t=+t,r>>>=0,a||ee(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return H(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return H(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let U={};function te(e,t,n){U[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}te(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),te(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),te(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=ne(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=ne(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function ne(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function re(e,t,n){ae(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&oe(t,e.length-(n+1))}function ie(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new U.ERR_OUT_OF_RANGE(`value`,i,e)}re(r,i,a)}function ae(e,t){if(typeof e!=`number`)throw new U.ERR_INVALID_ARG_TYPE(t,`number`,e)}function oe(e,t,n){throw Math.floor(e)===e?t<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(ae(e,n),new U.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let se=/[^+/0-9A-Za-z-_]/g;function ce(e){if(e=e.split(`=`)[0],e=e.trim().replace(se,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function le(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function W(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function ue(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function de(e){return t.toByteArray(ce(e))}function G(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function K(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function fe(e){return e!==e}let pe=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function me(e){return typeof BigInt>`u`?he:e}function he(){throw Error(`BigInt not supported`)}})),Im=a(((e,t)=>{let n=Mm(),r=typeof window<`u`?Fm().Buffer:global.Buffer;function i(e){return 12+4*Math.ceil(e.length/4)}function a(){return!(typeof window<`u`&&typeof document<`u`)}function o(e){return e.BYTES_PER_ELEMENT?e.length*e.BYTES_PER_ELEMENT:-1}function s(e){let t=0;try{let n=e;if(e instanceof Map?n=Object.fromEntries(e):e instanceof Set&&(n=Array.from(e)),ArrayBuffer.isView(e))return o(e);let i=JSON.stringify(n,(e,t)=>typeof t==`bigint`||typeof t==`function`?t.toString():t===void 0?`undefined`:typeof t==`symbol`||t instanceof RegExp?t.toString():t);t=r.byteLength(i,`utf8`)}catch{return Error(-1)}return t}function c(e){let t=[],o=[e],s=0;for(;o.length;){let c=o.pop();if(typeof c==`boolean`)s+=n.BYTES;else if(typeof c==`string`)a()?s+=i(c):s+=c.length*n.STRING;else if(typeof c==`number`)s+=n.NUMBER;else if(typeof c==`symbol`)Symbol.keyFor&&Symbol.keyFor(e)?s+=Symbol.keyFor(e).length*n.STRING:s+=(e.toString().length-8)*n.STRING;else if(typeof c==`bigint`)s+=r.from(c.toString()).byteLength;else if(typeof c==`function`)s+=c.toString().length;else if(typeof c==`object`&&t.indexOf(c)===-1){t.push(c);for(let e in c)o.push(c[e])}}return s}t.exports=function(e){let t=0;return t=typeof e==`object`&&e?s(e):c(e),t}})),Lm=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.inputs=e.debugRequest=e.fileDataFileNames=e.fileData=e.formData=e.retryAllErrors=e.useExponentialBackoff=e.retryDelayMS=e.maxRetries=e.queryParams=e.headers=e.responseType=e.method=e.timeout=e.data=e.url=void 0;let t=Om();e.url=(0,t.input)({label:`URL`,placeholder:`URL to call`,type:`string`,required:!0,comments:`This is the URL to call.`,example:`/sobjects/Account`,clean:e=>t.util.types.toString(e)}),e.data=(0,t.input)({label:`Data`,placeholder:`Data to send`,type:`string`,required:!1,comments:`The HTTP body payload to send to the URL.`,example:`{"exampleKey": "Example Data"}`}),e.timeout=(0,t.input)({label:`Timeout`,type:`string`,required:!1,comments:`The maximum time that a client will await a response to its request`,example:`2000`,clean:e=>t.util.types.toNumber(e)}),e.method=(0,t.input)({label:`Method`,type:`string`,required:!0,model:[`DELETE`,`GET`,`HEAD`,`LINK`,`OPTIONS`,`PATCH`,`POST`,`PURGE`,`PUT`,`UNLINK`].map(e=>({label:e,value:e})),comments:`The HTTP method to use.`,clean:e=>t.util.types.toString(e)}),e.responseType=(0,t.input)({label:`Response Type`,placeholder:`Response Type`,type:`string`,default:`json`,required:!0,comments:`The type of data you expect in the response. You can request json, text, or binary data.`,model:[`arraybuffer`,`document`,`json`,`text`].map(e=>({label:e,value:e})),clean:e=>t.util.types.toString(e)}),e.headers=(0,t.input)({label:`Header`,placeholder:`Header`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`A list of headers to send with the request.`,example:`User-Agent: curl/7.64.1`}),e.queryParams=(0,t.input)({label:`Query Parameter`,placeholder:`Query Parameter`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`A list of query parameters to send with the request. This is the portion at the end of the URL similar to ?key1=value1&key2=value2.`}),e.maxRetries=(0,t.input)({label:`Max Retry Count`,placeholder:`Max Retries`,type:`string`,required:!1,comments:`The maximum number of retries to attempt. Specify 0 for no retries.`,default:`0`,clean:e=>t.util.types.toNumber(e)}),e.retryDelayMS=(0,t.input)({label:`Retry Delay (ms)`,placeholder:`Retry Delay`,type:`string`,required:!1,comments:`The delay in milliseconds between retries. This is used when 'Use Exponential Backoff' is disabled.`,default:`0`,clean:e=>t.util.types.toNumber(e,0)}),e.useExponentialBackoff=(0,t.input)({label:`Use Exponential Backoff`,type:`boolean`,default:`false`,required:!1,comments:`Specifies whether to use a pre-defined exponential backoff strategy for retries. When enabled, 'Retry Delay (ms)' is ignored.`,clean:e=>t.util.types.toBool(e)}),e.retryAllErrors=(0,t.input)({label:`Retry On All Errors`,type:`boolean`,default:`false`,required:!1,comments:`If true, retries on all erroneous responses regardless of type. This is helpful when retrying after HTTP 429 or other 3xx or 4xx errors. Otherwise, only retries on HTTP 5xx and network errors.`,clean:e=>t.util.types.toBool(e)}),e.formData=(0,t.input)({label:`Form Data`,placeholder:`Data to send`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`The Form Data to be sent as a multipart form upload.`,example:`[{"key": "Example Key", "value": new Buffer("Hello World")}]`}),e.fileData=(0,t.input)({label:`File Data`,placeholder:`Data to send`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`File Data to be sent as a multipart form upload.`,example:`[{key: "example.txt", value: "My File Contents"}]`}),e.fileDataFileNames=(0,t.input)({label:`File Data File Names`,placeholder:`The file name to apply to a file`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`File names to apply to the file data inputs. Keys must match the file data keys above.`,clean:e=>e?t.util.types.keyValPairListToObject(e):void 0}),e.debugRequest=(0,t.input)({label:`Debug Request`,type:`boolean`,required:!1,comments:`Enabling this flag will log out the current request.`,clean:e=>t.util.types.toBool(e)}),e.inputs={url:e.url,method:e.method,data:e.data,formData:e.formData,fileData:e.fileData,fileDataFileNames:e.fileDataFileNames,queryParams:e.queryParams,headers:e.headers,responseType:e.responseType,timeout:e.timeout,debugRequest:e.debugRequest,retryDelayMS:e.retryDelayMS,retryAllErrors:e.retryAllErrors,maxRetries:e.maxRetries,useExponentialBackoff:e.useExponentialBackoff}})),Rm=a((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=e(r),o=0;o<a.length;o++)a[o]!=="default"&&t(i,r,a[o]);return n(i,r),i}})(),i=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},a=e&&e.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},o=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.inputs=e.buildRawRequestAction=e.sendRawRequest=e.handleErrors=e.createClient=e.toAxiosRetryConfig=void 0;let s=o(Nu()),c=r(Am()),l=o(bu()),u=o(jm()),d=o(Im()),f=Om(),p=o(dl()),m=Lm();Object.defineProperty(e,"inputs",{enumerable:!0,get:function(){return m.inputs}});let h=/^(cookie|set-cookie)$|auth|token|secret|password|api[-_]?key/i,g=e=>typeof e==`object`&&!!e&&typeof e.toJSON==`function`,_=e=>{let t=g(e)?e.toJSON():Object.assign({},e);return Object.fromEntries(Object.entries(t).map(([e,t])=>[e,h.test(e)?`[REDACTED]`:t]))},v=e=>{let t=p.default.types.toString(e.token?.access_token);if(t)return{Authorization:`Bearer ${t}`};let n=p.default.types.toString(e.fields?.apiKey);if(n)return{Authorization:`Bearer ${n}`};let r=p.default.types.toString(e.fields?.username),i=p.default.types.toString(e.fields?.password);if(r&&i)return{Authorization:`Basic ${Buffer.from(`${r}:${i}`).toString(`base64`)}`};throw Error(`Failed to guess at authorization parameters for Connection: ${e.key}`)},y=(e,t,n={})=>{let r=new l.default;return(e||[]).map(({key:e,value:t})=>r.append(e,t)),(t||[]).map(({key:e,value:t})=>r.append(e,p.default.types.toBufferDataPayload(t).data,{filename:n?.[e]||e})),r},b=(e,t)=>t?typeof e==`number`?t=>2**(t-1)*e:c.exponentialDelay:typeof e==`number`?()=>e:e;e.toAxiosRetryConfig=e=>{var{retryDelay:t,retryAllErrors:n,retryCondition:r,useExponentialBackoff:i}=e,o=a(e,[`retryDelay`,`retryAllErrors`,`retryCondition`,`useExponentialBackoff`]);return Object.assign(Object.assign({},o),{retryDelay:b(t,i),retryCondition:n?()=>!0:typeof r==`function`?r:c.isNetworkOrIdempotentRequestError})},e.createClient=({baseUrl:t,responseType:n,headers:r,timeout:i,params:a,debug:o=!1,retryConfig:l})=>{let u=s.default.create({baseURL:t,responseType:n,headers:r,timeout:i,params:a,maxContentLength:1/0,maxBodyLength:1/0});return o&&(u.interceptors.request.use(e=>{let{baseURL:t,headers:n,method:r,timeout:i,url:a,data:o,params:s}=e,c=(0,d.default)(o);return console.log(p.default.types.toJSON({type:`request`,baseURL:t,params:s,url:a,headers:_(n),method:r,timeout:i,data:c>1024*10||Buffer.isBuffer(o)?`<data (${c} bytes)>`:o},!0,!0)),e}),u.interceptors.response.use(e=>{let{headers:t,status:n,statusText:r,data:i}=e,a=(0,d.default)(i);return console.log(p.default.types.toJSON({type:`response`,headers:_(t),status:n,statusText:r,data:a>1024*10||Buffer.isBuffer(i)?`<data (${a} bytes)>`:i},!0,!0)),e})),l&&(0,c.default)(u,(0,e.toAxiosRetryConfig)(l)),u},e.handleErrors=e=>{if(s.default.isAxiosError(e)){let{message:t,response:n}=e;return{message:t,data:n?.data,status:n?.status,headers:n?.headers}}return e},e.sendRawRequest=(t,n,...r)=>i(void 0,[t,n,...r],void 0,function*(t,n,r={}){if(n.data&&(!(0,u.default)(n.formData)||!(0,u.default)(n.fileData)))throw Error(`Cannot specify both Data and File/Form Data.`);let i=!(0,u.default)(n.formData)||!(0,u.default)(n.fileData)?y(n.formData,n.fileData,n.fileDataFileNames):n.data;return yield(0,e.createClient)({baseUrl:t,debug:n.debugRequest,responseType:n.responseType,timeout:n.timeout,retryConfig:{retries:n.maxRetries,retryDelay:n.retryDelayMS,retryAllErrors:n.retryAllErrors,useExponentialBackoff:n.useExponentialBackoff}}).request({method:n.method,url:n.url,headers:Object.assign(Object.assign(Object.assign({},p.default.types.keyValPairListToObject(n.headers)),i instanceof l.default?i.getHeaders():{}),r),params:p.default.types.keyValPairListToObject(n.queryParams),data:i||void 0})}),e.buildRawRequestAction=(t,n=`Raw Request`,r=`Issue a raw HTTP request`)=>(0,f.action)({display:{label:n,description:r},inputs:Object.assign({connection:{label:`Connection`,type:`connection`,required:!0}},m.inputs),perform:(n,r)=>i(void 0,void 0,void 0,function*(){var{connection:n}=r,i=a(r,[`connection`]);let{data:o}=yield(0,e.sendRawRequest)(t,i,v(n));return{data:o}})})}))(),$=Om(),zm=[(0,$.connection)({key:`karbonApiKey`,display:{label:`API Key`,description:`API Key connection for Karbon`},inputs:{applicationId:{type:`string`,label:`Application ID`,comments:`The application ID for the Karbon API. You receive this when you create an application in Karbon.`,example:`00000000-0000-0000-0000-000000000000`,required:!0},accessKey:{type:`password`,label:`Access Key`,comments:`Get this by clicking Settings > Connected Apps > Manage on your app.`,example:`eyJ.....`,required:!0}}})];const Bm=`https://api.karbonhq.com`,Vm=`Success`,Hm={Contacts:{endpoint:`/v3/Contacts`,timestampField:`LastModifiedDateTime`},Invoices:{endpoint:`/v3/Invoices`,timestampField:`UpdatedAt`}},Um=/^(\d{4})-(\d{2})-(\d{2})$/,Wm=(e,t)=>{Km(e);let{applicationId:n,accessKey:r}=Xm(e);return(0,Rm.createClient)({baseUrl:Bm,headers:{AccessKey:r,Authorization:`Bearer ${n}`},debug:t})},Gm=e=>Object.entries(e).reduce((e,[t,n])=>t.startsWith(`@odata.`)?{...e,odata:{[t.replace(`@odata.`,``)]:n,...e.odata}}:{[t]:n,...e},{}),Km=e=>{if(!zm.map(e=>e.key).includes(e.key))throw new $.ConnectionError(e,`Unsupported connection ${e.key}.`)},qm=e=>e?$.util.types.toString(e):void 0,Jm=e=>e?$.util.types.toObject(e):void 0,Ym=e=>e?$.util.types.toNumber(e):void 0,Xm=e=>({applicationId:$.util.types.toString(e.fields.applicationId),accessKey:$.util.types.toString(e.fields.accessKey)}),Zm=async({client:e,endpoint:t,getAllData:n,pagination:{$top:r,$skip:i},$filter:a,$orderby:o})=>{n?(i=0,r=100):(i||=0,r||=100);let{data:s}=await e.get(t,{params:{$top:r,$skip:i,$filter:a,$orderby:o}}),c=Gm(s);if(c.value=c.value||[],!n)return c;let l=$.util.types.toNumber(c.odata?.count);if(l===0||l<=100)return c;let u=Math.ceil(l/100),d=Array.from({length:u-1},(e,t)=>(t+1)*100).map(n=>e.get(t,{params:{$top:100,$skip:n,$filter:a,$orderby:o}})),f=await Promise.all(d);return c.value=[...c.value||[],...f.flatMap(e=>e.data.value)],c},Qm=async(e,t,n,r)=>{let i=await Wm(e,t).post(`/v3/WebhookSubscriptions`,{TargetUrl:n,WebhookType:r});return{data:Gm(i.data)}},$m=async(e,t,n)=>{let{data:r}=await Wm(e,t).delete(`/v3/WebhookSubscriptions/${n}`);return{data:r}},eh=Object.keys(Hm).map(e=>({label:e,value:e})),th=(e,t,n)=>{let r=new Date(n).getTime();return e.filter(e=>{let n=e[t],i=typeof n==`string`?new Date(n).getTime():NaN;return!Number.isNaN(i)&&i>r})},nh=(0,$.input)({label:`Connection`,type:`connection`,required:!0}),rh=(0,$.input)({label:`Additional Fields`,type:`code`,language:`json`,comments:`Additional fields that are not covered by the standard inputs.`,required:!1,example:JSON.stringify({},null,2),clean:Jm}),ih=(0,$.input)({label:`Top`,type:`string`,comments:`The number of records to return at once.`,required:!1,example:`50`,placeholder:`50`,clean:Ym}),ah=(0,$.input)({label:`Filter`,type:`string`,comments:`A filter expression to apply to the results.`,example:`FullName eq 'Sample Management Team'`,placeholder:`FullName eq 'Sample Management Team'`,required:!1,clean:qm}),oh=(0,$.input)({label:`Order By`,type:`string`,comments:`The property to order the results by.`,example:`FullName`,placeholder:``,required:!1,clean:qm}),sh=(0,$.input)({label:`Skip`,type:`string`,comments:`The number of records to skip when looping over pages of results. If you fetch 100 results, you should skip 0 the first iteration, then 100, 200, 300, etc. until no more records are available.`,example:`100`,placeholder:`100`,required:!1,clean:Ym}),ch=(0,$.input)({label:`Get All Data`,type:`boolean`,comments:`Turn this on to retrieve all pages of data. $top and $skip will be ignored.`,required:!1,default:`false`,clean:$.util.types.toBool}),lh=(0,$.input)({label:`Webhook Type`,type:`string`,model:[`Contact`,`Work`,`Note`,`User`,`Invoice`].map(e=>({value:e,label:e})),comments:`The type of the Webhook.`,required:!0,example:`Contact`,clean:qm}),uh=(0,$.input)({label:`Contactkey`,comments:`The Contact key.`,type:`string`,required:!0,clean:qm,example:`4jgPTtcXxwC2`,placeholder:`4jgPTtcXxwC2`,dataSource:`selectContact`}),dh=(0,$.input)({label:`Contact's First Name`,comments:`The first name of the Contact.`,type:`string`,required:!0,clean:qm,example:`John`,placeholder:`John`}),fh=(0,$.input)({label:`Contact's Last Name`,comments:`The last name of the Contact.`,type:`string`,required:!0,clean:qm,example:`Doe`,placeholder:`Doe`});var ph={connection:nh,firstName:dh,lastName:fh,additionalFields:(0,$.input)({...rh,example:JSON.stringify({Salutation:`Mr`,Suffix:`Jr.`,RestrictionLevel:`Public`,UserDefinedIdentifier:`BILLJR-001`,BusinessCards:[{IsPrimaryCard:!0,OrganizationKey:`7NN1ySxv89B`,WebSites:[`www.website.one`,`www.website.two`],EmailAddresses:[`sample@example.com`,`sample.two@example.com`],RoleOrTitle:`COO`,FacebookLink:`facebook.com/sampleName`,LinkedInLink:`linkedin.com/sampleName`,TwitterLink:`twitter.com/sampleName`,SkypeLink:`skype.com/sampleName`,Addresses:[{AddressLines:`45 Sample Street`,City:`Alexandria`,StateProvinceCounty:`NSW`,ZipCode:2015,CountryCode:`AU`,Label:`Physical`}],PhoneNumbers:[{Number:1234567890,CountryCode:61,Label:`Work`}]}]},null,2),comments:`${rh.comments} See [Karbon API documentation](https://karbonhq.github.io/karbon-api-reference/#post-/v3/Contacts) for more information.`})};const mh={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#Contacts/KarbonService.ContactDTO/$entity`,type:`#KarbonService.ContactDTO`},ContactKey:`67zlxNyJSr8e`,FirstName:`William`,MiddleName:`John`,LastName:`Connor`,PreferredName:`Bill`,Salutation:`Mr`,Suffix:`Jr.`,ClientOwner:`rodney.muller@samplecompany.com`,ClientManager:`jessica.tse@samplecompany.com`,ContactType:`Client`,UserDefinedIdentifier:`BILLJR`,RestrictionLevel:`Public`,AvatarUrl:`https://az.karbonemail.com/images/e4ae96c1-8d17-4c6e-af8a-8040482176fc`,LastModifiedDateTime:`2022-07-05T07:30:13.7188114Z`,EntityDescription:{Text:`Birthday on June 23.`},AccountingDetail:{ContactPermaKey:`4XHEn8T3J4Y6`,OrganizationPermaKey:null,BirthDate:`1969-08-05T00:00:00Z`,DeathDate:null,Salutation:`Mr`,Sex:`M`,FinancialYearEndDay:8,FinancialYearEndMonth:30,IncorporationDate:null,IncorporationState:null,LegalName:null,LineOfBusiness:null,EntityType:null,TaxCountryCode:`US`,TradingName:null,AnnualRevenue:null,BaseCurrency:null,GstBasis:null,GstPeriod:null,IncomeTaxInstallmentPeriod:`Yearly`,IsVATRegistered:null,OrganizationValuation:null,PaysTax:null,PrepareGST:null,ProvisionaTaxBasic:null,ProvisionalTaxRatio:null,RevenueModel:null,SalesTaxBasis:null,SalesTaxPeriod:null,Sells:null,RegistrationNumbers:{RegistrationNumber:`12-3456789`,Type:`Social Security Number (SSN)`},Notes:{Body:`This is a sample note text.`,Type:`Basic`}},BusinessCards:{BusinessCardKey:`2tBHyXtJBxBy`,IsPrimaryCard:!0,WebSites:[`www.website.one`,`www.website.two`],EmailAddresses:[`sample@example.com`,`sample.two@example.com`],OrganizationKey:`ZGNmtYyLm4z`,RoleOrTitle:`COO`,FacebookLink:`facebook.com/sampleName`,LinkedInLink:`linkedin.com/sampleName`,TwitterLink:`twitter.com/sampleName`,SkypeLink:`skype.com/sampleName`,Addresses:{AddressKey:`e150a05a-2dea-4292-8bc8-03398c9384e4`,AddressLines:`45 Sample Street`,City:`Alexandria`,StateProvinceCounty:`NSW`,ZipCode:`2015`,CountryCode:`AU`,Label:`Physical`},PhoneNumbers:{PhoneNumberKey:`6e0b9ace-24b1-4328-a922-3b8be5ef5052`,Number:1234567890,CountryCode:61,Label:`Work`}}}},hh={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#Contacts/KarbonService.ContactSummaryDTO`,count:323},value:[{"@odata.type":`#KarbonService.ContactSummaryDTO`,ContactKey:`29YXnqWcqCf3`,FullName:`William John Connor`,PreferredName:`Bill`,Salutation:`Mr`,ClientOwner:`rodney.muller@samplecompany.com`,ClientManager:`jessica.tse@samplecompany.com`,Address:`42 Galaxy Way, London`,EmailAddress:`william.connor@samplecompany.com`,PhoneNumber:`0987888686`,RoleOrTitle:`COO`,UserDefinedIdentifier:`73YEnqFcqCf3`,LastModifiedDateTime:`2021-12-29T07:01:53Z`}]}};hh.data.value;const gh={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#Invoices/$entity`},InvoiceKey:`M2dVbCt4RHk`,InvoiceNumber:`KIN-1001`,TotalAmountDue:1607.13,InvoiceTotal:1607.13,InvoiceSubTotal:1397.5,InvoiceTaxTotal:209.63,InvoiceDate:`2023-07-21T00:00:00Z`,PaymentDueDate:`2023-07-28T00:00:00Z`,UpdatedAt:`2023-07-20T23:52:11Z`,CurrencyCode:`AUD`,PaymentInstructions:`Payment due 7 days from invoice date`,InvoiceStatus:`AwaitingPayment`,Client:{ClientKey:`2xxnBLyCP4Ts`,ClientType:`Organization`,Name:`Acme Corp`,AddressLine:`15 Example Street`,City:`Sydney`,StateProvinceCounty:`NSW`,ZipCode:`4004`,Country:`Australia`,EmailAddress:`acme@example.com`},TaxLineItems:[{TaxName:`GST`,TaxValue:209.63}]}},_h={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#Invoices(LineItems())`,count:1},value:[{InvoiceKey:`2F8bb4Xk4N1T`,InvoiceNumber:`KIN-1000`,TotalAmountDue:5,InvoiceTotal:5,InvoiceSubTotal:5,InvoiceTaxTotal:0,InvoiceDate:`2024-05-23T00:00:00Z`,PaymentDueDate:`2024-05-30T00:00:00Z`,UpdatedAt:`2024-05-23T16:44:29Z`,CurrencyCode:`USD`,PaymentInstructions:null,InvoiceStatus:`Approved`,Client:{ClientKey:`4hFn8Czrnw4v`,ClientType:`Organization`,Name:`Example Sandbox`,AddressLine:null,City:null,StateProvinceCounty:null,ZipCode:null,Country:null,EmailAddress:null},TaxLineItems:[],LineItems:[{LineItemKey:`3aebacb913b44aaa81b1cb2acf958b1b`,BillableItemEntityKey:`2SFw2p31285T`,BillableItemType:`Expense`,Description:`My Services`,Quantity:1,UnitPrice:5,Amount:5,TaxRate:0,TaxRateName:`No Tax Set`}]}]}},vh={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#Users/$entity`},Id:`4LR9qmR5NQ6T`,Name:`Joe Min`,EmailAddress:`joe@samplecompany.com`}},yh={data:{value:[{"@odata.type":`#KarbonService.WorkItemSummaryDTO`,WorkItemKey:`2LPSrkzbYrn4`,AssigneeEmailAddress:`joe@samplecompany.com`,AssigneeKey:`4gHCvnbFFqsq`,AssigneeName:`Joe Min`,Title:`Payroll 31 Aug - 15 Sep 2022`,ClientKey:`4ncPZ7q96SGc`,ClientName:`Acme Corporation`,ClientType:`Organization`,ClientUserDefinedIdentifier:`ACMECORP`,RelatedClientGroupKey:`3LCPr987gNrc`,ClientGroupKey:`3LCPr987gNrc`,RelatedClientGroupName:`Smith Family Group`,StartDate:`2021-12-29T00:00:00Z`,DueDate:`2022-01-30T00:00:00Z`,DeadlineDate:`2022-01-31T00:00:00Z`,CompletedDate:`2022-02-01T00:00:00Z`,ToDoPeriod:`2021-12-29T00:00:00Z`,WorkType:`Payroll`,WorkStatus:`Ready To Start - Send client requests`,PrimaryStatus:`Ready To Start`,SecondaryStatus:`Send client requests`,WorkTemplateKey:`p56mtcBhwb9`,WorkTemplateTile:`Payroll processing`,WorkScheduleKey:`4f3gHnLC323`}],odata:{count:323,context:`https://api.karbonhq.com/v3/$metadata#WorkItems/KarbonService.WorkItemSummaryDTO`,nextLink:`https://api.karbonhq.com/v3/WorkItems?$skip=100`}}},bh={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#Contacts/KarbonService.ContactDTO/$entity`,type:`#KarbonService.ContactDTO`},ContactKey:`67zlxNyJSr8e`,FirstName:`William`,MiddleName:`John`,LastName:`Connor`,PreferredName:`Bill`,Salutation:`Mr`,Suffix:`Jr.`,ClientOwner:`rodney.muller@samplecompany.com`,ClientManager:`jessica.tse@samplecompany.com`,ContactType:`Client`,UserDefinedIdentifier:`BILLJR`,RestrictionLevel:`Public`,AvatarUrl:`https://az.karbonemail.com/images/e4ae96c1-8d17-4c6e-af8a-8040482176fc`,LastModifiedDateTime:`2022-07-05T07:30:13.7188114Z`,EntityDescription:{Text:`Birthday on June 23.`},AccountingDetail:{ContactPermaKey:`4XHEn8T3J4Y6`,OrganizationPermaKey:null,BirthDate:`1969-08-05T00:00:00Z`,DeathDate:null,Salutation:`Mr`,Sex:`M`,FinancialYearEndDay:8,FinancialYearEndMonth:30,IncorporationDate:null,IncorporationState:null,LegalName:null,LineOfBusiness:null,EntityType:null,TaxCountryCode:`US`,TradingName:null,AnnualRevenue:null,BaseCurrency:null,GstBasis:null,GstPeriod:null,IncomeTaxInstallmentPeriod:`Quaterly`,IsVATRegistered:null,OrganizationValuation:null,PaysTax:null,PrepareGST:null,ProvisionaTaxBasic:null,ProvisionalTaxRatio:null,RevenueModel:null,SalesTaxBasis:null,SalesTaxPeriod:null,Sells:null,RegistrationNumbers:{RegistrationNumber:`12-3456789`,Type:`Social Security Number (SSN)`},Notes:{Body:`This is a sample note text.`,Type:`Basic`}},BusinessCards:{BusinessCardKey:`2tBHyXtJBxBy`,EntityType:`Contact`,EntityKey:`67zlxNyJSr8e`,IsPrimaryCard:!0,WebSites:[`www.website.one`,`www.website.two`],EmailAddresses:[`sample@example.com`,`sample.two@example.com`],OrganizationKey:`ZGNmtYyLm4z`,RoleOrTitle:`COO`,FacebookLink:`facebook.com/sampleName`,LinkedInLink:`linkedin.com/sampleName`,TwitterLink:`twitter.com/sampleName`,SkypeLink:`skype.com/sampleName`,Addresses:{AddressKey:`e150a05a-2dea-4292-8bc8-03398c9384e4`,AddressLines:`45 Sample Street`,City:`Alexandria`,StateProvinceCounty:`NSW`,ZipCode:`2015`,CountryCode:`AU`,Label:`Physical`},PhoneNumbers:{PhoneNumberKey:`6e0b9ace-24b1-4328-a922-3b8be5ef5052`,Number:1234567890,CountryCode:61,Label:`Work`}}}},xh={data:Vm},Sh={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#Users`,count:1,nextLink:`https://api.karbonhq.com/v3/Users?$skip=100`},value:[{Id:`4LR9qmR5NQ6T`,Name:`Joe Min`,EmailAddress:`joe@samplecompany.com`}]}},Ch={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#Users/KarbonService.UserProfileDTO/$entity`,type:`#KarbonService.UserProfileDTO`},Id:`2bYxtn94ZSdY`,Name:`Janet Smith`,EmailAddress:`janet@example.com`,BillableRate:0,CapacityMinutesPerWeek:2400,Permissions:[`User`],Roles:[`Accountant`,`Bookkeeper`],Teams:[`Accountants`,`Bookkeepers`]}},wh={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#WorkItems/KarbonService.WorkItemDTO/$entity`,type:`#KarbonService.WorkItemDTO`},WorkItemKey:`2LPSrkzbYrn4`,AssigneeEmailAddress:`joe@samplecompany.com`,AssigneeKey:`4gHCvnbFFqsq`,AssigneeName:`Joe Min`,Title:`Payroll 31 Aug - 15 Sep 2022`,ClientKey:`4ncPZ7q96SGc`,ClientName:`Acme Corporation`,ClientType:`Organization`,ClientUserDefinedIdentifier:`ACMECORP`,RelatedClientGroupKey:`3LCPr987gNrc`,ClientGroupKey:`3LCPr987gNrc`,RelatedClientGroupName:`Smith Family Group`,StartDate:`2021-12-29T00:00:00Z`,DueDate:`2022-01-30T00:00:00Z`,DeadlineDate:`2022-01-31T00:00:00Z`,CompletedDate:`2022-02-01T00:00:00Z`,ToDoPeriod:`2021-12-29T00:00:00Z`,WorkType:`Payroll`,WorkStatus:`Ready To Start - Send client requests`,PrimaryStatus:`Ready To Start`,SecondaryStatus:`Send client requests`,WorkTemplateKey:`p56mtcBhwb9`,WorkTemplateTile:`Payroll processing`,WorkScheduleKey:`4f3gHnLC323`,FeeSettings:{FeeType:`FixedFee`,FeeValue:5150.2},Description:`Send to Jo for review`,ClientTaskRecipient:null}},Th={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#WorkItems/KarbonService.WorkItemDTO/$entity`,type:`#KarbonService.WorkItemDTO`},WorkItemKey:`2LPSrkzbYrn4`,AssigneeEmailAddress:`joe@samplecompany.com`,AssigneeKey:`4gHCvnbFFqsq`,AssigneeName:`Joe Min`,Title:`Payroll 31 Aug - 15 Sep 2022`,ClientKey:`4ncPZ7q96SGc`,ClientName:`Acme Corporation`,ClientType:`Organization`,ClientUserDefinedIdentifier:`ACMECORP`,RelatedClientGroupKey:`3LCPr987gNrc`,ClientGroupKey:`3LCPr987gNrc`,RelatedClientGroupName:`Smith Family Group`,StartDate:`2021-12-29T00:00:00Z`,DueDate:`2022-01-30T00:00:00Z`,DeadlineDate:`2022-01-31T00:00:00Z`,CompletedDate:`2022-02-01T00:00:00Z`,ToDoPeriod:`2021-12-29T00:00:00Z`,WorkType:`Payroll`,WorkStatus:`Ready To Start - Send client requests`,PrimaryStatus:`Ready To Start`,SecondaryStatus:`Send client requests`,WorkTemplateKey:`p56mtcBhwb9`,WorkTemplateTile:`Payroll processing`,WorkScheduleKey:`4f3gHnLC323`,FeeSettings:{FeeType:`FixedFee`,FeeValue:5150.2},Description:`Send to Jo for review`,ClientTaskRecipient:null}},Eh={data:Vm},Dh={data:Vm},Oh={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#WebhookSubscriptions/$entity`},TargetUrl:`https://evelyn.info/hooks/catch/3550924/ovsbqn4/`,WebhookType:`Contact`}},kh=(0,$.action)({display:{label:`Create a Contact`,description:`Create a new contact`},inputs:{...ph},perform:async(e,{connection:t,firstName:n,lastName:r,additionalFields:i})=>({data:Gm((await Wm(t,e.debug.enabled).post(`/v3/Contacts`,{FirstName:n,LastName:r,...i||{}})).data)}),examplePayload:mh});var Ah={connection:nh,$filter:(0,$.input)({...ah,comments:`${ah.comments} See [Karbon API documentation](https://karbonhq.github.io/karbon-api-reference/#get-/v3/Contacts) for more information.`}),$top:ih,$skip:sh,$orderby:(0,$.input)({...oh,model:[{value:`FullName`,label:`Full Name`},{value:`FullName desc`,label:`Full Name Descending`},{value:`LastModifiedDateTime`,label:`Last Modified Date Time`},{value:`LastModifiedDateTime desc`,label:`Last Modified Date Time Descending`}]}),getAllData:ch};const jh=(0,$.action)({display:{label:`List Contacts`,description:`List all Contacts`},inputs:{...Ah},perform:async(e,{connection:t,$filter:n,$top:r,$skip:i,$orderby:a,getAllData:o})=>{let s=Wm(t,e.debug.enabled);return{data:await Zm({pagination:{$top:r,$skip:i},client:s,endpoint:`/v3/Contacts`,getAllData:o,$orderby:a,$filter:n})}},examplePayload:hh}),Mh=(0,$.input)({label:`Expand Business Cards`,comments:`Whether to return the Business Card associated with the Contact.`,type:`boolean`,required:!1,default:`false`,clean:$.util.types.toBool});var Nh={connection:nh,contactkey:(0,$.input)({...uh,comments:`${uh.comments} to get the Contact for.`}),expandBusinessCards:Mh};const Ph=(0,$.action)({display:{label:`Get Contact`,description:`Get a single Contact by Contact key`},inputs:{...Nh},perform:async(e,{connection:t,contactkey:n,expandBusinessCards:r})=>({data:Gm((await Wm(t,e.debug.enabled).get(`/v3/Contacts/${n}`,{params:{$expand:r?`BusinessCards`:void 0}})).data)}),examplePayload:bh}),Fh=(0,$.input)({label:`Contact's Middle Name`,comments:`The middle name of the Contact.`,type:`string`,required:!1,clean:qm,example:`John`,placeholder:`John`}),Ih=(0,$.input)({label:`Contact's Preferred Name`,comments:`The preferred name of the Contact.`,type:`string`,required:!1,clean:qm,example:`John`,placeholder:`John`}),Lh=(0,$.input)({label:`Contact's Salutation`,comments:`The title to address the Contact.`,type:`string`,required:!1,clean:qm,example:`Mr`,placeholder:`Mr`}),Rh=(0,$.input)({label:`Contact's Suffix`,comments:`The suffix of the Contact.`,type:`string`,required:!1,clean:qm,example:`Jr.`,placeholder:`Jr.`});var zh={connection:nh,contactkey:(0,$.input)({...uh,comments:`${uh.comments} to update the Contact for.`}),firstName:(0,$.input)({...dh,required:!1}),lastName:(0,$.input)({...fh,required:!1}),middleName:Fh,preferredName:Ih,salutation:Lh,suffix:Rh},Bh={listContacts:jh,createContact:kh,getContact:Ph,updateContact:(0,$.action)({display:{label:`Update a Contact`,description:`Partially update a contact by Contact key`},inputs:{...zh},perform:async(e,{connection:t,contactkey:n,firstName:r,lastName:i,middleName:a,preferredName:o,salutation:s,suffix:c})=>(await Wm(t,e.debug.enabled).patch(`/v3/Contacts/${n}`,{FirstName:r,MiddleName:a,LastName:i,PreferredName:o,Salutation:s,Suffix:c}),{data:Vm}),examplePayload:xh})};const Vh=(0,$.input)({label:`Include Line Items`,type:`boolean`,required:!1,default:`false`,comments:`Include additional lineitems invoice properties.`,clean:$.util.types.toBool});var Hh={connection:nh,invoiceKey:(0,$.input)({label:`Invoice Key`,type:`string`,required:!0,example:`M2dVbCt4RHk`,placeholder:`M2dVbCt4RHk`,comments:`The Invoice key to get the Invoice for.`,clean:qm,dataSource:`selectInvoice`}),includeLineItems:Vh};const Uh=(0,$.action)({display:{label:`Get Invoice`,description:`Get an invoice by key`},inputs:{...Hh},perform:async(e,{connection:t,invoiceKey:n,includeLineItems:r})=>({data:Gm((await Wm(t,e.debug.enabled).get(`/v3/Invoices/${n}`,{params:{$expand:r?`LineItems`:void 0}})).data)}),examplePayload:gh});var Wh={connection:nh,includeLineItems:Vh,$orderby:(0,$.input)({...oh,model:[{value:`InvoiceDate`,label:`Invoice Date`},{value:`InvoiceDate asc`,label:`Invoice Date asc`},{value:`InvoiceDate desc`,label:`Invoice Date desc`}]})},Gh={getInvoice:Uh,listInvoices:(0,$.action)({display:{label:`List Invoices`,description:`List invoices`},inputs:{...Wh},perform:async(e,{connection:t,includeLineItems:n,$orderby:r})=>({data:Gm((await Wm(t,e.debug.enabled).get(`/v3/Invoices`,{params:{$expand:n?`LineItems`:void 0,$orderby:r}})).data)}),examplePayload:_h})},Kh={connection:nh,userName:(0,$.input)({label:`User's Name`,type:`string`,comments:`The name of the User.`,required:!0,clean:qm,example:`John Doe`,placeholder:`John Doe`}),userEmail:(0,$.input)({label:`User's Email`,type:`string`,comments:`The email of the User.`,required:!0,clean:qm,example:`example@email.com`,placeholder:`example@email.com`})};const qh=(0,$.action)({display:{label:`Create User`,description:`Create a new user`},inputs:{...Kh},perform:async(e,{connection:t,userName:n,userEmail:r})=>({data:Gm((await Wm(t,e.debug.enabled).post(`/v3/Users`,{Name:n,EmailAddress:r})).data)}),examplePayload:vh});var Jh={connection:nh,userId:(0,$.input)({label:`User ID`,type:`string`,comments:`The unique ID of the User to get.`,required:!0,clean:qm,example:`2bYxtn94ZSdY`,placeholder:`2bYxtn94ZSdY`,dataSource:`selectUser`})};const Yh=(0,$.action)({display:{label:`Get User`,description:`Gets the details of a single User`},inputs:{...Jh},perform:async(e,{connection:t,userId:n})=>({data:Gm((await Wm(t,e.debug.enabled).get(`/v3/Users/${n}`)).data)}),examplePayload:Ch});var Xh={connection:nh,$filter:(0,$.input)({...ah,comments:`${ah.comments} See [Karbon API documentation](https://karbonhq.github.io/karbon-api-reference/#get-/v3/Users) for more information.`}),$top:ih,$skip:sh,getAllData:ch},Zh={createUser:qh,listUsers:(0,$.action)({display:{label:`List Users`,description:`Get a list of Users`},inputs:{...Xh},perform:async(e,{connection:t,$filter:n,$top:r,$skip:i,getAllData:a})=>{let o=Wm(t,e.debug.enabled);return{data:await Zm({pagination:{$top:r,$skip:i},client:o,endpoint:`/v3/Users`,getAllData:a,$filter:n})}},examplePayload:Sh}),getUser:Yh},Qh={connection:nh,assigneeEmailAddres:(0,$.input)({label:`Assignee Email Address`,type:`string`,comments:`The email address of the user to whom the Work Item is going to be assigned.`,required:!0,clean:qm,example:`example@email.com`,placeholder:`example@email.com`}),title:(0,$.input)({label:`Title`,type:`string`,comments:`The title of the Work Item.`,required:!0,clean:qm,example:`Work Item Title`,placeholder:`Work Item Title`}),clientKey:(0,$.input)({label:`Client Key`,type:`string`,comments:`A Karbon-generated value used to identify the existing Client (Contact, Organization or ClientGroup) for whom the Work Item is prepared.`,required:!0,clean:qm,example:`p56mtcBhwb9`,placeholder:`p56mtcBhwb9`}),clientType:(0,$.input)({label:`Client Type`,type:`string`,model:[`Contact`,`Organization`,`ClientGroup`].map(e=>({value:e,label:e})),comments:`The type of the Client.`,required:!0,example:`Organization`,clean:qm}),relatedClientGroupKey:(0,$.input)({label:`Related Client Group Key`,type:`string`,comments:`A Karbon-generated value used to identify the Client Group of the Client.`,clean:qm,example:`4f3gHnLC323`,required:!1,placeholder:`4f3gHnLC323`}),startDate:(0,$.input)({label:`Start Date`,type:`string`,comments:`The date and time at which the Work Item should start.`,required:!0,example:`2022-01-30`,placeholder:`2022-01-30`,clean:qm}),additionalFields:(0,$.input)({...rh,example:JSON.stringify({DueDate:`2022-01-30`,DeadlineDate:`2022-01-31`,WorkType:`Payroll`,WorkStatus:`Ready To Start - Send client requests`,WorkTemplateKey:`p56mtcBhwb9`,WorkScheduleKey:`4f3gHnLC323`,Description:`Send to Jo for review`,UserRoleAssignments:[{RoleKey:`2mYzTtly89Lq`,UserProfileKey:`2Qy48WVCRBcP`}],ClientTaskRecipient:{RecipientKey:`4ncPZ7q96SGc`,LinkType:`Organization`,EmailAddress:`acme@corp.com`},FeeSettings:{FeeType:`FixedFee`,FeeValue:5150.2}},null,2),comments:`${rh.comments} See [Karbon API documentation](https://karbonhq.github.io/karbon-api-reference/#post-/v3/WorkItems) for more information.`})};const $h=(0,$.action)({display:{label:`Create a Work Item`,description:`Create a new Work Item`},inputs:{...Qh},perform:async(e,{connection:t,assigneeEmailAddres:n,title:r,clientKey:i,clientType:a,relatedClientGroupKey:o,startDate:s,additionalFields:c})=>({data:Gm((await Wm(t,e.debug.enabled).post(`/v3/WorkItems`,{AssigneeEmailAddress:n,Title:r,ClientKey:i,ClientType:a,RelatedClientGroupKey:o,StartDate:s,...c||{}})).data)}),examplePayload:wh}),eg=(0,$.input)({label:`Work Item Key`,type:`string`,comments:`The Work Item key`,required:!0,clean:qm,example:`2LPSrkzbYrn4`,placeholder:`2LPSrkzbYrn4`,dataSource:`selectWorkItem`});var tg={connection:nh,workItemkey:(0,$.input)({...eg,comments:`${eg.comments} to get the Work Item for.`})};const ng=(0,$.action)({display:{label:`Get Work Item`,description:`Gets a Work Item by Work Item key`},inputs:{...tg},perform:async(e,{connection:t,workItemkey:n})=>({data:Gm((await Wm(t,e.debug.enabled).get(`/v3/WorkItems/${n}`)).data)}),examplePayload:Th});var rg={connection:nh,$filter:(0,$.input)({...ah,comments:`${ah.comments} See [Karbon API documentation](https://karbonhq.github.io/karbon-api-reference/#get-/v3/WorkItems) for more information.`}),$top:ih,$skip:sh,$orderby:(0,$.input)({...oh,model:[{value:`StartDate`,label:`Start Date`},{value:`StartDate desc`,label:`Start Date Descending`},{value:`DeadlineDate`,label:`Deadline Date`},{value:`DeadlineDate desc`,label:`Deadline Date Descending`}]}),getAllData:ch};const ig=(0,$.action)({display:{label:`List Work Items`,description:`Receive a list of work items from your tenant`},inputs:{...rg},perform:async(e,{connection:t,$filter:n,$top:r,$skip:i,$orderby:a,getAllData:o})=>{let s=Wm(t,e.debug.enabled);return{data:await Zm({pagination:{$top:r,$skip:i},client:s,endpoint:`/v3/WorkItems`,getAllData:o,$filter:n,$orderby:a})}},examplePayload:yh}),ag=(0,$.input)({label:`Description`,type:`string`,comments:`A free form text field to add more information about the Work Item`,required:!1,example:`This is a description.`,placeholder:`This is a description.`,clean:qm}),og=(0,$.input)({label:`Deadline Date`,type:`string`,comments:`The deadline of the workitem as ISO8601 formated datestamp or timestamp`,required:!1,example:`2022-01-30`,placeholder:`2022-01-30`,clean:qm});var sg={connection:nh,workItemkey:(0,$.input)({...eg,comments:`${eg.comments} to update a Work Item by.`}),description:ag,deadlineDate:og},cg={listWorkItems:ig,createWorkItem:$h,getWorkItem:ng,updateWorkItem:(0,$.action)({display:{label:`Update Work Item`,description:`Partially update a Work Item by Work Item key`},inputs:{...sg},perform:async(e,{connection:t,workItemkey:n,description:r,deadlineDate:i})=>(await Wm(t,e.debug.enabled).patch(`/v3/WorkItems/${n}`,{Description:r,DeadlineDate:i}),{data:Vm}),examplePayload:Eh})};const{debugRequest:lg,...ug}=Rm.inputs;var dg={rawRequest:(0,$.action)({display:{label:`Raw Request`,description:`Send raw HTTP request to Karbon`},perform:async(e,{connection:t,...n})=>{Km(t);let{applicationId:r,accessKey:i}=Xm(t),{data:a,headers:o}=await(0,Rm.sendRawRequest)(Bm,{...n,debugRequest:e.debug.enabled},{AccessKey:i,Authorization:`Bearer ${r}`});return{data:{data:Gm(a),headers:o}}},inputs:{connection:nh,...ug,url:{...ug.url,comments:`Input the path only (/v3/ClientGroups), The base URL is already included (${Bm}). For example, to connect to ${Bm}/v3/ClientGroups, only /v3/ClientGroups is entered in this field.`,example:`/v3/ClientGroups`,placeholder:`/v3/ClientGroups`}}})},fg={connection:nh};const pg=(0,$.action)({display:{label:`Delete All Webhook Subscriptions`,description:`Deletes all Webhook Subscriptions associated with Contact, Work, and Note`},inputs:{...fg},perform:async(e,{connection:t})=>(await Wm(t,e.debug.enabled).delete(`/v3/WebhookSubscriptions`),{data:Vm}),examplePayload:Dh});var mg={connection:nh,webhookType:lh},hg={deleteAllWebhookSubscriptions:pg,getWebhook:(0,$.action)({display:{label:`Get Webhook`,description:`Get a webhook subscription associated with the Karbon entity specified`},inputs:{...mg},perform:async(e,{connection:t,webhookType:n})=>{let{data:r}=await Wm(t,e.debug.enabled).get(`/v3/WebhookSubscriptions/${n}`);return{data:Gm(r)}},examplePayload:Oh})},gg={...Bh,...Gh,...Zh,...cg,...dg,...hg},_g={selectOrganization:(0,$.dataSource)({display:{label:`Select Organization`,description:`Select an Organization from a dropdown menu`},inputs:{connection:nh},dataSourceType:`picklist`,perform:async(e,{connection:t})=>({result:((await Zm({client:Wm(t,!1),endpoint:`/v3/Organizations/`,getAllData:!0,pagination:{}})).value||[]).map(e=>({key:e.OrganizationKey,label:e.FullName}))})})},vg={selectContact:(0,$.dataSource)({display:{label:`Select Contact`,description:`Select a Contact from a dropdown menu`},inputs:{connection:nh},dataSourceType:`picklist`,perform:async(e,{connection:t})=>({result:((await Zm({client:Wm(t,!1),endpoint:`/v3/Contacts`,getAllData:!0,pagination:{}})).value||[]).map(e=>({key:e.ContactKey,label:`${e.FullName||`No Name`} ${e.EmailAddress||``}`}))})})},yg={selectInvoice:(0,$.dataSource)({display:{label:`Select Invoice`,description:`Select an Invoice from a dropdown menu`},inputs:{connection:nh},dataSourceType:`picklist`,perform:async(e,{connection:t})=>({result:(Gm((await Wm(t,!1).get(`/v3/Invoices`)).data).value||[]).map(e=>({key:e.InvoiceKey,label:e.InvoiceNumber}))})})},bg={selectUser:(0,$.dataSource)({display:{label:`Select User`,description:`Select a User from a dropdown menu`},inputs:{connection:nh},dataSourceType:`picklist`,perform:async(e,{connection:t})=>({result:((await Zm({client:Wm(t,!1),endpoint:`/v3/Users`,getAllData:!0,pagination:{}})).value||[]).map(e=>({key:e.Id,label:`${e.Name} ${e.EmailAddress}`}))})})},xg={selectWorkItem:(0,$.dataSource)({display:{label:`Select Work Item`,description:`Select a Work Item from a dropdown menu`},inputs:{connection:nh},dataSourceType:`picklist`,perform:async(e,{connection:t})=>({result:((await Zm({client:Wm(t,!1),endpoint:`/v3/WorkItems`,getAllData:!0,pagination:{}})).value||[]).map(e=>({key:e.WorkItemKey,label:e.Title}))})})},Sg={..._g,...vg,...yg,...bg,...xg},Cg={connection:nh,webhookType:lh};const wg=(0,$.trigger)({display:{label:`Entity Trigger`,description:`Get notified to this flow when a Karbon entity changes`},allowsBranching:!1,inputs:{...Cg},synchronousResponseSupport:`invalid`,scheduleSupport:`invalid`,perform:async(e,t)=>Promise.resolve({payload:t}),webhookLifecycleHandlers:{create:async(e,{connection:t,webhookType:n})=>{let r=e.webhookUrls[e.flow.name];await Qm(t,!1,r,n)},delete:async(e,{connection:t,webhookType:n})=>{await $m(t,!1,n)}}}),Tg=e=>{let t=$.util.types.toString(e).trim();if(!t)return``;if(!Um.test(t))throw Error(`Look-back Date must be in YYYY-MM-DD format.`);let n=t.split(`-`),r=$.util.types.toNumber(n[0]),i=$.util.types.toNumber(n[1]),a=$.util.types.toNumber(n[2]),o=new Date(r,i-1,a);if(o.getFullYear()!==r||o.getMonth()!==i-1||o.getDate()!==a)throw Error(`Look-back Date "${t}" is not a valid calendar date.`);if(o>new Date)throw Error(`Look-back Date cannot be a future date.`);return t},Eg=e=>{if(!e)return[];let t=[];for(let n of e.updated??[])t.push({changeType:`updated`,record:n});return t};var Dg={connection:nh,pollResourceType:(0,$.input)({label:`Resource Type`,type:`string`,required:!0,default:`Contacts`,model:eh,comments:`The type of Karbon resource to poll for updated records.`,clean:$.util.types.toString}),lookBackDate:(0,$.input)({label:`Look-back Date`,placeholder:`Enter look-back date (YYYY-MM-DD)`,type:`string`,required:!1,comments:`The date the initial sync starts from, in YYYY-MM-DD format. Cannot be a future date. Leave empty to start from the first recurrence with no backfill. When set, the initial sync seeds each record modified on or after this date once.`,example:`2026-01-01`,clean:Tg})},Og={entityTrigger:wg,pollChangesTrigger:(0,$.pollingTrigger)({display:{label:`Updated Records`,description:`Retrieves existing and ongoing updated records from Karbon. Load history once, check for changes on a schedule, or both.`},inputs:Dg,triggerResolverSupport:`valid`,batchConfig:{batchSize:50},triggerResolver:{resolveItems:(e,{payload:t})=>Eg(t.body.data)},perform:async(e,t,n)=>{let r=Hm[n.pollResourceType];if(!r)throw Error(`Unsupported resource type: ${n.pollResourceType}`);let i=e.polling.getState(),a=new Date().toISOString(),o=i?.lastPolledAt??(n.lookBackDate?new Date(n.lookBackDate).toISOString():a),s=await Zm({client:Wm(n.connection,e.debug.enabled),endpoint:r.endpoint,getAllData:!0,pagination:{}}),c=th(s.value??[],r.timestampField,o);return e.polling.setState({lastPolledAt:a}),e.debug.enabled&&e.logger.debug(`Polled Karbon ${n.pollResourceType}: ${(s.value??[]).length} fetched, ${c.length} changed`),{payload:{...t,body:{data:{updated:c}}},polledNoChanges:c.length===0}}})},kg=(0,$.component)({key:`karbon`,public:!0,documentationUrl:`https://prismatic.io/docs/components/karbon/`,display:{label:`Karbon`,description:`Karbon is a collaborative practice management platform for accounting firms.`,iconPath:`icon.png`,category:`Application Connectors`},hooks:{error:Rm.handleErrors},actions:gg,connections:zm,dataSources:Sg,triggers:Og});exports.default=kg;
|
|
218
|
+
let t=Nm(),n=Pm(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;let i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.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 a(){try{let 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(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(K(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||fe(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(K(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).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}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(K(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return le(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return de(e).length;default:if(i)return r?-1:le(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return F(this,t,n);case`utf8`:case`utf-8`:return A(this,t,n);case`ascii`:return N(this,t,n);case`latin1`:case`binary`:return P(this,t,n);case`base64`:return k(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return I(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?A(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(K(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,fe(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:C(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):C(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function C(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function w(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(fe(r))return o;e[n+o]=r}return o}function T(e,t,n,r){return G(le(t,e.length-n),e,n,r)}function E(e,t,n,r){return G(W(t),e,n,r)}function D(e,t,n,r){return G(de(t),e,n,r)}function O(e,t,n,r){return G(ue(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return w(this,e,t,n);case`utf8`:case`utf-8`:return T(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return E(this,e,t,n);case`base64`:return D(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return O(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function k(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function A(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return M(r)}let j=4096;function M(e){let t=e.length;if(t<=j)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=j));return n}function N(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function P(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function F(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=pe[e[r]];return i}function I(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function L(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!1,52,8)};function R(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;R(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;R(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function z(e,t,n,r,i){ie(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function B(e,t,n,r,i){ie(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=me(function(e,t=0){return z(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=me(function(e,t=0){return B(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);R(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=me(function(e,t=0){return z(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=me(function(e,t=0){return B(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ee(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function V(e,t,r,i,a){return t=+t,r>>>=0,a||ee(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return V(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return V(this,e,t,!1,n)};function H(e,t,r,i,a){return t=+t,r>>>=0,a||ee(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return H(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return H(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let U={};function te(e,t,n){U[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}te(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),te(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),te(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=ne(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=ne(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function ne(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function re(e,t,n){ae(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&oe(t,e.length-(n+1))}function ie(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new U.ERR_OUT_OF_RANGE(`value`,i,e)}re(r,i,a)}function ae(e,t){if(typeof e!=`number`)throw new U.ERR_INVALID_ARG_TYPE(t,`number`,e)}function oe(e,t,n){throw Math.floor(e)===e?t<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(ae(e,n),new U.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let se=/[^+/0-9A-Za-z-_]/g;function ce(e){if(e=e.split(`=`)[0],e=e.trim().replace(se,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function le(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function W(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function ue(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function de(e){return t.toByteArray(ce(e))}function G(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function K(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function fe(e){return e!==e}let pe=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function me(e){return typeof BigInt>`u`?he:e}function he(){throw Error(`BigInt not supported`)}})),Im=a(((e,t)=>{let n=Mm(),r=typeof window<`u`?Fm().Buffer:global.Buffer;function i(e){return 12+4*Math.ceil(e.length/4)}function a(){return!(typeof window<`u`&&typeof document<`u`)}function o(e){return e.BYTES_PER_ELEMENT?e.length*e.BYTES_PER_ELEMENT:-1}function s(e){let t=0;try{let n=e;if(e instanceof Map?n=Object.fromEntries(e):e instanceof Set&&(n=Array.from(e)),ArrayBuffer.isView(e))return o(e);let i=JSON.stringify(n,(e,t)=>typeof t==`bigint`||typeof t==`function`?t.toString():t===void 0?`undefined`:typeof t==`symbol`||t instanceof RegExp?t.toString():t);t=r.byteLength(i,`utf8`)}catch{return Error(-1)}return t}function c(e){let t=[],o=[e],s=0;for(;o.length;){let c=o.pop();if(typeof c==`boolean`)s+=n.BYTES;else if(typeof c==`string`)a()?s+=i(c):s+=c.length*n.STRING;else if(typeof c==`number`)s+=n.NUMBER;else if(typeof c==`symbol`)Symbol.keyFor&&Symbol.keyFor(e)?s+=Symbol.keyFor(e).length*n.STRING:s+=(e.toString().length-8)*n.STRING;else if(typeof c==`bigint`)s+=r.from(c.toString()).byteLength;else if(typeof c==`function`)s+=c.toString().length;else if(typeof c==`object`&&t.indexOf(c)===-1){t.push(c);for(let e in c)o.push(c[e])}}return s}t.exports=function(e){let t=0;return t=typeof e==`object`&&e?s(e):c(e),t}})),Lm=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.inputs=e.debugRequest=e.fileDataFileNames=e.fileData=e.formData=e.retryAllErrors=e.useExponentialBackoff=e.retryDelayMS=e.maxRetries=e.queryParams=e.headers=e.responseType=e.method=e.timeout=e.data=e.url=void 0;let t=Om();e.url=(0,t.input)({label:`URL`,placeholder:`URL to call`,type:`string`,required:!0,comments:`This is the URL to call.`,example:`/sobjects/Account`,clean:e=>t.util.types.toString(e)}),e.data=(0,t.input)({label:`Data`,placeholder:`Data to send`,type:`string`,required:!1,comments:`The HTTP body payload to send to the URL.`,example:`{"exampleKey": "Example Data"}`}),e.timeout=(0,t.input)({label:`Timeout`,type:`string`,required:!1,comments:`The maximum time that a client will await a response to its request`,example:`2000`,clean:e=>t.util.types.toNumber(e)}),e.method=(0,t.input)({label:`Method`,type:`string`,required:!0,model:[`DELETE`,`GET`,`HEAD`,`LINK`,`OPTIONS`,`PATCH`,`POST`,`PURGE`,`PUT`,`UNLINK`].map(e=>({label:e,value:e})),comments:`The HTTP method to use.`,clean:e=>t.util.types.toString(e)}),e.responseType=(0,t.input)({label:`Response Type`,placeholder:`Response Type`,type:`string`,default:`json`,required:!0,comments:`The type of data you expect in the response. You can request json, text, or binary data.`,model:[`arraybuffer`,`document`,`json`,`text`].map(e=>({label:e,value:e})),clean:e=>t.util.types.toString(e)}),e.headers=(0,t.input)({label:`Header`,placeholder:`Header`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`A list of headers to send with the request.`,example:`User-Agent: curl/7.64.1`}),e.queryParams=(0,t.input)({label:`Query Parameter`,placeholder:`Query Parameter`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`A list of query parameters to send with the request. This is the portion at the end of the URL similar to ?key1=value1&key2=value2.`}),e.maxRetries=(0,t.input)({label:`Max Retry Count`,placeholder:`Max Retries`,type:`string`,required:!1,comments:`The maximum number of retries to attempt. Specify 0 for no retries.`,default:`0`,clean:e=>t.util.types.toNumber(e)}),e.retryDelayMS=(0,t.input)({label:`Retry Delay (ms)`,placeholder:`Retry Delay`,type:`string`,required:!1,comments:`The delay in milliseconds between retries. This is used when 'Use Exponential Backoff' is disabled.`,default:`0`,clean:e=>t.util.types.toNumber(e,0)}),e.useExponentialBackoff=(0,t.input)({label:`Use Exponential Backoff`,type:`boolean`,default:`false`,required:!1,comments:`Specifies whether to use a pre-defined exponential backoff strategy for retries. When enabled, 'Retry Delay (ms)' is ignored.`,clean:e=>t.util.types.toBool(e)}),e.retryAllErrors=(0,t.input)({label:`Retry On All Errors`,type:`boolean`,default:`false`,required:!1,comments:`If true, retries on all erroneous responses regardless of type. This is helpful when retrying after HTTP 429 or other 3xx or 4xx errors. Otherwise, only retries on HTTP 5xx and network errors.`,clean:e=>t.util.types.toBool(e)}),e.formData=(0,t.input)({label:`Form Data`,placeholder:`Data to send`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`The Form Data to be sent as a multipart form upload.`,example:`[{"key": "Example Key", "value": new Buffer("Hello World")}]`}),e.fileData=(0,t.input)({label:`File Data`,placeholder:`Data to send`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`File Data to be sent as a multipart form upload.`,example:`[{key: "example.txt", value: "My File Contents"}]`}),e.fileDataFileNames=(0,t.input)({label:`File Data File Names`,placeholder:`The file name to apply to a file`,type:`string`,collection:`keyvaluelist`,required:!1,comments:`File names to apply to the file data inputs. Keys must match the file data keys above.`,clean:e=>e?t.util.types.keyValPairListToObject(e):void 0}),e.debugRequest=(0,t.input)({label:`Debug Request`,type:`boolean`,required:!1,comments:`Enabling this flag will log out the current request.`,clean:e=>t.util.types.toBool(e)}),e.inputs={url:e.url,method:e.method,data:e.data,formData:e.formData,fileData:e.fileData,fileDataFileNames:e.fileDataFileNames,queryParams:e.queryParams,headers:e.headers,responseType:e.responseType,timeout:e.timeout,debugRequest:e.debugRequest,retryDelayMS:e.retryDelayMS,retryAllErrors:e.retryAllErrors,maxRetries:e.maxRetries,useExponentialBackoff:e.useExponentialBackoff}})),Rm=a((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=e(r),o=0;o<a.length;o++)a[o]!=="default"&&t(i,r,a[o]);return n(i,r),i}})(),i=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},a=e&&e.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},o=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.inputs=e.buildRawRequestAction=e.sendRawRequest=e.handleErrors=e.createClient=e.toAxiosRetryConfig=void 0;let s=o(Nu()),c=r(Am()),l=o(bu()),u=o(jm()),d=o(Im()),f=Om(),p=o(dl()),m=Lm();Object.defineProperty(e,"inputs",{enumerable:!0,get:function(){return m.inputs}});let h=/^(cookie|set-cookie)$|auth|token|secret|password|api[-_]?key/i,g=e=>typeof e==`object`&&!!e&&typeof e.toJSON==`function`,_=e=>{let t=g(e)?e.toJSON():Object.assign({},e);return Object.fromEntries(Object.entries(t).map(([e,t])=>[e,h.test(e)?`[REDACTED]`:t]))},v=e=>{let t=p.default.types.toString(e.token?.access_token);if(t)return{Authorization:`Bearer ${t}`};let n=p.default.types.toString(e.fields?.apiKey);if(n)return{Authorization:`Bearer ${n}`};let r=p.default.types.toString(e.fields?.username),i=p.default.types.toString(e.fields?.password);if(r&&i)return{Authorization:`Basic ${Buffer.from(`${r}:${i}`).toString(`base64`)}`};throw Error(`Failed to guess at authorization parameters for Connection: ${e.key}`)},y=(e,t,n={})=>{let r=new l.default;return(e||[]).map(({key:e,value:t})=>r.append(e,t)),(t||[]).map(({key:e,value:t})=>r.append(e,p.default.types.toBufferDataPayload(t).data,{filename:n?.[e]||e})),r},b=(e,t)=>t?typeof e==`number`?t=>2**(t-1)*e:c.exponentialDelay:typeof e==`number`?()=>e:e;e.toAxiosRetryConfig=e=>{var{retryDelay:t,retryAllErrors:n,retryCondition:r,useExponentialBackoff:i}=e,o=a(e,[`retryDelay`,`retryAllErrors`,`retryCondition`,`useExponentialBackoff`]);return Object.assign(Object.assign({},o),{retryDelay:b(t,i),retryCondition:n?()=>!0:typeof r==`function`?r:c.isNetworkOrIdempotentRequestError})},e.createClient=({baseUrl:t,responseType:n,headers:r,timeout:i,params:a,debug:o=!1,retryConfig:l})=>{let u=s.default.create({baseURL:t,responseType:n,headers:r,timeout:i,params:a,maxContentLength:1/0,maxBodyLength:1/0});return o&&(u.interceptors.request.use(e=>{let{baseURL:t,headers:n,method:r,timeout:i,url:a,data:o,params:s}=e,c=(0,d.default)(o);return console.log(p.default.types.toJSON({type:`request`,baseURL:t,params:s,url:a,headers:_(n),method:r,timeout:i,data:c>1024*10||Buffer.isBuffer(o)?`<data (${c} bytes)>`:o},!0,!0)),e}),u.interceptors.response.use(e=>{let{headers:t,status:n,statusText:r,data:i}=e,a=(0,d.default)(i);return console.log(p.default.types.toJSON({type:`response`,headers:_(t),status:n,statusText:r,data:a>1024*10||Buffer.isBuffer(i)?`<data (${a} bytes)>`:i},!0,!0)),e})),l&&(0,c.default)(u,(0,e.toAxiosRetryConfig)(l)),u},e.handleErrors=e=>{if(s.default.isAxiosError(e)){let{message:t,response:n}=e;return{message:t,data:n?.data,status:n?.status,headers:n?.headers}}return e},e.sendRawRequest=(t,n,...r)=>i(void 0,[t,n,...r],void 0,function*(t,n,r={}){if(n.data&&(!(0,u.default)(n.formData)||!(0,u.default)(n.fileData)))throw Error(`Cannot specify both Data and File/Form Data.`);let i=!(0,u.default)(n.formData)||!(0,u.default)(n.fileData)?y(n.formData,n.fileData,n.fileDataFileNames):n.data;return yield(0,e.createClient)({baseUrl:t,debug:n.debugRequest,responseType:n.responseType,timeout:n.timeout,retryConfig:{retries:n.maxRetries,retryDelay:n.retryDelayMS,retryAllErrors:n.retryAllErrors,useExponentialBackoff:n.useExponentialBackoff}}).request({method:n.method,url:n.url,headers:Object.assign(Object.assign(Object.assign({},p.default.types.keyValPairListToObject(n.headers)),i instanceof l.default?i.getHeaders():{}),r),params:p.default.types.keyValPairListToObject(n.queryParams),data:i||void 0})}),e.buildRawRequestAction=(t,n=`Raw Request`,r=`Issue a raw HTTP request`)=>(0,f.action)({display:{label:n,description:r},inputs:Object.assign({connection:{label:`Connection`,type:`connection`,required:!0}},m.inputs),perform:(n,r)=>i(void 0,void 0,void 0,function*(){var{connection:n}=r,i=a(r,[`connection`]);let{data:o}=yield(0,e.sendRawRequest)(t,i,v(n));return{data:o}})})}))(),$=Om(),zm=[(0,$.connection)({key:`karbonApiKey`,display:{label:`API Key`,description:`API Key connection for Karbon`},inputs:{applicationId:{type:`string`,label:`Application ID`,comments:`The application ID for the Karbon API. You receive this when you create an application in Karbon.`,example:`00000000-0000-0000-0000-000000000000`,required:!0},accessKey:{type:`password`,label:`Access Key`,comments:`Get this by clicking Settings > Connected Apps > Manage on your app.`,example:`eyJ.....`,required:!0}}})];const Bm=`https://api.karbonhq.com`,Vm=`Success`,Hm={Contacts:{endpoint:`/v3/Contacts`,timestampField:`LastModifiedDateTime`},Invoices:{endpoint:`/v3/Invoices`,timestampField:`UpdatedAt`}},Um=/^(\d{4})-(\d{2})-(\d{2})$/,Wm=(e,t)=>{Km(e);let{applicationId:n,accessKey:r}=Xm(e);return(0,Rm.createClient)({baseUrl:Bm,headers:{AccessKey:r,Authorization:`Bearer ${n}`},debug:t})},Gm=e=>Object.entries(e).reduce((e,[t,n])=>t.startsWith(`@odata.`)?{...e,odata:{[t.replace(`@odata.`,``)]:n,...e.odata}}:{[t]:n,...e},{}),Km=e=>{if(!zm.map(e=>e.key).includes(e.key))throw new $.ConnectionError(e,`Unsupported connection ${e.key}.`)},qm=e=>e?$.util.types.toString(e):void 0,Jm=e=>e?$.util.types.toObject(e):void 0,Ym=e=>e?$.util.types.toNumber(e):void 0,Xm=e=>({applicationId:$.util.types.toString(e.fields.applicationId),accessKey:$.util.types.toString(e.fields.accessKey)}),Zm=async({client:e,endpoint:t,getAllData:n,pagination:{$top:r,$skip:i},$filter:a,$orderby:o})=>{n?(i=0,r=100):(i||=0,r||=100);let{data:s}=await e.get(t,{params:{$top:r,$skip:i,$filter:a,$orderby:o}}),c=Gm(s);if(c.value=c.value||[],!n)return c;let l=$.util.types.toNumber(c.odata?.count);if(l===0||l<=100)return c;let u=Math.ceil(l/100),d=Array.from({length:u-1},(e,t)=>(t+1)*100).map(n=>e.get(t,{params:{$top:100,$skip:n,$filter:a,$orderby:o}})),f=await Promise.all(d);return c.value=[...c.value||[],...f.flatMap(e=>e.data.value)],c},Qm=async(e,t,n,r)=>{let i=await Wm(e,t).post(`/v3/WebhookSubscriptions`,{TargetUrl:n,WebhookType:r});return{data:Gm(i.data)}},$m=async(e,t,n)=>{let{data:r}=await Wm(e,t).delete(`/v3/WebhookSubscriptions/${n}`);return{data:r}},eh=Object.keys(Hm).map(e=>({label:e,value:e})),th=(e,t,n)=>{let r=new Date(n).getTime();return e.filter(e=>{let n=e[t],i=typeof n==`string`?new Date(n).getTime():NaN;return!Number.isNaN(i)&&i>r})},nh=(0,$.input)({label:`Connection`,type:`connection`,required:!0}),rh=(0,$.input)({label:`Additional Fields`,type:`code`,language:`json`,comments:`Additional fields that are not covered by the standard inputs.`,required:!1,example:JSON.stringify({},null,2),clean:Jm}),ih=(0,$.input)({label:`Top`,type:`string`,comments:`The number of records to return at once.`,required:!1,example:`50`,placeholder:`50`,clean:Ym}),ah=(0,$.input)({label:`Filter`,type:`string`,comments:`A filter expression to apply to the results.`,example:`FullName eq 'Sample Management Team'`,placeholder:`FullName eq 'Sample Management Team'`,required:!1,clean:qm}),oh=(0,$.input)({label:`Order By`,type:`string`,comments:`The property to order the results by.`,example:`FullName`,placeholder:``,required:!1,clean:qm}),sh=(0,$.input)({label:`Skip`,type:`string`,comments:`The number of records to skip when looping over pages of results. If you fetch 100 results, you should skip 0 the first iteration, then 100, 200, 300, etc. until no more records are available.`,example:`100`,placeholder:`100`,required:!1,clean:Ym}),ch=(0,$.input)({label:`Get All Data`,type:`boolean`,comments:`Turn this on to retrieve all pages of data. $top and $skip will be ignored.`,required:!1,default:`false`,clean:$.util.types.toBool}),lh=(0,$.input)({label:`Webhook Type`,type:`string`,model:[`Contact`,`Work`,`Note`,`User`,`Invoice`].map(e=>({value:e,label:e})),comments:`The type of the Webhook.`,required:!0,example:`Contact`,clean:qm}),uh=(0,$.input)({label:`Contactkey`,comments:`The Contact key.`,type:`string`,required:!0,clean:qm,example:`4jgPTtcXxwC2`,placeholder:`4jgPTtcXxwC2`,dataSource:`selectContact`}),dh=(0,$.input)({label:`Contact's First Name`,comments:`The first name of the Contact.`,type:`string`,required:!0,clean:qm,example:`John`,placeholder:`John`}),fh=(0,$.input)({label:`Contact's Last Name`,comments:`The last name of the Contact.`,type:`string`,required:!0,clean:qm,example:`Doe`,placeholder:`Doe`});var ph={connection:nh,firstName:dh,lastName:fh,additionalFields:(0,$.input)({...rh,example:JSON.stringify({Salutation:`Mr`,Suffix:`Jr.`,RestrictionLevel:`Public`,UserDefinedIdentifier:`BILLJR-001`,BusinessCards:[{IsPrimaryCard:!0,OrganizationKey:`7NN1ySxv89B`,WebSites:[`www.website.one`,`www.website.two`],EmailAddresses:[`sample@example.com`,`sample.two@example.com`],RoleOrTitle:`COO`,FacebookLink:`facebook.com/sampleName`,LinkedInLink:`linkedin.com/sampleName`,TwitterLink:`twitter.com/sampleName`,SkypeLink:`skype.com/sampleName`,Addresses:[{AddressLines:`45 Sample Street`,City:`Alexandria`,StateProvinceCounty:`NSW`,ZipCode:2015,CountryCode:`AU`,Label:`Physical`}],PhoneNumbers:[{Number:1234567890,CountryCode:61,Label:`Work`}]}]},null,2),comments:`${rh.comments} See [Karbon API documentation](https://karbonhq.github.io/karbon-api-reference/#post-/v3/Contacts) for more information.`})};const mh={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#Contacts/KarbonService.ContactDTO/$entity`,type:`#KarbonService.ContactDTO`},ContactKey:`67zlxNyJSr8e`,FirstName:`William`,MiddleName:`John`,LastName:`Connor`,PreferredName:`Bill`,Salutation:`Mr`,Suffix:`Jr.`,ClientOwner:`rodney.muller@samplecompany.com`,ClientManager:`jessica.tse@samplecompany.com`,ContactType:`Client`,UserDefinedIdentifier:`BILLJR`,RestrictionLevel:`Public`,AvatarUrl:`https://az.karbonemail.com/images/e4ae96c1-8d17-4c6e-af8a-8040482176fc`,LastModifiedDateTime:`2022-07-05T07:30:13.7188114Z`,EntityDescription:{Text:`Birthday on June 23.`},AccountingDetail:{ContactPermaKey:`4XHEn8T3J4Y6`,OrganizationPermaKey:null,BirthDate:`1969-08-05T00:00:00Z`,DeathDate:null,Salutation:`Mr`,Sex:`M`,FinancialYearEndDay:8,FinancialYearEndMonth:30,IncorporationDate:null,IncorporationState:null,LegalName:null,LineOfBusiness:null,EntityType:null,TaxCountryCode:`US`,TradingName:null,AnnualRevenue:null,BaseCurrency:null,GstBasis:null,GstPeriod:null,IncomeTaxInstallmentPeriod:`Yearly`,IsVATRegistered:null,OrganizationValuation:null,PaysTax:null,PrepareGST:null,ProvisionaTaxBasic:null,ProvisionalTaxRatio:null,RevenueModel:null,SalesTaxBasis:null,SalesTaxPeriod:null,Sells:null,RegistrationNumbers:{RegistrationNumber:`12-3456789`,Type:`Social Security Number (SSN)`},Notes:{Body:`This is a sample note text.`,Type:`Basic`}},BusinessCards:{BusinessCardKey:`2tBHyXtJBxBy`,IsPrimaryCard:!0,WebSites:[`www.website.one`,`www.website.two`],EmailAddresses:[`sample@example.com`,`sample.two@example.com`],OrganizationKey:`ZGNmtYyLm4z`,RoleOrTitle:`COO`,FacebookLink:`facebook.com/sampleName`,LinkedInLink:`linkedin.com/sampleName`,TwitterLink:`twitter.com/sampleName`,SkypeLink:`skype.com/sampleName`,Addresses:{AddressKey:`e150a05a-2dea-4292-8bc8-03398c9384e4`,AddressLines:`45 Sample Street`,City:`Alexandria`,StateProvinceCounty:`NSW`,ZipCode:`2015`,CountryCode:`AU`,Label:`Physical`},PhoneNumbers:{PhoneNumberKey:`6e0b9ace-24b1-4328-a922-3b8be5ef5052`,Number:1234567890,CountryCode:61,Label:`Work`}}}},hh={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#Contacts/KarbonService.ContactSummaryDTO`,count:323},value:[{"@odata.type":`#KarbonService.ContactSummaryDTO`,ContactKey:`29YXnqWcqCf3`,FullName:`William John Connor`,PreferredName:`Bill`,Salutation:`Mr`,ClientOwner:`rodney.muller@samplecompany.com`,ClientManager:`jessica.tse@samplecompany.com`,Address:`42 Galaxy Way, London`,EmailAddress:`william.connor@samplecompany.com`,PhoneNumber:`0987888686`,RoleOrTitle:`COO`,UserDefinedIdentifier:`73YEnqFcqCf3`,LastModifiedDateTime:`2021-12-29T07:01:53Z`}]}};hh.data.value;const gh={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#Invoices/$entity`},InvoiceKey:`M2dVbCt4RHk`,InvoiceNumber:`KIN-1001`,TotalAmountDue:1607.13,InvoiceTotal:1607.13,InvoiceSubTotal:1397.5,InvoiceTaxTotal:209.63,InvoiceDate:`2023-07-21T00:00:00Z`,PaymentDueDate:`2023-07-28T00:00:00Z`,UpdatedAt:`2023-07-20T23:52:11Z`,CurrencyCode:`AUD`,PaymentInstructions:`Payment due 7 days from invoice date`,InvoiceStatus:`AwaitingPayment`,Client:{ClientKey:`2xxnBLyCP4Ts`,ClientType:`Organization`,Name:`Acme Corp`,AddressLine:`15 Example Street`,City:`Sydney`,StateProvinceCounty:`NSW`,ZipCode:`4004`,Country:`Australia`,EmailAddress:`acme@example.com`},TaxLineItems:[{TaxName:`GST`,TaxValue:209.63}]}},_h={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#Invoices(LineItems())`,count:1},value:[{InvoiceKey:`2F8bb4Xk4N1T`,InvoiceNumber:`KIN-1000`,TotalAmountDue:5,InvoiceTotal:5,InvoiceSubTotal:5,InvoiceTaxTotal:0,InvoiceDate:`2024-05-23T00:00:00Z`,PaymentDueDate:`2024-05-30T00:00:00Z`,UpdatedAt:`2024-05-23T16:44:29Z`,CurrencyCode:`USD`,PaymentInstructions:null,InvoiceStatus:`Approved`,Client:{ClientKey:`4hFn8Czrnw4v`,ClientType:`Organization`,Name:`Example Sandbox`,AddressLine:null,City:null,StateProvinceCounty:null,ZipCode:null,Country:null,EmailAddress:null},TaxLineItems:[],LineItems:[{LineItemKey:`3aebacb913b44aaa81b1cb2acf958b1b`,BillableItemEntityKey:`2SFw2p31285T`,BillableItemType:`Expense`,Description:`My Services`,Quantity:1,UnitPrice:5,Amount:5,TaxRate:0,TaxRateName:`No Tax Set`}]}]}},vh={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#Users/$entity`},Id:`4LR9qmR5NQ6T`,Name:`Joe Min`,EmailAddress:`joe@samplecompany.com`}},yh={data:{value:[{"@odata.type":`#KarbonService.WorkItemSummaryDTO`,WorkItemKey:`2LPSrkzbYrn4`,AssigneeEmailAddress:`joe@samplecompany.com`,AssigneeKey:`4gHCvnbFFqsq`,AssigneeName:`Joe Min`,Title:`Payroll 31 Aug - 15 Sep 2022`,ClientKey:`4ncPZ7q96SGc`,ClientName:`Acme Corporation`,ClientType:`Organization`,ClientUserDefinedIdentifier:`ACMECORP`,RelatedClientGroupKey:`3LCPr987gNrc`,ClientGroupKey:`3LCPr987gNrc`,RelatedClientGroupName:`Smith Family Group`,StartDate:`2021-12-29T00:00:00Z`,DueDate:`2022-01-30T00:00:00Z`,DeadlineDate:`2022-01-31T00:00:00Z`,CompletedDate:`2022-02-01T00:00:00Z`,ToDoPeriod:`2021-12-29T00:00:00Z`,WorkType:`Payroll`,WorkStatus:`Ready To Start - Send client requests`,PrimaryStatus:`Ready To Start`,SecondaryStatus:`Send client requests`,WorkTemplateKey:`p56mtcBhwb9`,WorkTemplateTile:`Payroll processing`,WorkScheduleKey:`4f3gHnLC323`}],odata:{count:323,context:`https://api.karbonhq.com/v3/$metadata#WorkItems/KarbonService.WorkItemSummaryDTO`,nextLink:`https://api.karbonhq.com/v3/WorkItems?$skip=100`}}},bh={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#Contacts/KarbonService.ContactDTO/$entity`,type:`#KarbonService.ContactDTO`},ContactKey:`67zlxNyJSr8e`,FirstName:`William`,MiddleName:`John`,LastName:`Connor`,PreferredName:`Bill`,Salutation:`Mr`,Suffix:`Jr.`,ClientOwner:`rodney.muller@samplecompany.com`,ClientManager:`jessica.tse@samplecompany.com`,ContactType:`Client`,UserDefinedIdentifier:`BILLJR`,RestrictionLevel:`Public`,AvatarUrl:`https://az.karbonemail.com/images/e4ae96c1-8d17-4c6e-af8a-8040482176fc`,LastModifiedDateTime:`2022-07-05T07:30:13.7188114Z`,EntityDescription:{Text:`Birthday on June 23.`},AccountingDetail:{ContactPermaKey:`4XHEn8T3J4Y6`,OrganizationPermaKey:null,BirthDate:`1969-08-05T00:00:00Z`,DeathDate:null,Salutation:`Mr`,Sex:`M`,FinancialYearEndDay:8,FinancialYearEndMonth:30,IncorporationDate:null,IncorporationState:null,LegalName:null,LineOfBusiness:null,EntityType:null,TaxCountryCode:`US`,TradingName:null,AnnualRevenue:null,BaseCurrency:null,GstBasis:null,GstPeriod:null,IncomeTaxInstallmentPeriod:`Quaterly`,IsVATRegistered:null,OrganizationValuation:null,PaysTax:null,PrepareGST:null,ProvisionaTaxBasic:null,ProvisionalTaxRatio:null,RevenueModel:null,SalesTaxBasis:null,SalesTaxPeriod:null,Sells:null,RegistrationNumbers:{RegistrationNumber:`12-3456789`,Type:`Social Security Number (SSN)`},Notes:{Body:`This is a sample note text.`,Type:`Basic`}},BusinessCards:{BusinessCardKey:`2tBHyXtJBxBy`,EntityType:`Contact`,EntityKey:`67zlxNyJSr8e`,IsPrimaryCard:!0,WebSites:[`www.website.one`,`www.website.two`],EmailAddresses:[`sample@example.com`,`sample.two@example.com`],OrganizationKey:`ZGNmtYyLm4z`,RoleOrTitle:`COO`,FacebookLink:`facebook.com/sampleName`,LinkedInLink:`linkedin.com/sampleName`,TwitterLink:`twitter.com/sampleName`,SkypeLink:`skype.com/sampleName`,Addresses:{AddressKey:`e150a05a-2dea-4292-8bc8-03398c9384e4`,AddressLines:`45 Sample Street`,City:`Alexandria`,StateProvinceCounty:`NSW`,ZipCode:`2015`,CountryCode:`AU`,Label:`Physical`},PhoneNumbers:{PhoneNumberKey:`6e0b9ace-24b1-4328-a922-3b8be5ef5052`,Number:1234567890,CountryCode:61,Label:`Work`}}}},xh={data:Vm},Sh={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#Users`,count:1,nextLink:`https://api.karbonhq.com/v3/Users?$skip=100`},value:[{Id:`4LR9qmR5NQ6T`,Name:`Joe Min`,EmailAddress:`joe@samplecompany.com`}]}},Ch={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#Users/KarbonService.UserProfileDTO/$entity`,type:`#KarbonService.UserProfileDTO`},Id:`2bYxtn94ZSdY`,Name:`Janet Smith`,EmailAddress:`janet@example.com`,BillableRate:0,CapacityMinutesPerWeek:2400,Permissions:[`User`],Roles:[`Accountant`,`Bookkeeper`],Teams:[`Accountants`,`Bookkeepers`]}},wh={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#WorkItems/KarbonService.WorkItemDTO/$entity`,type:`#KarbonService.WorkItemDTO`},WorkItemKey:`2LPSrkzbYrn4`,AssigneeEmailAddress:`joe@samplecompany.com`,AssigneeKey:`4gHCvnbFFqsq`,AssigneeName:`Joe Min`,Title:`Payroll 31 Aug - 15 Sep 2022`,ClientKey:`4ncPZ7q96SGc`,ClientName:`Acme Corporation`,ClientType:`Organization`,ClientUserDefinedIdentifier:`ACMECORP`,RelatedClientGroupKey:`3LCPr987gNrc`,ClientGroupKey:`3LCPr987gNrc`,RelatedClientGroupName:`Smith Family Group`,StartDate:`2021-12-29T00:00:00Z`,DueDate:`2022-01-30T00:00:00Z`,DeadlineDate:`2022-01-31T00:00:00Z`,CompletedDate:`2022-02-01T00:00:00Z`,ToDoPeriod:`2021-12-29T00:00:00Z`,WorkType:`Payroll`,WorkStatus:`Ready To Start - Send client requests`,PrimaryStatus:`Ready To Start`,SecondaryStatus:`Send client requests`,WorkTemplateKey:`p56mtcBhwb9`,WorkTemplateTile:`Payroll processing`,WorkScheduleKey:`4f3gHnLC323`,FeeSettings:{FeeType:`FixedFee`,FeeValue:5150.2},Description:`Send to Jo for review`,ClientTaskRecipient:null}},Th={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#WorkItems/KarbonService.WorkItemDTO/$entity`,type:`#KarbonService.WorkItemDTO`},WorkItemKey:`2LPSrkzbYrn4`,AssigneeEmailAddress:`joe@samplecompany.com`,AssigneeKey:`4gHCvnbFFqsq`,AssigneeName:`Joe Min`,Title:`Payroll 31 Aug - 15 Sep 2022`,ClientKey:`4ncPZ7q96SGc`,ClientName:`Acme Corporation`,ClientType:`Organization`,ClientUserDefinedIdentifier:`ACMECORP`,RelatedClientGroupKey:`3LCPr987gNrc`,ClientGroupKey:`3LCPr987gNrc`,RelatedClientGroupName:`Smith Family Group`,StartDate:`2021-12-29T00:00:00Z`,DueDate:`2022-01-30T00:00:00Z`,DeadlineDate:`2022-01-31T00:00:00Z`,CompletedDate:`2022-02-01T00:00:00Z`,ToDoPeriod:`2021-12-29T00:00:00Z`,WorkType:`Payroll`,WorkStatus:`Ready To Start - Send client requests`,PrimaryStatus:`Ready To Start`,SecondaryStatus:`Send client requests`,WorkTemplateKey:`p56mtcBhwb9`,WorkTemplateTile:`Payroll processing`,WorkScheduleKey:`4f3gHnLC323`,FeeSettings:{FeeType:`FixedFee`,FeeValue:5150.2},Description:`Send to Jo for review`,ClientTaskRecipient:null}},Eh={data:Vm},Dh={data:Vm},Oh={data:{odata:{context:`https://api.karbonhq.com/v3/$metadata#WebhookSubscriptions/$entity`},TargetUrl:`https://evelyn.info/hooks/catch/3550924/ovsbqn4/`,WebhookType:`Contact`}},kh=(0,$.action)({display:{label:`Create a Contact`,description:`Create a new contact`},inputs:{...ph},perform:async(e,{connection:t,firstName:n,lastName:r,additionalFields:i})=>({data:Gm((await Wm(t,e.debug.enabled).post(`/v3/Contacts`,{FirstName:n,LastName:r,...i||{}})).data)}),examplePayload:mh});var Ah={connection:nh,$filter:(0,$.input)({...ah,comments:`${ah.comments} See [Karbon API documentation](https://karbonhq.github.io/karbon-api-reference/#get-/v3/Contacts) for more information.`}),$top:ih,$skip:sh,$orderby:(0,$.input)({...oh,model:[{value:`FullName`,label:`Full Name`},{value:`FullName desc`,label:`Full Name Descending`},{value:`LastModifiedDateTime`,label:`Last Modified Date Time`},{value:`LastModifiedDateTime desc`,label:`Last Modified Date Time Descending`}]}),getAllData:ch};const jh=(0,$.action)({display:{label:`List Contacts`,description:`List all Contacts`},inputs:{...Ah},perform:async(e,{connection:t,$filter:n,$top:r,$skip:i,$orderby:a,getAllData:o})=>{let s=Wm(t,e.debug.enabled);return{data:await Zm({pagination:{$top:r,$skip:i},client:s,endpoint:`/v3/Contacts`,getAllData:o,$orderby:a,$filter:n})}},examplePayload:hh}),Mh=(0,$.input)({label:`Expand Business Cards`,comments:`Whether to return the Business Card associated with the Contact.`,type:`boolean`,required:!1,default:`false`,clean:$.util.types.toBool});var Nh={connection:nh,contactkey:(0,$.input)({...uh,comments:`${uh.comments} to get the Contact for.`}),expandBusinessCards:Mh};const Ph=(0,$.action)({display:{label:`Get Contact`,description:`Get a single Contact by Contact key`},inputs:{...Nh},perform:async(e,{connection:t,contactkey:n,expandBusinessCards:r})=>({data:Gm((await Wm(t,e.debug.enabled).get(`/v3/Contacts/${n}`,{params:{$expand:r?`BusinessCards`:void 0}})).data)}),examplePayload:bh}),Fh=(0,$.input)({label:`Contact's Middle Name`,comments:`The middle name of the Contact.`,type:`string`,required:!1,clean:qm,example:`John`,placeholder:`John`}),Ih=(0,$.input)({label:`Contact's Preferred Name`,comments:`The preferred name of the Contact.`,type:`string`,required:!1,clean:qm,example:`John`,placeholder:`John`}),Lh=(0,$.input)({label:`Contact's Salutation`,comments:`The title to address the Contact.`,type:`string`,required:!1,clean:qm,example:`Mr`,placeholder:`Mr`}),Rh=(0,$.input)({label:`Contact's Suffix`,comments:`The suffix of the Contact.`,type:`string`,required:!1,clean:qm,example:`Jr.`,placeholder:`Jr.`});var zh={connection:nh,contactkey:(0,$.input)({...uh,comments:`${uh.comments} to update the Contact for.`}),firstName:(0,$.input)({...dh,required:!1}),lastName:(0,$.input)({...fh,required:!1}),middleName:Fh,preferredName:Ih,salutation:Lh,suffix:Rh},Bh={listContacts:jh,createContact:kh,getContact:Ph,updateContact:(0,$.action)({display:{label:`Update a Contact`,description:`Partially update a contact by Contact key`},inputs:{...zh},perform:async(e,{connection:t,contactkey:n,firstName:r,lastName:i,middleName:a,preferredName:o,salutation:s,suffix:c})=>(await Wm(t,e.debug.enabled).patch(`/v3/Contacts/${n}`,{FirstName:r,MiddleName:a,LastName:i,PreferredName:o,Salutation:s,Suffix:c}),{data:Vm}),examplePayload:xh})};const Vh=(0,$.input)({label:`Include Line Items`,type:`boolean`,required:!1,default:`false`,comments:`Include additional lineitems invoice properties.`,clean:$.util.types.toBool});var Hh={connection:nh,invoiceKey:(0,$.input)({label:`Invoice Key`,type:`string`,required:!0,example:`M2dVbCt4RHk`,placeholder:`M2dVbCt4RHk`,comments:`The Invoice key to get the Invoice for.`,clean:qm,dataSource:`selectInvoice`}),includeLineItems:Vh};const Uh=(0,$.action)({display:{label:`Get Invoice`,description:`Get an invoice by key`},inputs:{...Hh},perform:async(e,{connection:t,invoiceKey:n,includeLineItems:r})=>({data:Gm((await Wm(t,e.debug.enabled).get(`/v3/Invoices/${n}`,{params:{$expand:r?`LineItems`:void 0}})).data)}),examplePayload:gh});var Wh={connection:nh,includeLineItems:Vh,$orderby:(0,$.input)({...oh,model:[{value:`InvoiceDate`,label:`Invoice Date`},{value:`InvoiceDate asc`,label:`Invoice Date asc`},{value:`InvoiceDate desc`,label:`Invoice Date desc`}]})},Gh={getInvoice:Uh,listInvoices:(0,$.action)({display:{label:`List Invoices`,description:`List invoices`},inputs:{...Wh},perform:async(e,{connection:t,includeLineItems:n,$orderby:r})=>({data:Gm((await Wm(t,e.debug.enabled).get(`/v3/Invoices`,{params:{$expand:n?`LineItems`:void 0,$orderby:r}})).data)}),examplePayload:_h})},Kh={connection:nh,userName:(0,$.input)({label:`User's Name`,type:`string`,comments:`The name of the User.`,required:!0,clean:qm,example:`John Doe`,placeholder:`John Doe`}),userEmail:(0,$.input)({label:`User's Email`,type:`string`,comments:`The email of the User.`,required:!0,clean:qm,example:`example@email.com`,placeholder:`example@email.com`})};const qh=(0,$.action)({display:{label:`Create User`,description:`Create a new user`},inputs:{...Kh},perform:async(e,{connection:t,userName:n,userEmail:r})=>({data:Gm((await Wm(t,e.debug.enabled).post(`/v3/Users`,{Name:n,EmailAddress:r})).data)}),examplePayload:vh});var Jh={connection:nh,userId:(0,$.input)({label:`User ID`,type:`string`,comments:`The unique ID of the User to get.`,required:!0,clean:qm,example:`2bYxtn94ZSdY`,placeholder:`2bYxtn94ZSdY`,dataSource:`selectUser`})};const Yh=(0,$.action)({display:{label:`Get User`,description:`Gets the details of a single User`},inputs:{...Jh},perform:async(e,{connection:t,userId:n})=>({data:Gm((await Wm(t,e.debug.enabled).get(`/v3/Users/${n}`)).data)}),examplePayload:Ch});var Xh={connection:nh,$filter:(0,$.input)({...ah,comments:`${ah.comments} See [Karbon API documentation](https://karbonhq.github.io/karbon-api-reference/#get-/v3/Users) for more information.`}),$top:ih,$skip:sh,getAllData:ch},Zh={createUser:qh,listUsers:(0,$.action)({display:{label:`List Users`,description:`Get a list of Users`},inputs:{...Xh},perform:async(e,{connection:t,$filter:n,$top:r,$skip:i,getAllData:a})=>{let o=Wm(t,e.debug.enabled);return{data:await Zm({pagination:{$top:r,$skip:i},client:o,endpoint:`/v3/Users`,getAllData:a,$filter:n})}},examplePayload:Sh}),getUser:Yh},Qh={connection:nh,assigneeEmailAddres:(0,$.input)({label:`Assignee Email Address`,type:`string`,comments:`The email address of the user to whom the Work Item is going to be assigned.`,required:!0,clean:qm,example:`example@email.com`,placeholder:`example@email.com`}),title:(0,$.input)({label:`Title`,type:`string`,comments:`The title of the Work Item.`,required:!0,clean:qm,example:`Work Item Title`,placeholder:`Work Item Title`}),clientKey:(0,$.input)({label:`Client Key`,type:`string`,comments:`A Karbon-generated value used to identify the existing Client (Contact, Organization or ClientGroup) for whom the Work Item is prepared.`,required:!0,clean:qm,example:`p56mtcBhwb9`,placeholder:`p56mtcBhwb9`}),clientType:(0,$.input)({label:`Client Type`,type:`string`,model:[`Contact`,`Organization`,`ClientGroup`].map(e=>({value:e,label:e})),comments:`The type of the Client.`,required:!0,example:`Organization`,clean:qm}),relatedClientGroupKey:(0,$.input)({label:`Related Client Group Key`,type:`string`,comments:`A Karbon-generated value used to identify the Client Group of the Client.`,clean:qm,example:`4f3gHnLC323`,required:!1,placeholder:`4f3gHnLC323`}),startDate:(0,$.input)({label:`Start Date`,type:`string`,comments:`The date and time at which the Work Item should start.`,required:!0,example:`2022-01-30`,placeholder:`2022-01-30`,clean:qm}),additionalFields:(0,$.input)({...rh,example:JSON.stringify({DueDate:`2022-01-30`,DeadlineDate:`2022-01-31`,WorkType:`Payroll`,WorkStatus:`Ready To Start - Send client requests`,WorkTemplateKey:`p56mtcBhwb9`,WorkScheduleKey:`4f3gHnLC323`,Description:`Send to Jo for review`,UserRoleAssignments:[{RoleKey:`2mYzTtly89Lq`,UserProfileKey:`2Qy48WVCRBcP`}],ClientTaskRecipient:{RecipientKey:`4ncPZ7q96SGc`,LinkType:`Organization`,EmailAddress:`acme@corp.com`},FeeSettings:{FeeType:`FixedFee`,FeeValue:5150.2}},null,2),comments:`${rh.comments} See [Karbon API documentation](https://karbonhq.github.io/karbon-api-reference/#post-/v3/WorkItems) for more information.`})};const $h=(0,$.action)({display:{label:`Create a Work Item`,description:`Create a new Work Item`},inputs:{...Qh},perform:async(e,{connection:t,assigneeEmailAddres:n,title:r,clientKey:i,clientType:a,relatedClientGroupKey:o,startDate:s,additionalFields:c})=>({data:Gm((await Wm(t,e.debug.enabled).post(`/v3/WorkItems`,{AssigneeEmailAddress:n,Title:r,ClientKey:i,ClientType:a,RelatedClientGroupKey:o,StartDate:s,...c||{}})).data)}),examplePayload:wh}),eg=(0,$.input)({label:`Work Item Key`,type:`string`,comments:`The Work Item key`,required:!0,clean:qm,example:`2LPSrkzbYrn4`,placeholder:`2LPSrkzbYrn4`,dataSource:`selectWorkItem`});var tg={connection:nh,workItemkey:(0,$.input)({...eg,comments:`${eg.comments} to get the Work Item for.`})};const ng=(0,$.action)({display:{label:`Get Work Item`,description:`Gets a Work Item by Work Item key`},inputs:{...tg},perform:async(e,{connection:t,workItemkey:n})=>({data:Gm((await Wm(t,e.debug.enabled).get(`/v3/WorkItems/${n}`)).data)}),examplePayload:Th});var rg={connection:nh,$filter:(0,$.input)({...ah,comments:`${ah.comments} See [Karbon API documentation](https://karbonhq.github.io/karbon-api-reference/#get-/v3/WorkItems) for more information.`}),$top:ih,$skip:sh,$orderby:(0,$.input)({...oh,model:[{value:`StartDate`,label:`Start Date`},{value:`StartDate desc`,label:`Start Date Descending`},{value:`DeadlineDate`,label:`Deadline Date`},{value:`DeadlineDate desc`,label:`Deadline Date Descending`}]}),getAllData:ch};const ig=(0,$.action)({display:{label:`List Work Items`,description:`Receive a list of work items from your tenant`},inputs:{...rg},perform:async(e,{connection:t,$filter:n,$top:r,$skip:i,$orderby:a,getAllData:o})=>{let s=Wm(t,e.debug.enabled);return{data:await Zm({pagination:{$top:r,$skip:i},client:s,endpoint:`/v3/WorkItems`,getAllData:o,$filter:n,$orderby:a})}},examplePayload:yh}),ag=(0,$.input)({label:`Description`,type:`string`,comments:`A free form text field to add more information about the Work Item`,required:!1,example:`This is a description.`,placeholder:`This is a description.`,clean:qm}),og=(0,$.input)({label:`Deadline Date`,type:`string`,comments:`The deadline of the workitem as ISO8601 formated datestamp or timestamp`,required:!1,example:`2022-01-30`,placeholder:`2022-01-30`,clean:qm});var sg={connection:nh,workItemkey:(0,$.input)({...eg,comments:`${eg.comments} to update a Work Item by.`}),description:ag,deadlineDate:og},cg={listWorkItems:ig,createWorkItem:$h,getWorkItem:ng,updateWorkItem:(0,$.action)({display:{label:`Update Work Item`,description:`Partially update a Work Item by Work Item key`},inputs:{...sg},perform:async(e,{connection:t,workItemkey:n,description:r,deadlineDate:i})=>(await Wm(t,e.debug.enabled).patch(`/v3/WorkItems/${n}`,{Description:r,DeadlineDate:i}),{data:Vm}),examplePayload:Eh})};const{debugRequest:lg,...ug}=Rm.inputs;var dg={rawRequest:(0,$.action)({display:{label:`Raw Request`,description:`Send raw HTTP request to Karbon`},perform:async(e,{connection:t,...n})=>{Km(t);let{applicationId:r,accessKey:i}=Xm(t),{data:a,headers:o}=await(0,Rm.sendRawRequest)(Bm,{...n,debugRequest:e.debug.enabled},{AccessKey:i,Authorization:`Bearer ${r}`});return{data:{data:Gm(a),headers:o}}},inputs:{connection:nh,...ug,url:{...ug.url,comments:`Input the path only (/v3/ClientGroups), The base URL is already included (${Bm}). For example, to connect to ${Bm}/v3/ClientGroups, only /v3/ClientGroups is entered in this field.`,example:`/v3/ClientGroups`,placeholder:`/v3/ClientGroups`}}})},fg={connection:nh};const pg=(0,$.action)({display:{label:`Delete All Webhook Subscriptions`,description:`Deletes all Webhook Subscriptions associated with Contact, Work, and Note`},inputs:{...fg},perform:async(e,{connection:t})=>(await Wm(t,e.debug.enabled).delete(`/v3/WebhookSubscriptions`),{data:Vm}),examplePayload:Dh});var mg={connection:nh,webhookType:lh},hg={deleteAllWebhookSubscriptions:pg,getWebhook:(0,$.action)({display:{label:`Get Webhook`,description:`Get a webhook subscription associated with the Karbon entity specified`},inputs:{...mg},perform:async(e,{connection:t,webhookType:n})=>{let{data:r}=await Wm(t,e.debug.enabled).get(`/v3/WebhookSubscriptions/${n}`);return{data:Gm(r)}},examplePayload:Oh})},gg={...Bh,...Gh,...Zh,...cg,...dg,...hg},_g={selectOrganization:(0,$.dataSource)({display:{label:`Select Organization`,description:`Select an Organization from a dropdown menu`},inputs:{connection:nh},dataSourceType:`picklist`,perform:async(e,{connection:t})=>({result:((await Zm({client:Wm(t,!1),endpoint:`/v3/Organizations/`,getAllData:!0,pagination:{}})).value||[]).map(e=>({key:e.OrganizationKey,label:e.FullName}))})})},vg={selectContact:(0,$.dataSource)({display:{label:`Select Contact`,description:`Select a Contact from a dropdown menu`},inputs:{connection:nh},dataSourceType:`picklist`,perform:async(e,{connection:t})=>({result:((await Zm({client:Wm(t,!1),endpoint:`/v3/Contacts`,getAllData:!0,pagination:{}})).value||[]).map(e=>({key:e.ContactKey,label:`${e.FullName||`No Name`} ${e.EmailAddress||``}`}))})})},yg={selectInvoice:(0,$.dataSource)({display:{label:`Select Invoice`,description:`Select an Invoice from a dropdown menu`},inputs:{connection:nh},dataSourceType:`picklist`,perform:async(e,{connection:t})=>({result:(Gm((await Wm(t,!1).get(`/v3/Invoices`)).data).value||[]).map(e=>({key:e.InvoiceKey,label:e.InvoiceNumber}))})})},bg={selectUser:(0,$.dataSource)({display:{label:`Select User`,description:`Select a User from a dropdown menu`},inputs:{connection:nh},dataSourceType:`picklist`,perform:async(e,{connection:t})=>({result:((await Zm({client:Wm(t,!1),endpoint:`/v3/Users`,getAllData:!0,pagination:{}})).value||[]).map(e=>({key:e.Id,label:`${e.Name} ${e.EmailAddress}`}))})})},xg={selectWorkItem:(0,$.dataSource)({display:{label:`Select Work Item`,description:`Select a Work Item from a dropdown menu`},inputs:{connection:nh},dataSourceType:`picklist`,perform:async(e,{connection:t})=>({result:((await Zm({client:Wm(t,!1),endpoint:`/v3/WorkItems`,getAllData:!0,pagination:{}})).value||[]).map(e=>({key:e.WorkItemKey,label:e.Title}))})})},Sg={..._g,...vg,...yg,...bg,...xg},Cg={connection:nh,webhookType:lh};const wg=(0,$.trigger)({display:{label:`Entity Trigger`,description:`Get notified to this flow when a Karbon entity changes`},allowsBranching:!1,inputs:{...Cg},synchronousResponseSupport:`invalid`,scheduleSupport:`invalid`,perform:async(e,t)=>Promise.resolve({payload:t}),webhookLifecycleHandlers:{create:async(e,{connection:t,webhookType:n})=>{let r=e.webhookUrls[e.flow.name];await Qm(t,!1,r,n)},delete:async(e,{connection:t,webhookType:n})=>{await $m(t,!1,n)}}}),Tg=e=>{let t=$.util.types.toString(e).trim();if(!t)return``;if(!Um.test(t))throw Error(`Look-back Date must be in YYYY-MM-DD format.`);let n=t.split(`-`),r=$.util.types.toNumber(n[0]),i=$.util.types.toNumber(n[1]),a=$.util.types.toNumber(n[2]),o=new Date(r,i-1,a);if(o.getFullYear()!==r||o.getMonth()!==i-1||o.getDate()!==a)throw Error(`Look-back Date "${t}" is not a valid calendar date.`);if(o>new Date)throw Error(`Look-back Date cannot be a future date.`);return t},Eg=e=>{if(!e)return[];let t=[];for(let n of e.updated??[])t.push({changeType:`updated`,record:n});return t};var Dg={connection:nh,pollResourceType:(0,$.input)({label:`Resource Type`,type:`string`,required:!0,default:`Contacts`,model:eh,comments:`The type of Karbon resource to poll for updated records.`,clean:$.util.types.toString}),lookBackDate:(0,$.input)({label:`Look-back Date`,placeholder:`Enter look-back date (YYYY-MM-DD)`,type:`string`,required:!1,comments:`The date the initial sync starts from, in YYYY-MM-DD format. Cannot be a future date. Leave empty to start from the first recurrence with no backfill. When set, the initial sync seeds each record modified on or after this date once.`,example:`2026-01-01`,clean:Tg})},Og={entityTrigger:wg,pollChangesTrigger:(0,$.pollingTrigger)({display:{label:`Updated Records`,description:`Retrieves existing and ongoing updated records from Karbon. Load history once, check for changes on a schedule, or both.`},inputs:Dg,triggerResolverSupport:`valid`,batchConfig:{batchSize:50},triggerResolver:{resolveItems:(e,{payload:t})=>Eg(t.body.data)},perform:async(e,t,n)=>{let r=Hm[n.pollResourceType];if(!r)throw Error(`Unsupported resource type: ${n.pollResourceType}`);let i=e.polling.getState(),a=new Date().toISOString(),o=i?.lastPolledAt??(n.lookBackDate?new Date(n.lookBackDate).toISOString():a),s=await Zm({client:Wm(n.connection,e.debug.enabled),endpoint:r.endpoint,getAllData:!0,pagination:{}}),c=th(s.value??[],r.timestampField,o);return e.polling.setState({lastPolledAt:a}),e.debug.enabled&&e.logger.debug(`Polled Karbon ${n.pollResourceType}: ${(s.value??[]).length} fetched, ${c.length} changed`),{payload:{...t,body:{data:{updated:c}}},polledNoChanges:c.length===0}}})},kg=(0,$.component)({key:`karbon`,public:!0,documentationUrl:`https://prismatic.io/docs/components/karbon/`,display:{label:`Karbon`,description:`Manage contacts, work items, and users, and retrieve invoices in the Karbon accounting practice management platform.`,iconPath:`icon.png`,category:`Application Connectors`},hooks:{error:Rm.handleErrors},actions:gg,connections:zm,dataSources:Sg,triggers:Og});exports.default=kg;
|
package/npm-dist/index.cjs
CHANGED
|
@@ -1647,7 +1647,7 @@ var src_default = (0, _prismatic_io_spectral.component)({
|
|
|
1647
1647
|
documentationUrl: "https://prismatic.io/docs/components/karbon/",
|
|
1648
1648
|
display: {
|
|
1649
1649
|
label: "Karbon",
|
|
1650
|
-
description: "
|
|
1650
|
+
description: "Manage contacts, work items, and users, and retrieve invoices in the Karbon accounting practice management platform.",
|
|
1651
1651
|
iconPath: "icon.png",
|
|
1652
1652
|
category: "Application Connectors"
|
|
1653
1653
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismatic-io/components-karbon",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"main": "./npm-dist/index.cjs",
|
|
5
5
|
"types": "./npm-dist/index.d.cts",
|
|
6
6
|
"exports": {
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"tsdown": "0.22.3",
|
|
48
48
|
"typescript": "6.0.3",
|
|
49
49
|
"vitest": "^5.0.4",
|
|
50
|
-
"@prismatic-io/spectral": "^10.39.1"
|
|
50
|
+
"@prismatic-io/spectral": "^10.39.1",
|
|
51
|
+
"build-config": "file:../../packages/build-config"
|
|
51
52
|
}
|
|
52
53
|
}
|