@activepieces/piece-promotekit 0.3.2 → 0.3.4
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 +7 -12
- package/src/index.js +48 -78
- package/src/index.d.ts +0 -3
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/create-affiliate.d.ts +0 -7
- package/src/lib/actions/create-affiliate.d.ts.map +0 -1
- package/src/lib/actions/create-affiliate.js +0 -56
- package/src/lib/actions/create-affiliate.js.map +0 -1
- package/src/lib/actions/create-referral.d.ts +0 -5
- package/src/lib/actions/create-referral.d.ts.map +0 -1
- package/src/lib/actions/create-referral.js +0 -42
- package/src/lib/actions/create-referral.js.map +0 -1
- package/src/lib/actions/find-affiliate.d.ts +0 -4
- package/src/lib/actions/find-affiliate.d.ts.map +0 -1
- package/src/lib/actions/find-affiliate.js +0 -37
- package/src/lib/actions/find-affiliate.js.map +0 -1
- package/src/lib/actions/find-campaign.d.ts +0 -4
- package/src/lib/actions/find-campaign.d.ts.map +0 -1
- package/src/lib/actions/find-campaign.js +0 -44
- package/src/lib/actions/find-campaign.js.map +0 -1
- package/src/lib/actions/find-commission.d.ts +0 -4
- package/src/lib/actions/find-commission.d.ts.map +0 -1
- package/src/lib/actions/find-commission.js +0 -37
- package/src/lib/actions/find-commission.js.map +0 -1
- package/src/lib/actions/find-payout.d.ts +0 -4
- package/src/lib/actions/find-payout.d.ts.map +0 -1
- package/src/lib/actions/find-payout.js +0 -37
- package/src/lib/actions/find-payout.js.map +0 -1
- package/src/lib/actions/find-referral.d.ts +0 -4
- package/src/lib/actions/find-referral.d.ts.map +0 -1
- package/src/lib/actions/find-referral.js +0 -37
- package/src/lib/actions/find-referral.js.map +0 -1
- package/src/lib/actions/list-affiliates.d.ts +0 -5
- package/src/lib/actions/list-affiliates.d.ts.map +0 -1
- package/src/lib/actions/list-affiliates.js +0 -49
- package/src/lib/actions/list-affiliates.js.map +0 -1
- package/src/lib/actions/list-campaigns.d.ts +0 -2
- package/src/lib/actions/list-campaigns.d.ts.map +0 -1
- package/src/lib/actions/list-campaigns.js +0 -40
- package/src/lib/actions/list-campaigns.js.map +0 -1
- package/src/lib/actions/list-commissions.d.ts +0 -5
- package/src/lib/actions/list-commissions.d.ts.map +0 -1
- package/src/lib/actions/list-commissions.js +0 -49
- package/src/lib/actions/list-commissions.js.map +0 -1
- package/src/lib/actions/list-payouts.d.ts +0 -5
- package/src/lib/actions/list-payouts.d.ts.map +0 -1
- package/src/lib/actions/list-payouts.js +0 -49
- package/src/lib/actions/list-payouts.js.map +0 -1
- package/src/lib/actions/list-referrals.d.ts +0 -5
- package/src/lib/actions/list-referrals.d.ts.map +0 -1
- package/src/lib/actions/list-referrals.js +0 -49
- package/src/lib/actions/list-referrals.js.map +0 -1
- package/src/lib/actions/update-affiliate.d.ts +0 -9
- package/src/lib/actions/update-affiliate.d.ts.map +0 -1
- package/src/lib/actions/update-affiliate.js +0 -72
- package/src/lib/actions/update-affiliate.js.map +0 -1
- package/src/lib/common/index.d.ts +0 -27
- package/src/lib/common/index.d.ts.map +0 -1
- package/src/lib/common/index.js +0 -190
- package/src/lib/common/index.js.map +0 -1
- package/src/lib/triggers/new-affiliate-event.d.ts +0 -15
- package/src/lib/triggers/new-affiliate-event.d.ts.map +0 -1
- package/src/lib/triggers/new-affiliate-event.js +0 -94
- package/src/lib/triggers/new-affiliate-event.js.map +0 -1
- package/src/lib/triggers/new-commission-event.d.ts +0 -11
- package/src/lib/triggers/new-commission-event.d.ts.map +0 -1
- package/src/lib/triggers/new-commission-event.js +0 -74
- package/src/lib/triggers/new-commission-event.js.map +0 -1
- package/src/lib/triggers/new-referral-event.d.ts +0 -15
- package/src/lib/triggers/new-referral-event.d.ts.map +0 -1
- package/src/lib/triggers/new-referral-event.js +0 -93
- package/src/lib/triggers/new-referral-event.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-promotekit",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
|
|
15
|
-
"lint": "eslint 'src/**/*.ts'"
|
|
16
|
-
}
|
|
6
|
+
"dependencies": {},
|
|
7
|
+
"files": [
|
|
8
|
+
"src/index.js",
|
|
9
|
+
"package.json",
|
|
10
|
+
"src/i18n"
|
|
11
|
+
]
|
|
17
12
|
}
|
package/src/index.js
CHANGED
|
@@ -1,82 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promotekit = exports.promotekitAuth = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
"use strict";var lu=Object.create;var Qe=Object.defineProperty;var du=Object.getOwnPropertyDescriptor;var mu=Object.getOwnPropertyNames;var fu=Object.getPrototypeOf,gu=Object.prototype.hasOwnProperty;var o=(e,t)=>Qe(e,"name",{value:t,configurable:!0});var E=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},yn=(e,t)=>{for(var r in t)Qe(e,r,{get:t[r],enumerable:!0})},hn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of mu(t))!gu.call(e,i)&&i!==r&&Qe(e,i,{get:()=>t[i],enumerable:!(n=du(t,i))||n.enumerable});return e};var Ce=(e,t,r)=>(r=e!=null?lu(fu(e)):{},hn(t||!e||!e.__esModule?Qe(r,"default",{value:e,enumerable:!0}):r,e)),yu=e=>hn(Qe({},"__esModule",{value:!0}),e);var Fo=E((jo,Gt)=>{(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"),u="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",l={zoneIndex:new RegExp(u,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${u})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${u})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${t}\\.${t}\\.${t}\\.${t}(${u})?$`,"i")};function y(s,d){if(s.indexOf("::")!==s.lastIndexOf("::"))return null;let f=0,m=-1,v=(s.match(l.zoneIndex)||[])[0],P,j;for(v&&(v=v.substring(1),s=s.replace(/%.+$/,""));(m=s.indexOf(":",m+1))>=0;)f++;if(s.substr(0,2)==="::"&&f--,s.substr(-2,2)==="::"&&f--,f>d)return null;for(j=d-f,P=":";j--;)P+="0:";return s=s.replace("::",P),s[0]===":"&&(s=s.slice(1)),s[s.length-1]===":"&&(s=s.slice(0,-1)),d=(function(){let ne=s.split(":"),ue=[];for(let Ye=0;Ye<ne.length;Ye++)ue.push(parseInt(ne[Ye],16));return ue})(),{parts:d,zoneId:v}}o(y,"expandIPv6");function h(s,d,f,m){if(s.length!==d.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let v=0,P;for(;m>0;){if(P=f-m,P<0&&(P=0),s[v]>>P!==d[v]>>P)return!1;m-=f,v+=1}return!0}o(h,"matchCIDR");function _(s){if(i.test(s))return parseInt(s,16);if(s[0]==="0"&&!isNaN(parseInt(s[1],10))){if(n.test(s))return parseInt(s,8);throw new Error(`ipaddr: cannot parse ${s} as octal`)}return parseInt(s,10)}o(_,"parseIntAuto");function $(s,d){for(;s.length<d;)s=`0${s}`;return s}o($,"padPart");let x={};x.IPv4=(function(){function s(d){if(d.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let f,m;for(f=0;f<d.length;f++)if(m=d[f],!(0<=m&&m<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=d}return o(s,"IPv4"),s.prototype.SpecialRanges={unspecified:[[new s([0,0,0,0]),8]],broadcast:[[new s([255,255,255,255]),32]],multicast:[[new s([224,0,0,0]),4]],linkLocal:[[new s([169,254,0,0]),16]],loopback:[[new s([127,0,0,0]),8]],carrierGradeNat:[[new s([100,64,0,0]),10]],private:[[new s([10,0,0,0]),8],[new s([172,16,0,0]),12],[new s([192,168,0,0]),16]],reserved:[[new s([192,0,0,0]),24],[new s([192,0,2,0]),24],[new s([192,88,99,0]),24],[new s([198,18,0,0]),15],[new s([198,51,100,0]),24],[new s([203,0,113,0]),24],[new s([240,0,0,0]),4]],as112:[[new s([192,175,48,0]),24],[new s([192,31,196,0]),24]],amt:[[new s([192,52,193,0]),24]]},s.prototype.kind=function(){return"ipv4"},s.prototype.match=function(d,f){let m;if(f===void 0&&(m=d,d=m[0],f=m[1]),d.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return h(this.octets,d.octets,8,f)},s.prototype.prefixLengthFromSubnetMask=function(){let d=0,f=!1,m={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},v,P,j;for(v=3;v>=0;v-=1)if(P=this.octets[v],P in m){if(j=m[P],f&&j!==0)return null;j!==8&&(f=!0),d+=j}else return null;return 32-d},s.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},s.prototype.toByteArray=function(){return this.octets.slice(0)},s.prototype.toIPv4MappedAddress=function(){return x.IPv6.parse(`::ffff:${this.toString()}`)},s.prototype.toNormalizedString=function(){return this.toString()},s.prototype.toString=function(){return this.octets.join(".")},s})(),x.IPv4.broadcastAddressFromCIDR=function(s){try{let d=this.parseCIDR(s),f=d[0].toByteArray(),m=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),v=[],P=0;for(;P<4;)v.push(parseInt(f[P],10)|parseInt(m[P],10)^255),P++;return new this(v)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.isIPv4=function(s){return this.parser(s)!==null},x.IPv4.isValid=function(s){try{return new this(this.parser(s)),!0}catch{return!1}},x.IPv4.isValidCIDR=function(s){try{return this.parseCIDR(s),!0}catch{return!1}},x.IPv4.isValidFourPartDecimal=function(s){return!!(x.IPv4.isValid(s)&&s.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},x.IPv4.isValidCIDRFourPartDecimal=function(s){let d=s.match(/^(.+)\/(\d+)$/);return!x.IPv4.isValidCIDR(s)||!d?!1:x.IPv4.isValidFourPartDecimal(d[1])},x.IPv4.networkAddressFromCIDR=function(s){let d,f,m,v,P;try{for(d=this.parseCIDR(s),m=d[0].toByteArray(),P=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),v=[],f=0;f<4;)v.push(parseInt(m[f],10)&parseInt(P[f],10)),f++;return new this(v)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.parse=function(s){let d=this.parser(s);if(d===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(d)},x.IPv4.parseCIDR=function(s){let d;if(d=s.match(/^(.+)\/(\d+)$/)){let f=parseInt(d[2]);if(f>=0&&f<=32){let m=[this.parse(d[1]),f];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")},x.IPv4.parser=function(s){let d,f,m;if(d=s.match(r.fourOctet))return(function(){let v=d.slice(1,6),P=[];for(let j=0;j<v.length;j++)f=v[j],P.push(_(f));return P})();if(d=s.match(r.longValue)){if(m=_(d[1]),m>4294967295||m<0)throw new Error("ipaddr: address outside defined range");return(function(){let v=[],P;for(P=0;P<=24;P+=8)v.push(m>>P&255);return v})().reverse()}else return(d=s.match(r.twoOctet))?(function(){let v=d.slice(1,4),P=[];if(m=_(v[1]),m>16777215||m<0)throw new Error("ipaddr: address outside defined range");return P.push(_(v[0])),P.push(m>>16&255),P.push(m>>8&255),P.push(m&255),P})():(d=s.match(r.threeOctet))?(function(){let v=d.slice(1,5),P=[];if(m=_(v[2]),m>65535||m<0)throw new Error("ipaddr: address outside defined range");return P.push(_(v[0])),P.push(_(v[1])),P.push(m>>8&255),P.push(m&255),P})():null},x.IPv4.subnetMaskFromPrefixLength=function(s){if(s=parseInt(s),s<0||s>32)throw new Error("ipaddr: invalid IPv4 prefix length");let d=[0,0,0,0],f=0,m=Math.floor(s/8);for(;f<m;)d[f]=255,f++;return m<4&&(d[m]=Math.pow(2,s%8)-1<<8-s%8),new this(d)},x.IPv6=(function(){function s(d,f){let m,v;if(d.length===16)for(this.parts=[],m=0;m<=14;m+=2)this.parts.push(d[m]<<8|d[m+1]);else if(d.length===8)this.parts=d;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(m=0;m<this.parts.length;m++)if(v=this.parts[m],!(0<=v&&v<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");f&&(this.zoneId=f)}return o(s,"IPv6"),s.prototype.SpecialRanges={unspecified:[new s([0,0,0,0,0,0,0,0]),128],linkLocal:[new s([65152,0,0,0,0,0,0,0]),10],multicast:[new s([65280,0,0,0,0,0,0,0]),8],loopback:[new s([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new s([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new s([0,0,0,0,0,65535,0,0]),96],discard:[new s([256,0,0,0,0,0,0,0]),64],rfc6145:[new s([0,0,0,0,65535,0,0,0]),96],rfc6052:[new s([100,65435,0,0,0,0,0,0]),96],"6to4":[new s([8194,0,0,0,0,0,0,0]),16],teredo:[new s([8193,0,0,0,0,0,0,0]),32],benchmarking:[new s([8193,2,0,0,0,0,0,0]),48],amt:[new s([8193,3,0,0,0,0,0,0]),32],as112v6:[[new s([8193,4,274,0,0,0,0,0]),48],[new s([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new s([8193,16,0,0,0,0,0,0]),28],orchid2:[new s([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new s([8193,48,0,0,0,0,0,0]),28],reserved:[[new s([8193,0,0,0,0,0,0,0]),23],[new s([8193,3512,0,0,0,0,0,0]),32]]},s.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},s.prototype.kind=function(){return"ipv6"},s.prototype.match=function(d,f){let m;if(f===void 0&&(m=d,d=m[0],f=m[1]),d.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return h(this.parts,d.parts,16,f)},s.prototype.prefixLengthFromSubnetMask=function(){let d=0,f=!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},v,P;for(let j=7;j>=0;j-=1)if(v=this.parts[j],v in m){if(P=m[v],f&&P!==0)return null;P!==16&&(f=!0),d+=P}else return null;return 128-d},s.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},s.prototype.toByteArray=function(){let d,f=[],m=this.parts;for(let v=0;v<m.length;v++)d=m[v],f.push(d>>8),f.push(d&255);return f},s.prototype.toFixedLengthString=function(){let d=(function(){let m=[];for(let v=0;v<this.parts.length;v++)m.push($(this.parts[v].toString(16),4));return m}).call(this).join(":"),f="";return this.zoneId&&(f=`%${this.zoneId}`),d+f},s.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let d=this.parts.slice(-2),f=d[0],m=d[1];return new x.IPv4([f>>8,f&255,m>>8,m&255])},s.prototype.toNormalizedString=function(){let d=(function(){let m=[];for(let v=0;v<this.parts.length;v++)m.push(this.parts[v].toString(16));return m}).call(this).join(":"),f="";return this.zoneId&&(f=`%${this.zoneId}`),d+f},s.prototype.toRFC5952String=function(){let d=/((^|:)(0(:|$)){2,})/g,f=this.toNormalizedString(),m=0,v=-1,P;for(;P=d.exec(f);)P[0].length>v&&(m=P.index,v=P[0].length);return v<0?f:`${f.substring(0,m)}::${f.substring(m+v)}`},s.prototype.toString=function(){return this.toRFC5952String()},s})(),x.IPv6.broadcastAddressFromCIDR=function(s){try{let d=this.parseCIDR(s),f=d[0].toByteArray(),m=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),v=[],P=0;for(;P<16;)v.push(parseInt(f[P],10)|parseInt(m[P],10)^255),P++;return new this(v)}catch(d){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${d})`)}},x.IPv6.isIPv6=function(s){return this.parser(s)!==null},x.IPv6.isValid=function(s){if(typeof s=="string"&&s.indexOf(":")===-1)return!1;try{let d=this.parser(s);return new this(d.parts,d.zoneId),!0}catch{return!1}},x.IPv6.isValidCIDR=function(s){if(typeof s=="string"&&s.indexOf(":")===-1)return!1;try{return this.parseCIDR(s),!0}catch{return!1}},x.IPv6.networkAddressFromCIDR=function(s){let d,f,m,v,P;try{for(d=this.parseCIDR(s),m=d[0].toByteArray(),P=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),v=[],f=0;f<16;)v.push(parseInt(m[f],10)&parseInt(P[f],10)),f++;return new this(v)}catch(j){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${j})`)}},x.IPv6.parse=function(s){let d=this.parser(s);if(d.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(d.parts,d.zoneId)},x.IPv6.parseCIDR=function(s){let d,f,m;if((f=s.match(/^(.+)\/(\d+)$/))&&(d=parseInt(f[2]),d>=0&&d<=128))return m=[this.parse(f[1]),d],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")},x.IPv6.parser=function(s){let d,f,m,v,P,j;if(m=s.match(l.deprecatedTransitional))return this.parser(`::ffff:${m[1]}`);if(l.native.test(s))return y(s,8);if((m=s.match(l.transitional))&&(j=m[6]||"",d=m[1],m[1].endsWith("::")||(d=d.slice(0,-1)),d=y(d+j,6),d.parts)){for(P=[parseInt(m[2]),parseInt(m[3]),parseInt(m[4]),parseInt(m[5])],f=0;f<P.length;f++)if(v=P[f],!(0<=v&&v<=255))return null;return d.parts.push(P[0]<<8|P[1]),d.parts.push(P[2]<<8|P[3]),{parts:d.parts,zoneId:d.zoneId}}return null},x.IPv6.subnetMaskFromPrefixLength=function(s){if(s=parseInt(s),s<0||s>128)throw new Error("ipaddr: invalid IPv6 prefix length");let d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],f=0,m=Math.floor(s/8);for(;f<m;)d[f]=255,f++;return m<16&&(d[m]=Math.pow(2,s%8)-1<<8-s%8),new this(d)},x.fromByteArray=function(s){let d=s.length;if(d===4)return new x.IPv4(s);if(d===16)return new x.IPv6(s);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},x.isValid=function(s){return x.IPv6.isValid(s)||x.IPv4.isValid(s)},x.isValidCIDR=function(s){return x.IPv6.isValidCIDR(s)||x.IPv4.isValidCIDR(s)},x.parse=function(s){if(x.IPv6.isValid(s))return x.IPv6.parse(s);if(x.IPv4.isValid(s))return x.IPv4.parse(s);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},x.parseCIDR=function(s){try{return x.IPv6.parseCIDR(s)}catch{try{return x.IPv4.parseCIDR(s)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},x.process=function(s){let d=this.parse(s);return d.kind()==="ipv6"&&d.isIPv4MappedAddress()?d.toIPv4Address():d},x.subnetMatch=function(s,d,f){let m,v,P,j;f==null&&(f="unicast");for(v in d)if(Object.prototype.hasOwnProperty.call(d,v)){for(P=d[v],P[0]&&!(P[0]instanceof Array)&&(P=[P]),m=0;m<P.length;m++)if(j=P[m],s.kind()===j[0].kind()&&s.match.apply(s,j))return v}return f},typeof Gt<"u"&&Gt.exports?Gt.exports=x:e.ipaddr=x})(jo)});var Bi=E((DA,Fi)=>{var ji=require("stream").Stream,Yp=require("util");Fi.exports=pe;function pe(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}o(pe,"DelayedStream");Yp.inherits(pe,ji);pe.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(pe.prototype,"readable",{configurable:!0,enumerable:!0,get:o(function(){return this.source.readable},"get")});pe.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};pe.prototype.resume=function(){this._released||this.release(),this.source.resume()};pe.prototype.pause=function(){this.source.pause()};pe.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]};pe.prototype.pipe=function(){var e=ji.prototype.pipe.apply(this,arguments);return this.resume(),e};pe.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)};pe.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 Gi=E((UA,Hi)=>{var Qp=require("util"),Zi=require("stream").Stream,Vi=Bi();Hi.exports=X;function X(){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(X,"CombinedStream");Qp.inherits(X,Zi);X.create=function(e){var t=new this;e=e||{};for(var r in e)t[r]=e[r];return t};X.isStreamLike=function(e){return typeof e!="function"&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"&&!Buffer.isBuffer(e)};X.prototype.append=function(e){var t=X.isStreamLike(e);if(t){if(!(e instanceof Vi)){var r=Vi.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};X.prototype.pipe=function(e,t){return Zi.prototype.pipe.call(this,e,t),this.resume(),e};X.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}};X.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=X.isStreamLike(r);n&&(r.on("data",this._checkDataSize.bind(this)),this._handleErrors(r)),this._pipeNext(r)}.bind(this))};X.prototype._pipeNext=function(e){this._currentStream=e;var t=X.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()};X.prototype._handleErrors=function(e){var t=this;e.on("error",function(r){t._emitError(r)})};X.prototype.write=function(e){this.emit("data",e)};X.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function"&&this._currentStream.pause(),this.emit("pause"))};X.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")};X.prototype.end=function(){this._reset(),this.emit("end")};X.prototype.destroy=function(){this._reset(),this.emit("close")};X.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};X.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(e))}};X.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)};X.prototype._emitError=function(e){this._reset(),this.emit("error",e)}});var qi=E((LA,Wi)=>{"use strict";Wi.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 Xi=E(re=>{"use strict";var Xt=qi(),el=require("path").extname,Ki=/^\s*([^;\s]*)(?:;|\s|$)/,tl=/^text\//i;re.charset=Ji;re.charsets={lookup:Ji};re.contentType=rl;re.extension=nl;re.extensions=Object.create(null);re.lookup=ol;re.types=Object.create(null);il(re.extensions,re.types);function Ji(e){if(!e||typeof e!="string")return!1;var t=Ki.exec(e),r=t&&Xt[t[1].toLowerCase()];return r&&r.charset?r.charset:t&&tl.test(t[1])?"UTF-8":!1}o(Ji,"charset");function rl(e){if(!e||typeof e!="string")return!1;var t=e.indexOf("/")===-1?re.lookup(e):e;if(!t)return!1;if(t.indexOf("charset")===-1){var r=re.charset(t);r&&(t+="; charset="+r.toLowerCase())}return t}o(rl,"contentType");function nl(e){if(!e||typeof e!="string")return!1;var t=Ki.exec(e),r=t&&re.extensions[t[1].toLowerCase()];return!r||!r.length?!1:r[0]}o(nl,"extension");function ol(e){if(!e||typeof e!="string")return!1;var t=el("x."+e).toLowerCase().substr(1);return t&&re.types[t]||!1}o(ol,"lookup");function il(e,t){var r=["nginx","apache",void 0,"iana"];Object.keys(Xt).forEach(o(function(i){var u=Xt[i],c=u.extensions;if(!(!c||!c.length)){e[i]=c;for(var l=0;l<c.length;l++){var y=c[l];if(t[y]){var h=r.indexOf(Xt[t[y]].source),_=r.indexOf(u.source);if(t[y]!=="application/octet-stream"&&(h>_||h===_&&t[y].substr(0,12)==="application/"))continue}t[y]=i}}},"forEachMimeType"))}o(il,"populateMaps")});var Qi=E((BA,Yi)=>{Yi.exports=al;function al(e){var t=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;t?t(e):setTimeout(e,0)}o(al,"defer")});var Gr=E((ZA,ta)=>{var ea=Qi();ta.exports=sl;function sl(e){var t=!1;return ea(function(){t=!0}),o(function(n,i){t?e(n,i):ea(o(function(){e(n,i)},"nextTick_callback"))},"async_callback")}o(sl,"async")});var Wr=E((GA,ra)=>{ra.exports=ul;function ul(e){Object.keys(e.jobs).forEach(cl.bind(e)),e.jobs={}}o(ul,"abort");function cl(e){typeof this.jobs[e]=="function"&&this.jobs[e]()}o(cl,"clean")});var qr=E((qA,oa)=>{var na=Gr(),pl=Wr();oa.exports=ll;function ll(e,t,r,n){var i=r.keyedList?r.keyedList[r.index]:r.index;r.jobs[i]=dl(t,i,e[i],function(u,c){i in r.jobs&&(delete r.jobs[i],u?pl(r):r.results[i]=c,n(u,r.results))})}o(ll,"iterate");function dl(e,t,r,n){var i;return e.length==2?i=e(r,na(n)):i=e(r,t,na(n)),i}o(dl,"runJob")});var Kr=E((JA,ia)=>{ia.exports=ml;function ml(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,u){return t(e[i],e[u])}),n}o(ml,"state")});var Jr=E((YA,aa)=>{var fl=Wr(),gl=Gr();aa.exports=yl;function yl(e){Object.keys(this.jobs).length&&(this.index=this.size,fl(this),gl(e)(null,this.results))}o(yl,"terminator")});var ua=E((ez,sa)=>{var hl=qr(),vl=Kr(),xl=Jr();sa.exports=_l;function _l(e,t,r){for(var n=vl(e);n.index<(n.keyedList||e).length;)hl(e,t,n,function(i,u){if(i){r(i,u);return}if(Object.keys(n.jobs).length===0){r(null,n.results);return}}),n.index++;return xl.bind(n,r)}o(_l,"parallel")});var Xr=E((rz,Yt)=>{var ca=qr(),Pl=Kr(),bl=Jr();Yt.exports=Tl;Yt.exports.ascending=pa;Yt.exports.descending=Il;function Tl(e,t,r,n){var i=Pl(e,r);return ca(e,t,i,o(function u(c,l){if(c){n(c,l);return}if(i.index++,i.index<(i.keyedList||e).length){ca(e,t,i,u);return}n(null,i.results)},"iteratorHandler")),bl.bind(i,n)}o(Tl,"serialOrdered");function pa(e,t){return e<t?-1:e>t?1:0}o(pa,"ascending");function Il(e,t){return-1*pa(e,t)}o(Il,"descending")});var da=E((oz,la)=>{var El=Xr();la.exports=$l;function $l(e,t,r){return El(e,t,null,r)}o($l,"serial")});var fa=E((az,ma)=>{ma.exports={parallel:ua(),serial:da(),serialOrdered:Xr()}});var Yr=E((sz,ga)=>{"use strict";ga.exports=Object});var ha=E((uz,ya)=>{"use strict";ya.exports=Error});var xa=E((cz,va)=>{"use strict";va.exports=EvalError});var Pa=E((pz,_a)=>{"use strict";_a.exports=RangeError});var Ta=E((lz,ba)=>{"use strict";ba.exports=ReferenceError});var Ea=E((dz,Ia)=>{"use strict";Ia.exports=SyntaxError});var Qt=E((mz,$a)=>{"use strict";$a.exports=TypeError});var Aa=E((fz,Sa)=>{"use strict";Sa.exports=URIError});var ka=E((gz,za)=>{"use strict";za.exports=Math.abs});var wa=E((yz,Oa)=>{"use strict";Oa.exports=Math.floor});var Na=E((hz,Ra)=>{"use strict";Ra.exports=Math.max});var Ca=E((vz,Da)=>{"use strict";Da.exports=Math.min});var Ma=E((xz,Ua)=>{"use strict";Ua.exports=Math.pow});var ja=E((_z,La)=>{"use strict";La.exports=Math.round});var Ba=E((Pz,Fa)=>{"use strict";Fa.exports=Number.isNaN||o(function(t){return t!==t},"isNaN")});var Za=E((Tz,Va)=>{"use strict";var Sl=Ba();Va.exports=o(function(t){return Sl(t)||t===0?t:t<0?-1:1},"sign")});var Ga=E((Ez,Ha)=>{"use strict";Ha.exports=Object.getOwnPropertyDescriptor});var Qr=E(($z,Wa)=>{"use strict";var er=Ga();if(er)try{er([],"length")}catch{er=null}Wa.exports=er});var Ka=E((Sz,qa)=>{"use strict";var tr=Object.defineProperty||!1;if(tr)try{tr({},"a",{value:1})}catch{tr=!1}qa.exports=tr});var en=E((Az,Ja)=>{"use strict";Ja.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 u 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 c=Object.getOwnPropertySymbols(t);if(c.length!==1||c[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(t,r);if(l.value!==i||l.enumerable!==!0)return!1}return!0},"hasSymbols")});var Qa=E((kz,Ya)=>{"use strict";var Xa=typeof Symbol<"u"&&Symbol,Al=en();Ya.exports=o(function(){return typeof Xa!="function"||typeof Symbol!="function"||typeof Xa("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Al()},"hasNativeSymbols")});var tn=E((wz,es)=>{"use strict";es.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var rn=E((Rz,ts)=>{"use strict";var zl=Yr();ts.exports=zl.getPrototypeOf||null});var os=E((Nz,ns)=>{"use strict";var kl="Function.prototype.bind called on incompatible ",Ol=Object.prototype.toString,wl=Math.max,Rl="[object Function]",rs=o(function(t,r){for(var n=[],i=0;i<t.length;i+=1)n[i]=t[i];for(var u=0;u<r.length;u+=1)n[u+t.length]=r[u];return n},"concatty"),Nl=o(function(t,r){for(var n=[],i=r||0,u=0;i<t.length;i+=1,u+=1)n[u]=t[i];return n},"slicy"),Dl=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");ns.exports=o(function(t){var r=this;if(typeof r!="function"||Ol.apply(r)!==Rl)throw new TypeError(kl+r);for(var n=Nl(arguments,1),i,u=o(function(){if(this instanceof i){var _=r.apply(this,rs(n,arguments));return Object(_)===_?_:this}return r.apply(t,rs(n,arguments))},"binder"),c=wl(0,r.length-n.length),l=[],y=0;y<c;y++)l[y]="$"+y;if(i=Function("binder","return function ("+Dl(l,",")+"){ return binder.apply(this,arguments); }")(u),r.prototype){var h=o(function(){},"Empty");h.prototype=r.prototype,i.prototype=new h,h.prototype=null}return i},"bind")});var We=E((Cz,is)=>{"use strict";var Cl=os();is.exports=Function.prototype.bind||Cl});var rr=E((Uz,as)=>{"use strict";as.exports=Function.prototype.call});var nn=E((Mz,ss)=>{"use strict";ss.exports=Function.prototype.apply});var cs=E((Lz,us)=>{"use strict";us.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var ls=E((jz,ps)=>{"use strict";var Ul=We(),Ml=nn(),Ll=rr(),jl=cs();ps.exports=jl||Ul.call(Ll,Ml)});var ms=E((Fz,ds)=>{"use strict";var Fl=We(),Bl=Qt(),Vl=rr(),Zl=ls();ds.exports=o(function(t){if(t.length<1||typeof t[0]!="function")throw new Bl("a function is required");return Zl(Fl,Vl,t)},"callBindBasic")});var xs=E((Vz,vs)=>{"use strict";var Hl=ms(),fs=Qr(),ys;try{ys=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var on=!!ys&&fs&&fs(Object.prototype,"__proto__"),hs=Object,gs=hs.getPrototypeOf;vs.exports=on&&typeof on.get=="function"?Hl([on.get]):typeof gs=="function"?o(function(t){return gs(t==null?t:hs(t))},"getDunder"):!1});var Is=E((Hz,Ts)=>{"use strict";var _s=tn(),Ps=rn(),bs=xs();Ts.exports=_s?o(function(t){return _s(t)},"getProto"):Ps?o(function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return Ps(t)},"getProto"):bs?o(function(t){return bs(t)},"getProto"):null});var an=E((Wz,Es)=>{"use strict";var Gl=Function.prototype.call,Wl=Object.prototype.hasOwnProperty,ql=We();Es.exports=ql.call(Gl,Wl)});var ws=E((qz,Os)=>{"use strict";var L,Kl=Yr(),Jl=ha(),Xl=xa(),Yl=Pa(),Ql=Ta(),Xe=Ea(),Je=Qt(),ed=Aa(),td=ka(),rd=wa(),nd=Na(),od=Ca(),id=Ma(),ad=ja(),sd=Za(),zs=Function,sn=o(function(e){try{return zs('"use strict"; return ('+e+").constructor;")()}catch{}},"getEvalledConstructor"),bt=Qr(),ud=Ka(),un=o(function(){throw new Je},"throwTypeError"),cd=bt?(function(){try{return arguments.callee,un}catch{try{return bt(arguments,"callee").get}catch{return un}}})():un,qe=Qa()(),ee=Is(),pd=rn(),ld=tn(),ks=nn(),Tt=rr(),Ke={},dd=typeof Uint8Array>"u"||!ee?L:ee(Uint8Array),De={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?L:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?L:ArrayBuffer,"%ArrayIteratorPrototype%":qe&&ee?ee([][Symbol.iterator]()):L,"%AsyncFromSyncIteratorPrototype%":L,"%AsyncFunction%":Ke,"%AsyncGenerator%":Ke,"%AsyncGeneratorFunction%":Ke,"%AsyncIteratorPrototype%":Ke,"%Atomics%":typeof Atomics>"u"?L:Atomics,"%BigInt%":typeof BigInt>"u"?L:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?L:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?L:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?L:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Jl,"%eval%":eval,"%EvalError%":Xl,"%Float16Array%":typeof Float16Array>"u"?L:Float16Array,"%Float32Array%":typeof Float32Array>"u"?L:Float32Array,"%Float64Array%":typeof Float64Array>"u"?L:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?L:FinalizationRegistry,"%Function%":zs,"%GeneratorFunction%":Ke,"%Int8Array%":typeof Int8Array>"u"?L:Int8Array,"%Int16Array%":typeof Int16Array>"u"?L:Int16Array,"%Int32Array%":typeof Int32Array>"u"?L:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":qe&&ee?ee(ee([][Symbol.iterator]())):L,"%JSON%":typeof JSON=="object"?JSON:L,"%Map%":typeof Map>"u"?L:Map,"%MapIteratorPrototype%":typeof Map>"u"||!qe||!ee?L:ee(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Kl,"%Object.getOwnPropertyDescriptor%":bt,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?L:Promise,"%Proxy%":typeof Proxy>"u"?L:Proxy,"%RangeError%":Yl,"%ReferenceError%":Ql,"%Reflect%":typeof Reflect>"u"?L:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?L:Set,"%SetIteratorPrototype%":typeof Set>"u"||!qe||!ee?L:ee(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?L:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":qe&&ee?ee(""[Symbol.iterator]()):L,"%Symbol%":qe?Symbol:L,"%SyntaxError%":Xe,"%ThrowTypeError%":cd,"%TypedArray%":dd,"%TypeError%":Je,"%Uint8Array%":typeof Uint8Array>"u"?L:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?L:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?L:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?L:Uint32Array,"%URIError%":ed,"%WeakMap%":typeof WeakMap>"u"?L:WeakMap,"%WeakRef%":typeof WeakRef>"u"?L:WeakRef,"%WeakSet%":typeof WeakSet>"u"?L:WeakSet,"%Function.prototype.call%":Tt,"%Function.prototype.apply%":ks,"%Object.defineProperty%":ud,"%Object.getPrototypeOf%":pd,"%Math.abs%":td,"%Math.floor%":rd,"%Math.max%":nd,"%Math.min%":od,"%Math.pow%":id,"%Math.round%":ad,"%Math.sign%":sd,"%Reflect.getPrototypeOf%":ld};if(ee)try{null.error}catch(e){$s=ee(ee(e)),De["%Error.prototype%"]=$s}var $s,md=o(function e(t){var r;if(t==="%AsyncFunction%")r=sn("async function () {}");else if(t==="%GeneratorFunction%")r=sn("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=sn("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&ee&&(r=ee(i.prototype))}return De[t]=r,r},"doEval"),Ss={__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"]},It=We(),nr=an(),fd=It.call(Tt,Array.prototype.concat),gd=It.call(ks,Array.prototype.splice),As=It.call(Tt,String.prototype.replace),or=It.call(Tt,String.prototype.slice),yd=It.call(Tt,RegExp.prototype.exec),hd=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,vd=/\\(\\)?/g,xd=o(function(t){var r=or(t,0,1),n=or(t,-1);if(r==="%"&&n!=="%")throw new Xe("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Xe("invalid intrinsic syntax, expected opening `%`");var i=[];return As(t,hd,function(u,c,l,y){i[i.length]=l?As(y,vd,"$1"):c||u}),i},"stringToPath"),_d=o(function(t,r){var n=t,i;if(nr(Ss,n)&&(i=Ss[n],n="%"+i[0]+"%"),nr(De,n)){var u=De[n];if(u===Ke&&(u=md(n)),typeof u>"u"&&!r)throw new Je("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:u}}throw new Xe("intrinsic "+t+" does not exist!")},"getBaseIntrinsic");Os.exports=o(function(t,r){if(typeof t!="string"||t.length===0)throw new Je("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Je('"allowMissing" argument must be a boolean');if(yd(/^%?[^%]*%?$/,t)===null)throw new Xe("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=xd(t),i=n.length>0?n[0]:"",u=_d("%"+i+"%",r),c=u.name,l=u.value,y=!1,h=u.alias;h&&(i=h[0],gd(n,fd([0,1],h)));for(var _=1,$=!0;_<n.length;_+=1){var x=n[_],s=or(x,0,1),d=or(x,-1);if((s==='"'||s==="'"||s==="`"||d==='"'||d==="'"||d==="`")&&s!==d)throw new Xe("property names with quotes must have matching quotes");if((x==="constructor"||!$)&&(y=!0),i+="."+x,c="%"+i+"%",nr(De,c))l=De[c];else if(l!=null){if(!(x in l)){if(!r)throw new Je("base intrinsic for "+t+" exists, but the property is not available.");return}if(bt&&_+1>=n.length){var f=bt(l,x);$=!!f,$&&"get"in f&&!("originalValue"in f.get)?l=f.get:l=l[x]}else $=nr(l,x),l=l[x];$&&!y&&(De[c]=l)}}return l},"GetIntrinsic")});var Ns=E((Jz,Rs)=>{"use strict";var Pd=en();Rs.exports=o(function(){return Pd()&&!!Symbol.toStringTag},"hasToStringTagShams")});var Us=E((Yz,Cs)=>{"use strict";var bd=ws(),Ds=bd("%Object.defineProperty%",!0),Td=Ns()(),Id=an(),Ed=Qt(),ir=Td?Symbol.toStringTag:null;Cs.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 Ed("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");ir&&(n||!Id(t,ir))&&(Ds?Ds(t,ir,{configurable:!i,enumerable:!1,value:r,writable:!1}):t[ir]=r)},"setToStringTag")});var Ls=E((ek,Ms)=>{"use strict";var $d=Function.prototype.call,Sd=Object.prototype.hasOwnProperty,Ad=We();Ms.exports=Ad.call($d,Sd)});var Fs=E((tk,js)=>{"use strict";js.exports=function(e,t){return Object.keys(t).forEach(function(r){e[r]=e[r]||t[r]}),e}});var Zs=E((rk,Vs)=>{"use strict";var dn=Gi(),zd=require("util"),cn=require("path"),kd=require("http"),Od=require("https"),wd=require("url").parse,Rd=require("fs"),Nd=require("stream").Stream,Dd=require("crypto"),pn=Xi(),Cd=fa(),Ud=Us(),Oe=Ls(),ln=Fs();function Bs(e){return String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22")}o(Bs,"escapeHeaderParam");function F(e){if(!(this instanceof F))return new F(e);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],dn.call(this),e=e||{};for(var t in e)this[t]=e[t]}o(F,"FormData");zd.inherits(F,dn);F.LINE_BREAK=`\r
|
|
2
|
+
`;F.DEFAULT_CONTENT_TYPE="application/octet-stream";F.prototype.append=function(e,t,r){r=r||{},typeof r=="string"&&(r={filename:r});var n=dn.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),u=this._multiPartFooter();n(i),n(t),n(u),this._trackLength(i,t,r)};F.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)+F.LINE_BREAK.length,!(!t||!t.path&&!(t.readable&&Oe(t,"httpVersion"))&&!(t instanceof Nd))&&(r.knownLength||this._valuesToMeasure.push(t))};F.prototype._lengthRetriever=function(e,t){Oe(e,"fd")?e.end!=null&&e.end!=1/0&&e.start!=null?t(null,e.end+1-(e.start?e.start:0)):Rd.stat(e.path,function(r,n){if(r){t(r);return}var i=n.size-(e.start?e.start:0);t(null,i)}):Oe(e,"httpVersion")?t(null,Number(e.headers["content-length"])):Oe(e,"httpModule")?(e.on("response",function(r){e.pause(),t(null,Number(r.headers["content-length"]))}),e.resume()):t("Unknown stream")};F.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),u="",c={"Content-Disposition":["form-data",'name="'+Bs(e)+'"'].concat(n||[]),"Content-Type":[].concat(i||[])};typeof r.header=="object"&&ln(c,r.header);var l;for(var y in c)if(Oe(c,y)){if(l=c[y],l==null)continue;Array.isArray(l)||(l=[l]),l.length&&(u+=y+": "+l.join("; ")+F.LINE_BREAK)}return"--"+this.getBoundary()+F.LINE_BREAK+u+F.LINE_BREAK};F.prototype._getContentDisposition=function(e,t){var r;if(typeof t.filepath=="string"?r=cn.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e&&(e.name||e.path)?r=cn.basename(t.filename||e&&(e.name||e.path)):e&&e.readable&&Oe(e,"httpVersion")&&(r=cn.basename(e.client._httpMessage.path||"")),r)return'filename="'+Bs(r)+'"'};F.prototype._getContentType=function(e,t){var r=t.contentType;return!r&&e&&e.name&&(r=pn.lookup(e.name)),!r&&e&&e.path&&(r=pn.lookup(e.path)),!r&&e&&e.readable&&Oe(e,"httpVersion")&&(r=e.headers["content-type"]),!r&&(t.filepath||t.filename)&&(r=pn.lookup(t.filepath||t.filename)),!r&&e&&typeof e=="object"&&(r=F.DEFAULT_CONTENT_TYPE),r};F.prototype._multiPartFooter=function(){return function(e){var t=F.LINE_BREAK,r=this._streams.length===0;r&&(t+=this._lastBoundary()),e(t)}.bind(this)};F.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+F.LINE_BREAK};F.prototype.getHeaders=function(e){var t,r={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)Oe(e,t)&&(r[t.toLowerCase()]=e[t]);return r};F.prototype.setBoundary=function(e){if(typeof e!="string")throw new TypeError("FormData boundary must be a string");this._boundary=e};F.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};F.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(F.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])};F.prototype._generateBoundary=function(){this._boundary="--------------------------"+Dd.randomBytes(12).toString("hex")};F.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};F.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e};F.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}Cd.parallel(this._valuesToMeasure,this._lengthRetriever,function(r,n){if(r){e(r);return}n.forEach(function(i){t+=i}),e(null,t)})};F.prototype.submit=function(e,t){var r,n,i={method:"post"};return typeof e=="string"?(e=wd(e),n=ln({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},i)):(n=ln(e,i),n.port||(n.port=n.protocol==="https:"?443:80)),n.headers=this.getHeaders(e.headers),n.protocol==="https:"?r=Od.request(n):r=kd.request(n),this.getLength(function(u,c){if(u&&u!=="Unknown stream"){this._error(u);return}if(c&&r.setHeader("Content-Length",c),this.pipe(r),t){var l,y=o(function(h,_){return r.removeListener("error",y),r.removeListener("response",l),t.call(this,h,_)},"callback");l=y.bind(this,null),r.on("error",y),r.on("response",l)}}.bind(this)),r};F.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))};F.prototype.toString=function(){return"[object FormData]"};Ud(F.prototype,"FormData");Vs.exports=F});var em={};yn(em,{promotekit:()=>Qd,promotekitAuth:()=>M});module.exports=yu(em);var hu=Object.freeze({status:"aborted"});function T(e,t,r){function n(l,y){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:y,constr:c,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,y);let h=c.prototype,_=Object.keys(h);for(let $=0;$<_.length;$++){let x=_[$];x in l||(l[x]=h[x].bind(l))}}o(n,"init");let i=r?.Parent??Object;class u extends i{static{o(this,"Definition")}}Object.defineProperty(u,"name",{value:e});function c(l){var y;let h=r?.Parent?new u:this;n(h,l),(y=h._zod).deferred??(y.deferred=[]);for(let _ of h._zod.deferred)_();return h}return o(c,"_"),Object.defineProperty(c,"init",{value:n}),Object.defineProperty(c,Symbol.hasInstance,{value:o(l=>r?.Parent&&l instanceof r.Parent?!0:l?._zod?.traits?.has(e),"value")}),Object.defineProperty(c,"name",{value:e}),c}o(T,"$constructor");var le=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},$t=class extends Error{static{o(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},sr={};function ye(e){return e&&Object.assign(sr,e),sr}o(ye,"config");function cr(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(cr,"getEnumValues");function xn(e,t){return typeof t=="bigint"?t.toString():t}o(xn,"jsonStringifyReplacer");function At(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}o(At,"cached");function _n(e){return e==null}o(_n,"nullish");function zt(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}o(zt,"cleanRegex");var vn=Symbol("evaluating");function Y(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==vn)return n===void 0&&(n=vn,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}o(Y,"defineLazy");var pr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function et(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(et,"isObject");var vu=At(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Pn(e){if(et(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(et(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}o(Pn,"isPlainObject");var bn=new Set(["string","number","symbol"]);function Ue(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(Ue,"escapeRegex");function kt(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}o(kt,"clone");function W(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(W,"normalizeParams");function Tn(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}o(Tn,"optionalKeys");var In={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 Me(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(Me,"aborted");function Te(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}o(Te,"prefixIssues");function St(e){return typeof e=="string"?e:e?.message}o(St,"unwrapMessage");function Ie(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=St(e.inst?._zod.def?.error?.(e))??St(t?.error?.(e))??St(r.customError?.(e))??St(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}o(Ie,"finalizeIssue");function En(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}o(En,"getLengthableOrigin");function lr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}o(lr,"issue");var $n=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,xn,2),Object.defineProperty(e,"toString",{value:o(()=>e.message,"value"),enumerable:!1})},"initializer"),Sn=T("$ZodError",$n),tt=T("$ZodError",$n,{Parent:Error});var _u=o(e=>(t,r,n,i)=>{let u=n?Object.assign(n,{async:!1}):{async:!1},c=t._zod.run({value:r,issues:[]},u);if(c instanceof Promise)throw new le;if(c.issues.length){let l=new(i?.Err??e)(c.issues.map(y=>Ie(y,u,ye())));throw pr(l,i?.callee),l}return c.value},"_parse"),Ot=_u(tt),Pu=o(e=>async(t,r,n,i)=>{let u=n?Object.assign(n,{async:!0}):{async:!0},c=t._zod.run({value:r,issues:[]},u);if(c instanceof Promise&&(c=await c),c.issues.length){let l=new(i?.Err??e)(c.issues.map(y=>Ie(y,u,ye())));throw pr(l,i?.callee),l}return c.value},"_parseAsync"),wt=Pu(tt),bu=o(e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},u=t._zod.run({value:r,issues:[]},i);if(u instanceof Promise)throw new le;return u.issues.length?{success:!1,error:new(e??Sn)(u.issues.map(c=>Ie(c,i,ye())))}:{success:!0,data:u.value}},"_safeParse"),rt=bu(tt),Tu=o(e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},u=t._zod.run({value:r,issues:[]},i);return u instanceof Promise&&(u=await u),u.issues.length?{success:!1,error:new e(u.issues.map(c=>Ie(c,i,ye())))}:{success:!0,data:u.value}},"_safeParseAsync"),nt=Tu(tt);var Iu="(?:(?:\\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])))",Eu=new RegExp(`^${Iu}$`);var An=o(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),zn=/^-?\d+n?$/,kn=/^-?\d+$/,dr=/^-?\d+(?:\.\d+)?$/,On=/^(?:true|false)$/i;var Ee=T("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),$u={number:"number",bigint:"bigint",object:"date"};var wn=T("$ZodCheckGreaterThan",(e,t)=>{Ee.init(e,t);let r=$u[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,u=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>u&&(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 Rn=T("$ZodCheckNumberFormat",(e,t)=>{Ee.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,u]=In[t.format];e._zod.onattach.push(c=>{let l=c._zod.bag;l.format=t.format,l.minimum=i,l.maximum=u,r&&(l.pattern=kn)}),e._zod.check=c=>{let l=c.value;if(r){if(!Number.isInteger(l)){c.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?c.issues.push({input:l,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}):c.issues.push({input:l,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}}l<i&&c.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),l>u&&c.issues.push({origin:"number",input:l,code:"too_big",maximum:u,inclusive:!0,inst:e,continue:!t.abort})}});var Nn=T("$ZodCheckMinLength",(e,t)=>{var r;Ee.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!_n(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 c=En(i);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}});var mr=T("$ZodCheckStringFormat",(e,t)=>{var r,n;Ee.init(e,t),e._zod.onattach.push(i=>{let u=i._zod.bag;u.format=t.format,t.pattern&&(u.patterns??(u.patterns=new Set),u.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=()=>{})}),Dn=T("$ZodCheckRegex",(e,t)=>{mr.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 Un={major:4,minor:3,patch:6};var K=T("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Un;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let u of i._zod.onattach)u(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((c,l,y)=>{let h=Me(c),_;for(let $ of l){if($._zod.def.when){if(!$._zod.def.when(c))continue}else if(h)continue;let x=c.issues.length,s=$._zod.check(c);if(s instanceof Promise&&y?.async===!1)throw new le;if(_||s instanceof Promise)_=(_??Promise.resolve()).then(async()=>{await s,c.issues.length!==x&&(h||(h=Me(c,x)))});else{if(c.issues.length===x)continue;h||(h=Me(c,x))}}return _?_.then(()=>c):c},"runChecks"),u=o((c,l,y)=>{if(Me(c))return c.aborted=!0,c;let h=i(l,n,y);if(h instanceof Promise){if(y.async===!1)throw new le;return h.then(_=>e._zod.parse(_,y))}return e._zod.parse(h,y)},"handleCanaryResult");e._zod.run=(c,l)=>{if(l.skipChecks)return e._zod.parse(c,l);if(l.direction==="backward"){let h=e._zod.parse({value:c.value,issues:[]},{...l,skipChecks:!0});return h instanceof Promise?h.then(_=>u(_,c,l)):u(h,c,l)}let y=e._zod.parse(c,l);if(y instanceof Promise){if(l.async===!1)throw new le;return y.then(h=>i(h,n,l))}return i(y,n,l)}}Y(e,"~standard",()=>({validate:o(i=>{try{let u=rt(e,i);return u.success?{value:u.data}:{issues:u.error?.issues}}catch{return nt(e,i).then(c=>c.success?{value:c.data}:{issues:c.error?.issues})}},"validate"),vendor:"zod",version:1}))}),Dt=T("$ZodString",(e,t)=>{K.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??An(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}}),fr=T("$ZodStringFormat",(e,t)=>{mr.init(e,t),Dt.init(e,t)});var Bn=T("$ZodURL",(e,t)=>{fr.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 gr=T("$ZodNumber",(e,t)=>{K.init(e,t),e._zod.pattern=e._zod.bag.pattern??dr,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 u=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,...u?{received:u}:{}}),r}}),Vn=T("$ZodNumberFormat",(e,t)=>{Rn.init(e,t),gr.init(e,t)}),yr=T("$ZodBoolean",(e,t)=>{K.init(e,t),e._zod.pattern=On,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}}),Zn=T("$ZodBigInt",(e,t)=>{K.init(e,t),e._zod.pattern=zn,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 Hn=T("$ZodAny",(e,t)=>{K.init(e,t),e._zod.parse=r=>r}),Gn=T("$ZodUnknown",(e,t)=>{K.init(e,t),e._zod.parse=r=>r});var Wn=T("$ZodVoid",(e,t)=>{K.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}}),qn=T("$ZodDate",(e,t)=>{K.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,u=i instanceof Date;return u&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...u?{received:"Invalid Date"}:{},inst:e}),r}});function Mn(e,t,r){e.issues.length&&t.issues.push(...Te(r,e.issues)),t.value[r]=e.value}o(Mn,"handleArrayResult");var Kn=T("$ZodArray",(e,t)=>{K.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 u=[];for(let c=0;c<i.length;c++){let l=i[c],y=t.element._zod.run({value:l,issues:[]},n);y instanceof Promise?u.push(y.then(h=>Mn(h,r,c))):Mn(y,r,c)}return u.length?Promise.all(u).then(()=>r):r}});function Nt(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...Te(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}o(Nt,"handlePropertyResult");function Su(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=Tn(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}o(Su,"normalizeDef");function Au(e,t,r,n,i,u){let c=[],l=i.keySet,y=i.catchall._zod,h=y.def.type,_=y.optout==="optional";for(let $ in t){if(l.has($))continue;if(h==="never"){c.push($);continue}let x=y.run({value:t[$],issues:[]},n);x instanceof Promise?e.push(x.then(s=>Nt(s,r,$,t,_))):Nt(x,r,$,t,_)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:u}),e.length?Promise.all(e).then(()=>r):r}o(Au,"handleCatchall");var Jn=T("$ZodObject",(e,t)=>{if(K.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let l=t.shape;Object.defineProperty(t,"shape",{get:o(()=>{let y={...l};return Object.defineProperty(t,"shape",{value:y}),y},"get")})}let n=At(()=>Su(t));Y(e._zod,"propValues",()=>{let l=t.shape,y={};for(let h in l){let _=l[h]._zod;if(_.values){y[h]??(y[h]=new Set);for(let $ of _.values)y[h].add($)}}return y});let i=et,u=t.catchall,c;e._zod.parse=(l,y)=>{c??(c=n.value);let h=l.value;if(!i(h))return l.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),l;l.value={};let _=[],$=c.shape;for(let x of c.keys){let s=$[x],d=s._zod.optout==="optional",f=s._zod.run({value:h[x],issues:[]},y);f instanceof Promise?_.push(f.then(m=>Nt(m,l,x,h,d))):Nt(f,l,x,h,d)}return u?Au(_,h,l,y,n.value,e):_.length?Promise.all(_).then(()=>l):l}});function Ln(e,t,r,n){for(let u of e)if(u.issues.length===0)return t.value=u.value,t;let i=e.filter(u=>!Me(u));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(u=>u.issues.map(c=>Ie(c,n,ye())))}),t)}o(Ln,"handleUnionResults");var hr=T("$ZodUnion",(e,t)=>{K.init(e,t),Y(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),Y(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),Y(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),Y(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){let i=t.options.map(u=>u._zod.pattern);return new RegExp(`^(${i.map(u=>zt(u.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,u)=>{if(r)return n(i,u);let c=!1,l=[];for(let y of t.options){let h=y._zod.run({value:i.value,issues:[]},u);if(h instanceof Promise)l.push(h),c=!0;else{if(h.issues.length===0)return h;l.push(h)}}return c?Promise.all(l).then(y=>Ln(y,i,e,u)):Ln(l,i,e,u)}});var Xn=T("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,hr.init(e,t);let r=e._zod.parse;Y(e._zod,"propValues",()=>{let i={};for(let u of t.options){let c=u._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(let[l,y]of Object.entries(c)){i[l]||(i[l]=new Set);for(let h of y)i[l].add(h)}}return i});let n=At(()=>{let i=t.options,u=new Map;for(let c of i){let l=c._zod.propValues?.[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(c)}"`);for(let y of l){if(u.has(y))throw new Error(`Duplicate discriminator value "${String(y)}"`);u.set(y,c)}}return u});e._zod.parse=(i,u)=>{let c=i.value;if(!et(c))return i.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),i;let l=n.value.get(c?.[t.discriminator]);return l?l._zod.run(i,u):t.unionFallback?r(i,u):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:c,path:[t.discriminator],inst:e}),i)}});var Yn=T("$ZodRecord",(e,t)=>{K.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Pn(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let u=[],c=t.keyType._zod.values;if(c){r.value={};let l=new Set;for(let h of c)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){l.add(typeof h=="number"?h.toString():h);let _=t.valueType._zod.run({value:i[h],issues:[]},n);_ instanceof Promise?u.push(_.then($=>{$.issues.length&&r.issues.push(...Te(h,$.issues)),r.value[h]=$.value})):(_.issues.length&&r.issues.push(...Te(h,_.issues)),r.value[h]=_.value)}let y;for(let h in i)l.has(h)||(y=y??[],y.push(h));y&&y.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:y})}else{r.value={};for(let l of Reflect.ownKeys(i)){if(l==="__proto__")continue;let y=t.keyType._zod.run({value:l,issues:[]},n);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&dr.test(l)&&y.issues.length){let $=t.keyType._zod.run({value:Number(l),issues:[]},n);if($ instanceof Promise)throw new Error("Async schemas not supported in object keys currently");$.issues.length===0&&(y=$)}if(y.issues.length){t.mode==="loose"?r.value[l]=i[l]:r.issues.push({code:"invalid_key",origin:"record",issues:y.issues.map($=>Ie($,n,ye())),input:l,path:[l],inst:e});continue}let _=t.valueType._zod.run({value:i[l],issues:[]},n);_ instanceof Promise?u.push(_.then($=>{$.issues.length&&r.issues.push(...Te(l,$.issues)),r.value[y.value]=$.value})):(_.issues.length&&r.issues.push(...Te(l,_.issues)),r.value[y.value]=_.value)}}return u.length?Promise.all(u).then(()=>r):r}});var Qn=T("$ZodEnum",(e,t)=>{K.init(e,t);let r=cr(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>bn.has(typeof i)).map(i=>typeof i=="string"?Ue(i):i.toString()).join("|")})$`),e._zod.parse=(i,u)=>{let c=i.value;return n.has(c)||i.issues.push({code:"invalid_value",values:r,input:c,inst:e}),i}}),eo=T("$ZodLiteral",(e,t)=>{if(K.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"?Ue(n):n?Ue(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let u=n.value;return r.has(u)||n.issues.push({code:"invalid_value",values:t.values,input:u,inst:e}),n}});var to=T("$ZodTransform",(e,t)=>{K.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new $t(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(c=>(r.value=c,r));if(i instanceof Promise)throw new le;return r.value=i,r}});function jn(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}o(jn,"handleOptionalResult");var ro=T("$ZodOptional",(e,t)=>{K.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Y(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Y(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${zt(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(u=>jn(u,r.value)):jn(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var no=T("$ZodNullable",(e,t)=>{K.init(e,t),Y(e._zod,"optin",()=>t.innerType._zod.optin),Y(e._zod,"optout",()=>t.innerType._zod.optout),Y(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${zt(r.source)}|null)$`):void 0}),Y(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 oo=T("$ZodPipe",(e,t)=>{K.init(e,t),Y(e._zod,"values",()=>t.in._zod.values),Y(e._zod,"optin",()=>t.in._zod.optin),Y(e._zod,"optout",()=>t.out._zod.optout),Y(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let u=t.out._zod.run(r,n);return u instanceof Promise?u.then(c=>Rt(c,t.in,n)):Rt(u,t.in,n)}let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(u=>Rt(u,t.out,n)):Rt(i,t.out,n)}});function Rt(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}o(Rt,"handlePipeResult");var io=T("$ZodCustom",(e,t)=>{Ee.init(e,t),K.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(u=>Fn(u,r,n,e));Fn(i,r,n,e)}});function Fn(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(lr(i))}}o(Fn,"handleRefineResult");var so;var vr=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 vr}o(uo,"registry");(so=globalThis).__zod_globalRegistry??(so.__zod_globalRegistry=uo());var xr=globalThis.__zod_globalRegistry;function co(e,t){return new e({type:"string",...W(t)})}o(co,"_string");function po(e,t){return new e({type:"string",coerce:!0,...W(t)})}o(po,"_coercedString");function lo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...W(t)})}o(lo,"_url");function mo(e,t){return new e({type:"number",checks:[],...W(t)})}o(mo,"_number");function fo(e,t){return new e({type:"number",coerce:!0,checks:[],...W(t)})}o(fo,"_coercedNumber");function go(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...W(t)})}o(go,"_int");function yo(e,t){return new e({type:"boolean",...W(t)})}o(yo,"_boolean");function ho(e,t){return new e({type:"boolean",coerce:!0,...W(t)})}o(ho,"_coercedBoolean");function vo(e,t){return new e({type:"bigint",coerce:!0,...W(t)})}o(vo,"_coercedBigint");function xo(e){return new e({type:"any"})}o(xo,"_any");function _o(e){return new e({type:"unknown"})}o(_o,"_unknown");function Po(e,t){return new e({type:"void",...W(t)})}o(Po,"_void");function bo(e,t){return new e({type:"date",coerce:!0,...W(t)})}o(bo,"_coercedDate");function Ct(e,t){return new wn({check:"greater_than",...W(t),value:e,inclusive:!0})}o(Ct,"_gte");function ce(e,t){return new Nn({check:"min_length",...W(t),minimum:e})}o(ce,"_minLength");function $e(e,t){return new Dn({check:"string_format",format:"regex",...W(t),pattern:e})}o($e,"_regex");function To(e,t,r){let n=W(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}o(To,"_custom");var Q=T("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");K.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>Ot(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>rt(e,r,n),e.parseAsync=async(r,n)=>wt(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>nt(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)=>kt(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),Mt=T("ZodMiniString",(e,t)=>{Dt.init(e,t),Q.init(e,t)});function a(e){return co(Mt,e)}o(a,"string");var Io=T("ZodMiniStringFormat",(e,t)=>{fr.init(e,t),Mt.init(e,t)});var Fu=T("ZodMiniURL",(e,t)=>{Bn.init(e,t),Io.init(e,t)});function Eo(e){return lo(Fu,e)}o(Eo,"url");var Lt=T("ZodMiniNumber",(e,t)=>{gr.init(e,t),Q.init(e,t)});function te(e){return mo(Lt,e)}o(te,"number");var Bu=T("ZodMiniNumberFormat",(e,t)=>{Vn.init(e,t),Lt.init(e,t)});function $o(e){return go(Bu,e)}o($o,"int");var _r=T("ZodMiniBoolean",(e,t)=>{yr.init(e,t),Q.init(e,t)});function H(e){return yo(_r,e)}o(H,"boolean");var So=T("ZodMiniBigInt",(e,t)=>{Zn.init(e,t),Q.init(e,t)});var Vu=T("ZodMiniAny",(e,t)=>{Hn.init(e,t),Q.init(e,t)});function it(){return xo(Vu)}o(it,"any");var Zu=T("ZodMiniUnknown",(e,t)=>{Gn.init(e,t),Q.init(e,t)});function O(){return _o(Zu)}o(O,"unknown");var Hu=T("ZodMiniVoid",(e,t)=>{Wn.init(e,t),Q.init(e,t)});function Ao(e){return Po(Hu,e)}o(Ao,"_void");var zo=T("ZodMiniDate",(e,t)=>{qn.init(e,t),Q.init(e,t)});var Gu=T("ZodMiniArray",(e,t)=>{Kn.init(e,t),Q.init(e,t)});function N(e,t){return new Gu({type:"array",element:e,...W(t)})}o(N,"array");var Wu=T("ZodMiniObject",(e,t)=>{Jn.init(e,t),Q.init(e,t),Y(e,"shape",()=>t.shape)});function p(e,t){let r={type:"object",shape:e??{},...W(t)};return new Wu(r)}o(p,"object");var qu=T("ZodMiniUnion",(e,t)=>{hr.init(e,t),Q.init(e,t)});function D(e,t){return new qu({type:"union",options:e,...W(t)})}o(D,"union");var Ku=T("ZodMiniDiscriminatedUnion",(e,t)=>{Xn.init(e,t),Q.init(e,t)});function Se(e,t,r){return new Ku({type:"union",options:t,discriminator:e,...W(r)})}o(Se,"discriminatedUnion");var Ju=T("ZodMiniRecord",(e,t)=>{Yn.init(e,t),Q.init(e,t)});function w(e,t,r){return new Ju({type:"record",keyType:e,valueType:t,...W(r)})}o(w,"record");var Xu=T("ZodMiniEnum",(e,t)=>{Qn.init(e,t),Q.init(e,t),e.options=Object.values(t.entries)});function U(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Xu({type:"enum",entries:r,...W(t)})}o(U,"_enum");var Yu=T("ZodMiniLiteral",(e,t)=>{eo.init(e,t),Q.init(e,t)});function S(e,t){return new Yu({type:"literal",values:Array.isArray(e)?e:[e],...W(t)})}o(S,"literal");var Qu=T("ZodMiniTransform",(e,t)=>{to.init(e,t),Q.init(e,t)});function Ae(e){return new Qu({type:"transform",transform:e})}o(Ae,"transform");var ec=T("ZodMiniOptional",(e,t)=>{ro.init(e,t),Q.init(e,t)});function g(e){return new ec({type:"optional",innerType:e})}o(g,"optional");var tc=T("ZodMiniNullable",(e,t)=>{no.init(e,t),Q.init(e,t)});function at(e){return new tc({type:"nullable",innerType:e})}o(at,"nullable");var rc=T("ZodMiniPipe",(e,t)=>{oo.init(e,t),Q.init(e,t)});function ze(e,t){return new rc({type:"pipe",in:e,out:t})}o(ze,"pipe");var nc=T("ZodMiniCustom",(e,t)=>{io.init(e,t),Q.init(e,t)});function jt(e,t){return To(nc,e??(()=>!0),t)}o(jt,"custom");var st={};yn(st,{bigint:()=>cc,boolean:()=>uc,date:()=>pc,number:()=>sc,string:()=>ac});function ac(e){return po(Mt,e)}o(ac,"string");function sc(e){return fo(Lt,e)}o(sc,"number");function uc(e){return ho(_r,e)}o(uc,"boolean");function cc(e){return vo(So,e)}o(cc,"bigint");function pc(e){return bo(zo,e)}o(pc,"date");var br=p({retryOnFailure:p({defaultValue:g(H()),hide:g(H())}),continueOnFailure:p({defaultValue:g(H()),hide:g(H())})}),Pr=class{constructor(t,r,n,i,u,c,l,y,h,_,$){this.name=t;this.displayName=r;this.description=n;this.props=i;this.run=u;this.test=c;this.requireAuth=l;this.errorHandlingOptions=y;this.outputSchema=h;this.audience=_;this.aiMetadata=$}static{o(this,"IAction")}},G=o(e=>new Pr(e.name,e.displayName,e.description,e.props,e.run,e.test??e.run,e.requireAuth??!0,e.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},e.outputSchema,e.audience,e.aiMetadata),"createAction");var Z=p({displayName:a(),description:g(a())}),C=o((e,t)=>p({type:S(t),required:H(),defaultValue:g(it())}),"TPropertyValue");var oe=p({...Z.shape,...C(a(),"SHORT_TEXT").shape}),he=p({...Z.shape,...C(a(),"LONG_TEXT").shape});var Oo=p({label:a(),value:O()}),Ft=p({disabled:g(H()),placeholder:g(a()),options:N(Oo)});var ie=p({...Z.shape,options:Ft,...C(O(),"STATIC_DROPDOWN").shape}),ve=p({...Z.shape,options:Ft,...C(N(O()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var Tr=p({...Z.shape,...C(O(),"DROPDOWN").shape,refreshers:N(a())}),ut=p({...Z.shape,...C(N(O()),"MULTI_SELECT_DROPDOWN").shape,refreshers:N(a())});var xe=p({...Z.shape,...C(H(),"CHECKBOX").shape});var _e=p({...Z.shape,...C(te(),"NUMBER").shape});var ct=p({...Z.shape,streaming:g(H()),...C(O(),"FILE").shape});var pt=p({...Z.shape,...C(a(),"DATE_TIME").shape});var wo=w(a(),D([oe,he,ie,ut,ve,xe,_e,ct,pt])),lt=p({...Z.shape,properties:wo,...C(N(O()),"ARRAY").shape});var dt=p({...Z.shape,...C(D([w(a(),O())]),"JSON").shape});var Ro=D([oe,ie,dt,lt,ve]),dc=w(a(),Ro),Ir=p({refreshers:N(a()),...Z.shape,...C(O(),"DYNAMIC").shape});var Bt=p({...Z.shape,...C(Ao(),"MARKDOWN").shape});var mt=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(mt||{}),Le=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(Le||{}),je=(v=>(v.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",v.COMMUNICATION="COMMUNICATION",v.COMMERCE="COMMERCE",v.CORE="CORE",v.UNIVERSAL_AI="UNIVERSAL_AI",v.FLOW_CONTROL="FLOW_CONTROL",v.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",v.ACCOUNTING="ACCOUNTING",v.PRODUCTIVITY="PRODUCTIVITY",v.CONTENT_AND_FILES="CONTENT_AND_FILES",v.DEVELOPER_TOOLS="DEVELOPER_TOOLS",v.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",v.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",v.HUMAN_RESOURCES="HUMAN_RESOURCES",v.PAYMENT_PROCESSING="PAYMENT_PROCESSING",v.MARKETING="MARKETING",v.SALES_AND_CRM="SALES_AND_CRM",v))(je||{});var ft=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(ft||{}),Er="both_client_credentials_and_authorization_code";var de=(i=>(i.POLLING="POLLING",i.WEBHOOK="WEBHOOK",i.APP_WEBHOOK="APP_WEBHOOK",i.MANUAL="MANUAL",i))(de||{}),gt=(u=>(u.NONE="NONE",u.HEADER_PRESENT="HEADER_PRESENT",u.QUERY_PRESENT="QUERY_PRESENT",u.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",u.HEAD_REQUEST="HEAD_REQUEST",u))(gt||{}),mc=p({strategy:U(gt),paramName:g(a())}),yt=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(yt||{});var Vt=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(Vt||{}),No=p({status:g(te()),body:g(O()),headers:g(w(a(),a()))}),Do=p({type:S("DELAY"),resumeDateTime:a(),requestIdToReply:g(a()),handlerId:g(a()),streamStepProgress:g(U(Vt))}),Co=p({type:S("WEBHOOK"),requestId:a(),requestIdToReply:g(a()),response:No,handlerId:g(a()),streamStepProgress:g(U(Vt))}),fc=D([Do,Co]);var gc=p({body:O(),rawBody:g(O()),headers:w(a(),a()),queryParams:w(a(),a())});function ae(e){return e==null}o(ae,"isNil");function ht(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}o(ht,"isEmpty");function Zt(e,t){if(e==null)throw new Error(`${t} is null or undefined`)}o(Zt,"assertNotNullOrUndefined");var $r=Ce(require("crypto"),1);var yc=128,we,Fe,hc=o(e=>{!we||we.length<e?(we=Buffer.allocUnsafe(e*yc),$r.default.randomFillSync(we),Fe=0):Fe+e>we.length&&($r.default.randomFillSync(we),Fe=0),Fe+=e},"fillPool"),vc=o(e=>(hc(e|=0),we.subarray(Fe-e,Fe)),"random"),xc=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(u=t)=>{let c="";for(;;){let l=r(i),y=i;for(;y--;)if(c+=e[l[y]&n]||"",c.length===u)return c}}},"customRandom"),Mo=o((e,t=21)=>xc(e,t,vc),"customAlphabet");var _c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Lo=21,Db=a().check($e(new RegExp(`^[0-9a-zA-Z]{${Lo}}$`))),Pc=Mo(_c,Lo);var ke=ze(Ae(e=>e instanceof Date?e.toISOString():e),a()),se={id:a(),created:ke,updated:ke},q=o(e=>g(at(e)),"Nullable");function Sr(e){return g(at(U(e)))}o(Sr,"NullableEnum");var Mb=ze(Ae(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),g(H())),Ht=o(e=>ze(Ae(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),g(N(e))),"OptionalArrayFromQuery");var Fb=w(a(),O());var vt=(_=>(_.OPENAI="openai",_.OPENROUTER="openrouter",_.ANTHROPIC="anthropic",_.AZURE="azure",_.GOOGLE="google",_.ACTIVEPIECES="activepieces",_.CLOUDFLARE_GATEWAY="cloudflare-gateway",_.CUSTOM="custom",_.BEDROCK="bedrock",_.MISTRAL="mistral",_))(vt||{});var Qb=a().check($e(/^#[0-9A-Fa-f]{6}$/));var tT=p({filename:a(),data:O(),type:S("file"),mimetype:g(a())});var bc=Ce(Fo());var uT=p({...se,name:a(),permissions:N(a()),platformId:q(a()),type:a(),userCount:g(te())});var Bo=(n=>(n.AGENT_DECIDE="agent-decide",n.CHOOSE_YOURSELF="choose-yourself",n.LEAVE_EMPTY="leave-empty",n))(Bo||{}),Ar=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(Ar||{}),zr=(n=>(n.SSE="sse",n.STREAMABLE_HTTP="streamable-http",n.SIMPLE_HTTP="http",n))(zr||{});var kr=(n=>(n.TEXT="text",n.NUMBER="number",n.BOOLEAN="boolean",n))(kr||{});var Or=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(Or||{});var Tc=p({mode:U(Bo),value:O()}),Ic=p({auth:g(a()),fields:w(a(),Tc)}),Ec=p({pieceName:a(),pieceVersion:a(),actionName:a(),predefinedInput:g(Ic)}),$c=p({type:S("PIECE"),toolName:a().check(ce(1)),pieceMetadata:Ec}),Sc=p({type:S("none")}),Ac=p({type:S("access_token"),accessToken:a()}),zc=p({type:S("api_key"),apiKey:a(),apiKeyHeader:a()}),kc=p({type:S("headers"),headers:w(a(),a())}),Oc=Se("type",[Sc,Ac,zc,kc]),Vo=p({type:S("FLOW"),toolName:a().check(ce(1)),externalFlowId:a(),flowDisplayName:g(a())}),Zo=p({type:S("MCP"),toolName:a().check(ce(1)),serverUrl:Eo(),protocol:U(zr),auth:Oc}),Ho=p({type:S("KNOWLEDGE_BASE"),toolName:a().check(ce(1)),sourceType:U(Ar),sourceId:a(),sourceName:a()}),wc=Se("type",[$c,Vo,Zo,Ho]),Rc=p({displayName:a(),description:g(a()),type:U(kr)}),Go=p({type:S("MARKDOWN"),markdown:a()}),Be={type:S("TOOL_CALL"),input:q(w(a(),O())),output:g(O()),toolName:a(),status:U(Or),toolCallId:a(),startTime:a(),endTime:g(a())},LT=p(Be),Wo=Se("toolCallType",[p({...Be,toolCallType:S("PIECE"),pieceName:a(),pieceVersion:a(),actionName:a()}),p({...Be,toolCallType:S("FLOW"),displayName:a(),externalFlowId:a()}),p({...Be,toolCallType:S("MCP"),displayName:a(),serverUrl:a()}),p({...Be,toolCallType:S("KNOWLEDGE_BASE"),displayName:a(),sourceType:a()}),p({...Be,toolCallType:S("UNKNOWN"),displayName:a()})]),Nc=D([Go,Wo]);var wr=(r=>(r.IMAGE="image",r.TEXT="text",r))(wr||{}),Pe=p({apiKey:a()}),Dc=Pe,Cc=p({apiKey:a(),apiKeyHash:a()}),Uc=Pe,Mc=Pe,Lc=Pe,jc=Pe,Fc=Pe,Bc=Pe,Vc=Pe,Yo=p({accessKeyId:a().check(ce(1)),secretAccessKey:a().check(ce(1))}),Zc=p({}),Hc=p({}),Gc=p({}),Wc=p({}),qc=p({}),Kc=p({}),Qo=p({modelId:a(),modelName:a(),modelType:U(wr)}),ei=p({apiKeyHeader:a(),baseUrl:a(),models:N(Qo),defaultHeaders:g(w(a(),a()))}),ti=p({accountId:a(),gatewayId:a(),models:N(Qo),vertexProject:g(a()),vertexRegion:g(a())}),ri=p({resourceName:a(),apiVersion:ze(Ae(e=>typeof e=="string"&&e.trim().length===0?void 0:e),g(a()))}),ni=p({region:a().check(ce(1))}),Jc=D([Dc,Lc,jc,Fc,Bc,Mc,Uc,Cc,Yo,Vc]),oi=D([ei,ti,ri,ni,Zc,Gc,Wc,qc,Hc,Kc]),Xc=p({id:a(),name:a(),type:U(wr)}),Yc=p({id:a(),name:a(),provider:U(vt),config:oi,enabledForChat:H()}),Qc=p({provider:U(vt),config:oi,auth:Jc,platformId:a()});var VT={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"},qo=["gpt-5.5","gpt-5.4-mini","gpt-5.4-nano","gpt-4.1","gpt-4.1-mini"],ep=["claude-sonnet-4-6","claude-opus-4-7","claude-haiku-4-5"],tp=["claude-sonnet-4.6","claude-opus-4.7","claude-haiku-4.5"],Ko=["gemini-2.5-pro","gemini-2.5-flash","gemini-3.1-pro-preview","gemini-3-flash-preview"],rp=["grok-4.20","grok-4.1-fast"],np={openai:qo,anthropic:ep,google:Ko,activepieces:[...tp.map(e=>`anthropic/${e}`),...qo.map(e=>`openai/${e}`),...Ko.map(e=>`google/${e}`),...rp.map(e=>`x-ai/${e}`)]};var Jo=128e3,op={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function ip({provider:e}){return e?op[e]??Jo:Jo}o(ip,"getMaxContextTokens");var Xo={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"},ap={anthropic:"native",google:"native",openrouter:"plugin",activepieces:"plugin"},sp=new Set(["anthropic","mistral"]);function me(e){return{chatModels:np[e],maxContextTokens:ip({provider:e}),defaultEmbeddingModel:Xo[e],supportsEmbedding:Xo[e]!==void 0,supportsImageGeneration:!sp.has(e),webSearch:ap[e]}}o(me,"buildProviderCapabilities");var up={openai:me("openai"),anthropic:me("anthropic"),openrouter:me("openrouter"),azure:me("azure"),google:me("google"),"cloudflare-gateway":me("cloudflare-gateway"),custom:me("custom"),bedrock:me("bedrock"),mistral:me("mistral"),activepieces:me("activepieces")};var cp=p({base64Url:a(),fileName:a(),extension:g(a())}),pp=p({mimeType:a(),url:a(),fileName:g(a())}),Rr=D([cp,pp]);var lp=D([p({type:S("file"),value:Rr}),p({type:S("markdown"),value:a(),files:g(N(Rr))})]),dp=p({sessionId:a(),message:a(),files:g(N(a()))});var ai=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(ai||{}),si=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(si||{}),Nr=(n=>(n.RECORD_CREATED="RECORD_CREATED",n.RECORD_UPDATED="RECORD_UPDATED",n.RECORD_DELETED="RECORD_DELETED",n))(Nr||{});var mp=D([p({...se,name:a(),externalId:a(),type:S("STATIC_DROPDOWN"),tableId:a(),projectId:a(),data:p({options:N(p({value:a()}))})}),p({...se,name:a(),externalId:a(),type:D([S("TEXT"),S("NUMBER"),S("DATE")]),tableId:a(),projectId:a()})]),fp=p({...se,name:a(),folderId:q(a()),projectId:a(),externalId:a(),status:Sr(si),trigger:Sr(ai)}),gp=p({...se,tableId:a(),projectId:a(),cells:w(a(),p({updated:a(),created:a(),value:O(),fieldName:a()}))}),yp=p({events:N(U(Nr)),webhookUrl:a(),flowId:a()}),hp=p({fields:N(p({id:a(),name:a()})),rows:N(w(a(),a())),name:a()}),vp=p({projectId:a(),limit:g(st.number()),cursor:g(a()),name:g(a()),externalIds:Ht(a()),folderId:g(a()),folderIds:Ht(a())}),xp=p({records:N(N(p({fieldId:a(),value:ci()}))),tableId:a()}),_p=p({cells:g(N(p({fieldId:a(),value:ci()}))),tableId:a(),agentUpdate:g(H())}),ui=Se("operator",[Re("eq"),Re("neq"),Re("gt"),Re("gte"),Re("lt"),Re("lte"),Re("co"),ii("exists"),ii("not_exists")]),Pp=p({tableId:a(),limit:g(st.number()),cursor:g(a()),filters:Ht(ui)});function ci(){return ze(Ae(e=>e==null?e:String(e)),at(a()))}o(ci,"coerceToString");function Re(e){return p({fieldId:a(),operator:S(e),value:a()})}o(Re,"valueFilter");function ii(e){return p({fieldId:a(),operator:S(e)})}o(ii,"existenceFilter");var bp=p({status:g(te()),body:g(O()),headers:g(w(a(),a()))}),Tp=p({...se,deleted:q(ke),ownerId:a(),displayName:a(),platformId:a(),externalId:q(a())});var pi=p({name:a(),description:g(a()),type:a(),required:H()}),Ip=p({pieceName:a(),triggerName:a(),input:p({toolName:a(),toolDescription:a(),inputSchema:N(pi),returnsResponse:H()})});var li="^[0-9]+\\.[0-9]+\\.[0-9]+$",uI=new RegExp(li),$p="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",cI=a().check($e(new RegExp(li))),pI=a().check($e(new RegExp($p))),Sp=p({packageType:S("ARCHIVE"),pieceType:U(Le),pieceName:a(),pieceVersion:a(),archiveId:a(),platformId:a()}),di=p({packageType:S("REGISTRY"),pieceType:S("OFFICIAL"),pieceName:a(),pieceVersion:a()}),mi=p({packageType:S("REGISTRY"),pieceType:S("CUSTOM"),pieceName:a(),pieceVersion:a(),platformId:a()}),lI=D([di,mi]),dI=D([Sp,di,mi]);var Ap=Se("type",[p({type:S("CRON_EXPRESSION"),cronExpression:a(),timezone:a()}),p({type:S("INTERVAL"),intervalMs:$o().check(Ct(6e4))})]),mI=p({...se,type:U(de),projectId:a(),flowId:a(),triggerName:a(),schedule:q(Ap),flowVersionId:a(),pieceName:a(),pieceVersion:a(),deleted:q(a()),simulate:H()}),fi=(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))(fi||{}),gi=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(gi||{}),yi=(r=>(r.S3="S3",r.DB="DB",r))(yi||{}),fI=p({...se,projectId:q(a()),platformId:q(a()),type:U(fi),compression:U(gi),data:g(O()),location:U(yi),size:q(te()),fileName:q(a()),s3Key:q(a()),metadata:q(w(a(),a()))}),hi=(n=>(n.ADMIN="ADMIN",n.MEMBER="MEMBER",n.OPERATOR="OPERATOR",n))(hi||{}),vi=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(vi||{}),gI=p({id:a(),email:a(),firstName:a(),status:U(vi),externalId:q(a()),platformId:q(a()),platformRole:U(hi),lastName:a(),created:ke,updated:ke,lastActiveDate:q(ke),imageUrl:q(a())});var Dr=p({...Z.shape,...C(w(a(),O()),"OBJECT").shape});var bi=p({...Z.shape,...C(a(),"COLOR").shape});var Cr=D([oe,he,Bt,xe,ie,ve,Tr,ut,Ir,_e,lt,Dr,dt,pt,ct,bi]),b={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"}},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"}},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 fe=p({displayName:a(),description:g(a())});var Ti=p({username:a(),password:a()}),Ur=p({...fe.shape,username:p({displayName:a(),description:g(a())}),password:p({displayName:a(),description:g(a())}),...C(Ti,"BASIC_AUTH").shape});var wp=w(a(),D([oe,he,_e,xe,ie])),Mr=p({...fe.shape,props:wp,...C(O(),"CUSTOM_AUTH").shape});var Ne=p({...fe.shape,...C(p({auth:a()}),"SECRET_TEXT").shape});var Rp=w(a(),D([oe,he,Ne,_e,xe,ie,ve,Bt])),Ii=p({...fe.shape,props:Rp,...C(O(),"OIDC").shape});var Lr=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(Lr||{}),Ei=D([oe,Ne,ie]),$i=w(a(),Ei),Np=p({props:g(w(a(),Ei)),authUrl:a(),tokenUrl:a(),scope:N(a()),prompt:g(D([S("none"),S("consent"),S("login"),S("omit")])),pkce:g(H()),pkceMethod:g(D([S("plain"),S("S256")])),authorizationMethod:g(U(Lr)),grantType:g(D([U(ft),S(Er)])),extra:g(w(a(),a()))}),Si=p({access_token:a(),props:g($i),data:w(a(),it())}),jr=p({...fe.shape,...Np.shape,...C(Si,"OAUTH2").shape});var Ve=D([Ur,Mr,Ii,jr,Ne]),xt="Connection",Fr={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||xt}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||xt,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||xt}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||xt}},None(){}};var WE={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 Dp=p({...Z.shape,...C(O(),"CUSTOM").shape,code:a()});var Cp=D([Cr,Ve]),Br=w(a(),Cp),m$=w(a(),Cr);var Ai=D([p({strategy:S("CRON"),cronExpression:a()}),p({strategy:S("NONE")})]),Ze=class{constructor(t,r,n,i,u,c,l,y,h,_,$,x,s,d,f,m,v,P,j){this.name=t;this.displayName=r;this.description=n;this.requireAuth=i;this.props=u;this.type=c;this.handshakeConfiguration=l;this.onHandshake=y;this.renewConfiguration=h;this.onRenew=_;this.onEnable=$;this.onDisable=x;this.onStart=s;this.run=d;this.test=f;this.sampleData=m;this.testStrategy=v;this.outputSchema=P;this.aiMetadata=j}static{o(this,"ITrigger")}},He=o(e=>{switch(e.type){case"WEBHOOK":return new Ze(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);case"POLLING":return new Ze(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);case"MANUAL":return new Ze(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);case"APP_WEBHOOK":return new Ze(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,ae(e.sampleData)&&ae(e.test)?"SIMULATION":"TEST_FUNCTION",e.outputSchema,e.aiMetadata)}},"createTrigger");var zi="2",Wt="0.82.0";var Vr=class{constructor(t,r,n,i,u,c,l,y,h=Wt,_,$="",x){this.displayName=t;this.logoUrl=r;this.authors=n;this.events=i;this.categories=l;this.auth=y;this.minimumSupportedRelease=h;this.maximumSupportedRelease=_;this.description=$;this.deprecated=x;this._actions={};this._triggers={};this.getContextInfo=o(()=>({version:zi}),"getContextInfo");(!Up(h)||Mp(h,Wt))&&(this.minimumSupportedRelease=Wt),u.forEach(s=>this._actions[s.name]=s),c.forEach(s=>this._triggers[s.name]=s)}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: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}},ki=o(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((r,n,i)=>n===i.findIndex(u=>u.type===r.type)))throw new Error("Auth properties must be unique by type");return new Vr(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 Up(e){return/^\d+\.\d+\.\d+$/.test(e)}o(Up,"isValidSimpleSemver");function Mp(e,t){let[r,n,i]=e.split(".").map(Number),[u,c,l]=t.split(".").map(Number);return r!==u?r<u:n!==c?n<c:i<l}o(Mp,"isSemverLessThan");var Lp=g(w(a(),w(a(),a()))),Oi=p({id:g(a()),name:a(),displayName:a(),logoUrl:a(),description:a(),authors:N(a()),platformId:g(a()),directoryPath:g(a()),auth:g(D([Ve,N(Ve)])),version:a(),categories:g(N(U(je))),minimumSupportedRelease:g(a()),maximumSupportedRelease:g(a()),deprecated:g(H()),i18n:Lp}),jp=U(["human","ai","both"]),wi=p({description:g(a()),idempotent:g(H())}),Ri=p({name:a(),displayName:a(),description:a(),props:Br,requireAuth:H(),errorHandlingOptions:g(br),outputSchema:g(jt()),audience:g(jp),aiMetadata:g(wi)}),Ni=p({name:a(),displayName:a(),description:a(),props:Br,errorHandlingOptions:g(br),type:U(de),sampleData:O(),handshakeConfiguration:g(jt()),renewConfiguration:g(Ai),testStrategy:U(yt),outputSchema:g(jt()),aiMetadata:g(wi)}),Fp=p({...Oi.shape,actions:w(a(),Ri),triggers:w(a(),Ni)}),Bp=p({...Oi.shape,actions:te(),triggers:te(),suggestedActions:g(N(Ri)),suggestedTriggers:g(N(Ni))}),Di=p({projectUsage:te(),pieceType:U(Le),packageType:U(mt),platformId:g(a()),archiveId:g(a())}),mS=p({...Fp.shape,...Di.shape}),fS=p({...Bp.shape,...Di.shape}),gS=p({name:a(),version:a()});var Vp=Ce(require("path")),Zp=Ce(require("fs/promises"));var Li=require("node:stream");var qt=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((u,c)=>{i.append(c,u)}),{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 Kt=class{static{o(this,"DelegatingAuthenticationConverter")}constructor(t=new Zr,r=new Hr){this.converters={BEARER_TOKEN:t,BASIC:r}}convert(t,r){return this.converters[t.type].convert(t,r)}},Zr=class{static{o(this,"BearerTokenAuthenticationConverter")}convert(t,r){return r.Authorization=`Bearer ${t.token}`,r}},Hr=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,u=Buffer.isBuffer(n.responseBody)?n.responseBody.toString():n.responseBody;super(JSON.stringify({response:{status:i,body:u},request:{body:r}}));this.requestBody=r;this.status=i,this.responseBody=u}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 Ci({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(Ci,"toFailsafeOutput");var Pt=(c=>(c.GET="GET",c.POST="POST",c.PATCH="PATCH",c.PUT="PUT",c.DELETE="DELETE",c.HEAD="HEAD",c))(Pt||{});var Jt=class extends qt{static{o(this,"FetchHttpClient")}constructor(t="",r=new Kt){super(t,r)}async sendRequest(t,r){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:n,queryParams:i}=this.getUrl(t),u=this.getHeaders(t),c=t.queryParams??{};for(let[j,ne]of Object.entries(c))i.append(j,ne);let l=i.toString(),y=l?`${n}?${l}`:n,h=t.responseType??"json",_=t.followRedirects??!0,$=t.retries??0,{body:x,extraHeaders:s,isStream:d}=Hp(t.method)?Gp(t.body,u):{body:void 0,extraHeaders:{},isStream:!1},f=qp({...u,...s}),m=await Wp(async()=>{let j=new AbortController,ne=t.timeout&&t.timeout>0?setTimeout(()=>j.abort(),t.timeout):void 0;try{let ue={method:t.method.toString(),headers:f,body:x,redirect:_?"follow":"manual",signal:j.signal};return d&&(ue.duplex="half"),r?.dispatcher!==void 0&&(ue.dispatcher=r.dispatcher),await fetch(y,ue)}finally{ne!==void 0&&clearTimeout(ne)}},$),v=_?300:400;if(m.status<200||m.status>=v){let j=await Ui(m,h),ne=new _t(t.body,{status:m.status,responseBody:j});throw console.error("[HttpClient#(sanitized error message)] Request failed:",ne),ne}let P=await Ui(m,h);return{status:m.status,headers:Kp(m.headers),body:P}}};function Hp(e){return e!=="GET"&&e!=="HEAD"}o(Hp,"acceptsRequestBody");function Gp(e,t){if(Xp(e))return{body:void 0,extraHeaders:{},isStream:!1};if(Jp(e)){let n=new Li.PassThrough;return e.on("error",i=>n.destroy(i)),e.pipe(n),{body:n,extraHeaders:e.getHeaders(),isStream:!0}}return 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(Gp,"serializeBody");async function Ui(e,t){switch(t){case"arraybuffer":return Buffer.from(await e.arrayBuffer());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(Ui,"parseResponseBody");async function Wp(e,t){let r;for(let n=0;n<=t;n++)try{let i=await e();if(i.status>=500&&n<t){await Mi(n);continue}return i}catch(i){if(r=i,n<t){await Mi(n);continue}throw i}throw r}o(Wp,"sendWithRetries");function Mi(e){let t=Math.min(1e3*2**e,3e4);return new Promise(r=>setTimeout(r,t))}o(Mi,"backoff");function qp(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(qp,"normalizeHeaders");function Kp(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}o(Kp,"toHttpHeaders");function Jp(e){return typeof e=="object"&&e!==null&&typeof e.getHeaders=="function"&&typeof e.pipe=="function"&&typeof e.on=="function"}o(Jp,"isNodeFormData");function Xp(e){return e==null}o(Xp,"isNil");var Ge=new Jt;var Md=Ce(require("fs")),Hs=Ce(Zs());var Ld={"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 jd(e){let t=e.split(";")[0].trim().toLowerCase();return Ld[t]??""}o(jd,"contentTypeToExtension");var Fd=o(({baseUrl:e,relativePath:t})=>{let r=e.endsWith("/")?e:`${e}/`,n=t.startsWith("/")?t.slice(1):t;return`${r}${n}`},"joinBaseUrlWithRelativePath"),Bd=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 Gs({auth:e,baseUrl:t,authMapping:r,description:n,displayName:i,name:u,props:c,extraProps:l,authLocation:y="headers"}){return G({audience:"human",name:u||"custom_api_call",displayName:i||"Custom API Call",description:n||"Make a custom API call to a specific endpoint",auth:e,requireAuth:!!e,props:{url:b.DynamicProperties({auth:e,displayName:"",required:!0,refreshers:[],props:o(async({auth:h})=>({url:b.ShortText({displayName:"URL",description:`You can either use the full URL or the relative path to the base URL
|
|
3
|
+
i.e ${Bd(t,h)}/resource or /resource`,required:!0,defaultValue:h?t(h):"",...c?.url??{}})}),"props")}),method:b.StaticDropdown({displayName:"Method",required:!0,options:{options:Object.values(Pt).map(h=>({label:h,value:h}))},...c?.method??{}}),headers:b.Object({displayName:"Headers",description:"Authorization headers are injected automatically from your connection.",required:!0,...c?.headers??{}}),queryParams:b.Object({displayName:"Query Parameters",required:!0,...c?.queryParams??{}}),body_type:b.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:b.DynamicProperties({auth:e,displayName:"Body",refreshers:["body_type"],required:!1,props:o(async({body_type:h})=>{if(!h)return{};let _=h,$={};switch(_){case"none":break;case"json":$.data=b.Json({displayName:"JSON Body",required:!0,...c?.body??{}});break;case"raw":$.data=b.LongText({displayName:"Raw Body",required:!0});break;case"form_data":$.data=b.Array({displayName:"Form Data",required:!0,properties:{fieldName:b.ShortText({displayName:"Field Name",required:!0}),fieldType:b.StaticDropdown({displayName:"Field Type",required:!0,options:{disabled:!1,options:[{label:"Text",value:"text"},{label:"File",value:"file"}]}}),textFieldValue:b.LongText({displayName:"Text Field Value",required:!1}),fileFieldValue:b.File({displayName:"File Field Value",required:!1})}});break}return $},"props")}),response_is_binary:b.Checkbox({displayName:"Response is Binary ?",description:"Enable for files like PDFs, images, etc.",required:!1,defaultValue:!1}),failsafe:b.Checkbox({displayName:"No Error on Failure",required:!1,...c?.failsafe??{}}),timeout:b.Number({displayName:"Timeout (in seconds)",required:!1,...c?.timeout??{}}),followRedirects:b.Checkbox({displayName:"Follow redirects",required:!1,defaultValue:!1}),...l},run:o(async h=>{let{method:_,url:$,headers:x,queryParams:s,body:d,body_type:f,failsafe:m,timeout:v,response_is_binary:P,followRedirects:j}=h.propsValue;Zt(_,"Method"),Zt($,"URL");let ne=ae(r)?{}:await r(h.auth,h.propsValue),ue=$.url,Ye=ue.startsWith("http://")||ue.startsWith("https://")?ue:Fd({baseUrl:t(h.auth),relativePath:ue}),be={method:_,url:Ye,headers:{...x??{},...y==="headers"||!ae(y)?ne:{}},queryParams:{...y==="queryParams"?ne:{},...s??{}},timeout:v?v*1e3:0,followRedirects:j};if(P&&(be.responseType="arraybuffer"),d)if(f&&f!=="none"){let ge=d.data;if(f==="form_data"){let pu=ge,Et=new Hs.default;for(let{fieldName:mn,fieldType:fn,textFieldValue:gn,fileFieldValue:ar}of pu)fn==="text"&&!ht(gn)?Et.append(mn,gn):fn==="file"&&!ht(ar)&&Et.append(mn,ar.data,{filename:ar?.filename});be.body=Et,be.headers={...be.headers,...Et.getHeaders()}}else be.body=ge}else f||(be.body=d);try{let ge=await Ge.sendRequest(be);return await Vd(h.files,ge.body,ge.status,ge.headers,P)}catch(ge){if(m)return Ci({error:ge,requestBody:be.body});throw ge}},"run")})}o(Gs,"createCustomApiCallAction");var Vd=o(async(e,t,r,n,i)=>{let u;if(i&&Zd(t)){let c=Array.isArray(n?.["content-type"])?n["content-type"][0]:n?.["content-type"],l=jd(c??"")||"txt",y;t instanceof ArrayBuffer?y=Buffer.from(new Uint8Array(t)):Buffer.isBuffer(t)?y=t:y=Buffer.from(t),u=await e.write({fileName:`output.${l}`,data:y})}else u=t;return{status:r,headers:n,body:u}},"handleBinaryResponse"),Zd=o(e=>e instanceof ArrayBuffer||Buffer.isBuffer(e),"isBinaryBody");var Hd="https://www.promotekit.com/api/v1";async function B({token:e,method:t,path:r,body:n,queryParams:i}){return await Ge.sendRequest({method:t,url:`${Hd}${r}`,authentication:{type:"BEARER_TOKEN",token:e},queryParams:i,body:n})}o(B,"promotekitApiCall");var Gd=100;async function Ws({token:e,path:t,queryParams:r}){let n=[],i=1,u=!0;for(;u&&i<=Gd;){let c=await B({token:e,method:"GET",path:t,queryParams:{...r,page:String(i),limit:"100"}});n.push(...c.body.data),u=c.body.has_more,i++}return n}o(Ws,"promotekitPaginatedApiCall");function Wd(e){let t=e.campaign,r=e.links,n=e.promo_codes;return{id:e.id,email:e.email,first_name:e.first_name,last_name:e.last_name,payout_email:e.payout_email??null,clicks:e.clicks??0,approved:e.approved??!1,banned:e.banned??!1,links:r?r.map(i=>`${i.url} (${i.code})`).join(", "):null,promo_codes:n?n.map(i=>i.code).join(", "):null,campaign_id:t?.id??null,campaign_name:t?.name??null,campaign_commission_type:t?.commission_type??null,campaign_commission_amount:t?.commission_amount??null,created_at:e.created_at,updated_at:e.updated_at}}o(Wd,"flattenAffiliate");function qd(e){let t=e.affiliate;return{id:e.id,email:e.email,subscription_status:e.subscription_status??null,signup_date:e.signup_date??null,stripe_customer_id:e.stripe_customer_id??null,affiliate_id:t?.id??null,affiliate_email:t?.email??null,affiliate_first_name:t?.first_name??null,affiliate_last_name:t?.last_name??null,created_at:e.created_at}}o(qd,"flattenReferral");function Kd(e){let t=e.affiliate,r=e.referral,n=e.payout;return{id:e.id,revenue_amount:e.revenue_amount??null,currency:e.currency??null,commission_amount:e.commission_amount??null,payout_status:e.payout_status??null,referral_date:e.referral_date??null,stripe_payment_id:e.stripe_payment_id??null,affiliate_id:t?.id??null,affiliate_email:t?.email??null,referral_id:r?.id??null,referral_email:r?.email??null,payout_id:n?.id??null,created_at:e.created_at,updated_at:e.updated_at}}o(Kd,"flattenCommission");function Jd(e){let t=e.affiliate;return{id:e.id,amount:e.amount??null,currency:e.currency??null,status:e.status??null,affiliate_id:t?.id??null,affiliate_email:t?.email??null,affiliate_first_name:t?.first_name??null,affiliate_last_name:t?.last_name??null,created_at:e.created_at,updated_at:e.updated_at??null}}o(Jd,"flattenPayout");var V={flattenAffiliate:Wd,flattenReferral:qd,flattenCommission:Kd,flattenPayout:Jd,campaignDropdown:b.Dropdown({auth:M,displayName:"Campaign",description:"Select the campaign for this affiliate.",refreshers:[],required:!1,options:o(async({auth:e})=>e?{disabled:!1,options:(await Ws({token:e.secret_text,path:"/campaigns"})).map(r=>({label:r.name,value:r.id}))}:{disabled:!0,options:[],placeholder:"Please connect your account first"},"options")}),affiliateDropdown:b.Dropdown({auth:M,displayName:"Affiliate",description:"Select the affiliate.",refreshers:[],required:!0,options:o(async({auth:e})=>e?{disabled:!1,options:(await Ws({token:e.secret_text,path:"/affiliates"})).map(r=>({label:`${r.first_name??""} ${r.last_name??""} (${r.email})`.trim(),value:r.id}))}:{disabled:!0,options:[],placeholder:"Please connect your account first"},"options")})};var qs=G({auth:M,name:"list_affiliates",displayName:"List Affiliates",description:"List all affiliates in your PromoteKit account.",audience:"both",aiMetadata:{description:"Retrieve a paginated list of affiliates in the PromoteKit account. Use to enumerate or browse affiliates rather than look one up by a known ID. Supports page and per-page limit (max 100); read-only and safe to repeat.",idempotent:!0},props:{page:b.Number({displayName:"Page",description:"Page number to retrieve. Defaults to 1.",required:!1,defaultValue:1}),limit:b.Number({displayName:"Limit",description:"Number of affiliates per page (max 100). Defaults to 10.",required:!1,defaultValue:10})},async run(e){return(await B({token:e.auth.secret_text,method:"GET",path:"/affiliates",queryParams:{page:String(e.propsValue.page??1),limit:String(e.propsValue.limit??10)}})).body.data.map(V.flattenAffiliate)}});var Ks=G({auth:M,name:"find_affiliate",displayName:"Find Affiliate",description:"Get details of a specific affiliate by ID.",audience:"both",aiMetadata:{description:"Fetch a single affiliate by its PromoteKit affiliate ID. Use when you already have the exact ID and need that affiliate's details; to discover IDs, list affiliates first. Read-only and safe to repeat.",idempotent:!0},props:{affiliate_id:b.ShortText({displayName:"Affiliate ID",description:"The ID of the affiliate to retrieve.",required:!0})},async run(e){let t=await B({token:e.auth.secret_text,method:"GET",path:`/affiliates/${e.propsValue.affiliate_id}`});return V.flattenAffiliate(t.body.data)}});var Js=G({auth:M,name:"create_affiliate",displayName:"Create Affiliate",description:"Create a new affiliate in PromoteKit.",audience:"both",aiMetadata:{description:"Create a new affiliate in PromoteKit, optionally assigning them to a campaign. Email is required; first/last name and campaign are optional. Not idempotent: each call adds another affiliate, so guard against duplicates by checking for an existing affiliate first.",idempotent:!1},props:{email:b.ShortText({displayName:"Email",description:"The email address of the new affiliate.",required:!0}),first_name:b.ShortText({displayName:"First Name",required:!1}),last_name:b.ShortText({displayName:"Last Name",required:!1}),campaign_id:V.campaignDropdown},async run(e){let t={email:e.propsValue.email};e.propsValue.first_name&&(t.first_name=e.propsValue.first_name),e.propsValue.last_name&&(t.last_name=e.propsValue.last_name),e.propsValue.campaign_id&&(t.campaign_id=e.propsValue.campaign_id);let r=await B({token:e.auth.secret_text,method:"POST",path:"/affiliates",body:t});return V.flattenAffiliate(r.body.data)}});var Xs=G({auth:M,name:"update_affiliate",displayName:"Update Affiliate",description:"Update an existing affiliate in PromoteKit.",audience:"both",aiMetadata:{description:"Update an existing affiliate identified by affiliate ID, changing only the fields you supply (name, payout email, approved, banned); omitted fields are left untouched. Use to approve, ban, or edit an affiliate. Idempotent: re-sending the same field values leaves the affiliate in the same state.",idempotent:!0},props:{affiliate_id:b.ShortText({displayName:"Affiliate ID",description:"The ID of the affiliate to update.",required:!0}),first_name:b.ShortText({displayName:"First Name",required:!1}),last_name:b.ShortText({displayName:"Last Name",required:!1}),payout_email:b.ShortText({displayName:"Payout Email",description:"The email address where the affiliate receives payouts.",required:!1}),approved:b.Checkbox({displayName:"Approved",description:"Whether the affiliate is approved.",required:!1}),banned:b.Checkbox({displayName:"Banned",description:"Whether the affiliate is banned.",required:!1})},async run(e){let t={};e.propsValue.first_name!==void 0&&(t.first_name=e.propsValue.first_name),e.propsValue.last_name!==void 0&&(t.last_name=e.propsValue.last_name),e.propsValue.payout_email!==void 0&&(t.payout_email=e.propsValue.payout_email),e.propsValue.approved!==void 0&&(t.approved=e.propsValue.approved),e.propsValue.banned!==void 0&&(t.banned=e.propsValue.banned);let r=await B({token:e.auth.secret_text,method:"PUT",path:`/affiliates/${e.propsValue.affiliate_id}`,body:t});return V.flattenAffiliate(r.body.data)}});var Ys=G({auth:M,name:"list_referrals",displayName:"List Referrals",description:"List all referrals in your PromoteKit account.",audience:"both",aiMetadata:{description:"Retrieve a paginated list of referrals (referred customers) in the PromoteKit account. Use to enumerate or browse referrals rather than look one up by a known ID. Supports page and per-page limit (max 100); read-only and safe to repeat.",idempotent:!0},props:{page:b.Number({displayName:"Page",description:"Page number to retrieve. Defaults to 1.",required:!1,defaultValue:1}),limit:b.Number({displayName:"Limit",description:"Number of referrals per page (max 100). Defaults to 10.",required:!1,defaultValue:10})},async run(e){return(await B({token:e.auth.secret_text,method:"GET",path:"/referrals",queryParams:{page:String(e.propsValue.page??1),limit:String(e.propsValue.limit??10)}})).body.data.map(V.flattenReferral)}});var Qs=G({auth:M,name:"find_referral",displayName:"Find Referral",description:"Get details of a specific referral by ID.",audience:"both",aiMetadata:{description:"Fetch a single referral by its PromoteKit referral ID. Use when you already have the exact ID and need that referral's details; to discover IDs, list referrals first. Read-only and safe to repeat.",idempotent:!0},props:{referral_id:b.ShortText({displayName:"Referral ID",description:"The ID of the referral to retrieve.",required:!0})},async run(e){let t=await B({token:e.auth.secret_text,method:"GET",path:`/referrals/${e.propsValue.referral_id}`});return V.flattenReferral(t.body.data)}});var eu=G({auth:M,name:"create_referral",displayName:"Create Referral",description:"Create a new referral in PromoteKit.",audience:"both",aiMetadata:{description:"Create a new referral attributing a referred person (by email) to an affiliate. Both the email and the affiliate ID are required. Not idempotent: each call records another referral, so check for an existing one before repeating.",idempotent:!1},props:{email:b.ShortText({displayName:"Email",description:"The email address of the referred person.",required:!0}),affiliate_id:V.affiliateDropdown},async run(e){let t=await B({token:e.auth.secret_text,method:"POST",path:"/referrals",body:{email:e.propsValue.email,affiliate_id:e.propsValue.affiliate_id}});return V.flattenReferral(t.body.data)}});var tu=G({auth:M,name:"list_commissions",displayName:"List Commissions",description:"List all commissions in your PromoteKit account.",audience:"both",aiMetadata:{description:"Retrieve a paginated list of commissions earned in the PromoteKit account. Use to enumerate or browse commissions rather than look one up by a known ID. Supports page and per-page limit (max 100); read-only and safe to repeat.",idempotent:!0},props:{page:b.Number({displayName:"Page",description:"Page number to retrieve. Defaults to 1.",required:!1,defaultValue:1}),limit:b.Number({displayName:"Limit",description:"Number of commissions per page (max 100). Defaults to 10.",required:!1,defaultValue:10})},async run(e){return(await B({token:e.auth.secret_text,method:"GET",path:"/commissions",queryParams:{page:String(e.propsValue.page??1),limit:String(e.propsValue.limit??10)}})).body.data.map(V.flattenCommission)}});var ru=G({auth:M,name:"find_commission",displayName:"Find Commission",description:"Get details of a specific commission by ID.",audience:"both",aiMetadata:{description:"Fetch a single commission by its PromoteKit commission ID. Use when you already have the exact ID and need that commission's details; to discover IDs, list commissions first. Read-only and safe to repeat.",idempotent:!0},props:{commission_id:b.ShortText({displayName:"Commission ID",description:"The ID of the commission to retrieve.",required:!0})},async run(e){let t=await B({token:e.auth.secret_text,method:"GET",path:`/commissions/${e.propsValue.commission_id}`});return V.flattenCommission(t.body.data)}});var nu=G({auth:M,name:"list_campaigns",displayName:"List Campaigns",description:"List all campaigns in your PromoteKit account.",audience:"both",aiMetadata:{description:"Retrieve all campaigns (up to 100) in the PromoteKit account, each with its commission type and amount. Use to discover campaign IDs and commission terms, e.g. before assigning an affiliate to a campaign. Read-only and safe to repeat.",idempotent:!0},props:{},async run(e){return(await B({token:e.auth.secret_text,method:"GET",path:"/campaigns",queryParams:{limit:"100"}})).body.data.map(r=>({id:r.id,name:r.name,commission_type:r.commission_type??null,commission_amount:r.commission_amount??null}))}});var ou=G({auth:M,name:"find_campaign",displayName:"Find Campaign",description:"Get details of a specific campaign by ID.",audience:"both",aiMetadata:{description:"Fetch a single campaign by its PromoteKit campaign ID, returning its name and commission terms. Use when you already have the exact ID; to discover IDs, list campaigns first. Read-only and safe to repeat.",idempotent:!0},props:{campaign_id:b.ShortText({displayName:"Campaign ID",description:"The ID of the campaign to retrieve.",required:!0})},async run(e){let r=(await B({token:e.auth.secret_text,method:"GET",path:`/campaigns/${e.propsValue.campaign_id}`})).body.data;return{id:r.id,name:r.name,commission_type:r.commission_type??null,commission_amount:r.commission_amount??null}}});var iu=G({auth:M,name:"list_payouts",displayName:"List Payouts",description:"List all payouts in your PromoteKit account.",audience:"both",aiMetadata:{description:"Retrieve a paginated list of payouts to affiliates in the PromoteKit account. Use to enumerate or browse payouts rather than look one up by a known ID. Supports page and per-page limit (max 100); read-only and safe to repeat.",idempotent:!0},props:{page:b.Number({displayName:"Page",description:"Page number to retrieve. Defaults to 1.",required:!1,defaultValue:1}),limit:b.Number({displayName:"Limit",description:"Number of payouts per page (max 100). Defaults to 10.",required:!1,defaultValue:10})},async run(e){return(await B({token:e.auth.secret_text,method:"GET",path:"/payouts",queryParams:{page:String(e.propsValue.page??1),limit:String(e.propsValue.limit??10)}})).body.data.map(V.flattenPayout)}});var au=G({auth:M,name:"find_payout",displayName:"Find Payout",description:"Get details of a specific payout by ID.",audience:"both",aiMetadata:{description:"Fetch a single payout by its PromoteKit payout ID. Use when you already have the exact ID and need that payout's details; to discover IDs, list payouts first. Read-only and safe to repeat.",idempotent:!0},props:{payout_id:b.ShortText({displayName:"Payout ID",description:"The ID of the payout to retrieve.",required:!0})},async run(e){let t=await B({token:e.auth.secret_text,method:"GET",path:`/payouts/${e.propsValue.payout_id}`});return V.flattenPayout(t.body.data)}});var Xd=[{label:"Affiliate Created",value:"affiliate.created"},{label:"Affiliate Approved",value:"affiliate.approved"}],su=He({auth:M,name:"new_affiliate_event",displayName:"New Affiliate Event",description:"Triggers when a PromoteKit affiliate event is received.",aiMetadata:{description:"Fires on a PromoteKit affiliate webhook event \u2014 when an affiliate is created or approved. Optionally filter to specific event types; leave the selection empty to fire on any affiliate event. Requires the webhook endpoint to be configured in the PromoteKit dashboard."},props:{eventTypes:b.StaticMultiSelectDropdown({displayName:"Affiliate Event Types",description:"Select the affiliate event types to listen for. Leave empty to receive all affiliate events.",required:!1,options:{options:Xd}}),instructions:b.MarkDown({value:`### Setup Instructions
|
|
4
|
+
|
|
5
|
+
1. Go to your PromoteKit dashboard.
|
|
6
|
+
2. Navigate to **Settings > Webhooks**.
|
|
7
|
+
3. Click **Add Endpoint**.
|
|
8
|
+
4. Paste the webhook URL shown below :
|
|
9
|
+
\`\`\`text
|
|
10
|
+
{{webhookUrl}}
|
|
11
|
+
\`\`\`
|
|
12
|
+
5. Enable the affiliate event types you selected above.
|
|
13
|
+
6. Save the endpoint.
|
|
14
|
+
|
|
15
|
+
**Need different flows for different events?** Create a separate flow with its own webhook URL, and add a new endpoint in PromoteKit for that flow with only the matching event enabled.`})},sampleData:{type:"affiliate.created",id:"aff_sample",email:"affiliate@example.com",first_name:"John",last_name:"Doe",approved:!1,banned:!1,created_at:"2024-01-01T00:00:00Z"},type:"WEBHOOK",async onEnable(){},async onDisable(){},async run(e){let t=e.payload.body,r=e.propsValue.eventTypes??[];return t.type==="affiliate.created"||t.type==="affiliate.approved"?r.length>0&&!r.includes(t.type)?[]:[{type:t.type,...V.flattenAffiliate(t.data)}]:[]},async test(e){let t=await B({token:e.auth.secret_text,method:"GET",path:"/affiliates",queryParams:{limit:"5"}}),n=(e.propsValue.eventTypes??[])[0]??"affiliate.created";return t.body.data.map(i=>({type:n,...V.flattenAffiliate(i)}))}});var Yd=[{label:"Referral Created",value:"referral.created"},{label:"Referral Converted",value:"referral.converted"}],uu=He({auth:M,name:"new_referral_event",displayName:"New Referral Event",description:"Triggers when a PromoteKit referral webhook event is received.",aiMetadata:{description:"Fires on a PromoteKit referral webhook event \u2014 when a referral is created or converted. Optionally filter to specific event types; leave the selection empty to fire on any referral event. Requires the webhook endpoint to be configured in the PromoteKit dashboard."},props:{eventTypes:b.StaticMultiSelectDropdown({displayName:"Referral Event Types",description:"Select the referral event types to listen for. Leave empty to receive all referral events.",required:!1,options:{options:Yd}}),instructions:b.MarkDown({value:`### Setup Instructions
|
|
16
|
+
|
|
17
|
+
1. Go to your PromoteKit dashboard.
|
|
18
|
+
2. Navigate to **Settings > Webhooks**.
|
|
19
|
+
3. Click **Add Endpoint**.
|
|
20
|
+
4. Paste the webhook URL shown below.
|
|
21
|
+
\`\`\`text
|
|
22
|
+
{{webhookUrl}}
|
|
23
|
+
\`\`\`
|
|
24
|
+
5. Enable the referral event types you selected above.
|
|
25
|
+
6. Save the endpoint.
|
|
26
|
+
|
|
27
|
+
**Need different flows for different events?** Create a separate flow with its own webhook URL, and add a new endpoint in PromoteKit for that flow with only the matching event enabled.`})},sampleData:{type:"referral.created",id:"ref_sample",email:"referral@example.com",subscription_status:null,affiliate_id:"aff_sample",affiliate_email:"affiliate@example.com",created_at:"2024-01-01T00:00:00Z"},type:"WEBHOOK",async onEnable(){},async onDisable(){},async run(e){let t=e.payload.body,r=e.propsValue.eventTypes??[];return t.type==="referral.created"||t.type==="referral.converted"?r.length>0&&!r.includes(t.type)?[]:[{type:t.type,...V.flattenReferral(t.data)}]:[]},async test(e){let t=await B({token:e.auth.secret_text,method:"GET",path:"/referrals",queryParams:{limit:"5"}}),n=(e.propsValue.eventTypes??[])[0]??"referral.created";return t.body.data.map(i=>({type:n,...V.flattenReferral(i)}))}});var cu=He({auth:M,name:"new_commission_event",displayName:"New Commission Event",description:"Triggers when a PromoteKit commission webhook event is received.",aiMetadata:{description:"Fires when a PromoteKit commission is created (a commission.created webhook event), representing a new commission earned by an affiliate. Requires the webhook endpoint to be configured in the PromoteKit dashboard."},props:{instructions:b.MarkDown({value:`### Setup Instructions
|
|
28
|
+
|
|
29
|
+
1. Go to your PromoteKit dashboard.
|
|
30
|
+
2. Navigate to **Settings > Webhooks**.
|
|
31
|
+
3. Click **Add Endpoint**.
|
|
32
|
+
4. Paste the webhook URL shown below :
|
|
33
|
+
\`\`\`text
|
|
34
|
+
{{webhookUrl}}
|
|
35
|
+
\`\`\`
|
|
36
|
+
5. Enable the **Commission Created** event.
|
|
37
|
+
6. Save the endpoint.`})},sampleData:{type:"commission.created",id:"com_sample",revenue_amount:100,currency:"usd",commission_amount:20,payout_status:"pending",affiliate_id:"aff_sample",affiliate_email:"affiliate@example.com",created_at:"2024-01-01T00:00:00Z"},type:"WEBHOOK",async onEnable(){},async onDisable(){},async run(e){let t=e.payload.body;return t.type!=="commission.created"?[]:[{type:t.type,...V.flattenCommission(t.data)}]},async test(e){return(await B({token:e.auth.secret_text,method:"GET",path:"/commissions",queryParams:{limit:"5"}})).body.data.map(r=>({type:"commission.created",...V.flattenCommission(r)}))}});var M=Fr.SecretText({displayName:"API Key",description:`To get your API key:
|
|
27
38
|
1. Log in to your PromoteKit dashboard.
|
|
28
39
|
2. Go to **Settings > API Keys**.
|
|
29
40
|
3. Click **Create API Key**.
|
|
30
41
|
4. Copy the key and paste it here.
|
|
31
|
-
`,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
catch (_b) {
|
|
44
|
-
return { valid: false, error: 'Invalid API Key' };
|
|
45
|
-
}
|
|
46
|
-
}),
|
|
47
|
-
});
|
|
48
|
-
exports.promotekit = (0, pieces_framework_1.createPiece)({
|
|
49
|
-
displayName: 'PromoteKit',
|
|
50
|
-
description: 'Affiliate marketing platform integrated with Stripe.',
|
|
51
|
-
minimumSupportedRelease: '0.36.1',
|
|
52
|
-
logoUrl: 'https://cdn.activepieces.com/pieces/promotekit.png',
|
|
53
|
-
categories: [shared_1.PieceCategory.MARKETING],
|
|
54
|
-
auth: exports.promotekitAuth,
|
|
55
|
-
authors: ['BasTech'],
|
|
56
|
-
actions: [
|
|
57
|
-
list_affiliates_1.listAffiliates,
|
|
58
|
-
find_affiliate_1.findAffiliate,
|
|
59
|
-
create_affiliate_1.createAffiliate,
|
|
60
|
-
update_affiliate_1.updateAffiliate,
|
|
61
|
-
list_referrals_1.listReferrals,
|
|
62
|
-
find_referral_1.findReferral,
|
|
63
|
-
create_referral_1.createReferral,
|
|
64
|
-
list_commissions_1.listCommissions,
|
|
65
|
-
find_commission_1.findCommission,
|
|
66
|
-
list_campaigns_1.listCampaigns,
|
|
67
|
-
find_campaign_1.findCampaign,
|
|
68
|
-
list_payouts_1.listPayouts,
|
|
69
|
-
find_payout_1.findPayout,
|
|
70
|
-
(0, pieces_common_1.createCustomApiCallAction)({
|
|
71
|
-
baseUrl: () => 'https://www.promotekit.com/api/v1',
|
|
72
|
-
auth: exports.promotekitAuth,
|
|
73
|
-
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
74
|
-
return ({
|
|
75
|
-
Authorization: `Bearer ${auth}`,
|
|
76
|
-
});
|
|
77
|
-
}),
|
|
78
|
-
}),
|
|
79
|
-
],
|
|
80
|
-
triggers: [new_affiliate_event_1.newAffiliateEvent, new_referral_event_1.newReferralEvent, new_commission_event_1.newCommissionEvent],
|
|
81
|
-
});
|
|
82
|
-
//# sourceMappingURL=index.js.map
|
|
42
|
+
`,required:!0,validate:o(async({auth:e})=>{try{return await Ge.sendRequest({method:"GET",url:"https://www.promotekit.com/api/v1/affiliates",headers:{Authorization:`Bearer ${e}`},queryParams:{limit:"1"}}),{valid:!0}}catch{return{valid:!1,error:"Invalid API Key"}}},"validate")}),Qd=ki({displayName:"PromoteKit",description:"Affiliate marketing platform integrated with Stripe.",minimumSupportedRelease:"0.36.1",logoUrl:"https://cdn.activepieces.com/pieces/promotekit.png",categories:["MARKETING"],auth:M,authors:["BasTech"],actions:[qs,Ks,Js,Xs,Ys,Qs,eu,tu,ru,nu,ou,iu,au,Gs({baseUrl:o(()=>"https://www.promotekit.com/api/v1","baseUrl"),auth:M,authMapping:o(async e=>({Authorization:`Bearer ${e}`}),"authMapping")})],triggers:[su,uu,cu]});0&&(module.exports={promotekit,promotekitAuth});
|
|
43
|
+
/*! Bundled license information:
|
|
44
|
+
|
|
45
|
+
mime-types/index.js:
|
|
46
|
+
(*!
|
|
47
|
+
* mime-types
|
|
48
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
49
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
50
|
+
* MIT Licensed
|
|
51
|
+
*)
|
|
52
|
+
*/
|
package/src/index.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const promotekitAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
2
|
-
export declare const promotekit: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
-
//# sourceMappingURL=index.d.ts.map
|
package/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAwBA,eAAO,MAAM,cAAc,mEAsBzB,CAAC;AAEH,eAAO,MAAM,UAAU,mHA+BrB,CAAC"}
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAIqC;AACrC,qEAAwE;AACxE,iDAAqD;AACrD,mEAA+D;AAC/D,iEAA6D;AAC7D,qEAAiE;AACjE,qEAAiE;AACjE,iEAA6D;AAC7D,+DAA2D;AAC3D,mEAA+D;AAC/D,qEAAiE;AACjE,mEAA+D;AAC/D,iEAA6D;AAC7D,+DAA2D;AAC3D,6DAAyD;AACzD,2DAAuD;AACvD,4EAAuE;AACvE,0EAAqE;AACrE,8EAAyE;AAE5D,QAAA,cAAc,GAAG,4BAAS,CAAC,UAAU,CAAC;IACjD,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE;;;;;CAKd;IACC,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,8CAA8C;gBACnD,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,IAAI,EAAE,EAAE;gBAC5C,WAAW,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;aAC5B,CAAC,CAAC;YACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,WAAM,CAAC;YACP,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;QACpD,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC;AAEU,QAAA,UAAU,GAAG,IAAA,8BAAW,EAAC;IACpC,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,sDAAsD;IACnE,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,oDAAoD;IAC7D,UAAU,EAAE,CAAC,sBAAa,CAAC,SAAS,CAAC;IACrC,IAAI,EAAE,sBAAc;IACpB,OAAO,EAAE,CAAC,SAAS,CAAC;IACpB,OAAO,EAAE;QACP,gCAAc;QACd,8BAAa;QACb,kCAAe;QACf,kCAAe;QACf,8BAAa;QACb,4BAAY;QACZ,gCAAc;QACd,kCAAe;QACf,gCAAc;QACd,8BAAa;QACb,4BAAY;QACZ,0BAAW;QACX,wBAAU;QACV,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,mCAAmC;YAClD,IAAI,EAAE,sBAAc;YACpB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,UAAU,IAAI,EAAE;iBAChC,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,QAAQ,EAAE,CAAC,uCAAiB,EAAE,qCAAgB,EAAE,yCAAkB,CAAC;CACpE,CAAC,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const createAffiliate: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
-
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
first_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
last_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
-
campaign_id: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=create-affiliate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-affiliate.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-affiliate.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe;;;;;EA4C1B,CAAC"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createAffiliate = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const __1 = require("../..");
|
|
8
|
-
const common_1 = require("../common");
|
|
9
|
-
exports.createAffiliate = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: __1.promotekitAuth,
|
|
11
|
-
name: 'create_affiliate',
|
|
12
|
-
displayName: 'Create Affiliate',
|
|
13
|
-
description: 'Create a new affiliate in PromoteKit.',
|
|
14
|
-
audience: 'both',
|
|
15
|
-
aiMetadata: {
|
|
16
|
-
description: 'Create a new affiliate in PromoteKit, optionally assigning them to a campaign. Email is required; first/last name and campaign are optional. Not idempotent: each call adds another affiliate, so guard against duplicates by checking for an existing affiliate first.',
|
|
17
|
-
idempotent: false,
|
|
18
|
-
},
|
|
19
|
-
props: {
|
|
20
|
-
email: pieces_framework_1.Property.ShortText({
|
|
21
|
-
displayName: 'Email',
|
|
22
|
-
description: 'The email address of the new affiliate.',
|
|
23
|
-
required: true,
|
|
24
|
-
}),
|
|
25
|
-
first_name: pieces_framework_1.Property.ShortText({
|
|
26
|
-
displayName: 'First Name',
|
|
27
|
-
required: false,
|
|
28
|
-
}),
|
|
29
|
-
last_name: pieces_framework_1.Property.ShortText({
|
|
30
|
-
displayName: 'Last Name',
|
|
31
|
-
required: false,
|
|
32
|
-
}),
|
|
33
|
-
campaign_id: common_1.promotekitCommon.campaignDropdown,
|
|
34
|
-
},
|
|
35
|
-
run(context) {
|
|
36
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const body = {
|
|
38
|
-
email: context.propsValue.email,
|
|
39
|
-
};
|
|
40
|
-
if (context.propsValue.first_name)
|
|
41
|
-
body['first_name'] = context.propsValue.first_name;
|
|
42
|
-
if (context.propsValue.last_name)
|
|
43
|
-
body['last_name'] = context.propsValue.last_name;
|
|
44
|
-
if (context.propsValue.campaign_id)
|
|
45
|
-
body['campaign_id'] = context.propsValue.campaign_id;
|
|
46
|
-
const response = yield (0, common_1.promotekitApiCall)({
|
|
47
|
-
token: context.auth.secret_text,
|
|
48
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
49
|
-
path: '/affiliates',
|
|
50
|
-
body,
|
|
51
|
-
});
|
|
52
|
-
return common_1.promotekitCommon.flattenAffiliate(response.body.data);
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
//# sourceMappingURL=create-affiliate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-affiliate.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-affiliate.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,6BAAuC;AACvC,sCAAgE;AAEnD,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,kBAAc;IACpB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,uCAAuC;IACpD,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EAAE,yQAAyQ;QACtR,UAAU,EAAE,KAAK;KAClB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,yCAAyC;YACtD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,WAAW,EAAE,yBAAgB,CAAC,gBAAgB;KAC/C;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,IAAI,GAA4B;gBACpC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;aAChC,CAAC;YACF,IAAI,OAAO,CAAC,UAAU,CAAC,UAAU;gBAAE,IAAI,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC;YACtF,IAAI,OAAO,CAAC,UAAU,CAAC,SAAS;gBAAE,IAAI,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC;YACnF,IAAI,OAAO,CAAC,UAAU,CAAC,WAAW;gBAAE,IAAI,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC;YAEzF,MAAM,QAAQ,GAAG,MAAM,IAAA,0BAAiB,EAErC;gBACD,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAC/B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,IAAI,EAAE,aAAa;gBACnB,IAAI;aACL,CAAC,CAAC;YACH,OAAO,yBAAgB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/D,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const createReferral: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
-
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
affiliate_id: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
4
|
-
}>;
|
|
5
|
-
//# sourceMappingURL=create-referral.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-referral.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-referral.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc;;;EAgCzB,CAAC"}
|