@activepieces/piece-pipedrive 0.8.10 → 0.8.11
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/package.json +1 -1
- package/src/index.js +3 -3
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var Wc=Object.create;var jt=Object.defineProperty;var Kc=Object.getOwnPropertyDescriptor;var Jc=Object.getOwnPropertyNames;var Yc=Object.getPrototypeOf,Xc=Object.prototype.hasOwnProperty;var o=(e,t)=>jt(e,"name",{value:t,configurable:!0});var U=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},yi=(e,t)=>{for(var r in t)jt(e,r,{get:t[r],enumerable:!0})},hi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Jc(t))!Xc.call(e,i)&&i!==r&&jt(e,i,{get:()=>t[i],enumerable:!(n=Kc(t,i))||n.enumerable});return e};var $e=(e,t,r)=>(r=e!=null?Wc(Yc(e)):{},hi(t||!e||!e.__esModule?jt(r,"default",{value:e,enumerable:!0}):r,e)),Qc=e=>hi(jt({},"__esModule",{value:!0}),e);var Bo=U((Vo,Rr)=>{(function(e){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",u="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${u})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${u})|(?:::)(?:${u})?)${t}\\.${t}\\.${t}\\.${t}(${a})?$`,"i")};function d(l,p){if(l.indexOf("::")!==l.lastIndexOf("::"))return null;let _=0,m=-1,P=(l.match(c.zoneIndex)||[])[0],T,k;for(P&&(P=P.substring(1),l=l.replace(/%.+$/,""));(m=l.indexOf(":",m+1))>=0;)_++;if(l.substr(0,2)==="::"&&_--,l.substr(-2,2)==="::"&&_--,_>p)return null;for(k=p-_,T=":";k--;)T+="0:";return l=l.replace("::",T),l[0]===":"&&(l=l.slice(1)),l[l.length-1]===":"&&(l=l.slice(0,-1)),p=(function(){let ne=l.split(":"),ve=[];for(let ke=0;ke<ne.length;ke++)ve.push(parseInt(ne[ke],16));return ve})(),{parts:p,zoneId:P}}o(d,"expandIPv6");function g(l,p,_,m){if(l.length!==p.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let P=0,T;for(;m>0;){if(T=_-m,T<0&&(T=0),l[P]>>T!==p[P]>>T)return!1;m-=_,P+=1}return!0}o(g,"matchCIDR");function h(l){if(i.test(l))return parseInt(l,16);if(l[0]==="0"&&!isNaN(parseInt(l[1],10))){if(n.test(l))return parseInt(l,8);throw new Error(`ipaddr: cannot parse ${l} as octal`)}return parseInt(l,10)}o(h,"parseIntAuto");function I(l,p){for(;l.length<p;)l=`0${l}`;return l}o(I,"padPart");let b={};b.IPv4=(function(){function l(p){if(p.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let _,m;for(_=0;_<p.length;_++)if(m=p[_],!(0<=m&&m<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=p}return o(l,"IPv4"),l.prototype.SpecialRanges={unspecified:[[new l([0,0,0,0]),8]],broadcast:[[new l([255,255,255,255]),32]],multicast:[[new l([224,0,0,0]),4]],linkLocal:[[new l([169,254,0,0]),16]],loopback:[[new l([127,0,0,0]),8]],carrierGradeNat:[[new l([100,64,0,0]),10]],private:[[new l([10,0,0,0]),8],[new l([172,16,0,0]),12],[new l([192,168,0,0]),16]],reserved:[[new l([192,0,0,0]),24],[new l([192,0,2,0]),24],[new l([192,88,99,0]),24],[new l([198,18,0,0]),15],[new l([198,51,100,0]),24],[new l([203,0,113,0]),24],[new l([240,0,0,0]),4]],as112:[[new l([192,175,48,0]),24],[new l([192,31,196,0]),24]],amt:[[new l([192,52,193,0]),24]]},l.prototype.kind=function(){return"ipv4"},l.prototype.match=function(p,_){let m;if(_===void 0&&(m=p,p=m[0],_=m[1]),p.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return g(this.octets,p.octets,8,_)},l.prototype.prefixLengthFromSubnetMask=function(){let p=0,_=!1,m={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},P,T,k;for(P=3;P>=0;P-=1)if(T=this.octets[P],T in m){if(k=m[T],_&&k!==0)return null;k!==8&&(_=!0),p+=k}else return null;return 32-p},l.prototype.range=function(){return b.subnetMatch(this,this.SpecialRanges)},l.prototype.toByteArray=function(){return this.octets.slice(0)},l.prototype.toIPv4MappedAddress=function(){return b.IPv6.parse(`::ffff:${this.toString()}`)},l.prototype.toNormalizedString=function(){return this.toString()},l.prototype.toString=function(){return this.octets.join(".")},l})(),b.IPv4.broadcastAddressFromCIDR=function(l){try{let p=this.parseCIDR(l),_=p[0].toByteArray(),m=this.subnetMaskFromPrefixLength(p[1]).toByteArray(),P=[],T=0;for(;T<4;)P.push(parseInt(_[T],10)|parseInt(m[T],10)^255),T++;return new this(P)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},b.IPv4.isIPv4=function(l){return this.parser(l)!==null},b.IPv4.isValid=function(l){try{return new this(this.parser(l)),!0}catch{return!1}},b.IPv4.isValidCIDR=function(l){try{return this.parseCIDR(l),!0}catch{return!1}},b.IPv4.isValidFourPartDecimal=function(l){return!!(b.IPv4.isValid(l)&&l.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},b.IPv4.isValidCIDRFourPartDecimal=function(l){let p=l.match(/^(.+)\/(\d+)$/);return!b.IPv4.isValidCIDR(l)||!p?!1:b.IPv4.isValidFourPartDecimal(p[1])},b.IPv4.networkAddressFromCIDR=function(l){let p,_,m,P,T;try{for(p=this.parseCIDR(l),m=p[0].toByteArray(),T=this.subnetMaskFromPrefixLength(p[1]).toByteArray(),P=[],_=0;_<4;)P.push(parseInt(m[_],10)&parseInt(T[_],10)),_++;return new this(P)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},b.IPv4.parse=function(l){let p=this.parser(l);if(p===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(p)},b.IPv4.parseCIDR=function(l){let p;if(p=l.match(/^(.+)\/(\d+)$/)){let _=parseInt(p[2]);if(_>=0&&_<=32){let m=[this.parse(p[1]),_];return Object.defineProperty(m,"toString",{value:o(function(){return this.join("/")},"value")}),m}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},b.IPv4.parser=function(l){let p,_,m;if(p=l.match(r.fourOctet))return(function(){let P=p.slice(1,6),T=[];for(let k=0;k<P.length;k++)_=P[k],T.push(h(_));return T})();if(p=l.match(r.longValue)){if(m=h(p[1]),m>4294967295||m<0)throw new Error("ipaddr: address outside defined range");return(function(){let P=[],T;for(T=0;T<=24;T+=8)P.push(m>>T&255);return P})().reverse()}else return(p=l.match(r.twoOctet))?(function(){let P=p.slice(1,4),T=[];if(m=h(P[1]),m>16777215||m<0)throw new Error("ipaddr: address outside defined range");return T.push(h(P[0])),T.push(m>>16&255),T.push(m>>8&255),T.push(m&255),T})():(p=l.match(r.threeOctet))?(function(){let P=p.slice(1,5),T=[];if(m=h(P[2]),m>65535||m<0)throw new Error("ipaddr: address outside defined range");return T.push(h(P[0])),T.push(h(P[1])),T.push(m>>8&255),T.push(m&255),T})():null},b.IPv4.subnetMaskFromPrefixLength=function(l){if(l=parseInt(l),l<0||l>32)throw new Error("ipaddr: invalid IPv4 prefix length");let p=[0,0,0,0],_=0,m=Math.floor(l/8);for(;_<m;)p[_]=255,_++;return m<4&&(p[m]=Math.pow(2,l%8)-1<<8-l%8),new this(p)},b.IPv6=(function(){function l(p,_){let m,P;if(p.length===16)for(this.parts=[],m=0;m<=14;m+=2)this.parts.push(p[m]<<8|p[m+1]);else if(p.length===8)this.parts=p;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(m=0;m<this.parts.length;m++)if(P=this.parts[m],!(0<=P&&P<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");_&&(this.zoneId=_)}return o(l,"IPv6"),l.prototype.SpecialRanges={unspecified:[new l([0,0,0,0,0,0,0,0]),128],linkLocal:[new l([65152,0,0,0,0,0,0,0]),10],multicast:[new l([65280,0,0,0,0,0,0,0]),8],loopback:[new l([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new l([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new l([0,0,0,0,0,65535,0,0]),96],discard:[new l([256,0,0,0,0,0,0,0]),64],rfc6145:[new l([0,0,0,0,65535,0,0,0]),96],rfc6052:[new l([100,65435,0,0,0,0,0,0]),96],"6to4":[new l([8194,0,0,0,0,0,0,0]),16],teredo:[new l([8193,0,0,0,0,0,0,0]),32],benchmarking:[new l([8193,2,0,0,0,0,0,0]),48],amt:[new l([8193,3,0,0,0,0,0,0]),32],as112v6:[[new l([8193,4,274,0,0,0,0,0]),48],[new l([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new l([8193,16,0,0,0,0,0,0]),28],orchid2:[new l([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new l([8193,48,0,0,0,0,0,0]),28],reserved:[[new l([8193,0,0,0,0,0,0,0]),23],[new l([8193,3512,0,0,0,0,0,0]),32]]},l.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},l.prototype.kind=function(){return"ipv6"},l.prototype.match=function(p,_){let m;if(_===void 0&&(m=p,p=m[0],_=m[1]),p.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return g(this.parts,p.parts,16,_)},l.prototype.prefixLengthFromSubnetMask=function(){let p=0,_=!1,m={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},P,T;for(let k=7;k>=0;k-=1)if(P=this.parts[k],P in m){if(T=m[P],_&&T!==0)return null;T!==16&&(_=!0),p+=T}else return null;return 128-p},l.prototype.range=function(){return b.subnetMatch(this,this.SpecialRanges)},l.prototype.toByteArray=function(){let p,_=[],m=this.parts;for(let P=0;P<m.length;P++)p=m[P],_.push(p>>8),_.push(p&255);return _},l.prototype.toFixedLengthString=function(){let p=(function(){let m=[];for(let P=0;P<this.parts.length;P++)m.push(I(this.parts[P].toString(16),4));return m}).call(this).join(":"),_="";return this.zoneId&&(_=`%${this.zoneId}`),p+_},l.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let p=this.parts.slice(-2),_=p[0],m=p[1];return new b.IPv4([_>>8,_&255,m>>8,m&255])},l.prototype.toNormalizedString=function(){let p=(function(){let m=[];for(let P=0;P<this.parts.length;P++)m.push(this.parts[P].toString(16));return m}).call(this).join(":"),_="";return this.zoneId&&(_=`%${this.zoneId}`),p+_},l.prototype.toRFC5952String=function(){let p=/((^|:)(0(:|$)){2,})/g,_=this.toNormalizedString(),m=0,P=-1,T;for(;T=p.exec(_);)T[0].length>P&&(m=T.index,P=T[0].length);return P<0?_:`${_.substring(0,m)}::${_.substring(m+P)}`},l.prototype.toString=function(){return this.toRFC5952String()},l})(),b.IPv6.broadcastAddressFromCIDR=function(l){try{let p=this.parseCIDR(l),_=p[0].toByteArray(),m=this.subnetMaskFromPrefixLength(p[1]).toByteArray(),P=[],T=0;for(;T<16;)P.push(parseInt(_[T],10)|parseInt(m[T],10)^255),T++;return new this(P)}catch(p){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${p})`)}},b.IPv6.isIPv6=function(l){return this.parser(l)!==null},b.IPv6.isValid=function(l){if(typeof l=="string"&&l.indexOf(":")===-1)return!1;try{let p=this.parser(l);return new this(p.parts,p.zoneId),!0}catch{return!1}},b.IPv6.isValidCIDR=function(l){if(typeof l=="string"&&l.indexOf(":")===-1)return!1;try{return this.parseCIDR(l),!0}catch{return!1}},b.IPv6.networkAddressFromCIDR=function(l){let p,_,m,P,T;try{for(p=this.parseCIDR(l),m=p[0].toByteArray(),T=this.subnetMaskFromPrefixLength(p[1]).toByteArray(),P=[],_=0;_<16;)P.push(parseInt(m[_],10)&parseInt(T[_],10)),_++;return new this(P)}catch(k){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${k})`)}},b.IPv6.parse=function(l){let p=this.parser(l);if(p.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(p.parts,p.zoneId)},b.IPv6.parseCIDR=function(l){let p,_,m;if((_=l.match(/^(.+)\/(\d+)$/))&&(p=parseInt(_[2]),p>=0&&p<=128))return m=[this.parse(_[1]),p],Object.defineProperty(m,"toString",{value:o(function(){return this.join("/")},"value")}),m;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},b.IPv6.parser=function(l){let p,_,m,P,T,k;if(m=l.match(c.deprecatedTransitional))return this.parser(`::ffff:${m[1]}`);if(c.native.test(l))return d(l,8);if((m=l.match(c.transitional))&&(k=m[6]||"",p=m[1],m[1].endsWith("::")||(p=p.slice(0,-1)),p=d(p+k,6),p.parts)){for(T=[parseInt(m[2]),parseInt(m[3]),parseInt(m[4]),parseInt(m[5])],_=0;_<T.length;_++)if(P=T[_],!(0<=P&&P<=255))return null;return p.parts.push(T[0]<<8|T[1]),p.parts.push(T[2]<<8|T[3]),{parts:p.parts,zoneId:p.zoneId}}return null},b.IPv6.subnetMaskFromPrefixLength=function(l){if(l=parseInt(l),l<0||l>128)throw new Error("ipaddr: invalid IPv6 prefix length");let p=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],_=0,m=Math.floor(l/8);for(;_<m;)p[_]=255,_++;return m<16&&(p[m]=Math.pow(2,l%8)-1<<8-l%8),new this(p)},b.fromByteArray=function(l){let p=l.length;if(p===4)return new b.IPv4(l);if(p===16)return new b.IPv6(l);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},b.isValid=function(l){return b.IPv6.isValid(l)||b.IPv4.isValid(l)},b.isValidCIDR=function(l){return b.IPv6.isValidCIDR(l)||b.IPv4.isValidCIDR(l)},b.parse=function(l){if(b.IPv6.isValid(l))return b.IPv6.parse(l);if(b.IPv4.isValid(l))return b.IPv4.parse(l);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},b.parseCIDR=function(l){try{return b.IPv6.parseCIDR(l)}catch{try{return b.IPv4.parseCIDR(l)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},b.process=function(l){let p=this.parse(l);return p.kind()==="ipv6"&&p.isIPv4MappedAddress()?p.toIPv4Address():p},b.subnetMatch=function(l,p,_){let m,P,T,k;_==null&&(_="unicast");for(P in p)if(Object.prototype.hasOwnProperty.call(p,P)){for(T=p[P],T[0]&&!(T[0]instanceof Array)&&(T=[T]),m=0;m<T.length;m++)if(k=T[m],l.kind()===k[0].kind()&&l.match.apply(l,k))return P}return _},typeof Rr<"u"&&Rr.exports?Rr.exports=b:e.ipaddr=b})(Vo)});var qa=U((Nz,Ha)=>{var Ga=require("stream").Stream,Up=require("util");Ha.exports=Le;function Le(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}o(Le,"DelayedStream");Up.inherits(Le,Ga);Le.create=function(e,t){var r=new this;t=t||{};for(var n in t)r[n]=t[n];r.source=e;var i=e.emit;return e.emit=function(){return r._handleEmit(arguments),i.apply(e,arguments)},e.on("error",function(){}),r.pauseStream&&e.pause(),r};Object.defineProperty(Le.prototype,"readable",{configurable:!0,enumerable:!0,get:o(function(){return this.source.readable},"get")});Le.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};Le.prototype.resume=function(){this._released||this.release(),this.source.resume()};Le.prototype.pause=function(){this.source.pause()};Le.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]};Le.prototype.pipe=function(){var e=Ga.prototype.pipe.apply(this,arguments);return this.resume(),e};Le.prototype._handleEmit=function(e){if(this._released){this.emit.apply(this,e);return}e[0]==="data"&&(this.dataSize+=e[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(e)};Le.prototype._checkIfMaxDataSizeExceeded=function(){if(!this._maxDataSizeExceeded&&!(this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(e))}}});var Ya=U((Uz,Ja)=>{var Mp=require("util"),Ka=require("stream").Stream,Wa=qa();Ja.exports=pe;function pe(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2*1024*1024,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}o(pe,"CombinedStream");Mp.inherits(pe,Ka);pe.create=function(e){var t=new this;e=e||{};for(var r in e)t[r]=e[r];return t};pe.isStreamLike=function(e){return typeof e!="function"&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"&&!Buffer.isBuffer(e)};pe.prototype.append=function(e){var t=pe.isStreamLike(e);if(t){if(!(e instanceof Wa)){var r=Wa.create(e,{maxDataSize:1/0,pauseStream:this.pauseStreams});e.on("data",this._checkDataSize.bind(this)),e=r}this._handleErrors(e),this.pauseStreams&&e.pause()}return this._streams.push(e),this};pe.prototype.pipe=function(e,t){return Ka.prototype.pipe.call(this,e,t),this.resume(),e};pe.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop){this._pendingNext=!0;return}this._insideLoop=!0;try{do this._pendingNext=!1,this._realGetNext();while(this._pendingNext)}finally{this._insideLoop=!1}};pe.prototype._realGetNext=function(){var e=this._streams.shift();if(typeof e>"u"){this.end();return}if(typeof e!="function"){this._pipeNext(e);return}var t=e;t(function(r){var n=pe.isStreamLike(r);n&&(r.on("data",this._checkDataSize.bind(this)),this._handleErrors(r)),this._pipeNext(r)}.bind(this))};pe.prototype._pipeNext=function(e){this._currentStream=e;var t=pe.isStreamLike(e);if(t){e.on("end",this._getNext.bind(this)),e.pipe(this,{end:!1});return}var r=e;this.write(r),this._getNext()};pe.prototype._handleErrors=function(e){var t=this;e.on("error",function(r){t._emitError(r)})};pe.prototype.write=function(e){this.emit("data",e)};pe.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function"&&this._currentStream.pause(),this.emit("pause"))};pe.prototype.resume=function(){this._released||(this._released=!0,this.writable=!0,this._getNext()),this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function"&&this._currentStream.resume(),this.emit("resume")};pe.prototype.end=function(){this._reset(),this.emit("end")};pe.prototype.destroy=function(){this._reset(),this.emit("close")};pe.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};pe.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(e))}};pe.prototype._updateDataSize=function(){this.dataSize=0;var e=this;this._streams.forEach(function(t){t.dataSize&&(e.dataSize+=t.dataSize)}),this._currentStream&&this._currentStream.dataSize&&(this.dataSize+=this._currentStream.dataSize)};pe.prototype._emitError=function(e){this._reset(),this.emit("error",e)}});var Qa=U((Lz,Xa)=>{"use strict";Xa.exports={"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dat"]},"application/msword":{source:"iana",extensions:["doc"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",extensions:["docx"]},"application/vnd.ms-excel":{source:"iana",extensions:["xls"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",extensions:["xlsx"]},"application/vnd.ms-powerpoint":{source:"iana",extensions:["ppt"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",extensions:["pptx"]},"application/csv":{compressible:!0,extensions:["csv"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"text/plain":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["txt","text","log"]},"text/html":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["html","htm"]},"text/css":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["css"]},"text/csv":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["csv"]},"text/markdown":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["md","markdown"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/webp":{source:"apache",compressible:!1,extensions:["webp"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tiff","tif"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/heic":{source:"iana",compressible:!1,extensions:["heic"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mp3","mpga"]},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/ogg":{source:"iana",compressible:!1,extensions:["ogg","oga"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","m4v"]},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg"]},"video/webm":{source:"iana",compressible:!1,extensions:["webm"]},"video/quicktime":{source:"iana",compressible:!1,extensions:["mov","qt"]},"video/x-msvideo":{source:"iana",compressible:!1,extensions:["avi"]},"font/woff":{source:"iana",compressible:!1,extensions:["woff"]},"font/woff2":{source:"iana",compressible:!1,extensions:["woff2"]},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"multipart/form-data":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/ics":{compressible:!0,extensions:["ics"]},"text/calendar":{source:"iana",compressible:!0,extensions:["ics","ifb"]},"application/x-ndjson":{compressible:!0,extensions:["ndjson"]}}});var rs=U(ze=>{"use strict";var Lr=Qa(),Lp=require("path").extname,es=/^\s*([^;\s]*)(?:;|\s|$)/,Fp=/^text\//i;ze.charset=ts;ze.charsets={lookup:ts};ze.contentType=jp;ze.extension=Vp;ze.extensions=Object.create(null);ze.lookup=Bp;ze.types=Object.create(null);Zp(ze.extensions,ze.types);function ts(e){if(!e||typeof e!="string")return!1;var t=es.exec(e),r=t&&Lr[t[1].toLowerCase()];return r&&r.charset?r.charset:t&&Fp.test(t[1])?"UTF-8":!1}o(ts,"charset");function jp(e){if(!e||typeof e!="string")return!1;var t=e.indexOf("/")===-1?ze.lookup(e):e;if(!t)return!1;if(t.indexOf("charset")===-1){var r=ze.charset(t);r&&(t+="; charset="+r.toLowerCase())}return t}o(jp,"contentType");function Vp(e){if(!e||typeof e!="string")return!1;var t=es.exec(e),r=t&&ze.extensions[t[1].toLowerCase()];return!r||!r.length?!1:r[0]}o(Vp,"extension");function Bp(e){if(!e||typeof e!="string")return!1;var t=Lp("x."+e).toLowerCase().substr(1);return t&&ze.types[t]||!1}o(Bp,"lookup");function Zp(e,t){var r=["nginx","apache",void 0,"iana"];Object.keys(Lr).forEach(o(function(i){var a=Lr[i],u=a.extensions;if(!(!u||!u.length)){e[i]=u;for(var c=0;c<u.length;c++){var d=u[c];if(t[d]){var g=r.indexOf(Lr[t[d]].source),h=r.indexOf(a.source);if(t[d]!=="application/octet-stream"&&(g>h||g===h&&t[d].substr(0,12)==="application/"))continue}t[d]=i}}},"forEachMimeType"))}o(Zp,"populateMaps")});var is=U((Vz,ns)=>{ns.exports=Gp;function Gp(e){var t=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;t?t(e):setTimeout(e,0)}o(Gp,"defer")});var Vn=U((Zz,as)=>{var os=is();as.exports=Hp;function Hp(e){var t=!1;return os(function(){t=!0}),o(function(n,i){t?e(n,i):os(o(function(){e(n,i)},"nextTick_callback"))},"async_callback")}o(Hp,"async")});var Bn=U((Hz,ss)=>{ss.exports=qp;function qp(e){Object.keys(e.jobs).forEach(Wp.bind(e)),e.jobs={}}o(qp,"abort");function Wp(e){typeof this.jobs[e]=="function"&&this.jobs[e]()}o(Wp,"clean")});var Zn=U((Wz,cs)=>{var us=Vn(),Kp=Bn();cs.exports=Jp;function Jp(e,t,r,n){var i=r.keyedList?r.keyedList[r.index]:r.index;r.jobs[i]=Yp(t,i,e[i],function(a,u){i in r.jobs&&(delete r.jobs[i],a?Kp(r):r.results[i]=u,n(a,r.results))})}o(Jp,"iterate");function Yp(e,t,r,n){var i;return e.length==2?i=e(r,us(n)):i=e(r,t,us(n)),i}o(Yp,"runJob")});var Gn=U((Jz,ls)=>{ls.exports=Xp;function Xp(e,t){var r=!Array.isArray(e),n={index:0,keyedList:r||t?Object.keys(e):null,jobs:{},results:r?{}:[],size:r?Object.keys(e).length:e.length};return t&&n.keyedList.sort(r?t:function(i,a){return t(e[i],e[a])}),n}o(Xp,"state")});var Hn=U((Xz,ds)=>{var Qp=Bn(),em=Vn();ds.exports=tm;function tm(e){Object.keys(this.jobs).length&&(this.index=this.size,Qp(this),em(e)(null,this.results))}o(tm,"terminator")});var ms=U((ek,ps)=>{var rm=Zn(),nm=Gn(),im=Hn();ps.exports=om;function om(e,t,r){for(var n=nm(e);n.index<(n.keyedList||e).length;)rm(e,t,n,function(i,a){if(i){r(i,a);return}if(Object.keys(n.jobs).length===0){r(null,n.results);return}}),n.index++;return im.bind(n,r)}o(om,"parallel")});var qn=U((rk,Fr)=>{var fs=Zn(),am=Gn(),sm=Hn();Fr.exports=um;Fr.exports.ascending=gs;Fr.exports.descending=cm;function um(e,t,r,n){var i=am(e,r);return fs(e,t,i,o(function a(u,c){if(u){n(u,c);return}if(i.index++,i.index<(i.keyedList||e).length){fs(e,t,i,a);return}n(null,i.results)},"iteratorHandler")),sm.bind(i,n)}o(um,"serialOrdered");function gs(e,t){return e<t?-1:e>t?1:0}o(gs,"ascending");function cm(e,t){return-1*gs(e,t)}o(cm,"descending")});var hs=U((ik,ys)=>{var lm=qn();ys.exports=dm;function dm(e,t,r){return lm(e,t,null,r)}o(dm,"serial")});var vs=U((ak,_s)=>{_s.exports={parallel:ms(),serial:hs(),serialOrdered:qn()}});var Wn=U((sk,bs)=>{"use strict";bs.exports=Object});var xs=U((uk,Ps)=>{"use strict";Ps.exports=Error});var Is=U((ck,Ts)=>{"use strict";Ts.exports=EvalError});var As=U((lk,Es)=>{"use strict";Es.exports=RangeError});var $s=U((dk,Ss)=>{"use strict";Ss.exports=ReferenceError});var zs=U((pk,ws)=>{"use strict";ws.exports=SyntaxError});var jr=U((mk,ks)=>{"use strict";ks.exports=TypeError});var Ds=U((fk,Os)=>{"use strict";Os.exports=URIError});var Ns=U((gk,Rs)=>{"use strict";Rs.exports=Math.abs});var Us=U((yk,Cs)=>{"use strict";Cs.exports=Math.floor});var Ls=U((hk,Ms)=>{"use strict";Ms.exports=Math.max});var js=U((_k,Fs)=>{"use strict";Fs.exports=Math.min});var Bs=U((vk,Vs)=>{"use strict";Vs.exports=Math.pow});var Gs=U((bk,Zs)=>{"use strict";Zs.exports=Math.round});var qs=U((Pk,Hs)=>{"use strict";Hs.exports=Number.isNaN||o(function(t){return t!==t},"isNaN")});var Ks=U((Tk,Ws)=>{"use strict";var pm=qs();Ws.exports=o(function(t){return pm(t)||t===0?t:t<0?-1:1},"sign")});var Ys=U((Ek,Js)=>{"use strict";Js.exports=Object.getOwnPropertyDescriptor});var Kn=U((Ak,Xs)=>{"use strict";var Vr=Ys();if(Vr)try{Vr([],"length")}catch{Vr=null}Xs.exports=Vr});var eu=U((Sk,Qs)=>{"use strict";var Br=Object.defineProperty||!1;if(Br)try{Br({},"a",{value:1})}catch{Br=!1}Qs.exports=Br});var Jn=U(($k,tu)=>{"use strict";tu.exports=o(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;t[r]=i;for(var a in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var u=Object.getOwnPropertySymbols(t);if(u.length!==1||u[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var c=Object.getOwnPropertyDescriptor(t,r);if(c.value!==i||c.enumerable!==!0)return!1}return!0},"hasSymbols")});var iu=U((zk,nu)=>{"use strict";var ru=typeof Symbol<"u"&&Symbol,mm=Jn();nu.exports=o(function(){return typeof ru!="function"||typeof Symbol!="function"||typeof ru("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:mm()},"hasNativeSymbols")});var Yn=U((Ok,ou)=>{"use strict";ou.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Xn=U((Dk,au)=>{"use strict";var fm=Wn();au.exports=fm.getPrototypeOf||null});var cu=U((Rk,uu)=>{"use strict";var gm="Function.prototype.bind called on incompatible ",ym=Object.prototype.toString,hm=Math.max,_m="[object Function]",su=o(function(t,r){for(var n=[],i=0;i<t.length;i+=1)n[i]=t[i];for(var a=0;a<r.length;a+=1)n[a+t.length]=r[a];return n},"concatty"),vm=o(function(t,r){for(var n=[],i=r||0,a=0;i<t.length;i+=1,a+=1)n[a]=t[i];return n},"slicy"),bm=o(function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r},"joiny");uu.exports=o(function(t){var r=this;if(typeof r!="function"||ym.apply(r)!==_m)throw new TypeError(gm+r);for(var n=vm(arguments,1),i,a=o(function(){if(this instanceof i){var h=r.apply(this,su(n,arguments));return Object(h)===h?h:this}return r.apply(t,su(n,arguments))},"binder"),u=hm(0,r.length-n.length),c=[],d=0;d<u;d++)c[d]="$"+d;if(i=Function("binder","return function ("+bm(c,",")+"){ return binder.apply(this,arguments); }")(a),r.prototype){var g=o(function(){},"Empty");g.prototype=r.prototype,i.prototype=new g,g.prototype=null}return i},"bind")});var Ot=U((Ck,lu)=>{"use strict";var Pm=cu();lu.exports=Function.prototype.bind||Pm});var Zr=U((Uk,du)=>{"use strict";du.exports=Function.prototype.call});var Qn=U((Mk,pu)=>{"use strict";pu.exports=Function.prototype.apply});var fu=U((Lk,mu)=>{"use strict";mu.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var yu=U((Fk,gu)=>{"use strict";var xm=Ot(),Tm=Qn(),Im=Zr(),Em=fu();gu.exports=Em||xm.call(Im,Tm)});var _u=U((jk,hu)=>{"use strict";var Am=Ot(),Sm=jr(),$m=Zr(),wm=yu();hu.exports=o(function(t){if(t.length<1||typeof t[0]!="function")throw new Sm("a function is required");return wm(Am,$m,t)},"callBindBasic")});var Iu=U((Bk,Tu)=>{"use strict";var zm=_u(),vu=Kn(),Pu;try{Pu=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var ei=!!Pu&&vu&&vu(Object.prototype,"__proto__"),xu=Object,bu=xu.getPrototypeOf;Tu.exports=ei&&typeof ei.get=="function"?zm([ei.get]):typeof bu=="function"?o(function(t){return bu(t==null?t:xu(t))},"getDunder"):!1});var wu=U((Gk,$u)=>{"use strict";var Eu=Yn(),Au=Xn(),Su=Iu();$u.exports=Eu?o(function(t){return Eu(t)},"getProto"):Au?o(function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return Au(t)},"getProto"):Su?o(function(t){return Su(t)},"getProto"):null});var ti=U((qk,zu)=>{"use strict";var km=Function.prototype.call,Om=Object.prototype.hasOwnProperty,Dm=Ot();zu.exports=Dm.call(km,Om)});var Uu=U((Wk,Cu)=>{"use strict";var Q,Rm=Wn(),Nm=xs(),Cm=Is(),Um=As(),Mm=$s(),Ct=zs(),Nt=jr(),Lm=Ds(),Fm=Ns(),jm=Us(),Vm=Ls(),Bm=js(),Zm=Bs(),Gm=Gs(),Hm=Ks(),Ru=Function,ri=o(function(e){try{return Ru('"use strict"; return ('+e+").constructor;")()}catch{}},"getEvalledConstructor"),sr=Kn(),qm=eu(),ni=o(function(){throw new Nt},"throwTypeError"),Wm=sr?(function(){try{return arguments.callee,ni}catch{try{return sr(arguments,"callee").get}catch{return ni}}})():ni,Dt=iu()(),xe=wu(),Km=Xn(),Jm=Yn(),Nu=Qn(),ur=Zr(),Rt={},Ym=typeof Uint8Array>"u"||!xe?Q:xe(Uint8Array),bt={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Q:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Q:ArrayBuffer,"%ArrayIteratorPrototype%":Dt&&xe?xe([][Symbol.iterator]()):Q,"%AsyncFromSyncIteratorPrototype%":Q,"%AsyncFunction%":Rt,"%AsyncGenerator%":Rt,"%AsyncGeneratorFunction%":Rt,"%AsyncIteratorPrototype%":Rt,"%Atomics%":typeof Atomics>"u"?Q:Atomics,"%BigInt%":typeof BigInt>"u"?Q:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Q:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Q:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Q:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Nm,"%eval%":eval,"%EvalError%":Cm,"%Float16Array%":typeof Float16Array>"u"?Q:Float16Array,"%Float32Array%":typeof Float32Array>"u"?Q:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Q:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Q:FinalizationRegistry,"%Function%":Ru,"%GeneratorFunction%":Rt,"%Int8Array%":typeof Int8Array>"u"?Q:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Q:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Q:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Dt&&xe?xe(xe([][Symbol.iterator]())):Q,"%JSON%":typeof JSON=="object"?JSON:Q,"%Map%":typeof Map>"u"?Q:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Dt||!xe?Q:xe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Rm,"%Object.getOwnPropertyDescriptor%":sr,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Q:Promise,"%Proxy%":typeof Proxy>"u"?Q:Proxy,"%RangeError%":Um,"%ReferenceError%":Mm,"%Reflect%":typeof Reflect>"u"?Q:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Q:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Dt||!xe?Q:xe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Q:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Dt&&xe?xe(""[Symbol.iterator]()):Q,"%Symbol%":Dt?Symbol:Q,"%SyntaxError%":Ct,"%ThrowTypeError%":Wm,"%TypedArray%":Ym,"%TypeError%":Nt,"%Uint8Array%":typeof Uint8Array>"u"?Q:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Q:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Q:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Q:Uint32Array,"%URIError%":Lm,"%WeakMap%":typeof WeakMap>"u"?Q:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Q:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Q:WeakSet,"%Function.prototype.call%":ur,"%Function.prototype.apply%":Nu,"%Object.defineProperty%":qm,"%Object.getPrototypeOf%":Km,"%Math.abs%":Fm,"%Math.floor%":jm,"%Math.max%":Vm,"%Math.min%":Bm,"%Math.pow%":Zm,"%Math.round%":Gm,"%Math.sign%":Hm,"%Reflect.getPrototypeOf%":Jm};if(xe)try{null.error}catch(e){ku=xe(xe(e)),bt["%Error.prototype%"]=ku}var ku,Xm=o(function e(t){var r;if(t==="%AsyncFunction%")r=ri("async function () {}");else if(t==="%GeneratorFunction%")r=ri("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=ri("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&xe&&(r=xe(i.prototype))}return bt[t]=r,r},"doEval"),Ou={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},cr=Ot(),Gr=ti(),Qm=cr.call(ur,Array.prototype.concat),ef=cr.call(Nu,Array.prototype.splice),Du=cr.call(ur,String.prototype.replace),Hr=cr.call(ur,String.prototype.slice),tf=cr.call(ur,RegExp.prototype.exec),rf=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,nf=/\\(\\)?/g,of=o(function(t){var r=Hr(t,0,1),n=Hr(t,-1);if(r==="%"&&n!=="%")throw new Ct("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Ct("invalid intrinsic syntax, expected opening `%`");var i=[];return Du(t,rf,function(a,u,c,d){i[i.length]=c?Du(d,nf,"$1"):u||a}),i},"stringToPath"),af=o(function(t,r){var n=t,i;if(Gr(Ou,n)&&(i=Ou[n],n="%"+i[0]+"%"),Gr(bt,n)){var a=bt[n];if(a===Rt&&(a=Xm(n)),typeof a>"u"&&!r)throw new Nt("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new Ct("intrinsic "+t+" does not exist!")},"getBaseIntrinsic");Cu.exports=o(function(t,r){if(typeof t!="string"||t.length===0)throw new Nt("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Nt('"allowMissing" argument must be a boolean');if(tf(/^%?[^%]*%?$/,t)===null)throw new Ct("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=of(t),i=n.length>0?n[0]:"",a=af("%"+i+"%",r),u=a.name,c=a.value,d=!1,g=a.alias;g&&(i=g[0],ef(n,Qm([0,1],g)));for(var h=1,I=!0;h<n.length;h+=1){var b=n[h],l=Hr(b,0,1),p=Hr(b,-1);if((l==='"'||l==="'"||l==="`"||p==='"'||p==="'"||p==="`")&&l!==p)throw new Ct("property names with quotes must have matching quotes");if((b==="constructor"||!I)&&(d=!0),i+="."+b,u="%"+i+"%",Gr(bt,u))c=bt[u];else if(c!=null){if(!(b in c)){if(!r)throw new Nt("base intrinsic for "+t+" exists, but the property is not available.");return}if(sr&&h+1>=n.length){var _=sr(c,b);I=!!_,I&&"get"in _&&!("originalValue"in _.get)?c=_.get:c=c[b]}else I=Gr(c,b),c=c[b];I&&!d&&(bt[u]=c)}}return c},"GetIntrinsic")});var Lu=U((Jk,Mu)=>{"use strict";var sf=Jn();Mu.exports=o(function(){return sf()&&!!Symbol.toStringTag},"hasToStringTagShams")});var Vu=U((Xk,ju)=>{"use strict";var uf=Uu(),Fu=uf("%Object.defineProperty%",!0),cf=Lu()(),lf=ti(),df=jr(),qr=cf?Symbol.toStringTag:null;ju.exports=o(function(t,r){var n=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof n<"u"&&typeof n!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new df("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");qr&&(n||!lf(t,qr))&&(Fu?Fu(t,qr,{configurable:!i,enumerable:!1,value:r,writable:!1}):t[qr]=r)},"setToStringTag")});var Zu=U((eO,Bu)=>{"use strict";var pf=Function.prototype.call,mf=Object.prototype.hasOwnProperty,ff=Ot();Bu.exports=ff.call(pf,mf)});var Hu=U((tO,Gu)=>{"use strict";Gu.exports=function(e,t){return Object.keys(t).forEach(function(r){e[r]=e[r]||t[r]}),e}});var ui=U((rO,Wu)=>{"use strict";var si=Ya(),gf=require("util"),ii=require("path"),yf=require("http"),hf=require("https"),_f=require("url").parse,vf=require("fs"),bf=require("stream").Stream,Pf=require("crypto"),oi=rs(),xf=vs(),Tf=Vu(),lt=Zu(),ai=Hu();function qu(e){return String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}o(qu,"escapeHeaderParam");function re(e){if(!(this instanceof re))return new re(e);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],si.call(this),e=e||{};for(var t in e)this[t]=e[t]}o(re,"FormData");gf.inherits(re,si);re.LINE_BREAK=`\r
|
|
2
|
-
`;re.DEFAULT_CONTENT_TYPE="application/octet-stream";re.prototype.append=function(e,t,r){r=r||{},typeof r=="string"&&(r={filename:r});var n=si.prototype.append.bind(this);if((typeof t=="number"||t==null)&&(t=String(t)),Array.isArray(t)){this._error(new Error("Arrays are not supported."));return}var i=this._multiPartHeader(e,t,r),a=this._multiPartFooter();n(i),n(t),n(a),this._trackLength(i,t,r)};re.prototype._trackLength=function(e,t,r){var n=0;r.knownLength!=null?n+=Number(r.knownLength):Buffer.isBuffer(t)?n=t.length:typeof t=="string"&&(n=Buffer.byteLength(t)),this._valueLength+=n,this._overheadLength+=Buffer.byteLength(e)+re.LINE_BREAK.length,!(!t||!t.path&&!(t.readable&<(t,"httpVersion"))&&!(t instanceof bf))&&(r.knownLength||this._valuesToMeasure.push(t))};re.prototype._lengthRetriever=function(e,t){lt(e,"fd")?e.end!=null&&e.end!=1/0&&e.start!=null?t(null,e.end+1-(e.start?e.start:0)):vf.stat(e.path,function(r,n){if(r){t(r);return}var i=n.size-(e.start?e.start:0);t(null,i)}):lt(e,"httpVersion")?t(null,Number(e.headers["content-length"])):lt(e,"httpModule")?(e.on("response",function(r){e.pause(),t(null,Number(r.headers["content-length"]))}),e.resume()):t("Unknown stream")};re.prototype._multiPartHeader=function(e,t,r){if(typeof r.header=="string")return r.header;var n=this._getContentDisposition(t,r),i=this._getContentType(t,r),a="",u={"Content-Disposition":["form-data",'name="'+qu(e)+'"'].concat(n||[]),"Content-Type":[].concat(i||[])};typeof r.header=="object"&&ai(u,r.header);var c;for(var d in u)if(lt(u,d)){if(c=u[d],c==null)continue;Array.isArray(c)||(c=[c]),c.length&&(a+=d+": "+c.join("; ")+re.LINE_BREAK)}return"--"+this.getBoundary()+re.LINE_BREAK+a+re.LINE_BREAK};re.prototype._getContentDisposition=function(e,t){var r;if(typeof t.filepath=="string"?r=ii.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e&&(e.name||e.path)?r=ii.basename(t.filename||e&&(e.name||e.path)):e&&e.readable&<(e,"httpVersion")&&(r=ii.basename(e.client._httpMessage.path||"")),r)return'filename="'+qu(r)+'"'};re.prototype._getContentType=function(e,t){var r=t.contentType;return!r&&e&&e.name&&(r=oi.lookup(e.name)),!r&&e&&e.path&&(r=oi.lookup(e.path)),!r&&e&&e.readable&<(e,"httpVersion")&&(r=e.headers["content-type"]),!r&&(t.filepath||t.filename)&&(r=oi.lookup(t.filepath||t.filename)),!r&&e&&typeof e=="object"&&(r=re.DEFAULT_CONTENT_TYPE),r};re.prototype._multiPartFooter=function(){return function(e){var t=re.LINE_BREAK,r=this._streams.length===0;r&&(t+=this._lastBoundary()),e(t)}.bind(this)};re.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+re.LINE_BREAK};re.prototype.getHeaders=function(e){var t,r={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)lt(e,t)&&(r[t.toLowerCase()]=e[t]);return r};re.prototype.setBoundary=function(e){if(typeof e!="string")throw new TypeError("FormData boundary must be a string");this._boundary=e};re.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};re.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),r=0,n=this._streams.length;r<n;r++)typeof this._streams[r]!="function"&&(Buffer.isBuffer(this._streams[r])?e=Buffer.concat([e,this._streams[r]]):e=Buffer.concat([e,Buffer.from(this._streams[r])]),(typeof this._streams[r]!="string"||this._streams[r].substring(2,t.length+2)!==t)&&(e=Buffer.concat([e,Buffer.from(re.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])};re.prototype._generateBoundary=function(){this._boundary="--------------------------"+Pf.randomBytes(12).toString("hex")};re.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e};re.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e};re.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;if(this._streams.length&&(t+=this._lastBoundary().length),!this._valuesToMeasure.length){process.nextTick(e.bind(this,null,t));return}xf.parallel(this._valuesToMeasure,this._lengthRetriever,function(r,n){if(r){e(r);return}n.forEach(function(i){t+=i}),e(null,t)})};re.prototype.submit=function(e,t){var r,n,i={method:"post"};return typeof e=="string"?(e=_f(e),n=ai({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},i)):(n=ai(e,i),n.port||(n.port=n.protocol==="https:"?443:80)),n.headers=this.getHeaders(e.headers),n.protocol==="https:"?r=hf.request(n):r=yf.request(n),this.getLength(function(a,u){if(a&&a!=="Unknown stream"){this._error(a);return}if(u&&r.setHeader("Content-Length",u),this.pipe(r),t){var c,d=o(function(g,h){return r.removeListener("error",d),r.removeListener("response",c),t.call(this,g,h)},"callback");c=d.bind(this,null),r.on("error",d),r.on("response",c)}}.bind(this)),r};re.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))};re.prototype.toString=function(){return"[object FormData]"};Tf(re.prototype,"FormData");Wu.exports=re});var dt=U((ci,li)=>{(function(e,t){typeof ci=="object"&&typeof li<"u"?li.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=t()})(ci,(function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",i="second",a="minute",u="hour",c="day",d="week",g="month",h="quarter",I="year",b="date",l="Invalid Date",p=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,_=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:o(function(j){var z=["th","st","nd","rd"],S=j%100;return"["+j+(z[(S-20)%10]||z[S]||z[0])+"]"},"ordinal")},P=o(function(j,z,S){var N=String(j);return!N||N.length>=z?j:""+Array(z+1-N.length).join(S)+j},"m"),T={s:P,z:o(function(j){var z=-j.utcOffset(),S=Math.abs(z),N=Math.floor(S/60),w=S%60;return(z<=0?"+":"-")+P(N,2,"0")+":"+P(w,2,"0")},"z"),m:o(function j(z,S){if(z.date()<S.date())return-j(S,z);var N=12*(S.year()-z.year())+(S.month()-z.month()),w=z.clone().add(N,g),J=S-w<0,Y=z.clone().add(N+(J?-1:1),g);return+(-(N+(S-w)/(J?w-Y:Y-w))||0)},"t"),a:o(function(j){return j<0?Math.ceil(j)||0:Math.floor(j)},"a"),p:o(function(j){return{M:g,y:I,w:d,d:c,D:b,h:u,m:a,s:i,ms:n,Q:h}[j]||String(j||"").toLowerCase().replace(/s$/,"")},"p"),u:o(function(j){return j===void 0},"u")},k="en",ne={};ne[k]=m;var ve=o(function(j){return j instanceof Ae},"p"),ke=o(function j(z,S,N){var w;if(!z)return k;if(typeof z=="string"){var J=z.toLowerCase();ne[J]&&(w=J),S&&(ne[J]=S,w=J);var Y=z.split("-");if(!w&&Y.length>1)return j(Y[0])}else{var oe=z.name;ne[oe]=z,w=oe}return!N&&w&&(k=w),w||!N&&k},"t"),ye=o(function(j,z){if(ve(j))return j.clone();var S=typeof z=="object"?z:{};return S.date=j,S.args=arguments,new Ae(S)},"w"),X=T;X.l=ke,X.i=ve,X.w=function(j,z){return ye(j,{locale:z.$L,utc:z.$u,x:z.$x,$offset:z.$offset})};var Ae=(function(){function j(S){this.$L=ke(S.locale,null,!0),this.parse(S)}o(j,"M");var z=j.prototype;return z.parse=function(S){this.$d=(function(N){var w=N.date,J=N.utc;if(w===null)return new Date(NaN);if(X.u(w))return new Date;if(w instanceof Date)return new Date(w);if(typeof w=="string"&&!/Z$/i.test(w)){var Y=w.match(p);if(Y){var oe=Y[2]-1||0,me=(Y[7]||"0").substring(0,3);return J?new Date(Date.UTC(Y[1],oe,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,me)):new Date(Y[1],oe,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,me)}}return new Date(w)})(S),this.$x=S.x||{},this.init()},z.init=function(){var S=this.$d;this.$y=S.getFullYear(),this.$M=S.getMonth(),this.$D=S.getDate(),this.$W=S.getDay(),this.$H=S.getHours(),this.$m=S.getMinutes(),this.$s=S.getSeconds(),this.$ms=S.getMilliseconds()},z.$utils=function(){return X},z.isValid=function(){return this.$d.toString()!==l},z.isSame=function(S,N){var w=ye(S);return this.startOf(N)<=w&&w<=this.endOf(N)},z.isAfter=function(S,N){return ye(S)<this.startOf(N)},z.isBefore=function(S,N){return this.endOf(N)<ye(S)},z.$g=function(S,N,w){return X.u(S)?this[N]:this.set(w,S)},z.unix=function(){return Math.floor(this.valueOf()/1e3)},z.valueOf=function(){return this.$d.getTime()},z.startOf=function(S,N){var w=this,J=!!X.u(N)||N,Y=X.p(S),oe=o(function(gt,Se){var et=X.w(w.$u?Date.UTC(w.$y,Se,gt):new Date(w.$y,Se,gt),w);return J?et:et.endOf(c)},"l"),me=o(function(gt,Se){return X.w(w.toDate()[gt].apply(w.toDate("s"),(J?[0,0,0,0]:[23,59,59,999]).slice(Se)),w)},"$"),be=this.$W,Te=this.$M,Ce=this.$D,xt="set"+(this.$u?"UTC":"");switch(Y){case I:return J?oe(1,0):oe(31,11);case g:return J?oe(1,Te):oe(0,Te+1);case d:var ft=this.$locale().weekStart||0,Lt=(be<ft?be+7:be)-ft;return oe(J?Ce-Lt:Ce+(6-Lt),Te);case c:case b:return me(xt+"Hours",0);case u:return me(xt+"Minutes",1);case a:return me(xt+"Seconds",2);case i:return me(xt+"Milliseconds",3);default:return this.clone()}},z.endOf=function(S){return this.startOf(S,!1)},z.$set=function(S,N){var w,J=X.p(S),Y="set"+(this.$u?"UTC":""),oe=(w={},w[c]=Y+"Date",w[b]=Y+"Date",w[g]=Y+"Month",w[I]=Y+"FullYear",w[u]=Y+"Hours",w[a]=Y+"Minutes",w[i]=Y+"Seconds",w[n]=Y+"Milliseconds",w)[J],me=J===c?this.$D+(N-this.$W):N;if(J===g||J===I){var be=this.clone().set(b,1);be.$d[oe](me),be.init(),this.$d=be.set(b,Math.min(this.$D,be.daysInMonth())).$d}else oe&&this.$d[oe](me);return this.init(),this},z.set=function(S,N){return this.clone().$set(S,N)},z.get=function(S){return this[X.p(S)]()},z.add=function(S,N){var w,J=this;S=Number(S);var Y=X.p(N),oe=o(function(Te){var Ce=ye(J);return X.w(Ce.date(Ce.date()+Math.round(Te*S)),J)},"y");if(Y===g)return this.set(g,this.$M+S);if(Y===I)return this.set(I,this.$y+S);if(Y===c)return oe(1);if(Y===d)return oe(7);var me=(w={},w[a]=t,w[u]=r,w[i]=e,w)[Y]||1,be=this.$d.getTime()+S*me;return X.w(be,this)},z.subtract=function(S,N){return this.add(-1*S,N)},z.format=function(S){var N=this,w=this.$locale();if(!this.isValid())return w.invalidDate||l;var J=S||"YYYY-MM-DDTHH:mm:ssZ",Y=X.z(this),oe=this.$H,me=this.$m,be=this.$M,Te=w.weekdays,Ce=w.months,xt=w.meridiem,ft=o(function(Se,et,Ft,mr){return Se&&(Se[et]||Se(N,J))||Ft[et].slice(0,mr)},"h"),Lt=o(function(Se){return X.s(oe%12||12,Se,"0")},"d"),gt=xt||function(Se,et,Ft){var mr=Se<12?"AM":"PM";return Ft?mr.toLowerCase():mr};return J.replace(_,(function(Se,et){return et||(function(Ft){switch(Ft){case"YY":return String(N.$y).slice(-2);case"YYYY":return X.s(N.$y,4,"0");case"M":return be+1;case"MM":return X.s(be+1,2,"0");case"MMM":return ft(w.monthsShort,be,Ce,3);case"MMMM":return ft(Ce,be);case"D":return N.$D;case"DD":return X.s(N.$D,2,"0");case"d":return String(N.$W);case"dd":return ft(w.weekdaysMin,N.$W,Te,2);case"ddd":return ft(w.weekdaysShort,N.$W,Te,3);case"dddd":return Te[N.$W];case"H":return String(oe);case"HH":return X.s(oe,2,"0");case"h":return Lt(1);case"hh":return Lt(2);case"a":return gt(oe,me,!0);case"A":return gt(oe,me,!1);case"m":return String(me);case"mm":return X.s(me,2,"0");case"s":return String(N.$s);case"ss":return X.s(N.$s,2,"0");case"SSS":return X.s(N.$ms,3,"0");case"Z":return Y}return null})(Se)||Y.replace(":","")}))},z.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},z.diff=function(S,N,w){var J,Y=this,oe=X.p(N),me=ye(S),be=(me.utcOffset()-this.utcOffset())*t,Te=this-me,Ce=o(function(){return X.m(Y,me)},"D");switch(oe){case I:J=Ce()/12;break;case g:J=Ce();break;case h:J=Ce()/3;break;case d:J=(Te-be)/6048e5;break;case c:J=(Te-be)/864e5;break;case u:J=Te/r;break;case a:J=Te/t;break;case i:J=Te/e;break;default:J=Te}return w?J:X.a(J)},z.daysInMonth=function(){return this.endOf(g).$D},z.$locale=function(){return ne[this.$L]},z.locale=function(S,N){if(!S)return this.$L;var w=this.clone(),J=ke(S,N,!0);return J&&(w.$L=J),w},z.clone=function(){return X.w(this.$d,this)},z.toDate=function(){return new Date(this.valueOf())},z.toJSON=function(){return this.isValid()?this.toISOString():null},z.toISOString=function(){return this.$d.toISOString()},z.toString=function(){return this.$d.toUTCString()},j})(),pr=Ae.prototype;return ye.prototype=pr,[["$ms",n],["$s",i],["$m",a],["$H",u],["$W",c],["$M",g],["$y",I],["$D",b]].forEach((function(j){pr[j[1]]=function(z){return this.$g(z,j[0],j[1])}})),ye.extend=function(j,z){return j.$i||(j(z,Ae,ye),j.$i=!0),ye},ye.locale=ke,ye.isDayjs=ve,ye.unix=function(j){return ye(1e3*j)},ye.en=ne[k],ye.Ls=ne,ye.p={},ye}))});var Ff={};yi(Ff,{pipedrive:()=>Lf});module.exports=Qc(Ff);var el=Object.freeze({status:"aborted"});function O(e,t,r){function n(c,d){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:d,constr:u,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,d);let g=u.prototype,h=Object.keys(g);for(let I=0;I<h.length;I++){let b=h[I];b in c||(c[b]=g[b].bind(c))}}o(n,"init");let i=r?.Parent??Object;class a extends i{static{o(this,"Definition")}}Object.defineProperty(a,"name",{value:e});function u(c){var d;let g=r?.Parent?new a:this;n(g,c),(d=g._zod).deferred??(d.deferred=[]);for(let h of g._zod.deferred)h();return g}return o(u,"_"),Object.defineProperty(u,"init",{value:n}),Object.defineProperty(u,Symbol.hasInstance,{value:o(c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e),"value")}),Object.defineProperty(u,"name",{value:e}),u}o(O,"$constructor");var Ve=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},fr=class extends Error{static{o(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},en={};function qe(e){return e&&Object.assign(en,e),en}o(qe,"config");function rn(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}o(rn,"getEnumValues");function vi(e,t){return typeof t=="bigint"?t.toString():t}o(vi,"jsonStringifyReplacer");function yr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}o(yr,"cached");function bi(e){return e==null}o(bi,"nullish");function hr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}o(hr,"cleanRegex");var _i=Symbol("evaluating");function he(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==_i)return n===void 0&&(n=_i,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}o(he,"defineLazy");var nn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Vt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(Vt,"isObject");var tl=yr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Pi(e){if(Vt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Vt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}o(Pi,"isPlainObject");var xi=new Set(["string","number","symbol"]);function Tt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(Tt,"escapeRegex");function _r(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}o(_r,"clone");function ae(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:o(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:o(()=>t.error,"error")}:t}o(ae,"normalizeParams");function Ti(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}o(Ti,"optionalKeys");var Ii={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function It(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}o(It,"aborted");function tt(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}o(tt,"prefixIssues");function gr(e){return typeof e=="string"?e:e?.message}o(gr,"unwrapMessage");function rt(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=gr(e.inst?._zod.def?.error?.(e))??gr(t?.error?.(e))??gr(r.customError?.(e))??gr(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}o(rt,"finalizeIssue");function Ei(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}o(Ei,"getLengthableOrigin");function on(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}o(on,"issue");var Ai=o((e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,vi,2),Object.defineProperty(e,"toString",{value:o(()=>e.message,"value"),enumerable:!1})},"initializer"),Si=O("$ZodError",Ai),Bt=O("$ZodError",Ai,{Parent:Error});var nl=o(e=>(t,r,n,i)=>{let a=n?Object.assign(n,{async:!1}):{async:!1},u=t._zod.run({value:r,issues:[]},a);if(u instanceof Promise)throw new Ve;if(u.issues.length){let c=new(i?.Err??e)(u.issues.map(d=>rt(d,a,qe())));throw nn(c,i?.callee),c}return u.value},"_parse"),vr=nl(Bt),il=o(e=>async(t,r,n,i)=>{let a=n?Object.assign(n,{async:!0}):{async:!0},u=t._zod.run({value:r,issues:[]},a);if(u instanceof Promise&&(u=await u),u.issues.length){let c=new(i?.Err??e)(u.issues.map(d=>rt(d,a,qe())));throw nn(c,i?.callee),c}return u.value},"_parseAsync"),br=il(Bt),ol=o(e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new Ve;return a.issues.length?{success:!1,error:new(e??Si)(a.issues.map(u=>rt(u,i,qe())))}:{success:!0,data:a.value}},"_safeParse"),Zt=ol(Bt),al=o(e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(u=>rt(u,i,qe())))}:{success:!0,data:a.value}},"_safeParseAsync"),Gt=al(Bt);var sl="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",ul=new RegExp(`^${sl}$`);var $i=o(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),wi=/^-?\d+n?$/,zi=/^-?\d+$/,an=/^-?\d+(?:\.\d+)?$/,ki=/^(?:true|false)$/i;var nt=O("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),cl={number:"number",bigint:"bigint",object:"date"};var Oi=O("$ZodCheckGreaterThan",(e,t)=>{nt.init(e,t);let r=cl[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,a=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});var Di=O("$ZodCheckNumberFormat",(e,t)=>{nt.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,a]=Ii[t.format];e._zod.onattach.push(u=>{let c=u._zod.bag;c.format=t.format,c.minimum=i,c.maximum=a,r&&(c.pattern=zi)}),e._zod.check=u=>{let c=u.value;if(r){if(!Number.isInteger(c)){u.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?u.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):u.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}c<i&&u.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),c>a&&u.issues.push({origin:"number",input:c,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}});var Ri=O("$ZodCheckMinLength",(e,t)=>{var r;nt.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!bi(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let u=Ei(i);n.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}});var sn=O("$ZodCheckStringFormat",(e,t)=>{var r,n;nt.init(e,t),e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Ni=O("$ZodCheckRegex",(e,t)=>{sn.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});var Ui={major:4,minor:3,patch:6};var de=O("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ui;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let a of i._zod.onattach)a(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=o((u,c,d)=>{let g=It(u),h;for(let I of c){if(I._zod.def.when){if(!I._zod.def.when(u))continue}else if(g)continue;let b=u.issues.length,l=I._zod.check(u);if(l instanceof Promise&&d?.async===!1)throw new Ve;if(h||l instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await l,u.issues.length!==b&&(g||(g=It(u,b)))});else{if(u.issues.length===b)continue;g||(g=It(u,b))}}return h?h.then(()=>u):u},"runChecks"),a=o((u,c,d)=>{if(It(u))return u.aborted=!0,u;let g=i(c,n,d);if(g instanceof Promise){if(d.async===!1)throw new Ve;return g.then(h=>e._zod.parse(h,d))}return e._zod.parse(g,d)},"handleCanaryResult");e._zod.run=(u,c)=>{if(c.skipChecks)return e._zod.parse(u,c);if(c.direction==="backward"){let g=e._zod.parse({value:u.value,issues:[]},{...c,skipChecks:!0});return g instanceof Promise?g.then(h=>a(h,u,c)):a(g,u,c)}let d=e._zod.parse(u,c);if(d instanceof Promise){if(c.async===!1)throw new Ve;return d.then(g=>i(g,n,c))}return i(d,n,c)}}he(e,"~standard",()=>({validate:o(i=>{try{let a=Zt(e,i);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return Gt(e,i).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},"validate"),vendor:"zod",version:1}))}),Tr=O("$ZodString",(e,t)=>{de.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??$i(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),un=O("$ZodStringFormat",(e,t)=>{sn.init(e,t),Tr.init(e,t)});var Vi=O("$ZodURL",(e,t)=>{un.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var cn=O("$ZodNumber",(e,t)=>{de.init(e,t),e._zod.pattern=e._zod.bag.pattern??an,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...a?{received:a}:{}}),r}}),Bi=O("$ZodNumberFormat",(e,t)=>{Di.init(e,t),cn.init(e,t)}),ln=O("$ZodBoolean",(e,t)=>{de.init(e,t),e._zod.pattern=ki,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),Zi=O("$ZodBigInt",(e,t)=>{de.init(e,t),e._zod.pattern=wi,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var Gi=O("$ZodAny",(e,t)=>{de.init(e,t),e._zod.parse=r=>r}),Hi=O("$ZodUnknown",(e,t)=>{de.init(e,t),e._zod.parse=r=>r});var qi=O("$ZodVoid",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),r}}),Wi=O("$ZodDate",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:e}),r}});function Mi(e,t,r){e.issues.length&&t.issues.push(...tt(r,e.issues)),t.value[r]=e.value}o(Mi,"handleArrayResult");var Ki=O("$ZodArray",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let a=[];for(let u=0;u<i.length;u++){let c=i[u],d=t.element._zod.run({value:c,issues:[]},n);d instanceof Promise?a.push(d.then(g=>Mi(g,r,u))):Mi(d,r,u)}return a.length?Promise.all(a).then(()=>r):r}});function xr(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...tt(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}o(xr,"handlePropertyResult");function ll(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Ti(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}o(ll,"normalizeDef");function dl(e,t,r,n,i,a){let u=[],c=i.keySet,d=i.catchall._zod,g=d.def.type,h=d.optout==="optional";for(let I in t){if(c.has(I))continue;if(g==="never"){u.push(I);continue}let b=d.run({value:t[I],issues:[]},n);b instanceof Promise?e.push(b.then(l=>xr(l,r,I,t,h))):xr(b,r,I,t,h)}return u.length&&r.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:a}),e.length?Promise.all(e).then(()=>r):r}o(dl,"handleCatchall");var Ji=O("$ZodObject",(e,t)=>{if(de.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:o(()=>{let d={...c};return Object.defineProperty(t,"shape",{value:d}),d},"get")})}let n=yr(()=>ll(t));he(e._zod,"propValues",()=>{let c=t.shape,d={};for(let g in c){let h=c[g]._zod;if(h.values){d[g]??(d[g]=new Set);for(let I of h.values)d[g].add(I)}}return d});let i=Vt,a=t.catchall,u;e._zod.parse=(c,d)=>{u??(u=n.value);let g=c.value;if(!i(g))return c.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),c;c.value={};let h=[],I=u.shape;for(let b of u.keys){let l=I[b],p=l._zod.optout==="optional",_=l._zod.run({value:g[b],issues:[]},d);_ instanceof Promise?h.push(_.then(m=>xr(m,c,b,g,p))):xr(_,c,b,g,p)}return a?dl(h,g,c,d,n.value,e):h.length?Promise.all(h).then(()=>c):c}});function Li(e,t,r,n){for(let a of e)if(a.issues.length===0)return t.value=a.value,t;let i=e.filter(a=>!It(a));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(a=>a.issues.map(u=>rt(u,n,qe())))}),t)}o(Li,"handleUnionResults");var dn=O("$ZodUnion",(e,t)=>{de.init(e,t),he(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),he(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),he(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),he(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){let i=t.options.map(a=>a._zod.pattern);return new RegExp(`^(${i.map(a=>hr(a.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(r)return n(i,a);let u=!1,c=[];for(let d of t.options){let g=d._zod.run({value:i.value,issues:[]},a);if(g instanceof Promise)c.push(g),u=!0;else{if(g.issues.length===0)return g;c.push(g)}}return u?Promise.all(c).then(d=>Li(d,i,e,a)):Li(c,i,e,a)}});var Yi=O("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,dn.init(e,t);let r=e._zod.parse;he(e._zod,"propValues",()=>{let i={};for(let a of t.options){let u=a._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let[c,d]of Object.entries(u)){i[c]||(i[c]=new Set);for(let g of d)i[c].add(g)}}return i});let n=yr(()=>{let i=t.options,a=new Map;for(let u of i){let c=u._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(let d of c){if(a.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);a.set(d,u)}}return a});e._zod.parse=(i,a)=>{let u=i.value;if(!Vt(u))return i.issues.push({code:"invalid_type",expected:"object",input:u,inst:e}),i;let c=n.value.get(u?.[t.discriminator]);return c?c._zod.run(i,a):t.unionFallback?r(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:u,path:[t.discriminator],inst:e}),i)}});var Xi=O("$ZodRecord",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Pi(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let a=[],u=t.keyType._zod.values;if(u){r.value={};let c=new Set;for(let g of u)if(typeof g=="string"||typeof g=="number"||typeof g=="symbol"){c.add(typeof g=="number"?g.toString():g);let h=t.valueType._zod.run({value:i[g],issues:[]},n);h instanceof Promise?a.push(h.then(I=>{I.issues.length&&r.issues.push(...tt(g,I.issues)),r.value[g]=I.value})):(h.issues.length&&r.issues.push(...tt(g,h.issues)),r.value[g]=h.value)}let d;for(let g in i)c.has(g)||(d=d??[],d.push(g));d&&d.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:d})}else{r.value={};for(let c of Reflect.ownKeys(i)){if(c==="__proto__")continue;let d=t.keyType._zod.run({value:c,issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&an.test(c)&&d.issues.length){let I=t.keyType._zod.run({value:Number(c),issues:[]},n);if(I instanceof Promise)throw new Error("Async schemas not supported in object keys currently");I.issues.length===0&&(d=I)}if(d.issues.length){t.mode==="loose"?r.value[c]=i[c]:r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(I=>rt(I,n,qe())),input:c,path:[c],inst:e});continue}let h=t.valueType._zod.run({value:i[c],issues:[]},n);h instanceof Promise?a.push(h.then(I=>{I.issues.length&&r.issues.push(...tt(c,I.issues)),r.value[d.value]=I.value})):(h.issues.length&&r.issues.push(...tt(c,h.issues)),r.value[d.value]=h.value)}}return a.length?Promise.all(a).then(()=>r):r}});var Qi=O("$ZodEnum",(e,t)=>{de.init(e,t);let r=rn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>xi.has(typeof i)).map(i=>typeof i=="string"?Tt(i):i.toString()).join("|")})$`),e._zod.parse=(i,a)=>{let u=i.value;return n.has(u)||i.issues.push({code:"invalid_value",values:r,input:u,inst:e}),i}}),eo=O("$ZodLiteral",(e,t)=>{if(de.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?Tt(n):n?Tt(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),n}});var to=O("$ZodTransform",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new fr(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(u=>(r.value=u,r));if(i instanceof Promise)throw new Ve;return r.value=i,r}});function Fi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}o(Fi,"handleOptionalResult");var ro=O("$ZodOptional",(e,t)=>{de.init(e,t),e._zod.optin="optional",e._zod.optout="optional",he(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),he(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${hr(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>Fi(a,r.value)):Fi(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var no=O("$ZodNullable",(e,t)=>{de.init(e,t),he(e._zod,"optin",()=>t.innerType._zod.optin),he(e._zod,"optout",()=>t.innerType._zod.optout),he(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${hr(r.source)}|null)$`):void 0}),he(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)});var io=O("$ZodPipe",(e,t)=>{de.init(e,t),he(e._zod,"values",()=>t.in._zod.values),he(e._zod,"optin",()=>t.in._zod.optin),he(e._zod,"optout",()=>t.out._zod.optout),he(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let a=t.out._zod.run(r,n);return a instanceof Promise?a.then(u=>Pr(u,t.in,n)):Pr(a,t.in,n)}let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>Pr(a,t.out,n)):Pr(i,t.out,n)}});function Pr(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}o(Pr,"handlePipeResult");var oo=O("$ZodCustom",(e,t)=>{nt.init(e,t),de.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(a=>ji(a,r,n,e));ji(i,r,n,e)}});function ji(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(on(i))}}o(ji,"handleRefineResult");var so;var pn=class{static{o(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function uo(){return new pn}o(uo,"registry");(so=globalThis).__zod_globalRegistry??(so.__zod_globalRegistry=uo());var mn=globalThis.__zod_globalRegistry;function co(e,t){return new e({type:"string",...ae(t)})}o(co,"_string");function lo(e,t){return new e({type:"string",coerce:!0,...ae(t)})}o(lo,"_coercedString");function po(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ae(t)})}o(po,"_url");function mo(e,t){return new e({type:"number",checks:[],...ae(t)})}o(mo,"_number");function fo(e,t){return new e({type:"number",coerce:!0,checks:[],...ae(t)})}o(fo,"_coercedNumber");function go(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ae(t)})}o(go,"_int");function yo(e,t){return new e({type:"boolean",...ae(t)})}o(yo,"_boolean");function ho(e,t){return new e({type:"boolean",coerce:!0,...ae(t)})}o(ho,"_coercedBoolean");function _o(e,t){return new e({type:"bigint",coerce:!0,...ae(t)})}o(_o,"_coercedBigint");function vo(e){return new e({type:"any"})}o(vo,"_any");function bo(e){return new e({type:"unknown"})}o(bo,"_unknown");function Po(e,t){return new e({type:"void",...ae(t)})}o(Po,"_void");function xo(e,t){return new e({type:"date",coerce:!0,...ae(t)})}o(xo,"_coercedDate");function Ir(e,t){return new Oi({check:"greater_than",...ae(t),value:e,inclusive:!0})}o(Ir,"_gte");function Me(e,t){return new Ri({check:"min_length",...ae(t),minimum:e})}o(Me,"_minLength");function it(e,t){return new Ni({check:"string_format",format:"regex",...ae(t),pattern:e})}o(it,"_regex");function To(e,t,r){let n=ae(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}o(To,"_custom");var _e=O("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");de.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>vr(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Zt(e,r,n),e.parseAsync=async(r,n)=>br(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Gt(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>_r(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),Ar=O("ZodMiniString",(e,t)=>{Tr.init(e,t),_e.init(e,t)});function s(e){return co(Ar,e)}o(s,"string");var Io=O("ZodMiniStringFormat",(e,t)=>{un.init(e,t),Ar.init(e,t)});var Il=O("ZodMiniURL",(e,t)=>{Vi.init(e,t),Io.init(e,t)});function Eo(e){return po(Il,e)}o(Eo,"url");var Sr=O("ZodMiniNumber",(e,t)=>{cn.init(e,t),_e.init(e,t)});function Pe(e){return mo(Sr,e)}o(Pe,"number");var El=O("ZodMiniNumberFormat",(e,t)=>{Bi.init(e,t),Sr.init(e,t)});function Ao(e){return go(El,e)}o(Ao,"int");var fn=O("ZodMiniBoolean",(e,t)=>{ln.init(e,t),_e.init(e,t)});function te(e){return yo(fn,e)}o(te,"boolean");var So=O("ZodMiniBigInt",(e,t)=>{Zi.init(e,t),_e.init(e,t)});var Al=O("ZodMiniAny",(e,t)=>{Gi.init(e,t),_e.init(e,t)});function qt(){return vo(Al)}o(qt,"any");var Sl=O("ZodMiniUnknown",(e,t)=>{Hi.init(e,t),_e.init(e,t)});function H(){return bo(Sl)}o(H,"unknown");var $l=O("ZodMiniVoid",(e,t)=>{qi.init(e,t),_e.init(e,t)});function $o(e){return Po($l,e)}o($o,"_void");var wo=O("ZodMiniDate",(e,t)=>{Wi.init(e,t),_e.init(e,t)});var wl=O("ZodMiniArray",(e,t)=>{Ki.init(e,t),_e.init(e,t)});function V(e,t){return new wl({type:"array",element:e,...ae(t)})}o(V,"array");var zl=O("ZodMiniObject",(e,t)=>{Ji.init(e,t),_e.init(e,t),he(e,"shape",()=>t.shape)});function f(e,t){let r={type:"object",shape:e??{},...ae(t)};return new zl(r)}o(f,"object");var kl=O("ZodMiniUnion",(e,t)=>{dn.init(e,t),_e.init(e,t)});function K(e,t){return new kl({type:"union",options:e,...ae(t)})}o(K,"union");var Ol=O("ZodMiniDiscriminatedUnion",(e,t)=>{Yi.init(e,t),_e.init(e,t)});function ot(e,t,r){return new Ol({type:"union",options:t,discriminator:e,...ae(r)})}o(ot,"discriminatedUnion");var Dl=O("ZodMiniRecord",(e,t)=>{Xi.init(e,t),_e.init(e,t)});function q(e,t,r){return new Dl({type:"record",keyType:e,valueType:t,...ae(r)})}o(q,"record");var Rl=O("ZodMiniEnum",(e,t)=>{Qi.init(e,t),_e.init(e,t),e.options=Object.values(t.entries)});function L(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Rl({type:"enum",entries:r,...ae(t)})}o(L,"_enum");var Nl=O("ZodMiniLiteral",(e,t)=>{eo.init(e,t),_e.init(e,t)});function M(e,t){return new Nl({type:"literal",values:Array.isArray(e)?e:[e],...ae(t)})}o(M,"literal");var Cl=O("ZodMiniTransform",(e,t)=>{to.init(e,t),_e.init(e,t)});function at(e){return new Cl({type:"transform",transform:e})}o(at,"transform");var Ul=O("ZodMiniOptional",(e,t)=>{ro.init(e,t),_e.init(e,t)});function v(e){return new Ul({type:"optional",innerType:e})}o(v,"optional");var Ml=O("ZodMiniNullable",(e,t)=>{no.init(e,t),_e.init(e,t)});function Wt(e){return new Ml({type:"nullable",innerType:e})}o(Wt,"nullable");var Ll=O("ZodMiniPipe",(e,t)=>{io.init(e,t),_e.init(e,t)});function st(e,t){return new Ll({type:"pipe",in:e,out:t})}o(st,"pipe");var Fl=O("ZodMiniCustom",(e,t)=>{oo.init(e,t),_e.init(e,t)});function $r(e,t){return To(Fl,e??(()=>!0),t)}o($r,"custom");var Kt={};yi(Kt,{bigint:()=>Hl,boolean:()=>Gl,date:()=>ql,number:()=>Zl,string:()=>Bl});function Bl(e){return lo(Ar,e)}o(Bl,"string");function Zl(e){return fo(Sr,e)}o(Zl,"number");function Gl(e){return ho(fn,e)}o(Gl,"boolean");function Hl(e){return _o(So,e)}o(Hl,"bigint");function ql(e){return xo(wo,e)}o(ql,"date");var yn=f({retryOnFailure:f({defaultValue:v(te()),hide:v(te())}),continueOnFailure:f({defaultValue:v(te()),hide:v(te())})}),gn=class{constructor(t,r,n,i,a,u,c,d,g,h,I,b,l){this.name=t;this.displayName=r;this.description=n;this.props=i;this.propertyGroups=a;this.run=u;this.test=c;this.requireAuth=d;this.errorHandlingOptions=g;this.outputSchema=h;this.audience=I;this.aiMetadata=b;this.classification=l}static{o(this,"IAction")}},D=o(e=>new gn(e.name,e.displayName,e.description,e.props,e.propertyGroups,e.run,e.test??e.run,e.requireAuth??!0,e.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},e.outputSchema,e.audience,e.aiMetadata,e.classification),"createAction");var ee=f({displayName:s(),description:v(s()),advanced:v(te()),width:v(L(["half","full"])),icon:v(s()),placeholder:v(s())}),W=o((e,t)=>f({type:M(t),required:te(),defaultValue:v(qt())}),"TPropertyValue");var Oe=f({...ee.shape,...W(s(),"SHORT_TEXT").shape}),We=f({...ee.shape,...W(s(),"LONG_TEXT").shape});var ko=f({label:s(),value:H(),description:v(s()),icon:v(s())}),wr=f({disabled:v(te()),placeholder:v(s()),options:V(ko)});var Kl=L(["cards"]),De=f({...ee.shape,options:wr,display:v(Kl),...W(H(),"STATIC_DROPDOWN").shape}),Ke=f({...ee.shape,options:wr,...W(V(H()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var hn=f({...ee.shape,...W(H(),"DROPDOWN").shape,refreshers:V(s())}),Jt=f({...ee.shape,...W(V(H()),"MULTI_SELECT_DROPDOWN").shape,refreshers:V(s())});var Je=f({...ee.shape,reveals:v(V(s())),...W(te(),"CHECKBOX").shape});var Ye=f({...ee.shape,display:v(L(["stepper"])),min:v(Pe()),max:v(Pe()),step:v(Pe()),...W(Pe(),"NUMBER").shape});var Yt=f({...ee.shape,streaming:v(te()),...W(H(),"FILE").shape});var Xt=f({...ee.shape,...W(s(),"DATE_TIME").shape});var Oo=q(s(),K([Oe,We,De,Jt,Ke,Je,Ye,Yt,Xt])),Qt=f({...ee.shape,properties:Oo,...W(V(H()),"ARRAY").shape});var Do=L(["any_time","last_24_hours","last_7_days","last_30_days","last_90_days","this_month","custom"]),Ro=f({preset:v(Do),after:v(s()),before:v(s())}),_n=f({...ee.shape,display:v(L(["dropdown"])),...W(Ro,"DATE_RANGE").shape});var er=f({...ee.shape,...W(K([q(s(),H())]),"JSON").shape});var No=K([Oe,De,er,Qt,Ke]),Jl=q(s(),No),vn=f({refreshers:V(s()),...ee.shape,...W(H(),"DYNAMIC").shape});var zr=f({...ee.shape,...W($o(),"MARKDOWN").shape});var tr=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(tr||{}),Et=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(Et||{}),At=(P=>(P.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",P.COMMUNICATION="COMMUNICATION",P.COMMERCE="COMMERCE",P.CORE="CORE",P.UNIVERSAL_AI="UNIVERSAL_AI",P.FLOW_CONTROL="FLOW_CONTROL",P.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",P.ACCOUNTING="ACCOUNTING",P.PRODUCTIVITY="PRODUCTIVITY",P.CONTENT_AND_FILES="CONTENT_AND_FILES",P.DEVELOPER_TOOLS="DEVELOPER_TOOLS",P.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",P.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",P.HUMAN_RESOURCES="HUMAN_RESOURCES",P.PAYMENT_PROCESSING="PAYMENT_PROCESSING",P.MARKETING="MARKETING",P.SALES_AND_CRM="SALES_AND_CRM",P))(At||{});var rr=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(rr||{}),bn="both_client_credentials_and_authorization_code";var fe=(i=>(i.POLLING="POLLING",i.WEBHOOK="WEBHOOK",i.APP_WEBHOOK="APP_WEBHOOK",i.MANUAL="MANUAL",i))(fe||{}),nr=(a=>(a.NONE="NONE",a.HEADER_PRESENT="HEADER_PRESENT",a.QUERY_PRESENT="QUERY_PRESENT",a.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",a.HEAD_REQUEST="HEAD_REQUEST",a))(nr||{}),Yl=f({strategy:L(nr),paramName:v(s())}),ir=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(ir||{});var kr=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(kr||{}),Co=f({status:v(Pe()),body:v(H()),headers:v(q(s(),s()))}),Uo=f({type:M("DELAY"),resumeDateTime:s(),requestIdToReply:v(s()),handlerId:v(s()),streamStepProgress:v(L(kr))}),Mo=f({type:M("WEBHOOK"),requestId:s(),requestIdToReply:v(s()),response:Co,handlerId:v(s()),streamStepProgress:v(L(kr))}),Xl=K([Uo,Mo]);var Ql=f({body:H(),rawBody:v(H()),headers:q(s(),s()),queryParams:q(s(),s())});function A(e){return e==null}o(A,"isNil");function ce(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}o(ce,"isEmpty");function Or(e,t){if(e==null)throw new Error(`${t} is null or undefined`)}o(Or,"assertNotNullOrUndefined");var Pn=$e(require("crypto"),1);var ed=128,ut,St,td=o(e=>{if(e<0)throw new RangeError("Wrong ID size");try{!ut||ut.length<e?(ut=Buffer.allocUnsafe(e*ed),Pn.default.randomFillSync(ut),St=0):St+e>ut.length&&(Pn.default.randomFillSync(ut),St=0)}catch(t){throw ut=void 0,t}St+=e},"fillPool"),rd=o(e=>(td(e|=0),ut.subarray(St-e,St)),"random"),nd=o((e,t,r)=>{let n=(2<<31-Math.clz32(e.length-1|1))-1,i=Math.ceil(1.6*n*t/e.length);return(a=t)=>{if(a<=0)return"";let u="";for(;;){let c=r(i),d=i;for(;d--;)if(u+=e[c[d]&n]||"",u.length===a)return u}}},"customRandom"),Fo=o((e,t=21)=>nd(e,t,rd),"customAlphabet");var id="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",jo=21,II=s().check(it(new RegExp(`^[0-9a-zA-Z]{${jo}}$`))),od=Fo(id,jo);var ct=st(at(e=>e instanceof Date?e.toISOString():e),s()),Ue={id:s(),created:ct,updated:ct},le=o(e=>v(Wt(e)),"Nullable");function xn(e){return v(Wt(L(e)))}o(xn,"NullableEnum");var SI=st(at(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),v(te())),Dr=o(e=>st(at(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),v(V(e))),"OptionalArrayFromQuery");var zI=q(s(),H());var or=(h=>(h.OPENAI="openai",h.OPENROUTER="openrouter",h.ANTHROPIC="anthropic",h.AZURE="azure",h.GOOGLE="google",h.ACTIVEPIECES="activepieces",h.CLOUDFLARE_GATEWAY="cloudflare-gateway",h.CUSTOM="custom",h.BEDROCK="bedrock",h.MISTRAL="mistral",h))(or||{});var VI=s().check(it(/^#[0-9A-Fa-f]{6}$/));var ZI=f({filename:s(),data:H(),type:M("file"),mimetype:v(s())});var ad=$e(Bo());var YI=f({...Ue,name:s(),permissions:V(s()),platformId:le(s()),type:s(),userCount:v(Pe())});var Zo=(n=>(n.AGENT_DECIDE="agent-decide",n.CHOOSE_YOURSELF="choose-yourself",n.LEAVE_EMPTY="leave-empty",n))(Zo||{}),Tn=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(Tn||{}),In=(n=>(n.SSE="sse",n.STREAMABLE_HTTP="streamable-http",n.SIMPLE_HTTP="http",n))(In||{});var En=(n=>(n.TEXT="text",n.NUMBER="number",n.BOOLEAN="boolean",n))(En||{});var An=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(An||{});var sd=f({mode:L(Zo),value:H()}),ud=f({auth:v(s()),fields:q(s(),sd)}),cd=f({pieceName:s(),pieceVersion:s(),actionName:s(),predefinedInput:v(ud)}),ld=f({type:M("PIECE"),toolName:s().check(Me(1)),pieceMetadata:cd}),dd=f({type:M("none")}),pd=f({type:M("access_token"),accessToken:s()}),md=f({type:M("api_key"),apiKey:s(),apiKeyHeader:s()}),fd=f({type:M("headers"),headers:q(s(),s())}),gd=ot("type",[dd,pd,md,fd]),Go=f({type:M("FLOW"),toolName:s().check(Me(1)),externalFlowId:s(),flowDisplayName:v(s())}),Ho=f({type:M("MCP"),toolName:s().check(Me(1)),serverUrl:Eo(),protocol:L(In),auth:gd}),qo=f({type:M("KNOWLEDGE_BASE"),toolName:s().check(Me(1)),sourceType:L(Tn),sourceId:s(),sourceName:s()}),yd=ot("type",[ld,Go,Ho,qo]),hd=f({displayName:s(),description:v(s()),type:L(En)}),Wo=f({type:M("MARKDOWN"),markdown:s()}),$t={type:M("TOOL_CALL"),input:le(q(s(),H())),output:v(H()),toolName:s(),status:L(An),toolCallId:s(),startTime:s(),endTime:v(s())},$E=f($t),Ko=ot("toolCallType",[f({...$t,toolCallType:M("PIECE"),pieceName:s(),pieceVersion:s(),actionName:s()}),f({...$t,toolCallType:M("FLOW"),displayName:s(),externalFlowId:s()}),f({...$t,toolCallType:M("MCP"),displayName:s(),serverUrl:s()}),f({...$t,toolCallType:M("KNOWLEDGE_BASE"),displayName:s(),sourceType:s()}),f({...$t,toolCallType:M("UNKNOWN"),displayName:s()})]),_d=K([Wo,Ko]);var Sn=(r=>(r.IMAGE="image",r.TEXT="text",r))(Sn||{}),Xe=f({apiKey:s()}),vd=Xe,bd=f({apiKey:s(),apiKeyHash:s()}),Pd=Xe,xd=Xe,Td=Xe,Id=Xe,Ed=Xe,Ad=Xe,Sd=Xe,ea=f({accessKeyId:s().check(Me(1)),secretAccessKey:s().check(Me(1))}),$d=f({}),wd=f({}),zd=f({}),kd=f({}),Od=f({}),Dd=f({}),ta=f({modelId:s(),modelName:s(),modelType:L(Sn)}),ra=f({apiKeyHeader:s(),baseUrl:s(),models:V(ta),defaultHeaders:v(q(s(),s()))}),na=f({accountId:s(),gatewayId:s(),models:V(ta),vertexProject:v(s()),vertexRegion:v(s())}),ia=f({resourceName:s(),apiVersion:st(at(e=>typeof e=="string"&&e.trim().length===0?void 0:e),v(s()))}),oa=f({region:s().check(Me(1))}),Rd=K([vd,Td,Id,Ed,Ad,xd,Pd,bd,ea,Sd]),aa=K([ra,na,ia,oa,$d,zd,kd,Od,wd,Dd]),Nd=f({id:s(),name:s(),type:L(Sn)}),Cd=f({id:s(),name:s(),provider:L(or),config:aa,enabledForChat:te()}),Ud=f({provider:L(or),config:aa,auth:Rd,platformId:s()});var OE={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"},Jo=["gpt-5.5","gpt-5.4-mini","gpt-5.4-nano","gpt-4.1","gpt-4.1-mini"],Md=["claude-sonnet-4-6","claude-opus-4-7","claude-haiku-4-5"],Ld=["claude-sonnet-4.6","claude-opus-4.7","claude-haiku-4.5"],Yo=["gemini-2.5-pro","gemini-2.5-flash","gemini-3.1-pro-preview","gemini-3-flash-preview"],Fd=["grok-4.20","grok-4.1-fast"],jd={openai:Jo,anthropic:Md,google:Yo,activepieces:[...Ld.map(e=>`anthropic/${e}`),...Jo.map(e=>`openai/${e}`),...Yo.map(e=>`google/${e}`),...Fd.map(e=>`x-ai/${e}`)]};var Xo=128e3,Vd={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function Bd({provider:e}){return e?Vd[e]??Xo:Xo}o(Bd,"getMaxContextTokens");var Qo={openai:"text-embedding-3-small",google:"text-embedding-004",azure:"text-embedding-3-small",activepieces:"text-embedding-3-small",openrouter:"openai/text-embedding-3-small"},Zd={anthropic:"native",google:"native",openrouter:"plugin",activepieces:"plugin"},Gd=new Set(["anthropic","mistral"]);function Be(e){return{chatModels:jd[e],maxContextTokens:Bd({provider:e}),defaultEmbeddingModel:Qo[e],supportsEmbedding:Qo[e]!==void 0,supportsImageGeneration:!Gd.has(e),webSearch:Zd[e]}}o(Be,"buildProviderCapabilities");var Hd={openai:Be("openai"),anthropic:Be("anthropic"),openrouter:Be("openrouter"),azure:Be("azure"),google:Be("google"),"cloudflare-gateway":Be("cloudflare-gateway"),custom:Be("custom"),bedrock:Be("bedrock"),mistral:Be("mistral"),activepieces:Be("activepieces")};var qd=f({base64Url:s(),fileName:s(),extension:v(s())}),Wd=f({mimeType:s(),url:s(),fileName:v(s())}),$n=K([qd,Wd]);var Kd=K([f({type:M("file"),value:$n}),f({type:M("markdown"),value:s(),files:v(V($n))})]),Jd=f({sessionId:s(),message:s(),files:v(V(s()))});var ua=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(ua||{}),ca=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(ca||{}),wn=(n=>(n.RECORD_CREATED="RECORD_CREATED",n.RECORD_UPDATED="RECORD_UPDATED",n.RECORD_DELETED="RECORD_DELETED",n))(wn||{});var Yd=K([f({...Ue,name:s(),externalId:s(),type:M("STATIC_DROPDOWN"),tableId:s(),projectId:s(),data:f({options:V(f({value:s()}))})}),f({...Ue,name:s(),externalId:s(),type:K([M("TEXT"),M("NUMBER"),M("DATE"),M("DATETIME")]),tableId:s(),projectId:s()})]),Xd=f({...Ue,name:s(),folderId:le(s()),projectId:s(),externalId:s(),status:xn(ca),trigger:xn(ua)}),Qd=f({...Ue,tableId:s(),projectId:s(),cells:q(s(),f({updated:s(),created:s(),value:H(),fieldName:s()}))}),ep=f({events:V(L(wn)),webhookUrl:s(),flowId:s()}),tp=f({fields:V(f({id:s(),name:s()})),rows:V(q(s(),s())),name:s()}),rp=f({projectId:s(),limit:v(Kt.number()),cursor:v(s()),name:v(s()),externalIds:Dr(s()),folderId:v(s()),folderIds:Dr(s())}),np=f({records:V(V(f({fieldId:s(),value:da()}))),tableId:s()}),ip=f({cells:v(V(f({fieldId:s(),value:da()}))),tableId:s(),agentUpdate:v(te())}),la=ot("operator",[yt("eq"),yt("neq"),yt("gt"),yt("gte"),yt("lt"),yt("lte"),yt("co"),sa("exists"),sa("not_exists")]),op=f({tableId:s(),limit:v(Kt.number()),cursor:v(s()),filters:Dr(la)});function da(){return st(at(e=>e==null?e:String(e)),Wt(s()))}o(da,"coerceToString");function yt(e){return f({fieldId:s(),operator:M(e),value:s()})}o(yt,"valueFilter");function sa(e){return f({fieldId:s(),operator:M(e)})}o(sa,"existenceFilter");var ap=f({status:v(Pe()),body:v(H()),headers:v(q(s(),s()))}),sp=f({...Ue,deleted:le(ct),ownerId:s(),displayName:s(),platformId:s(),externalId:le(s())});var pa=f({name:s(),description:v(s()),type:s(),required:te()}),up=f({pieceName:s(),triggerName:s(),input:f({toolName:s(),toolDescription:s(),inputSchema:V(pa),returnsResponse:te()})});var ma="^[0-9]+\\.[0-9]+\\.[0-9]+$",YE=new RegExp(ma),lp="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",XE=s().check(it(new RegExp(ma))),QE=s().check(it(new RegExp(lp))),dp=f({packageType:M("ARCHIVE"),pieceType:L(Et),pieceName:s(),pieceVersion:s(),archiveId:s(),platformId:s()}),fa=f({packageType:M("REGISTRY"),pieceType:M("OFFICIAL"),pieceName:s(),pieceVersion:s()}),ga=f({packageType:M("REGISTRY"),pieceType:M("CUSTOM"),pieceName:s(),pieceVersion:s(),platformId:s()}),eA=K([fa,ga]),tA=K([dp,fa,ga]);var pp=ot("type",[f({type:M("CRON_EXPRESSION"),cronExpression:s(),timezone:s()}),f({type:M("INTERVAL"),intervalMs:Ao().check(Ir(6e4))})]),rA=f({...Ue,type:L(fe),projectId:s(),flowId:s(),triggerName:s(),schedule:le(pp),flowVersionId:s(),pieceName:s(),pieceVersion:s(),deleted:le(s()),simulate:te()}),ya=(m=>(m.UNKNOWN="UNKNOWN",m.FLOW_RUN_LOG="FLOW_RUN_LOG",m.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",m.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",m.FLOW_STEP_FILE="FLOW_STEP_FILE",m.SAMPLE_DATA="SAMPLE_DATA",m.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",m.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",m.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",m.PROJECT_RELEASE="PROJECT_RELEASE",m.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",m.PLATFORM_ASSET="PLATFORM_ASSET",m.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",m.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",m.KNOWLEDGE_BASE="KNOWLEDGE_BASE",m.FLOW_BUNDLE="FLOW_BUNDLE",m))(ya||{}),ha=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(ha||{}),_a=(r=>(r.S3="S3",r.DB="DB",r))(_a||{}),nA=f({...Ue,projectId:le(s()),platformId:le(s()),type:L(ya),compression:L(ha),data:v(H()),location:L(_a),size:le(Pe()),fileName:le(s()),s3Key:le(s()),metadata:le(q(s(),s()))}),va=(n=>(n.ADMIN="ADMIN",n.MEMBER="MEMBER",n.OPERATOR="OPERATOR",n))(va||{}),ba=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(ba||{}),iA=f({id:s(),email:s(),firstName:s(),status:L(ba),externalId:le(s()),platformId:le(s()),platformRole:L(va),lastName:s(),created:ct,updated:ct,lastActiveDate:le(ct),imageUrl:le(s())});var zn=f({...ee.shape,...W(q(s(),H()),"OBJECT").shape});var kn=f({...ee.shape,formatProperty:v(s()),...W(s(),"RICH_TEXT").shape});var Ia=f({...ee.shape,...W(s(),"COLOR").shape});var On=K([Oe,We,kn,zr,Je,De,Ke,hn,Jt,vn,Ye,Qt,zn,er,Xt,_n,Yt,Ia]),y={ShortText(e){return{...e,valueSchema:void 0,type:"SHORT_TEXT"}},Checkbox(e){return{...e,valueSchema:void 0,type:"CHECKBOX"}},LongText(e){return{...e,valueSchema:void 0,type:"LONG_TEXT"}},RichText(e){return{...e,valueSchema:void 0,type:"RICH_TEXT"}},MarkDown(e){return{displayName:"Markdown",required:!1,description:e.value,type:"MARKDOWN",valueSchema:void 0,variant:e.variant??"INFO"}},Number(e){return{...e,valueSchema:void 0,type:"NUMBER"}},Json(e){return{...e,valueSchema:void 0,type:"JSON"}},Array(e){return{...e,valueSchema:void 0,type:"ARRAY"}},Object(e){return{...e,valueSchema:void 0,type:"OBJECT"}},Dropdown(e){return{...e,valueSchema:void 0,type:"DROPDOWN"}},StaticDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_DROPDOWN"}},MultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"MULTI_SELECT_DROPDOWN"}},DynamicProperties(e){return{...e,valueSchema:void 0,type:"DYNAMIC"}},StaticMultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_MULTI_SELECT_DROPDOWN"}},DateTime(e){return{...e,valueSchema:void 0,type:"DATE_TIME"}},DateRange(e){return{...e,valueSchema:void 0,type:"DATE_RANGE"}},File(e){return{...e,valueSchema:void 0,type:"FILE"}},Custom(e){let t=e.code.toString();return{...e,code:t,valueSchema:void 0,type:"CUSTOM"}},Color(e){return{...e,valueSchema:void 0,type:"COLOR"}}};var Ze=f({displayName:s(),description:v(s()),hasConnectionIdentifier:v(te())});var Ea=f({username:s(),password:s()}),Dn=f({...Ze.shape,username:f({displayName:s(),description:v(s())}),password:f({displayName:s(),description:v(s())}),...W(Ea,"BASIC_AUTH").shape});var yp=q(s(),K([Oe,We,Ye,Je,De])),Rn=f({...Ze.shape,props:yp,...W(H(),"CUSTOM_AUTH").shape});var ht=f({...Ze.shape,...W(f({auth:s()}),"SECRET_TEXT").shape});var hp=q(s(),K([Oe,We,ht,Ye,Je,De,Ke,zr])),Aa=f({...Ze.shape,props:hp,...W(H(),"OIDC").shape});var Nn=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(Nn||{}),Sa=K([Oe,ht,De]),$a=q(s(),Sa),_p=f({props:v(q(s(),Sa)),authUrl:s(),tokenUrl:s(),scope:V(s()),prompt:v(K([M("none"),M("consent"),M("login"),M("omit")])),pkce:v(te()),pkceMethod:v(K([M("plain"),M("S256")])),authorizationMethod:v(L(Nn)),grantType:v(K([L(rr),M(bn)])),extra:v(q(s(),s()))}),wa=f({access_token:s(),props:v($a),data:q(s(),qt())}),Cn=f({...Ze.shape,..._p.shape,...W(wa,"OAUTH2").shape});var wt=K([Dn,Rn,Aa,Cn,ht]),ar="Connection",Un={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||ar}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||ar,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||ar}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||ar}},None(){}};var jS={OAUTH2:"OAUTH2",CLOUD_OAUTH2:"OAUTH2",PLATFORM_OAUTH2:"OAUTH2",BASIC_AUTH:"BASIC_AUTH",CUSTOM_AUTH:"CUSTOM_AUTH",OIDC:"OIDC",SECRET_TEXT:"SECRET_TEXT",NO_AUTH:void 0};var vp=f({...ee.shape,...W(H(),"CUSTOM").shape,code:s()});var bp=K([On,wt]),Mn=q(s(),bp),u$=q(s(),On);var za=K([f({strategy:M("CRON"),cronExpression:s()}),f({strategy:M("NONE")})]),zt=class{constructor(t,r,n,i,a,u,c,d,g,h,I,b,l,p,_,m,P,T,k,ne,ve){this.name=t;this.displayName=r;this.description=n;this.requireAuth=i;this.props=a;this.type=u;this.handshakeConfiguration=c;this.onHandshake=d;this.renewConfiguration=g;this.onRenew=h;this.onEnable=I;this.onDisable=b;this.onStart=l;this.run=p;this.test=_;this.sampleData=m;this.testStrategy=P;this.outputSchema=T;this.aiMetadata=k;this.classification=ne;this.propertyGroups=ve}static{o(this,"ITrigger")}},ie=o(e=>{switch(e.type){case"WEBHOOK":return new zt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,e.handshakeConfiguration??{strategy:"NONE"},e.onHandshake??(async()=>({status:200})),e.renewConfiguration??{strategy:"NONE"},e.onRenew??(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,e.test?"TEST_FUNCTION":"SIMULATION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case"POLLING":return new zt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,"TEST_FUNCTION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case"MANUAL":return new zt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,"TEST_FUNCTION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case"APP_WEBHOOK":return new zt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,A(e.sampleData)&&A(e.test)?"SIMULATION":"TEST_FUNCTION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups)}},"createTrigger");var ka="2",Nr="0.82.0";var Ln=class{constructor(t,r,n,i,a,u,c,d,g=Nr,h,I="",b){this.displayName=t;this.logoUrl=r;this.authors=n;this.events=i;this.categories=c;this.auth=d;this.minimumSupportedRelease=g;this.maximumSupportedRelease=h;this.description=I;this.deprecated=b;this._actions={};this._triggers={};this.getContextInfo=o(()=>({version:ka}),"getContextInfo");(!xp(g)||Tp(g,Nr))&&(this.minimumSupportedRelease=Nr),a.forEach(l=>this._actions[l.name]=l),u.forEach(l=>this._triggers[l.name]=l)}static{o(this,"Piece")}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth:Pp(this.auth),minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,deprecated:this.deprecated,contextInfo:this.getContextInfo?.()}}getAction(t){return this._actions[t]}getTrigger(t){return this._triggers[t]}actions(){return this._actions}triggers(){return this._triggers}},Da=o(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((r,n,i)=>n===i.findIndex(a=>a.type===r.type)))throw new Error("Auth properties must be unique by type");return new Ln(e.displayName,e.logoUrl,e.authors??[],e.events,e.actions,e.triggers,e.categories??[],e.auth,e.minimumSupportedRelease,e.maximumSupportedRelease,e.description,e.deprecated)},"createPiece");function Pp(e){if(e!==void 0)return Array.isArray(e)?e.map(Oa):Oa(e)}o(Pp,"withConnectionIdentifierFlag");function Oa(e){return{...e,hasConnectionIdentifier:e.getConnectionIdentifier!==void 0}}o(Oa,"flagConnectionIdentifier");function xp(e){return/^\d+\.\d+\.\d+$/.test(e)}o(xp,"isValidSimpleSemver");function Tp(e,t){let[r,n,i]=e.split(".").map(Number),[a,u,c]=t.split(".").map(Number);return r!==a?r<a:n!==u?n<u:i<c}o(Tp,"isSemverLessThan");var Ip=v(q(s(),q(s(),s()))),Ra=f({id:v(s()),name:s(),displayName:s(),logoUrl:s(),description:s(),authors:V(s()),platformId:v(s()),directoryPath:v(s()),auth:v(K([wt,V(wt)])),version:s(),categories:v(V(L(At))),minimumSupportedRelease:v(s()),maximumSupportedRelease:v(s()),deprecated:v(te()),i18n:Ip}),Ep=L(["human","ai","both"]),Na=f({description:v(s()),idempotent:v(te())}),Ca=L(["READ","SEARCH","WRITE","DESTRUCTIVE"]);var Ap=L(["tabs","section","summary","builder","footer"]),Ua=f({key:s(),display:Ap,label:v(s()),description:v(s()),icon:v(s()),props:V(s())}),Ma=f({name:s(),displayName:s(),description:s(),props:Mn,propertyGroups:v(V(Ua)),requireAuth:te(),errorHandlingOptions:v(yn),outputSchema:v($r()),audience:v(Ep),aiMetadata:v(Na),classification:v(Ca)}),La=f({name:s(),displayName:s(),description:s(),props:Mn,propertyGroups:v(V(Ua)),errorHandlingOptions:v(yn),type:L(fe),sampleData:H(),handshakeConfiguration:v($r()),renewConfiguration:v(za),testStrategy:L(ir),outputSchema:v($r()),aiMetadata:v(Na),classification:v(Ca)}),Sp=f({...Ra.shape,actions:q(s(),Ma),triggers:q(s(),La)}),$p=f({...Ra.shape,actions:Pe(),triggers:Pe(),suggestedActions:v(V(Ma)),suggestedTriggers:v(V(La))}),Fa=f({projectUsage:Pe(),pieceType:L(Et),packageType:L(tr),platformId:v(s()),archiveId:v(s())}),lw=f({...Sp.shape,...Fa.shape}),dw=f({...$p.shape,...Fa.shape}),pw=f({name:s(),version:s()});var wp=$e(require("path")),zp=$e(require("fs/promises"));var kt=require("node:stream");var Cr=class{constructor(t,r){this.baseUrl=t;this.authenticationConverter=r}static{o(this,"BaseHttpClient")}getUrl(t){let r=new URL(`${this.baseUrl}${t.url}`),n=`${r.origin}${r.pathname}`,i=new URLSearchParams;return r.searchParams.forEach((a,u)=>{i.append(u,a)}),{urlWithoutQueryParams:n,queryParams:i}}getHeaders(t){let r={Accept:"application/json"};return t.authentication&&this.populateAuthentication(t.authentication,r),t.body&&(t.headers?.["Content-Type"]==="text/csv"?r["Content-Type"]="text/csv":r["Content-Type"]="application/json"),t.headers&&(r={...r,...t.headers}),r}populateAuthentication(t,r){this.authenticationConverter.convert(t,r)}};var Ur=class{static{o(this,"DelegatingAuthenticationConverter")}constructor(t=new Fn,r=new jn){this.converters={BEARER_TOKEN:t,BASIC:r}}convert(t,r){return this.converters[t.type].convert(t,r)}},Fn=class{static{o(this,"BearerTokenAuthenticationConverter")}convert(t,r){return r.Authorization=`Bearer ${t.token}`,r}},jn=class{static{o(this,"BasicTokenAuthenticationConverter")}convert(t,r){let n=`${t.username}:${t.password}`,i=Buffer.from(n).toString("base64");return r.Authorization=`Basic ${i}`,r}};var _t=class extends Error{constructor(r,n){let i=n.status||500,a=Buffer.isBuffer(n.responseBody)?n.responseBody.toString():n.responseBody;super(JSON.stringify({response:{status:i,body:a},request:{body:r}}));this.requestBody=r;this.status=i,this.responseBody=a}static{o(this,"HttpError")}errorMessage(){return{response:{status:this.status,body:this.responseBody},request:{body:this.requestBody}}}get response(){return{status:this.status,body:this.responseBody}}get request(){return{body:this.requestBody}}};function ja({error:e,requestBody:t}){return e instanceof _t?e.errorMessage():{response:{status:0,body:e instanceof Error?e.message:String(e)},request:{body:t}}}o(ja,"toFailsafeOutput");var vt=(u=>(u.GET="GET",u.POST="POST",u.PATCH="PATCH",u.PUT="PUT",u.DELETE="DELETE",u.HEAD="HEAD",u))(vt||{});var Mr=class extends Cr{static{o(this,"FetchHttpClient")}constructor(t="",r=new Ur){super(t,r)}async sendRequest(t,r){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:n,queryParams:i}=this.getUrl(t),a=this.getHeaders(t),u=t.queryParams??{};for(let[k,ne]of Object.entries(u))i.append(k,ne);let c=i.toString(),d=c?`${n}?${c}`:n,g=t.responseType??"json",h=t.followRedirects??!0,I=t.retries??0,{body:b,extraHeaders:l,isStream:p}=kp(t.method)?Op(t.body,a):{body:void 0,extraHeaders:{},isStream:!1},_=Rp({...a,...l}),m=await Dp(async()=>{let k=new AbortController,ne=t.timeout&&t.timeout>0?setTimeout(()=>k.abort(),t.timeout):void 0;try{let ve={method:t.method.toString(),headers:_,body:b,redirect:h?"follow":"manual",signal:k.signal};return p&&(ve.duplex="half"),r?.dispatcher!==void 0&&(ve.dispatcher=r.dispatcher),await fetch(d,ve)}finally{ne!==void 0&&clearTimeout(ne)}},p?0:I),P=h?300:400;if(m.status<200||m.status>=P){let k=await Va(m,g==="stream"?"text":g),ne=new _t(t.body,{status:m.status,responseBody:k});throw console.error("[HttpClient#(sanitized error message)] Request failed:",ne),ne}let T=await Va(m,g);return{status:m.status,headers:Np(m.headers),body:T}}};function kp(e){return e!=="GET"&&e!=="HEAD"}o(kp,"acceptsRequestBody");function Op(e,t){if(Za(e))return{body:void 0,extraHeaders:{},isStream:!1};if(Cp(e)){let n=new kt.PassThrough;return e.on("error",i=>n.destroy(i)),e.pipe(n),{body:n,extraHeaders:e.getHeaders(),isStream:!0}}return e instanceof kt.Readable?{body:e,extraHeaders:{},isStream:!0}:typeof e=="string"||Buffer.isBuffer(e)||e instanceof URLSearchParams||e instanceof ArrayBuffer||typeof FormData<"u"&&e instanceof FormData||typeof Blob<"u"&&e instanceof Blob?{body:e,extraHeaders:{},isStream:!1}:(t["Content-Type"]??t["content-type"]??"").includes("application/x-www-form-urlencoded")?{body:new URLSearchParams(e).toString(),extraHeaders:{},isStream:!1}:{body:JSON.stringify(e),extraHeaders:{},isStream:!1}}o(Op,"serializeBody");async function Va(e,t){switch(t){case"arraybuffer":return Buffer.from(await e.arrayBuffer());case"stream":return Za(e.body)?kt.Readable.from([]):kt.Readable.fromWeb(e.body);case"blob":return await e.blob();case"text":return await e.text();default:{let r=await e.text();if(r.length===0)return;try{return JSON.parse(r)}catch{return r}}}}o(Va,"parseResponseBody");async function Dp(e,t){let r;for(let n=0;n<=t;n++)try{let i=await e();if(i.status>=500&&n<t){await Ba(n);continue}return i}catch(i){if(r=i,n<t){await Ba(n);continue}throw i}throw r}o(Dp,"sendWithRetries");function Ba(e){let t=Math.min(1e3*2**e,3e4);return new Promise(r=>setTimeout(r,t))}o(Ba,"backoff");function Rp(e){let t={};for(let[r,n]of Object.entries(e))n!==void 0&&(t[r.toLowerCase()]=Array.isArray(n)?n.join(", "):n);return t}o(Rp,"normalizeHeaders");function Np(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}o(Np,"toHttpHeaders");function Cp(e){return typeof e=="object"&&e!==null&&typeof e.getHeaders=="function"&&typeof e.pipe=="function"&&typeof e.on=="function"}o(Cp,"isNodeFormData");function Za(e){return e==null}o(Za,"isNil");var we=new Mr;var If=$e(require("fs")),Ku=$e(ui());var Ef={"application/json":"json","application/pdf":"pdf","application/xml":"xml","text/xml":"xml","application/zip":"zip","application/gzip":"gz","application/x-tar":"tar","application/octet-stream":"bin","application/msword":"doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.ms-excel":"xls","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-powerpoint":"ppt","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/rtf":"rtf","application/javascript":"js","application/x-www-form-urlencoded":"bin","text/plain":"txt","text/html":"html","text/css":"css","text/csv":"csv","text/calendar":"ics","text/markdown":"md","image/png":"png","image/jpeg":"jpeg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/bmp":"bmp","image/tiff":"tiff","image/x-icon":"ico","image/vnd.microsoft.icon":"ico","image/heic":"heic","audio/mpeg":"mp3","audio/mp4":"m4a","audio/wav":"wav","audio/x-wav":"wav","audio/ogg":"ogg","audio/webm":"weba","video/mp4":"mp4","video/mpeg":"mpeg","video/webm":"webm","video/quicktime":"mov","video/x-msvideo":"avi","font/woff":"woff","font/woff2":"woff2","font/ttf":"ttf","font/otf":"otf"};function Af(e){let t=e.split(";")[0].trim().toLowerCase();return Ef[t]??""}o(Af,"contentTypeToExtension");var Sf=o(({baseUrl:e,relativePath:t})=>{let r=e.endsWith("/")?e:`${e}/`,n=t.startsWith("/")?t.slice(1):t;return`${r}${n}`},"joinBaseUrlWithRelativePath"),$f=o((e,t)=>{let r="https://api.example.com";try{let n=t?e(t):void 0;return(n?.endsWith("/")?n.slice(0,-1):n)??r}catch{return r}},"getBaseUrlForDescription");function Ju({auth:e,baseUrl:t,authMapping:r,description:n,displayName:i,name:a,props:u,extraProps:c,authLocation:d="headers",classification:g="WRITE"}){return D({audience:"human",name:a||"custom_api_call",classification:g,displayName:i||"Custom API Call",description:n||"Make a custom API call to a specific endpoint",auth:e,requireAuth:!!e,props:{url:y.DynamicProperties({auth:e,displayName:"",required:!0,refreshers:[],props:o(async({auth:h})=>({url:y.ShortText({displayName:"URL",description:`You can either use the full URL or the relative path to the base URL
|
|
3
|
-
i.e ${$f(t,h)}/resource or /resource`,required:!0,defaultValue:h?t(h):"",...u?.url??{}})}),"props")}),method:y.StaticDropdown({displayName:"Method",required:!0,options:{options:Object.values(vt).map(h=>({label:h,value:h}))},...u?.method??{}}),headers:y.Object({displayName:"Headers",description:"Authorization headers are injected automatically from your connection.",required:!0,...u?.headers??{}}),queryParams:y.Object({displayName:"Query Parameters",required:!0,...u?.queryParams??{}}),body_type:y.StaticDropdown({displayName:"Body Type",required:!1,defaultValue:"none",options:{disabled:!1,options:[{label:"None",value:"none"},{label:"JSON",value:"json"},{label:"Form Data",value:"form_data"},{label:"Raw",value:"raw"}]}}),body:y.DynamicProperties({auth:e,displayName:"Body",refreshers:["body_type"],required:!1,props:o(async({body_type:h})=>{if(!h)return{};let I=h,b={};switch(I){case"none":break;case"json":b.data=y.Json({displayName:"JSON Body",required:!0,...u?.body??{}});break;case"raw":b.data=y.LongText({displayName:"Raw Body",required:!0});break;case"form_data":b.data=y.Array({displayName:"Form Data",required:!0,properties:{fieldName:y.ShortText({displayName:"Field Name",required:!0}),fieldType:y.StaticDropdown({displayName:"Field Type",required:!0,options:{disabled:!1,options:[{label:"Text",value:"text"},{label:"File",value:"file"}]}}),textFieldValue:y.LongText({displayName:"Text Field Value",required:!1}),fileFieldValue:y.File({displayName:"File Field Value",required:!1})}});break}return b},"props")}),response_is_binary:y.Checkbox({displayName:"Response is Binary ?",description:"Enable for files like PDFs, images, etc.",required:!1,defaultValue:!1}),failsafe:y.Checkbox({displayName:"No Error on Failure",required:!1,...u?.failsafe??{}}),timeout:y.Number({displayName:"Timeout (in seconds)",required:!1,...u?.timeout??{}}),followRedirects:y.Checkbox({displayName:"Follow redirects",required:!1,defaultValue:!1}),...c},run:o(async h=>{let{method:I,url:b,headers:l,queryParams:p,body:_,body_type:m,failsafe:P,timeout:T,response_is_binary:k,followRedirects:ne}=h.propsValue;Or(I,"Method"),Or(b,"URL");let ve=A(r)?{}:await r(h.auth,h.propsValue),ke=b.url,ye=ke.startsWith("http://")||ke.startsWith("https://")?ke:Sf({baseUrl:t(h.auth),relativePath:ke}),X={method:I,url:ye,headers:{...l??{},...d==="headers"||!A(d)?ve:{}},queryParams:{...d==="queryParams"?ve:{},...p??{}},timeout:T?T*1e3:0,followRedirects:ne};if(k&&(X.responseType="arraybuffer"),_)if(m&&m!=="none"){let Ae=_.data;if(m==="form_data"){let pr=Ae,j=new Ku.default;for(let{fieldName:z,fieldType:S,textFieldValue:N,fileFieldValue:w}of pr)S==="text"&&!ce(N)?j.append(z,N):S==="file"&&!ce(w)&&j.append(z,w.data,{filename:w?.filename});X.body=j,X.headers={...X.headers,...j.getHeaders()}}else X.body=Ae}else m||(X.body=_);try{let Ae=await we.sendRequest(X);return await wf(h.files,Ae.body,Ae.status,Ae.headers,k)}catch(Ae){if(P)return ja({error:Ae,requestBody:X.body});throw Ae}},"run")})}o(Ju,"createCustomApiCallAction");var wf=o(async(e,t,r,n,i)=>{let a;if(i&&zf(t)){let u=Array.isArray(n?.["content-type"])?n["content-type"][0]:n?.["content-type"],c=Af(u??"")||"txt",d;t instanceof ArrayBuffer?d=Buffer.from(new Uint8Array(t)):Buffer.isBuffer(t)?d=t:d=Buffer.from(t),a=await e.write({fileName:`output.${c}`,data:d})}else a=t;return{status:r,headers:n,body:a}},"handleBinaryResponse"),zf=o(e=>e instanceof ArrayBuffer||Buffer.isBuffer(e),"isBinaryBody");var pi=$e(dt());var ue={subscribeWebhook:o(async(e,t,r,n,i)=>{let a={method:"POST",url:`${n}/api/v1/webhooks`,body:{event_object:e,event_action:t,subscription_url:r,version:"2.0"},authentication:{type:"BEARER_TOKEN",token:i},queryParams:{}},{body:u}=await we.sendRequest(a);return u},"subscribeWebhook"),unsubscribeWebhook:o(async(e,t,r)=>{let n={method:"DELETE",url:`${t}/api/v1/webhooks/${e}`,authentication:{type:"BEARER_TOKEN",token:r}};return await we.sendRequest(n)},"unsubscribeWebhook")};async function x({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:i,body:a}){let u=`${t}/api${n}`,c={};if(i)for(let[h,I]of Object.entries(i))I!=null&&(c[h]=Array.isArray(I)?I.map(String).join(","):String(I));let d;a&&(d=Object.entries(a).reduce((h,[I,b])=>(A(b)||(h[I]=b),h),{}));let g={method:r,url:u,authentication:{type:"BEARER_TOKEN",token:e},queryParams:c,body:d};try{return(await we.sendRequest(g)).body}catch(h){throw h instanceof _t&&h.response.status===403?new Error("Please reconnect your Pipedrive account."):h}}o(x,"pipedriveApiCall");async function $({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:i,body:a}){let u=i||{};u.start=0,u.limit=500;let c=[],d=!0;do{let g=await x({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:u,body:a});if(A(g.data))break;c.push(...g.data),u.start=g.additional_data.pagination.next_start,d=g.additional_data.pagination.more_items_in_collection}while(d);return c}o($,"pipedrivePaginatedV1ApiCall");async function ge({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:i,body:a}){let u=i?{...i}:{},c,d=[],g=!0;do{let h={...u};c&&(h.cursor=c),h.limit=500;let I=await x({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:h,body:a});if(A(I.data))break;Array.isArray(I.data)?d.push(...I.data):d.push(I.data),g=I.additional_data?.next_cursor!=null,c=I.additional_data?.next_cursor}while(g&&c);return d}o(ge,"pipedrivePaginatedV2ApiCall");function di(e){return(0,pi.default)(e).isValid()?(0,pi.default)(e).format("YYYY-MM-DD"):e}o(di,"formatDateIfValid");function Ie(e,t){let r=e.reduce((i,a)=>(i[a.key]=a,i),{}),n={};for(let[i,a]of Object.entries(t)){if(ce(a))continue;let u=r[i];if(u){if(u.is_subfield){let c=i.split("_")[0];n[c]={...n[c],[u.id_suffix]:u.field_type==="date"?di(a):a};continue}switch(u.field_type){case"monetary":n[i]={...n[i],value:Number(a)};break;case"address":case"daterange":case"timerange":case"time":n[i]={...n[i],value:di(a)};break;case"date":n[i]=di(a);break;default:n[i]=a;break}}}return n}o(Ie,"pipedriveParseCustomFields");function R(e,t){let r={...t},n=t.custom_fields||{};for(let i of e){if(!i.edit_flag)continue;let a=i.key,u=i.name,c=i.field_type;if(a in n){let d=n[a];A(d)?r[u]=null:c==="enum"?r[u]=i.options?.find(g=>g.id===d)?.label||null:c==="set"&&Array.isArray(d)?r[u]=d.map(g=>i.options?.find(h=>h.id===g)?.label||null):r[u]=d}}return delete r.custom_fields,r}o(R,"pipedriveTransformCustomFields");function Pt(e,t){let r={...t};for(let n of e){if(!n.edit_flag)continue;let i=n.key,a=n.name,u=n.field_type;if(i in t){if(t[i]===null||t[i]===void 0)r[a]=null;else if(u==="enum")r[a]=n.options?.find(c=>c.id.toString()===t[i])?.label||null;else if(u==="set"){let c=t[i].split(",");r[a]=c.map(d=>n.options?.find(g=>g.id.toString()===d)?.label||null)}else r[a]=t[i];delete r[i]}}return r}o(Pt,"pipedriveTransformV1CustomFields");var E=Un.OAuth2({description:"",authUrl:"https://oauth.pipedrive.com/oauth/authorize",tokenUrl:"https://oauth.pipedrive.com/oauth/token",required:!0,scope:["base","admin","contacts:full","users:read","deals:full","activities:full","leads:full","products:full","webhooks:full"]});var Yu=ie({auth:E,name:"new_activity",classification:"READ",displayName:"New Activity",description:"Triggers when a new activity is added",aiMetadata:{description:"Fires when a new activity is added in Pipedrive. An activity is a scheduled task or event (call, meeting, deadline, email, etc.) with a subject, type, due date/time, and optional links to a deal, person, organization, or lead. Use to react when work or appointments are scheduled in the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("activity","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_activity_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_activity_trigger");t!=null&&await ue.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=[],r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:"attendees"}});if(A(r.data))return[];for(let n of r.data)t.push(n);return t},async run(e){let t=e.payload.body;return[(await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/activities/${t.data.id}`,query:{include_fields:"attendees"}})).data]},sampleData:{id:8,owner_id:1234,done:!1,type:"deadline",due_date:"2020-06-09",due_time:"10:00",duration:"01:00",busy:!0,add_time:"2020-06-08T12:37:56Z",marked_as_done_time:"2020-08-08T08:08:38Z",subject:"Deadline",public_description:"This is a description",location:{value:"Mustam\xE4e tee 3, Tallinn, Estonia",street_number:"3",route:"Mustam\xE4e tee",sublocality:"Kristiine",locality:"Tallinn",admin_area_level_1:"Harju maakond",admin_area_level_2:null,country:"Estonia",postal_code:"10616",formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia"},org_id:5,person_id:1101,deal_id:300,lead_id:"46c3b0e1-db35-59ca-1828-4817378dff71",is_deleted:!1,update_time:"2020-08-08T12:37:56Z",note:"A note for the activity",creator_user_id:1234,attendees:[{email_address:"attendee@pipedrivemail.com",is_organizer:0,name:"Attendee",person_id:25312,status:"noreply",user_id:null}],participants:[{person_id:17985,primary:!1},{person_id:1101,primary:!0}]}});var Fe=["next_activity_id","last_activity_id","open_deals_count","related_open_deals_count","closed_deals_count","related_closed_deals_count","participant_open_deals_count","participant_closed_deals_count","email_messages_count","activities_count","done_activities_count","undone_activities_count","files_count","notes_count","followers_count","related_won_deals_count","lost_deals_count","related_lost_deals_count","last_incoming_mail_time","last_outgoing_mail_time","won_deals_count"],Ee=["next_activity_id","last_activity_id","first_won_time","products_count","files_count","notes_count","followers_count","email_messages_count","activities_count","done_activities_count","undone_activities_count","participants_count","last_incoming_mail_time","last_outgoing_mail_time","smart_bcc_email"],je=["next_activity_id","last_activity_id","open_deals_count","related_open_deals_count","closed_deals_count","related_closed_deals_count","email_messages_count","people_count","activities_count","done_activities_count","undone_activities_count","files_count","notes_count","followers_count","won_deals_count","related_won_deals_count","lost_deals_count","related_lost_deals_count"];var Xu=ie({auth:E,name:"new_deal",classification:"READ",displayName:"New Deal",description:"Triggers when a new deal is created.",aiMetadata:{description:"Fires the moment a new deal record is created in Pipedrive, representing a sales opportunity (with its title, value, currency, owner, associated person/organization, pipeline and stage). Use to start automations whenever a deal enters the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("deal","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_deal_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_deal_trigger");t!=null&&await ue.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{limit:5,sort_by:"update_time",sort_direction:"desc",include_fields:Ee.join(",")}}),r=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});if(A(t.data))return[];let n=[];for(let i of t.data){let a=R(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/deals/${t.data.id}`,query:{include_fields:Ee.join(",")}}),n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return[R(n,r.data)]},sampleData:{id:1,creator_user_id:8877,owner_id:8877,person_id:1101,org_id:5,stage_id:2,title:"Deal One",value:5e3,currency:"EUR",add_time:"2019-05-29T04:21:51Z",update_time:"2019-11-28T16:19:50Z",stage_change_time:"2019-11-28T15:41:22Z",is_deleted:!1,status:"open",probability:null,next_activity_id:128,last_activity_id:null,lost_reason:null,visible_to:1,close_time:null,pipeline_id:1,won_time:"2019-11-27T11:40:36Z",first_won_time:"2019-11-27T11:40:36Z",lost_time:null,products_count:0,files_count:0,notes_count:2,followers_count:0,email_messages_count:4,activities_count:1,done_activities_count:0,undone_activities_count:1,participants_count:1,expected_close_date:"2019-06-29",last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[11],rotten_time:null,smart_bcc_email:"company+deal1@pipedrivemail.com",custom_fields:{d4de1c1518b4531717c676029a45911c340390a6:{value:2300,currency:"EUR"}}}});var Qu=ie({auth:E,name:"new_person",classification:"READ",displayName:"New Person",description:"Triggers when a new person is created",aiMetadata:{description:"Fires the moment a new person (contact) record is created in Pipedrive, with their name, emails, phones, owner, associated organization, labels, and custom fields. Use to start automations whenever a contact is added to the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("person","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_person_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_person_trigger");t!=null&&await ue.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{limit:5,sort_by:"update_time",sort_direction:"desc",include_fields:Fe.join(",")}}),r=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});if(A(t.data))return[];let n=[];for(let i of t.data){let a=R(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/persons/${t.data.id}`,query:{include_fields:Fe.join(",")}}),n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});return[R(n,r.data)]},sampleData:{id:1,owner_id:123,org_id:1234,name:"Will Smith",first_name:"Will",last_name:"Smith",is_deleted:!1,phones:[{value:"12345",primary:!0,label:"work"}],emails:[{value:"will.smith@example.com",primary:!0,label:"work"}],add_time:"2017-10-18T13:23:07Z",update_time:"2020-05-08T05:30:20Z",visible_to:3,picture_id:4,next_activity_id:128,last_activity_id:34,last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[1],marketing_status:"no_consent"}});var tc=ie({auth:E,name:"updated_deal",classification:"READ",displayName:"Updated Deal",description:"Triggers when a deal is updated.",aiMetadata:{description:"Fires when any field of an existing deal changes in Pipedrive, such as its value, status, owner, stage, or custom fields. Can optionally be scoped to changes on a specific deal, pipeline, or stage. Use to react to edits on sales opportunities in the CRM."},props:{filter_by:y.StaticDropdown({displayName:"Filter by",required:!1,options:{disabled:!1,options:[{label:"Deal Status",value:"status"},{label:"Stage in Pipeline",value:"stage_id"}]}}),filter_by_field_value:y.DynamicProperties({auth:E,displayName:"Field Values",required:!1,refreshers:["filter_by"],props:o(async({auth:e,filter_by:t})=>{if(!e||!t)return{};let r={},n=e,i=t;if(i==="status"&&(r.field_value=y.StaticDropdown({displayName:"Deal Status",required:!0,options:{disabled:!1,options:[{label:"Open",value:"open"},{label:"Won",value:"won"},{label:"Lost",value:"lost"},{label:"Deleted",value:"deleted"}]}})),i==="stage_id"){let a=await we.sendRequest({method:"GET",url:`${n.data.api_domain}/api/v2/stages`,authentication:{type:"BEARER_TOKEN",token:n.access_token}});r.field_value=y.StaticDropdown({displayName:"Stage in Pipeline",required:!0,options:{disabled:!1,options:a.body.data.map(u=>({label:u.name,value:u.id}))}})}return r},"props")}),field_to_watch:y.Dropdown({auth:E,displayName:"Field to watch for Changes On",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{placeholder:"Connect your account",disabled:!0,options:[]};let t=e,r=await we.sendRequest({method:"GET",url:`${t.data.api_domain}/api/v1/dealFields`,authentication:{type:"BEARER_TOKEN",token:t.access_token}}),n=[];for(let i of r.body.data)n.push({label:i.name,value:i.key});return{disabled:!1,options:n}},"options")})},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("deal","change",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_updated_deal_trigger",t.data.id)},async onDisable(e){let t=await e.store.get("_updated_deal_trigger");t&&await ue.unsubscribeWebhook(t,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=e.propsValue.filter_by,r=e.propsValue.filter_by_field_value.field_value,n={limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:Ee.join(",")};t&&r&&(n[t]=r);let i=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:n});if(A(i.data))return[];let a=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),u=[];for(let c of i.data){let d=R(a,c);u.push(d)}return u},async run(e){let t=e.propsValue.filter_by,r=e.propsValue.filter_by_field_value.field_value,n=e.propsValue.field_to_watch==="label"?"label_ids":e.propsValue.field_to_watch,i=e.payload.body,a=ec(i.data),u=ec(i.previous),c=!t&&!n,d=n&&n in u&&a[n]!==u[n],g=t&&a[t]===r;if(c||!t&&d||g&&(!n||d)){let h=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/deals/${i.data.id}`,query:{include_fields:Ee.join(",")}}),I=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return[R(I,h.data)]}return[]},sampleData:{id:1,creator_user_id:8877,owner_id:8877,person_id:1101,org_id:5,stage_id:2,title:"Deal One",value:5e3,currency:"EUR",add_time:"2019-05-29T04:21:51Z",update_time:"2019-11-28T16:19:50Z",stage_change_time:"2019-11-28T15:41:22Z",is_deleted:!1,status:"open",probability:null,next_activity_id:128,last_activity_id:null,lost_reason:null,visible_to:1,close_time:null,pipeline_id:1,won_time:"2019-11-27T11:40:36Z",first_won_time:"2019-11-27T11:40:36Z",lost_time:null,products_count:0,files_count:0,notes_count:2,followers_count:0,email_messages_count:4,activities_count:1,done_activities_count:0,undone_activities_count:1,participants_count:1,expected_close_date:"2019-06-29",last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[11],rotten_time:null,smart_bcc_email:"company+deal1@pipedrivemail.com"}});function ec(e){let{custom_fields:t,...r}=e;if(!t)return r;let n={};for(let[i,a]of Object.entries(t)){if(A(a)){n[i]=a;continue}switch(a.type){case"varchar":case"text":case"varchar_auto":case"double":case"phone":case"date":n[i]=a?.value;break;case"set":n[i]=a?.values?.length?a.values.map(c=>c.id).join(","):"";break;case"enum":case"user":case"org":case"people":n[i]=a?.id;break;case"monetary":n[i]=a?.value,n[`${i}_currency`]=a?.currency;break;case"time":n[i]=a?.value,n[`${i}_timezone_id`]=a?.timezone_id;break;case"timerange":n[i]=a?.from,n[`${i}_timezone_id`]=a?.timezone_id,n[`${i}_until`]=a?.until;break;case"daterange":n[i]=a?.from,n[`${i}_until`]=a?.until;break;case"address":n[i]=a?.value,n[`${i}_subpremise`]=a?.subpremise,n[`${i}_street_number`]=a?.street_number,n[`${i}_route`]=a?.route,n[`${i}_sublocality`]=a?.sublocality,n[`${i}_locality`]=a?.locality,n[`${i}_admin_area_level_1`]=a?.admin_area_level_1,n[`${i}_admin_area_level_2`]=a?.admin_area_level_2,n[`${i}_country`]=a?.country,n[`${i}_postal_code`]=a?.postal_code,n[`${i}_formatted_address`]=a?.formatted_address;break}}return{...r,...n}}o(ec,"flattenCustomFields");var rc=ie({auth:E,name:"updated_person",classification:"READ",displayName:"Updated Person",description:"Triggers when a person is updated.",aiMetadata:{description:"Fires when any field of an existing person (contact) record changes in Pipedrive, such as their name, emails, phones, owner, associated organization, labels, or custom fields. Use to react to edits on contact records in the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("person","change",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_updated_person_trigger",t.data.id)},async onDisable(e){let t=await e.store.get("_updated_person_trigger");t!=null&&await ue.unsubscribeWebhook(t,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{limit:5,sort_by:"update_time",sort_direction:"desc",include_fields:Fe.join(",")}}),r=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});if(A(t.data))return[];let n=[];for(let i of t.data){let a=R(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/persons/${t.data.id}`,query:{include_fields:Fe.join(",")}}),n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});return[R(n,r.data)]},sampleData:{id:1,owner_id:123,org_id:1234,name:"Will Smith",first_name:"Will",last_name:"Smith",is_deleted:!1,phones:[{value:"12345",primary:!0,label:"work"}],emails:[{value:"will.smith@example.com",primary:!0,label:"work"}],add_time:"2017-10-18T13:23:07Z",update_time:"2020-05-08T05:30:20Z",visible_to:3,picture_id:4,next_activity_id:128,last_activity_id:34,last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[1],marketing_status:"no_consent"}});var nc=ie({auth:E,name:"new-lead",classification:"READ",displayName:"New Lead",description:"Triggers when a new lead is created.",aiMetadata:{description:"Fires when a new lead is created in Pipedrive. A lead is an early, unqualified sales opportunity (with a title, optional value, source, and links to a person or organization) that has not yet been converted into a deal. Use to act on inbound prospects as they enter the leads inbox."},props:{},type:"WEBHOOK",async onEnable(e){let t=await we.sendRequest({method:"POST",url:`${e.auth.data.api_domain}/api/v1/webhooks`,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token},body:{event_object:"lead",event_action:"create",subscription_url:e.webhookUrl,version:"2.0"}});await e.store?.put("_new_lead_trigger",{webhookId:t.body.data.id})},async onDisable(e){let t=await e.store?.get("_new_lead_trigger");t!==null&&!A(t.webhookId)&&await we.sendRequest({method:"DELETE",url:`${e.auth.data.api_domain}/api/v1/webhooks/${t.webhookId}`,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token}})},async test(e){let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/leads",query:{limit:10,sort:"update_time DESC"}});if(A(t.data))return[];let r=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),n=[];for(let i of t.data){let a=Pt(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v1/leads/${t.data.id}`}),n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return[Pt(n,r.data)]},sampleData:{id:"f3c23480-c9b1-11ef-bc83-2b8218e028ef",title:"Test lead",owner_id:22701301,creator_id:22701301,label_ids:["a0e5f330-d2a7-4181-a6e3-a44d634b7bf7","8a0e6918-1eee-4e56-a615-c81d712a6a77"],value:null,expected_close_date:null,person_id:2,organization_id:1,is_archived:!1,source_name:"Manually created",origin:"ManuallyCreated",origin_id:null,channel:1,channel_id:null,was_seen:!0,next_activity_id:null,add_time:"2025-01-03T09:06:00.776Z",update_time:"2025-01-03T09:06:00.776Z",visible_to:3}});var ic=ie({auth:E,name:"new-organization",classification:"READ",displayName:"New Organization",description:"Triggers when a new organization is created.",aiMetadata:{description:"Fires the moment a new organization (company) record is created in Pipedrive, with its name, owner, address, labels, and custom fields. Use to start automations whenever a company is added to the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("organization","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_organization_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_organization_trigger");t!=null&&await ue.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:je.join(",")}});if(A(t.data))return[];let r=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),n=[];for(let i of t.data){let a=R(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/organizations/${t.data.id}`,query:{include_fields:je.join(",")}}),n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"});return[R(n,r.data)]},sampleData:{id:1,owner_id:22701301,name:"Pipedrive Sample Org",add_time:"2024-12-04T03:49:06Z",update_time:"2024-12-14T11:03:19Z",is_deleted:!1,visible_to:3,picture_id:null,label_ids:[],address:{value:"Mustam\xE4e tee 3, Tallinn, Estonia",street_number:"3",route:"Mustam\xE4e tee",sublocality:"Kristiine",locality:"Tallinn",admin_area_level_1:"Harju maakond",admin_area_level_2:null,country:"Estonia",postal_code:"10616",formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia"}}});var oc=ie({auth:E,name:"updated-organization",classification:"READ",displayName:"Updated Organization",description:"Triggers when an existing organization is updated.",aiMetadata:{description:"Fires when any field of an existing organization (company) record changes in Pipedrive, such as its name, owner, address, labels, or custom fields. Use to react to edits on company records in the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("organization","change",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_updated_organization_trigger",t.data.id)},async onDisable(e){let t=await e.store.get("_updated_organization_trigger");t!=null&&await ue.unsubscribeWebhook(t,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:je.join(",")}});if(A(t.data))return[];let r=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),n=[];for(let i of t.data){let a=R(r,i);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/organizations/${t.data.id}`,query:{include_fields:je.join(",")}}),n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"});return[R(n,r.data)]},sampleData:{id:1,owner_id:22701301,name:"Pipedrive Sample Org",add_time:"2024-12-04T03:49:06Z",update_time:"2024-12-14T11:03:19Z",is_deleted:!1,visible_to:3,picture_id:null,label_ids:[],address:{value:"Mustam\xE4e tee 3, Tallinn, Estonia",street_number:"3",route:"Mustam\xE4e tee",sublocality:"Kristiine",locality:"Tallinn",admin_area_level_1:"Harju maakond",admin_area_level_2:null,country:"Estonia",postal_code:"10616",formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia"}}});var ac=ie({auth:E,name:"updated-deal-stage",classification:"READ",displayName:"Updated Deal Stage",description:"Triggers when a deal's stage is updated.",aiMetadata:{description:"Fires when an existing deal moves from one pipeline stage to another (its stage_id changes). Represents progress of a deal through the sales pipeline; can optionally be limited to a specific stage. Use to react when deals advance, regress, or reach a particular stage."},type:"WEBHOOK",props:{stage_id:y.Dropdown({auth:E,displayName:"Stage in Pipeline",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{placeholder:"please connect your account.",disabled:!0,options:[]};let t=e,r=await ge({accessToken:t.access_token,apiDomain:t.data.api_domain,method:"GET",resourceUri:"/v2/stages"}),n=[];for(let i of r)n.push({label:`${i.name}`,value:i.id});return{disabled:!1,options:n}},"options")})},async onEnable(e){let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/webhooks",body:{subscription_url:e.webhookUrl,event_object:"deal",event_action:"change",version:"2.0"}});await e.store.put("updated-deal-stage-trigger",t.data.id)},async onDisable(e){let t=await e.store.get("updated-deal-stage-trigger");t&&await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/webhooks/${t}`})},async test(e){let t=e.propsValue.stage_id,r={limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:Ee.join(",")};t&&(r.stage_id=t.toString());let n=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:r});if(A(n.data))return[];let i=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),a=[];for(let u of n.data){let c=R(i,u),d=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/stages/${c.stage_id}`});c.stage=d.data,a.push(c)}return a},async run(e){let t=e.propsValue.stage_id,r=e.payload.body,n=r.data,i=r.previous;if(!i||A(i.stage_id))return[];if(n.stage_id!==i.stage_id){if(t&&n.stage_id!==t)return[];let a=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/deals/${r.data.id}`,query:{include_fields:Ee.join(",")}}),u=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),c=R(u,a.data),d=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/stages/${n.stage_id}`});return c.stage=d.data,[c]}return[]},sampleData:{id:1,creator_user_id:8877,owner_id:8877,person_id:1101,org_id:5,stage_id:2,title:"Deal One",value:5e3,currency:"EUR",add_time:"2019-05-29T04:21:51Z",update_time:"2019-11-28T16:19:50Z",stage_change_time:"2019-11-28T15:41:22Z",is_deleted:!1,status:"open",probability:null,next_activity_id:128,last_activity_id:null,lost_reason:null,visible_to:1,close_time:null,pipeline_id:1,won_time:"2019-11-27T11:40:36Z",first_won_time:"2019-11-27T11:40:36Z",lost_time:null,products_count:0,files_count:0,notes_count:2,followers_count:0,email_messages_count:4,activities_count:1,done_activities_count:0,undone_activities_count:1,participants_count:1,expected_close_date:"2019-06-29",last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[11],rotten_time:null,smart_bcc_email:"company+deal1@pipedrivemail.com",stage:{id:2,order_nr:1,name:"Qualification",is_deleted:!1,deal_probability:!1,pipeline_id:1,is_deal_rot_enabled:!1,days_to_rotten:null,add_time:"2018-09-04T06:24:59Z",update_time:null}}});async function kf(e,t){let r=await x({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v1/filters",query:{type:t}}),n=[];for(let i of r.data)n.push({label:i.name,value:i.id});return n}o(kf,"fetchFiltersOptions");async function Of(e){let t=await x({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v1/activityTypes"}),r=[];for(let n of t.data)r.push({label:n.name,value:n.key_string});return r}o(Of,"fetchActivityTypesOptions");async function Df(e){let t=await ge({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v2/pipelines"}),r=[];for(let n of t)r.push({label:n.name,value:n.id});return r}o(Df,"fetchPipelinesOptions");async function Rf(e){let t=await x({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v1/users:(id,email)"}),r=[];for(let n of t.data)r.push({label:n.email,value:n.id});return r}o(Rf,"fetchOwnersOptions");function sc(e){switch(e.field_type){case"varchar":case"varchar_auto":case"phone":return y.ShortText({displayName:e.name,required:!1});case"text":case"address":return y.LongText({displayName:e.name,required:!1});case"enum":return y.StaticDropdown({displayName:e.name,required:!1,options:{disabled:!1,options:e.options?e.options.map(t=>({label:t.label,value:t.id})):[]}});case"set":return y.StaticMultiSelectDropdown({displayName:e.name,required:!1,options:{disabled:!1,options:e.options?e.options.map(t=>({label:t.label,value:t.id})):[]}});case"double":case"monetary":return y.Number({displayName:e.name,required:!1});case"time":case"timerange":return y.ShortText({displayName:e.name,description:"Please enter time in HH:mm:ss format.",required:!1});case"int":return y.Number({displayName:e.name,required:!1});case"date":case"daterange":return y.DateTime({displayName:e.name,description:"Please enter date in YYYY-MM-DD format.",required:!1});default:return null}}o(sc,"createPropertyDefinition");async function Nf(e,t){let r="";switch(t){case"person":r="/v1/personFields";break;case"deal":case"lead":r="/v1/dealFields";break;case"organization":r="/v1/organizationFields";break;case"product":r="/v1/productFields";break}let n=await $({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:r}),i={};for(let a of n){if(!a.edit_flag)continue;let u=sc(a);u&&(i[a.key]=u)}return i}o(Nf,"retrieveObjectCustomProperties");var Ut=o(e=>y.Dropdown({auth:E,displayName:"Field to search by",required:!0,refreshers:[],options:o(async({auth:t})=>{if(!t)return{disabled:!0,options:[],placeholder:"Please connect your account."};let r=t,n="";switch(e){case"person":n="/v1/personFields";break;case"deal":case"lead":n="/v1/dealFields";break;case"organization":n="/v1/organizationFields";break;case"product":n="/v1/productFields";break}let i=await $({accessToken:r.access_token,apiDomain:r.data.api_domain,method:"GET",resourceUri:n}),a=[];for(let u of i)A(u.id)||a.push({label:u.name,value:u.id.toString()});return{disabled:!1,options:a}},"options")}),"searchFieldProp"),Mt=o(e=>y.DynamicProperties({auth:E,displayName:"Field Value",required:!0,refreshers:["searchField"],props:o(async({auth:t,searchField:r})=>{if(!t||!r)return{};let n=t,i={},a="";switch(e){case"person":a="/v1/personFields";break;case"deal":case"lead":a="/v1/dealFields";break;case"organization":a="/v1/organizationFields";break;case"product":a="/v1/productFields";break}let u=await x({accessToken:n.access_token,apiDomain:n.data.api_domain,method:"GET",resourceUri:`${a}/${r}`}),c=u.data.field_type==="set"?y.StaticDropdown({displayName:u.data.name,required:!1,options:{disabled:!1,options:u.data.options?u.data.options.map(d=>({label:d.label,value:d.id.toString()})):[]}}):sc(u.data);return c?i.field_value=c:i.field_value=y.ShortText({displayName:u.data.name,required:!1}),i},"props")}),"searchFieldValueProp"),Re=o((e,t=!1)=>y.Dropdown({auth:E,displayName:e,refreshers:[],required:t,options:o(async({auth:r})=>r?{disabled:!1,options:await Rf(r)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"ownerIdProp"),Ge=o((e,t=!1)=>y.Dropdown({auth:E,displayName:"Filter",refreshers:[],required:t,options:o(async({auth:r})=>r?{disabled:!1,options:await kf(r,e)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"filterIdProp"),He=o((e=!1)=>y.Number({displayName:"Organization ID",description:"You can use Find Organization action to retrieve org ID.",required:e}),"organizationIdProp"),Cf=o((e=!1)=>y.Dropdown({auth:E,displayName:"Pipeline",refreshers:[],required:e,options:o(async({auth:t})=>t?{disabled:!1,options:await Df(t)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"dealPipelineIdProp"),Uf=o((e=!1)=>y.Dropdown({auth:E,displayName:"Stage",description:"If a stage is chosen above, the pipeline field will be ignored.",required:e,refreshers:[],options:o(async({auth:t})=>{if(!t)return{placeholder:"Please connect your account.",disabled:!0,options:[]};let r=t,n=await ge({accessToken:r.access_token,apiDomain:r.data.api_domain,method:"GET",resourceUri:"/v2/stages"}),i=[];for(let a of n)i.push({label:`${a.name}`,value:a.id});return{disabled:!1,options:i}},"options")}),"dealStageIdProp"),Ne=o((e=!1)=>y.Number({displayName:"Person ID",description:"You can use Find Person action to retrieve person ID.",required:e}),"personIdProp"),lr=o((e,t,r=!1)=>y.MultiSelectDropdown({auth:E,displayName:"Label",required:r,refreshers:[],options:o(async({auth:n})=>{if(!n)return{disabled:!0,options:[],placeholder:"Please connect your account."};let i=n,a="";switch(e){case"person":a="/v1/personFields";break;case"deal":a="/v1/dealFields";break;case"organization":a="/v1/organizationFields";break}let c=(await $({accessToken:i.access_token,apiDomain:i.data.api_domain,method:"GET",resourceUri:a})).find(g=>g.key===t),d=[];if(c&&c.options)for(let g of c.options)d.push({label:g.label,value:g.id});return{disabled:!1,options:d}},"options")}),"labelIdsProp"),Mf=o((e=!1)=>y.MultiSelectDropdown({auth:E,displayName:"Label",required:e,refreshers:[],options:o(async({auth:t})=>{if(!t)return{disabled:!0,options:[],placeholder:"Please connect your account."};let r=t,n=await x({accessToken:r.access_token,apiDomain:r.data.api_domain,method:"GET",resourceUri:"/v1/leadLabels"}),i=[];for(let a of n.data)i.push({label:`${a.name} (${a.color})`,value:a.id});return{disabled:!1,options:i}},"options")}),"leadLabelIdsProp"),Wr=o((e=!1)=>y.Number({displayName:"Product ID",description:"You can use Find Product action to retrieve product ID.",required:e}),"productIdProp"),pt=y.StaticDropdown({displayName:"Visible To",required:!1,options:{disabled:!1,options:[{label:"Owner & followers",value:1},{label:"Entire company",value:3}]}}),dr=o((e=!1)=>y.ShortText({displayName:"Lead ID",required:e}),"leadIdProp"),fi=o((e=!1)=>y.Dropdown({auth:E,displayName:"Activity Type",refreshers:[],required:e,options:o(async({auth:t})=>t?{disabled:!1,options:await Of(t)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"activityTypeIdProp"),Qe=o((e=!1)=>y.Number({displayName:"Deal ID",description:"You can use Find Deal action to retrieve deal ID.",required:e}),"dealIdProp"),Kr={creationTime:y.DateTime({displayName:"Creation Time",required:!1}),status:y.StaticDropdown({displayName:"Status",required:!1,options:{disabled:!1,options:[{label:"Open",value:"open"},{label:"Won",value:"won"},{label:"Lost",value:"lost"},{label:"Deleted",value:"deleted"}]}}),stageId:Uf(!1),pipelineId:Cf(!1),ownerId:Re("Owner",!1),organizationId:He(!1),personId:Ne(!1),labelIds:lr("deal","label",!1),probability:y.Number({displayName:"Probability",required:!1}),expectedCloseDate:y.DateTime({displayName:"Expected Close Date",required:!1,description:"Please enter date in YYYY-MM-DD format."}),dealValue:y.Number({displayName:"Value",required:!1}),dealValueCurrency:y.ShortText({displayName:"Currency",required:!1,description:'Please enter currency code (e.g., "USD", "EUR").'}),visibleTo:pt,customfields:mt("deal")},Jr={ownerId:Re("Owner",!1),organizationId:He(!1),personId:Ne(!1),labelIds:Mf(!1),expectedCloseDate:y.DateTime({displayName:"Expected Close Date",required:!1,description:"Please enter date in YYYY-MM-DD format."}),visibleTo:pt,channel:y.Dropdown({auth:E,displayName:"Channel",required:!1,refreshers:[],options:o(async({auth:e})=>{if(!e)return{disabled:!0,options:[],placeholder:"Please connect your account."};let t=e,n=(await $({accessToken:t.access_token,apiDomain:t.data.api_domain,method:"GET",resourceUri:"/v1/dealFields:(key,name,options)"})).find(a=>a.key==="channel"),i=[];if(n)for(let a of n.options??[])i.push({label:a.label,value:a.id});return{disabled:!1,options:i}},"options")}),leadValue:y.Number({displayName:"Lead Value Amount",required:!1}),leadValueCurrency:y.ShortText({displayName:"Lead Value Currency",required:!1,description:'The currency of the lead value (e.g., "USD", "EUR").'}),customfields:mt("lead")},Yr={ownerId:Re("Owner",!1),visibleTo:pt,labelIds:lr("organization","label_ids",!1),address:y.LongText({displayName:"Address",required:!1}),customfields:mt("organization")},Xr={ownerId:Re("Owner",!1),organizationId:He(!1),email:y.Array({displayName:"Email",required:!1}),phone:y.Array({displayName:"Phone",required:!1}),labelIds:lr("person","label_ids",!1),firstName:y.ShortText({displayName:"First Name",required:!1}),lastName:y.ShortText({displayName:"Last Name",required:!1}),visibleTo:pt,marketing_status:y.StaticDropdown({displayName:"Marketing Status",description:"Marketing opt-in status",required:!1,options:{disabled:!1,options:[{label:"No Consent",value:"no_consent"},{label:"Unsubscribed",value:"unsubscribed"},{label:"Subscribed",value:"subscribed"},{label:"Archived",value:"archived"}]}}),customfields:mt("person")},Qr={organizationId:He(!1),personId:Ne(!1),dealId:Qe(!1),leadId:dr(!1),assignTo:Re("Assign To",!1),type:fi(!1),dueDate:y.DateTime({displayName:"Due Date",required:!1,description:"Please enter date in YYYY-MM-DD format."}),dueTime:y.ShortText({displayName:"Due Time",required:!1,description:"Please enter time in HH:MM format."}),duration:y.ShortText({displayName:"Duration",required:!1,description:'Please enter time in HH:MM format (e.g., "01:30" for 1 hour 30 minutes).'}),isDone:y.Checkbox({displayName:"Mark as Done?",required:!1,defaultValue:!1}),busy:y.StaticDropdown({displayName:"Free or Busy",required:!1,options:{disabled:!1,options:[{label:"Free",value:"free"},{label:"Busy",value:"busy"}]}}),note:y.LongText({displayName:"Note",required:!1}),publicDescription:y.LongText({displayName:"Public Description",required:!1})};function mt(e){return y.DynamicProperties({auth:E,displayName:"Custom Fields",required:!1,refreshers:[],props:o(async({auth:t})=>t?await Nf(t,e):{},"props")})}o(mt,"customFieldsProp");var uc=D({auth:E,name:"create-person",classification:"WRITE",displayName:"Create Person",description:"Creates a new person.",audience:"both",aiMetadata:{description:"Creates a new person (contact) with a name, optional emails/phones, owner, organization, and custom fields. Provide either a single Name or First/Last Name, not both. Use to add a contact (use Update Person to edit an existing one, or Find Person to check for one first). Not idempotent: each call creates a separate person, so guard against duplicates.",idempotent:!1},props:{name:y.ShortText({displayName:"Name",required:!1}),...Xr},async run(e){let{name:t,ownerId:r,organizationId:n,marketing_status:i,visibleTo:a,firstName:u,lastName:c}=e.propsValue,d=e.propsValue.phone??[],g=e.propsValue.email??[],h=e.propsValue.labelIds??[],I=e.propsValue.customfields??{};if(t&&(u||c))throw new Error("Provide either Name OR First Name/Last Name, not both.");if(!t&&!u&&!c)throw new Error("Provide Name or at least one of First Name / Last Name.");if(!t&&(u&&!c||!u&&c))throw new Error("If First Name is provided, Last Name must be provided as well.");let b=d.map((k,ne)=>({value:k,label:"work",primary:ne===0})),l=g.map((k,ne)=>({value:k,label:"work",primary:ne===0})),p={name:t,owner_id:r,org_id:n,visible_to:a,first_name:u,last_name:c,marketing_status:i};b.length&&(p.phones=b),l.length&&(p.emails=l),h.length&&(p.label_ids=h);let _=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),m=Ie(_,I);ce(m)||(p.custom_fields=m);let P=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/persons",body:p}),T=R(_,P.data);return{...P,data:T}}});var cc=D({auth:E,name:"update-person",classification:"WRITE",displayName:"Update Person",description:"Updates an existing person.",audience:"both",aiMetadata:{description:"Updates fields on an existing person identified by their person ID, such as name, emails, phones, owner, organization, and custom fields; only supplied fields change. Use to edit a contact you have the ID for (use Create Person to add one, or Find Person to locate it). Idempotent: repeating the same update converges to the same person state.",idempotent:!0},props:{personId:Ne(!0),name:y.ShortText({displayName:"Name",required:!1}),...Xr},async run(e){let{name:t,ownerId:r,personId:n,organizationId:i,marketing_status:a,visibleTo:u,firstName:c,lastName:d}=e.propsValue,g=e.propsValue.phone??[],h=e.propsValue.email??[],I=e.propsValue.labelIds??[],b=e.propsValue.customfields??{};if(c&&!d||!c&&d)throw new Error("If First Name is provided, Last Name must be provided as well.");let l=g.map((ne,ve)=>({value:ne,label:"work",primary:ve===0})),p=h.map((ne,ve)=>({value:ne,label:"work",primary:ve===0})),_={name:t,owner_id:r,org_id:i,marketing_status:a,visible_to:u,first_name:c,last_name:d};l.length&&(_.phones=l),p.length&&(_.emails=p),I.length&&(_.label_ids=I);let m=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),P=Ie(m,b);ce(P)||(_.custom_fields=P);let T=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/persons/${n}`,body:_}),k=R(m,T.data);return{...T,data:k}}});var lc=D({auth:E,name:"create-organization",classification:"WRITE",displayName:"Create Organization",description:"Creates a new organization.",audience:"both",aiMetadata:{description:"Creates a new organization (company) with a required name and optional owner, address, visibility, labels, and custom fields. Use to add a company record (use Update Organization to edit one, or Find Organization to check for an existing match). Not idempotent: each call creates a separate organization, so guard against duplicates.",idempotent:!1},props:{name:y.ShortText({displayName:"Name",required:!0}),...Yr},async run(e){let{name:t,ownerId:r,address:n,visibleTo:i}=e.propsValue,a=e.propsValue.labelIds??[],u=e.propsValue.customfields??{},c={name:t,owner_id:r,visible_to:i};n&&typeof n=="string"&&(c.address={value:n}),a.length>0&&(c.label_ids=a);let d=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),g=Ie(d,u);ce(g)||(c.custom_fields=g);let h=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/organizations",body:c}),I=R(d,h.data);return{...h,data:I}}});var dc=D({auth:E,name:"update-organization",classification:"WRITE",displayName:"Update Organization",description:"Updates an existing organization.",audience:"both",aiMetadata:{description:"Update fields on an existing organization identified by ID (name, owner, address, visibility, labels, and custom fields). Pick this to modify a known organization; only supplied fields are changed. Re-running with the same inputs yields the same final state.",idempotent:!0},props:{organizationId:He(!0),name:y.ShortText({displayName:"Name",required:!1}),...Yr},async run(e){let{name:t,ownerId:r,address:n,visibleTo:i,organizationId:a}=e.propsValue,u=e.propsValue.labelIds??[],c=e.propsValue.customfields??{},d={name:t,owner_id:r,visible_to:i};n&&typeof n=="string"&&(d.address={value:n}),u.length>0&&(d.label_ids=u);let g=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),h=Ie(g,c);ce(h)||(d.custom_fields=h);let I=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/organizations/${a}`,body:d}),b=R(g,I.data);return{...I,data:b}}});var pc=$e(dt()),mc=D({auth:E,name:"create-lead",classification:"WRITE",displayName:"Create Lead",description:"Creates a new lead.",audience:"both",aiMetadata:{description:"Creates a new lead with a required title and optional value, owner, channel, and custom fields. At least one of a linked person or organization must be supplied. Use to capture an unqualified opportunity (use Create Deal once it advances to your pipeline, or Update Lead to edit one). Not idempotent: each call creates a separate lead.",idempotent:!1},props:{title:y.ShortText({displayName:"Title",required:!0}),...Jr},async run(e){let{title:t,leadValue:r,leadValueCurrency:n,expectedCloseDate:i,visibleTo:a,ownerId:u,organizationId:c,personId:d,channel:g}=e.propsValue;if(!d&&!c)throw new Error("Neither an Organization nor a Person were provided. One of them must be provided in order to create a lead.");let h=e.propsValue.labelIds??[],I=e.propsValue.customfields??{},b={title:t,owner_id:u,organization_id:c,person_id:d,channel:g,visible_to:a};if(h.length>0&&(b.label_ids=h),i&&(b.expected_close_date=(0,pc.default)(i).format("YYYY-MM-DD")),r){if(!n)throw new Error("lead Value Currency is required when lead Value is provided");b.value={amount:r,currency:n}}let l={};Object.entries(I).forEach(([P,T])=>{l[P]=Array.isArray(T)?T.join(","):T});let p=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/leads",body:{...b,...l}}),_=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),m=Pt(_,p.data);return{...p,data:m}}});var fc=$e(dt()),gc=D({auth:E,name:"update-lead",classification:"WRITE",displayName:"Update Lead",description:"Updates an existing lead.",audience:"both",aiMetadata:{description:"Updates fields on an existing lead identified by its lead ID, such as title, owner, value, channel, or linked person/organization; only supplied fields change. Use to modify a lead you have the ID for (use Create Lead to add one, or Find Lead to locate it). Idempotent: repeating the same update converges to the same lead state.",idempotent:!0},props:{leadId:dr(!0),title:y.ShortText({displayName:"Title",required:!1}),...Jr},async run(e){let{title:t,ownerId:r,leadId:n,channel:i,organizationId:a,personId:u,expectedCloseDate:c,visibleTo:d,leadValue:g,leadValueCurrency:h}=e.propsValue,I=e.propsValue.labelIds??[],b=e.propsValue.customfields??{},l={title:t,owner_id:r,organization_id:a,person_id:u,channel:i,visible_to:d};if(I.length>0&&(l.label_ids=I),c&&(l.expected_close_date=(0,fc.default)(c).format("YYYY-MM-DD")),g){if(!h)throw new Error("lead Value Currency is required when lead Value is provided");l.value={amount:g,currency:h}}let p={};Object.entries(b).forEach(([T,k])=>{p[T]=Array.isArray(k)&&k.length>0?k.join(","):k});let _=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v1/leads/${n}`,body:{...l,...p}}),m=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),P=Pt(m,_.data);return{..._,data:P}}});var gi=$e(dt());var yc=D({auth:E,name:"create-deal",classification:"WRITE",displayName:"Create Deal",description:"Creates a new deal.",audience:"both",aiMetadata:{description:"Creates a new deal with a required title and optional value, currency, pipeline/stage, status, owner, and linked person/organization. Use to add a sales opportunity to a pipeline (use Update Deal to edit one, or Add Product to Deal to attach line items). Not idempotent: each call creates a separate deal, so guard against duplicates.",idempotent:!1},props:{title:y.ShortText({displayName:"Title",required:!0}),...Kr},async run(e){let{title:t,dealValue:r,dealValueCurrency:n,expectedCloseDate:i,visibleTo:a,probability:u,stageId:c,status:d,pipelineId:g,ownerId:h,organizationId:I,personId:b,creationTime:l}=e.propsValue,p=e.propsValue.labelIds??[],_=e.propsValue.customfields??{},m={title:t,pipeline_id:g,stage_id:c,status:d,add_time:l?(0,gi.default)(l).format("YYYY-MM-DDTHH:mm:ss[Z]"):void 0,probability:u,visible_to:a,owner_id:h,org_id:I,person_id:b,value:r,currency:n};p.length>0&&(m.label_ids=p),i&&(m.expected_close_date=(0,gi.default)(i).format("YYYY-MM-DD"));let P=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),T=Ie(P,_);ce(T)||(m.custom_fields=T);let k=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/deals",body:m}),ne=R(P,k.data);return{...k,data:ne}}});var hc=$e(dt());var _c=D({auth:E,name:"update-deal",classification:"WRITE",displayName:"Update Deal",description:"Updates an existing deal.",audience:"both",aiMetadata:{description:"Updates fields on an existing deal identified by its deal ID, such as title, value, stage, status, owner, or linked person/organization; only supplied fields are changed. Use to modify a deal you already know the ID of (use Create Deal to add a new one, or Find Deal to locate one first). Idempotent: repeating the same update converges to the same deal state.",idempotent:!0},props:{dealId:Qe(!0),title:y.ShortText({displayName:"Title",required:!1}),...Kr},async run(e){let{dealId:t,title:r,dealValue:n,dealValueCurrency:i,expectedCloseDate:a,visibleTo:u,probability:c,stageId:d,status:g,pipelineId:h,ownerId:I,organizationId:b,personId:l}=e.propsValue,p=e.propsValue.labelIds??[],_=e.propsValue.customfields??{},m={title:r,pipeline_id:h,stage_id:d,status:g,probability:c,visible_to:u,owner_id:I,org_id:b,person_id:l,value:n,currency:i};p.length>0&&(m.label_ids=p),a&&(m.expected_close_date=(0,hc.default)(a).format("YYYY-MM-DD"));let P=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),T=Ie(P,_);ce(T)||(m.custom_fields=T);let k=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/deals/${t}`,body:m}),ne=R(P,k.data);return{...k,data:ne}}});var vc=D({auth:E,name:"create-product",classification:"WRITE",displayName:"Create Product",description:"Creates a new product.",audience:"both",aiMetadata:{description:"Create a new product in the catalog with name, code, pricing (price/cost/overhead/currency/tax), unit, owner, visibility, and custom fields. Pick this to add a product; each call creates a separate record, so repeating it produces duplicates. Not idempotent.",idempotent:!1},props:{name:y.ShortText({displayName:"Name",required:!0}),code:y.ShortText({displayName:"Code",required:!1}),description:y.LongText({displayName:"Description",required:!1}),unit:y.ShortText({displayName:"Unit",required:!1}),tax:y.Number({displayName:"Tax percentage",required:!1}),isActive:y.Checkbox({displayName:"Is Active ?",required:!1,defaultValue:!0}),ownerId:Re("Owner",!1),currency:y.ShortText({displayName:"Currency",required:!1,description:'Please enter currency code (e.g., "USD", "EUR").'}),price:y.Number({displayName:"Price",required:!1}),cost:y.Number({displayName:"Cost",required:!1}),overheadCost:y.Number({displayName:"Overhead Cost",required:!1}),visibleTo:pt,customfields:mt("product")},async run(e){let{name:t,code:r,description:n,unit:i,tax:a,isActive:u,ownerId:c,currency:d,price:g,cost:h,overheadCost:I,visibleTo:b}=e.propsValue,l=e.propsValue.customfields??{},p={name:t,code:r,description:n,unit:i,tax:a,is_deleted:!u,prices:[{price:g??0,currency:d??"USD",cost:h??0,direct_cost:I??0}],visible_to:b};c&&(p.owner_id=c);let _=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"}),m=Ie(_,l);ce(m)||(p.custom_fields=m);let P=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/products",body:p}),T=R(_,P.data);return{...P,data:T}}});var bc=D({auth:E,name:"add-product-to-deal",classification:"WRITE",displayName:"Add Product to Deal",description:"Adds a product to a deal.",audience:"both",aiMetadata:{description:"Attaches an existing product (by product ID) as a line item on a deal (by deal ID), setting its unit price, quantity, and optional discount and tax. Use when building out the products on a deal; requires both IDs and a price and quantity. Not idempotent: each call adds another line item, so calling it twice attaches the product twice.",idempotent:!1},props:{dealId:Qe(!0),productId:Wr(!0),price:y.Number({displayName:"Price",required:!0}),quantity:y.Number({displayName:"Quantity",required:!0}),discount:y.Number({displayName:"Discount",required:!1}),discountType:y.StaticDropdown({displayName:"Discount Type",required:!1,options:{disabled:!1,options:[{label:"Percentage",value:"percentage"},{label:"Amount",value:"amount"}]}}),comments:y.LongText({displayName:"Comments",required:!1}),enableProduct:y.Checkbox({displayName:"Enable Product?",required:!1,defaultValue:!0}),taxMethod:y.StaticDropdown({displayName:"Tax Method",required:!1,options:{disabled:!1,options:[{label:"Exclusive",value:"exclusive"},{label:"Inclusive",value:"inclusive"},{label:"None",value:"none"}]}}),taxPercentage:y.Number({displayName:"Tax Percentage",required:!1})},async run(e){let{productId:t,dealId:r,price:n,quantity:i,discountType:a,discount:u,comments:c,enableProduct:d,taxPercentage:g,taxMethod:h}=e.propsValue;return await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:`/v2/deals/${r}/products`,body:{product_id:t,item_price:n,quantity:i,discount_type:a,discount:u,comments:c??"",is_enabled:d,tax:g,tax_method:h}})}});var Pc=D({auth:E,name:"add-labels-to-person",classification:"WRITE",displayName:"Add Labels to Person",description:"Adds existing labels to an existing person.",audience:"both",aiMetadata:{description:"Set the label(s) on an existing person by ID using pre-existing label definitions. Pick this to tag/categorize a known person; it replaces the person's label_ids with the supplied set rather than merging, so include all labels that should remain. Mutates the person record.",idempotent:!1},props:{personId:Ne(!0),labelIds:lr("person","label_ids",!0)},async run(e){let{personId:t}=e.propsValue,r=e.propsValue.labelIds??[],n={};r.length>0&&(n.label_ids=r);let i=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/persons/${t}`,body:{...n}}),a=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),u=R(a,i.data);return{...i,data:u}}});var xc=$e(dt()),Tc=D({auth:E,name:"create-activity",classification:"WRITE",displayName:"Create Activity",description:"Creates a new activity.",audience:"both",aiMetadata:{description:"Creates an activity (call, meeting, task, etc.) with a subject and optional type, due date/time, owner, and links to a deal, lead, person, or organization. Use to schedule or log work against CRM records (use Update Activity to change one that exists). Not idempotent: each call creates a separate activity.",idempotent:!1},props:{subject:y.ShortText({displayName:"Subject",required:!0}),...Qr},async run(e){let{subject:t,organizationId:r,personId:n,dealId:i,leadId:a,assignTo:u,type:c,dueDate:d,dueTime:g,duration:h,isDone:I,busy:b,note:l,publicDescription:p}=e.propsValue,_={subject:t,org_id:r,deal_id:i,lead_id:a,public_description:p,type:c,owner_id:u,due_time:g,duration:h,done:I,note:l};return n&&(_.participants=[{person_id:n,primary:!0}]),b&&(_.busy=b==="busy"),d&&(_.due_date=(0,xc.default)(d).format("YYYY-MM-DD")),await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/activities",body:_})}});var Ic=$e(dt()),Ec=D({auth:E,name:"update-activity",classification:"WRITE",displayName:"Update Activity",description:"Updates an existing activity.",audience:"both",aiMetadata:{description:"Updates fields on an existing activity identified by its activity ID, such as subject, type, due date/time, owner, done state, and linked records; only supplied fields change. Use to reschedule or mark an activity done (use Create Activity to add a new one). Idempotent: repeating the same update converges to the same activity state.",idempotent:!0},props:{activityId:y.Number({displayName:"Activity ID",required:!0}),subject:y.ShortText({displayName:"Subject",required:!1}),...Qr},async run(e){let{activityId:t,subject:r,organizationId:n,personId:i,dealId:a,leadId:u,assignTo:c,type:d,dueDate:g,dueTime:h,duration:I,isDone:b,busy:l,note:p,publicDescription:_}=e.propsValue,m={subject:r,org_id:n,deal_id:a,lead_id:u,note:p,public_description:_,type:d,owner_id:c,due_time:h,duration:I,done:b};return i&&(m.participants=[{person_id:i,primary:!0}]),l&&(m.busy=l==="busy"),g&&(m.due_date=(0,Ic.default)(g).format("YYYY-MM-DD")),await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/activities/${t}`,body:m})}});var Ac=$e(ui());var Sc=D({auth:E,name:"attach-file",classification:"WRITE",displayName:"Attach File",description:"Uploads a file and attaches it to a deal,person,organization,activity or product.",audience:"both",aiMetadata:{description:"Uploads a file and attaches it to one or more CRM records by supplying any of the optional deal, person, organization, product, or activity IDs. Use to add documents or images to existing records; requires the file content and a file name. Not idempotent: each call uploads and creates a separate file attachment.",idempotent:!1},props:{file:y.File({displayName:"File",required:!0}),fileName:y.ShortText({displayName:"File Name",required:!0}),dealId:Qe(!1),personId:Ne(!1),organizationId:He(!1),productId:Wr(!1),activityId:y.Number({displayName:"Activity ID",required:!1})},async run(e){let{file:t,fileName:r,dealId:n,personId:i,organizationId:a,productId:u,activityId:c}=e.propsValue,d=new Ac.default;return d.append("file",t.data,r),n&&d.append("deal_id",n),i&&d.append("person_id",i),a&&d.append("org_id",a),u&&d.append("product_id",u),c&&d.append("activity_id",c),(await we.sendRequest({method:"POST",url:`${e.auth.data.api_domain}/api/v1/files`,body:d,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token},headers:{...d.getHeaders()}})).body}});var $c=D({auth:E,name:"add-follower",classification:"WRITE",displayName:"Add Follower",description:"Adds a follower to a deal, person, organization or product.",audience:"both",aiMetadata:{description:"Adds a user as a follower of a single record, with the Target Object dropdown selecting the type (deal, person, organization, or product) and the Target Object ID identifying it. Use to subscribe a user to updates on a record; requires the follower user ID. Not idempotent: each call creates a follower association.",idempotent:!1},props:{followerId:Re("Follower",!0),entity:y.StaticDropdown({displayName:"Target Object",description:"Type of object to add the follower to.",required:!0,options:{disabled:!1,options:[{label:"Deal",value:"deal"},{label:"Person",value:"person"},{label:"Organization",value:"organization"},{label:"Product",value:"product"}]}}),entityId:y.ShortText({displayName:"Target Object ID",description:"ID of the object to add the follower to.",required:!0})},async run(e){let{followerId:t,entity:r,entityId:n}=e.propsValue,i="";switch(r){case"deal":i=`/deals/${n}/followers`;break;case"organization":i=`/organizations/${n}/followers`;break;case"person":i=`/persons/${n}/followers`;break;case"product":i=`/products/${n}/followers`;break}if(!i)throw new Error(`Invalid object type: ${r}`);return await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:`/v2${i}`,body:{user_id:t}})}});var wc=D({auth:E,name:"create-note",classification:"WRITE",displayName:"Create Note",description:"Creates a new note.",audience:"both",aiMetadata:{description:"Create a note with the given content and attach it to at least one deal, person, organization, or lead (at least one association is required, with optional pinning). Pick this to record a comment or log against a CRM record; each call creates a new note, so repeating it produces duplicates. Not idempotent.",idempotent:!1},props:{content:y.LongText({displayName:"Content",required:!0}),dealId:Qe(!1),pinnedToDeal:y.Checkbox({displayName:"Pin note to deal?",required:!1,defaultValue:!1}),personId:Ne(!1),pinnedToPerson:y.Checkbox({displayName:"Pin note to person?",required:!1,defaultValue:!1}),organizationId:He(!1),pinnedToOrganization:y.Checkbox({displayName:"Pin note to organization?",required:!1,defaultValue:!1}),leadId:dr(!1),pinnedToLead:y.Checkbox({displayName:"Pin note to lead?",required:!1,defaultValue:!1})},async run(e){let{content:t,dealId:r,personId:n,organizationId:i,leadId:a,pinnedToDeal:u,pinnedToPerson:c,pinnedToOrganization:d,pinnedToLead:g}=e.propsValue;if(!r&&!n&&!i&&!a)throw new Error("Note must be associated with at least one organization, person, deal, lead or project.");let h={content:t,pinned_to_deal_flag:u?1:0,pinned_to_person_flag:c?1:0,pinned_to_organization_flag:d?1:0,pinned_to_lead_flag:g?1:0,lead_id:a,person_id:n,org_id:i,deal_id:r};return await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/notes",body:h})}});var zc=D({auth:E,name:"get-note",classification:"READ",displayName:"Retrieve a Note",description:"Finds a note by ID.",audience:"both",aiMetadata:{description:"Retrieves a single note by its numeric note ID. Use when you already have the note ID; to list the notes attached to a deal, lead, person, or organization, use Find Notes instead. Read-only and idempotent.",idempotent:!0},props:{noteId:y.Number({displayName:"Note ID",required:!0})},async run(e){try{return await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v1/notes/${e.propsValue.noteId}`})}catch{return{success:!1,data:{}}}}});var kc=D({auth:E,name:"find-user",classification:"SEARCH",displayName:"Find User",description:"Finds a user by name or email.",audience:"both",aiMetadata:{description:"Search Pipedrive account users (team members, not CRM persons) by name or by email address. Pick this to resolve an owner or assignee to a user ID; choose the search-by field to match either a name or an email term. Read-only and may return multiple matches.",idempotent:!0},props:{field:y.StaticDropdown({displayName:"Field to search by",required:!0,options:{disabled:!1,options:[{label:"Name",value:"name"},{label:"Email",value:"email"}]}}),fieldValue:y.ShortText({displayName:"Field Value",required:!0})},async run(e){let{field:t,fieldValue:r}=e.propsValue,n=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/users/find",query:{term:r,search_by_email:t=="email"?1:0}});return{found:n.data&&n.data.length>0,data:n.data}}});var Oc=D({auth:E,name:"find-product",classification:"SEARCH",displayName:"Find Product",description:"Finds a product by name ",audience:"both",aiMetadata:{description:"Search the product catalog by name and return the single best-matching product with its full details and custom fields. Pick this when you have a product name or keyword rather than an ID; use Retrieve a Product when you already know the exact product ID. Read-only and returns at most one match (found:false when nothing matches).",idempotent:!0},props:{searchTerm:y.ShortText({displayName:"Search Term",required:!0})},async run(e){let{searchTerm:t}=e.propsValue,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/products/search",query:{term:t,fields:"name",limit:1,include_fields:"product.price"}});if(A(r.data)||A(r.data.items)||r.data.items.length===0)return{found:!1,data:[]};let n=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/products/${r.data.items[0].item.id}`}),i=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"});return{found:!0,data:[R(i,n.data)]}}});var Dc=ie({auth:E,name:"organization-matching-filter",classification:"READ",displayName:"Organization Matching Filter",description:"Triggers when an organization newly matches a Pipedrive filter for the first time.",aiMetadata:{description:"Fires when an organization (company) record first becomes a member of a selected Pipedrive filter \u2014 that is, the organization newly satisfies the filter conditions. Polls the filter and emits each organization the first time it appears; does not re-fire for organizations already in the filter."},type:"POLLING",props:{filterId:Ge("org",!0)},async onEnable(e){let t=[],r=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId}});A(r)||r.forEach(n=>{t.push(n.id)}),await e.store.put("organizations",JSON.stringify(t))},async onDisable(e){await e.store.delete("organizations")},async test(e){let t=[],r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{limit:10,sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId,include_fields:je.join(",")}});if(A(r.data))return[];for(let a of r.data)t.push(a);let n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),i=[];for(let a of t){let u=R(n,a);i.push(u)}return i},async run(e){let t=await e.store.get("organizations")??"[]",r=JSON.parse(t),n=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId,include_fields:je.join(",")}});if(A(n)||n.length===0)return[];let i=n.filter(d=>!r.includes(d.id)),a=i.map(d=>d.id);if(a.length===0)return[];await e.store.put("organizations",JSON.stringify([...a,...r]));let u=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),c=[];for(let d of i){let g=R(u,d);c.push(g)}return c},sampleData:{id:1,owner_id:22701301,name:"Pipedrive Sample Org",add_time:"2024-12-04T03:49:06Z",update_time:"2024-12-14T11:03:19Z",is_deleted:!1,visible_to:3,picture_id:null,label_ids:[],address:{value:"Mustam\xE4e tee 3, Tallinn, Estonia",street_number:"3",route:"Mustam\xE4e tee",sublocality:"Kristiine",locality:"Tallinn",admin_area_level_1:"Harju maakond",admin_area_level_2:null,country:"Estonia",postal_code:"10616",formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia"},custom_fields:{your_custom_field_key:"your_custom_field_value"}}});var Rc=ie({auth:E,name:"person-matching-filter",classification:"READ",displayName:"Person Matching Filter",description:"Triggers when a person newly matches a Pipedrive filter for the first time.",aiMetadata:{description:"Fires when a person (contact) record first becomes a member of a selected Pipedrive filter \u2014 that is, the person newly satisfies the filter conditions. Polls the filter and emits each person the first time it appears; does not re-fire for people already in the filter."},type:"POLLING",props:{filterId:Ge("people",!0)},async onEnable(e){let t=[],r=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId}});A(r)||r.forEach(n=>{t.push(n.id)}),await e.store.put("persons",JSON.stringify(t))},async onDisable(e){await e.store.delete("persons")},async test(e){let t=[],r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{limit:10,sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId,include_fields:Fe.join(",")}});if(A(r.data))return[];for(let a of r.data)t.push(a);let n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),i=[];for(let a of t){let u=R(n,a);i.push(u)}return i},async run(e){let t=await e.store.get("persons")??"[]",r=JSON.parse(t),n=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId,include_fields:Fe.join(",")}});if(A(n)||n.length===0)return[];let i=n.filter(d=>!r.includes(d.id)),a=i.map(d=>d.id);if(a.length===0)return[];await e.store.put("persons",JSON.stringify([...a,...r]));let u=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),c=[];for(let d of i){let g=R(u,d);c.push(g)}return c},sampleData:{id:1,owner_id:123,org_id:1234,name:"Will Smith",first_name:"Will",last_name:"Smith",is_deleted:!1,phones:[{value:"12345",primary:!0,label:"work"}],emails:[{value:"will.smith@example.com",primary:!0,label:"work"}],add_time:"2017-10-18T13:23:07Z",update_time:"2020-05-08T05:30:20Z",visible_to:3,picture_id:4,next_activity_id:128,last_activity_id:34,last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[1],marketing_status:"no_consent"}});var Nc=ie({auth:E,name:"activity-matching-filter",classification:"READ",displayName:"Activity Matching Filter",description:"Trigges when an activity newly matches a Pipedrive filter for the first time.",aiMetadata:{description:"Fires when an activity (scheduled task or event) first becomes a member of a selected Pipedrive filter \u2014 that is, the activity newly satisfies the filter conditions. Polls the filter and emits each activity the first time it appears; does not re-fire for activities already in the filter."},type:"POLLING",props:{filterId:Ge("activity",!0)},async onEnable(e){let t=[],r=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{filter_id:e.propsValue.filterId}});A(r)||r.forEach(n=>{t.push(n.id)}),await e.store.put("activities",JSON.stringify(t))},async onDisable(e){await e.store.delete("activities")},async test(e){let t=[],r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{limit:10,filter_id:e.propsValue.filterId,sort_by:"update_time",sort_direction:"desc",include_fields:"attendees"}});if(A(r.data))return[];for(let n of r.data)t.push(n);return t},async run(e){let t=await e.store.get("activities")??"[]",r=JSON.parse(t),n=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{filter_id:e.propsValue.filterId,include_fields:"attendees"}});if(A(n)||n.length===0)return[];let i=n.filter(u=>!r.includes(u.id)),a=i.map(u=>u.id);return a.length===0?[]:(await e.store.put("activities",JSON.stringify([...a,...r])),i)},sampleData:{id:8,company_id:22122,user_id:1234,done:!1,type:"deadline",reference_type:"scheduler-service",reference_id:7,conference_meeting_client:"871b8bc88d3a1202",conference_meeting_url:"https://pipedrive.zoom.us/link",conference_meeting_id:"01758746701",due_date:"2020-06-09",due_time:"10:00",duration:"01:00",busy_flag:!0,add_time:"2020-06-08 12:37:56",marked_as_done_time:"2020-08-08 08:08:38",last_notification_time:"2020-08-08 12:37:56",last_notification_user_id:7655,notification_language_id:1,subject:"Deadline",public_description:"This is a description",calendar_sync_include_context:"",location:"Mustam\xE4e tee 3, Tallinn, Estonia",org_id:5,person_id:1101,deal_id:300,lead_id:"46c3b0e1-db35-59ca-1828-4817378dff71",active_flag:!0,update_time:"2020-08-08 12:37:56",update_user_id:5596,gcal_event_id:"",google_calendar_id:"",google_calendar_etag:"",source_timezone:"",rec_rule:"RRULE:FREQ=WEEKLY;BYDAY=WE",rec_rule_extension:"",rec_master_activity_id:1,series:[],note:"A note for the activity",created_by_user_id:1234,location_subpremise:"",location_street_number:"3",location_route:"Mustam\xE4e tee",location_sublocality:"Kristiine",location_locality:"Tallinn",location_admin_area_level_1:"Harju maakond",location_admin_area_level_2:"",location_country:"Estonia",location_postal_code:"10616",location_formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia",attendees:[{email_address:"attendee@pipedrivemail.com",is_organizer:0,name:"Attendee",person_id:25312,status:"noreply",user_id:null}],participants:[{person_id:17985,primary_flag:!1},{person_id:1101,primary_flag:!0}],org_name:"Organization",person_name:"Person",deal_title:"Deal",owner_name:"Creator",person_dropbox_bcc:"company@pipedrivemail.com",deal_dropbox_bcc:"company+deal300@pipedrivemail.com",assigned_to_user_id:1235,file:{id:"376892,",clean_name:"Audio 10:55:07.m4a",url:"https://pipedrive-files.s3-eu-west-1.amazonaws.com/Audio-recording.m4a"}}});var Cc=ie({auth:E,name:"deal-matching-filter",classification:"READ",displayName:"Deal Matching Filter",description:"Trigges when a deal newly matches a Pipedrive filter for the first time.",aiMetadata:{description:"Fires when a deal first becomes a member of a selected Pipedrive filter \u2014 that is, the deal newly satisfies the filter conditions. Polls the filter and emits each deal the first time it appears; does not re-fire for deals already in the filter."},type:"POLLING",props:{filterId:Ge("deals",!0),status:y.StaticDropdown({displayName:"Status",required:!1,defaultValue:"all_not_deleted",options:{disabled:!1,options:[{label:"Open",value:"open"},{label:"Won",value:"won"},{label:"Lost",value:"lost"},{label:"Deleted",value:"deleted"},{label:"All(Not Deleted)",value:"all_not_deleted"}]}})},async onEnable(e){let t=[],r=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{filter_id:e.propsValue.filterId,status:e.propsValue.status}});A(r)||r.forEach(n=>{t.push(n.id)}),await e.store.put("deals",JSON.stringify(t))},async onDisable(e){await e.store.delete("deals")},async test(e){let t=[],r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{limit:10,filter_id:e.propsValue.filterId,status:e.propsValue.status,include_fields:Ee.join(",")}});if(A(r.data))return[];for(let a of r.data)t.push(a);let n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),i=[];for(let a of t){let u=R(n,a);i.push(u)}return i},async run(e){let t=await e.store.get("deals")??"[]",r=JSON.parse(t),n=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{filter_id:e.propsValue.filterId,status:e.propsValue.status,include_fields:Ee.join(",")}});if(A(n)||n.length===0)return[];let i=n.filter(d=>!r.includes(d.id)),a=i.map(d=>d.id);if(a.length===0)return[];await e.store.put("deals",JSON.stringify([...a,...r]));let u=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),c=[];for(let d of i){let g=R(u,d);c.push(g)}return c},sampleData:{id:1,creator_user_id:22701301,person_id:1101,org_id:5,stage_id:2,title:"Deal One",value:5e3,currency:"EUR",add_time:"2019-05-29 04:21:51",update_time:"2019-11-28 16:19:50",stage_change_time:"2019-11-28 15:41:22",active:!0,deleted:!1,status:"open",probability:null,next_activity_date:"2019-11-29",next_activity_time:"11:30:00",next_activity_id:128,last_activity_id:null,last_activity_date:null,lost_reason:null,visible_to:"1",close_time:null,pipeline_id:1,won_time:"2019-11-27 11:40:36",first_won_time:"2019-11-27 11:40:36",lost_time:"",products_count:0,files_count:0,notes_count:2,followers_count:0,email_messages_count:4,activities_count:1,done_activities_count:0,undone_activities_count:1,participants_count:1,expected_close_date:"2019-06-29",last_incoming_mail_time:"2019-05-29 18:21:42",last_outgoing_mail_time:"2019-05-30 03:45:35",label:11,stage_order_nr:2,person_name:"Person",org_name:"Organization",next_activity_subject:"Call",next_activity_type:"call",next_activity_duration:"00:30:00",next_activity_note:"Note content",formatted_value:"\u20AC5,000",weighted_value:5e3,formatted_weighted_value:"\u20AC5,000",weighted_value_currency:"EUR",rotten_time:null,owner_name:"Creator",cc_email:"company+deal1@pipedrivemail.com",org_hidden:!1,person_hidden:!1,average_time_to_won:{y:0,m:0,d:0,h:0,i:20,s:49,total_seconds:1249},average_stage_progress:4.99,age:{y:0,m:6,d:14,h:8,i:57,s:26,total_seconds:17139446},stay_in_pipeline_stages:{times_in_stages:{1:15721267,2:1288449,3:4368,4:3315,5:26460},order_of_stages:[1,2,3,4,5]},last_activity:null,next_activity:null}});var Uc=ie({auth:E,name:"new-note",classification:"READ",displayName:"New Note",description:"Triggers when a new note is created.",aiMetadata:{description:"Fires when a new note is created in Pipedrive. A note carries free-text content and may be linked to a deal, person, organization, or lead. Use to react whenever someone records a comment or annotation in the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("note","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_note_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_note_trigger");t!=null&&await ue.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/notes",query:{limit:10,sort:"update_time DESC"}});return A(t.data)?[]:t.data},async run(e){let t=e.payload.body;return[(await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v1/notes/${t.data.id}`})).data]},sampleData:{id:1,user_id:22701301,deal_id:null,person_id:1,org_id:1,lead_id:null,content:"Note content for v2 API.",add_time:"2024-12-04T06:48:26Z",update_time:"2024-12-04T06:48:26Z",is_deleted:!1}});var Mc=D({auth:E,name:"find-deals-associated-with-person",classification:"SEARCH",displayName:"Find Deals Associated With Person",description:"Finds multiple deals related to a specific person.",audience:"both",aiMetadata:{description:"Lists all deals linked to a given person, identified by their numeric person ID, sorted by most recently updated. Use when you already have a person and need their associated deals; to look up a deal by a field value instead, use Find Deal. Read-only and idempotent.",idempotent:!0},props:{personId:Ne(!0)},async run(e){let{personId:t}=e.propsValue,r=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{person_id:t,sort_by:"update_time",sort_direction:"desc",include_fields:Ee.join(",")}});if(A(r)||r.length===0)return{found:!1,data:[]};let n=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),i=[];for(let a of r){let u=R(n,a);i.push(u)}return{found:!0,data:i}}});var Lc=D({auth:E,name:"find-products",classification:"SEARCH",displayName:"Find Products",description:"Finds a product or products by name or product code.",audience:"both",aiMetadata:{description:"Searches products by exact match on either name or product code (selected via the Field dropdown) and returns all matches, paging through every result. Use to locate products before adding them to a deal or updating them. Read-only and idempotent.",idempotent:!0},props:{field:y.StaticDropdown({displayName:"Field to search by",required:!0,defaultValue:"name",options:{disabled:!1,options:[{label:"Name",value:"name"},{label:"Product Code",value:"code"}]}}),fieldValue:y.ShortText({displayName:"Field Value",required:!0})},async run(e){let t={term:e.propsValue.fieldValue,fields:e.propsValue.field,exact_match:"true",limit:"100"},r,n=!0,i=[];do{r&&(t.cursor=r);let a=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/products/search",query:{term:e.propsValue.fieldValue,fields:e.propsValue.field,exact_match:"true"}});if(A(a.data.items))break;for(let u of a.data.items)i.push(u.item);n=a.additional_data?.next_cursor!=null,r=a.additional_data?.next_cursor}while(n);return{found:i.length>0,data:i}}});var Fc=D({auth:E,name:"get-product",classification:"READ",displayName:"Retrieve a Product",description:"Finds a product by ID.",audience:"both",aiMetadata:{description:"Retrieve a single product by its exact numeric ID, returning full details and resolved custom fields. Pick this when you already know the product ID; use Find Product to search by name instead. Read-only and returns found:false rather than erroring when the ID does not exist.",idempotent:!0},props:{productId:y.Number({displayName:"Product ID",required:!0})},async run(e){try{let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/products/${e.propsValue.productId}`}),r=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"});return{found:!0,data:[R(r,t.data)]}}catch{return{found:!1,data:[]}}}});var jc=D({auth:E,name:"find-notes",classification:"SEARCH",displayName:"Find Notes",description:"Finds notes by Deal, Lead, Person, or Organization ID.",audience:"both",aiMetadata:{description:"Lists notes attached to a single parent record, chosen via the Search By dropdown (Deal, Lead, Person, or Organization) plus that record's ID, sorted newest-updated first. Use to retrieve the notes on a known object; to fetch one specific note by its own ID, use Retrieve a Note. Read-only and idempotent.",idempotent:!0},props:{objectType:y.StaticDropdown({displayName:"Search By",required:!0,options:{disabled:!1,options:[{label:"Deal",value:"deal_id"},{label:"Lead",value:"lead_id"},{label:"Person",value:"person_id"},{label:"Organization",value:"org_id"}]}}),objectId:y.ShortText({displayName:"ID",required:!0})},async run(e){let t=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/notes",query:{sort:"update_time DESC",[e.propsValue.objectType]:e.propsValue.objectId}});return A(t)||t.length===0?{found:!1,data:[]}:{found:t.length>0,data:t}}});var Vc=D({auth:E,name:"find-organization",classification:"SEARCH",displayName:"Find Organization",description:"Finds an organization.",audience:"both",aiMetadata:{description:"Finds a single organization by matching a chosen field to a value (exact match), returning the most recently updated match. Use to locate an organization before reading or updating it; pick the field via Search Field and supply its value. Read-only and idempotent (a temporary search filter is created and removed internally).",idempotent:!0},props:{searchField:Ut("organization"),searchFieldValue:Mt("organization")},async run(e){let{searchField:t}=e.propsValue,r=e.propsValue.searchFieldValue.field_value;if(A(r))throw new Error("Please enter a value for the field");let n=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/filters",body:{name:"Activepieces Find Organization Filter",type:"org",conditions:{glue:"and",conditions:[{glue:"and",conditions:[{object:"organization",field_id:t,operator:"=",value:r}]},{glue:"or",conditions:[{object:"organization",field_id:t,operator:"IS NOT NULL",value:null}]}]}}}),i=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{filter_id:n.data.id,limit:1,sort_by:"update_time",sort_direction:"desc",include_fields:je.join(",")}});if(await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/filters/${n.data.id}`}),A(i.data)||i.data.length===0)return{found:!1,data:[]};let a=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"});return{found:!0,data:[R(a,i.data[0])]}}});var Bc=D({auth:E,name:"find-person",classification:"SEARCH",displayName:"Find Person",description:"Finds a person.",audience:"both",aiMetadata:{description:"Look up a single person by an exact value in a chosen field (e.g. email, phone, name, or a custom field). Pick this when you need to resolve a person record to its ID or details before acting on it. Effectively read-only (it creates and removes a temporary search filter) and returns the most recently updated match.",idempotent:!0},props:{searchField:Ut("person"),searchFieldValue:Mt("person")},async run(e){let{searchField:t}=e.propsValue,r=e.propsValue.searchFieldValue.field_value;if(A(r))throw new Error("Please enter a value for the field");let n=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/filters",body:{name:"Activepieces Find Person Filter",type:"people",conditions:{glue:"and",conditions:[{glue:"and",conditions:[{object:"person",field_id:t,operator:"=",value:r}]},{glue:"or",conditions:[{object:"person",field_id:t,operator:"IS NOT NULL",value:null}]}]}}}),i=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{filter_id:n.data.id,limit:1,sort_by:"update_time",sort_direction:"desc",include_fields:Fe.join(",")}});if(await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/filters/${n.data.id}`}),A(i.data)||i.data.length===0)return{found:!1,data:[]};let a=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});return{found:!0,data:[R(a,i.data[0])]}}});var Zc=D({auth:E,name:"find-deal",classification:"SEARCH",displayName:"Find Deal",description:"Finds a deal by any field.",audience:"both",aiMetadata:{description:"Finds a single deal by matching a chosen field to a value (exact match), returning the most recently updated match. Use to locate a deal before reading or updating it; pick the field via Search Field and supply its value. To list deals tied to a specific person, use Find Deals Associated With Person instead. Read-only and idempotent (a temporary search filter is created and removed internally).",idempotent:!0},props:{searchField:Ut("deal"),searchFieldValue:Mt("deal")},async run(e){let{searchField:t}=e.propsValue,r=e.propsValue.searchFieldValue.field_value;if(A(r))throw new Error("Please enter a value for the field");let n=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/filters",body:{name:"Activepieces Find Deal Filter",type:"deals",conditions:{glue:"and",conditions:[{glue:"and",conditions:[{object:"deal",field_id:t,operator:"=",value:r}]},{glue:"or",conditions:[{object:"deal",field_id:t,operator:"IS NOT NULL",value:null}]}]}}}),i=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{filter_id:n.data.id,limit:1,sort_by:"update_time",sort_direction:"desc",include_fields:Ee.join(",")}});if(await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/filters/${n.data.id}`}),A(i.data)||i.data.length===0)return{found:!1,data:[]};let a=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return{found:!0,data:[R(a,i.data[0])]}}});var Gc=D({auth:E,name:"find-activity",classification:"SEARCH",displayName:"Find Activity",description:"Finds an activity by subject.",audience:"both",aiMetadata:{description:"Search activities by subject text, optionally narrowed by owner, type, done/not-done status, or a saved filter. Pick this to locate existing activities; matching is case-insensitive substring by default but can be made exact-match. Read-only and may return multiple matches.",idempotent:!0},props:{subject:y.ShortText({displayName:"Subject",required:!0}),exactMatch:y.Checkbox({displayName:"Exact Match",required:!1,defaultValue:!0}),assignTo:Re("Assign To",!1),type:fi(!1),filterId:Ge("activity",!1),status:y.StaticDropdown({displayName:"Status",required:!1,options:{disabled:!1,options:[{label:"Done",value:1},{label:"Not Done",value:0}]}})},async run(e){let{subject:t,assignTo:r,type:n,filterId:i,status:a,exactMatch:u}=e.propsValue,c=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{owner_id:r,done:a!=null?a===1:void 0,sort_by:"update_time",sort_direction:"desc",filter_id:i}});if(A(c)||c.length===0)return{found:!1,data:[]};let d=[];for(let g of c){let h=!1;g.subject&&(u&&g.subject===t||!u&&g.subject.toLowerCase().includes(t.toLowerCase()))&&(h=!0),n?h&&g.type===n&&d.push(g):h&&d.push(g)}return{found:d.length>0,data:d}}});var Hc=D({auth:E,name:"update-product",classification:"WRITE",displayName:"Update Product",description:"Updates an existing product.",audience:"both",aiMetadata:{description:"Updates fields on an existing product identified by its product ID, such as name, code, pricing, tax, owner, active state, and custom fields; only supplied fields change. Use to edit a product you have the ID for (use Find Products to locate it first). Idempotent: repeating the same update converges to the same product state.",idempotent:!0},props:{id:y.ShortText({displayName:"Product ID",required:!0}),name:y.ShortText({displayName:"Name",required:!1}),code:y.ShortText({displayName:"Code",required:!1}),description:y.LongText({displayName:"Description",required:!1}),unit:y.ShortText({displayName:"Unit",required:!1}),tax:y.Number({displayName:"Tax percentage",required:!1}),isActive:y.Checkbox({displayName:"Is Active ?",required:!1,defaultValue:!0}),ownerId:Re("Owner",!1),currency:y.ShortText({displayName:"Currency",required:!1,description:'Please enter currency code (e.g., "USD", "EUR").'}),price:y.Number({displayName:"Price",required:!1}),cost:y.Number({displayName:"Cost",required:!1}),overheadCost:y.Number({displayName:"Overhead Cost",required:!1}),visibleTo:pt,customfields:mt("product")},async run(e){let{id:t,name:r,code:n,description:i,unit:a,tax:u,isActive:c,ownerId:d,currency:g,price:h,cost:I,overheadCost:b,visibleTo:l}=e.propsValue,p=e.propsValue.customfields??{},_={name:r,code:n,description:i,unit:a,tax:u,is_deleted:!c,prices:[{price:h??0,currency:g??"USD",cost:I??0,direct_cost:b??0}],visible_to:l};d&&(_.owner_id=d);let m=await $({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"}),P=Ie(m,p);ce(P)||(_.custom_fields=P);let T=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:"/v2/products/"+t,body:_}),k=R(m,T.data);return{...T,data:k}}});var qc=D({auth:E,name:"find-lead",classification:"SEARCH",displayName:"Find Lead",description:"Finds leads by title.",audience:"both",aiMetadata:{description:"Searches leads by title text and returns all matches, paging through every result. By default it matches titles containing the term; enable Exact Match for full case-insensitive title equality only. Use to locate leads before reading or updating them. Read-only and idempotent.",idempotent:!0},props:{term:y.ShortText({displayName:"Title",description:"The title to search for.",required:!0}),exact_match:y.Checkbox({displayName:"Exact Match",description:"When enabled, only full exact matches against the given title are returned. It is not case sensitive.",required:!1})},async run(e){let{term:t,exact_match:r}=e.propsValue,n,i=!0,a=[];do{let u={term:t,fields:"title",limit:"100"};r&&(u.exact_match=!0),n&&(u.cursor=n);let c=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/leads/search",query:u});if(A(c.data?.items))break;for(let d of c.data.items)a.push(d.item);i=c.additional_data?.next_cursor!=null,n=c.additional_data?.next_cursor}while(i);return{found:a.length>0,data:a}}});var Lf=Da({displayName:"Pipedrive",description:"Sales CRM and pipeline management software",minimumSupportedRelease:"0.30.0",logoUrl:"https://cdn.activepieces.com/pieces/pipedrive.png",categories:["SALES_AND_CRM"],auth:E,actions:[$c,zc,wc,Pc,bc,Sc,Tc,Ec,yc,_c,mc,gc,lc,dc,uc,cc,vc,Hc,Mc,Oc,Lc,jc,Fc,Vc,Bc,Zc,Gc,kc,qc,Ju({baseUrl:o(()=>"https://api.pipedrive.com/api/v2","baseUrl"),auth:E,authMapping:o(async e=>({Authorization:`Bearer ${e.access_token}`}),"authMapping")})],authors:["ashrafsamhouri","kishanprmr","MoShizzle","khaledmashaly","abuaboud","leocottaz","Anmol-Gup"],triggers:[Qu,Xu,Yu,Uc,rc,tc,ac,nc,ic,oc,Nc,Cc,Rc,Dc]});0&&(module.exports={pipedrive});
|
|
1
|
+
"use strict";var Xl=Object.create;var Gt=Object.defineProperty;var Yl=Object.getOwnPropertyDescriptor;var Ql=Object.getOwnPropertyNames;var ed=Object.getPrototypeOf,td=Object.prototype.hasOwnProperty;var i=(e,t)=>Gt(e,"name",{value:t,configurable:!0});var U=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},$o=(e,t)=>{for(var r in t)Gt(e,r,{get:t[r],enumerable:!0})},wo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ql(t))!td.call(e,o)&&o!==r&&Gt(e,o,{get:()=>t[o],enumerable:!(n=Yl(t,o))||n.enumerable});return e};var we=(e,t,r)=>(r=e!=null?Xl(ed(e)):{},wo(t||!e||!e.__esModule?Gt(r,"default",{value:e,enumerable:!0}):r,e)),rd=e=>wo(Gt({},"__esModule",{value:!0}),e);var ta=U((ea,Mr)=>{(function(e){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},n=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",u="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${u})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${u})|(?:::)(?:${u})?)${t}\\.${t}\\.${t}\\.${t}(${a})?$`,"i")};function d(l,m){if(l.indexOf("::")!==l.lastIndexOf("::"))return null;let h=0,p=-1,P=(l.match(c.zoneIndex)||[])[0],T,z;for(P&&(P=P.substring(1),l=l.replace(/%.+$/,""));(p=l.indexOf(":",p+1))>=0;)h++;if(l.substr(0,2)==="::"&&h--,l.substr(-2,2)==="::"&&h--,h>m)return null;for(z=m-h,T=":";z--;)T+="0:";return l=l.replace("::",T),l[0]===":"&&(l=l.slice(1)),l[l.length-1]===":"&&(l=l.slice(0,-1)),m=(function(){let ne=l.split(":"),ve=[];for(let De=0;De<ne.length;De++)ve.push(parseInt(ne[De],16));return ve})(),{parts:m,zoneId:P}}i(d,"expandIPv6");function g(l,m,h,p){if(l.length!==m.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let P=0,T;for(;p>0;){if(T=h-p,T<0&&(T=0),l[P]>>T!==m[P]>>T)return!1;p-=h,P+=1}return!0}i(g,"matchCIDR");function _(l){if(o.test(l))return parseInt(l,16);if(l[0]==="0"&&!isNaN(parseInt(l[1],10))){if(n.test(l))return parseInt(l,8);throw new Error(`ipaddr: cannot parse ${l} as octal`)}return parseInt(l,10)}i(_,"parseIntAuto");function I(l,m){for(;l.length<m;)l=`0${l}`;return l}i(I,"padPart");let b={};b.IPv4=(function(){function l(m){if(m.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let h,p;for(h=0;h<m.length;h++)if(p=m[h],!(0<=p&&p<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=m}return i(l,"IPv4"),l.prototype.SpecialRanges={unspecified:[[new l([0,0,0,0]),8]],broadcast:[[new l([255,255,255,255]),32]],multicast:[[new l([224,0,0,0]),4]],linkLocal:[[new l([169,254,0,0]),16]],loopback:[[new l([127,0,0,0]),8]],carrierGradeNat:[[new l([100,64,0,0]),10]],private:[[new l([10,0,0,0]),8],[new l([172,16,0,0]),12],[new l([192,168,0,0]),16]],reserved:[[new l([192,0,0,0]),24],[new l([192,0,2,0]),24],[new l([192,88,99,0]),24],[new l([198,18,0,0]),15],[new l([198,51,100,0]),24],[new l([203,0,113,0]),24],[new l([240,0,0,0]),4]],as112:[[new l([192,175,48,0]),24],[new l([192,31,196,0]),24]],amt:[[new l([192,52,193,0]),24]]},l.prototype.kind=function(){return"ipv4"},l.prototype.match=function(m,h){let p;if(h===void 0&&(p=m,m=p[0],h=p[1]),m.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return g(this.octets,m.octets,8,h)},l.prototype.prefixLengthFromSubnetMask=function(){let m=0,h=!1,p={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},P,T,z;for(P=3;P>=0;P-=1)if(T=this.octets[P],T in p){if(z=p[T],h&&z!==0)return null;z!==8&&(h=!0),m+=z}else return null;return 32-m},l.prototype.range=function(){return b.subnetMatch(this,this.SpecialRanges)},l.prototype.toByteArray=function(){return this.octets.slice(0)},l.prototype.toIPv4MappedAddress=function(){return b.IPv6.parse(`::ffff:${this.toString()}`)},l.prototype.toNormalizedString=function(){return this.toString()},l.prototype.toString=function(){return this.octets.join(".")},l})(),b.IPv4.broadcastAddressFromCIDR=function(l){try{let m=this.parseCIDR(l),h=m[0].toByteArray(),p=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),P=[],T=0;for(;T<4;)P.push(parseInt(h[T],10)|parseInt(p[T],10)^255),T++;return new this(P)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},b.IPv4.isIPv4=function(l){return this.parser(l)!==null},b.IPv4.isValid=function(l){try{return new this(this.parser(l)),!0}catch{return!1}},b.IPv4.isValidCIDR=function(l){try{return this.parseCIDR(l),!0}catch{return!1}},b.IPv4.isValidFourPartDecimal=function(l){return!!(b.IPv4.isValid(l)&&l.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},b.IPv4.isValidCIDRFourPartDecimal=function(l){let m=l.match(/^(.+)\/(\d+)$/);return!b.IPv4.isValidCIDR(l)||!m?!1:b.IPv4.isValidFourPartDecimal(m[1])},b.IPv4.networkAddressFromCIDR=function(l){let m,h,p,P,T;try{for(m=this.parseCIDR(l),p=m[0].toByteArray(),T=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),P=[],h=0;h<4;)P.push(parseInt(p[h],10)&parseInt(T[h],10)),h++;return new this(P)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},b.IPv4.parse=function(l){let m=this.parser(l);if(m===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(m)},b.IPv4.parseCIDR=function(l){let m;if(m=l.match(/^(.+)\/(\d+)$/)){let h=parseInt(m[2]);if(h>=0&&h<=32){let p=[this.parse(m[1]),h];return Object.defineProperty(p,"toString",{value:i(function(){return this.join("/")},"value")}),p}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},b.IPv4.parser=function(l){let m,h,p;if(m=l.match(r.fourOctet))return(function(){let P=m.slice(1,6),T=[];for(let z=0;z<P.length;z++)h=P[z],T.push(_(h));return T})();if(m=l.match(r.longValue)){if(p=_(m[1]),p>4294967295||p<0)throw new Error("ipaddr: address outside defined range");return(function(){let P=[],T;for(T=0;T<=24;T+=8)P.push(p>>T&255);return P})().reverse()}else return(m=l.match(r.twoOctet))?(function(){let P=m.slice(1,4),T=[];if(p=_(P[1]),p>16777215||p<0)throw new Error("ipaddr: address outside defined range");return T.push(_(P[0])),T.push(p>>16&255),T.push(p>>8&255),T.push(p&255),T})():(m=l.match(r.threeOctet))?(function(){let P=m.slice(1,5),T=[];if(p=_(P[2]),p>65535||p<0)throw new Error("ipaddr: address outside defined range");return T.push(_(P[0])),T.push(_(P[1])),T.push(p>>8&255),T.push(p&255),T})():null},b.IPv4.subnetMaskFromPrefixLength=function(l){if(l=parseInt(l),l<0||l>32)throw new Error("ipaddr: invalid IPv4 prefix length");let m=[0,0,0,0],h=0,p=Math.floor(l/8);for(;h<p;)m[h]=255,h++;return p<4&&(m[p]=Math.pow(2,l%8)-1<<8-l%8),new this(m)},b.IPv6=(function(){function l(m,h){let p,P;if(m.length===16)for(this.parts=[],p=0;p<=14;p+=2)this.parts.push(m[p]<<8|m[p+1]);else if(m.length===8)this.parts=m;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(p=0;p<this.parts.length;p++)if(P=this.parts[p],!(0<=P&&P<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");h&&(this.zoneId=h)}return i(l,"IPv6"),l.prototype.SpecialRanges={unspecified:[new l([0,0,0,0,0,0,0,0]),128],linkLocal:[new l([65152,0,0,0,0,0,0,0]),10],multicast:[new l([65280,0,0,0,0,0,0,0]),8],loopback:[new l([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new l([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new l([0,0,0,0,0,65535,0,0]),96],discard:[new l([256,0,0,0,0,0,0,0]),64],rfc6145:[new l([0,0,0,0,65535,0,0,0]),96],rfc6052:[new l([100,65435,0,0,0,0,0,0]),96],"6to4":[new l([8194,0,0,0,0,0,0,0]),16],teredo:[new l([8193,0,0,0,0,0,0,0]),32],benchmarking:[new l([8193,2,0,0,0,0,0,0]),48],amt:[new l([8193,3,0,0,0,0,0,0]),32],as112v6:[[new l([8193,4,274,0,0,0,0,0]),48],[new l([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new l([8193,16,0,0,0,0,0,0]),28],orchid2:[new l([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new l([8193,48,0,0,0,0,0,0]),28],reserved:[[new l([8193,0,0,0,0,0,0,0]),23],[new l([8193,3512,0,0,0,0,0,0]),32]]},l.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},l.prototype.kind=function(){return"ipv6"},l.prototype.match=function(m,h){let p;if(h===void 0&&(p=m,m=p[0],h=p[1]),m.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return g(this.parts,m.parts,16,h)},l.prototype.prefixLengthFromSubnetMask=function(){let m=0,h=!1,p={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},P,T;for(let z=7;z>=0;z-=1)if(P=this.parts[z],P in p){if(T=p[P],h&&T!==0)return null;T!==16&&(h=!0),m+=T}else return null;return 128-m},l.prototype.range=function(){return b.subnetMatch(this,this.SpecialRanges)},l.prototype.toByteArray=function(){let m,h=[],p=this.parts;for(let P=0;P<p.length;P++)m=p[P],h.push(m>>8),h.push(m&255);return h},l.prototype.toFixedLengthString=function(){let m=(function(){let p=[];for(let P=0;P<this.parts.length;P++)p.push(I(this.parts[P].toString(16),4));return p}).call(this).join(":"),h="";return this.zoneId&&(h=`%${this.zoneId}`),m+h},l.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let m=this.parts.slice(-2),h=m[0],p=m[1];return new b.IPv4([h>>8,h&255,p>>8,p&255])},l.prototype.toNormalizedString=function(){let m=(function(){let p=[];for(let P=0;P<this.parts.length;P++)p.push(this.parts[P].toString(16));return p}).call(this).join(":"),h="";return this.zoneId&&(h=`%${this.zoneId}`),m+h},l.prototype.toRFC5952String=function(){let m=/((^|:)(0(:|$)){2,})/g,h=this.toNormalizedString(),p=0,P=-1,T;for(;T=m.exec(h);)T[0].length>P&&(p=T.index,P=T[0].length);return P<0?h:`${h.substring(0,p)}::${h.substring(p+P)}`},l.prototype.toString=function(){return this.toRFC5952String()},l})(),b.IPv6.broadcastAddressFromCIDR=function(l){try{let m=this.parseCIDR(l),h=m[0].toByteArray(),p=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),P=[],T=0;for(;T<16;)P.push(parseInt(h[T],10)|parseInt(p[T],10)^255),T++;return new this(P)}catch(m){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${m})`)}},b.IPv6.isIPv6=function(l){return this.parser(l)!==null},b.IPv6.isValid=function(l){if(typeof l=="string"&&l.indexOf(":")===-1)return!1;try{let m=this.parser(l);return new this(m.parts,m.zoneId),!0}catch{return!1}},b.IPv6.isValidCIDR=function(l){if(typeof l=="string"&&l.indexOf(":")===-1)return!1;try{return this.parseCIDR(l),!0}catch{return!1}},b.IPv6.networkAddressFromCIDR=function(l){let m,h,p,P,T;try{for(m=this.parseCIDR(l),p=m[0].toByteArray(),T=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),P=[],h=0;h<16;)P.push(parseInt(p[h],10)&parseInt(T[h],10)),h++;return new this(P)}catch(z){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${z})`)}},b.IPv6.parse=function(l){let m=this.parser(l);if(m.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(m.parts,m.zoneId)},b.IPv6.parseCIDR=function(l){let m,h,p;if((h=l.match(/^(.+)\/(\d+)$/))&&(m=parseInt(h[2]),m>=0&&m<=128))return p=[this.parse(h[1]),m],Object.defineProperty(p,"toString",{value:i(function(){return this.join("/")},"value")}),p;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},b.IPv6.parser=function(l){let m,h,p,P,T,z;if(p=l.match(c.deprecatedTransitional))return this.parser(`::ffff:${p[1]}`);if(c.native.test(l))return d(l,8);if((p=l.match(c.transitional))&&(z=p[6]||"",m=p[1],p[1].endsWith("::")||(m=m.slice(0,-1)),m=d(m+z,6),m.parts)){for(T=[parseInt(p[2]),parseInt(p[3]),parseInt(p[4]),parseInt(p[5])],h=0;h<T.length;h++)if(P=T[h],!(0<=P&&P<=255))return null;return m.parts.push(T[0]<<8|T[1]),m.parts.push(T[2]<<8|T[3]),{parts:m.parts,zoneId:m.zoneId}}return null},b.IPv6.subnetMaskFromPrefixLength=function(l){if(l=parseInt(l),l<0||l>128)throw new Error("ipaddr: invalid IPv6 prefix length");let m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],h=0,p=Math.floor(l/8);for(;h<p;)m[h]=255,h++;return p<16&&(m[p]=Math.pow(2,l%8)-1<<8-l%8),new this(m)},b.fromByteArray=function(l){let m=l.length;if(m===4)return new b.IPv4(l);if(m===16)return new b.IPv6(l);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},b.isValid=function(l){return b.IPv6.isValid(l)||b.IPv4.isValid(l)},b.isValidCIDR=function(l){return b.IPv6.isValidCIDR(l)||b.IPv4.isValidCIDR(l)},b.parse=function(l){if(b.IPv6.isValid(l))return b.IPv6.parse(l);if(b.IPv4.isValid(l))return b.IPv4.parse(l);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},b.parseCIDR=function(l){try{return b.IPv6.parseCIDR(l)}catch{try{return b.IPv4.parseCIDR(l)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},b.process=function(l){let m=this.parse(l);return m.kind()==="ipv6"&&m.isIPv4MappedAddress()?m.toIPv4Address():m},b.subnetMatch=function(l,m,h){let p,P,T,z;h==null&&(h="unicast");for(P in m)if(Object.prototype.hasOwnProperty.call(m,P)){for(T=m[P],T[0]&&!(T[0]instanceof Array)&&(T=[T]),p=0;p<T.length;p++)if(z=T[p],l.kind()===z[0].kind()&&l.match.apply(l,z))return P}return h},typeof Mr<"u"&&Mr.exports?Mr.exports=b:e.ipaddr=b})(ea)});var as=U((Jz,is)=>{var os=require("stream").Stream,Vm=require("util");is.exports=je;function je(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}i(je,"DelayedStream");Vm.inherits(je,os);je.create=function(e,t){var r=new this;t=t||{};for(var n in t)r[n]=t[n];r.source=e;var o=e.emit;return e.emit=function(){return r._handleEmit(arguments),o.apply(e,arguments)},e.on("error",function(){}),r.pauseStream&&e.pause(),r};Object.defineProperty(je.prototype,"readable",{configurable:!0,enumerable:!0,get:i(function(){return this.source.readable},"get")});je.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};je.prototype.resume=function(){this._released||this.release(),this.source.resume()};je.prototype.pause=function(){this.source.pause()};je.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]};je.prototype.pipe=function(){var e=os.prototype.pipe.apply(this,arguments);return this.resume(),e};je.prototype._handleEmit=function(e){if(this._released){this.emit.apply(this,e);return}e[0]==="data"&&(this.dataSize+=e[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(e)};je.prototype._checkIfMaxDataSizeExceeded=function(){if(!this._maxDataSizeExceeded&&!(this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(e))}}});var ls=U((Yz,cs)=>{var Bm=require("util"),us=require("stream").Stream,ss=as();cs.exports=pe;function pe(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2*1024*1024,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}i(pe,"CombinedStream");Bm.inherits(pe,us);pe.create=function(e){var t=new this;e=e||{};for(var r in e)t[r]=e[r];return t};pe.isStreamLike=function(e){return typeof e!="function"&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"&&!Buffer.isBuffer(e)};pe.prototype.append=function(e){var t=pe.isStreamLike(e);if(t){if(!(e instanceof ss)){var r=ss.create(e,{maxDataSize:1/0,pauseStream:this.pauseStreams});e.on("data",this._checkDataSize.bind(this)),e=r}this._handleErrors(e),this.pauseStreams&&e.pause()}return this._streams.push(e),this};pe.prototype.pipe=function(e,t){return us.prototype.pipe.call(this,e,t),this.resume(),e};pe.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop){this._pendingNext=!0;return}this._insideLoop=!0;try{do this._pendingNext=!1,this._realGetNext();while(this._pendingNext)}finally{this._insideLoop=!1}};pe.prototype._realGetNext=function(){var e=this._streams.shift();if(typeof e>"u"){this.end();return}if(typeof e!="function"){this._pipeNext(e);return}var t=e;t(function(r){var n=pe.isStreamLike(r);n&&(r.on("data",this._checkDataSize.bind(this)),this._handleErrors(r)),this._pipeNext(r)}.bind(this))};pe.prototype._pipeNext=function(e){this._currentStream=e;var t=pe.isStreamLike(e);if(t){e.on("end",this._getNext.bind(this)),e.pipe(this,{end:!1});return}var r=e;this.write(r),this._getNext()};pe.prototype._handleErrors=function(e){var t=this;e.on("error",function(r){t._emitError(r)})};pe.prototype.write=function(e){this.emit("data",e)};pe.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function"&&this._currentStream.pause(),this.emit("pause"))};pe.prototype.resume=function(){this._released||(this._released=!0,this.writable=!0,this._getNext()),this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function"&&this._currentStream.resume(),this.emit("resume")};pe.prototype.end=function(){this._reset(),this.emit("end")};pe.prototype.destroy=function(){this._reset(),this.emit("close")};pe.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};pe.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(e))}};pe.prototype._updateDataSize=function(){this.dataSize=0;var e=this;this._streams.forEach(function(t){t.dataSize&&(e.dataSize+=t.dataSize)}),this._currentStream&&this._currentStream.dataSize&&(this.dataSize+=this._currentStream.dataSize)};pe.prototype._emitError=function(e){this._reset(),this.emit("error",e)}});var ps=U((eO,ds)=>{"use strict";ds.exports={"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dat"]},"application/msword":{source:"iana",extensions:["doc"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",extensions:["docx"]},"application/vnd.ms-excel":{source:"iana",extensions:["xls"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",extensions:["xlsx"]},"application/vnd.ms-powerpoint":{source:"iana",extensions:["ppt"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",extensions:["pptx"]},"application/csv":{compressible:!0,extensions:["csv"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"text/plain":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["txt","text","log"]},"text/html":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["html","htm"]},"text/css":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["css"]},"text/csv":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["csv"]},"text/markdown":{source:"iana",compressible:!0,charset:"UTF-8",extensions:["md","markdown"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/webp":{source:"apache",compressible:!1,extensions:["webp"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tiff","tif"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/heic":{source:"iana",compressible:!1,extensions:["heic"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mp3","mpga"]},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/ogg":{source:"iana",compressible:!1,extensions:["ogg","oga"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","m4v"]},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg"]},"video/webm":{source:"iana",compressible:!1,extensions:["webm"]},"video/quicktime":{source:"iana",compressible:!1,extensions:["mov","qt"]},"video/x-msvideo":{source:"iana",compressible:!1,extensions:["avi"]},"font/woff":{source:"iana",compressible:!1,extensions:["woff"]},"font/woff2":{source:"iana",compressible:!1,extensions:["woff2"]},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"multipart/form-data":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/ics":{compressible:!0,extensions:["ics"]},"text/calendar":{source:"iana",compressible:!0,extensions:["ics","ifb"]},"application/x-ndjson":{compressible:!0,extensions:["ndjson"]}}});var gs=U(Oe=>{"use strict";var Br=ps(),Zm=require("path").extname,ms=/^\s*([^;\s]*)(?:;|\s|$)/,Gm=/^text\//i;Oe.charset=fs;Oe.charsets={lookup:fs};Oe.contentType=Hm;Oe.extension=qm;Oe.extensions=Object.create(null);Oe.lookup=Wm;Oe.types=Object.create(null);Km(Oe.extensions,Oe.types);function fs(e){if(!e||typeof e!="string")return!1;var t=ms.exec(e),r=t&&Br[t[1].toLowerCase()];return r&&r.charset?r.charset:t&&Gm.test(t[1])?"UTF-8":!1}i(fs,"charset");function Hm(e){if(!e||typeof e!="string")return!1;var t=e.indexOf("/")===-1?Oe.lookup(e):e;if(!t)return!1;if(t.indexOf("charset")===-1){var r=Oe.charset(t);r&&(t+="; charset="+r.toLowerCase())}return t}i(Hm,"contentType");function qm(e){if(!e||typeof e!="string")return!1;var t=ms.exec(e),r=t&&Oe.extensions[t[1].toLowerCase()];return!r||!r.length?!1:r[0]}i(qm,"extension");function Wm(e){if(!e||typeof e!="string")return!1;var t=Zm("x."+e).toLowerCase().substr(1);return t&&Oe.types[t]||!1}i(Wm,"lookup");function Km(e,t){var r=["nginx","apache",void 0,"iana"];Object.keys(Br).forEach(i(function(o){var a=Br[o],u=a.extensions;if(!(!u||!u.length)){e[o]=u;for(var c=0;c<u.length;c++){var d=u[c];if(t[d]){var g=r.indexOf(Br[t[d]].source),_=r.indexOf(a.source);if(t[d]!=="application/octet-stream"&&(g>_||g===_&&t[d].substr(0,12)==="application/"))continue}t[d]=o}}},"forEachMimeType"))}i(Km,"populateMaps")});var hs=U((nO,ys)=>{ys.exports=Jm;function Jm(e){var t=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;t?t(e):setTimeout(e,0)}i(Jm,"defer")});var Xn=U((iO,vs)=>{var _s=hs();vs.exports=Xm;function Xm(e){var t=!1;return _s(function(){t=!0}),i(function(n,o){t?e(n,o):_s(i(function(){e(n,o)},"nextTick_callback"))},"async_callback")}i(Xm,"async")});var Yn=U((sO,bs)=>{bs.exports=Ym;function Ym(e){Object.keys(e.jobs).forEach(Qm.bind(e)),e.jobs={}}i(Ym,"abort");function Qm(e){typeof this.jobs[e]=="function"&&this.jobs[e]()}i(Qm,"clean")});var Qn=U((cO,xs)=>{var Ps=Xn(),ef=Yn();xs.exports=tf;function tf(e,t,r,n){var o=r.keyedList?r.keyedList[r.index]:r.index;r.jobs[o]=rf(t,o,e[o],function(a,u){o in r.jobs&&(delete r.jobs[o],a?ef(r):r.results[o]=u,n(a,r.results))})}i(tf,"iterate");function rf(e,t,r,n){var o;return e.length==2?o=e(r,Ps(n)):o=e(r,t,Ps(n)),o}i(rf,"runJob")});var eo=U((dO,Ts)=>{Ts.exports=nf;function nf(e,t){var r=!Array.isArray(e),n={index:0,keyedList:r||t?Object.keys(e):null,jobs:{},results:r?{}:[],size:r?Object.keys(e).length:e.length};return t&&n.keyedList.sort(r?t:function(o,a){return t(e[o],e[a])}),n}i(nf,"state")});var to=U((mO,Is)=>{var of=Yn(),af=Xn();Is.exports=sf;function sf(e){Object.keys(this.jobs).length&&(this.index=this.size,of(this),af(e)(null,this.results))}i(sf,"terminator")});var As=U((gO,Es)=>{var uf=Qn(),cf=eo(),lf=to();Es.exports=df;function df(e,t,r){for(var n=cf(e);n.index<(n.keyedList||e).length;)uf(e,t,n,function(o,a){if(o){r(o,a);return}if(Object.keys(n.jobs).length===0){r(null,n.results);return}}),n.index++;return lf.bind(n,r)}i(df,"parallel")});var ro=U((hO,Zr)=>{var Ss=Qn(),pf=eo(),mf=to();Zr.exports=ff;Zr.exports.ascending=ks;Zr.exports.descending=gf;function ff(e,t,r,n){var o=pf(e,r);return Ss(e,t,o,i(function a(u,c){if(u){n(u,c);return}if(o.index++,o.index<(o.keyedList||e).length){Ss(e,t,o,a);return}n(null,o.results)},"iteratorHandler")),mf.bind(o,n)}i(ff,"serialOrdered");function ks(e,t){return e<t?-1:e>t?1:0}i(ks,"ascending");function gf(e,t){return-1*ks(e,t)}i(gf,"descending")});var ws=U((vO,$s)=>{var yf=ro();$s.exports=hf;function hf(e,t,r){return yf(e,t,null,r)}i(hf,"serial")});var Os=U((PO,zs)=>{zs.exports={parallel:As(),serial:ws(),serialOrdered:ro()}});var no=U((xO,Ds)=>{"use strict";Ds.exports=Object});var Ns=U((TO,Rs)=>{"use strict";Rs.exports=Error});var Us=U((IO,Cs)=>{"use strict";Cs.exports=EvalError});var Ls=U((EO,Ms)=>{"use strict";Ms.exports=RangeError});var js=U((AO,Fs)=>{"use strict";Fs.exports=ReferenceError});var Bs=U((SO,Vs)=>{"use strict";Vs.exports=SyntaxError});var Gr=U((kO,Zs)=>{"use strict";Zs.exports=TypeError});var Hs=U(($O,Gs)=>{"use strict";Gs.exports=URIError});var Ws=U((wO,qs)=>{"use strict";qs.exports=Math.abs});var Js=U((zO,Ks)=>{"use strict";Ks.exports=Math.floor});var Ys=U((OO,Xs)=>{"use strict";Xs.exports=Math.max});var eu=U((DO,Qs)=>{"use strict";Qs.exports=Math.min});var ru=U((RO,tu)=>{"use strict";tu.exports=Math.pow});var ou=U((NO,nu)=>{"use strict";nu.exports=Math.round});var au=U((CO,iu)=>{"use strict";iu.exports=Number.isNaN||i(function(t){return t!==t},"isNaN")});var uu=U((MO,su)=>{"use strict";var _f=au();su.exports=i(function(t){return _f(t)||t===0?t:t<0?-1:1},"sign")});var lu=U((FO,cu)=>{"use strict";cu.exports=Object.getOwnPropertyDescriptor});var oo=U((jO,du)=>{"use strict";var Hr=lu();if(Hr)try{Hr([],"length")}catch{Hr=null}du.exports=Hr});var mu=U((VO,pu)=>{"use strict";var qr=Object.defineProperty||!1;if(qr)try{qr({},"a",{value:1})}catch{qr=!1}pu.exports=qr});var io=U((BO,fu)=>{"use strict";fu.exports=i(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var o=42;t[r]=o;for(var a in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var u=Object.getOwnPropertySymbols(t);if(u.length!==1||u[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var c=Object.getOwnPropertyDescriptor(t,r);if(c.value!==o||c.enumerable!==!0)return!1}return!0},"hasSymbols")});var hu=U((GO,yu)=>{"use strict";var gu=typeof Symbol<"u"&&Symbol,vf=io();yu.exports=i(function(){return typeof gu!="function"||typeof Symbol!="function"||typeof gu("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:vf()},"hasNativeSymbols")});var ao=U((qO,_u)=>{"use strict";_u.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var so=U((WO,vu)=>{"use strict";var bf=no();vu.exports=bf.getPrototypeOf||null});var xu=U((KO,Pu)=>{"use strict";var Pf="Function.prototype.bind called on incompatible ",xf=Object.prototype.toString,Tf=Math.max,If="[object Function]",bu=i(function(t,r){for(var n=[],o=0;o<t.length;o+=1)n[o]=t[o];for(var a=0;a<r.length;a+=1)n[a+t.length]=r[a];return n},"concatty"),Ef=i(function(t,r){for(var n=[],o=r||0,a=0;o<t.length;o+=1,a+=1)n[a]=t[o];return n},"slicy"),Af=i(function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r},"joiny");Pu.exports=i(function(t){var r=this;if(typeof r!="function"||xf.apply(r)!==If)throw new TypeError(Pf+r);for(var n=Ef(arguments,1),o,a=i(function(){if(this instanceof o){var _=r.apply(this,bu(n,arguments));return Object(_)===_?_:this}return r.apply(t,bu(n,arguments))},"binder"),u=Tf(0,r.length-n.length),c=[],d=0;d<u;d++)c[d]="$"+d;if(o=Function("binder","return function ("+Af(c,",")+"){ return binder.apply(this,arguments); }")(a),r.prototype){var g=i(function(){},"Empty");g.prototype=r.prototype,o.prototype=new g,g.prototype=null}return o},"bind")});var Nt=U((XO,Tu)=>{"use strict";var Sf=xu();Tu.exports=Function.prototype.bind||Sf});var Wr=U((YO,Iu)=>{"use strict";Iu.exports=Function.prototype.call});var uo=U((QO,Eu)=>{"use strict";Eu.exports=Function.prototype.apply});var Su=U((eD,Au)=>{"use strict";Au.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var $u=U((tD,ku)=>{"use strict";var kf=Nt(),$f=uo(),wf=Wr(),zf=Su();ku.exports=zf||kf.call(wf,$f)});var zu=U((rD,wu)=>{"use strict";var Of=Nt(),Df=Gr(),Rf=Wr(),Nf=$u();wu.exports=i(function(t){if(t.length<1||typeof t[0]!="function")throw new Df("a function is required");return Nf(Of,Rf,t)},"callBindBasic")});var Uu=U((oD,Cu)=>{"use strict";var Cf=zu(),Ou=oo(),Ru;try{Ru=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var co=!!Ru&&Ou&&Ou(Object.prototype,"__proto__"),Nu=Object,Du=Nu.getPrototypeOf;Cu.exports=co&&typeof co.get=="function"?Cf([co.get]):typeof Du=="function"?i(function(t){return Du(t==null?t:Nu(t))},"getDunder"):!1});var Vu=U((aD,ju)=>{"use strict";var Mu=ao(),Lu=so(),Fu=Uu();ju.exports=Mu?i(function(t){return Mu(t)},"getProto"):Lu?i(function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return Lu(t)},"getProto"):Fu?i(function(t){return Fu(t)},"getProto"):null});var lo=U((uD,Bu)=>{"use strict";var Uf=Function.prototype.call,Mf=Object.prototype.hasOwnProperty,Lf=Nt();Bu.exports=Lf.call(Uf,Mf)});var Ju=U((cD,Ku)=>{"use strict";var Q,Ff=no(),jf=Ns(),Vf=Us(),Bf=Ls(),Zf=js(),Lt=Bs(),Mt=Gr(),Gf=Hs(),Hf=Ws(),qf=Js(),Wf=Ys(),Kf=eu(),Jf=ru(),Xf=ou(),Yf=uu(),qu=Function,po=i(function(e){try{return qu('"use strict"; return ('+e+").constructor;")()}catch{}},"getEvalledConstructor"),lr=oo(),Qf=mu(),mo=i(function(){throw new Mt},"throwTypeError"),eg=lr?(function(){try{return arguments.callee,mo}catch{try{return lr(arguments,"callee").get}catch{return mo}}})():mo,Ct=hu()(),xe=Vu(),tg=so(),rg=ao(),Wu=uo(),dr=Wr(),Ut={},ng=typeof Uint8Array>"u"||!xe?Q:xe(Uint8Array),xt={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Q:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Q:ArrayBuffer,"%ArrayIteratorPrototype%":Ct&&xe?xe([][Symbol.iterator]()):Q,"%AsyncFromSyncIteratorPrototype%":Q,"%AsyncFunction%":Ut,"%AsyncGenerator%":Ut,"%AsyncGeneratorFunction%":Ut,"%AsyncIteratorPrototype%":Ut,"%Atomics%":typeof Atomics>"u"?Q:Atomics,"%BigInt%":typeof BigInt>"u"?Q:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Q:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Q:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Q:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":jf,"%eval%":eval,"%EvalError%":Vf,"%Float16Array%":typeof Float16Array>"u"?Q:Float16Array,"%Float32Array%":typeof Float32Array>"u"?Q:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Q:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Q:FinalizationRegistry,"%Function%":qu,"%GeneratorFunction%":Ut,"%Int8Array%":typeof Int8Array>"u"?Q:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Q:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Q:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ct&&xe?xe(xe([][Symbol.iterator]())):Q,"%JSON%":typeof JSON=="object"?JSON:Q,"%Map%":typeof Map>"u"?Q:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ct||!xe?Q:xe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Ff,"%Object.getOwnPropertyDescriptor%":lr,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Q:Promise,"%Proxy%":typeof Proxy>"u"?Q:Proxy,"%RangeError%":Bf,"%ReferenceError%":Zf,"%Reflect%":typeof Reflect>"u"?Q:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Q:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ct||!xe?Q:xe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Q:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ct&&xe?xe(""[Symbol.iterator]()):Q,"%Symbol%":Ct?Symbol:Q,"%SyntaxError%":Lt,"%ThrowTypeError%":eg,"%TypedArray%":ng,"%TypeError%":Mt,"%Uint8Array%":typeof Uint8Array>"u"?Q:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Q:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Q:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Q:Uint32Array,"%URIError%":Gf,"%WeakMap%":typeof WeakMap>"u"?Q:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Q:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Q:WeakSet,"%Function.prototype.call%":dr,"%Function.prototype.apply%":Wu,"%Object.defineProperty%":Qf,"%Object.getPrototypeOf%":tg,"%Math.abs%":Hf,"%Math.floor%":qf,"%Math.max%":Wf,"%Math.min%":Kf,"%Math.pow%":Jf,"%Math.round%":Xf,"%Math.sign%":Yf,"%Reflect.getPrototypeOf%":rg};if(xe)try{null.error}catch(e){Zu=xe(xe(e)),xt["%Error.prototype%"]=Zu}var Zu,og=i(function e(t){var r;if(t==="%AsyncFunction%")r=po("async function () {}");else if(t==="%GeneratorFunction%")r=po("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=po("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var o=e("%AsyncGenerator%");o&&xe&&(r=xe(o.prototype))}return xt[t]=r,r},"doEval"),Gu={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},pr=Nt(),Kr=lo(),ig=pr.call(dr,Array.prototype.concat),ag=pr.call(Wu,Array.prototype.splice),Hu=pr.call(dr,String.prototype.replace),Jr=pr.call(dr,String.prototype.slice),sg=pr.call(dr,RegExp.prototype.exec),ug=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,cg=/\\(\\)?/g,lg=i(function(t){var r=Jr(t,0,1),n=Jr(t,-1);if(r==="%"&&n!=="%")throw new Lt("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Lt("invalid intrinsic syntax, expected opening `%`");var o=[];return Hu(t,ug,function(a,u,c,d){o[o.length]=c?Hu(d,cg,"$1"):u||a}),o},"stringToPath"),dg=i(function(t,r){var n=t,o;if(Kr(Gu,n)&&(o=Gu[n],n="%"+o[0]+"%"),Kr(xt,n)){var a=xt[n];if(a===Ut&&(a=og(n)),typeof a>"u"&&!r)throw new Mt("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:a}}throw new Lt("intrinsic "+t+" does not exist!")},"getBaseIntrinsic");Ku.exports=i(function(t,r){if(typeof t!="string"||t.length===0)throw new Mt("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Mt('"allowMissing" argument must be a boolean');if(sg(/^%?[^%]*%?$/,t)===null)throw new Lt("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=lg(t),o=n.length>0?n[0]:"",a=dg("%"+o+"%",r),u=a.name,c=a.value,d=!1,g=a.alias;g&&(o=g[0],ag(n,ig([0,1],g)));for(var _=1,I=!0;_<n.length;_+=1){var b=n[_],l=Jr(b,0,1),m=Jr(b,-1);if((l==='"'||l==="'"||l==="`"||m==='"'||m==="'"||m==="`")&&l!==m)throw new Lt("property names with quotes must have matching quotes");if((b==="constructor"||!I)&&(d=!0),o+="."+b,u="%"+o+"%",Kr(xt,u))c=xt[u];else if(c!=null){if(!(b in c)){if(!r)throw new Mt("base intrinsic for "+t+" exists, but the property is not available.");return}if(lr&&_+1>=n.length){var h=lr(c,b);I=!!h,I&&"get"in h&&!("originalValue"in h.get)?c=h.get:c=c[b]}else I=Kr(c,b),c=c[b];I&&!d&&(xt[u]=c)}}return c},"GetIntrinsic")});var Yu=U((dD,Xu)=>{"use strict";var pg=io();Xu.exports=i(function(){return pg()&&!!Symbol.toStringTag},"hasToStringTagShams")});var tc=U((mD,ec)=>{"use strict";var mg=Ju(),Qu=mg("%Object.defineProperty%",!0),fg=Yu()(),gg=lo(),yg=Gr(),Xr=fg?Symbol.toStringTag:null;ec.exports=i(function(t,r){var n=arguments.length>2&&!!arguments[2]&&arguments[2].force,o=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof n<"u"&&typeof n!="boolean"||typeof o<"u"&&typeof o!="boolean")throw new yg("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");Xr&&(n||!gg(t,Xr))&&(Qu?Qu(t,Xr,{configurable:!o,enumerable:!1,value:r,writable:!1}):t[Xr]=r)},"setToStringTag")});var nc=U((gD,rc)=>{"use strict";var hg=Function.prototype.call,_g=Object.prototype.hasOwnProperty,vg=Nt();rc.exports=vg.call(hg,_g)});var ic=U((yD,oc)=>{"use strict";oc.exports=function(e,t){return Object.keys(t).forEach(function(r){e[r]=e[r]||t[r]}),e}});var _o=U((hD,sc)=>{"use strict";var ho=ls(),bg=require("util"),fo=require("path"),Pg=require("http"),xg=require("https"),Tg=require("url").parse,Ig=require("fs"),Eg=require("stream").Stream,Ag=require("crypto"),go=gs(),Sg=Os(),kg=tc(),pt=nc(),yo=ic();function ac(e){return String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}i(ac,"escapeHeaderParam");function re(e){if(!(this instanceof re))return new re(e);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],ho.call(this),e=e||{};for(var t in e)this[t]=e[t]}i(re,"FormData");bg.inherits(re,ho);re.LINE_BREAK=`\r
|
|
2
|
+
`;re.DEFAULT_CONTENT_TYPE="application/octet-stream";re.prototype.append=function(e,t,r){r=r||{},typeof r=="string"&&(r={filename:r});var n=ho.prototype.append.bind(this);if((typeof t=="number"||t==null)&&(t=String(t)),Array.isArray(t)){this._error(new Error("Arrays are not supported."));return}var o=this._multiPartHeader(e,t,r),a=this._multiPartFooter();n(o),n(t),n(a),this._trackLength(o,t,r)};re.prototype._trackLength=function(e,t,r){var n=0;r.knownLength!=null?n+=Number(r.knownLength):Buffer.isBuffer(t)?n=t.length:typeof t=="string"&&(n=Buffer.byteLength(t)),this._valueLength+=n,this._overheadLength+=Buffer.byteLength(e)+re.LINE_BREAK.length,!(!t||!t.path&&!(t.readable&&pt(t,"httpVersion"))&&!(t instanceof Eg))&&(r.knownLength||this._valuesToMeasure.push(t))};re.prototype._lengthRetriever=function(e,t){pt(e,"fd")?e.end!=null&&e.end!=1/0&&e.start!=null?t(null,e.end+1-(e.start?e.start:0)):Ig.stat(e.path,function(r,n){if(r){t(r);return}var o=n.size-(e.start?e.start:0);t(null,o)}):pt(e,"httpVersion")?t(null,Number(e.headers["content-length"])):pt(e,"httpModule")?(e.on("response",function(r){e.pause(),t(null,Number(r.headers["content-length"]))}),e.resume()):t("Unknown stream")};re.prototype._multiPartHeader=function(e,t,r){if(typeof r.header=="string")return r.header;var n=this._getContentDisposition(t,r),o=this._getContentType(t,r),a="",u={"Content-Disposition":["form-data",'name="'+ac(e)+'"'].concat(n||[]),"Content-Type":[].concat(o||[])};typeof r.header=="object"&&yo(u,r.header);var c;for(var d in u)if(pt(u,d)){if(c=u[d],c==null)continue;Array.isArray(c)||(c=[c]),c.length&&(a+=d+": "+c.join("; ")+re.LINE_BREAK)}return"--"+this.getBoundary()+re.LINE_BREAK+a+re.LINE_BREAK};re.prototype._getContentDisposition=function(e,t){var r;if(typeof t.filepath=="string"?r=fo.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e&&(e.name||e.path)?r=fo.basename(t.filename||e&&(e.name||e.path)):e&&e.readable&&pt(e,"httpVersion")&&(r=fo.basename(e.client._httpMessage.path||"")),r)return'filename="'+ac(r)+'"'};re.prototype._getContentType=function(e,t){var r=t.contentType;return!r&&e&&e.name&&(r=go.lookup(e.name)),!r&&e&&e.path&&(r=go.lookup(e.path)),!r&&e&&e.readable&&pt(e,"httpVersion")&&(r=e.headers["content-type"]),!r&&(t.filepath||t.filename)&&(r=go.lookup(t.filepath||t.filename)),!r&&e&&typeof e=="object"&&(r=re.DEFAULT_CONTENT_TYPE),r};re.prototype._multiPartFooter=function(){return function(e){var t=re.LINE_BREAK,r=this._streams.length===0;r&&(t+=this._lastBoundary()),e(t)}.bind(this)};re.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+re.LINE_BREAK};re.prototype.getHeaders=function(e){var t,r={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)pt(e,t)&&(r[t.toLowerCase()]=e[t]);return r};re.prototype.setBoundary=function(e){if(typeof e!="string")throw new TypeError("FormData boundary must be a string");this._boundary=e};re.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};re.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),r=0,n=this._streams.length;r<n;r++)typeof this._streams[r]!="function"&&(Buffer.isBuffer(this._streams[r])?e=Buffer.concat([e,this._streams[r]]):e=Buffer.concat([e,Buffer.from(this._streams[r])]),(typeof this._streams[r]!="string"||this._streams[r].substring(2,t.length+2)!==t)&&(e=Buffer.concat([e,Buffer.from(re.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])};re.prototype._generateBoundary=function(){this._boundary="--------------------------"+Ag.randomBytes(12).toString("hex")};re.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e};re.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e};re.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;if(this._streams.length&&(t+=this._lastBoundary().length),!this._valuesToMeasure.length){process.nextTick(e.bind(this,null,t));return}Sg.parallel(this._valuesToMeasure,this._lengthRetriever,function(r,n){if(r){e(r);return}n.forEach(function(o){t+=o}),e(null,t)})};re.prototype.submit=function(e,t){var r,n,o={method:"post"};return typeof e=="string"?(e=Tg(e),n=yo({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},o)):(n=yo(e,o),n.port||(n.port=n.protocol==="https:"?443:80)),n.headers=this.getHeaders(e.headers),n.protocol==="https:"?r=xg.request(n):r=Pg.request(n),this.getLength(function(a,u){if(a&&a!=="Unknown stream"){this._error(a);return}if(u&&r.setHeader("Content-Length",u),this.pipe(r),t){var c,d=i(function(g,_){return r.removeListener("error",d),r.removeListener("response",c),t.call(this,g,_)},"callback");c=d.bind(this,null),r.on("error",d),r.on("response",c)}}.bind(this)),r};re.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))};re.prototype.toString=function(){return"[object FormData]"};kg(re.prototype,"FormData");sc.exports=re});var mt=U((vo,bo)=>{(function(e,t){typeof vo=="object"&&typeof bo<"u"?bo.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=t()})(vo,(function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",a="minute",u="hour",c="day",d="week",g="month",_="quarter",I="year",b="date",l="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,p={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:i(function(V){var w=["th","st","nd","rd"],S=V%100;return"["+V+(w[(S-20)%10]||w[S]||w[0])+"]"},"ordinal")},P=i(function(V,w,S){var N=String(V);return!N||N.length>=w?V:""+Array(w+1-N.length).join(S)+V},"m"),T={s:P,z:i(function(V){var w=-V.utcOffset(),S=Math.abs(w),N=Math.floor(S/60),$=S%60;return(w<=0?"+":"-")+P(N,2,"0")+":"+P($,2,"0")},"z"),m:i(function V(w,S){if(w.date()<S.date())return-V(S,w);var N=12*(S.year()-w.year())+(S.month()-w.month()),$=w.clone().add(N,g),J=S-$<0,X=w.clone().add(N+(J?-1:1),g);return+(-(N+(S-$)/(J?$-X:X-$))||0)},"t"),a:i(function(V){return V<0?Math.ceil(V)||0:Math.floor(V)},"a"),p:i(function(V){return{M:g,y:I,w:d,d:c,D:b,h:u,m:a,s:o,ms:n,Q:_}[V]||String(V||"").toLowerCase().replace(/s$/,"")},"p"),u:i(function(V){return V===void 0},"u")},z="en",ne={};ne[z]=p;var ve=i(function(V){return V instanceof ke},"p"),De=i(function V(w,S,N){var $;if(!w)return z;if(typeof w=="string"){var J=w.toLowerCase();ne[J]&&($=J),S&&(ne[J]=S,$=J);var X=w.split("-");if(!$&&X.length>1)return V(X[0])}else{var ie=w.name;ne[ie]=w,$=ie}return!N&&$&&(z=$),$||!N&&z},"t"),ye=i(function(V,w){if(ve(V))return V.clone();var S=typeof w=="object"?w:{};return S.date=V,S.args=arguments,new ke(S)},"w"),Y=T;Y.l=De,Y.i=ve,Y.w=function(V,w){return ye(V,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var ke=(function(){function V(S){this.$L=De(S.locale,null,!0),this.parse(S)}i(V,"M");var w=V.prototype;return w.parse=function(S){this.$d=(function(N){var $=N.date,J=N.utc;if($===null)return new Date(NaN);if(Y.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var X=$.match(m);if(X){var ie=X[2]-1||0,me=(X[7]||"0").substring(0,3);return J?new Date(Date.UTC(X[1],ie,X[3]||1,X[4]||0,X[5]||0,X[6]||0,me)):new Date(X[1],ie,X[3]||1,X[4]||0,X[5]||0,X[6]||0,me)}}return new Date($)})(S),this.$x=S.x||{},this.init()},w.init=function(){var S=this.$d;this.$y=S.getFullYear(),this.$M=S.getMonth(),this.$D=S.getDate(),this.$W=S.getDay(),this.$H=S.getHours(),this.$m=S.getMinutes(),this.$s=S.getSeconds(),this.$ms=S.getMilliseconds()},w.$utils=function(){return Y},w.isValid=function(){return this.$d.toString()!==l},w.isSame=function(S,N){var $=ye(S);return this.startOf(N)<=$&&$<=this.endOf(N)},w.isAfter=function(S,N){return ye(S)<this.startOf(N)},w.isBefore=function(S,N){return this.endOf(N)<ye(S)},w.$g=function(S,N,$){return Y.u(S)?this[N]:this.set($,S)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(S,N){var $=this,J=!!Y.u(N)||N,X=Y.p(S),ie=i(function(ht,$e){var rt=Y.w($.$u?Date.UTC($.$y,$e,ht):new Date($.$y,$e,ht),$);return J?rt:rt.endOf(c)},"l"),me=i(function(ht,$e){return Y.w($.toDate()[ht].apply($.toDate("s"),(J?[0,0,0,0]:[23,59,59,999]).slice($e)),$)},"$"),be=this.$W,Ie=this.$M,Me=this.$D,It="set"+(this.$u?"UTC":"");switch(X){case I:return J?ie(1,0):ie(31,11);case g:return J?ie(1,Ie):ie(0,Ie+1);case d:var yt=this.$locale().weekStart||0,Bt=(be<yt?be+7:be)-yt;return ie(J?Me-Bt:Me+(6-Bt),Ie);case c:case b:return me(It+"Hours",0);case u:return me(It+"Minutes",1);case a:return me(It+"Seconds",2);case o:return me(It+"Milliseconds",3);default:return this.clone()}},w.endOf=function(S){return this.startOf(S,!1)},w.$set=function(S,N){var $,J=Y.p(S),X="set"+(this.$u?"UTC":""),ie=($={},$[c]=X+"Date",$[b]=X+"Date",$[g]=X+"Month",$[I]=X+"FullYear",$[u]=X+"Hours",$[a]=X+"Minutes",$[o]=X+"Seconds",$[n]=X+"Milliseconds",$)[J],me=J===c?this.$D+(N-this.$W):N;if(J===g||J===I){var be=this.clone().set(b,1);be.$d[ie](me),be.init(),this.$d=be.set(b,Math.min(this.$D,be.daysInMonth())).$d}else ie&&this.$d[ie](me);return this.init(),this},w.set=function(S,N){return this.clone().$set(S,N)},w.get=function(S){return this[Y.p(S)]()},w.add=function(S,N){var $,J=this;S=Number(S);var X=Y.p(N),ie=i(function(Ie){var Me=ye(J);return Y.w(Me.date(Me.date()+Math.round(Ie*S)),J)},"y");if(X===g)return this.set(g,this.$M+S);if(X===I)return this.set(I,this.$y+S);if(X===c)return ie(1);if(X===d)return ie(7);var me=($={},$[a]=t,$[u]=r,$[o]=e,$)[X]||1,be=this.$d.getTime()+S*me;return Y.w(be,this)},w.subtract=function(S,N){return this.add(-1*S,N)},w.format=function(S){var N=this,$=this.$locale();if(!this.isValid())return $.invalidDate||l;var J=S||"YYYY-MM-DDTHH:mm:ssZ",X=Y.z(this),ie=this.$H,me=this.$m,be=this.$M,Ie=$.weekdays,Me=$.months,It=$.meridiem,yt=i(function($e,rt,Zt,hr){return $e&&($e[rt]||$e(N,J))||Zt[rt].slice(0,hr)},"h"),Bt=i(function($e){return Y.s(ie%12||12,$e,"0")},"d"),ht=It||function($e,rt,Zt){var hr=$e<12?"AM":"PM";return Zt?hr.toLowerCase():hr};return J.replace(h,(function($e,rt){return rt||(function(Zt){switch(Zt){case"YY":return String(N.$y).slice(-2);case"YYYY":return Y.s(N.$y,4,"0");case"M":return be+1;case"MM":return Y.s(be+1,2,"0");case"MMM":return yt($.monthsShort,be,Me,3);case"MMMM":return yt(Me,be);case"D":return N.$D;case"DD":return Y.s(N.$D,2,"0");case"d":return String(N.$W);case"dd":return yt($.weekdaysMin,N.$W,Ie,2);case"ddd":return yt($.weekdaysShort,N.$W,Ie,3);case"dddd":return Ie[N.$W];case"H":return String(ie);case"HH":return Y.s(ie,2,"0");case"h":return Bt(1);case"hh":return Bt(2);case"a":return ht(ie,me,!0);case"A":return ht(ie,me,!1);case"m":return String(me);case"mm":return Y.s(me,2,"0");case"s":return String(N.$s);case"ss":return Y.s(N.$s,2,"0");case"SSS":return Y.s(N.$ms,3,"0");case"Z":return X}return null})($e)||X.replace(":","")}))},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(S,N,$){var J,X=this,ie=Y.p(N),me=ye(S),be=(me.utcOffset()-this.utcOffset())*t,Ie=this-me,Me=i(function(){return Y.m(X,me)},"D");switch(ie){case I:J=Me()/12;break;case g:J=Me();break;case _:J=Me()/3;break;case d:J=(Ie-be)/6048e5;break;case c:J=(Ie-be)/864e5;break;case u:J=Ie/r;break;case a:J=Ie/t;break;case o:J=Ie/e;break;default:J=Ie}return $?J:Y.a(J)},w.daysInMonth=function(){return this.endOf(g).$D},w.$locale=function(){return ne[this.$L]},w.locale=function(S,N){if(!S)return this.$L;var $=this.clone(),J=De(S,N,!0);return J&&($.$L=J),$},w.clone=function(){return Y.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},V})(),yr=ke.prototype;return ye.prototype=yr,[["$ms",n],["$s",o],["$m",a],["$H",u],["$W",c],["$M",g],["$y",I],["$D",b]].forEach((function(V){yr[V[1]]=function(w){return this.$g(w,V[0],V[1])}})),ye.extend=function(V,w){return V.$i||(V(w,ke,ye),V.$i=!0),ye},ye.locale=De,ye.isDayjs=ve,ye.unix=function(V){return ye(1e3*V)},ye.en=ne[z],ye.Ls=ne,ye.p={},ye}))});var ty={};$o(ty,{pipedrive:()=>ey});module.exports=rd(ty);var nd=Object.freeze({status:"aborted"});function O(e,t,r){function n(c,d){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:d,constr:u,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,d);let g=u.prototype,_=Object.keys(g);for(let I=0;I<_.length;I++){let b=_[I];b in c||(c[b]=g[b].bind(c))}}i(n,"init");let o=r?.Parent??Object;class a extends o{static{i(this,"Definition")}}Object.defineProperty(a,"name",{value:e});function u(c){var d;let g=r?.Parent?new a:this;n(g,c),(d=g._zod).deferred??(d.deferred=[]);for(let _ of g._zod.deferred)_();return g}return i(u,"_"),Object.defineProperty(u,"init",{value:n}),Object.defineProperty(u,Symbol.hasInstance,{value:i(c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e),"value")}),Object.defineProperty(u,"name",{value:e}),u}i(O,"$constructor");var Ge=class extends Error{static{i(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},_r=class extends Error{static{i(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},ln={};function Ke(e){return e&&Object.assign(ln,e),ln}i(Ke,"config");function pn(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}i(pn,"getEnumValues");function Oo(e,t){return typeof t=="bigint"?t.toString():t}i(Oo,"jsonStringifyReplacer");function br(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}i(br,"cached");function Do(e){return e==null}i(Do,"nullish");function Pr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}i(Pr,"cleanRegex");var zo=Symbol("evaluating");function he(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==zo)return n===void 0&&(n=zo,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}i(he,"defineLazy");var mn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ht(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}i(Ht,"isObject");var od=br(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Ro(e){if(Ht(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Ht(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}i(Ro,"isPlainObject");var No=new Set(["string","number","symbol"]);function Et(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}i(Et,"escapeRegex");function xr(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}i(xr,"clone");function ae(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:i(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:i(()=>t.error,"error")}:t}i(ae,"normalizeParams");function Co(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}i(Co,"optionalKeys");var Uo={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function At(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}i(At,"aborted");function nt(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}i(nt,"prefixIssues");function vr(e){return typeof e=="string"?e:e?.message}i(vr,"unwrapMessage");function ot(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=vr(e.inst?._zod.def?.error?.(e))??vr(t?.error?.(e))??vr(r.customError?.(e))??vr(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}i(ot,"finalizeIssue");function Mo(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}i(Mo,"getLengthableOrigin");function fn(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}i(fn,"issue");var Lo=i((e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Oo,2),Object.defineProperty(e,"toString",{value:i(()=>e.message,"value"),enumerable:!1})},"initializer"),Fo=O("$ZodError",Lo),qt=O("$ZodError",Lo,{Parent:Error});var ad=i(e=>(t,r,n,o)=>{let a=n?Object.assign(n,{async:!1}):{async:!1},u=t._zod.run({value:r,issues:[]},a);if(u instanceof Promise)throw new Ge;if(u.issues.length){let c=new(o?.Err??e)(u.issues.map(d=>ot(d,a,Ke())));throw mn(c,o?.callee),c}return u.value},"_parse"),Tr=ad(qt),sd=i(e=>async(t,r,n,o)=>{let a=n?Object.assign(n,{async:!0}):{async:!0},u=t._zod.run({value:r,issues:[]},a);if(u instanceof Promise&&(u=await u),u.issues.length){let c=new(o?.Err??e)(u.issues.map(d=>ot(d,a,Ke())));throw mn(c,o?.callee),c}return u.value},"_parseAsync"),Ir=sd(qt),ud=i(e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new Ge;return a.issues.length?{success:!1,error:new(e??Fo)(a.issues.map(u=>ot(u,o,Ke())))}:{success:!0,data:a.value}},"_safeParse"),Wt=ud(qt),cd=i(e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},o);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(u=>ot(u,o,Ke())))}:{success:!0,data:a.value}},"_safeParseAsync"),Kt=cd(qt);var ld="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",dd=new RegExp(`^${ld}$`);var jo=i(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),Vo=/^-?\d+n?$/,Bo=/^-?\d+$/,gn=/^-?\d+(?:\.\d+)?$/,Zo=/^(?:true|false)$/i;var it=O("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),pd={number:"number",bigint:"bigint",object:"date"};var Go=O("$ZodCheckGreaterThan",(e,t)=>{it.init(e,t);let r=pd[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,a=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});var Ho=O("$ZodCheckNumberFormat",(e,t)=>{it.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,a]=Uo[t.format];e._zod.onattach.push(u=>{let c=u._zod.bag;c.format=t.format,c.minimum=o,c.maximum=a,r&&(c.pattern=Bo)}),e._zod.check=u=>{let c=u.value;if(r){if(!Number.isInteger(c)){u.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?u.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):u.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}c<o&&u.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>a&&u.issues.push({origin:"number",input:c,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}});var qo=O("$ZodCheckMinLength",(e,t)=>{var r;it.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Do(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let u=Mo(o);n.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}});var yn=O("$ZodCheckStringFormat",(e,t)=>{var r,n;it.init(e,t),e._zod.onattach.push(o=>{let a=o._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Wo=O("$ZodCheckRegex",(e,t)=>{yn.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});var Jo={major:4,minor:3,patch:6};var de=O("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Jo;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let a of o._zod.onattach)a(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=i((u,c,d)=>{let g=At(u),_;for(let I of c){if(I._zod.def.when){if(!I._zod.def.when(u))continue}else if(g)continue;let b=u.issues.length,l=I._zod.check(u);if(l instanceof Promise&&d?.async===!1)throw new Ge;if(_||l instanceof Promise)_=(_??Promise.resolve()).then(async()=>{await l,u.issues.length!==b&&(g||(g=At(u,b)))});else{if(u.issues.length===b)continue;g||(g=At(u,b))}}return _?_.then(()=>u):u},"runChecks"),a=i((u,c,d)=>{if(At(u))return u.aborted=!0,u;let g=o(c,n,d);if(g instanceof Promise){if(d.async===!1)throw new Ge;return g.then(_=>e._zod.parse(_,d))}return e._zod.parse(g,d)},"handleCanaryResult");e._zod.run=(u,c)=>{if(c.skipChecks)return e._zod.parse(u,c);if(c.direction==="backward"){let g=e._zod.parse({value:u.value,issues:[]},{...c,skipChecks:!0});return g instanceof Promise?g.then(_=>a(_,u,c)):a(g,u,c)}let d=e._zod.parse(u,c);if(d instanceof Promise){if(c.async===!1)throw new Ge;return d.then(g=>o(g,n,c))}return o(d,n,c)}}he(e,"~standard",()=>({validate:i(o=>{try{let a=Wt(e,o);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return Kt(e,o).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},"validate"),vendor:"zod",version:1}))}),Sr=O("$ZodString",(e,t)=>{de.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??jo(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),hn=O("$ZodStringFormat",(e,t)=>{yn.init(e,t),Sr.init(e,t)});var ti=O("$ZodURL",(e,t)=>{hn.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var _n=O("$ZodNumber",(e,t)=>{de.init(e,t),e._zod.pattern=e._zod.bag.pattern??gn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let a=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...a?{received:a}:{}}),r}}),ri=O("$ZodNumberFormat",(e,t)=>{Ho.init(e,t),_n.init(e,t)}),vn=O("$ZodBoolean",(e,t)=>{de.init(e,t),e._zod.pattern=Zo,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),ni=O("$ZodBigInt",(e,t)=>{de.init(e,t),e._zod.pattern=Vo,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var oi=O("$ZodAny",(e,t)=>{de.init(e,t),e._zod.parse=r=>r}),ii=O("$ZodUnknown",(e,t)=>{de.init(e,t),e._zod.parse=r=>r});var ai=O("$ZodVoid",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),si=O("$ZodDate",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,a=o instanceof Date;return a&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...a?{received:"Invalid Date"}:{},inst:e}),r}});function Xo(e,t,r){e.issues.length&&t.issues.push(...nt(r,e.issues)),t.value[r]=e.value}i(Xo,"handleArrayResult");var ui=O("$ZodArray",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let a=[];for(let u=0;u<o.length;u++){let c=o[u],d=t.element._zod.run({value:c,issues:[]},n);d instanceof Promise?a.push(d.then(g=>Xo(g,r,u))):Xo(d,r,u)}return a.length?Promise.all(a).then(()=>r):r}});function Ar(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...nt(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}i(Ar,"handlePropertyResult");function md(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Co(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}i(md,"normalizeDef");function fd(e,t,r,n,o,a){let u=[],c=o.keySet,d=o.catchall._zod,g=d.def.type,_=d.optout==="optional";for(let I in t){if(c.has(I))continue;if(g==="never"){u.push(I);continue}let b=d.run({value:t[I],issues:[]},n);b instanceof Promise?e.push(b.then(l=>Ar(l,r,I,t,_))):Ar(b,r,I,t,_)}return u.length&&r.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:a}),e.length?Promise.all(e).then(()=>r):r}i(fd,"handleCatchall");var ci=O("$ZodObject",(e,t)=>{if(de.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:i(()=>{let d={...c};return Object.defineProperty(t,"shape",{value:d}),d},"get")})}let n=br(()=>md(t));he(e._zod,"propValues",()=>{let c=t.shape,d={};for(let g in c){let _=c[g]._zod;if(_.values){d[g]??(d[g]=new Set);for(let I of _.values)d[g].add(I)}}return d});let o=Ht,a=t.catchall,u;e._zod.parse=(c,d)=>{u??(u=n.value);let g=c.value;if(!o(g))return c.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),c;c.value={};let _=[],I=u.shape;for(let b of u.keys){let l=I[b],m=l._zod.optout==="optional",h=l._zod.run({value:g[b],issues:[]},d);h instanceof Promise?_.push(h.then(p=>Ar(p,c,b,g,m))):Ar(h,c,b,g,m)}return a?fd(_,g,c,d,n.value,e):_.length?Promise.all(_).then(()=>c):c}});function Yo(e,t,r,n){for(let a of e)if(a.issues.length===0)return t.value=a.value,t;let o=e.filter(a=>!At(a));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(a=>a.issues.map(u=>ot(u,n,Ke())))}),t)}i(Yo,"handleUnionResults");var bn=O("$ZodUnion",(e,t)=>{de.init(e,t),he(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),he(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),he(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),he(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(a=>a._zod.pattern);return new RegExp(`^(${o.map(a=>Pr(a.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,a)=>{if(r)return n(o,a);let u=!1,c=[];for(let d of t.options){let g=d._zod.run({value:o.value,issues:[]},a);if(g instanceof Promise)c.push(g),u=!0;else{if(g.issues.length===0)return g;c.push(g)}}return u?Promise.all(c).then(d=>Yo(d,o,e,a)):Yo(c,o,e,a)}});var li=O("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,bn.init(e,t);let r=e._zod.parse;he(e._zod,"propValues",()=>{let o={};for(let a of t.options){let u=a._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let[c,d]of Object.entries(u)){o[c]||(o[c]=new Set);for(let g of d)o[c].add(g)}}return o});let n=br(()=>{let o=t.options,a=new Map;for(let u of o){let c=u._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(let d of c){if(a.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);a.set(d,u)}}return a});e._zod.parse=(o,a)=>{let u=o.value;if(!Ht(u))return o.issues.push({code:"invalid_type",expected:"object",input:u,inst:e}),o;let c=n.value.get(u?.[t.discriminator]);return c?c._zod.run(o,a):t.unionFallback?r(o,a):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:u,path:[t.discriminator],inst:e}),o)}});var di=O("$ZodRecord",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Ro(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let a=[],u=t.keyType._zod.values;if(u){r.value={};let c=new Set;for(let g of u)if(typeof g=="string"||typeof g=="number"||typeof g=="symbol"){c.add(typeof g=="number"?g.toString():g);let _=t.valueType._zod.run({value:o[g],issues:[]},n);_ instanceof Promise?a.push(_.then(I=>{I.issues.length&&r.issues.push(...nt(g,I.issues)),r.value[g]=I.value})):(_.issues.length&&r.issues.push(...nt(g,_.issues)),r.value[g]=_.value)}let d;for(let g in o)c.has(g)||(d=d??[],d.push(g));d&&d.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:d})}else{r.value={};for(let c of Reflect.ownKeys(o)){if(c==="__proto__")continue;let d=t.keyType._zod.run({value:c,issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&gn.test(c)&&d.issues.length){let I=t.keyType._zod.run({value:Number(c),issues:[]},n);if(I instanceof Promise)throw new Error("Async schemas not supported in object keys currently");I.issues.length===0&&(d=I)}if(d.issues.length){t.mode==="loose"?r.value[c]=o[c]:r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(I=>ot(I,n,Ke())),input:c,path:[c],inst:e});continue}let _=t.valueType._zod.run({value:o[c],issues:[]},n);_ instanceof Promise?a.push(_.then(I=>{I.issues.length&&r.issues.push(...nt(c,I.issues)),r.value[d.value]=I.value})):(_.issues.length&&r.issues.push(...nt(c,_.issues)),r.value[d.value]=_.value)}}return a.length?Promise.all(a).then(()=>r):r}});var pi=O("$ZodEnum",(e,t)=>{de.init(e,t);let r=pn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>No.has(typeof o)).map(o=>typeof o=="string"?Et(o):o.toString()).join("|")})$`),e._zod.parse=(o,a)=>{let u=o.value;return n.has(u)||o.issues.push({code:"invalid_value",values:r,input:u,inst:e}),o}}),mi=O("$ZodLiteral",(e,t)=>{if(de.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?Et(n):n?Et(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),n}});var fi=O("$ZodTransform",(e,t)=>{de.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new _r(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(u=>(r.value=u,r));if(o instanceof Promise)throw new Ge;return r.value=o,r}});function Qo(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}i(Qo,"handleOptionalResult");var gi=O("$ZodOptional",(e,t)=>{de.init(e,t),e._zod.optin="optional",e._zod.optout="optional",he(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),he(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Pr(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(a=>Qo(a,r.value)):Qo(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var yi=O("$ZodNullable",(e,t)=>{de.init(e,t),he(e._zod,"optin",()=>t.innerType._zod.optin),he(e._zod,"optout",()=>t.innerType._zod.optout),he(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Pr(r.source)}|null)$`):void 0}),he(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)});var hi=O("$ZodPipe",(e,t)=>{de.init(e,t),he(e._zod,"values",()=>t.in._zod.values),he(e._zod,"optin",()=>t.in._zod.optin),he(e._zod,"optout",()=>t.out._zod.optout),he(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let a=t.out._zod.run(r,n);return a instanceof Promise?a.then(u=>Er(u,t.in,n)):Er(a,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(a=>Er(a,t.out,n)):Er(o,t.out,n)}});function Er(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}i(Er,"handlePipeResult");var _i=O("$ZodCustom",(e,t)=>{it.init(e,t),de.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(a=>ei(a,r,n,e));ei(o,r,n,e)}});function ei(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(fn(o))}}i(ei,"handleRefineResult");var bi;var Pn=class{static{i(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Pi(){return new Pn}i(Pi,"registry");(bi=globalThis).__zod_globalRegistry??(bi.__zod_globalRegistry=Pi());var xn=globalThis.__zod_globalRegistry;function xi(e,t){return new e({type:"string",...ae(t)})}i(xi,"_string");function Ti(e,t){return new e({type:"string",coerce:!0,...ae(t)})}i(Ti,"_coercedString");function Ii(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ae(t)})}i(Ii,"_url");function Ei(e,t){return new e({type:"number",checks:[],...ae(t)})}i(Ei,"_number");function Ai(e,t){return new e({type:"number",coerce:!0,checks:[],...ae(t)})}i(Ai,"_coercedNumber");function Si(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ae(t)})}i(Si,"_int");function ki(e,t){return new e({type:"boolean",...ae(t)})}i(ki,"_boolean");function $i(e,t){return new e({type:"boolean",coerce:!0,...ae(t)})}i($i,"_coercedBoolean");function wi(e,t){return new e({type:"bigint",coerce:!0,...ae(t)})}i(wi,"_coercedBigint");function zi(e){return new e({type:"any"})}i(zi,"_any");function Oi(e){return new e({type:"unknown"})}i(Oi,"_unknown");function Di(e,t){return new e({type:"void",...ae(t)})}i(Di,"_void");function Ri(e,t){return new e({type:"date",coerce:!0,...ae(t)})}i(Ri,"_coercedDate");function kr(e,t){return new Go({check:"greater_than",...ae(t),value:e,inclusive:!0})}i(kr,"_gte");function Fe(e,t){return new qo({check:"min_length",...ae(t),minimum:e})}i(Fe,"_minLength");function at(e,t){return new Wo({check:"string_format",format:"regex",...ae(t),pattern:e})}i(at,"_regex");function Ni(e,t,r){let n=ae(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}i(Ni,"_custom");var _e=O("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");de.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>Tr(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Wt(e,r,n),e.parseAsync=async(r,n)=>Ir(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Kt(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>xr(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),wr=O("ZodMiniString",(e,t)=>{Sr.init(e,t),_e.init(e,t)});function s(e){return xi(wr,e)}i(s,"string");var Ci=O("ZodMiniStringFormat",(e,t)=>{hn.init(e,t),wr.init(e,t)});var Sd=O("ZodMiniURL",(e,t)=>{ti.init(e,t),Ci.init(e,t)});function Ui(e){return Ii(Sd,e)}i(Ui,"url");var zr=O("ZodMiniNumber",(e,t)=>{_n.init(e,t),_e.init(e,t)});function Pe(e){return Ei(zr,e)}i(Pe,"number");var kd=O("ZodMiniNumberFormat",(e,t)=>{ri.init(e,t),zr.init(e,t)});function Mi(e){return Si(kd,e)}i(Mi,"int");var Tn=O("ZodMiniBoolean",(e,t)=>{vn.init(e,t),_e.init(e,t)});function te(e){return ki(Tn,e)}i(te,"boolean");var Li=O("ZodMiniBigInt",(e,t)=>{ni.init(e,t),_e.init(e,t)});var $d=O("ZodMiniAny",(e,t)=>{oi.init(e,t),_e.init(e,t)});function Xt(){return zi($d)}i(Xt,"any");var wd=O("ZodMiniUnknown",(e,t)=>{ii.init(e,t),_e.init(e,t)});function H(){return Oi(wd)}i(H,"unknown");var zd=O("ZodMiniVoid",(e,t)=>{ai.init(e,t),_e.init(e,t)});function Fi(e){return Di(zd,e)}i(Fi,"_void");var ji=O("ZodMiniDate",(e,t)=>{si.init(e,t),_e.init(e,t)});var Od=O("ZodMiniArray",(e,t)=>{ui.init(e,t),_e.init(e,t)});function F(e,t){return new Od({type:"array",element:e,...ae(t)})}i(F,"array");var Dd=O("ZodMiniObject",(e,t)=>{ci.init(e,t),_e.init(e,t),he(e,"shape",()=>t.shape)});function f(e,t){let r={type:"object",shape:e??{},...ae(t)};return new Dd(r)}i(f,"object");var Rd=O("ZodMiniUnion",(e,t)=>{bn.init(e,t),_e.init(e,t)});function K(e,t){return new Rd({type:"union",options:e,...ae(t)})}i(K,"union");var Nd=O("ZodMiniDiscriminatedUnion",(e,t)=>{li.init(e,t),_e.init(e,t)});function st(e,t,r){return new Nd({type:"union",options:t,discriminator:e,...ae(r)})}i(st,"discriminatedUnion");var Cd=O("ZodMiniRecord",(e,t)=>{di.init(e,t),_e.init(e,t)});function q(e,t,r){return new Cd({type:"record",keyType:e,valueType:t,...ae(r)})}i(q,"record");var Ud=O("ZodMiniEnum",(e,t)=>{pi.init(e,t),_e.init(e,t),e.options=Object.values(t.entries)});function L(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Ud({type:"enum",entries:r,...ae(t)})}i(L,"_enum");var Md=O("ZodMiniLiteral",(e,t)=>{mi.init(e,t),_e.init(e,t)});function M(e,t){return new Md({type:"literal",values:Array.isArray(e)?e:[e],...ae(t)})}i(M,"literal");var Ld=O("ZodMiniTransform",(e,t)=>{fi.init(e,t),_e.init(e,t)});function ut(e){return new Ld({type:"transform",transform:e})}i(ut,"transform");var Fd=O("ZodMiniOptional",(e,t)=>{gi.init(e,t),_e.init(e,t)});function v(e){return new Fd({type:"optional",innerType:e})}i(v,"optional");var jd=O("ZodMiniNullable",(e,t)=>{yi.init(e,t),_e.init(e,t)});function Yt(e){return new jd({type:"nullable",innerType:e})}i(Yt,"nullable");var Vd=O("ZodMiniPipe",(e,t)=>{hi.init(e,t),_e.init(e,t)});function ct(e,t){return new Vd({type:"pipe",in:e,out:t})}i(ct,"pipe");var Bd=O("ZodMiniCustom",(e,t)=>{_i.init(e,t),_e.init(e,t)});function Or(e,t){return Ni(Bd,e??(()=>!0),t)}i(Or,"custom");var Qt={};$o(Qt,{bigint:()=>Kd,boolean:()=>Wd,date:()=>Jd,number:()=>qd,string:()=>Hd});function Hd(e){return Ti(wr,e)}i(Hd,"string");function qd(e){return Ai(zr,e)}i(qd,"number");function Wd(e){return $i(Tn,e)}i(Wd,"boolean");function Kd(e){return wi(Li,e)}i(Kd,"bigint");function Jd(e){return Ri(ji,e)}i(Jd,"date");var En=f({retryOnFailure:f({defaultValue:v(te()),hide:v(te())}),continueOnFailure:f({defaultValue:v(te()),hide:v(te())})}),In=class{constructor(t,r,n,o,a,u,c,d,g,_,I,b,l){this.name=t;this.displayName=r;this.description=n;this.props=o;this.propertyGroups=a;this.run=u;this.test=c;this.requireAuth=d;this.errorHandlingOptions=g;this.outputSchema=_;this.audience=I;this.aiMetadata=b;this.classification=l}static{i(this,"IAction")}},D=i(e=>new In(e.name,e.displayName,e.description,e.props,e.propertyGroups,e.run,e.test??e.run,e.requireAuth??!0,e.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},e.outputSchema,e.audience,e.aiMetadata,e.classification),"createAction");var ee=f({displayName:s(),description:v(s()),advanced:v(te()),width:v(L(["half","full"])),icon:v(s()),placeholder:v(s())}),W=i((e,t)=>f({type:M(t),required:te(),defaultValue:v(Xt())}),"TPropertyValue");var Re=f({...ee.shape,...W(s(),"SHORT_TEXT").shape}),Je=f({...ee.shape,...W(s(),"LONG_TEXT").shape});var Bi=f({label:s(),value:H(),description:v(s()),icon:v(s())}),Dr=f({disabled:v(te()),placeholder:v(s()),options:F(Bi)});var Yd=L(["cards"]),Ne=f({...ee.shape,options:Dr,display:v(Yd),...W(H(),"STATIC_DROPDOWN").shape}),Xe=f({...ee.shape,options:Dr,...W(F(H()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var An=f({...ee.shape,...W(H(),"DROPDOWN").shape,refreshers:F(s())}),er=f({...ee.shape,...W(F(H()),"MULTI_SELECT_DROPDOWN").shape,refreshers:F(s())});var Ye=f({...ee.shape,reveals:v(F(s())),...W(te(),"CHECKBOX").shape});var Qe=f({...ee.shape,display:v(L(["stepper"])),min:v(Pe()),max:v(Pe()),step:v(Pe()),...W(Pe(),"NUMBER").shape});var tr=f({...ee.shape,streaming:v(te()),...W(H(),"FILE").shape});var rr=f({...ee.shape,...W(s(),"DATE_TIME").shape});var Zi=q(s(),K([Re,Je,Ne,er,Xe,Ye,Qe,tr,rr])),nr=f({...ee.shape,properties:Zi,...W(F(H()),"ARRAY").shape});var Gi=L(["any_time","last_24_hours","last_7_days","last_30_days","last_90_days","this_month","custom"]),Hi=f({preset:v(Gi),after:v(s()),before:v(s())}),Sn=f({...ee.shape,display:v(L(["dropdown"])),...W(Hi,"DATE_RANGE").shape});var or=f({...ee.shape,...W(K([q(s(),H())]),"JSON").shape});var qi=K([Re,Ne,or,nr,Xe]),Qd=q(s(),qi),kn=f({refreshers:F(s()),...ee.shape,...W(H(),"DYNAMIC").shape});var Rr=f({...ee.shape,...W(Fi(),"MARKDOWN").shape});var ir=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(ir||{}),St=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(St||{}),kt=(P=>(P.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",P.COMMUNICATION="COMMUNICATION",P.COMMERCE="COMMERCE",P.CORE="CORE",P.UNIVERSAL_AI="UNIVERSAL_AI",P.FLOW_CONTROL="FLOW_CONTROL",P.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",P.ACCOUNTING="ACCOUNTING",P.PRODUCTIVITY="PRODUCTIVITY",P.CONTENT_AND_FILES="CONTENT_AND_FILES",P.DEVELOPER_TOOLS="DEVELOPER_TOOLS",P.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",P.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",P.HUMAN_RESOURCES="HUMAN_RESOURCES",P.PAYMENT_PROCESSING="PAYMENT_PROCESSING",P.MARKETING="MARKETING",P.SALES_AND_CRM="SALES_AND_CRM",P))(kt||{});var ar=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(ar||{}),$n="both_client_credentials_and_authorization_code";var fe=(o=>(o.POLLING="POLLING",o.WEBHOOK="WEBHOOK",o.APP_WEBHOOK="APP_WEBHOOK",o.MANUAL="MANUAL",o))(fe||{}),sr=(a=>(a.NONE="NONE",a.HEADER_PRESENT="HEADER_PRESENT",a.QUERY_PRESENT="QUERY_PRESENT",a.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",a.HEAD_REQUEST="HEAD_REQUEST",a))(sr||{}),ep=f({strategy:L(sr),paramName:v(s())}),ur=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(ur||{});var Nr=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(Nr||{}),Wi=f({status:v(Pe()),body:v(H()),headers:v(q(s(),s()))}),Ki=f({type:M("DELAY"),resumeDateTime:s(),requestIdToReply:v(s()),handlerId:v(s()),streamStepProgress:v(L(Nr))}),Ji=f({type:M("WEBHOOK"),requestId:s(),requestIdToReply:v(s()),response:Wi,handlerId:v(s()),streamStepProgress:v(L(Nr))}),tp=K([Ki,Ji]);var rp=f({body:H(),rawBody:v(H()),headers:q(s(),s()),queryParams:q(s(),s())});function A(e){return e==null}i(A,"isNil");function ce(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}i(ce,"isEmpty");function Cr(e,t){if(e==null)throw new Error(`${t} is null or undefined`)}i(Cr,"assertNotNullOrUndefined");var wn=we(require("crypto"),1);var np=128,lt,$t,op=i(e=>{if(e<0)throw new RangeError("Wrong ID size");try{!lt||lt.length<e?(lt=Buffer.allocUnsafe(e*np),wn.default.randomFillSync(lt),$t=0):$t+e>lt.length&&(wn.default.randomFillSync(lt),$t=0)}catch(t){throw lt=void 0,t}$t+=e},"fillPool"),ip=i(e=>(op(e|=0),lt.subarray($t-e,$t)),"random"),ap=i((e,t,r)=>{let n=(2<<31-Math.clz32(e.length-1|1))-1,o=Math.ceil(1.6*n*t/e.length);return(a=t)=>{if(a<=0)return"";let u="";for(;;){let c=r(o),d=o;for(;d--;)if(u+=e[c[d]&n]||"",u.length===a)return u}}},"customRandom"),Yi=i((e,t=21)=>ap(e,t,ip),"customAlphabet");var sp="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Qi=21,LE=s().check(at(new RegExp(`^[0-9a-zA-Z]{${Qi}}$`))),up=Yi(sp,Qi);var dt=ct(ut(e=>e instanceof Date?e.toISOString():e),s()),Le={id:s(),created:dt,updated:dt},le=i(e=>v(Yt(e)),"Nullable");function zn(e){return v(Yt(L(e)))}i(zn,"NullableEnum");var VE=ct(ut(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),v(te())),Ur=i(e=>ct(ut(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),v(F(e))),"OptionalArrayFromQuery");var GE=q(s(),H());var wt=(p=>(p.OPENAI="openai",p.OPENROUTER="openrouter",p.ANTHROPIC="anthropic",p.AZURE="azure",p.GOOGLE="google",p.ACTIVEPIECES="activepieces",p.CLOUDFLARE_GATEWAY="cloudflare-gateway",p.CUSTOM="custom",p.BEDROCK="bedrock",p.MISTRAL="mistral",p.XAI="xai",p.DEEPSEEK="deepseek",p.ZAI="zai",p.QWEN="qwen",p.MINIMAX="minimax",p.MOONSHOT="moonshot",p))(wt||{});var nA=s().check(at(/^#[0-9A-Fa-f]{6}$/));var iA=f({filename:s(),data:H(),type:M("file"),mimetype:v(s())});var cp=we(ta());var pA=f({...Le,name:s(),permissions:F(s()),platformId:le(s()),type:s(),userCount:v(Pe())});var ra=(n=>(n.AGENT_DECIDE="agent-decide",n.CHOOSE_YOURSELF="choose-yourself",n.LEAVE_EMPTY="leave-empty",n))(ra||{}),On=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(On||{}),Dn=(n=>(n.SSE="sse",n.STREAMABLE_HTTP="streamable-http",n.SIMPLE_HTTP="http",n))(Dn||{});var Rn=(n=>(n.TEXT="text",n.NUMBER="number",n.BOOLEAN="boolean",n))(Rn||{});var Nn=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(Nn||{});var lp=f({mode:L(ra),value:H()}),dp=f({auth:v(s()),fields:q(s(),lp)}),pp=f({pieceName:s(),pieceVersion:s(),actionName:s(),predefinedInput:v(dp)}),mp=f({type:M("PIECE"),toolName:s().check(Fe(1)),pieceMetadata:pp}),fp=f({type:M("none")}),gp=f({type:M("access_token"),accessToken:s()}),yp=f({type:M("api_key"),apiKey:s(),apiKeyHeader:s()}),hp=f({type:M("headers"),headers:q(s(),s())}),_p=st("type",[fp,gp,yp,hp]),na=f({type:M("FLOW"),toolName:s().check(Fe(1)),externalFlowId:s(),flowDisplayName:v(s())}),oa=f({type:M("MCP"),toolName:s().check(Fe(1)),serverUrl:Ui(),protocol:L(Dn),auth:_p}),ia=f({type:M("KNOWLEDGE_BASE"),toolName:s().check(Fe(1)),sourceType:L(On),sourceId:s(),sourceName:s()}),vp=st("type",[mp,na,oa,ia]),bp=f({displayName:s(),description:v(s()),type:L(Rn)}),aa=f({type:M("MARKDOWN"),markdown:s()}),zt={type:M("TOOL_CALL"),input:le(q(s(),H())),output:v(H()),toolName:s(),status:L(Nn),toolCallId:s(),startTime:s(),endTime:v(s())},BA=f(zt),sa=st("toolCallType",[f({...zt,toolCallType:M("PIECE"),pieceName:s(),pieceVersion:s(),actionName:s()}),f({...zt,toolCallType:M("FLOW"),displayName:s(),externalFlowId:s()}),f({...zt,toolCallType:M("MCP"),displayName:s(),serverUrl:s()}),f({...zt,toolCallType:M("KNOWLEDGE_BASE"),displayName:s(),sourceType:s()}),f({...zt,toolCallType:M("UNKNOWN"),displayName:s()})]),Pp=K([aa,sa]);var Cn=(r=>(r.IMAGE="image",r.TEXT="text",r))(Cn||{}),et=f({apiKey:s()}),xp=et,Tp=f({apiKey:s(),apiKeyHash:s()}),Ip=et,Ep=et,Ap=et,Sp=et,kp=et,$p=et,wp=et,pa=f({accessKeyId:s().check(Fe(1)),secretAccessKey:s().check(Fe(1))}),zp=f({}),Op=f({}),Dp=f({}),Rp=f({}),Np=f({}),Cp=f({}),ma=f({modelId:s(),modelName:s(),modelType:L(Cn)}),fa=f({apiKeyHeader:s(),baseUrl:s(),models:F(ma),defaultHeaders:v(q(s(),s()))}),ga=f({accountId:s(),gatewayId:s(),models:F(ma),vertexProject:v(s()),vertexRegion:v(s())}),ya=f({resourceName:s(),apiVersion:ct(ut(e=>typeof e=="string"&&e.trim().length===0?void 0:e),v(s()))}),ha=f({region:s().check(Fe(1))}),_a=f({}),Up=K([xp,Ap,Sp,kp,$p,Ep,Ip,Tp,pa,wp]),va=K([fa,ga,ya,ha,zp,Dp,Rp,Np,Op,Cp,_a]),Mp=f({id:s(),name:s(),type:L(Cn)}),Lp=f({id:s(),name:s(),provider:L(wt),config:va,enabledForChat:te()}),Fp=f({provider:L(wt),name:s(),enabledForChat:te(),keys:F(f({id:s(),name:s()}))}),jp=f({provider:L(wt),configId:s(),config:va,auth:Up,platformId:s()});var qA={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"},ua=["gpt-5.5","gpt-5.4-mini","gpt-5.4-nano","gpt-4.1","gpt-4.1-mini"],Vp=["claude-sonnet-4-6","claude-opus-4-7","claude-haiku-4-5"],Bp=["claude-sonnet-4.6","claude-opus-4.7","claude-haiku-4.5"],ca=["gemini-2.5-pro","gemini-2.5-flash","gemini-3.1-pro-preview","gemini-3-flash-preview"],Zp=["grok-4.20","grok-4.1-fast"],Gp={openai:ua,anthropic:Vp,google:ca,activepieces:[...Bp.map(e=>`anthropic/${e}`),...ua.map(e=>`openai/${e}`),...ca.map(e=>`google/${e}`),...Zp.map(e=>`x-ai/${e}`)]};var la=128e3,Hp={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function qp({provider:e}){return e?Hp[e]??la:la}i(qp,"getMaxContextTokens");var da={openai:"text-embedding-3-small",google:"text-embedding-004",azure:"text-embedding-3-small",activepieces:"text-embedding-3-small",openrouter:"openai/text-embedding-3-small"},Wp={anthropic:"native",google:"native",openrouter:"plugin",activepieces:"plugin"},Kp=new Set(["anthropic","mistral","xai","deepseek","zai","qwen","minimax","moonshot"]),Jp={xai:"https://api.x.ai/v1",deepseek:"https://api.deepseek.com/v1",zai:"https://api.z.ai/api/paas/v4",qwen:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",minimax:"https://api.minimax.io/v1",moonshot:"https://api.moonshot.ai/v1"};function Ee(e){return{chatModels:Gp[e],maxContextTokens:qp({provider:e}),defaultEmbeddingModel:da[e],supportsEmbedding:da[e]!==void 0,supportsImageGeneration:!Kp.has(e),webSearch:Wp[e]}}i(Ee,"buildProviderCapabilities");var Xp={openai:Ee("openai"),anthropic:Ee("anthropic"),openrouter:Ee("openrouter"),azure:Ee("azure"),google:Ee("google"),"cloudflare-gateway":Ee("cloudflare-gateway"),custom:Ee("custom"),bedrock:Ee("bedrock"),mistral:Ee("mistral"),activepieces:Ee("activepieces"),xai:Ee("xai"),deepseek:Ee("deepseek"),zai:Ee("zai"),qwen:Ee("qwen"),minimax:Ee("minimax"),moonshot:Ee("moonshot")};var Yp=f({base64Url:s(),fileName:s(),extension:v(s())}),Qp=f({mimeType:s(),url:s(),fileName:v(s())}),Un=K([Yp,Qp]);var em=K([f({type:M("file"),value:Un}),f({type:M("markdown"),value:s(),files:v(F(Un))})]),tm=f({sessionId:s(),message:s(),files:v(F(s()))});var Pa=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(Pa||{}),xa=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(xa||{}),Mn=(n=>(n.RECORD_CREATED="RECORD_CREATED",n.RECORD_UPDATED="RECORD_UPDATED",n.RECORD_DELETED="RECORD_DELETED",n))(Mn||{});var rm=K([f({...Le,name:s(),externalId:s(),type:M("STATIC_DROPDOWN"),tableId:s(),projectId:s(),data:f({options:F(f({value:s()}))})}),f({...Le,name:s(),externalId:s(),type:K([M("TEXT"),M("NUMBER"),M("DATE"),M("DATETIME")]),tableId:s(),projectId:s()})]),nm=f({...Le,name:s(),folderId:le(s()),projectId:s(),externalId:s(),status:zn(xa),trigger:zn(Pa)}),om=f({...Le,tableId:s(),projectId:s(),cells:q(s(),f({updated:s(),created:s(),value:H(),fieldName:s()}))}),im=f({events:F(L(Mn)),webhookUrl:s(),flowId:s()}),am=f({fields:F(f({id:s(),name:s()})),rows:F(q(s(),s())),name:s()}),sm=f({projectId:s(),limit:v(Qt.number()),cursor:v(s()),name:v(s()),externalIds:Ur(s()),folderId:v(s()),folderIds:Ur(s())}),um=f({records:F(F(f({fieldId:s(),value:Ia()}))),tableId:s()}),cm=f({cells:v(F(f({fieldId:s(),value:Ia()}))),tableId:s(),agentUpdate:v(te())}),Ta=st("operator",[_t("eq"),_t("neq"),_t("gt"),_t("gte"),_t("lt"),_t("lte"),_t("co"),ba("exists"),ba("not_exists")]),lm=f({tableId:s(),limit:v(Qt.number()),cursor:v(s()),filters:Ur(Ta)});function Ia(){return ct(ut(e=>e==null?e:String(e)),Yt(s()))}i(Ia,"coerceToString");function _t(e){return f({fieldId:s(),operator:M(e),value:s()})}i(_t,"valueFilter");function ba(e){return f({fieldId:s(),operator:M(e)})}i(ba,"existenceFilter");var dm=f({status:v(Pe()),body:v(H()),headers:v(q(s(),s()))}),pm=f({...Le,deleted:le(dt),ownerId:s(),displayName:s(),platformId:s(),externalId:le(s())});var Ea=f({name:s(),description:v(s()),type:s(),required:te()}),mm=f({pieceName:s(),triggerName:s(),input:f({toolName:s(),toolDescription:s(),inputSchema:F(Ea),returnsResponse:te()})});var Aa="^[0-9]+\\.[0-9]+\\.[0-9]+$",pS=new RegExp(Aa),gm="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",mS=s().check(at(new RegExp(Aa))),fS=s().check(at(new RegExp(gm))),ym=f({packageType:M("ARCHIVE"),pieceType:L(St),pieceName:s(),pieceVersion:s(),archiveId:s(),platformId:s()}),Sa=f({packageType:M("REGISTRY"),pieceType:M("OFFICIAL"),pieceName:s(),pieceVersion:s()}),ka=f({packageType:M("REGISTRY"),pieceType:M("CUSTOM"),pieceName:s(),pieceVersion:s(),platformId:s()}),gS=K([Sa,ka]),yS=K([ym,Sa,ka]);var hm=st("type",[f({type:M("CRON_EXPRESSION"),cronExpression:s(),timezone:s()}),f({type:M("INTERVAL"),intervalMs:Mi().check(kr(6e4))})]),hS=f({...Le,type:L(fe),projectId:s(),flowId:s(),triggerName:s(),schedule:le(hm),flowVersionId:s(),pieceName:s(),pieceVersion:s(),deleted:le(s()),simulate:te()}),$a=(p=>(p.UNKNOWN="UNKNOWN",p.FLOW_RUN_LOG="FLOW_RUN_LOG",p.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",p.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",p.FLOW_STEP_FILE="FLOW_STEP_FILE",p.SAMPLE_DATA="SAMPLE_DATA",p.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",p.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",p.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",p.PROJECT_RELEASE="PROJECT_RELEASE",p.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",p.PLATFORM_ASSET="PLATFORM_ASSET",p.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",p.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",p.KNOWLEDGE_BASE="KNOWLEDGE_BASE",p.FLOW_BUNDLE="FLOW_BUNDLE",p))($a||{}),wa=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(wa||{}),za=(r=>(r.S3="S3",r.DB="DB",r))(za||{}),_S=f({...Le,projectId:le(s()),platformId:le(s()),type:L($a),compression:L(wa),data:v(H()),location:L(za),size:le(Pe()),fileName:le(s()),s3Key:le(s()),metadata:le(q(s(),s()))}),Oa=(n=>(n.ADMIN="ADMIN",n.MEMBER="MEMBER",n.OPERATOR="OPERATOR",n))(Oa||{}),Da=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(Da||{}),vS=f({id:s(),email:s(),firstName:s(),status:L(Da),externalId:le(s()),platformId:le(s()),platformRole:L(Oa),lastName:s(),created:dt,updated:dt,lastActiveDate:le(dt),imageUrl:le(s())});var Ln=f({...ee.shape,...W(q(s(),H()),"OBJECT").shape});var Fn=f({...ee.shape,formatProperty:v(s()),...W(s(),"RICH_TEXT").shape});var Ua=f({...ee.shape,...W(s(),"COLOR").shape});var jn=K([Re,Je,Fn,Rr,Ye,Ne,Xe,An,er,kn,Qe,nr,Ln,or,rr,Sn,tr,Ua]),y={ShortText(e){return{...e,valueSchema:void 0,type:"SHORT_TEXT"}},Checkbox(e){return{...e,valueSchema:void 0,type:"CHECKBOX"}},LongText(e){return{...e,valueSchema:void 0,type:"LONG_TEXT"}},RichText(e){return{...e,valueSchema:void 0,type:"RICH_TEXT"}},MarkDown(e){return{displayName:"Markdown",required:!1,description:e.value,type:"MARKDOWN",valueSchema:void 0,variant:e.variant??"INFO"}},Number(e){return{...e,valueSchema:void 0,type:"NUMBER"}},Json(e){return{...e,valueSchema:void 0,type:"JSON"}},Array(e){return{...e,valueSchema:void 0,type:"ARRAY"}},Object(e){return{...e,valueSchema:void 0,type:"OBJECT"}},Dropdown(e){return{...e,valueSchema:void 0,type:"DROPDOWN"}},StaticDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_DROPDOWN"}},MultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"MULTI_SELECT_DROPDOWN"}},DynamicProperties(e){return{...e,valueSchema:void 0,type:"DYNAMIC"}},StaticMultiSelectDropdown(e){return{...e,valueSchema:void 0,type:"STATIC_MULTI_SELECT_DROPDOWN"}},DateTime(e){return{...e,valueSchema:void 0,type:"DATE_TIME"}},DateRange(e){return{...e,valueSchema:void 0,type:"DATE_RANGE"}},File(e){return{...e,valueSchema:void 0,type:"FILE"}},Custom(e){let t=e.code.toString();return{...e,code:t,valueSchema:void 0,type:"CUSTOM"}},Color(e){return{...e,valueSchema:void 0,type:"COLOR"}}};var He=f({displayName:s(),description:v(s()),hasConnectionIdentifier:v(te())});var Ma=f({username:s(),password:s()}),Vn=f({...He.shape,username:f({displayName:s(),description:v(s())}),password:f({displayName:s(),description:v(s())}),...W(Ma,"BASIC_AUTH").shape});var Pm=q(s(),K([Re,Je,Qe,Ye,Ne])),Bn=f({...He.shape,props:Pm,...W(H(),"CUSTOM_AUTH").shape});var vt=f({...He.shape,...W(f({auth:s()}),"SECRET_TEXT").shape});var xm=q(s(),K([Re,Je,vt,Qe,Ye,Ne,Xe,Rr])),La=f({...He.shape,props:xm,...W(H(),"OIDC").shape});var Zn=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(Zn||{}),Fa=K([Re,vt,Ne]),ja=q(s(),Fa),Tm=f({props:v(q(s(),Fa)),authUrl:s(),tokenUrl:s(),scope:F(s()),prompt:v(K([M("none"),M("consent"),M("login"),M("omit")])),pkce:v(te()),pkceMethod:v(K([M("plain"),M("S256")])),authorizationMethod:v(L(Zn)),grantType:v(K([L(ar),M($n)])),extra:v(q(s(),s()))}),Va=f({access_token:s(),props:v(ja),data:q(s(),Xt())}),Gn=f({...He.shape,...Tm.shape,...W(Va,"OAUTH2").shape});var Ot=K([Vn,Bn,La,Gn,vt]),cr="Connection",Hn={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||cr}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||cr,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||cr}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||cr}},None(){}};var r$={OAUTH2:"OAUTH2",CLOUD_OAUTH2:"OAUTH2",PLATFORM_OAUTH2:"OAUTH2",BASIC_AUTH:"BASIC_AUTH",CUSTOM_AUTH:"CUSTOM_AUTH",OIDC:"OIDC",SECRET_TEXT:"SECRET_TEXT",NO_AUTH:void 0};var Im=f({...ee.shape,...W(H(),"CUSTOM").shape,code:s()});var Em=K([jn,Ot]),qn=q(s(),Em),T$=q(s(),jn);var Ba=K([f({strategy:M("CRON"),cronExpression:s()}),f({strategy:M("NONE")})]),Dt=class{constructor(t,r,n,o,a,u,c,d,g,_,I,b,l,m,h,p,P,T,z,ne,ve){this.name=t;this.displayName=r;this.description=n;this.requireAuth=o;this.props=a;this.type=u;this.handshakeConfiguration=c;this.onHandshake=d;this.renewConfiguration=g;this.onRenew=_;this.onEnable=I;this.onDisable=b;this.onStart=l;this.run=m;this.test=h;this.sampleData=p;this.testStrategy=P;this.outputSchema=T;this.aiMetadata=z;this.classification=ne;this.propertyGroups=ve}static{i(this,"ITrigger")}},oe=i(e=>{switch(e.type){case"WEBHOOK":return new Dt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,e.handshakeConfiguration??{strategy:"NONE"},e.onHandshake??(async()=>({status:200})),e.renewConfiguration??{strategy:"NONE"},e.onRenew??(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,e.test?"TEST_FUNCTION":"SIMULATION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case"POLLING":return new Dt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,"TEST_FUNCTION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case"MANUAL":return new Dt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,"TEST_FUNCTION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case"APP_WEBHOOK":return new Dt(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:"NONE"},async()=>({status:200}),{strategy:"NONE"},(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,A(e.sampleData)&&A(e.test)?"SIMULATION":"TEST_FUNCTION",e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups)}},"createTrigger");var Za="2",Lr="0.82.0";var Wn=class{constructor(t,r,n,o,a,u,c,d,g=Lr,_,I="",b){this.displayName=t;this.logoUrl=r;this.authors=n;this.events=o;this.categories=c;this.auth=d;this.minimumSupportedRelease=g;this.maximumSupportedRelease=_;this.description=I;this.deprecated=b;this._actions={};this._triggers={};this.getContextInfo=i(()=>({version:Za}),"getContextInfo");(!Sm(g)||km(g,Lr))&&(this.minimumSupportedRelease=Lr),a.forEach(l=>this._actions[l.name]=l),u.forEach(l=>this._triggers[l.name]=l)}static{i(this,"Piece")}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth:Am(this.auth),minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,deprecated:this.deprecated,contextInfo:this.getContextInfo?.()}}getAction(t){return this._actions[t]}getTrigger(t){return this._triggers[t]}actions(){return this._actions}triggers(){return this._triggers}},Ha=i(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((r,n,o)=>n===o.findIndex(a=>a.type===r.type)))throw new Error("Auth properties must be unique by type");return new Wn(e.displayName,e.logoUrl,e.authors??[],e.events,e.actions,e.triggers,e.categories??[],e.auth,e.minimumSupportedRelease,e.maximumSupportedRelease,e.description,e.deprecated)},"createPiece");function Am(e){if(e!==void 0)return Array.isArray(e)?e.map(Ga):Ga(e)}i(Am,"withConnectionIdentifierFlag");function Ga(e){return{...e,hasConnectionIdentifier:e.getConnectionIdentifier!==void 0}}i(Ga,"flagConnectionIdentifier");function Sm(e){return/^\d+\.\d+\.\d+$/.test(e)}i(Sm,"isValidSimpleSemver");function km(e,t){let[r,n,o]=e.split(".").map(Number),[a,u,c]=t.split(".").map(Number);return r!==a?r<a:n!==u?n<u:o<c}i(km,"isSemverLessThan");var $m=v(q(s(),q(s(),s()))),qa=f({id:v(s()),name:s(),displayName:s(),logoUrl:s(),description:s(),authors:F(s()),platformId:v(s()),directoryPath:v(s()),auth:v(K([Ot,F(Ot)])),version:s(),categories:v(F(L(kt))),minimumSupportedRelease:v(s()),maximumSupportedRelease:v(s()),deprecated:v(te()),i18n:$m}),wm=L(["human","ai","both"]),Wa=f({description:v(s()),idempotent:v(te())}),Ka=L(["READ","SEARCH","WRITE","DESTRUCTIVE"]);var zm=L(["tabs","section","summary","builder","footer"]),Ja=f({key:s(),display:zm,label:v(s()),description:v(s()),icon:v(s()),props:F(s())}),Xa=f({name:s(),displayName:s(),description:s(),props:qn,propertyGroups:v(F(Ja)),requireAuth:te(),errorHandlingOptions:v(En),outputSchema:v(Or()),audience:v(wm),aiMetadata:v(Wa),classification:v(Ka)}),Ya=f({name:s(),displayName:s(),description:s(),props:qn,propertyGroups:v(F(Ja)),errorHandlingOptions:v(En),type:L(fe),sampleData:H(),handshakeConfiguration:v(Or()),renewConfiguration:v(Ba),testStrategy:L(ur),outputSchema:v(Or()),aiMetadata:v(Wa),classification:v(Ka)}),Om=f({...qa.shape,actions:q(s(),Xa),triggers:q(s(),Ya)}),Dm=f({...qa.shape,actions:Pe(),triggers:Pe(),suggestedActions:v(F(Xa)),suggestedTriggers:v(F(Ya))}),Qa=f({projectUsage:Pe(),pieceType:L(St),packageType:L(ir),platformId:v(s()),archiveId:v(s())}),Ew=f({...Om.shape,...Qa.shape}),Aw=f({...Dm.shape,...Qa.shape}),Sw=f({name:s(),version:s()});var Rm=we(require("path")),Nm=we(require("fs/promises"));var Rt=require("node:stream");var Fr=class{constructor(t,r){this.baseUrl=t;this.authenticationConverter=r}static{i(this,"BaseHttpClient")}getUrl(t){let r=new URL(`${this.baseUrl}${t.url}`),n=`${r.origin}${r.pathname}`,o=new URLSearchParams;return r.searchParams.forEach((a,u)=>{o.append(u,a)}),{urlWithoutQueryParams:n,queryParams:o}}getHeaders(t){let r={Accept:"application/json"};return t.authentication&&this.populateAuthentication(t.authentication,r),t.body&&(t.headers?.["Content-Type"]==="text/csv"?r["Content-Type"]="text/csv":r["Content-Type"]="application/json"),t.headers&&(r={...r,...t.headers}),r}populateAuthentication(t,r){this.authenticationConverter.convert(t,r)}};var jr=class{static{i(this,"DelegatingAuthenticationConverter")}constructor(t=new Kn,r=new Jn){this.converters={BEARER_TOKEN:t,BASIC:r}}convert(t,r){return this.converters[t.type].convert(t,r)}},Kn=class{static{i(this,"BearerTokenAuthenticationConverter")}convert(t,r){return r.Authorization=`Bearer ${t.token}`,r}},Jn=class{static{i(this,"BasicTokenAuthenticationConverter")}convert(t,r){let n=`${t.username}:${t.password}`,o=Buffer.from(n).toString("base64");return r.Authorization=`Basic ${o}`,r}};var bt=class extends Error{constructor(r,n){let o=n.status||500,a=Buffer.isBuffer(n.responseBody)?n.responseBody.toString():n.responseBody;super(JSON.stringify({response:{status:o,body:a},request:{body:r}}));this.requestBody=r;this.status=o,this.responseBody=a}static{i(this,"HttpError")}errorMessage(){return{response:{status:this.status,body:this.responseBody},request:{body:this.requestBody}}}get response(){return{status:this.status,body:this.responseBody}}get request(){return{body:this.requestBody}}};function es({error:e,requestBody:t}){return e instanceof bt?e.errorMessage():{response:{status:0,body:e instanceof Error?e.message:String(e)},request:{body:t}}}i(es,"toFailsafeOutput");var Pt=(u=>(u.GET="GET",u.POST="POST",u.PATCH="PATCH",u.PUT="PUT",u.DELETE="DELETE",u.HEAD="HEAD",u))(Pt||{});var Vr=class extends Fr{static{i(this,"FetchHttpClient")}constructor(t="",r=new jr){super(t,r)}async sendRequest(t,r){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:n,queryParams:o}=this.getUrl(t),a=this.getHeaders(t),u=t.queryParams??{};for(let[z,ne]of Object.entries(u))o.append(z,ne);let c=o.toString(),d=c?`${n}?${c}`:n,g=t.responseType??"json",_=t.followRedirects??!0,I=t.retries??0,{body:b,extraHeaders:l,isStream:m}=Cm(t.method)?Um(t.body,a):{body:void 0,extraHeaders:{},isStream:!1},h=Lm({...a,...l}),p=await Mm(async()=>{let z=new AbortController,ne=t.timeout&&t.timeout>0?setTimeout(()=>z.abort(),t.timeout):void 0;try{let ve={method:t.method.toString(),headers:h,body:b,redirect:_?"follow":"manual",signal:z.signal};return m&&(ve.duplex="half"),r?.dispatcher!==void 0&&(ve.dispatcher=r.dispatcher),await fetch(d,ve)}finally{ne!==void 0&&clearTimeout(ne)}},m?0:I),P=_?300:400;if(p.status<200||p.status>=P){let z=await ts(p,g==="stream"?"text":g),ne=new bt(t.body,{status:p.status,responseBody:z});throw console.error("[HttpClient#(sanitized error message)] Request failed:",ne),ne}let T=await ts(p,g);return{status:p.status,headers:Fm(p.headers),body:T}}};function Cm(e){return e!=="GET"&&e!=="HEAD"}i(Cm,"acceptsRequestBody");function Um(e,t){if(ns(e))return{body:void 0,extraHeaders:{},isStream:!1};if(jm(e)){let n=new Rt.PassThrough;return e.on("error",o=>n.destroy(o)),e.pipe(n),{body:n,extraHeaders:e.getHeaders(),isStream:!0}}return e instanceof Rt.Readable?{body:e,extraHeaders:{},isStream:!0}:typeof e=="string"||Buffer.isBuffer(e)||e instanceof URLSearchParams||e instanceof ArrayBuffer||typeof FormData<"u"&&e instanceof FormData||typeof Blob<"u"&&e instanceof Blob?{body:e,extraHeaders:{},isStream:!1}:(t["Content-Type"]??t["content-type"]??"").includes("application/x-www-form-urlencoded")?{body:new URLSearchParams(e).toString(),extraHeaders:{},isStream:!1}:{body:JSON.stringify(e),extraHeaders:{},isStream:!1}}i(Um,"serializeBody");async function ts(e,t){switch(t){case"arraybuffer":return Buffer.from(await e.arrayBuffer());case"stream":return ns(e.body)?Rt.Readable.from([]):Rt.Readable.fromWeb(e.body);case"blob":return await e.blob();case"text":return await e.text();default:{let r=await e.text();if(r.length===0)return;try{return JSON.parse(r)}catch{return r}}}}i(ts,"parseResponseBody");async function Mm(e,t){let r;for(let n=0;n<=t;n++)try{let o=await e();if(o.status>=500&&n<t){await rs(n);continue}return o}catch(o){if(r=o,n<t){await rs(n);continue}throw o}throw r}i(Mm,"sendWithRetries");function rs(e){let t=Math.min(1e3*2**e,3e4);return new Promise(r=>setTimeout(r,t))}i(rs,"backoff");function Lm(e){let t={};for(let[r,n]of Object.entries(e))n!==void 0&&(t[r.toLowerCase()]=Array.isArray(n)?n.join(", "):n);return t}i(Lm,"normalizeHeaders");function Fm(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}i(Fm,"toHttpHeaders");function jm(e){return typeof e=="object"&&e!==null&&typeof e.getHeaders=="function"&&typeof e.pipe=="function"&&typeof e.on=="function"}i(jm,"isNodeFormData");function ns(e){return e==null}i(ns,"isNil");var ze=new Vr;var $g=we(require("fs")),uc=we(_o());var wg={"application/json":"json","application/pdf":"pdf","application/xml":"xml","text/xml":"xml","application/zip":"zip","application/gzip":"gz","application/x-tar":"tar","application/octet-stream":"bin","application/msword":"doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.ms-excel":"xls","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-powerpoint":"ppt","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/rtf":"rtf","application/javascript":"js","application/x-www-form-urlencoded":"bin","text/plain":"txt","text/html":"html","text/css":"css","text/csv":"csv","text/calendar":"ics","text/markdown":"md","image/png":"png","image/jpeg":"jpeg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/bmp":"bmp","image/tiff":"tiff","image/x-icon":"ico","image/vnd.microsoft.icon":"ico","image/heic":"heic","audio/mpeg":"mp3","audio/mp4":"m4a","audio/wav":"wav","audio/x-wav":"wav","audio/ogg":"ogg","audio/webm":"weba","video/mp4":"mp4","video/mpeg":"mpeg","video/webm":"webm","video/quicktime":"mov","video/x-msvideo":"avi","font/woff":"woff","font/woff2":"woff2","font/ttf":"ttf","font/otf":"otf"};function zg(e){let t=e.split(";")[0].trim().toLowerCase();return wg[t]??""}i(zg,"contentTypeToExtension");var Og=i(({baseUrl:e,relativePath:t})=>{let r=e.endsWith("/")?e:`${e}/`,n=t.startsWith("/")?t.slice(1):t;return`${r}${n}`},"joinBaseUrlWithRelativePath"),Dg=i((e,t)=>{let r="https://api.example.com";try{let n=t?e(t):void 0;return(n?.endsWith("/")?n.slice(0,-1):n)??r}catch{return r}},"getBaseUrlForDescription");function cc({auth:e,baseUrl:t,authMapping:r,description:n,displayName:o,name:a,props:u,extraProps:c,authLocation:d="headers",classification:g="WRITE"}){return D({audience:"human",name:a||"custom_api_call",classification:g,displayName:o||"Custom API Call",description:n||"Make a custom API call to a specific endpoint",auth:e,requireAuth:!!e,props:{url:y.DynamicProperties({auth:e,displayName:"",required:!0,refreshers:[],props:i(async({auth:_})=>({url:y.ShortText({displayName:"URL",description:`You can either use the full URL or the relative path to the base URL
|
|
3
|
+
i.e ${Dg(t,_)}/resource or /resource`,required:!0,defaultValue:_?t(_):"",...u?.url??{}})}),"props")}),method:y.StaticDropdown({displayName:"Method",required:!0,options:{options:Object.values(Pt).map(_=>({label:_,value:_}))},...u?.method??{}}),headers:y.Object({displayName:"Headers",description:"Authorization headers are injected automatically from your connection.",required:!0,...u?.headers??{}}),queryParams:y.Object({displayName:"Query Parameters",required:!0,...u?.queryParams??{}}),body_type:y.StaticDropdown({displayName:"Body Type",required:!1,defaultValue:"none",options:{disabled:!1,options:[{label:"None",value:"none"},{label:"JSON",value:"json"},{label:"Form Data",value:"form_data"},{label:"Raw",value:"raw"}]}}),body:y.DynamicProperties({auth:e,displayName:"Body",refreshers:["body_type"],required:!1,props:i(async({body_type:_})=>{if(!_)return{};let I=_,b={};switch(I){case"none":break;case"json":b.data=y.Json({displayName:"JSON Body",required:!0,...u?.body??{}});break;case"raw":b.data=y.LongText({displayName:"Raw Body",required:!0});break;case"form_data":b.data=y.Array({displayName:"Form Data",required:!0,properties:{fieldName:y.ShortText({displayName:"Field Name",required:!0}),fieldType:y.StaticDropdown({displayName:"Field Type",required:!0,options:{disabled:!1,options:[{label:"Text",value:"text"},{label:"File",value:"file"}]}}),textFieldValue:y.LongText({displayName:"Text Field Value",required:!1}),fileFieldValue:y.File({displayName:"File Field Value",required:!1})}});break}return b},"props")}),response_is_binary:y.Checkbox({displayName:"Response is Binary ?",description:"Enable for files like PDFs, images, etc.",required:!1,defaultValue:!1}),failsafe:y.Checkbox({displayName:"No Error on Failure",required:!1,...u?.failsafe??{}}),timeout:y.Number({displayName:"Timeout (in seconds)",required:!1,...u?.timeout??{}}),followRedirects:y.Checkbox({displayName:"Follow redirects",required:!1,defaultValue:!1}),...c},run:i(async _=>{let{method:I,url:b,headers:l,queryParams:m,body:h,body_type:p,failsafe:P,timeout:T,response_is_binary:z,followRedirects:ne}=_.propsValue;Cr(I,"Method"),Cr(b,"URL");let ve=A(r)?{}:await r(_.auth,_.propsValue),De=b.url,ye=De.startsWith("http://")||De.startsWith("https://")?De:Og({baseUrl:t(_.auth),relativePath:De}),Y={method:I,url:ye,headers:{...l??{},...d==="headers"||!A(d)?ve:{}},queryParams:{...d==="queryParams"?ve:{},...m??{}},timeout:T?T*1e3:0,followRedirects:ne};if(z&&(Y.responseType="arraybuffer"),h)if(p&&p!=="none"){let ke=h.data;if(p==="form_data"){let yr=ke,V=new uc.default;for(let{fieldName:w,fieldType:S,textFieldValue:N,fileFieldValue:$}of yr)S==="text"&&!ce(N)?V.append(w,N):S==="file"&&!ce($)&&V.append(w,$.data,{filename:$?.filename});Y.body=V,Y.headers={...Y.headers,...V.getHeaders()}}else Y.body=ke}else p||(Y.body=h);try{let ke=await ze.sendRequest(Y);return await Rg(_.files,ke.body,ke.status,ke.headers,z)}catch(ke){if(P)return es({error:ke,requestBody:Y.body});throw ke}},"run")})}i(cc,"createCustomApiCallAction");var Rg=i(async(e,t,r,n,o)=>{let a;if(o&&Ng(t)){let u=Array.isArray(n?.["content-type"])?n["content-type"][0]:n?.["content-type"],c=zg(u??"")||"txt",d;t instanceof ArrayBuffer?d=Buffer.from(new Uint8Array(t)):Buffer.isBuffer(t)?d=t:d=Buffer.from(t),a=await e.write({fileName:`output.${c}`,data:d})}else a=t;return{status:r,headers:n,body:a}},"handleBinaryResponse"),Ng=i(e=>e instanceof ArrayBuffer||Buffer.isBuffer(e),"isBinaryBody");var xo=we(mt());var ue={subscribeWebhook:i(async(e,t,r,n,o)=>{let a={method:"POST",url:`${n}/api/v1/webhooks`,body:{event_object:e,event_action:t,subscription_url:r,version:"2.0"},authentication:{type:"BEARER_TOKEN",token:o},queryParams:{}},{body:u}=await ze.sendRequest(a);return u},"subscribeWebhook"),unsubscribeWebhook:i(async(e,t,r)=>{let n={method:"DELETE",url:`${t}/api/v1/webhooks/${e}`,authentication:{type:"BEARER_TOKEN",token:r}};return await ze.sendRequest(n)},"unsubscribeWebhook")};async function x({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:o,body:a}){let u=`${t}/api${n}`,c={};if(o)for(let[_,I]of Object.entries(o))I!=null&&(c[_]=Array.isArray(I)?I.map(String).join(","):String(I));let d;a&&(d=Object.entries(a).reduce((_,[I,b])=>(A(b)||(_[I]=b),_),{}));let g={method:r,url:u,authentication:{type:"BEARER_TOKEN",token:e},queryParams:c,body:d};try{return(await ze.sendRequest(g)).body}catch(_){throw _ instanceof bt&&_.response.status===403?new Error("Please reconnect your Pipedrive account."):_}}i(x,"pipedriveApiCall");async function k({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:o,body:a}){let u=o||{};u.start=0,u.limit=500;let c=[],d=!0;do{let g=await x({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:u,body:a});if(A(g.data))break;c.push(...g.data),u.start=g.additional_data.pagination.next_start,d=g.additional_data.pagination.more_items_in_collection}while(d);return c}i(k,"pipedrivePaginatedV1ApiCall");async function ge({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:o,body:a}){let u=o?{...o}:{},c,d=[],g=!0;do{let _={...u};c&&(_.cursor=c),_.limit=500;let I=await x({accessToken:e,apiDomain:t,method:r,resourceUri:n,query:_,body:a});if(A(I.data))break;Array.isArray(I.data)?d.push(...I.data):d.push(I.data),g=I.additional_data?.next_cursor!=null,c=I.additional_data?.next_cursor}while(g&&c);return d}i(ge,"pipedrivePaginatedV2ApiCall");function Po(e){return(0,xo.default)(e).isValid()?(0,xo.default)(e).format("YYYY-MM-DD"):e}i(Po,"formatDateIfValid");function Ae(e,t){let r=e.reduce((o,a)=>(o[a.key]=a,o),{}),n={};for(let[o,a]of Object.entries(t)){if(ce(a))continue;let u=r[o];if(u){if(u.is_subfield){let c=o.split("_")[0];n[c]={...n[c],[u.id_suffix]:u.field_type==="date"?Po(a):a};continue}switch(u.field_type){case"monetary":n[o]={...n[o],value:Number(a)};break;case"address":case"daterange":case"timerange":case"time":n[o]={...n[o],value:Po(a)};break;case"date":n[o]=Po(a);break;default:n[o]=a;break}}}return n}i(Ae,"pipedriveParseCustomFields");function R(e,t){let r={...t},n=t.custom_fields||{};for(let o of e){if(!o.edit_flag)continue;let a=o.key,u=o.name,c=o.field_type;if(a in n){let d=n[a];A(d)?r[u]=null:c==="enum"?r[u]=o.options?.find(g=>g.id===d)?.label||null:c==="set"&&Array.isArray(d)?r[u]=d.map(g=>o.options?.find(_=>_.id===g)?.label||null):r[u]=d}}return delete r.custom_fields,r}i(R,"pipedriveTransformCustomFields");function Tt(e,t){let r={...t};for(let n of e){if(!n.edit_flag)continue;let o=n.key,a=n.name,u=n.field_type;if(o in t){if(t[o]===null||t[o]===void 0)r[a]=null;else if(u==="enum")r[a]=n.options?.find(c=>c.id.toString()===t[o])?.label||null;else if(u==="set"){let c=t[o].split(",");r[a]=c.map(d=>n.options?.find(g=>g.id.toString()===d)?.label||null)}else r[a]=t[o];delete r[o]}}return r}i(Tt,"pipedriveTransformV1CustomFields");var E=Hn.OAuth2({description:"",authUrl:"https://oauth.pipedrive.com/oauth/authorize",tokenUrl:"https://oauth.pipedrive.com/oauth/token",required:!0,scope:["base","admin","contacts:full","users:read","deals:full","activities:full","leads:full","products:full","webhooks:full"]});var lc=[{key:"value",label:"Value"},{key:"label",label:"Label"},{key:"primary",label:"Primary",format:"boolean"}],Yr=[{key:"id",label:"Person ID",format:"number"},{key:"name",label:"Name"},{key:"first_name",label:"First Name"},{key:"last_name",label:"Last Name"},{key:"emails",label:"Emails",labelKey:"value",listItems:lc},{key:"phones",label:"Phones",labelKey:"value",listItems:lc},{key:"org_id",label:"Organization ID",format:"number"},{key:"owner_id",label:"Owner ID",format:"number"},{key:"label_ids",label:"Label IDs"},{key:"visible_to",label:"Visible To"},{key:"is_deleted",label:"Deleted",format:"boolean"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}],Cg=[{key:"open_deals_count",label:"Open Deals",format:"number"},{key:"won_deals_count",label:"Won Deals",format:"number"},{key:"lost_deals_count",label:"Lost Deals",format:"number"},{key:"closed_deals_count",label:"Closed Deals",format:"number"},{key:"activities_count",label:"Activities",format:"number"},{key:"done_activities_count",label:"Done Activities",format:"number"},{key:"undone_activities_count",label:"Undone Activities",format:"number"},{key:"notes_count",label:"Notes",format:"number"},{key:"files_count",label:"Files",format:"number"},{key:"followers_count",label:"Followers",format:"number"},{key:"last_activity_id",label:"Last Activity ID",format:"number"},{key:"next_activity_id",label:"Next Activity ID",format:"number"},{key:"last_incoming_mail_time",label:"Last Incoming Mail",format:"datetime"},{key:"last_outgoing_mail_time",label:"Last Outgoing Mail",format:"datetime"}],Qr=[...Yr,...Cg],Io=[{key:"id",label:"Deal ID",format:"number"},{key:"title",label:"Title"},{key:"value",label:"Value",format:"number"},{key:"currency",label:"Currency"},{key:"status",label:"Status"},{key:"probability",label:"Probability",format:"number"},{key:"stage_id",label:"Stage ID",format:"number"},{key:"pipeline_id",label:"Pipeline ID",format:"number"},{key:"person_id",label:"Person ID",format:"number"},{key:"org_id",label:"Organization ID",format:"number"},{key:"owner_id",label:"Owner ID",format:"number"},{key:"creator_user_id",label:"Creator User ID",format:"number"},{key:"label_ids",label:"Label IDs"},{key:"expected_close_date",label:"Expected Close Date",format:"date"},{key:"close_time",label:"Closed At",format:"datetime"},{key:"won_time",label:"Won At",format:"datetime"},{key:"lost_time",label:"Lost At",format:"datetime"},{key:"lost_reason",label:"Lost Reason"},{key:"stage_change_time",label:"Stage Changed At",format:"datetime"},{key:"mrr",label:"MRR",format:"number"},{key:"arr",label:"ARR",format:"number"},{key:"acv",label:"ACV",format:"number"},{key:"is_archived",label:"Archived",format:"boolean"},{key:"is_deleted",label:"Deleted",format:"boolean"},{key:"visible_to",label:"Visible To"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}],Ug=[{key:"activities_count",label:"Activities",format:"number"},{key:"done_activities_count",label:"Done Activities",format:"number"},{key:"undone_activities_count",label:"Undone Activities",format:"number"},{key:"notes_count",label:"Notes",format:"number"},{key:"files_count",label:"Files",format:"number"},{key:"followers_count",label:"Followers",format:"number"},{key:"participants_count",label:"Participants",format:"number"},{key:"products_count",label:"Products",format:"number"},{key:"last_activity_id",label:"Last Activity ID",format:"number"},{key:"next_activity_id",label:"Next Activity ID",format:"number"},{key:"smart_bcc_email",label:"Smart BCC Email",format:"email"}],Ft=[...Io,...Ug],Eo=[{key:"id",label:"Organization ID",format:"number"},{key:"name",label:"Name"},{key:"address",label:"Address"},{key:"website",label:"Website",format:"url"},{key:"linkedin",label:"LinkedIn",format:"url"},{key:"industry",label:"Industry"},{key:"employee_count",label:"Employees",format:"number"},{key:"annual_revenue",label:"Annual Revenue",format:"number"},{key:"owner_id",label:"Owner ID",format:"number"},{key:"label_ids",label:"Label IDs"},{key:"visible_to",label:"Visible To"},{key:"is_deleted",label:"Deleted",format:"boolean"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}],Mg=[{key:"people_count",label:"People",format:"number"},{key:"open_deals_count",label:"Open Deals",format:"number"},{key:"won_deals_count",label:"Won Deals",format:"number"},{key:"lost_deals_count",label:"Lost Deals",format:"number"},{key:"closed_deals_count",label:"Closed Deals",format:"number"},{key:"activities_count",label:"Activities",format:"number"},{key:"notes_count",label:"Notes",format:"number"},{key:"files_count",label:"Files",format:"number"},{key:"followers_count",label:"Followers",format:"number"},{key:"last_activity_id",label:"Last Activity ID",format:"number"},{key:"next_activity_id",label:"Next Activity ID",format:"number"}],en=[...Eo,...Mg],mr=[{key:"id",label:"Activity ID",format:"number"},{key:"subject",label:"Subject"},{key:"type",label:"Type"},{key:"done",label:"Done",format:"boolean"},{key:"due_date",label:"Due Date",format:"date"},{key:"due_time",label:"Due Time"},{key:"duration",label:"Duration",format:"duration"},{key:"priority",label:"Priority"},{key:"note",label:"Note",format:"html"},{key:"public_description",label:"Public Description"},{key:"location",label:"Location"},{key:"outcome",label:"Outcome"},{key:"busy",label:"Busy",format:"boolean"},{key:"deal_id",label:"Deal ID",format:"number"},{key:"person_id",label:"Person ID",format:"number"},{key:"org_id",label:"Organization ID",format:"number"},{key:"lead_id",label:"Lead ID"},{key:"owner_id",label:"Owner ID",format:"number"},{key:"creator_user_id",label:"Creator User ID",format:"number"},{key:"participants",label:"Participants"},{key:"conference_meeting_url",label:"Meeting URL",format:"url"},{key:"marked_as_done_time",label:"Marked Done At",format:"datetime"},{key:"is_deleted",label:"Deleted",format:"boolean"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}],Lg=[{key:"price",label:"Price",format:"number"},{key:"currency",label:"Currency"},{key:"cost",label:"Cost",format:"number"},{key:"direct_cost",label:"Direct Cost",format:"number"},{key:"notes",label:"Notes"}],tn=[{key:"id",label:"Product ID",format:"number"},{key:"name",label:"Name"},{key:"code",label:"Code"},{key:"description",label:"Description"},{key:"unit",label:"Unit"},{key:"tax",label:"Tax",format:"number"},{key:"category",label:"Category"},{key:"prices",label:"Prices",labelKey:"currency",listItems:Lg},{key:"billing_frequency",label:"Billing Frequency"},{key:"billing_frequency_cycles",label:"Billing Cycles",format:"number"},{key:"is_linkable",label:"Linkable",format:"boolean"},{key:"is_deleted",label:"Deleted",format:"boolean"},{key:"owner_id",label:"Owner ID",format:"number"},{key:"visible_to",label:"Visible To"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}],Fg=[{key:"id",label:"Product ID",format:"number"},{key:"name",label:"Name"},{key:"code",label:"Code"},{key:"tax",label:"Tax",format:"number"},{key:"type",label:"Type"},{key:"owner",label:"Owner"},{key:"visible_to",label:"Visible To"},{key:"custom_fields",label:"Custom Fields",dynamicKey:!0}],rn=[{key:"id",label:"Note ID",format:"number"},{key:"content",label:"Content",format:"html"},{key:"deal_id",label:"Deal ID",format:"number"},{key:"person_id",label:"Person ID",format:"number"},{key:"org_id",label:"Organization ID",format:"number"},{key:"lead_id",label:"Lead ID"},{key:"deal",label:"Deal",children:[{key:"title",label:"Title"}]},{key:"user",label:"Author",children:[{key:"name",label:"Name"},{key:"email",label:"Email",format:"email"}]},{key:"user_id",label:"Author ID",format:"number"},{key:"last_update_user_id",label:"Last Updated By",format:"number"},{key:"pinned_to_deal_flag",label:"Pinned to Deal",format:"boolean"},{key:"pinned_to_person_flag",label:"Pinned to Person",format:"boolean"},{key:"pinned_to_organization_flag",label:"Pinned to Organization",format:"boolean"},{key:"active_flag",label:"Active",format:"boolean"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}],Ao=[{key:"id",label:"Lead ID"},{key:"title",label:"Title"},{key:"value",label:"Value"},{key:"owner_id",label:"Owner ID",format:"number"},{key:"creator_id",label:"Creator ID",format:"number"},{key:"person_id",label:"Person ID",format:"number"},{key:"organization_id",label:"Organization ID",format:"number"},{key:"label_ids",label:"Label IDs"},{key:"expected_close_date",label:"Expected Close Date",format:"date"},{key:"source_name",label:"Source"},{key:"channel",label:"Channel"},{key:"cc_email",label:"CC Email",format:"email"},{key:"was_seen",label:"Seen",format:"boolean"},{key:"is_archived",label:"Archived",format:"boolean"},{key:"next_activity_id",label:"Next Activity ID",format:"number"},{key:"visible_to",label:"Visible To"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}],jg=[{key:"id",label:"Lead ID"},{key:"title",label:"Title"},{key:"type",label:"Type"},{key:"value",label:"Value",format:"number"},{key:"currency",label:"Currency"},{key:"person",label:"Person"},{key:"organization",label:"Organization"},{key:"owner",label:"Owner"},{key:"emails",label:"Emails"},{key:"phones",label:"Phones"},{key:"notes",label:"Notes"},{key:"is_archived",label:"Archived",format:"boolean"},{key:"visible_to",label:"Visible To"},{key:"custom_fields",label:"Custom Fields",dynamicKey:!0}],Vg=[{key:"id",label:"User ID",format:"number"},{key:"name",label:"Name"},{key:"email",label:"Email",format:"email"}],Bg=[{key:"id",label:"Deal Product ID",format:"number"},{key:"deal_id",label:"Deal ID",format:"number"},{key:"product_id",label:"Product ID",format:"number"},{key:"name",label:"Name"},{key:"item_price",label:"Item Price",format:"number"},{key:"quantity",label:"Quantity",format:"number"},{key:"sum",label:"Sum",format:"number"},{key:"currency",label:"Currency"},{key:"discount",label:"Discount",format:"number"},{key:"discount_type",label:"Discount Type"},{key:"tax",label:"Tax",format:"number"},{key:"tax_method",label:"Tax Method"},{key:"comments",label:"Comments"},{key:"order_nr",label:"Order Number",format:"number"},{key:"is_enabled",label:"Enabled",format:"boolean"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}],Zg=[{key:"user_id",label:"User ID",format:"number"},{key:"add_time",label:"Followed At",format:"datetime"}],Gg=[{key:"id",label:"File ID",format:"number"},{key:"name",label:"Name"},{key:"file_name",label:"Stored File Name"},{key:"file_type",label:"File Type"},{key:"file_size",label:"File Size",format:"number"},{key:"url",label:"Download URL",format:"url"},{key:"description",label:"Description"},{key:"user_id",label:"User ID",format:"number"},{key:"active_flag",label:"Active",format:"boolean"},{key:"inline_flag",label:"Inline",format:"boolean"},{key:"remote_location",label:"Remote Location"},{key:"remote_id",label:"Remote ID"},{key:"deal_id",label:"Deal ID",format:"number"},{key:"deal_name",label:"Deal Name"},{key:"lead_id",label:"Lead ID"},{key:"lead_name",label:"Lead Name"},{key:"person_id",label:"Person ID",format:"number"},{key:"person_name",label:"Person Name"},{key:"org_id",label:"Organization ID",format:"number"},{key:"org_name",label:"Organization Name"},{key:"product_id",label:"Product ID",format:"number"},{key:"product_name",label:"Product Name"},{key:"activity_id",label:"Activity ID",format:"number"},{key:"log_id",label:"Log ID",format:"number"},{key:"mail_message_id",label:"Mail Message ID",format:"number"},{key:"mail_template_id",label:"Mail Template ID",format:"number"},{key:"cid",label:"Content ID"},{key:"add_time",label:"Created At",format:"datetime"},{key:"update_time",label:"Updated At",format:"datetime"}];function Te(e,t){return{fields:[{key:"success",label:"Success",format:"boolean"},{key:"data",label:e,children:t}]}}i(Te,"envelope");function Ve({label:e,fields:t,labelKey:r}){return{fields:[{key:"found",label:"Found",format:"boolean"},{key:"data",label:e,labelKey:r,listItems:t}]}}i(Ve,"search");var dc=Te("Person",Yr),pc=Te("Person",Yr),mc=Te("Person",Yr),fc=Te("Deal",Io),gc=Te("Deal",Io),yc=Te("Organization",Eo),hc=Te("Organization",Eo),_c=Te("Activity",mr),vc=Te("Activity",mr),bc=Te("Product",tn),Pc=Te("Product",tn),xc=Te("Deal Product",Bg),Tc=Te("Note",rn),Ic=Te("Note",rn),Ec=Te("Lead",Ao),Ac=Te("Lead",Ao),Sc=Ve({label:"People",fields:Qr,labelKey:"name"}),kc=Ve({label:"Deals",fields:Ft,labelKey:"title"}),$c=Ve({label:"Deals",fields:Ft,labelKey:"title"}),wc=Ve({label:"Organizations",fields:en,labelKey:"name"}),zc=Ve({label:"Activities",fields:mr,labelKey:"subject"}),Oc=Ve({label:"Notes",fields:rn,labelKey:"content"}),Dc=Ve({label:"Leads",fields:jg,labelKey:"title"}),Rc=Ve({label:"Users",fields:Vg,labelKey:"name"}),Nc=Ve({label:"Products",fields:tn,labelKey:"name"}),Cc=Ve({label:"Products",fields:tn,labelKey:"name"}),Uc=Ve({label:"Products",fields:Fg,labelKey:"name"}),Mc=Te("Follower",Zg),Lc=Te("File",Gg),Fc={fields:Qr},jc={fields:Qr},Vc={fields:Ft},Bc={fields:Ft},Zc={fields:Ft},Gc={fields:en},Hc={fields:en},qc={fields:mr},Wc={fields:rn},Kc={fields:Ao},Jc={fields:Qr},Xc={fields:Ft},Yc={fields:en},Qc={fields:mr};var el=oe({auth:E,name:"new_activity",outputSchema:qc,classification:"READ",displayName:"New Activity",description:"Triggers when a new activity is added",aiMetadata:{description:"Fires when a new activity is added in Pipedrive. An activity is a scheduled task or event (call, meeting, deadline, email, etc.) with a subject, type, due date/time, and optional links to a deal, person, organization, or lead. Use to react when work or appointments are scheduled in the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("activity","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_activity_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_activity_trigger");t!=null&&await ue.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=[],r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:"attendees"}});if(A(r.data))return[];for(let n of r.data)t.push(n);return t},async run(e){let t=e.payload.body;return[(await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/activities/${t.data.id}`,query:{include_fields:"attendees"}})).data]},sampleData:{id:8,owner_id:1234,done:!1,type:"deadline",due_date:"2020-06-09",due_time:"10:00",duration:"01:00",busy:!0,add_time:"2020-06-08T12:37:56Z",marked_as_done_time:"2020-08-08T08:08:38Z",subject:"Deadline",public_description:"This is a description",location:{value:"Mustam\xE4e tee 3, Tallinn, Estonia",street_number:"3",route:"Mustam\xE4e tee",sublocality:"Kristiine",locality:"Tallinn",admin_area_level_1:"Harju maakond",admin_area_level_2:null,country:"Estonia",postal_code:"10616",formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia"},org_id:5,person_id:1101,deal_id:300,lead_id:"46c3b0e1-db35-59ca-1828-4817378dff71",is_deleted:!1,update_time:"2020-08-08T12:37:56Z",note:"A note for the activity",creator_user_id:1234,attendees:[{email_address:"attendee@pipedrivemail.com",is_organizer:0,name:"Attendee",person_id:25312,status:"noreply",user_id:null}],participants:[{person_id:17985,primary:!1},{person_id:1101,primary:!0}]}});var Be=["next_activity_id","last_activity_id","open_deals_count","related_open_deals_count","closed_deals_count","related_closed_deals_count","participant_open_deals_count","participant_closed_deals_count","email_messages_count","activities_count","done_activities_count","undone_activities_count","files_count","notes_count","followers_count","related_won_deals_count","lost_deals_count","related_lost_deals_count","last_incoming_mail_time","last_outgoing_mail_time","won_deals_count"],Se=["next_activity_id","last_activity_id","first_won_time","products_count","files_count","notes_count","followers_count","email_messages_count","activities_count","done_activities_count","undone_activities_count","participants_count","last_incoming_mail_time","last_outgoing_mail_time","smart_bcc_email"],Ze=["next_activity_id","last_activity_id","open_deals_count","related_open_deals_count","closed_deals_count","related_closed_deals_count","email_messages_count","people_count","activities_count","done_activities_count","undone_activities_count","files_count","notes_count","followers_count","won_deals_count","related_won_deals_count","lost_deals_count","related_lost_deals_count"];var tl=oe({auth:E,name:"new_deal",outputSchema:Vc,classification:"READ",displayName:"New Deal",description:"Triggers when a new deal is created.",aiMetadata:{description:"Fires the moment a new deal record is created in Pipedrive, representing a sales opportunity (with its title, value, currency, owner, associated person/organization, pipeline and stage). Use to start automations whenever a deal enters the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("deal","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_deal_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_deal_trigger");t!=null&&await ue.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{limit:5,sort_by:"update_time",sort_direction:"desc",include_fields:Se.join(",")}}),r=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});if(A(t.data))return[];let n=[];for(let o of t.data){let a=R(r,o);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/deals/${t.data.id}`,query:{include_fields:Se.join(",")}}),n=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return[R(n,r.data)]},sampleData:{id:1,creator_user_id:8877,owner_id:8877,person_id:1101,org_id:5,stage_id:2,title:"Deal One",value:5e3,currency:"EUR",add_time:"2019-05-29T04:21:51Z",update_time:"2019-11-28T16:19:50Z",stage_change_time:"2019-11-28T15:41:22Z",is_deleted:!1,status:"open",probability:null,next_activity_id:128,last_activity_id:null,lost_reason:null,visible_to:1,close_time:null,pipeline_id:1,won_time:"2019-11-27T11:40:36Z",first_won_time:"2019-11-27T11:40:36Z",lost_time:null,products_count:0,files_count:0,notes_count:2,followers_count:0,email_messages_count:4,activities_count:1,done_activities_count:0,undone_activities_count:1,participants_count:1,expected_close_date:"2019-06-29",last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[11],rotten_time:null,smart_bcc_email:"company+deal1@pipedrivemail.com",custom_fields:{d4de1c1518b4531717c676029a45911c340390a6:{value:2300,currency:"EUR"}}}});var rl=oe({auth:E,name:"new_person",outputSchema:Fc,classification:"READ",displayName:"New Person",description:"Triggers when a new person is created",aiMetadata:{description:"Fires the moment a new person (contact) record is created in Pipedrive, with their name, emails, phones, owner, associated organization, labels, and custom fields. Use to start automations whenever a contact is added to the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("person","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_person_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_person_trigger");t!=null&&await ue.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{limit:5,sort_by:"update_time",sort_direction:"desc",include_fields:Be.join(",")}}),r=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});if(A(t.data))return[];let n=[];for(let o of t.data){let a=R(r,o);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/persons/${t.data.id}`,query:{include_fields:Be.join(",")}}),n=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});return[R(n,r.data)]},sampleData:{id:1,owner_id:123,org_id:1234,name:"Will Smith",first_name:"Will",last_name:"Smith",is_deleted:!1,phones:[{value:"12345",primary:!0,label:"work"}],emails:[{value:"will.smith@example.com",primary:!0,label:"work"}],add_time:"2017-10-18T13:23:07Z",update_time:"2020-05-08T05:30:20Z",visible_to:3,picture_id:4,next_activity_id:128,last_activity_id:34,last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[1],marketing_status:"no_consent"}});var ol=oe({auth:E,name:"updated_deal",outputSchema:Bc,classification:"READ",displayName:"Updated Deal",description:"Triggers when a deal is updated.",aiMetadata:{description:"Fires when any field of an existing deal changes in Pipedrive, such as its value, status, owner, stage, or custom fields. Can optionally be scoped to changes on a specific deal, pipeline, or stage. Use to react to edits on sales opportunities in the CRM."},props:{filter_by:y.StaticDropdown({displayName:"Filter by",required:!1,options:{disabled:!1,options:[{label:"Deal Status",value:"status"},{label:"Stage in Pipeline",value:"stage_id"}]}}),filter_by_field_value:y.DynamicProperties({auth:E,displayName:"Field Values",required:!1,refreshers:["filter_by"],props:i(async({auth:e,filter_by:t})=>{if(!e||!t)return{};let r={},n=e,o=t;if(o==="status"&&(r.field_value=y.StaticDropdown({displayName:"Deal Status",required:!0,options:{disabled:!1,options:[{label:"Open",value:"open"},{label:"Won",value:"won"},{label:"Lost",value:"lost"},{label:"Deleted",value:"deleted"}]}})),o==="stage_id"){let a=await ze.sendRequest({method:"GET",url:`${n.data.api_domain}/api/v2/stages`,authentication:{type:"BEARER_TOKEN",token:n.access_token}});r.field_value=y.StaticDropdown({displayName:"Stage in Pipeline",required:!0,options:{disabled:!1,options:a.body.data.map(u=>({label:u.name,value:u.id}))}})}return r},"props")}),field_to_watch:y.Dropdown({auth:E,displayName:"Field to watch for Changes On",required:!1,refreshers:[],options:i(async({auth:e})=>{if(!e)return{placeholder:"Connect your account",disabled:!0,options:[]};let t=e,r=await ze.sendRequest({method:"GET",url:`${t.data.api_domain}/api/v1/dealFields`,authentication:{type:"BEARER_TOKEN",token:t.access_token}}),n=[];for(let o of r.body.data)n.push({label:o.name,value:o.key});return{disabled:!1,options:n}},"options")})},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("deal","change",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_updated_deal_trigger",t.data.id)},async onDisable(e){let t=await e.store.get("_updated_deal_trigger");t&&await ue.unsubscribeWebhook(t,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=e.propsValue.filter_by,r=e.propsValue.filter_by_field_value.field_value,n={limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:Se.join(",")};t&&r&&(n[t]=r);let o=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:n});if(A(o.data))return[];let a=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),u=[];for(let c of o.data){let d=R(a,c);u.push(d)}return u},async run(e){let t=e.propsValue.filter_by,r=e.propsValue.filter_by_field_value.field_value,n=e.propsValue.field_to_watch==="label"?"label_ids":e.propsValue.field_to_watch,o=e.payload.body,a=nl(o.data),u=nl(o.previous),c=!t&&!n,d=n&&n in u&&a[n]!==u[n],g=t&&a[t]===r;if(c||!t&&d||g&&(!n||d)){let _=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/deals/${o.data.id}`,query:{include_fields:Se.join(",")}}),I=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return[R(I,_.data)]}return[]},sampleData:{id:1,creator_user_id:8877,owner_id:8877,person_id:1101,org_id:5,stage_id:2,title:"Deal One",value:5e3,currency:"EUR",add_time:"2019-05-29T04:21:51Z",update_time:"2019-11-28T16:19:50Z",stage_change_time:"2019-11-28T15:41:22Z",is_deleted:!1,status:"open",probability:null,next_activity_id:128,last_activity_id:null,lost_reason:null,visible_to:1,close_time:null,pipeline_id:1,won_time:"2019-11-27T11:40:36Z",first_won_time:"2019-11-27T11:40:36Z",lost_time:null,products_count:0,files_count:0,notes_count:2,followers_count:0,email_messages_count:4,activities_count:1,done_activities_count:0,undone_activities_count:1,participants_count:1,expected_close_date:"2019-06-29",last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[11],rotten_time:null,smart_bcc_email:"company+deal1@pipedrivemail.com"}});function nl(e){let{custom_fields:t,...r}=e;if(!t)return r;let n={};for(let[o,a]of Object.entries(t)){if(A(a)){n[o]=a;continue}switch(a.type){case"varchar":case"text":case"varchar_auto":case"double":case"phone":case"date":n[o]=a?.value;break;case"set":n[o]=a?.values?.length?a.values.map(c=>c.id).join(","):"";break;case"enum":case"user":case"org":case"people":n[o]=a?.id;break;case"monetary":n[o]=a?.value,n[`${o}_currency`]=a?.currency;break;case"time":n[o]=a?.value,n[`${o}_timezone_id`]=a?.timezone_id;break;case"timerange":n[o]=a?.from,n[`${o}_timezone_id`]=a?.timezone_id,n[`${o}_until`]=a?.until;break;case"daterange":n[o]=a?.from,n[`${o}_until`]=a?.until;break;case"address":n[o]=a?.value,n[`${o}_subpremise`]=a?.subpremise,n[`${o}_street_number`]=a?.street_number,n[`${o}_route`]=a?.route,n[`${o}_sublocality`]=a?.sublocality,n[`${o}_locality`]=a?.locality,n[`${o}_admin_area_level_1`]=a?.admin_area_level_1,n[`${o}_admin_area_level_2`]=a?.admin_area_level_2,n[`${o}_country`]=a?.country,n[`${o}_postal_code`]=a?.postal_code,n[`${o}_formatted_address`]=a?.formatted_address;break}}return{...r,...n}}i(nl,"flattenCustomFields");var il=oe({auth:E,name:"updated_person",outputSchema:jc,classification:"READ",displayName:"Updated Person",description:"Triggers when a person is updated.",aiMetadata:{description:"Fires when any field of an existing person (contact) record changes in Pipedrive, such as their name, emails, phones, owner, associated organization, labels, or custom fields. Use to react to edits on contact records in the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("person","change",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_updated_person_trigger",t.data.id)},async onDisable(e){let t=await e.store.get("_updated_person_trigger");t!=null&&await ue.unsubscribeWebhook(t,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{limit:5,sort_by:"update_time",sort_direction:"desc",include_fields:Be.join(",")}}),r=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});if(A(t.data))return[];let n=[];for(let o of t.data){let a=R(r,o);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/persons/${t.data.id}`,query:{include_fields:Be.join(",")}}),n=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});return[R(n,r.data)]},sampleData:{id:1,owner_id:123,org_id:1234,name:"Will Smith",first_name:"Will",last_name:"Smith",is_deleted:!1,phones:[{value:"12345",primary:!0,label:"work"}],emails:[{value:"will.smith@example.com",primary:!0,label:"work"}],add_time:"2017-10-18T13:23:07Z",update_time:"2020-05-08T05:30:20Z",visible_to:3,picture_id:4,next_activity_id:128,last_activity_id:34,last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[1],marketing_status:"no_consent"}});var al=oe({auth:E,name:"new-lead",outputSchema:Kc,classification:"READ",displayName:"New Lead",description:"Triggers when a new lead is created.",aiMetadata:{description:"Fires when a new lead is created in Pipedrive. A lead is an early, unqualified sales opportunity (with a title, optional value, source, and links to a person or organization) that has not yet been converted into a deal. Use to act on inbound prospects as they enter the leads inbox."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ze.sendRequest({method:"POST",url:`${e.auth.data.api_domain}/api/v1/webhooks`,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token},body:{event_object:"lead",event_action:"create",subscription_url:e.webhookUrl,version:"2.0"}});await e.store?.put("_new_lead_trigger",{webhookId:t.body.data.id})},async onDisable(e){let t=await e.store?.get("_new_lead_trigger");t!==null&&!A(t.webhookId)&&await ze.sendRequest({method:"DELETE",url:`${e.auth.data.api_domain}/api/v1/webhooks/${t.webhookId}`,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token}})},async test(e){let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/leads",query:{limit:10,sort:"update_time DESC"}});if(A(t.data))return[];let r=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),n=[];for(let o of t.data){let a=Tt(r,o);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v1/leads/${t.data.id}`}),n=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return[Tt(n,r.data)]},sampleData:{id:"f3c23480-c9b1-11ef-bc83-2b8218e028ef",title:"Test lead",owner_id:22701301,creator_id:22701301,label_ids:["a0e5f330-d2a7-4181-a6e3-a44d634b7bf7","8a0e6918-1eee-4e56-a615-c81d712a6a77"],value:null,expected_close_date:null,person_id:2,organization_id:1,is_archived:!1,source_name:"Manually created",origin:"ManuallyCreated",origin_id:null,channel:1,channel_id:null,was_seen:!0,next_activity_id:null,add_time:"2025-01-03T09:06:00.776Z",update_time:"2025-01-03T09:06:00.776Z",visible_to:3}});var sl=oe({auth:E,name:"new-organization",outputSchema:Gc,classification:"READ",displayName:"New Organization",description:"Triggers when a new organization is created.",aiMetadata:{description:"Fires the moment a new organization (company) record is created in Pipedrive, with its name, owner, address, labels, and custom fields. Use to start automations whenever a company is added to the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("organization","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_organization_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_organization_trigger");t!=null&&await ue.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:Ze.join(",")}});if(A(t.data))return[];let r=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),n=[];for(let o of t.data){let a=R(r,o);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/organizations/${t.data.id}`,query:{include_fields:Ze.join(",")}}),n=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"});return[R(n,r.data)]},sampleData:{id:1,owner_id:22701301,name:"Pipedrive Sample Org",add_time:"2024-12-04T03:49:06Z",update_time:"2024-12-14T11:03:19Z",is_deleted:!1,visible_to:3,picture_id:null,label_ids:[],address:{value:"Mustam\xE4e tee 3, Tallinn, Estonia",street_number:"3",route:"Mustam\xE4e tee",sublocality:"Kristiine",locality:"Tallinn",admin_area_level_1:"Harju maakond",admin_area_level_2:null,country:"Estonia",postal_code:"10616",formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia"}}});var ul=oe({auth:E,name:"updated-organization",outputSchema:Hc,classification:"READ",displayName:"Updated Organization",description:"Triggers when an existing organization is updated.",aiMetadata:{description:"Fires when any field of an existing organization (company) record changes in Pipedrive, such as its name, owner, address, labels, or custom fields. Use to react to edits on company records in the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("organization","change",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_updated_organization_trigger",t.data.id)},async onDisable(e){let t=await e.store.get("_updated_organization_trigger");t!=null&&await ue.unsubscribeWebhook(t,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:Ze.join(",")}});if(A(t.data))return[];let r=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),n=[];for(let o of t.data){let a=R(r,o);n.push(a)}return n},async run(e){let t=e.payload.body,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/organizations/${t.data.id}`,query:{include_fields:Ze.join(",")}}),n=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"});return[R(n,r.data)]},sampleData:{id:1,owner_id:22701301,name:"Pipedrive Sample Org",add_time:"2024-12-04T03:49:06Z",update_time:"2024-12-14T11:03:19Z",is_deleted:!1,visible_to:3,picture_id:null,label_ids:[],address:{value:"Mustam\xE4e tee 3, Tallinn, Estonia",street_number:"3",route:"Mustam\xE4e tee",sublocality:"Kristiine",locality:"Tallinn",admin_area_level_1:"Harju maakond",admin_area_level_2:null,country:"Estonia",postal_code:"10616",formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia"}}});var cl=oe({auth:E,name:"updated-deal-stage",outputSchema:Zc,classification:"READ",displayName:"Updated Deal Stage",description:"Triggers when a deal's stage is updated.",aiMetadata:{description:"Fires when an existing deal moves from one pipeline stage to another (its stage_id changes). Represents progress of a deal through the sales pipeline; can optionally be limited to a specific stage. Use to react when deals advance, regress, or reach a particular stage."},type:"WEBHOOK",props:{stage_id:y.Dropdown({auth:E,displayName:"Stage in Pipeline",required:!1,refreshers:[],options:i(async({auth:e})=>{if(!e)return{placeholder:"please connect your account.",disabled:!0,options:[]};let t=e,r=await ge({accessToken:t.access_token,apiDomain:t.data.api_domain,method:"GET",resourceUri:"/v2/stages"}),n=[];for(let o of r)n.push({label:`${o.name}`,value:o.id});return{disabled:!1,options:n}},"options")})},async onEnable(e){let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/webhooks",body:{subscription_url:e.webhookUrl,event_object:"deal",event_action:"change",version:"2.0"}});await e.store.put("updated-deal-stage-trigger",t.data.id)},async onDisable(e){let t=await e.store.get("updated-deal-stage-trigger");t&&await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/webhooks/${t}`})},async test(e){let t=e.propsValue.stage_id,r={limit:10,sort_by:"update_time",sort_direction:"desc",include_fields:Se.join(",")};t&&(r.stage_id=t.toString());let n=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:r});if(A(n.data))return[];let o=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),a=[];for(let u of n.data){let c=R(o,u),d=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/stages/${c.stage_id}`});c.stage=d.data,a.push(c)}return a},async run(e){let t=e.propsValue.stage_id,r=e.payload.body,n=r.data,o=r.previous;if(!o||A(o.stage_id))return[];if(n.stage_id!==o.stage_id){if(t&&n.stage_id!==t)return[];let a=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/deals/${r.data.id}`,query:{include_fields:Se.join(",")}}),u=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),c=R(u,a.data),d=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/stages/${n.stage_id}`});return c.stage=d.data,[c]}return[]},sampleData:{id:1,creator_user_id:8877,owner_id:8877,person_id:1101,org_id:5,stage_id:2,title:"Deal One",value:5e3,currency:"EUR",add_time:"2019-05-29T04:21:51Z",update_time:"2019-11-28T16:19:50Z",stage_change_time:"2019-11-28T15:41:22Z",is_deleted:!1,status:"open",probability:null,next_activity_id:128,last_activity_id:null,lost_reason:null,visible_to:1,close_time:null,pipeline_id:1,won_time:"2019-11-27T11:40:36Z",first_won_time:"2019-11-27T11:40:36Z",lost_time:null,products_count:0,files_count:0,notes_count:2,followers_count:0,email_messages_count:4,activities_count:1,done_activities_count:0,undone_activities_count:1,participants_count:1,expected_close_date:"2019-06-29",last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[11],rotten_time:null,smart_bcc_email:"company+deal1@pipedrivemail.com",stage:{id:2,order_nr:1,name:"Qualification",is_deleted:!1,deal_probability:!1,pipeline_id:1,is_deal_rot_enabled:!1,days_to_rotten:null,add_time:"2018-09-04T06:24:59Z",update_time:null}}});async function Hg(e,t){let r=await x({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v1/filters",query:{type:t}}),n=[];for(let o of r.data)n.push({label:o.name,value:o.id});return n}i(Hg,"fetchFiltersOptions");async function qg(e){let t=await x({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v1/activityTypes"}),r=[];for(let n of t.data)r.push({label:n.name,value:n.key_string});return r}i(qg,"fetchActivityTypesOptions");async function Wg(e){let t=await ge({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v2/pipelines"}),r=[];for(let n of t)r.push({label:n.name,value:n.id});return r}i(Wg,"fetchPipelinesOptions");async function Kg(e){let t=await x({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:"/v1/users:(id,email)"}),r=[];for(let n of t.data)r.push({label:n.email,value:n.id});return r}i(Kg,"fetchOwnersOptions");function ll(e){switch(e.field_type){case"varchar":case"varchar_auto":case"phone":return y.ShortText({displayName:e.name,required:!1});case"text":case"address":return y.LongText({displayName:e.name,required:!1});case"enum":return y.StaticDropdown({displayName:e.name,required:!1,options:{disabled:!1,options:e.options?e.options.map(t=>({label:t.label,value:t.id})):[]}});case"set":return y.StaticMultiSelectDropdown({displayName:e.name,required:!1,options:{disabled:!1,options:e.options?e.options.map(t=>({label:t.label,value:t.id})):[]}});case"double":case"monetary":return y.Number({displayName:e.name,required:!1});case"time":case"timerange":return y.ShortText({displayName:e.name,description:"Please enter time in HH:mm:ss format.",required:!1});case"int":return y.Number({displayName:e.name,required:!1});case"date":case"daterange":return y.DateTime({displayName:e.name,description:"Please enter date in YYYY-MM-DD format.",required:!1});default:return null}}i(ll,"createPropertyDefinition");async function Jg(e,t){let r="";switch(t){case"person":r="/v1/personFields";break;case"deal":case"lead":r="/v1/dealFields";break;case"organization":r="/v1/organizationFields";break;case"product":r="/v1/productFields";break}let n=await k({accessToken:e.access_token,apiDomain:e.data.api_domain,method:"GET",resourceUri:r}),o={};for(let a of n){if(!a.edit_flag)continue;let u=ll(a);u&&(o[a.key]=u)}return o}i(Jg,"retrieveObjectCustomProperties");var jt=i(e=>y.Dropdown({auth:E,displayName:"Field to search by",required:!0,refreshers:[],options:i(async({auth:t})=>{if(!t)return{disabled:!0,options:[],placeholder:"Please connect your account."};let r=t,n="";switch(e){case"person":n="/v1/personFields";break;case"deal":case"lead":n="/v1/dealFields";break;case"organization":n="/v1/organizationFields";break;case"product":n="/v1/productFields";break}let o=await k({accessToken:r.access_token,apiDomain:r.data.api_domain,method:"GET",resourceUri:n}),a=[];for(let u of o)A(u.id)||a.push({label:u.name,value:u.id.toString()});return{disabled:!1,options:a}},"options")}),"searchFieldProp"),Vt=i(e=>y.DynamicProperties({auth:E,displayName:"Field Value",required:!0,refreshers:["searchField"],props:i(async({auth:t,searchField:r})=>{if(!t||!r)return{};let n=t,o={},a="";switch(e){case"person":a="/v1/personFields";break;case"deal":case"lead":a="/v1/dealFields";break;case"organization":a="/v1/organizationFields";break;case"product":a="/v1/productFields";break}let u=await x({accessToken:n.access_token,apiDomain:n.data.api_domain,method:"GET",resourceUri:`${a}/${r}`}),c=u.data.field_type==="set"?y.StaticDropdown({displayName:u.data.name,required:!1,options:{disabled:!1,options:u.data.options?u.data.options.map(d=>({label:d.label,value:d.id.toString()})):[]}}):ll(u.data);return c?o.field_value=c:o.field_value=y.ShortText({displayName:u.data.name,required:!1}),o},"props")}),"searchFieldValueProp"),Ce=i((e,t=!1)=>y.Dropdown({auth:E,displayName:e,refreshers:[],required:t,options:i(async({auth:r})=>r?{disabled:!1,options:await Kg(r)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"ownerIdProp"),qe=i((e,t=!1)=>y.Dropdown({auth:E,displayName:"Filter",refreshers:[],required:t,options:i(async({auth:r})=>r?{disabled:!1,options:await Hg(r,e)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"filterIdProp"),We=i((e=!1)=>y.Number({displayName:"Organization ID",description:"You can use Find Organization action to retrieve org ID.",required:e}),"organizationIdProp"),Xg=i((e=!1)=>y.Dropdown({auth:E,displayName:"Pipeline",refreshers:[],required:e,options:i(async({auth:t})=>t?{disabled:!1,options:await Wg(t)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"dealPipelineIdProp"),Yg=i((e=!1)=>y.Dropdown({auth:E,displayName:"Stage",description:"If a stage is chosen above, the pipeline field will be ignored.",required:e,refreshers:[],options:i(async({auth:t})=>{if(!t)return{placeholder:"Please connect your account.",disabled:!0,options:[]};let r=t,n=await ge({accessToken:r.access_token,apiDomain:r.data.api_domain,method:"GET",resourceUri:"/v2/stages"}),o=[];for(let a of n)o.push({label:`${a.name}`,value:a.id});return{disabled:!1,options:o}},"options")}),"dealStageIdProp"),Ue=i((e=!1)=>y.Number({displayName:"Person ID",description:"You can use Find Person action to retrieve person ID.",required:e}),"personIdProp"),fr=i((e,t,r=!1)=>y.MultiSelectDropdown({auth:E,displayName:"Label",required:r,refreshers:[],options:i(async({auth:n})=>{if(!n)return{disabled:!0,options:[],placeholder:"Please connect your account."};let o=n,a="";switch(e){case"person":a="/v1/personFields";break;case"deal":a="/v1/dealFields";break;case"organization":a="/v1/organizationFields";break}let c=(await k({accessToken:o.access_token,apiDomain:o.data.api_domain,method:"GET",resourceUri:a})).find(g=>g.key===t),d=[];if(c&&c.options)for(let g of c.options)d.push({label:g.label,value:g.id});return{disabled:!1,options:d}},"options")}),"labelIdsProp"),Qg=i((e=!1)=>y.MultiSelectDropdown({auth:E,displayName:"Label",required:e,refreshers:[],options:i(async({auth:t})=>{if(!t)return{disabled:!0,options:[],placeholder:"Please connect your account."};let r=t,n=await x({accessToken:r.access_token,apiDomain:r.data.api_domain,method:"GET",resourceUri:"/v1/leadLabels"}),o=[];for(let a of n.data)o.push({label:`${a.name} (${a.color})`,value:a.id});return{disabled:!1,options:o}},"options")}),"leadLabelIdsProp"),nn=i((e=!1)=>y.Number({displayName:"Product ID",description:"You can use Find Product action to retrieve product ID.",required:e}),"productIdProp"),ft=y.StaticDropdown({displayName:"Visible To",required:!1,options:{disabled:!1,options:[{label:"Owner & followers",value:1},{label:"Entire company",value:3}]}}),gr=i((e=!1)=>y.ShortText({displayName:"Lead ID",required:e}),"leadIdProp"),So=i((e=!1)=>y.Dropdown({auth:E,displayName:"Activity Type",refreshers:[],required:e,options:i(async({auth:t})=>t?{disabled:!1,options:await qg(t)}:{disabled:!0,options:[],placeholder:"Please connect your account."},"options")}),"activityTypeIdProp"),tt=i((e=!1)=>y.Number({displayName:"Deal ID",description:"You can use Find Deal action to retrieve deal ID.",required:e}),"dealIdProp"),on={creationTime:y.DateTime({displayName:"Creation Time",required:!1}),status:y.StaticDropdown({displayName:"Status",required:!1,options:{disabled:!1,options:[{label:"Open",value:"open"},{label:"Won",value:"won"},{label:"Lost",value:"lost"},{label:"Deleted",value:"deleted"}]}}),stageId:Yg(!1),pipelineId:Xg(!1),ownerId:Ce("Owner",!1),organizationId:We(!1),personId:Ue(!1),labelIds:fr("deal","label",!1),probability:y.Number({displayName:"Probability",required:!1}),expectedCloseDate:y.DateTime({displayName:"Expected Close Date",required:!1,description:"Please enter date in YYYY-MM-DD format."}),dealValue:y.Number({displayName:"Value",required:!1}),dealValueCurrency:y.ShortText({displayName:"Currency",required:!1,description:'Please enter currency code (e.g., "USD", "EUR").'}),visibleTo:ft,customfields:gt("deal")},an={ownerId:Ce("Owner",!1),organizationId:We(!1),personId:Ue(!1),labelIds:Qg(!1),expectedCloseDate:y.DateTime({displayName:"Expected Close Date",required:!1,description:"Please enter date in YYYY-MM-DD format."}),visibleTo:ft,channel:y.Dropdown({auth:E,displayName:"Channel",required:!1,refreshers:[],options:i(async({auth:e})=>{if(!e)return{disabled:!0,options:[],placeholder:"Please connect your account."};let t=e,n=(await k({accessToken:t.access_token,apiDomain:t.data.api_domain,method:"GET",resourceUri:"/v1/dealFields:(key,name,options)"})).find(a=>a.key==="channel"),o=[];if(n)for(let a of n.options??[])o.push({label:a.label,value:a.id});return{disabled:!1,options:o}},"options")}),leadValue:y.Number({displayName:"Lead Value Amount",required:!1}),leadValueCurrency:y.ShortText({displayName:"Lead Value Currency",required:!1,description:'The currency of the lead value (e.g., "USD", "EUR").'}),customfields:gt("lead")},sn={ownerId:Ce("Owner",!1),visibleTo:ft,labelIds:fr("organization","label_ids",!1),address:y.LongText({displayName:"Address",required:!1}),customfields:gt("organization")},un={ownerId:Ce("Owner",!1),organizationId:We(!1),email:y.Array({displayName:"Email",required:!1}),phone:y.Array({displayName:"Phone",required:!1}),labelIds:fr("person","label_ids",!1),firstName:y.ShortText({displayName:"First Name",required:!1}),lastName:y.ShortText({displayName:"Last Name",required:!1}),visibleTo:ft,marketing_status:y.StaticDropdown({displayName:"Marketing Status",description:"Marketing opt-in status",required:!1,options:{disabled:!1,options:[{label:"No Consent",value:"no_consent"},{label:"Unsubscribed",value:"unsubscribed"},{label:"Subscribed",value:"subscribed"},{label:"Archived",value:"archived"}]}}),customfields:gt("person")},cn={organizationId:We(!1),personId:Ue(!1),dealId:tt(!1),leadId:gr(!1),assignTo:Ce("Assign To",!1),type:So(!1),dueDate:y.DateTime({displayName:"Due Date",required:!1,description:"Please enter date in YYYY-MM-DD format."}),dueTime:y.ShortText({displayName:"Due Time",required:!1,description:"Please enter time in HH:MM format."}),duration:y.ShortText({displayName:"Duration",required:!1,description:'Please enter time in HH:MM format (e.g., "01:30" for 1 hour 30 minutes).'}),isDone:y.Checkbox({displayName:"Mark as Done?",required:!1,defaultValue:!1}),busy:y.StaticDropdown({displayName:"Free or Busy",required:!1,options:{disabled:!1,options:[{label:"Free",value:"free"},{label:"Busy",value:"busy"}]}}),note:y.LongText({displayName:"Note",required:!1}),publicDescription:y.LongText({displayName:"Public Description",required:!1})};function gt(e){return y.DynamicProperties({auth:E,displayName:"Custom Fields",required:!1,refreshers:[],props:i(async({auth:t})=>t?await Jg(t,e):{},"props")})}i(gt,"customFieldsProp");var dl=D({auth:E,name:"create-person",outputSchema:dc,classification:"WRITE",displayName:"Create Person",description:"Creates a new person.",audience:"both",aiMetadata:{description:"Creates a new person (contact) with a name, optional emails/phones, owner, organization, and custom fields. Provide either a single Name or First/Last Name, not both. Use to add a contact (use Update Person to edit an existing one, or Find Person to check for one first). Not idempotent: each call creates a separate person, so guard against duplicates.",idempotent:!1},props:{name:y.ShortText({displayName:"Name",required:!1}),...un},async run(e){let{name:t,ownerId:r,organizationId:n,marketing_status:o,visibleTo:a,firstName:u,lastName:c}=e.propsValue,d=e.propsValue.phone??[],g=e.propsValue.email??[],_=e.propsValue.labelIds??[],I=e.propsValue.customfields??{};if(t&&(u||c))throw new Error("Provide either Name OR First Name/Last Name, not both.");if(!t&&!u&&!c)throw new Error("Provide Name or at least one of First Name / Last Name.");if(!t&&(u&&!c||!u&&c))throw new Error("If First Name is provided, Last Name must be provided as well.");let b=d.map((z,ne)=>({value:z,label:"work",primary:ne===0})),l=g.map((z,ne)=>({value:z,label:"work",primary:ne===0})),m={name:t,owner_id:r,org_id:n,visible_to:a,first_name:u,last_name:c,marketing_status:o};b.length&&(m.phones=b),l.length&&(m.emails=l),_.length&&(m.label_ids=_);let h=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),p=Ae(h,I);ce(p)||(m.custom_fields=p);let P=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/persons",body:m}),T=R(h,P.data);return{...P,data:T}}});var pl=D({auth:E,name:"update-person",outputSchema:pc,classification:"WRITE",displayName:"Update Person",description:"Updates an existing person.",audience:"both",aiMetadata:{description:"Updates fields on an existing person identified by their person ID, such as name, emails, phones, owner, organization, and custom fields; only supplied fields change. Use to edit a contact you have the ID for (use Create Person to add one, or Find Person to locate it). Idempotent: repeating the same update converges to the same person state.",idempotent:!0},props:{personId:Ue(!0),name:y.ShortText({displayName:"Name",required:!1}),...un},async run(e){let{name:t,ownerId:r,personId:n,organizationId:o,marketing_status:a,visibleTo:u,firstName:c,lastName:d}=e.propsValue,g=e.propsValue.phone??[],_=e.propsValue.email??[],I=e.propsValue.labelIds??[],b=e.propsValue.customfields??{};if(c&&!d||!c&&d)throw new Error("If First Name is provided, Last Name must be provided as well.");let l=g.map((ne,ve)=>({value:ne,label:"work",primary:ve===0})),m=_.map((ne,ve)=>({value:ne,label:"work",primary:ve===0})),h={name:t,owner_id:r,org_id:o,marketing_status:a,visible_to:u,first_name:c,last_name:d};l.length&&(h.phones=l),m.length&&(h.emails=m),I.length&&(h.label_ids=I);let p=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),P=Ae(p,b);ce(P)||(h.custom_fields=P);let T=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/persons/${n}`,body:h}),z=R(p,T.data);return{...T,data:z}}});var ml=D({auth:E,name:"create-organization",outputSchema:yc,classification:"WRITE",displayName:"Create Organization",description:"Creates a new organization.",audience:"both",aiMetadata:{description:"Creates a new organization (company) with a required name and optional owner, address, visibility, labels, and custom fields. Use to add a company record (use Update Organization to edit one, or Find Organization to check for an existing match). Not idempotent: each call creates a separate organization, so guard against duplicates.",idempotent:!1},props:{name:y.ShortText({displayName:"Name",required:!0}),...sn},async run(e){let{name:t,ownerId:r,address:n,visibleTo:o}=e.propsValue,a=e.propsValue.labelIds??[],u=e.propsValue.customfields??{},c={name:t,owner_id:r,visible_to:o};n&&typeof n=="string"&&(c.address={value:n}),a.length>0&&(c.label_ids=a);let d=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),g=Ae(d,u);ce(g)||(c.custom_fields=g);let _=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/organizations",body:c}),I=R(d,_.data);return{..._,data:I}}});var fl=D({auth:E,name:"update-organization",outputSchema:hc,classification:"WRITE",displayName:"Update Organization",description:"Updates an existing organization.",audience:"both",aiMetadata:{description:"Update fields on an existing organization identified by ID (name, owner, address, visibility, labels, and custom fields). Pick this to modify a known organization; only supplied fields are changed. Re-running with the same inputs yields the same final state.",idempotent:!0},props:{organizationId:We(!0),name:y.ShortText({displayName:"Name",required:!1}),...sn},async run(e){let{name:t,ownerId:r,address:n,visibleTo:o,organizationId:a}=e.propsValue,u=e.propsValue.labelIds??[],c=e.propsValue.customfields??{},d={name:t,owner_id:r,visible_to:o};n&&typeof n=="string"&&(d.address={value:n}),u.length>0&&(d.label_ids=u);let g=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),_=Ae(g,c);ce(_)||(d.custom_fields=_);let I=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/organizations/${a}`,body:d}),b=R(g,I.data);return{...I,data:b}}});var gl=we(mt());var yl=D({auth:E,name:"create-lead",outputSchema:Ec,classification:"WRITE",displayName:"Create Lead",description:"Creates a new lead.",audience:"both",aiMetadata:{description:"Creates a new lead with a required title and optional value, owner, channel, and custom fields. At least one of a linked person or organization must be supplied. Use to capture an unqualified opportunity (use Create Deal once it advances to your pipeline, or Update Lead to edit one). Not idempotent: each call creates a separate lead.",idempotent:!1},props:{title:y.ShortText({displayName:"Title",required:!0}),...an},async run(e){let{title:t,leadValue:r,leadValueCurrency:n,expectedCloseDate:o,visibleTo:a,ownerId:u,organizationId:c,personId:d,channel:g}=e.propsValue;if(!d&&!c)throw new Error("Neither an Organization nor a Person were provided. One of them must be provided in order to create a lead.");let _=e.propsValue.labelIds??[],I=e.propsValue.customfields??{},b={title:t,owner_id:u,organization_id:c,person_id:d,channel:g,visible_to:a};if(_.length>0&&(b.label_ids=_),o&&(b.expected_close_date=(0,gl.default)(o).format("YYYY-MM-DD")),r){if(!n)throw new Error("lead Value Currency is required when lead Value is provided");b.value={amount:r,currency:n}}let l={};Object.entries(I).forEach(([P,T])=>{l[P]=Array.isArray(T)?T.join(","):T});let m=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/leads",body:{...b,...l}}),h=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),p=Tt(h,m.data);return{...m,data:p}}});var hl=we(mt());var _l=D({auth:E,name:"update-lead",outputSchema:Ac,classification:"WRITE",displayName:"Update Lead",description:"Updates an existing lead.",audience:"both",aiMetadata:{description:"Updates fields on an existing lead identified by its lead ID, such as title, owner, value, channel, or linked person/organization; only supplied fields change. Use to modify a lead you have the ID for (use Create Lead to add one, or Find Lead to locate it). Idempotent: repeating the same update converges to the same lead state.",idempotent:!0},props:{leadId:gr(!0),title:y.ShortText({displayName:"Title",required:!1}),...an},async run(e){let{title:t,ownerId:r,leadId:n,channel:o,organizationId:a,personId:u,expectedCloseDate:c,visibleTo:d,leadValue:g,leadValueCurrency:_}=e.propsValue,I=e.propsValue.labelIds??[],b=e.propsValue.customfields??{},l={title:t,owner_id:r,organization_id:a,person_id:u,channel:o,visible_to:d};if(I.length>0&&(l.label_ids=I),c&&(l.expected_close_date=(0,hl.default)(c).format("YYYY-MM-DD")),g){if(!_)throw new Error("lead Value Currency is required when lead Value is provided");l.value={amount:g,currency:_}}let m={};Object.entries(b).forEach(([T,z])=>{m[T]=Array.isArray(z)&&z.length>0?z.join(","):z});let h=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v1/leads/${n}`,body:{...l,...m}}),p=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),P=Tt(p,h.data);return{...h,data:P}}});var ko=we(mt());var vl=D({auth:E,name:"create-deal",outputSchema:fc,classification:"WRITE",displayName:"Create Deal",description:"Creates a new deal.",audience:"both",aiMetadata:{description:"Creates a new deal with a required title and optional value, currency, pipeline/stage, status, owner, and linked person/organization. Use to add a sales opportunity to a pipeline (use Update Deal to edit one, or Add Product to Deal to attach line items). Not idempotent: each call creates a separate deal, so guard against duplicates.",idempotent:!1},props:{title:y.ShortText({displayName:"Title",required:!0}),...on},async run(e){let{title:t,dealValue:r,dealValueCurrency:n,expectedCloseDate:o,visibleTo:a,probability:u,stageId:c,status:d,pipelineId:g,ownerId:_,organizationId:I,personId:b,creationTime:l}=e.propsValue,m=e.propsValue.labelIds??[],h=e.propsValue.customfields??{},p={title:t,pipeline_id:g,stage_id:c,status:d,add_time:l?(0,ko.default)(l).format("YYYY-MM-DDTHH:mm:ss[Z]"):void 0,probability:u,visible_to:a,owner_id:_,org_id:I,person_id:b,value:r,currency:n};m.length>0&&(p.label_ids=m),o&&(p.expected_close_date=(0,ko.default)(o).format("YYYY-MM-DD"));let P=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),T=Ae(P,h);ce(T)||(p.custom_fields=T);let z=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/deals",body:p}),ne=R(P,z.data);return{...z,data:ne}}});var bl=we(mt());var Pl=D({auth:E,name:"update-deal",outputSchema:gc,classification:"WRITE",displayName:"Update Deal",description:"Updates an existing deal.",audience:"both",aiMetadata:{description:"Updates fields on an existing deal identified by its deal ID, such as title, value, stage, status, owner, or linked person/organization; only supplied fields are changed. Use to modify a deal you already know the ID of (use Create Deal to add a new one, or Find Deal to locate one first). Idempotent: repeating the same update converges to the same deal state.",idempotent:!0},props:{dealId:tt(!0),title:y.ShortText({displayName:"Title",required:!1}),...on},async run(e){let{dealId:t,title:r,dealValue:n,dealValueCurrency:o,expectedCloseDate:a,visibleTo:u,probability:c,stageId:d,status:g,pipelineId:_,ownerId:I,organizationId:b,personId:l}=e.propsValue,m=e.propsValue.labelIds??[],h=e.propsValue.customfields??{},p={title:r,pipeline_id:_,stage_id:d,status:g,probability:c,visible_to:u,owner_id:I,org_id:b,person_id:l,value:n,currency:o};m.length>0&&(p.label_ids=m),a&&(p.expected_close_date=(0,bl.default)(a).format("YYYY-MM-DD"));let P=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),T=Ae(P,h);ce(T)||(p.custom_fields=T);let z=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/deals/${t}`,body:p}),ne=R(P,z.data);return{...z,data:ne}}});var xl=D({auth:E,name:"create-product",outputSchema:bc,classification:"WRITE",displayName:"Create Product",description:"Creates a new product.",audience:"both",aiMetadata:{description:"Create a new product in the catalog with name, code, pricing (price/cost/overhead/currency/tax), unit, owner, visibility, and custom fields. Pick this to add a product; each call creates a separate record, so repeating it produces duplicates. Not idempotent.",idempotent:!1},props:{name:y.ShortText({displayName:"Name",required:!0}),code:y.ShortText({displayName:"Code",required:!1}),description:y.LongText({displayName:"Description",required:!1}),unit:y.ShortText({displayName:"Unit",required:!1}),tax:y.Number({displayName:"Tax percentage",required:!1}),isActive:y.Checkbox({displayName:"Is Active ?",required:!1,defaultValue:!0}),ownerId:Ce("Owner",!1),currency:y.ShortText({displayName:"Currency",required:!1,description:'Please enter currency code (e.g., "USD", "EUR").'}),price:y.Number({displayName:"Price",required:!1}),cost:y.Number({displayName:"Cost",required:!1}),overheadCost:y.Number({displayName:"Overhead Cost",required:!1}),visibleTo:ft,customfields:gt("product")},async run(e){let{name:t,code:r,description:n,unit:o,tax:a,isActive:u,ownerId:c,currency:d,price:g,cost:_,overheadCost:I,visibleTo:b}=e.propsValue,l=e.propsValue.customfields??{},m={name:t,code:r,description:n,unit:o,tax:a,is_deleted:!u,prices:[{price:g??0,currency:d??"USD",cost:_??0,direct_cost:I??0}],visible_to:b};c&&(m.owner_id=c);let h=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"}),p=Ae(h,l);ce(p)||(m.custom_fields=p);let P=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/products",body:m}),T=R(h,P.data);return{...P,data:T}}});var Tl=D({auth:E,name:"add-product-to-deal",outputSchema:xc,classification:"WRITE",displayName:"Add Product to Deal",description:"Adds a product to a deal.",audience:"both",aiMetadata:{description:"Attaches an existing product (by product ID) as a line item on a deal (by deal ID), setting its unit price, quantity, and optional discount and tax. Use when building out the products on a deal; requires both IDs and a price and quantity. Not idempotent: each call adds another line item, so calling it twice attaches the product twice.",idempotent:!1},props:{dealId:tt(!0),productId:nn(!0),price:y.Number({displayName:"Price",required:!0}),quantity:y.Number({displayName:"Quantity",required:!0}),discount:y.Number({displayName:"Discount",required:!1}),discountType:y.StaticDropdown({displayName:"Discount Type",required:!1,options:{disabled:!1,options:[{label:"Percentage",value:"percentage"},{label:"Amount",value:"amount"}]}}),comments:y.LongText({displayName:"Comments",required:!1}),enableProduct:y.Checkbox({displayName:"Enable Product?",required:!1,defaultValue:!0}),taxMethod:y.StaticDropdown({displayName:"Tax Method",required:!1,options:{disabled:!1,options:[{label:"Exclusive",value:"exclusive"},{label:"Inclusive",value:"inclusive"},{label:"None",value:"none"}]}}),taxPercentage:y.Number({displayName:"Tax Percentage",required:!1})},async run(e){let{productId:t,dealId:r,price:n,quantity:o,discountType:a,discount:u,comments:c,enableProduct:d,taxPercentage:g,taxMethod:_}=e.propsValue;return await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:`/v2/deals/${r}/products`,body:{product_id:t,item_price:n,quantity:o,discount_type:a,discount:u,comments:c??"",is_enabled:d,tax:g,tax_method:_}})}});var Il=D({auth:E,name:"add-labels-to-person",outputSchema:mc,classification:"WRITE",displayName:"Add Labels to Person",description:"Adds existing labels to an existing person.",audience:"both",aiMetadata:{description:"Set the label(s) on an existing person by ID using pre-existing label definitions. Pick this to tag/categorize a known person; it replaces the person's label_ids with the supplied set rather than merging, so include all labels that should remain. Mutates the person record.",idempotent:!1},props:{personId:Ue(!0),labelIds:fr("person","label_ids",!0)},async run(e){let{personId:t}=e.propsValue,r=e.propsValue.labelIds??[],n={};r.length>0&&(n.label_ids=r);let o=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/persons/${t}`,body:{...n}}),a=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),u=R(a,o.data);return{...o,data:u}}});var El=we(mt());var Al=D({auth:E,name:"create-activity",outputSchema:_c,classification:"WRITE",displayName:"Create Activity",description:"Creates a new activity.",audience:"both",aiMetadata:{description:"Creates an activity (call, meeting, task, etc.) with a subject and optional type, due date/time, owner, and links to a deal, lead, person, or organization. Use to schedule or log work against CRM records (use Update Activity to change one that exists). Not idempotent: each call creates a separate activity.",idempotent:!1},props:{subject:y.ShortText({displayName:"Subject",required:!0}),...cn},async run(e){let{subject:t,organizationId:r,personId:n,dealId:o,leadId:a,assignTo:u,type:c,dueDate:d,dueTime:g,duration:_,isDone:I,busy:b,note:l,publicDescription:m}=e.propsValue,h={subject:t,org_id:r,deal_id:o,lead_id:a,public_description:m,type:c,owner_id:u,due_time:g,duration:_,done:I,note:l};return n&&(h.participants=[{person_id:n,primary:!0}]),b&&(h.busy=b==="busy"),d&&(h.due_date=(0,El.default)(d).format("YYYY-MM-DD")),await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v2/activities",body:h})}});var Sl=we(mt());var kl=D({auth:E,name:"update-activity",outputSchema:vc,classification:"WRITE",displayName:"Update Activity",description:"Updates an existing activity.",audience:"both",aiMetadata:{description:"Updates fields on an existing activity identified by its activity ID, such as subject, type, due date/time, owner, done state, and linked records; only supplied fields change. Use to reschedule or mark an activity done (use Create Activity to add a new one). Idempotent: repeating the same update converges to the same activity state.",idempotent:!0},props:{activityId:y.Number({displayName:"Activity ID",required:!0}),subject:y.ShortText({displayName:"Subject",required:!1}),...cn},async run(e){let{activityId:t,subject:r,organizationId:n,personId:o,dealId:a,leadId:u,assignTo:c,type:d,dueDate:g,dueTime:_,duration:I,isDone:b,busy:l,note:m,publicDescription:h}=e.propsValue,p={subject:r,org_id:n,deal_id:a,lead_id:u,note:m,public_description:h,type:d,owner_id:c,due_time:_,duration:I,done:b};return o&&(p.participants=[{person_id:o,primary:!0}]),l&&(p.busy=l==="busy"),g&&(p.due_date=(0,Sl.default)(g).format("YYYY-MM-DD")),await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:`/v2/activities/${t}`,body:p})}});var $l=we(_o());var wl=D({auth:E,name:"attach-file",outputSchema:Lc,classification:"WRITE",displayName:"Attach File",description:"Uploads a file and attaches it to a deal,person,organization,activity or product.",audience:"both",aiMetadata:{description:"Uploads a file and attaches it to one or more CRM records by supplying any of the optional deal, person, organization, product, or activity IDs. Use to add documents or images to existing records; requires the file content and a file name. Not idempotent: each call uploads and creates a separate file attachment.",idempotent:!1},props:{file:y.File({displayName:"File",required:!0}),fileName:y.ShortText({displayName:"File Name",required:!0}),dealId:tt(!1),personId:Ue(!1),organizationId:We(!1),productId:nn(!1),activityId:y.Number({displayName:"Activity ID",required:!1})},async run(e){let{file:t,fileName:r,dealId:n,personId:o,organizationId:a,productId:u,activityId:c}=e.propsValue,d=new $l.default;return d.append("file",t.data,r),n&&d.append("deal_id",n),o&&d.append("person_id",o),a&&d.append("org_id",a),u&&d.append("product_id",u),c&&d.append("activity_id",c),(await ze.sendRequest({method:"POST",url:`${e.auth.data.api_domain}/api/v1/files`,body:d,authentication:{type:"BEARER_TOKEN",token:e.auth.access_token},headers:{...d.getHeaders()}})).body}});var zl=D({auth:E,name:"add-follower",outputSchema:Mc,classification:"WRITE",displayName:"Add Follower",description:"Adds a follower to a deal, person, organization or product.",audience:"both",aiMetadata:{description:"Adds a user as a follower of a single record, with the Target Object dropdown selecting the type (deal, person, organization, or product) and the Target Object ID identifying it. Use to subscribe a user to updates on a record; requires the follower user ID. Not idempotent: each call creates a follower association.",idempotent:!1},props:{followerId:Ce("Follower",!0),entity:y.StaticDropdown({displayName:"Target Object",description:"Type of object to add the follower to.",required:!0,options:{disabled:!1,options:[{label:"Deal",value:"deal"},{label:"Person",value:"person"},{label:"Organization",value:"organization"},{label:"Product",value:"product"}]}}),entityId:y.ShortText({displayName:"Target Object ID",description:"ID of the object to add the follower to.",required:!0})},async run(e){let{followerId:t,entity:r,entityId:n}=e.propsValue,o="";switch(r){case"deal":o=`/deals/${n}/followers`;break;case"organization":o=`/organizations/${n}/followers`;break;case"person":o=`/persons/${n}/followers`;break;case"product":o=`/products/${n}/followers`;break}if(!o)throw new Error(`Invalid object type: ${r}`);return await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:`/v2${o}`,body:{user_id:t}})}});var Ol=D({auth:E,name:"create-note",outputSchema:Tc,classification:"WRITE",displayName:"Create Note",description:"Creates a new note.",audience:"both",aiMetadata:{description:"Create a note with the given content and attach it to at least one deal, person, organization, or lead (at least one association is required, with optional pinning). Pick this to record a comment or log against a CRM record; each call creates a new note, so repeating it produces duplicates. Not idempotent.",idempotent:!1},props:{content:y.LongText({displayName:"Content",required:!0}),dealId:tt(!1),pinnedToDeal:y.Checkbox({displayName:"Pin note to deal?",required:!1,defaultValue:!1}),personId:Ue(!1),pinnedToPerson:y.Checkbox({displayName:"Pin note to person?",required:!1,defaultValue:!1}),organizationId:We(!1),pinnedToOrganization:y.Checkbox({displayName:"Pin note to organization?",required:!1,defaultValue:!1}),leadId:gr(!1),pinnedToLead:y.Checkbox({displayName:"Pin note to lead?",required:!1,defaultValue:!1})},async run(e){let{content:t,dealId:r,personId:n,organizationId:o,leadId:a,pinnedToDeal:u,pinnedToPerson:c,pinnedToOrganization:d,pinnedToLead:g}=e.propsValue;if(!r&&!n&&!o&&!a)throw new Error("Note must be associated with at least one organization, person, deal, lead or project.");let _={content:t,pinned_to_deal_flag:u?1:0,pinned_to_person_flag:c?1:0,pinned_to_organization_flag:d?1:0,pinned_to_lead_flag:g?1:0,lead_id:a,person_id:n,org_id:o,deal_id:r};return await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/notes",body:_})}});var Dl=D({auth:E,name:"get-note",outputSchema:Ic,classification:"READ",displayName:"Retrieve a Note",description:"Finds a note by ID.",audience:"both",aiMetadata:{description:"Retrieves a single note by its numeric note ID. Use when you already have the note ID; to list the notes attached to a deal, lead, person, or organization, use Find Notes instead. Read-only and idempotent.",idempotent:!0},props:{noteId:y.Number({displayName:"Note ID",required:!0})},async run(e){try{return await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v1/notes/${e.propsValue.noteId}`})}catch{return{success:!1,data:{}}}}});var Rl=D({auth:E,name:"find-user",outputSchema:Rc,classification:"SEARCH",displayName:"Find User",description:"Finds a user by name or email.",audience:"both",aiMetadata:{description:"Search Pipedrive account users (team members, not CRM persons) by name or by email address. Pick this to resolve an owner or assignee to a user ID; choose the search-by field to match either a name or an email term. Read-only and may return multiple matches.",idempotent:!0},props:{field:y.StaticDropdown({displayName:"Field to search by",required:!0,options:{disabled:!1,options:[{label:"Name",value:"name"},{label:"Email",value:"email"}]}}),fieldValue:y.ShortText({displayName:"Field Value",required:!0})},async run(e){let{field:t,fieldValue:r}=e.propsValue,n=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/users/find",query:{term:r,search_by_email:t=="email"?1:0}});return{found:n.data&&n.data.length>0,data:n.data}}});var Nl=D({auth:E,name:"find-product",outputSchema:Cc,classification:"SEARCH",displayName:"Find Product",description:"Finds a product by name ",audience:"both",aiMetadata:{description:"Search the product catalog by name and return the single best-matching product with its full details and custom fields. Pick this when you have a product name or keyword rather than an ID; use Retrieve a Product when you already know the exact product ID. Read-only and returns at most one match (found:false when nothing matches).",idempotent:!0},props:{searchTerm:y.ShortText({displayName:"Search Term",required:!0})},async run(e){let{searchTerm:t}=e.propsValue,r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/products/search",query:{term:t,fields:"name",limit:1,include_fields:"product.price"}});if(A(r.data)||A(r.data.items)||r.data.items.length===0)return{found:!1,data:[]};let n=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/products/${r.data.items[0].item.id}`}),o=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"});return{found:!0,data:[R(o,n.data)]}}});var Cl=oe({auth:E,name:"organization-matching-filter",outputSchema:Yc,classification:"READ",displayName:"Organization Matching Filter",description:"Triggers when an organization newly matches a Pipedrive filter for the first time.",aiMetadata:{description:"Fires when an organization (company) record first becomes a member of a selected Pipedrive filter \u2014 that is, the organization newly satisfies the filter conditions. Polls the filter and emits each organization the first time it appears; does not re-fire for organizations already in the filter."},type:"POLLING",props:{filterId:qe("org",!0)},async onEnable(e){let t=[],r=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId}});A(r)||r.forEach(n=>{t.push(n.id)}),await e.store.put("organizations",JSON.stringify(t))},async onDisable(e){await e.store.delete("organizations")},async test(e){let t=[],r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{limit:10,sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId,include_fields:Ze.join(",")}});if(A(r.data))return[];for(let a of r.data)t.push(a);let n=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),o=[];for(let a of t){let u=R(n,a);o.push(u)}return o},async run(e){let t=await e.store.get("organizations")??"[]",r=JSON.parse(t),n=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId,include_fields:Ze.join(",")}});if(A(n)||n.length===0)return[];let o=n.filter(d=>!r.includes(d.id)),a=o.map(d=>d.id);if(a.length===0)return[];await e.store.put("organizations",JSON.stringify([...a,...r]));let u=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"}),c=[];for(let d of o){let g=R(u,d);c.push(g)}return c},sampleData:{id:1,owner_id:22701301,name:"Pipedrive Sample Org",add_time:"2024-12-04T03:49:06Z",update_time:"2024-12-14T11:03:19Z",is_deleted:!1,visible_to:3,picture_id:null,label_ids:[],address:{value:"Mustam\xE4e tee 3, Tallinn, Estonia",street_number:"3",route:"Mustam\xE4e tee",sublocality:"Kristiine",locality:"Tallinn",admin_area_level_1:"Harju maakond",admin_area_level_2:null,country:"Estonia",postal_code:"10616",formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia"},custom_fields:{your_custom_field_key:"your_custom_field_value"}}});var Ul=oe({auth:E,name:"person-matching-filter",outputSchema:Jc,classification:"READ",displayName:"Person Matching Filter",description:"Triggers when a person newly matches a Pipedrive filter for the first time.",aiMetadata:{description:"Fires when a person (contact) record first becomes a member of a selected Pipedrive filter \u2014 that is, the person newly satisfies the filter conditions. Polls the filter and emits each person the first time it appears; does not re-fire for people already in the filter."},type:"POLLING",props:{filterId:qe("people",!0)},async onEnable(e){let t=[],r=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId}});A(r)||r.forEach(n=>{t.push(n.id)}),await e.store.put("persons",JSON.stringify(t))},async onDisable(e){await e.store.delete("persons")},async test(e){let t=[],r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{limit:10,sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId,include_fields:Be.join(",")}});if(A(r.data))return[];for(let a of r.data)t.push(a);let n=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),o=[];for(let a of t){let u=R(n,a);o.push(u)}return o},async run(e){let t=await e.store.get("persons")??"[]",r=JSON.parse(t),n=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{sort_by:"update_time",sort_direction:"desc",filter_id:e.propsValue.filterId,include_fields:Be.join(",")}});if(A(n)||n.length===0)return[];let o=n.filter(d=>!r.includes(d.id)),a=o.map(d=>d.id);if(a.length===0)return[];await e.store.put("persons",JSON.stringify([...a,...r]));let u=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"}),c=[];for(let d of o){let g=R(u,d);c.push(g)}return c},sampleData:{id:1,owner_id:123,org_id:1234,name:"Will Smith",first_name:"Will",last_name:"Smith",is_deleted:!1,phones:[{value:"12345",primary:!0,label:"work"}],emails:[{value:"will.smith@example.com",primary:!0,label:"work"}],add_time:"2017-10-18T13:23:07Z",update_time:"2020-05-08T05:30:20Z",visible_to:3,picture_id:4,next_activity_id:128,last_activity_id:34,last_incoming_mail_time:"2019-05-29T18:21:42Z",last_outgoing_mail_time:"2019-05-30T03:45:35Z",label_ids:[1],marketing_status:"no_consent"}});var Ml=oe({auth:E,name:"activity-matching-filter",outputSchema:Qc,classification:"READ",displayName:"Activity Matching Filter",description:"Trigges when an activity newly matches a Pipedrive filter for the first time.",aiMetadata:{description:"Fires when an activity (scheduled task or event) first becomes a member of a selected Pipedrive filter \u2014 that is, the activity newly satisfies the filter conditions. Polls the filter and emits each activity the first time it appears; does not re-fire for activities already in the filter."},type:"POLLING",props:{filterId:qe("activity",!0)},async onEnable(e){let t=[],r=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{filter_id:e.propsValue.filterId}});A(r)||r.forEach(n=>{t.push(n.id)}),await e.store.put("activities",JSON.stringify(t))},async onDisable(e){await e.store.delete("activities")},async test(e){let t=[],r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{limit:10,filter_id:e.propsValue.filterId,sort_by:"update_time",sort_direction:"desc",include_fields:"attendees"}});if(A(r.data))return[];for(let n of r.data)t.push(n);return t},async run(e){let t=await e.store.get("activities")??"[]",r=JSON.parse(t),n=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{filter_id:e.propsValue.filterId,include_fields:"attendees"}});if(A(n)||n.length===0)return[];let o=n.filter(u=>!r.includes(u.id)),a=o.map(u=>u.id);return a.length===0?[]:(await e.store.put("activities",JSON.stringify([...a,...r])),o)},sampleData:{id:8,company_id:22122,user_id:1234,done:!1,type:"deadline",reference_type:"scheduler-service",reference_id:7,conference_meeting_client:"871b8bc88d3a1202",conference_meeting_url:"https://pipedrive.zoom.us/link",conference_meeting_id:"01758746701",due_date:"2020-06-09",due_time:"10:00",duration:"01:00",busy_flag:!0,add_time:"2020-06-08 12:37:56",marked_as_done_time:"2020-08-08 08:08:38",last_notification_time:"2020-08-08 12:37:56",last_notification_user_id:7655,notification_language_id:1,subject:"Deadline",public_description:"This is a description",calendar_sync_include_context:"",location:"Mustam\xE4e tee 3, Tallinn, Estonia",org_id:5,person_id:1101,deal_id:300,lead_id:"46c3b0e1-db35-59ca-1828-4817378dff71",active_flag:!0,update_time:"2020-08-08 12:37:56",update_user_id:5596,gcal_event_id:"",google_calendar_id:"",google_calendar_etag:"",source_timezone:"",rec_rule:"RRULE:FREQ=WEEKLY;BYDAY=WE",rec_rule_extension:"",rec_master_activity_id:1,series:[],note:"A note for the activity",created_by_user_id:1234,location_subpremise:"",location_street_number:"3",location_route:"Mustam\xE4e tee",location_sublocality:"Kristiine",location_locality:"Tallinn",location_admin_area_level_1:"Harju maakond",location_admin_area_level_2:"",location_country:"Estonia",location_postal_code:"10616",location_formatted_address:"Mustam\xE4e tee 3, 10616 Tallinn, Estonia",attendees:[{email_address:"attendee@pipedrivemail.com",is_organizer:0,name:"Attendee",person_id:25312,status:"noreply",user_id:null}],participants:[{person_id:17985,primary_flag:!1},{person_id:1101,primary_flag:!0}],org_name:"Organization",person_name:"Person",deal_title:"Deal",owner_name:"Creator",person_dropbox_bcc:"company@pipedrivemail.com",deal_dropbox_bcc:"company+deal300@pipedrivemail.com",assigned_to_user_id:1235,file:{id:"376892,",clean_name:"Audio 10:55:07.m4a",url:"https://pipedrive-files.s3-eu-west-1.amazonaws.com/Audio-recording.m4a"}}});var Ll=oe({auth:E,name:"deal-matching-filter",outputSchema:Xc,classification:"READ",displayName:"Deal Matching Filter",description:"Trigges when a deal newly matches a Pipedrive filter for the first time.",aiMetadata:{description:"Fires when a deal first becomes a member of a selected Pipedrive filter \u2014 that is, the deal newly satisfies the filter conditions. Polls the filter and emits each deal the first time it appears; does not re-fire for deals already in the filter."},type:"POLLING",props:{filterId:qe("deals",!0),status:y.StaticDropdown({displayName:"Status",required:!1,defaultValue:"all_not_deleted",options:{disabled:!1,options:[{label:"Open",value:"open"},{label:"Won",value:"won"},{label:"Lost",value:"lost"},{label:"Deleted",value:"deleted"},{label:"All(Not Deleted)",value:"all_not_deleted"}]}})},async onEnable(e){let t=[],r=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{filter_id:e.propsValue.filterId,status:e.propsValue.status}});A(r)||r.forEach(n=>{t.push(n.id)}),await e.store.put("deals",JSON.stringify(t))},async onDisable(e){await e.store.delete("deals")},async test(e){let t=[],r=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{limit:10,filter_id:e.propsValue.filterId,status:e.propsValue.status,include_fields:Se.join(",")}});if(A(r.data))return[];for(let a of r.data)t.push(a);let n=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),o=[];for(let a of t){let u=R(n,a);o.push(u)}return o},async run(e){let t=await e.store.get("deals")??"[]",r=JSON.parse(t),n=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{filter_id:e.propsValue.filterId,status:e.propsValue.status,include_fields:Se.join(",")}});if(A(n)||n.length===0)return[];let o=n.filter(d=>!r.includes(d.id)),a=o.map(d=>d.id);if(a.length===0)return[];await e.store.put("deals",JSON.stringify([...a,...r]));let u=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),c=[];for(let d of o){let g=R(u,d);c.push(g)}return c},sampleData:{id:1,creator_user_id:22701301,person_id:1101,org_id:5,stage_id:2,title:"Deal One",value:5e3,currency:"EUR",add_time:"2019-05-29 04:21:51",update_time:"2019-11-28 16:19:50",stage_change_time:"2019-11-28 15:41:22",active:!0,deleted:!1,status:"open",probability:null,next_activity_date:"2019-11-29",next_activity_time:"11:30:00",next_activity_id:128,last_activity_id:null,last_activity_date:null,lost_reason:null,visible_to:"1",close_time:null,pipeline_id:1,won_time:"2019-11-27 11:40:36",first_won_time:"2019-11-27 11:40:36",lost_time:"",products_count:0,files_count:0,notes_count:2,followers_count:0,email_messages_count:4,activities_count:1,done_activities_count:0,undone_activities_count:1,participants_count:1,expected_close_date:"2019-06-29",last_incoming_mail_time:"2019-05-29 18:21:42",last_outgoing_mail_time:"2019-05-30 03:45:35",label:11,stage_order_nr:2,person_name:"Person",org_name:"Organization",next_activity_subject:"Call",next_activity_type:"call",next_activity_duration:"00:30:00",next_activity_note:"Note content",formatted_value:"\u20AC5,000",weighted_value:5e3,formatted_weighted_value:"\u20AC5,000",weighted_value_currency:"EUR",rotten_time:null,owner_name:"Creator",cc_email:"company+deal1@pipedrivemail.com",org_hidden:!1,person_hidden:!1,average_time_to_won:{y:0,m:0,d:0,h:0,i:20,s:49,total_seconds:1249},average_stage_progress:4.99,age:{y:0,m:6,d:14,h:8,i:57,s:26,total_seconds:17139446},stay_in_pipeline_stages:{times_in_stages:{1:15721267,2:1288449,3:4368,4:3315,5:26460},order_of_stages:[1,2,3,4,5]},last_activity:null,next_activity:null}});var Fl=oe({auth:E,name:"new-note",outputSchema:Wc,classification:"READ",displayName:"New Note",description:"Triggers when a new note is created.",aiMetadata:{description:"Fires when a new note is created in Pipedrive. A note carries free-text content and may be linked to a deal, person, organization, or lead. Use to react whenever someone records a comment or annotation in the CRM."},props:{},type:"WEBHOOK",async onEnable(e){let t=await ue.subscribeWebhook("note","create",e.webhookUrl,e.auth.data.api_domain,e.auth.access_token);await e.store?.put("_new_note_trigger",{webhookId:t.data.id})},async onDisable(e){let t=await e.store?.get("_new_note_trigger");t!=null&&await ue.unsubscribeWebhook(t.webhookId,e.auth.data.api_domain,e.auth.access_token)},async test(e){let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/notes",query:{limit:10,sort:"update_time DESC"}});return A(t.data)?[]:t.data},async run(e){let t=e.payload.body;return[(await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v1/notes/${t.data.id}`})).data]},sampleData:{id:1,user_id:22701301,deal_id:null,person_id:1,org_id:1,lead_id:null,content:"Note content for v2 API.",add_time:"2024-12-04T06:48:26Z",update_time:"2024-12-04T06:48:26Z",is_deleted:!1}});var jl=D({auth:E,name:"find-deals-associated-with-person",outputSchema:$c,classification:"SEARCH",displayName:"Find Deals Associated With Person",description:"Finds multiple deals related to a specific person.",audience:"both",aiMetadata:{description:"Lists all deals linked to a given person, identified by their numeric person ID, sorted by most recently updated. Use when you already have a person and need their associated deals; to look up a deal by a field value instead, use Find Deal. Read-only and idempotent.",idempotent:!0},props:{personId:Ue(!0)},async run(e){let{personId:t}=e.propsValue,r=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{person_id:t,sort_by:"update_time",sort_direction:"desc",include_fields:Se.join(",")}});if(A(r)||r.length===0)return{found:!1,data:[]};let n=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"}),o=[];for(let a of r){let u=R(n,a);o.push(u)}return{found:!0,data:o}}});var Vl=D({auth:E,name:"find-products",outputSchema:Uc,classification:"SEARCH",displayName:"Find Products",description:"Finds a product or products by name or product code.",audience:"both",aiMetadata:{description:"Searches products by exact match on either name or product code (selected via the Field dropdown) and returns all matches, paging through every result. Use to locate products before adding them to a deal or updating them. Read-only and idempotent.",idempotent:!0},props:{field:y.StaticDropdown({displayName:"Field to search by",required:!0,defaultValue:"name",options:{disabled:!1,options:[{label:"Name",value:"name"},{label:"Product Code",value:"code"}]}}),fieldValue:y.ShortText({displayName:"Field Value",required:!0})},async run(e){let t={term:e.propsValue.fieldValue,fields:e.propsValue.field,exact_match:"true",limit:"100"},r,n=!0,o=[];do{r&&(t.cursor=r);let a=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/products/search",query:{term:e.propsValue.fieldValue,fields:e.propsValue.field,exact_match:"true"}});if(A(a.data.items))break;for(let u of a.data.items)o.push(u.item);n=a.additional_data?.next_cursor!=null,r=a.additional_data?.next_cursor}while(n);return{found:o.length>0,data:o}}});var Bl=D({auth:E,name:"get-product",outputSchema:Nc,classification:"READ",displayName:"Retrieve a Product",description:"Finds a product by ID.",audience:"both",aiMetadata:{description:"Retrieve a single product by its exact numeric ID, returning full details and resolved custom fields. Pick this when you already know the product ID; use Find Product to search by name instead. Read-only and returns found:false rather than erroring when the ID does not exist.",idempotent:!0},props:{productId:y.Number({displayName:"Product ID",required:!0})},async run(e){try{let t=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:`/v2/products/${e.propsValue.productId}`}),r=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"});return{found:!0,data:[R(r,t.data)]}}catch{return{found:!1,data:[]}}}});var Zl=D({auth:E,name:"find-notes",outputSchema:Oc,classification:"SEARCH",displayName:"Find Notes",description:"Finds notes by Deal, Lead, Person, or Organization ID.",audience:"both",aiMetadata:{description:"Lists notes attached to a single parent record, chosen via the Search By dropdown (Deal, Lead, Person, or Organization) plus that record's ID, sorted newest-updated first. Use to retrieve the notes on a known object; to fetch one specific note by its own ID, use Retrieve a Note. Read-only and idempotent.",idempotent:!0},props:{objectType:y.StaticDropdown({displayName:"Search By",required:!0,options:{disabled:!1,options:[{label:"Deal",value:"deal_id"},{label:"Lead",value:"lead_id"},{label:"Person",value:"person_id"},{label:"Organization",value:"org_id"}]}}),objectId:y.ShortText({displayName:"ID",required:!0})},async run(e){let t=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/notes",query:{sort:"update_time DESC",[e.propsValue.objectType]:e.propsValue.objectId}});return A(t)||t.length===0?{found:!1,data:[]}:{found:t.length>0,data:t}}});var Gl=D({auth:E,name:"find-organization",outputSchema:wc,classification:"SEARCH",displayName:"Find Organization",description:"Finds an organization.",audience:"both",aiMetadata:{description:"Finds a single organization by matching a chosen field to a value (exact match), returning the most recently updated match. Use to locate an organization before reading or updating it; pick the field via Search Field and supply its value. Read-only and idempotent (a temporary search filter is created and removed internally).",idempotent:!0},props:{searchField:jt("organization"),searchFieldValue:Vt("organization")},async run(e){let{searchField:t}=e.propsValue,r=e.propsValue.searchFieldValue.field_value;if(A(r))throw new Error("Please enter a value for the field");let n=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/filters",body:{name:"Activepieces Find Organization Filter",type:"org",conditions:{glue:"and",conditions:[{glue:"and",conditions:[{object:"organization",field_id:t,operator:"=",value:r}]},{glue:"or",conditions:[{object:"organization",field_id:t,operator:"IS NOT NULL",value:null}]}]}}}),o=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/organizations",query:{filter_id:n.data.id,limit:1,sort_by:"update_time",sort_direction:"desc",include_fields:Ze.join(",")}});if(await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/filters/${n.data.id}`}),A(o.data)||o.data.length===0)return{found:!1,data:[]};let a=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/organizationFields"});return{found:!0,data:[R(a,o.data[0])]}}});var Hl=D({auth:E,name:"find-person",outputSchema:Sc,classification:"SEARCH",displayName:"Find Person",description:"Finds a person.",audience:"both",aiMetadata:{description:"Look up a single person by an exact value in a chosen field (e.g. email, phone, name, or a custom field). Pick this when you need to resolve a person record to its ID or details before acting on it. Effectively read-only (it creates and removes a temporary search filter) and returns the most recently updated match.",idempotent:!0},props:{searchField:jt("person"),searchFieldValue:Vt("person")},async run(e){let{searchField:t}=e.propsValue,r=e.propsValue.searchFieldValue.field_value;if(A(r))throw new Error("Please enter a value for the field");let n=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/filters",body:{name:"Activepieces Find Person Filter",type:"people",conditions:{glue:"and",conditions:[{glue:"and",conditions:[{object:"person",field_id:t,operator:"=",value:r}]},{glue:"or",conditions:[{object:"person",field_id:t,operator:"IS NOT NULL",value:null}]}]}}}),o=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/persons",query:{filter_id:n.data.id,limit:1,sort_by:"update_time",sort_direction:"desc",include_fields:Be.join(",")}});if(await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/filters/${n.data.id}`}),A(o.data)||o.data.length===0)return{found:!1,data:[]};let a=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/personFields"});return{found:!0,data:[R(a,o.data[0])]}}});var ql=D({auth:E,name:"find-deal",outputSchema:kc,classification:"SEARCH",displayName:"Find Deal",description:"Finds a deal by any field.",audience:"both",aiMetadata:{description:"Finds a single deal by matching a chosen field to a value (exact match), returning the most recently updated match. Use to locate a deal before reading or updating it; pick the field via Search Field and supply its value. To list deals tied to a specific person, use Find Deals Associated With Person instead. Read-only and idempotent (a temporary search filter is created and removed internally).",idempotent:!0},props:{searchField:jt("deal"),searchFieldValue:Vt("deal")},async run(e){let{searchField:t}=e.propsValue,r=e.propsValue.searchFieldValue.field_value;if(A(r))throw new Error("Please enter a value for the field");let n=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"POST",resourceUri:"/v1/filters",body:{name:"Activepieces Find Deal Filter",type:"deals",conditions:{glue:"and",conditions:[{glue:"and",conditions:[{object:"deal",field_id:t,operator:"=",value:r}]},{glue:"or",conditions:[{object:"deal",field_id:t,operator:"IS NOT NULL",value:null}]}]}}}),o=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/deals",query:{filter_id:n.data.id,limit:1,sort_by:"update_time",sort_direction:"desc",include_fields:Se.join(",")}});if(await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"DELETE",resourceUri:`/v1/filters/${n.data.id}`}),A(o.data)||o.data.length===0)return{found:!1,data:[]};let a=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/dealFields"});return{found:!0,data:[R(a,o.data[0])]}}});var Wl=D({auth:E,name:"find-activity",outputSchema:zc,classification:"SEARCH",displayName:"Find Activity",description:"Finds an activity by subject.",audience:"both",aiMetadata:{description:"Search activities by subject text, optionally narrowed by owner, type, done/not-done status, or a saved filter. Pick this to locate existing activities; matching is case-insensitive substring by default but can be made exact-match. Read-only and may return multiple matches.",idempotent:!0},props:{subject:y.ShortText({displayName:"Subject",required:!0}),exactMatch:y.Checkbox({displayName:"Exact Match",required:!1,defaultValue:!0}),assignTo:Ce("Assign To",!1),type:So(!1),filterId:qe("activity",!1),status:y.StaticDropdown({displayName:"Status",required:!1,options:{disabled:!1,options:[{label:"Done",value:1},{label:"Not Done",value:0}]}})},async run(e){let{subject:t,assignTo:r,type:n,filterId:o,status:a,exactMatch:u}=e.propsValue,c=await ge({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/activities",query:{owner_id:r,done:a!=null?a===1:void 0,sort_by:"update_time",sort_direction:"desc",filter_id:o}});if(A(c)||c.length===0)return{found:!1,data:[]};let d=[];for(let g of c){let _=!1;g.subject&&(u&&g.subject===t||!u&&g.subject.toLowerCase().includes(t.toLowerCase()))&&(_=!0),n?_&&g.type===n&&d.push(g):_&&d.push(g)}return{found:d.length>0,data:d}}});var Kl=D({auth:E,name:"update-product",outputSchema:Pc,classification:"WRITE",displayName:"Update Product",description:"Updates an existing product.",audience:"both",aiMetadata:{description:"Updates fields on an existing product identified by its product ID, such as name, code, pricing, tax, owner, active state, and custom fields; only supplied fields change. Use to edit a product you have the ID for (use Find Products to locate it first). Idempotent: repeating the same update converges to the same product state.",idempotent:!0},props:{id:y.ShortText({displayName:"Product ID",required:!0}),name:y.ShortText({displayName:"Name",required:!1}),code:y.ShortText({displayName:"Code",required:!1}),description:y.LongText({displayName:"Description",required:!1}),unit:y.ShortText({displayName:"Unit",required:!1}),tax:y.Number({displayName:"Tax percentage",required:!1}),isActive:y.Checkbox({displayName:"Is Active ?",required:!1,defaultValue:!0}),ownerId:Ce("Owner",!1),currency:y.ShortText({displayName:"Currency",required:!1,description:'Please enter currency code (e.g., "USD", "EUR").'}),price:y.Number({displayName:"Price",required:!1}),cost:y.Number({displayName:"Cost",required:!1}),overheadCost:y.Number({displayName:"Overhead Cost",required:!1}),visibleTo:ft,customfields:gt("product")},async run(e){let{id:t,name:r,code:n,description:o,unit:a,tax:u,isActive:c,ownerId:d,currency:g,price:_,cost:I,overheadCost:b,visibleTo:l}=e.propsValue,m=e.propsValue.customfields??{},h={name:r,code:n,description:o,unit:a,tax:u,is_deleted:!c,prices:[{price:_??0,currency:g??"USD",cost:I??0,direct_cost:b??0}],visible_to:l};d&&(h.owner_id=d);let p=await k({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v1/productFields"}),P=Ae(p,m);ce(P)||(h.custom_fields=P);let T=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"PATCH",resourceUri:"/v2/products/"+t,body:h}),z=R(p,T.data);return{...T,data:z}}});var Jl=D({auth:E,name:"find-lead",outputSchema:Dc,classification:"SEARCH",displayName:"Find Lead",description:"Finds leads by title.",audience:"both",aiMetadata:{description:"Searches leads by title text and returns all matches, paging through every result. By default it matches titles containing the term; enable Exact Match for full case-insensitive title equality only. Use to locate leads before reading or updating them. Read-only and idempotent.",idempotent:!0},props:{term:y.ShortText({displayName:"Title",description:"The title to search for.",required:!0}),exact_match:y.Checkbox({displayName:"Exact Match",description:"When enabled, only full exact matches against the given title are returned. It is not case sensitive.",required:!1})},async run(e){let{term:t,exact_match:r}=e.propsValue,n,o=!0,a=[];do{let u={term:t,fields:"title",limit:"100"};r&&(u.exact_match=!0),n&&(u.cursor=n);let c=await x({accessToken:e.auth.access_token,apiDomain:e.auth.data.api_domain,method:"GET",resourceUri:"/v2/leads/search",query:u});if(A(c.data?.items))break;for(let d of c.data.items)a.push(d.item);o=c.additional_data?.next_cursor!=null,n=c.additional_data?.next_cursor}while(o);return{found:a.length>0,data:a}}});var ey=Ha({displayName:"Pipedrive",description:"Sales CRM and pipeline management software",minimumSupportedRelease:"0.30.0",logoUrl:"https://cdn.activepieces.com/pieces/pipedrive.png",categories:["SALES_AND_CRM"],auth:E,actions:[zl,Dl,Ol,Il,Tl,wl,Al,kl,vl,Pl,yl,_l,ml,fl,dl,pl,xl,Kl,jl,Nl,Vl,Zl,Bl,Gl,Hl,ql,Wl,Rl,Jl,cc({baseUrl:i(()=>"https://api.pipedrive.com/api/v2","baseUrl"),auth:E,authMapping:i(async e=>({Authorization:`Bearer ${e.access_token}`}),"authMapping")})],authors:["ashrafsamhouri","kishanprmr","MoShizzle","khaledmashaly","abuaboud","leocottaz","Anmol-Gup"],triggers:[rl,tl,el,Fl,il,ol,cl,al,sl,ul,Ml,Ll,Ul,Cl]});0&&(module.exports={pipedrive});
|
|
4
4
|
/*! Bundled license information:
|
|
5
5
|
|
|
6
6
|
mime-types/index.js:
|