@activepieces/piece-wonderchat 0.1.5 → 0.1.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@activepieces/piece-wonderchat",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
6
  "dependencies": {},
package/src/index.js CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";var ko=Object.create;var Oe=Object.defineProperty;var Oo=Object.getOwnPropertyDescriptor;var wo=Object.getOwnPropertyNames;var Ro=Object.getPrototypeOf,Do=Object.prototype.hasOwnProperty;var i=(e,t)=>Oe(e,"name",{value:t,configurable:!0});var No=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),lr=(e,t)=>{for(var r in t)Oe(e,r,{get:t[r],enumerable:!0})},pr=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of wo(t))!Do.call(e,a)&&a!==r&&Oe(e,a,{get:()=>t[a],enumerable:!(o=Oo(t,a))||o.enumerable});return e};var Ye=(e,t,r)=>(r=e!=null?ko(Ro(e)):{},pr(t||!e||!e.__esModule?Oe(r,"default",{value:e,enumerable:!0}):r,e)),Co=e=>pr(Oe({},"__esModule",{value:!0}),e);var An=No((Sn,yt)=>{(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")},o=new RegExp("^0[0-7]+$","i"),a=new RegExp("^0x[a-f0-9]+$","i"),c="%[0-9a-z]{1,}",p="(?:[0-9a-f]+::?)+",m={zoneIndex:new RegExp(c,"i"),native:new RegExp(`^(::)?(${p})?([0-9a-f]+)?(::)?(${c})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${c})?)$`,"i"),transitional:new RegExp(`^((?:${p})|(?:::)(?:${p})?)${t}\\.${t}\\.${t}\\.${t}(${c})?$`,"i")};function h(s,l){if(s.indexOf("::")!==s.lastIndexOf("::"))return null;let g=0,d=-1,y=(s.match(m.zoneIndex)||[])[0],_,C;for(y&&(y=y.substring(1),s=s.replace(/%.+$/,""));(d=s.indexOf(":",d+1))>=0;)g++;if(s.substr(0,2)==="::"&&g--,s.substr(-2,2)==="::"&&g--,g>l)return null;for(C=l-g,_=":";C--;)_+="0:";return s=s.replace("::",_),s[0]===":"&&(s=s.slice(1)),s[s.length-1]===":"&&(s=s.slice(0,-1)),l=function(){let Q=s.split(":"),_e=[];for(let bt=0;bt<Q.length;bt++)_e.push(parseInt(Q[bt],16));return _e}(),{parts:l,zoneId:y}}i(h,"expandIPv6");function x(s,l,g,d){if(s.length!==l.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let y=0,_;for(;d>0;){if(_=g-d,_<0&&(_=0),s[y]>>_!==l[y]>>_)return!1;d-=g,y+=1}return!0}i(x,"matchCIDR");function P(s){if(a.test(s))return parseInt(s,16);if(s[0]==="0"&&!isNaN(parseInt(s[1],10))){if(o.test(s))return parseInt(s,8);throw new Error(`ipaddr: cannot parse ${s} as octal`)}return parseInt(s,10)}i(P,"parseIntAuto");function O(s,l){for(;s.length<l;)s=`0${s}`;return s}i(O,"padPart");let v={};v.IPv4=function(){function s(l){if(l.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let g,d;for(g=0;g<l.length;g++)if(d=l[g],!(0<=d&&d<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=l}return i(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(l,g){let d;if(g===void 0&&(d=l,l=d[0],g=d[1]),l.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return x(this.octets,l.octets,8,g)},s.prototype.prefixLengthFromSubnetMask=function(){let l=0,g=!1,d={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},y,_,C;for(y=3;y>=0;y-=1)if(_=this.octets[y],_ in d){if(C=d[_],g&&C!==0)return null;C!==8&&(g=!0),l+=C}else return null;return 32-l},s.prototype.range=function(){return v.subnetMatch(this,this.SpecialRanges)},s.prototype.toByteArray=function(){return this.octets.slice(0)},s.prototype.toIPv4MappedAddress=function(){return v.IPv6.parse(`::ffff:${this.toString()}`)},s.prototype.toNormalizedString=function(){return this.toString()},s.prototype.toString=function(){return this.octets.join(".")},s}(),v.IPv4.broadcastAddressFromCIDR=function(s){try{let l=this.parseCIDR(s),g=l[0].toByteArray(),d=this.subnetMaskFromPrefixLength(l[1]).toByteArray(),y=[],_=0;for(;_<4;)y.push(parseInt(g[_],10)|parseInt(d[_],10)^255),_++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},v.IPv4.isIPv4=function(s){return this.parser(s)!==null},v.IPv4.isValid=function(s){try{return new this(this.parser(s)),!0}catch{return!1}},v.IPv4.isValidCIDR=function(s){try{return this.parseCIDR(s),!0}catch{return!1}},v.IPv4.isValidFourPartDecimal=function(s){return!!(v.IPv4.isValid(s)&&s.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},v.IPv4.isValidCIDRFourPartDecimal=function(s){let l=s.match(/^(.+)\/(\d+)$/);return!v.IPv4.isValidCIDR(s)||!l?!1:v.IPv4.isValidFourPartDecimal(l[1])},v.IPv4.networkAddressFromCIDR=function(s){let l,g,d,y,_;try{for(l=this.parseCIDR(s),d=l[0].toByteArray(),_=this.subnetMaskFromPrefixLength(l[1]).toByteArray(),y=[],g=0;g<4;)y.push(parseInt(d[g],10)&parseInt(_[g],10)),g++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},v.IPv4.parse=function(s){let l=this.parser(s);if(l===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(l)},v.IPv4.parseCIDR=function(s){let l;if(l=s.match(/^(.+)\/(\d+)$/)){let g=parseInt(l[2]);if(g>=0&&g<=32){let d=[this.parse(l[1]),g];return Object.defineProperty(d,"toString",{value:i(function(){return this.join("/")},"value")}),d}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},v.IPv4.parser=function(s){let l,g,d;if(l=s.match(r.fourOctet))return function(){let y=l.slice(1,6),_=[];for(let C=0;C<y.length;C++)g=y[C],_.push(P(g));return _}();if(l=s.match(r.longValue)){if(d=P(l[1]),d>4294967295||d<0)throw new Error("ipaddr: address outside defined range");return function(){let y=[],_;for(_=0;_<=24;_+=8)y.push(d>>_&255);return y}().reverse()}else return(l=s.match(r.twoOctet))?function(){let y=l.slice(1,4),_=[];if(d=P(y[1]),d>16777215||d<0)throw new Error("ipaddr: address outside defined range");return _.push(P(y[0])),_.push(d>>16&255),_.push(d>>8&255),_.push(d&255),_}():(l=s.match(r.threeOctet))?function(){let y=l.slice(1,5),_=[];if(d=P(y[2]),d>65535||d<0)throw new Error("ipaddr: address outside defined range");return _.push(P(y[0])),_.push(P(y[1])),_.push(d>>8&255),_.push(d&255),_}():null},v.IPv4.subnetMaskFromPrefixLength=function(s){if(s=parseInt(s),s<0||s>32)throw new Error("ipaddr: invalid IPv4 prefix length");let l=[0,0,0,0],g=0,d=Math.floor(s/8);for(;g<d;)l[g]=255,g++;return d<4&&(l[d]=Math.pow(2,s%8)-1<<8-s%8),new this(l)},v.IPv6=function(){function s(l,g){let d,y;if(l.length===16)for(this.parts=[],d=0;d<=14;d+=2)this.parts.push(l[d]<<8|l[d+1]);else if(l.length===8)this.parts=l;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(d=0;d<this.parts.length;d++)if(y=this.parts[d],!(0<=y&&y<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");g&&(this.zoneId=g)}return i(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(l,g){let d;if(g===void 0&&(d=l,l=d[0],g=d[1]),l.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return x(this.parts,l.parts,16,g)},s.prototype.prefixLengthFromSubnetMask=function(){let l=0,g=!1,d={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},y,_;for(let C=7;C>=0;C-=1)if(y=this.parts[C],y in d){if(_=d[y],g&&_!==0)return null;_!==16&&(g=!0),l+=_}else return null;return 128-l},s.prototype.range=function(){return v.subnetMatch(this,this.SpecialRanges)},s.prototype.toByteArray=function(){let l,g=[],d=this.parts;for(let y=0;y<d.length;y++)l=d[y],g.push(l>>8),g.push(l&255);return g},s.prototype.toFixedLengthString=function(){let l=function(){let d=[];for(let y=0;y<this.parts.length;y++)d.push(O(this.parts[y].toString(16),4));return d}.call(this).join(":"),g="";return this.zoneId&&(g=`%${this.zoneId}`),l+g},s.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let l=this.parts.slice(-2),g=l[0],d=l[1];return new v.IPv4([g>>8,g&255,d>>8,d&255])},s.prototype.toNormalizedString=function(){let l=function(){let d=[];for(let y=0;y<this.parts.length;y++)d.push(this.parts[y].toString(16));return d}.call(this).join(":"),g="";return this.zoneId&&(g=`%${this.zoneId}`),l+g},s.prototype.toRFC5952String=function(){let l=/((^|:)(0(:|$)){2,})/g,g=this.toNormalizedString(),d=0,y=-1,_;for(;_=l.exec(g);)_[0].length>y&&(d=_.index,y=_[0].length);return y<0?g:`${g.substring(0,d)}::${g.substring(d+y)}`},s.prototype.toString=function(){return this.toRFC5952String()},s}(),v.IPv6.broadcastAddressFromCIDR=function(s){try{let l=this.parseCIDR(s),g=l[0].toByteArray(),d=this.subnetMaskFromPrefixLength(l[1]).toByteArray(),y=[],_=0;for(;_<16;)y.push(parseInt(g[_],10)|parseInt(d[_],10)^255),_++;return new this(y)}catch(l){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${l})`)}},v.IPv6.isIPv6=function(s){return this.parser(s)!==null},v.IPv6.isValid=function(s){if(typeof s=="string"&&s.indexOf(":")===-1)return!1;try{let l=this.parser(s);return new this(l.parts,l.zoneId),!0}catch{return!1}},v.IPv6.isValidCIDR=function(s){if(typeof s=="string"&&s.indexOf(":")===-1)return!1;try{return this.parseCIDR(s),!0}catch{return!1}},v.IPv6.networkAddressFromCIDR=function(s){let l,g,d,y,_;try{for(l=this.parseCIDR(s),d=l[0].toByteArray(),_=this.subnetMaskFromPrefixLength(l[1]).toByteArray(),y=[],g=0;g<16;)y.push(parseInt(d[g],10)&parseInt(_[g],10)),g++;return new this(y)}catch(C){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${C})`)}},v.IPv6.parse=function(s){let l=this.parser(s);if(l.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(l.parts,l.zoneId)},v.IPv6.parseCIDR=function(s){let l,g,d;if((g=s.match(/^(.+)\/(\d+)$/))&&(l=parseInt(g[2]),l>=0&&l<=128))return d=[this.parse(g[1]),l],Object.defineProperty(d,"toString",{value:i(function(){return this.join("/")},"value")}),d;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},v.IPv6.parser=function(s){let l,g,d,y,_,C;if(d=s.match(m.deprecatedTransitional))return this.parser(`::ffff:${d[1]}`);if(m.native.test(s))return h(s,8);if((d=s.match(m.transitional))&&(C=d[6]||"",l=d[1],d[1].endsWith("::")||(l=l.slice(0,-1)),l=h(l+C,6),l.parts)){for(_=[parseInt(d[2]),parseInt(d[3]),parseInt(d[4]),parseInt(d[5])],g=0;g<_.length;g++)if(y=_[g],!(0<=y&&y<=255))return null;return l.parts.push(_[0]<<8|_[1]),l.parts.push(_[2]<<8|_[3]),{parts:l.parts,zoneId:l.zoneId}}return null},v.IPv6.subnetMaskFromPrefixLength=function(s){if(s=parseInt(s),s<0||s>128)throw new Error("ipaddr: invalid IPv6 prefix length");let l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],g=0,d=Math.floor(s/8);for(;g<d;)l[g]=255,g++;return d<16&&(l[d]=Math.pow(2,s%8)-1<<8-s%8),new this(l)},v.fromByteArray=function(s){let l=s.length;if(l===4)return new v.IPv4(s);if(l===16)return new v.IPv6(s);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},v.isValid=function(s){return v.IPv6.isValid(s)||v.IPv4.isValid(s)},v.isValidCIDR=function(s){return v.IPv6.isValidCIDR(s)||v.IPv4.isValidCIDR(s)},v.parse=function(s){if(v.IPv6.isValid(s))return v.IPv6.parse(s);if(v.IPv4.isValid(s))return v.IPv4.parse(s);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},v.parseCIDR=function(s){try{return v.IPv6.parseCIDR(s)}catch{try{return v.IPv4.parseCIDR(s)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},v.process=function(s){let l=this.parse(s);return l.kind()==="ipv6"&&l.isIPv4MappedAddress()?l.toIPv4Address():l},v.subnetMatch=function(s,l,g){let d,y,_,C;g==null&&(g="unicast");for(y in l)if(Object.prototype.hasOwnProperty.call(l,y)){for(_=l[y],_[0]&&!(_[0]instanceof Array)&&(_=[_]),d=0;d<_.length;d++)if(C=_[d],s.kind()===C[0].kind()&&s.match.apply(s,C))return y}return g},typeof yt<"u"&&yt.exports?yt.exports=v:e.ipaddr=v})(Sn)});var fs={};lr(fs,{wonderchat:()=>ms,wonderchatAuth:()=>X});module.exports=Co(fs);var Uo=Object.freeze({status:"aborted"});function I(e,t,r){function o(m,h){if(m._zod||Object.defineProperty(m,"_zod",{value:{def:h,constr:p,traits:new Set},enumerable:!1}),m._zod.traits.has(e))return;m._zod.traits.add(e),t(m,h);let x=p.prototype,P=Object.keys(x);for(let O=0;O<P.length;O++){let v=P[O];v in m||(m[v]=x[v].bind(m))}}i(o,"init");let a=r?.Parent??Object;class c extends a{static{i(this,"Definition")}}Object.defineProperty(c,"name",{value:e});function p(m){var h;let x=r?.Parent?new c:this;o(x,m),(h=x._zod).deferred??(h.deferred=[]);for(let P of x._zod.deferred)P();return x}return i(p,"_"),Object.defineProperty(p,"init",{value:o}),Object.defineProperty(p,Symbol.hasInstance,{value:i(m=>r?.Parent&&m instanceof r.Parent?!0:m?._zod?.traits?.has(e),"value")}),Object.defineProperty(p,"name",{value:e}),p}i(I,"$constructor");var Mo=Symbol("zod_brand"),ee=class extends Error{static{i(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Qe=class extends Error{static{i(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},$t={};function ne(e){return e&&Object.assign($t,e),$t}i(ne,"config");function zt(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,a])=>t.indexOf(+o)===-1).map(([o,a])=>a)}i(zt,"getEnumValues");function mr(e,t){return typeof t=="bigint"?t.toString():t}i(mr,"jsonStringifyReplacer");function tt(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}i(tt,"cached");function fr(e){return e==null}i(fr,"nullish");function rt(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}i(rt,"cleanRegex");var dr=Symbol("evaluating");function V(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==dr)return o===void 0&&(o=dr,o=r()),o},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}i(V,"defineLazy");var St="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function we(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}i(we,"isObject");var Lo=tt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function gr(e){if(we(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(we(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}i(gr,"isPlainObject");var yr=new Set(["string","number","symbol"]);function Pe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}i(Pe,"escapeRegex");function nt(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}i(nt,"clone");function j(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:i(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:i(()=>t.error,"error")}:t}i(j,"normalizeParams");function hr(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}i(hr,"optionalKeys");var jo={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 Ie(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}i(Ie,"aborted");function ce(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}i(ce,"prefixIssues");function et(e){return typeof e=="string"?e:e?.message}i(et,"unwrapMessage");function le(e,t,r){let o={...e,path:e.path??[]};if(!e.message){let a=et(e.inst?._zod.def?.error?.(e))??et(t?.error?.(e))??et(r.customError?.(e))??et(r.localeError?.(e))??"Invalid input";o.message=a}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}i(le,"finalizeIssue");function vr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}i(vr,"getLengthableOrigin");function At(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}i(At,"issue");var xr=i((e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,mr,2),Object.defineProperty(e,"toString",{value:i(()=>e.message,"value"),enumerable:!1})},"initializer"),_r=I("$ZodError",xr),Re=I("$ZodError",xr,{Parent:Error});var Zo=i(e=>(t,r,o,a)=>{let c=o?Object.assign(o,{async:!1}):{async:!1},p=t._zod.run({value:r,issues:[]},c);if(p instanceof Promise)throw new ee;if(p.issues.length){let m=new(a?.Err??e)(p.issues.map(h=>le(h,c,ne())));throw St(m,a?.callee),m}return p.value},"_parse"),ot=Zo(Re),Vo=i(e=>async(t,r,o,a)=>{let c=o?Object.assign(o,{async:!0}):{async:!0},p=t._zod.run({value:r,issues:[]},c);if(p instanceof Promise&&(p=await p),p.issues.length){let m=new(a?.Err??e)(p.issues.map(h=>le(h,c,ne())));throw St(m,a?.callee),m}return p.value},"_parseAsync"),it=Vo(Re),Bo=i(e=>(t,r,o)=>{let a=o?{...o,async:!1}:{async:!1},c=t._zod.run({value:r,issues:[]},a);if(c instanceof Promise)throw new ee;return c.issues.length?{success:!1,error:new(e??_r)(c.issues.map(p=>le(p,a,ne())))}:{success:!0,data:c.value}},"_safeParse"),De=Bo(Re),Ho=i(e=>async(t,r,o)=>{let a=o?Object.assign(o,{async:!0}):{async:!0},c=t._zod.run({value:r,issues:[]},a);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(p=>le(p,a,ne())))}:{success:!0,data:c.value}},"_safeParseAsync"),Ne=Ho(Re);var Wo="(?:(?:\\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])))",Go=new RegExp(`^${Wo}$`);var Pr=i(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),Ir=/^-?\d+n?$/;var kt=/^-?\d+(?:\.\d+)?$/,Tr=/^(?:true|false)$/i;var Te=I("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var br=I("$ZodCheckMinLength",(e,t)=>{var r;Te.init(e,t),(r=e._zod.def).when??(r.when=o=>{let a=o.value;return!fr(a)&&a.length!==void 0}),e._zod.onattach.push(o=>{let a=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let a=o.value;if(a.length>=t.minimum)return;let p=vr(a);o.issues.push({origin:p,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}});var Ot=I("$ZodCheckStringFormat",(e,t)=>{var r,o;Te.init(e,t),e._zod.onattach.push(a=>{let c=a._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),$r=I("$ZodCheckRegex",(e,t)=>{Ot.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 zr={major:4,minor:3,patch:6};var F=I("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=zr;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let a of o)for(let c of a._zod.onattach)c(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let a=i((p,m,h)=>{let x=Ie(p),P;for(let O of m){if(O._zod.def.when){if(!O._zod.def.when(p))continue}else if(x)continue;let v=p.issues.length,s=O._zod.check(p);if(s instanceof Promise&&h?.async===!1)throw new ee;if(P||s instanceof Promise)P=(P??Promise.resolve()).then(async()=>{await s,p.issues.length!==v&&(x||(x=Ie(p,v)))});else{if(p.issues.length===v)continue;x||(x=Ie(p,v))}}return P?P.then(()=>p):p},"runChecks"),c=i((p,m,h)=>{if(Ie(p))return p.aborted=!0,p;let x=a(m,o,h);if(x instanceof Promise){if(h.async===!1)throw new ee;return x.then(P=>e._zod.parse(P,h))}return e._zod.parse(x,h)},"handleCanaryResult");e._zod.run=(p,m)=>{if(m.skipChecks)return e._zod.parse(p,m);if(m.direction==="backward"){let x=e._zod.parse({value:p.value,issues:[]},{...m,skipChecks:!0});return x instanceof Promise?x.then(P=>c(P,p,m)):c(x,p,m)}let h=e._zod.parse(p,m);if(h instanceof Promise){if(m.async===!1)throw new ee;return h.then(x=>a(x,o,m))}return a(h,o,m)}}V(e,"~standard",()=>({validate:i(a=>{try{let c=De(e,a);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return Ne(e,a).then(p=>p.success?{value:p.data}:{issues:p.error?.issues})}},"validate"),vendor:"zod",version:1}))}),ut=I("$ZodString",(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Pr(e._zod.bag),e._zod.parse=(r,o)=>{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}}),wt=I("$ZodStringFormat",(e,t)=>{Ot.init(e,t),ut.init(e,t)});var wr=I("$ZodURL",(e,t)=>{wt.init(e,t),e._zod.check=r=>{try{let o=r.value.trim(),a=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.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(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.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=a.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var Rr=I("$ZodNumber",(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??kt,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let a=r.value;if(typeof a=="number"&&!Number.isNaN(a)&&Number.isFinite(a))return r;let c=typeof a=="number"?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:a,inst:e,...c?{received:c}:{}}),r}});var Rt=I("$ZodBoolean",(e,t)=>{F.init(e,t),e._zod.pattern=Tr,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let a=r.value;return typeof a=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:e}),r}}),Dr=I("$ZodBigInt",(e,t)=>{F.init(e,t),e._zod.pattern=Ir,e._zod.parse=(r,o)=>{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 Nr=I("$ZodAny",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),Cr=I("$ZodUnknown",(e,t)=>{F.init(e,t),e._zod.parse=r=>r});var Ur=I("$ZodVoid",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{let a=r.value;return typeof a>"u"||r.issues.push({expected:"void",code:"invalid_type",input:a,inst:e}),r}}),Mr=I("$ZodDate",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let a=r.value,c=a instanceof Date;return c&&!Number.isNaN(a.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:a,...c?{received:"Invalid Date"}:{},inst:e}),r}});function Sr(e,t,r){e.issues.length&&t.issues.push(...ce(r,e.issues)),t.value[r]=e.value}i(Sr,"handleArrayResult");var Lr=I("$ZodArray",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);let c=[];for(let p=0;p<a.length;p++){let m=a[p],h=t.element._zod.run({value:m,issues:[]},o);h instanceof Promise?c.push(h.then(x=>Sr(x,r,p))):Sr(h,r,p)}return c.length?Promise.all(c).then(()=>r):r}});function st(e,t,r,o,a){if(e.issues.length){if(a&&!(r in o))return;t.issues.push(...ce(r,e.issues))}e.value===void 0?r in o&&(t.value[r]=void 0):t.value[r]=e.value}i(st,"handlePropertyResult");function Ko(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=hr(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}i(Ko,"normalizeDef");function Jo(e,t,r,o,a,c){let p=[],m=a.keySet,h=a.catchall._zod,x=h.def.type,P=h.optout==="optional";for(let O in t){if(m.has(O))continue;if(x==="never"){p.push(O);continue}let v=h.run({value:t[O],issues:[]},o);v instanceof Promise?e.push(v.then(s=>st(s,r,O,t,P))):st(v,r,O,t,P)}return p.length&&r.issues.push({code:"unrecognized_keys",keys:p,input:t,inst:c}),e.length?Promise.all(e).then(()=>r):r}i(Jo,"handleCatchall");var jr=I("$ZodObject",(e,t)=>{if(F.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let m=t.shape;Object.defineProperty(t,"shape",{get:i(()=>{let h={...m};return Object.defineProperty(t,"shape",{value:h}),h},"get")})}let o=tt(()=>Ko(t));V(e._zod,"propValues",()=>{let m=t.shape,h={};for(let x in m){let P=m[x]._zod;if(P.values){h[x]??(h[x]=new Set);for(let O of P.values)h[x].add(O)}}return h});let a=we,c=t.catchall,p;e._zod.parse=(m,h)=>{p??(p=o.value);let x=m.value;if(!a(x))return m.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),m;m.value={};let P=[],O=p.shape;for(let v of p.keys){let s=O[v],l=s._zod.optout==="optional",g=s._zod.run({value:x[v],issues:[]},h);g instanceof Promise?P.push(g.then(d=>st(d,m,v,x,l))):st(g,m,v,x,l)}return c?Jo(P,x,m,h,o.value,e):P.length?Promise.all(P).then(()=>m):m}});function Ar(e,t,r,o){for(let c of e)if(c.issues.length===0)return t.value=c.value,t;let a=e.filter(c=>!Ie(c));return a.length===1?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(c=>c.issues.map(p=>le(p,o,ne())))}),t)}i(Ar,"handleUnionResults");var Dt=I("$ZodUnion",(e,t)=>{F.init(e,t),V(e._zod,"optin",()=>t.options.some(a=>a._zod.optin==="optional")?"optional":void 0),V(e._zod,"optout",()=>t.options.some(a=>a._zod.optout==="optional")?"optional":void 0),V(e._zod,"values",()=>{if(t.options.every(a=>a._zod.values))return new Set(t.options.flatMap(a=>Array.from(a._zod.values)))}),V(e._zod,"pattern",()=>{if(t.options.every(a=>a._zod.pattern)){let a=t.options.map(c=>c._zod.pattern);return new RegExp(`^(${a.map(c=>rt(c.source)).join("|")})$`)}});let r=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(a,c)=>{if(r)return o(a,c);let p=!1,m=[];for(let h of t.options){let x=h._zod.run({value:a.value,issues:[]},c);if(x instanceof Promise)m.push(x),p=!0;else{if(x.issues.length===0)return x;m.push(x)}}return p?Promise.all(m).then(h=>Ar(h,a,e,c)):Ar(m,a,e,c)}});var Fr=I("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Dt.init(e,t);let r=e._zod.parse;V(e._zod,"propValues",()=>{let a={};for(let c of t.options){let p=c._zod.propValues;if(!p||Object.keys(p).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(c)}"`);for(let[m,h]of Object.entries(p)){a[m]||(a[m]=new Set);for(let x of h)a[m].add(x)}}return a});let o=tt(()=>{let a=t.options,c=new Map;for(let p of a){let m=p._zod.propValues?.[t.discriminator];if(!m||m.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(p)}"`);for(let h of m){if(c.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);c.set(h,p)}}return c});e._zod.parse=(a,c)=>{let p=a.value;if(!we(p))return a.issues.push({code:"invalid_type",expected:"object",input:p,inst:e}),a;let m=o.value.get(p?.[t.discriminator]);return m?m._zod.run(a,c):t.unionFallback?r(a,c):(a.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:p,path:[t.discriminator],inst:e}),a)}});var Zr=I("$ZodRecord",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{let a=r.value;if(!gr(a))return r.issues.push({expected:"record",code:"invalid_type",input:a,inst:e}),r;let c=[],p=t.keyType._zod.values;if(p){r.value={};let m=new Set;for(let x of p)if(typeof x=="string"||typeof x=="number"||typeof x=="symbol"){m.add(typeof x=="number"?x.toString():x);let P=t.valueType._zod.run({value:a[x],issues:[]},o);P instanceof Promise?c.push(P.then(O=>{O.issues.length&&r.issues.push(...ce(x,O.issues)),r.value[x]=O.value})):(P.issues.length&&r.issues.push(...ce(x,P.issues)),r.value[x]=P.value)}let h;for(let x in a)m.has(x)||(h=h??[],h.push(x));h&&h.length>0&&r.issues.push({code:"unrecognized_keys",input:a,inst:e,keys:h})}else{r.value={};for(let m of Reflect.ownKeys(a)){if(m==="__proto__")continue;let h=t.keyType._zod.run({value:m,issues:[]},o);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof m=="string"&&kt.test(m)&&h.issues.length){let O=t.keyType._zod.run({value:Number(m),issues:[]},o);if(O instanceof Promise)throw new Error("Async schemas not supported in object keys currently");O.issues.length===0&&(h=O)}if(h.issues.length){t.mode==="loose"?r.value[m]=a[m]:r.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(O=>le(O,o,ne())),input:m,path:[m],inst:e});continue}let P=t.valueType._zod.run({value:a[m],issues:[]},o);P instanceof Promise?c.push(P.then(O=>{O.issues.length&&r.issues.push(...ce(m,O.issues)),r.value[h.value]=O.value})):(P.issues.length&&r.issues.push(...ce(m,P.issues)),r.value[h.value]=P.value)}}return c.length?Promise.all(c).then(()=>r):r}});var Vr=I("$ZodEnum",(e,t)=>{F.init(e,t);let r=zt(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(a=>yr.has(typeof a)).map(a=>typeof a=="string"?Pe(a):a.toString()).join("|")})$`),e._zod.parse=(a,c)=>{let p=a.value;return o.has(p)||a.issues.push({code:"invalid_value",values:r,input:p,inst:e}),a}}),Br=I("$ZodLiteral",(e,t)=>{if(F.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(o=>typeof o=="string"?Pe(o):o?Pe(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,a)=>{let c=o.value;return r.has(c)||o.issues.push({code:"invalid_value",values:t.values,input:c,inst:e}),o}});var Hr=I("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Qe(e.constructor.name);let a=t.transform(r.value,r);if(o.async)return(a instanceof Promise?a:Promise.resolve(a)).then(p=>(r.value=p,r));if(a instanceof Promise)throw new ee;return r.value=a,r}});function kr(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}i(kr,"handleOptionalResult");var Wr=I("$ZodOptional",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.optout="optional",V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${rt(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let a=t.innerType._zod.run(r,o);return a instanceof Promise?a.then(c=>kr(c,r.value)):kr(a,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,o)}});var Gr=I("$ZodNullable",(e,t)=>{F.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${rt(r.source)}|null)$`):void 0}),V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)});var Kr=I("$ZodPipe",(e,t)=>{F.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let c=t.out._zod.run(r,o);return c instanceof Promise?c.then(p=>at(p,t.in,o)):at(c,t.in,o)}let a=t.in._zod.run(r,o);return a instanceof Promise?a.then(c=>at(c,t.out,o)):at(a,t.out,o)}});function at(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}i(at,"handlePipeResult");var Jr=I("$ZodCustom",(e,t)=>{Te.init(e,t),F.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,a=t.fn(o);if(a instanceof Promise)return a.then(c=>Or(c,r,o,e));Or(a,r,o,e)}});function Or(e,t,r,o){if(!e){let a={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(a.params=o._zod.def.params),t.issues.push(At(a))}}i(Or,"handleRefineResult");var Xr,Qo=Symbol("ZodOutput"),ei=Symbol("ZodInput"),Nt=class{static{i(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.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 o={...this.get(r)??{}};delete o.id;let a={...o,...this._map.get(t)};return Object.keys(a).length?a:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Yr(){return new Nt}i(Yr,"registry");(Xr=globalThis).__zod_globalRegistry??(Xr.__zod_globalRegistry=Yr());var Ct=globalThis.__zod_globalRegistry;function Qr(e,t){return new e({type:"string",...j(t)})}i(Qr,"_string");function en(e,t){return new e({type:"string",coerce:!0,...j(t)})}i(en,"_coercedString");function tn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...j(t)})}i(tn,"_url");function rn(e,t){return new e({type:"number",checks:[],...j(t)})}i(rn,"_number");function nn(e,t){return new e({type:"number",coerce:!0,checks:[],...j(t)})}i(nn,"_coercedNumber");function on(e,t){return new e({type:"boolean",...j(t)})}i(on,"_boolean");function an(e,t){return new e({type:"boolean",coerce:!0,...j(t)})}i(an,"_coercedBoolean");function sn(e,t){return new e({type:"bigint",coerce:!0,...j(t)})}i(sn,"_coercedBigint");function un(e){return new e({type:"any"})}i(un,"_any");function cn(e){return new e({type:"unknown"})}i(cn,"_unknown");function ln(e,t){return new e({type:"void",...j(t)})}i(ln,"_void");function pn(e,t){return new e({type:"date",coerce:!0,...j(t)})}i(pn,"_coercedDate");function Y(e,t){return new br({check:"min_length",...j(t),minimum:e})}i(Y,"_minLength");function pe(e,t){return new $r({check:"string_format",format:"regex",...j(t),pattern:e})}i(pe,"_regex");function dn(e,t,r){let o=j(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}i(dn,"_custom");var B=I("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");F.init(e,t),e.def=t,e.type=t.type,e.parse=(r,o)=>ot(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>De(e,r,o),e.parseAsync=async(r,o)=>it(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Ne(e,r,o),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]},{parent:!0}),e.with=e.check,e.clone=(r,o)=>nt(e,r,o),e.brand=()=>e,e.register=(r,o)=>(r.add(e,o),e),e.apply=r=>r(e)}),lt=I("ZodMiniString",(e,t)=>{ut.init(e,t),B.init(e,t)});function n(e){return Qr(lt,e)}i(n,"string");var mn=I("ZodMiniStringFormat",(e,t)=>{wt.init(e,t),lt.init(e,t)});var li=I("ZodMiniURL",(e,t)=>{wr.init(e,t),mn.init(e,t)});function fn(e){return tn(li,e)}i(fn,"url");var Ut=I("ZodMiniNumber",(e,t)=>{Rr.init(e,t),B.init(e,t)});function W(e){return rn(Ut,e)}i(W,"number");var Mt=I("ZodMiniBoolean",(e,t)=>{Rt.init(e,t),B.init(e,t)});function M(e){return on(Mt,e)}i(M,"boolean");var gn=I("ZodMiniBigInt",(e,t)=>{Dr.init(e,t),B.init(e,t)});var pi=I("ZodMiniAny",(e,t)=>{Nr.init(e,t),B.init(e,t)});function Ue(){return un(pi)}i(Ue,"any");var di=I("ZodMiniUnknown",(e,t)=>{Cr.init(e,t),B.init(e,t)});function S(){return cn(di)}i(S,"unknown");var mi=I("ZodMiniVoid",(e,t)=>{Ur.init(e,t),B.init(e,t)});function yn(e){return ln(mi,e)}i(yn,"_void");var hn=I("ZodMiniDate",(e,t)=>{Mr.init(e,t),B.init(e,t)});var fi=I("ZodMiniArray",(e,t)=>{Lr.init(e,t),B.init(e,t)});function w(e,t){return new fi({type:"array",element:e,...j(t)})}i(w,"array");var gi=I("ZodMiniObject",(e,t)=>{jr.init(e,t),B.init(e,t),V(e,"shape",()=>t.shape)});function u(e,t){let r={type:"object",shape:e??{},...j(t)};return new gi(r)}i(u,"object");var yi=I("ZodMiniUnion",(e,t)=>{Dt.init(e,t),B.init(e,t)});function R(e,t){return new yi({type:"union",options:e,...j(t)})}i(R,"union");var hi=I("ZodMiniDiscriminatedUnion",(e,t)=>{Fr.init(e,t),B.init(e,t)});function be(e,t,r){return new hi({type:"union",options:t,discriminator:e,...j(r)})}i(be,"discriminatedUnion");var vi=I("ZodMiniRecord",(e,t)=>{Zr.init(e,t),B.init(e,t)});function A(e,t,r){return new vi({type:"record",keyType:e,valueType:t,...j(r)})}i(A,"record");var xi=I("ZodMiniEnum",(e,t)=>{Vr.init(e,t),B.init(e,t),e.options=Object.values(t.entries)});function N(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new xi({type:"enum",entries:r,...j(t)})}i(N,"_enum");var _i=I("ZodMiniLiteral",(e,t)=>{Br.init(e,t),B.init(e,t)});function b(e,t){return new _i({type:"literal",values:Array.isArray(e)?e:[e],...j(t)})}i(b,"literal");var Pi=I("ZodMiniTransform",(e,t)=>{Hr.init(e,t),B.init(e,t)});function de(e){return new Pi({type:"transform",transform:e})}i(de,"transform");var Ii=I("ZodMiniOptional",(e,t)=>{Wr.init(e,t),B.init(e,t)});function f(e){return new Ii({type:"optional",innerType:e})}i(f,"optional");var Ti=I("ZodMiniNullable",(e,t)=>{Gr.init(e,t),B.init(e,t)});function Me(e){return new Ti({type:"nullable",innerType:e})}i(Me,"nullable");var bi=I("ZodMiniPipe",(e,t)=>{Kr.init(e,t),B.init(e,t)});function me(e,t){return new bi({type:"pipe",in:e,out:t})}i(me,"pipe");var $i=I("ZodMiniCustom",(e,t)=>{Jr.init(e,t),B.init(e,t)});function pt(e,t){return dn($i,e??(()=>!0),t)}i(pt,"custom");var Le={};lr(Le,{bigint:()=>wi,boolean:()=>Oi,date:()=>Ri,number:()=>ki,string:()=>Ai});function Ai(e){return en(lt,e)}i(Ai,"string");function ki(e){return nn(Ut,e)}i(ki,"number");function Oi(e){return an(Mt,e)}i(Oi,"boolean");function wi(e){return sn(gn,e)}i(wi,"bigint");function Ri(e){return pn(hn,e)}i(Ri,"date");var jt=u({retryOnFailure:u({defaultValue:f(M()),hide:f(M())}),continueOnFailure:u({defaultValue:f(M()),hide:f(M())})}),Lt=class{constructor(t,r,o,a,c,p,m,h,x,P,O){this.name=t;this.displayName=r;this.description=o;this.props=a;this.run=c;this.test=p;this.requireAuth=m;this.errorHandlingOptions=h;this.outputSchema=x;this.audience=P;this.aiMetadata=O}static{i(this,"IAction")}},fe=i(e=>new Lt(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 U=u({displayName:n(),description:f(n())}),D=i((e,t)=>u({type:b(t),required:M(),defaultValue:f(Ue())}),"TPropertyValue");var K=u({...U.shape,...D(n(),"SHORT_TEXT").shape}),oe=u({...U.shape,...D(n(),"LONG_TEXT").shape});var xn=u({label:n(),value:S()}),dt=u({disabled:f(M()),placeholder:f(n()),options:w(xn)});var J=u({...U.shape,options:dt,...D(S(),"STATIC_DROPDOWN").shape}),ie=u({...U.shape,options:dt,...D(w(S()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var Ft=u({...U.shape,...D(S(),"DROPDOWN").shape,refreshers:w(n())}),je=u({...U.shape,...D(w(S()),"MULTI_SELECT_DROPDOWN").shape,refreshers:w(n())});var ae=u({...U.shape,...D(M(),"CHECKBOX").shape});var se=u({...U.shape,...D(W(),"NUMBER").shape});var Fe=u({...U.shape,...D(S(),"FILE").shape});var Ze=u({...U.shape,...D(n(),"DATE_TIME").shape});var _n=A(n(),R([K,oe,J,je,ie,ae,se,Fe,Ze])),Ve=u({...U.shape,properties:_n,...D(w(S()),"ARRAY").shape});var Be=u({...U.shape,...D(R([A(n(),S())]),"JSON").shape});var Pn=R([K,J,Be,Ve,ie]),Ni=A(n(),Pn),Zt=u({refreshers:w(n()),...U.shape,...D(S(),"DYNAMIC").shape});var mt=u({...U.shape,...D(yn(),"MARKDOWN").shape});var He=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(He||{}),$e=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))($e||{}),Ee=(y=>(y.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",y.COMMUNICATION="COMMUNICATION",y.COMMERCE="COMMERCE",y.CORE="CORE",y.UNIVERSAL_AI="UNIVERSAL_AI",y.FLOW_CONTROL="FLOW_CONTROL",y.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",y.ACCOUNTING="ACCOUNTING",y.PRODUCTIVITY="PRODUCTIVITY",y.CONTENT_AND_FILES="CONTENT_AND_FILES",y.DEVELOPER_TOOLS="DEVELOPER_TOOLS",y.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",y.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",y.HUMAN_RESOURCES="HUMAN_RESOURCES",y.PAYMENT_PROCESSING="PAYMENT_PROCESSING",y.MARKETING="MARKETING",y.SALES_AND_CRM="SALES_AND_CRM",y))(Ee||{});var We=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(We||{}),Vt="both_client_credentials_and_authorization_code";var ge=(a=>(a.POLLING="POLLING",a.WEBHOOK="WEBHOOK",a.APP_WEBHOOK="APP_WEBHOOK",a.MANUAL="MANUAL",a))(ge||{}),Ge=(c=>(c.NONE="NONE",c.HEADER_PRESENT="HEADER_PRESENT",c.QUERY_PRESENT="QUERY_PRESENT",c.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",c.HEAD_REQUEST="HEAD_REQUEST",c))(Ge||{}),Ci=u({strategy:N(Ge),paramName:f(n())}),Ke=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(Ke||{});var ft=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(ft||{}),In=u({status:f(W()),body:f(S()),headers:f(A(n(),n()))}),Tn=u({type:b("DELAY"),resumeDateTime:n(),requestIdToReply:f(n()),handlerId:f(n()),streamStepProgress:f(N(ft))}),bn=u({type:b("WEBHOOK"),requestId:n(),requestIdToReply:f(n()),response:In,handlerId:f(n()),streamStepProgress:f(N(ft))}),Ui=R([Tn,bn]);var Mi=u({body:S(),rawBody:f(S()),headers:A(n(),n()),queryParams:A(n(),n())});function G(e){return e==null}i(G,"isNil");var Bt=Ye(require("crypto"),1);var Li=128,he,ze,ji=i(e=>{!he||he.length<e?(he=Buffer.allocUnsafe(e*Li),Bt.default.randomFillSync(he),ze=0):ze+e>he.length&&(Bt.default.randomFillSync(he),ze=0),ze+=e},"fillPool"),Fi=i(e=>(ji(e|=0),he.subarray(ze-e,ze)),"random"),Zi=i((e,t,r)=>{let o=(2<<31-Math.clz32(e.length-1|1))-1,a=Math.ceil(1.6*o*t/e.length);return(c=t)=>{let p="";for(;;){let m=r(a),h=a;for(;h--;)if(p+=e[m[h]&o]||"",p.length===c)return p}}},"customRandom"),En=i((e,t=21)=>Zi(e,t,Fi),"customAlphabet");var Vi="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",zn=21,Xy=n().check(pe(new RegExp(`^[0-9a-zA-Z]{${zn}}$`))),Bi=En(Vi,zn);var ye=me(de(e=>e instanceof Date?e.toISOString():e),n()),q={id:n(),created:ye,updated:ye},L=i(e=>f(Me(e)),"Nullable");function Ht(e){return f(Me(N(e)))}i(Ht,"NullableEnum");var eh=me(de(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),f(M())),gt=i(e=>me(de(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),f(w(e))),"OptionalArrayFromQuery");var nh=A(n(),S());var Je=(P=>(P.OPENAI="openai",P.OPENROUTER="openrouter",P.ANTHROPIC="anthropic",P.AZURE="azure",P.GOOGLE="google",P.ACTIVEPIECES="activepieces",P.CLOUDFLARE_GATEWAY="cloudflare-gateway",P.CUSTOM="custom",P.BEDROCK="bedrock",P.MISTRAL="mistral",P))(Je||{});var gh=n().check(pe(/^#[0-9A-Fa-f]{6}$/));var hh=u({filename:n(),data:S(),type:b("file"),mimetype:f(n())});var Hi=Ye(An());var bh=u({...q,name:n(),permissions:w(n()),platformId:L(n()),type:n(),userCount:f(W())});var kn=(o=>(o.AGENT_DECIDE="agent-decide",o.CHOOSE_YOURSELF="choose-yourself",o.LEAVE_EMPTY="leave-empty",o))(kn||{}),Wt=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(Wt||{}),Gt=(o=>(o.SSE="sse",o.STREAMABLE_HTTP="streamable-http",o.SIMPLE_HTTP="http",o))(Gt||{});var Kt=(o=>(o.TEXT="text",o.NUMBER="number",o.BOOLEAN="boolean",o))(Kt||{});var Jt=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(Jt||{});var Wi=u({mode:N(kn),value:S()}),Gi=u({auth:f(n()),fields:A(n(),Wi)}),Ki=u({pieceName:n(),pieceVersion:n(),actionName:n(),predefinedInput:f(Gi)}),Ji=u({type:b("PIECE"),toolName:n().check(Y(1)),pieceMetadata:Ki}),qi=u({type:b("none")}),Xi=u({type:b("access_token"),accessToken:n()}),Yi=u({type:b("api_key"),apiKey:n(),apiKeyHeader:n()}),Qi=u({type:b("headers"),headers:A(n(),n())}),ea=be("type",[qi,Xi,Yi,Qi]),On=u({type:b("FLOW"),toolName:n().check(Y(1)),externalFlowId:n(),flowDisplayName:f(n())}),wn=u({type:b("MCP"),toolName:n().check(Y(1)),serverUrl:fn(),protocol:N(Gt),auth:ea}),Rn=u({type:b("KNOWLEDGE_BASE"),toolName:n().check(Y(1)),sourceType:N(Wt),sourceId:n(),sourceName:n()}),ta=be("type",[Ji,On,wn,Rn]),ra=u({displayName:n(),description:f(n()),type:N(Kt)}),Dn=u({type:b("MARKDOWN"),markdown:n()}),Se={type:b("TOOL_CALL"),input:L(A(n(),S())),output:f(S()),toolName:n(),status:N(Jt),toolCallId:n(),startTime:n(),endTime:f(n())},Xh=u(Se),Nn=be("toolCallType",[u({...Se,toolCallType:b("PIECE"),pieceName:n(),pieceVersion:n(),actionName:n()}),u({...Se,toolCallType:b("FLOW"),displayName:n(),externalFlowId:n()}),u({...Se,toolCallType:b("MCP"),displayName:n(),serverUrl:n()}),u({...Se,toolCallType:b("KNOWLEDGE_BASE"),displayName:n(),sourceType:n()}),u({...Se,toolCallType:b("UNKNOWN"),displayName:n()})]),na=R([Dn,Nn]);var qt=(r=>(r.IMAGE="image",r.TEXT="text",r))(qt||{}),ue=u({apiKey:n()}),oa=ue,ia=u({apiKey:n(),apiKeyHash:n()}),aa=ue,sa=ue,ua=ue,ca=ue,la=ue,pa=ue,da=ue,Cn=u({accessKeyId:n().check(Y(1)),secretAccessKey:n().check(Y(1))}),ma=u({}),fa=u({}),ga=u({}),ya=u({}),ha=u({}),va=u({}),Un=u({modelId:n(),modelName:n(),modelType:N(qt)}),Mn=u({apiKeyHeader:n(),baseUrl:n(),models:w(Un),defaultHeaders:f(A(n(),n()))}),Ln=u({accountId:n(),gatewayId:n(),models:w(Un),vertexProject:f(n()),vertexRegion:f(n())}),jn=u({resourceName:n(),apiVersion:me(de(e=>typeof e=="string"&&e.trim().length===0?void 0:e),f(n()))}),Fn=u({region:n().check(Y(1))}),xa=R([oa,ua,ca,la,pa,sa,aa,ia,Cn,da]),Zn=R([Mn,Ln,jn,Fn,ma,ga,ya,ha,fa,va]),_a=u({id:n(),name:n(),type:N(qt)}),Pa=u({id:n(),name:n(),provider:N(Je),config:Zn,enabledForChat:M()}),Ia=u({provider:N(Je),config:Zn,auth:xa,platformId:n()});var tv={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"};var Ta=u({base64Url:n(),fileName:n(),extension:f(n())}),ba=u({mimeType:n(),url:n(),fileName:f(n())}),Xt=R([Ta,ba]);var $a=R([u({type:b("file"),value:Xt}),u({type:b("markdown"),value:n(),files:f(w(Xt))})]),Ea=u({sessionId:n(),message:n(),files:f(w(n()))});var Bn=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(Bn||{}),Hn=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(Hn||{}),Yt=(o=>(o.RECORD_CREATED="RECORD_CREATED",o.RECORD_UPDATED="RECORD_UPDATED",o.RECORD_DELETED="RECORD_DELETED",o))(Yt||{});var za=R([u({...q,name:n(),externalId:n(),type:b("STATIC_DROPDOWN"),tableId:n(),projectId:n(),data:u({options:w(u({value:n()}))})}),u({...q,name:n(),externalId:n(),type:R([b("TEXT"),b("NUMBER"),b("DATE")]),tableId:n(),projectId:n()})]),Sa=u({...q,name:n(),folderId:L(n()),projectId:n(),externalId:n(),status:Ht(Hn),trigger:Ht(Bn)}),Aa=u({...q,tableId:n(),projectId:n(),cells:A(n(),u({updated:n(),created:n(),value:S(),fieldName:n()}))}),ka=u({events:w(N(Yt)),webhookUrl:n(),flowId:n()}),Oa=u({fields:w(u({id:n(),name:n()})),rows:w(A(n(),n())),name:n()}),wa=u({projectId:n(),limit:f(Le.number()),cursor:f(n()),name:f(n()),externalIds:gt(n()),folderId:f(n()),folderIds:gt(n())}),Ra=u({records:w(w(u({fieldId:n(),value:Gn()}))),tableId:n()}),Da=u({cells:f(w(u({fieldId:n(),value:Gn()}))),tableId:n(),agentUpdate:f(M())}),Wn=be("operator",[ve("eq"),ve("neq"),ve("gt"),ve("gte"),ve("lt"),ve("lte"),ve("co"),Vn("exists"),Vn("not_exists")]),Na=u({tableId:n(),limit:f(Le.number()),cursor:f(n()),filters:gt(Wn)});function Gn(){return me(de(e=>e==null?e:String(e)),Me(n()))}i(Gn,"coerceToString");function ve(e){return u({fieldId:n(),operator:b(e),value:n()})}i(ve,"valueFilter");function Vn(e){return u({fieldId:n(),operator:b(e)})}i(Vn,"existenceFilter");var Ca=u({status:f(W()),body:f(S()),headers:f(A(n(),n()))}),Ua=u({...q,deleted:L(ye),ownerId:n(),displayName:n(),platformId:n(),externalId:L(n())});var Kn=u({name:n(),description:f(n()),type:n(),required:M()}),Ma=u({pieceName:n(),triggerName:n(),input:u({toolName:n(),toolDescription:n(),inputSchema:w(Kn),returnsResponse:M()})});var Jn="^[0-9]+\\.[0-9]+\\.[0-9]+$",_v=new RegExp(Jn),ja="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",Pv=n().check(pe(new RegExp(Jn))),Iv=n().check(pe(new RegExp(ja))),Fa=u({packageType:b("ARCHIVE"),pieceType:N($e),pieceName:n(),pieceVersion:n(),archiveId:n(),platformId:n()}),qn=u({packageType:b("REGISTRY"),pieceType:b("OFFICIAL"),pieceName:n(),pieceVersion:n()}),Xn=u({packageType:b("REGISTRY"),pieceType:b("CUSTOM"),pieceName:n(),pieceVersion:n(),platformId:n()}),Tv=R([qn,Xn]),bv=R([Fa,qn,Xn]),Yn=(t=>(t.CRON_EXPRESSION="CRON_EXPRESSION",t))(Yn||{}),Za=u({type:N(Yn),cronExpression:n(),timezone:n()}),$v=u({...q,type:N(ge),projectId:n(),flowId:n(),triggerName:n(),schedule:L(Za),flowVersionId:n(),pieceName:n(),pieceVersion:n(),deleted:L(n()),simulate:M()}),Qn=(d=>(d.UNKNOWN="UNKNOWN",d.FLOW_RUN_LOG="FLOW_RUN_LOG",d.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",d.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",d.FLOW_STEP_FILE="FLOW_STEP_FILE",d.SAMPLE_DATA="SAMPLE_DATA",d.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",d.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",d.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",d.PROJECT_RELEASE="PROJECT_RELEASE",d.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",d.PLATFORM_ASSET="PLATFORM_ASSET",d.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",d.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",d.KNOWLEDGE_BASE="KNOWLEDGE_BASE",d.FLOW_BUNDLE="FLOW_BUNDLE",d))(Qn||{}),eo=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(eo||{}),to=(r=>(r.S3="S3",r.DB="DB",r))(to||{}),Ev=u({...q,projectId:L(n()),platformId:L(n()),type:N(Qn),compression:N(eo),data:f(S()),location:N(to),size:L(W()),fileName:L(n()),s3Key:L(n()),metadata:L(A(n(),n()))}),ro=(o=>(o.ADMIN="ADMIN",o.MEMBER="MEMBER",o.OPERATOR="OPERATOR",o))(ro||{}),no=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(no||{}),zv=u({id:n(),email:n(),firstName:n(),status:N(no),externalId:L(n()),platformId:L(n()),platformRole:N(ro),lastName:n(),created:ye,updated:ye,lastActiveDate:L(ye),imageUrl:L(n())});var Qt=u({...U.shape,...D(A(n(),S()),"OBJECT").shape});var so=u({...U.shape,...D(n(),"COLOR").shape});var er=R([K,oe,mt,ae,J,ie,Ft,je,Zt,se,Ve,Qt,Be,Ze,Fe,so]),H={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 te=u({displayName:n(),description:f(n())});var uo=u({username:n(),password:n()}),tr=u({...te.shape,username:u({displayName:n(),description:f(n())}),password:u({displayName:n(),description:f(n())}),...D(uo,"BASIC_AUTH").shape});var Wa=A(n(),R([K,oe,se,ae,J])),rr=u({...te.shape,props:Wa,...D(S(),"CUSTOM_AUTH").shape});var xe=u({...te.shape,...D(u({auth:n()}),"SECRET_TEXT").shape});var Ga=A(n(),R([K,oe,xe,se,ae,J,ie,mt])),co=u({...te.shape,props:Ga,...D(S(),"OIDC").shape});var nr=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(nr||{}),lo=R([K,xe,J]),po=A(n(),lo),Ka=u({props:f(A(n(),lo)),authUrl:n(),tokenUrl:n(),scope:w(n()),prompt:f(R([b("none"),b("consent"),b("login"),b("omit")])),pkce:f(M()),pkceMethod:f(R([b("plain"),b("S256")])),authorizationMethod:f(N(nr)),grantType:f(R([N(We),b(Vt)])),extra:f(A(n(),n()))}),mo=u({access_token:n(),props:f(po),data:A(n(),Ue())}),or=u({...te.shape,...Ka.shape,...D(mo,"OAUTH2").shape});var Ae=R([tr,rr,co,or,xe]),qe="Connection",ir={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||qe}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||qe,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||qe}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||qe}},None(){}};var i_={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 Ja=u({...U.shape,...D(S(),"CUSTOM").shape,code:n()});var Xa=R([er,Ae]),ar=A(n(),Xa),$_=A(n(),er);var fo=R([u({strategy:b("CRON"),cronExpression:n()}),u({strategy:b("NONE")})]),ke=class{constructor(t,r,o,a,c,p,m,h,x,P,O,v,s,l,g,d,y,_,C){this.name=t;this.displayName=r;this.description=o;this.requireAuth=a;this.props=c;this.type=p;this.handshakeConfiguration=m;this.onHandshake=h;this.renewConfiguration=x;this.onRenew=P;this.onEnable=O;this.onDisable=v;this.onStart=s;this.run=l;this.test=g;this.sampleData=d;this.testStrategy=y;this.outputSchema=_;this.aiMetadata=C}static{i(this,"ITrigger")}},go=i(e=>{switch(e.type){case"WEBHOOK":return new ke(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 ke(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 ke(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 ke(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,G(e.sampleData)&&G(e.test)?"SIMULATION":"TEST_FUNCTION",e.outputSchema,e.aiMetadata)}},"createTrigger");var yo="2",ht="0.82.0";var sr=class{constructor(t,r,o,a,c,p,m,h,x=ht,P,O=""){this.displayName=t;this.logoUrl=r;this.authors=o;this.events=a;this.categories=m;this.auth=h;this.minimumSupportedRelease=x;this.maximumSupportedRelease=P;this.description=O;this._actions={};this._triggers={};this.getContextInfo=i(()=>({version:yo}),"getContextInfo");(!Ya(x)||Qa(x,ht))&&(this.minimumSupportedRelease=ht),c.forEach(v=>this._actions[v.name]=v),p.forEach(v=>this._triggers[v.name]=v)}static{i(this,"Piece")}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth:this.auth,minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,contextInfo:this.getContextInfo?.()}}getAction(t){return this._actions[t]}getTrigger(t){return this._triggers[t]}actions(){return this._actions}triggers(){return this._triggers}},ho=i(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((r,o,a)=>o===a.findIndex(c=>c.type===r.type)))throw new Error("Auth properties must be unique by type");return new sr(e.displayName,e.logoUrl,e.authors??[],e.events,e.actions,e.triggers,e.categories??[],e.auth,e.minimumSupportedRelease,e.maximumSupportedRelease,e.description)},"createPiece");function Ya(e){return/^\d+\.\d+\.\d+$/.test(e)}i(Ya,"isValidSimpleSemver");function Qa(e,t){let[r,o,a]=e.split(".").map(Number),[c,p,m]=t.split(".").map(Number);return r!==c?r<c:o!==p?o<p:a<m}i(Qa,"isSemverLessThan");var es=f(A(n(),A(n(),n()))),vo=u({id:f(n()),name:n(),displayName:n(),logoUrl:n(),description:n(),authors:w(n()),platformId:f(n()),directoryPath:f(n()),auth:f(R([Ae,w(Ae)])),version:n(),categories:f(w(N(Ee))),minimumSupportedRelease:f(n()),maximumSupportedRelease:f(n()),i18n:es}),ts=N(["human","ai","both"]),xo=u({description:f(n()),idempotent:f(M())}),_o=u({name:n(),displayName:n(),description:n(),props:ar,requireAuth:M(),errorHandlingOptions:f(jt),outputSchema:f(pt()),audience:f(ts),aiMetadata:f(xo)}),Po=u({name:n(),displayName:n(),description:n(),props:ar,errorHandlingOptions:f(jt),type:N(ge),sampleData:S(),handshakeConfiguration:f(pt()),renewConfiguration:f(fo),testStrategy:N(Ke),outputSchema:f(pt()),aiMetadata:f(xo)}),rs=u({...vo.shape,actions:A(n(),_o),triggers:A(n(),Po)}),ns=u({...vo.shape,actions:W(),triggers:W(),suggestedActions:f(w(Po)),suggestedTriggers:f(w(_o))}),Io=u({projectUsage:W(),tags:f(w(n())),pieceType:N($e),packageType:N(He),platformId:f(n()),archiveId:f(n())}),$P=u({...rs.shape,...Io.shape}),EP=u({...ns.shape,...Io.shape}),zP=u({name:n(),version:n()});var os=Ye(require("path")),is=Ye(require("fs/promises"));var vt=class{constructor(t,r){this.baseUrl=t;this.authenticationConverter=r}static{i(this,"BaseHttpClient")}getUrl(t){let r=new URL(`${this.baseUrl}${t.url}`),o=`${r.origin}${r.pathname}`,a=new URLSearchParams;return r.searchParams.forEach((c,p)=>{a.append(p,c)}),{urlWithoutQueryParams:o,queryParams:a}}getHeaders(t){let r={Accept:"application/json"};if(t.authentication&&this.populateAuthentication(t.authentication,r),t.body)switch(t.headers?.["Content-Type"]){case"text/csv":r["Content-Type"]="text/csv";break;default:r["Content-Type"]="application/json";break}return t.headers&&(r={...r,...t.headers}),r}populateAuthentication(t,r){this.authenticationConverter.convert(t,r)}};var xt=class{static{i(this,"DelegatingAuthenticationConverter")}constructor(t=new ur,r=new cr){this.converters={BEARER_TOKEN:t,BASIC:r}}convert(t,r){return this.converters[t.type].convert(t,r)}},ur=class{static{i(this,"BearerTokenAuthenticationConverter")}convert(t,r){return r.Authorization=`Bearer ${t.token}`,r}},cr=class{static{i(this,"BasicTokenAuthenticationConverter")}convert(t,r){let o=`${t.username}:${t.password}`,a=Buffer.from(o).toString("base64");return r.Authorization=`Basic ${a}`,r}};var _t=class extends Error{constructor(r,o){let a=o.status||500,c=Buffer.isBuffer(o.responseBody)?o.responseBody.toString():o.responseBody;super(JSON.stringify({response:{status:a,body:c},request:{body:r}}));this.requestBody=r;this.status=a,this.responseBody=c}static{i(this,"HttpError")}errorMessage(){return{response:{status:this.status,body:this.responseBody},request:{body:this.requestBody}}}get response(){return{status:this.status,body:this.responseBody}}get request(){return{body:this.requestBody}}};var Pt=class extends vt{static{i(this,"FetchHttpClient")}constructor(t="",r=new xt){super(t,r)}async sendRequest(t,r){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:o,queryParams:a}=this.getUrl(t),c=this.getHeaders(t),p=t.queryParams??{};for(let[C,Q]of Object.entries(p))a.append(C,Q);let m=a.toString(),h=m?`${o}?${m}`:o,x=t.responseType??"json",P=t.followRedirects??!0,O=t.retries??0,{body:v,extraHeaders:s,isStream:l}=as(t.body,c),g=us({...c,...s}),d=await ss(async()=>{let C=new AbortController,Q=t.timeout&&t.timeout>0?setTimeout(()=>C.abort(),t.timeout):void 0;try{let _e={method:t.method.toString(),headers:g,body:v,redirect:P?"follow":"manual",signal:C.signal};return l&&(_e.duplex="half"),r?.dispatcher!==void 0&&(_e.dispatcher=r.dispatcher),await fetch(h,_e)}finally{Q!==void 0&&clearTimeout(Q)}},O),y=P?300:400;if(d.status<200||d.status>=y){let C=await To(d,x),Q=new _t(t.body,{status:d.status,responseBody:C});throw console.error("[HttpClient#(sanitized error message)] Request failed:",Q),Q}let _=await To(d,x);return{status:d.status,headers:cs(d.headers),body:_}}};function as(e,t){return ps(e)?{body:void 0,extraHeaders:{},isStream:!1}:ls(e)?{body:e,extraHeaders:e.getHeaders(),isStream:!0}:typeof e=="string"||Buffer.isBuffer(e)||e instanceof URLSearchParams||e instanceof ArrayBuffer||typeof FormData<"u"&&e instanceof FormData||typeof Blob<"u"&&e instanceof Blob?{body:e,extraHeaders:{},isStream:!1}:(t["Content-Type"]??t["content-type"]??"").includes("application/x-www-form-urlencoded")?{body:new URLSearchParams(e).toString(),extraHeaders:{},isStream:!1}:{body:JSON.stringify(e),extraHeaders:{},isStream:!1}}i(as,"serializeBody");async function To(e,t){switch(t){case"arraybuffer":return Buffer.from(await e.arrayBuffer());case"blob":return await e.blob();case"text":return await e.text();case"json":default:{let r=await e.text();if(r.length===0)return;try{return JSON.parse(r)}catch{return r}}}}i(To,"parseResponseBody");async function ss(e,t){let r;for(let o=0;o<=t;o++)try{let a=await e();if(a.status>=500&&o<t){await bo(o);continue}return a}catch(a){if(r=a,o<t){await bo(o);continue}throw a}throw r}i(ss,"sendWithRetries");function bo(e){let t=Math.min(1e3*2**e,3e4);return new Promise(r=>setTimeout(r,t))}i(bo,"backoff");function us(e){let t={};for(let[r,o]of Object.entries(e))o!==void 0&&(t[r]=Array.isArray(o)?o.join(", "):o);return t}i(us,"normalizeHeaders");function cs(e){let t={};return e.forEach((r,o)=>{t[o]=r}),t}i(cs,"toHttpHeaders");function ls(e){return typeof e=="object"&&e!==null&&typeof e.getHeaders=="function"&&typeof e.pipe=="function"}i(ls,"isNodeFormData");function ps(e){return e==null}i(ps,"isNil");var re=new Pt;var Xe={async poll(e,{store:t,auth:r,propsValue:o,maxItemsToPoll:a,files:c,server:p}){switch(e.strategy){case 0:{let m=await t.get("lastPoll");if(G(m))throw new Error("lastPoll doesn't exist in the store.");let h=await e.items({store:t,auth:r,propsValue:o,lastFetchEpochMS:m,server:p}),x=h.reduce((P,O)=>Math.max(P,O.epochMilliSeconds),m);return await t.put("lastPoll",x),h.filter(P=>P.epochMilliSeconds>m).map(P=>P.data)}case 1:{let m=await t.get("lastItem"),h=await e.items({store:t,auth:r,propsValue:o,lastItemId:m,files:c,server:p}),x=h.findIndex(v=>v.id===m),P=[];G(m)||x==-1?P=h??[]:P=h?.slice(0,x)??[],G(a)||(P=P.slice(-a));let O=P?.[0]?.id;return G(O)||await t.put("lastItem",O),P.map(v=>v.data)}}},async onEnable(e,{store:t,auth:r,propsValue:o,server:a}){switch(e.strategy){case 0:{await t.put("lastPoll",Date.now());break}case 1:{let p=(await e.items({store:t,auth:r,propsValue:o,lastItemId:null,server:a}))?.[0]?.id;G(p)?await t.delete("lastItem"):await t.put("lastItem",p);break}}},async onDisable(e,t){switch(e.strategy){case 0:case 1:return}},async test(e,{auth:t,propsValue:r,store:o,files:a,server:c}){let p=[];switch(e.strategy){case 0:{p=await e.items({store:o,auth:t,propsValue:r,lastFetchEpochMS:0,server:c});break}case 1:{p=await e.items({store:o,auth:t,propsValue:r,lastItemId:null,files:a,server:c});break}}return ds(p.map(m=>m.data))}};function ds(e){return e.length<=5?e:e.slice(0,5)}i(ds,"getFirstFiveOrAll");var $o=fe({name:"askQuestion",displayName:"Ask Question",description:"Sends a question to a Wonderchat bot; returns the bot\u2019s answer.",audience:"both",aiMetadata:{description:"Sends a question to a specific Wonderchat chatbot (identified by chatbotId) and returns the bot\u2019s generated answer. Use to query a deployed knowledge-base chatbot programmatically. Optionally pass a chatlogId to continue an existing chat session plus custom context/contextUrl to ground the answer. Not idempotent: each call posts a new message and produces a fresh AI-generated reply.",idempotent:!1},auth:X,props:{chatbotId:H.ShortText({displayName:"Chatbot Id",description:"The ID of your chatbot (can be found in the URL when viewing your bot: /bot/YOUR_BOT_ID)",required:!0}),question:H.LongText({displayName:"Question",description:"The question you wish to ask your chatbot",required:!0}),chatlogId:H.ShortText({displayName:"Chatlog Id",description:'The ID of your chat session (can be found under Chatlog Details section, labeled as "ID")',required:!1}),context:H.LongText({displayName:"Custom context",description:"Additional custom context about the chat session (e.g., user information)",required:!1}),contextUrl:H.LongText({displayName:"Context URL",description:"URL of the page the user is on to provide additional context",required:!1})},async run({propsValue:e}){let{chatbotId:t,question:r,chatlogId:o,context:a,contextUrl:c}=e,p={chatbotId:t,question:r};return o&&(p.chatlogId=o),a&&(p.context=a),c&&(p.contextUrl=c),(await re.sendRequest({method:"POST",url:"https://app.wonderchat.io/api/v1/chat",headers:{"Content-Type":"application/json"},body:p})).body}});var Eo=fe({name:"addPage",displayName:"Add Page",description:"Add new pages to your chatbot\u2019s knowledge base.",audience:"both",aiMetadata:{description:"Adds one or more webpage URLs to a specific Wonderchat chatbot\u2019s knowledge base (identified by chatbotId), triggering Wonderchat to crawl and ingest them. Use when an agent needs to expand or update what a bot can answer from. Optionally provide a session cookie to crawl pages behind a login. Not idempotent: each call appends/re-ingests pages into the knowledge base.",idempotent:!1},auth:X,props:{chatbotId:H.ShortText({displayName:"Chatbot Id",description:"The ID of your chatbot (can be found in the URL when viewing your bot: /bot/YOUR_BOT_ID)",required:!0}),urls:H.Array({displayName:"URLs",description:`List of webpage URLs to add to your chatbot's knowledge base (e.g., "https://wonderchat.io")`,required:!1}),sessionCookie:H.LongText({displayName:"Session cookie",description:"Session cookie for crawling sites behind login",required:!1})},async run({auth:e,propsValue:t}){let r=e.secret_text,{chatbotId:o,urls:a,sessionCookie:c}=t,p={apiKey:r,chatbotId:o};return c&&(p.sessionCookie=c),a&&(p.urls=a),(await re.sendRequest({method:"POST",url:"https://app.wonderchat.io/api/v1/add-pages",headers:{"Content-Type":"application/json"},body:p})).body}});var zo=fe({name:"addTag",displayName:"Add Tag",description:"Add custom tags to a specific chatlog.",audience:"both",aiMetadata:{description:"Adds one or more custom tags to a specific Wonderchat chatlog (chat session identified by chatlogId). Use to label or categorize a conversation. Idempotent: tags are applied as a set, so re-adding the same tags leaves the chatlog\u2019s tag set unchanged.",idempotent:!0},auth:X,props:{chatlogId:H.ShortText({displayName:"Chatlog Id",description:'The ID of your chat session (can be found under Chatlog Details section, labeled as "ID")',required:!0}),tags:H.Array({displayName:"Tags",description:"List of URLs to add to your chatbot",required:!0})},async run({auth:e,propsValue:t}){let r=e.secret_text,{chatlogId:o,tags:a}=t;return(await re.sendRequest({method:"POST",url:"https://app.wonderchat.io/api/v1/add-tags-to-chatlog",headers:{"Content-Type":"application/json"},body:{apiKey:r,chatlogId:o,tags:a}})).body}});var So=fe({name:"removeTag",displayName:"Remove Tag",description:"Remove specific tags from a chatlog.",audience:"both",aiMetadata:{description:"Removes one or more tags from a specific Wonderchat chatlog (chat session identified by chatlogId). Use to clear or correct labels on a conversation. Idempotent: re-running with the same tags leaves the chatlog\u2019s tag set unchanged once those tags are already absent.",idempotent:!0},auth:X,props:{chatlogId:H.ShortText({displayName:"Chatlog Id",description:'The ID of your chat session (can be found under Chatlog Details section, labeled as "ID")',required:!0}),tags:H.Array({displayName:"Tags",description:"List of tags to remove",required:!0})},async run({auth:e,propsValue:t}){let r=e.secret_text,{chatlogId:o,tags:a}=t;return(await re.sendRequest({method:"POST",url:"https://app.wonderchat.io/api/v1/delete-tags-from-chatlog",headers:{"Content-Type":"application/json"},body:{apiKey:r,chatlogId:o,tags:a}})).body}});var Tt={strategy:0,items:i(async({auth:e,propsValue:t,lastFetchEpochMS:r})=>(await re.sendRequest({method:"POST",url:"https://app.wonderchat.io/api/v1/messages",headers:{"Content-Type":"application/json"},body:{apiKey:e.secret_text,chatlogId:t.chatlogId}})).body.messages.filter(p=>p.type==="user").filter(p=>new Date(p.createdAt).getTime()>r).map(p=>({epochMilliSeconds:new Date(p.createdAt).getTime(),data:p})),"items")},Ao=go({auth:X,name:"newUserMessage",displayName:"New User Message",description:"Triggers when a new message is sent by a user in a specific chatlog.",aiMetadata:{description:"Fires when an end user sends a new message in a specific Wonderchat chat session (identified by chatlogId). Polls the chatlog\u2019s messages and emits only newly arrived user-typed messages (bot replies are excluded). Use to react to incoming visitor messages in a single tracked conversation."},props:{chatlogId:H.ShortText({displayName:"Chatlog ID",description:'The ID of your chat session (can be found under Chatlog Details section, labeled as "ID")',required:!0})},sampleData:{content:"I would want to now more about the products pricing strategy",type:"user",createdAt:"2023-12-01T06:35:15.456Z"},type:"POLLING",async test(e){return await Xe.poll(Tt,e)},async onEnable(e){let{store:t,auth:r,propsValue:o}=e;await Xe.onEnable(Tt,{store:t,auth:r,propsValue:o})},async onDisable(e){let{store:t,auth:r,propsValue:o}=e;await Xe.onEnable(Tt,{store:t,auth:r,propsValue:o})},async run(e){return await Xe.poll(Tt,e)}});var X=ir.SecretText({displayName:"API Key",description:`
1
+ "use strict";var Vo=Object.create;var we=Object.defineProperty;var Bo=Object.getOwnPropertyDescriptor;var Ho=Object.getOwnPropertyNames;var Wo=Object.getPrototypeOf,Go=Object.prototype.hasOwnProperty;var i=(e,t)=>we(e,"name",{value:t,configurable:!0});var Ko=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},mr=(e,t)=>{for(var r in t)we(e,r,{get:t[r],enumerable:!0})},fr=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ho(t))!Go.call(e,a)&&a!==r&&we(e,a,{get:()=>t[a],enumerable:!(o=Bo(t,a))||o.enumerable});return e};var Qe=(e,t,r)=>(r=e!=null?Vo(Wo(e)):{},fr(t||!e||!e.__esModule?we(r,"default",{value:e,enumerable:!0}):r,e)),Jo=e=>fr(we({},"__esModule",{value:!0}),e);var Mn=Ko((Un,xt)=>{(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")},o=new RegExp("^0[0-7]+$","i"),a=new RegExp("^0x[a-f0-9]+$","i"),c="%[0-9a-z]{1,}",l="(?:[0-9a-f]+::?)+",m={zoneIndex:new RegExp(c,"i"),native:new RegExp(`^(::)?(${l})?([0-9a-f]+)?(::)?(${c})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${c})?)$`,"i"),transitional:new RegExp(`^((?:${l})|(?:::)(?:${l})?)${t}\\.${t}\\.${t}\\.${t}(${c})?$`,"i")};function h(s,p){if(s.indexOf("::")!==s.lastIndexOf("::"))return null;let g=0,d=-1,y=(s.match(m.zoneIndex)||[])[0],x,C;for(y&&(y=y.substring(1),s=s.replace(/%.+$/,""));(d=s.indexOf(":",d+1))>=0;)g++;if(s.substr(0,2)==="::"&&g--,s.substr(-2,2)==="::"&&g--,g>p)return null;for(C=p-g,x=":";C--;)x+="0:";return s=s.replace("::",x),s[0]===":"&&(s=s.slice(1)),s[s.length-1]===":"&&(s=s.slice(0,-1)),p=(function(){let Q=s.split(":"),Te=[];for(let St=0;St<Q.length;St++)Te.push(parseInt(Q[St],16));return Te})(),{parts:p,zoneId:y}}i(h,"expandIPv6");function v(s,p,g,d){if(s.length!==p.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let y=0,x;for(;d>0;){if(x=g-d,x<0&&(x=0),s[y]>>x!==p[y]>>x)return!1;d-=g,y+=1}return!0}i(v,"matchCIDR");function _(s){if(a.test(s))return parseInt(s,16);if(s[0]==="0"&&!isNaN(parseInt(s[1],10))){if(o.test(s))return parseInt(s,8);throw new Error(`ipaddr: cannot parse ${s} as octal`)}return parseInt(s,10)}i(_,"parseIntAuto");function k(s,p){for(;s.length<p;)s=`0${s}`;return s}i(k,"padPart");let P={};P.IPv4=(function(){function s(p){if(p.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let g,d;for(g=0;g<p.length;g++)if(d=p[g],!(0<=d&&d<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=p}return i(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(p,g){let d;if(g===void 0&&(d=p,p=d[0],g=d[1]),p.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return v(this.octets,p.octets,8,g)},s.prototype.prefixLengthFromSubnetMask=function(){let p=0,g=!1,d={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},y,x,C;for(y=3;y>=0;y-=1)if(x=this.octets[y],x in d){if(C=d[x],g&&C!==0)return null;C!==8&&(g=!0),p+=C}else return null;return 32-p},s.prototype.range=function(){return P.subnetMatch(this,this.SpecialRanges)},s.prototype.toByteArray=function(){return this.octets.slice(0)},s.prototype.toIPv4MappedAddress=function(){return P.IPv6.parse(`::ffff:${this.toString()}`)},s.prototype.toNormalizedString=function(){return this.toString()},s.prototype.toString=function(){return this.octets.join(".")},s})(),P.IPv4.broadcastAddressFromCIDR=function(s){try{let p=this.parseCIDR(s),g=p[0].toByteArray(),d=this.subnetMaskFromPrefixLength(p[1]).toByteArray(),y=[],x=0;for(;x<4;)y.push(parseInt(g[x],10)|parseInt(d[x],10)^255),x++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},P.IPv4.isIPv4=function(s){return this.parser(s)!==null},P.IPv4.isValid=function(s){try{return new this(this.parser(s)),!0}catch{return!1}},P.IPv4.isValidCIDR=function(s){try{return this.parseCIDR(s),!0}catch{return!1}},P.IPv4.isValidFourPartDecimal=function(s){return!!(P.IPv4.isValid(s)&&s.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},P.IPv4.isValidCIDRFourPartDecimal=function(s){let p=s.match(/^(.+)\/(\d+)$/);return!P.IPv4.isValidCIDR(s)||!p?!1:P.IPv4.isValidFourPartDecimal(p[1])},P.IPv4.networkAddressFromCIDR=function(s){let p,g,d,y,x;try{for(p=this.parseCIDR(s),d=p[0].toByteArray(),x=this.subnetMaskFromPrefixLength(p[1]).toByteArray(),y=[],g=0;g<4;)y.push(parseInt(d[g],10)&parseInt(x[g],10)),g++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},P.IPv4.parse=function(s){let p=this.parser(s);if(p===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(p)},P.IPv4.parseCIDR=function(s){let p;if(p=s.match(/^(.+)\/(\d+)$/)){let g=parseInt(p[2]);if(g>=0&&g<=32){let d=[this.parse(p[1]),g];return Object.defineProperty(d,"toString",{value:i(function(){return this.join("/")},"value")}),d}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},P.IPv4.parser=function(s){let p,g,d;if(p=s.match(r.fourOctet))return(function(){let y=p.slice(1,6),x=[];for(let C=0;C<y.length;C++)g=y[C],x.push(_(g));return x})();if(p=s.match(r.longValue)){if(d=_(p[1]),d>4294967295||d<0)throw new Error("ipaddr: address outside defined range");return(function(){let y=[],x;for(x=0;x<=24;x+=8)y.push(d>>x&255);return y})().reverse()}else return(p=s.match(r.twoOctet))?(function(){let y=p.slice(1,4),x=[];if(d=_(y[1]),d>16777215||d<0)throw new Error("ipaddr: address outside defined range");return x.push(_(y[0])),x.push(d>>16&255),x.push(d>>8&255),x.push(d&255),x})():(p=s.match(r.threeOctet))?(function(){let y=p.slice(1,5),x=[];if(d=_(y[2]),d>65535||d<0)throw new Error("ipaddr: address outside defined range");return x.push(_(y[0])),x.push(_(y[1])),x.push(d>>8&255),x.push(d&255),x})():null},P.IPv4.subnetMaskFromPrefixLength=function(s){if(s=parseInt(s),s<0||s>32)throw new Error("ipaddr: invalid IPv4 prefix length");let p=[0,0,0,0],g=0,d=Math.floor(s/8);for(;g<d;)p[g]=255,g++;return d<4&&(p[d]=Math.pow(2,s%8)-1<<8-s%8),new this(p)},P.IPv6=(function(){function s(p,g){let d,y;if(p.length===16)for(this.parts=[],d=0;d<=14;d+=2)this.parts.push(p[d]<<8|p[d+1]);else if(p.length===8)this.parts=p;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(d=0;d<this.parts.length;d++)if(y=this.parts[d],!(0<=y&&y<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");g&&(this.zoneId=g)}return i(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(p,g){let d;if(g===void 0&&(d=p,p=d[0],g=d[1]),p.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return v(this.parts,p.parts,16,g)},s.prototype.prefixLengthFromSubnetMask=function(){let p=0,g=!1,d={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},y,x;for(let C=7;C>=0;C-=1)if(y=this.parts[C],y in d){if(x=d[y],g&&x!==0)return null;x!==16&&(g=!0),p+=x}else return null;return 128-p},s.prototype.range=function(){return P.subnetMatch(this,this.SpecialRanges)},s.prototype.toByteArray=function(){let p,g=[],d=this.parts;for(let y=0;y<d.length;y++)p=d[y],g.push(p>>8),g.push(p&255);return g},s.prototype.toFixedLengthString=function(){let p=(function(){let d=[];for(let y=0;y<this.parts.length;y++)d.push(k(this.parts[y].toString(16),4));return d}).call(this).join(":"),g="";return this.zoneId&&(g=`%${this.zoneId}`),p+g},s.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let p=this.parts.slice(-2),g=p[0],d=p[1];return new P.IPv4([g>>8,g&255,d>>8,d&255])},s.prototype.toNormalizedString=function(){let p=(function(){let d=[];for(let y=0;y<this.parts.length;y++)d.push(this.parts[y].toString(16));return d}).call(this).join(":"),g="";return this.zoneId&&(g=`%${this.zoneId}`),p+g},s.prototype.toRFC5952String=function(){let p=/((^|:)(0(:|$)){2,})/g,g=this.toNormalizedString(),d=0,y=-1,x;for(;x=p.exec(g);)x[0].length>y&&(d=x.index,y=x[0].length);return y<0?g:`${g.substring(0,d)}::${g.substring(d+y)}`},s.prototype.toString=function(){return this.toRFC5952String()},s})(),P.IPv6.broadcastAddressFromCIDR=function(s){try{let p=this.parseCIDR(s),g=p[0].toByteArray(),d=this.subnetMaskFromPrefixLength(p[1]).toByteArray(),y=[],x=0;for(;x<16;)y.push(parseInt(g[x],10)|parseInt(d[x],10)^255),x++;return new this(y)}catch(p){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${p})`)}},P.IPv6.isIPv6=function(s){return this.parser(s)!==null},P.IPv6.isValid=function(s){if(typeof s=="string"&&s.indexOf(":")===-1)return!1;try{let p=this.parser(s);return new this(p.parts,p.zoneId),!0}catch{return!1}},P.IPv6.isValidCIDR=function(s){if(typeof s=="string"&&s.indexOf(":")===-1)return!1;try{return this.parseCIDR(s),!0}catch{return!1}},P.IPv6.networkAddressFromCIDR=function(s){let p,g,d,y,x;try{for(p=this.parseCIDR(s),d=p[0].toByteArray(),x=this.subnetMaskFromPrefixLength(p[1]).toByteArray(),y=[],g=0;g<16;)y.push(parseInt(d[g],10)&parseInt(x[g],10)),g++;return new this(y)}catch(C){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${C})`)}},P.IPv6.parse=function(s){let p=this.parser(s);if(p.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(p.parts,p.zoneId)},P.IPv6.parseCIDR=function(s){let p,g,d;if((g=s.match(/^(.+)\/(\d+)$/))&&(p=parseInt(g[2]),p>=0&&p<=128))return d=[this.parse(g[1]),p],Object.defineProperty(d,"toString",{value:i(function(){return this.join("/")},"value")}),d;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},P.IPv6.parser=function(s){let p,g,d,y,x,C;if(d=s.match(m.deprecatedTransitional))return this.parser(`::ffff:${d[1]}`);if(m.native.test(s))return h(s,8);if((d=s.match(m.transitional))&&(C=d[6]||"",p=d[1],d[1].endsWith("::")||(p=p.slice(0,-1)),p=h(p+C,6),p.parts)){for(x=[parseInt(d[2]),parseInt(d[3]),parseInt(d[4]),parseInt(d[5])],g=0;g<x.length;g++)if(y=x[g],!(0<=y&&y<=255))return null;return p.parts.push(x[0]<<8|x[1]),p.parts.push(x[2]<<8|x[3]),{parts:p.parts,zoneId:p.zoneId}}return null},P.IPv6.subnetMaskFromPrefixLength=function(s){if(s=parseInt(s),s<0||s>128)throw new Error("ipaddr: invalid IPv6 prefix length");let p=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],g=0,d=Math.floor(s/8);for(;g<d;)p[g]=255,g++;return d<16&&(p[d]=Math.pow(2,s%8)-1<<8-s%8),new this(p)},P.fromByteArray=function(s){let p=s.length;if(p===4)return new P.IPv4(s);if(p===16)return new P.IPv6(s);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},P.isValid=function(s){return P.IPv6.isValid(s)||P.IPv4.isValid(s)},P.isValidCIDR=function(s){return P.IPv6.isValidCIDR(s)||P.IPv4.isValidCIDR(s)},P.parse=function(s){if(P.IPv6.isValid(s))return P.IPv6.parse(s);if(P.IPv4.isValid(s))return P.IPv4.parse(s);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},P.parseCIDR=function(s){try{return P.IPv6.parseCIDR(s)}catch{try{return P.IPv4.parseCIDR(s)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},P.process=function(s){let p=this.parse(s);return p.kind()==="ipv6"&&p.isIPv4MappedAddress()?p.toIPv4Address():p},P.subnetMatch=function(s,p,g){let d,y,x,C;g==null&&(g="unicast");for(y in p)if(Object.prototype.hasOwnProperty.call(p,y)){for(x=p[y],x[0]&&!(x[0]instanceof Array)&&(x=[x]),d=0;d<x.length;d++)if(C=x[d],s.kind()===C[0].kind()&&s.match.apply(s,C))return y}return g},typeof xt<"u"&&xt.exports?xt.exports=P:e.ipaddr=P})(Un)});var Ds={};mr(Ds,{wonderchat:()=>Rs,wonderchatAuth:()=>X});module.exports=Jo(Ds);var qo=Object.freeze({status:"aborted"});function I(e,t,r){function o(m,h){if(m._zod||Object.defineProperty(m,"_zod",{value:{def:h,constr:l,traits:new Set},enumerable:!1}),m._zod.traits.has(e))return;m._zod.traits.add(e),t(m,h);let v=l.prototype,_=Object.keys(v);for(let k=0;k<_.length;k++){let P=_[k];P in m||(m[P]=v[P].bind(m))}}i(o,"init");let a=r?.Parent??Object;class c extends a{static{i(this,"Definition")}}Object.defineProperty(c,"name",{value:e});function l(m){var h;let v=r?.Parent?new c:this;o(v,m),(h=v._zod).deferred??(h.deferred=[]);for(let _ of v._zod.deferred)_();return v}return i(l,"_"),Object.defineProperty(l,"init",{value:o}),Object.defineProperty(l,Symbol.hasInstance,{value:i(m=>r?.Parent&&m instanceof r.Parent?!0:m?._zod?.traits?.has(e),"value")}),Object.defineProperty(l,"name",{value:e}),l}i(I,"$constructor");var ee=class extends Error{static{i(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},et=class extends Error{static{i(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},At={};function oe(e){return e&&Object.assign(At,e),At}i(oe,"config");function Ot(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,a])=>t.indexOf(+o)===-1).map(([o,a])=>a)}i(Ot,"getEnumValues");function yr(e,t){return typeof t=="bigint"?t.toString():t}i(yr,"jsonStringifyReplacer");function rt(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}i(rt,"cached");function hr(e){return e==null}i(hr,"nullish");function nt(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}i(nt,"cleanRegex");var gr=Symbol("evaluating");function V(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==gr)return o===void 0&&(o=gr,o=r()),o},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}i(V,"defineLazy");var kt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Re(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}i(Re,"isObject");var Xo=rt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function vr(e){if(Re(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Re(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}i(vr,"isPlainObject");var xr=new Set(["string","number","symbol"]);function be(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}i(be,"escapeRegex");function ot(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}i(ot,"clone");function L(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:i(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:i(()=>t.error,"error")}:t}i(L,"normalizeParams");function Pr(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}i(Pr,"optionalKeys");var _r={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 Ee(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}i(Ee,"aborted");function le(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}i(le,"prefixIssues");function tt(e){return typeof e=="string"?e:e?.message}i(tt,"unwrapMessage");function pe(e,t,r){let o={...e,path:e.path??[]};if(!e.message){let a=tt(e.inst?._zod.def?.error?.(e))??tt(t?.error?.(e))??tt(r.customError?.(e))??tt(r.localeError?.(e))??"Invalid input";o.message=a}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}i(pe,"finalizeIssue");function Ir(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}i(Ir,"getLengthableOrigin");function wt(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}i(wt,"issue");var Tr=i((e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,yr,2),Object.defineProperty(e,"toString",{value:i(()=>e.message,"value"),enumerable:!1})},"initializer"),br=I("$ZodError",Tr),De=I("$ZodError",Tr,{Parent:Error});var Qo=i(e=>(t,r,o,a)=>{let c=o?Object.assign(o,{async:!1}):{async:!1},l=t._zod.run({value:r,issues:[]},c);if(l instanceof Promise)throw new ee;if(l.issues.length){let m=new(a?.Err??e)(l.issues.map(h=>pe(h,c,oe())));throw kt(m,a?.callee),m}return l.value},"_parse"),it=Qo(De),ei=i(e=>async(t,r,o,a)=>{let c=o?Object.assign(o,{async:!0}):{async:!0},l=t._zod.run({value:r,issues:[]},c);if(l instanceof Promise&&(l=await l),l.issues.length){let m=new(a?.Err??e)(l.issues.map(h=>pe(h,c,oe())));throw kt(m,a?.callee),m}return l.value},"_parseAsync"),at=ei(De),ti=i(e=>(t,r,o)=>{let a=o?{...o,async:!1}:{async:!1},c=t._zod.run({value:r,issues:[]},a);if(c instanceof Promise)throw new ee;return c.issues.length?{success:!1,error:new(e??br)(c.issues.map(l=>pe(l,a,oe())))}:{success:!0,data:c.value}},"_safeParse"),Ne=ti(De),ri=i(e=>async(t,r,o)=>{let a=o?Object.assign(o,{async:!0}):{async:!0},c=t._zod.run({value:r,issues:[]},a);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(l=>pe(l,a,oe())))}:{success:!0,data:c.value}},"_safeParseAsync"),Ce=ri(De);var ni="(?:(?:\\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])))",oi=new RegExp(`^${ni}$`);var Er=i(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),$r=/^-?\d+n?$/,Sr=/^-?\d+$/,Rt=/^-?\d+(?:\.\d+)?$/,Ar=/^(?:true|false)$/i;var de=I("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ii={number:"number",bigint:"bigint",object:"date"};var zr=I("$ZodCheckGreaterThan",(e,t)=>{de.init(e,t);let r=ii[typeof t.value];e._zod.onattach.push(o=>{let a=o._zod.bag,c=(t.inclusive?a.minimum:a.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>c&&(t.inclusive?a.minimum=t.value:a.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});var Or=I("$ZodCheckNumberFormat",(e,t)=>{de.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[a,c]=_r[t.format];e._zod.onattach.push(l=>{let m=l._zod.bag;m.format=t.format,m.minimum=a,m.maximum=c,r&&(m.pattern=Sr)}),e._zod.check=l=>{let m=l.value;if(r){if(!Number.isInteger(m)){l.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:m,inst:e});return}if(!Number.isSafeInteger(m)){m>0?l.issues.push({input:m,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):l.issues.push({input:m,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}m<a&&l.issues.push({origin:"number",input:m,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!t.abort}),m>c&&l.issues.push({origin:"number",input:m,code:"too_big",maximum:c,inclusive:!0,inst:e,continue:!t.abort})}});var kr=I("$ZodCheckMinLength",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=o=>{let a=o.value;return!hr(a)&&a.length!==void 0}),e._zod.onattach.push(o=>{let a=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let a=o.value;if(a.length>=t.minimum)return;let l=Ir(a);o.issues.push({origin:l,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}});var Dt=I("$ZodCheckStringFormat",(e,t)=>{var r,o;de.init(e,t),e._zod.onattach.push(a=>{let c=a._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),wr=I("$ZodCheckRegex",(e,t)=>{Dt.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 Dr={major:4,minor:3,patch:6};var F=I("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Dr;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let a of o)for(let c of a._zod.onattach)c(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let a=i((l,m,h)=>{let v=Ee(l),_;for(let k of m){if(k._zod.def.when){if(!k._zod.def.when(l))continue}else if(v)continue;let P=l.issues.length,s=k._zod.check(l);if(s instanceof Promise&&h?.async===!1)throw new ee;if(_||s instanceof Promise)_=(_??Promise.resolve()).then(async()=>{await s,l.issues.length!==P&&(v||(v=Ee(l,P)))});else{if(l.issues.length===P)continue;v||(v=Ee(l,P))}}return _?_.then(()=>l):l},"runChecks"),c=i((l,m,h)=>{if(Ee(l))return l.aborted=!0,l;let v=a(m,o,h);if(v instanceof Promise){if(h.async===!1)throw new ee;return v.then(_=>e._zod.parse(_,h))}return e._zod.parse(v,h)},"handleCanaryResult");e._zod.run=(l,m)=>{if(m.skipChecks)return e._zod.parse(l,m);if(m.direction==="backward"){let v=e._zod.parse({value:l.value,issues:[]},{...m,skipChecks:!0});return v instanceof Promise?v.then(_=>c(_,l,m)):c(v,l,m)}let h=e._zod.parse(l,m);if(h instanceof Promise){if(m.async===!1)throw new ee;return h.then(v=>a(v,o,m))}return a(h,o,m)}}V(e,"~standard",()=>({validate:i(a=>{try{let c=Ne(e,a);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return Ce(e,a).then(l=>l.success?{value:l.data}:{issues:l.error?.issues})}},"validate"),vendor:"zod",version:1}))}),ct=I("$ZodString",(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Er(e._zod.bag),e._zod.parse=(r,o)=>{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}}),Nt=I("$ZodStringFormat",(e,t)=>{Dt.init(e,t),ct.init(e,t)});var Lr=I("$ZodURL",(e,t)=>{Nt.init(e,t),e._zod.check=r=>{try{let o=r.value.trim(),a=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.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(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.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=a.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var Ct=I("$ZodNumber",(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??Rt,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let a=r.value;if(typeof a=="number"&&!Number.isNaN(a)&&Number.isFinite(a))return r;let c=typeof a=="number"?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:a,inst:e,...c?{received:c}:{}}),r}}),jr=I("$ZodNumberFormat",(e,t)=>{Or.init(e,t),Ct.init(e,t)}),Ut=I("$ZodBoolean",(e,t)=>{F.init(e,t),e._zod.pattern=Ar,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let a=r.value;return typeof a=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:e}),r}}),Fr=I("$ZodBigInt",(e,t)=>{F.init(e,t),e._zod.pattern=$r,e._zod.parse=(r,o)=>{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 Zr=I("$ZodAny",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),Vr=I("$ZodUnknown",(e,t)=>{F.init(e,t),e._zod.parse=r=>r});var Br=I("$ZodVoid",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{let a=r.value;return typeof a>"u"||r.issues.push({expected:"void",code:"invalid_type",input:a,inst:e}),r}}),Hr=I("$ZodDate",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let a=r.value,c=a instanceof Date;return c&&!Number.isNaN(a.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:a,...c?{received:"Invalid Date"}:{},inst:e}),r}});function Nr(e,t,r){e.issues.length&&t.issues.push(...le(r,e.issues)),t.value[r]=e.value}i(Nr,"handleArrayResult");var Wr=I("$ZodArray",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);let c=[];for(let l=0;l<a.length;l++){let m=a[l],h=t.element._zod.run({value:m,issues:[]},o);h instanceof Promise?c.push(h.then(v=>Nr(v,r,l))):Nr(h,r,l)}return c.length?Promise.all(c).then(()=>r):r}});function ut(e,t,r,o,a){if(e.issues.length){if(a&&!(r in o))return;t.issues.push(...le(r,e.issues))}e.value===void 0?r in o&&(t.value[r]=void 0):t.value[r]=e.value}i(ut,"handlePropertyResult");function ai(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=Pr(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}i(ai,"normalizeDef");function si(e,t,r,o,a,c){let l=[],m=a.keySet,h=a.catchall._zod,v=h.def.type,_=h.optout==="optional";for(let k in t){if(m.has(k))continue;if(v==="never"){l.push(k);continue}let P=h.run({value:t[k],issues:[]},o);P instanceof Promise?e.push(P.then(s=>ut(s,r,k,t,_))):ut(P,r,k,t,_)}return l.length&&r.issues.push({code:"unrecognized_keys",keys:l,input:t,inst:c}),e.length?Promise.all(e).then(()=>r):r}i(si,"handleCatchall");var Gr=I("$ZodObject",(e,t)=>{if(F.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let m=t.shape;Object.defineProperty(t,"shape",{get:i(()=>{let h={...m};return Object.defineProperty(t,"shape",{value:h}),h},"get")})}let o=rt(()=>ai(t));V(e._zod,"propValues",()=>{let m=t.shape,h={};for(let v in m){let _=m[v]._zod;if(_.values){h[v]??(h[v]=new Set);for(let k of _.values)h[v].add(k)}}return h});let a=Re,c=t.catchall,l;e._zod.parse=(m,h)=>{l??(l=o.value);let v=m.value;if(!a(v))return m.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),m;m.value={};let _=[],k=l.shape;for(let P of l.keys){let s=k[P],p=s._zod.optout==="optional",g=s._zod.run({value:v[P],issues:[]},h);g instanceof Promise?_.push(g.then(d=>ut(d,m,P,v,p))):ut(g,m,P,v,p)}return c?si(_,v,m,h,o.value,e):_.length?Promise.all(_).then(()=>m):m}});function Cr(e,t,r,o){for(let c of e)if(c.issues.length===0)return t.value=c.value,t;let a=e.filter(c=>!Ee(c));return a.length===1?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(c=>c.issues.map(l=>pe(l,o,oe())))}),t)}i(Cr,"handleUnionResults");var Mt=I("$ZodUnion",(e,t)=>{F.init(e,t),V(e._zod,"optin",()=>t.options.some(a=>a._zod.optin==="optional")?"optional":void 0),V(e._zod,"optout",()=>t.options.some(a=>a._zod.optout==="optional")?"optional":void 0),V(e._zod,"values",()=>{if(t.options.every(a=>a._zod.values))return new Set(t.options.flatMap(a=>Array.from(a._zod.values)))}),V(e._zod,"pattern",()=>{if(t.options.every(a=>a._zod.pattern)){let a=t.options.map(c=>c._zod.pattern);return new RegExp(`^(${a.map(c=>nt(c.source)).join("|")})$`)}});let r=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(a,c)=>{if(r)return o(a,c);let l=!1,m=[];for(let h of t.options){let v=h._zod.run({value:a.value,issues:[]},c);if(v instanceof Promise)m.push(v),l=!0;else{if(v.issues.length===0)return v;m.push(v)}}return l?Promise.all(m).then(h=>Cr(h,a,e,c)):Cr(m,a,e,c)}});var Kr=I("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Mt.init(e,t);let r=e._zod.parse;V(e._zod,"propValues",()=>{let a={};for(let c of t.options){let l=c._zod.propValues;if(!l||Object.keys(l).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(c)}"`);for(let[m,h]of Object.entries(l)){a[m]||(a[m]=new Set);for(let v of h)a[m].add(v)}}return a});let o=rt(()=>{let a=t.options,c=new Map;for(let l of a){let m=l._zod.propValues?.[t.discriminator];if(!m||m.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(l)}"`);for(let h of m){if(c.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);c.set(h,l)}}return c});e._zod.parse=(a,c)=>{let l=a.value;if(!Re(l))return a.issues.push({code:"invalid_type",expected:"object",input:l,inst:e}),a;let m=o.value.get(l?.[t.discriminator]);return m?m._zod.run(a,c):t.unionFallback?r(a,c):(a.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:l,path:[t.discriminator],inst:e}),a)}});var Jr=I("$ZodRecord",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{let a=r.value;if(!vr(a))return r.issues.push({expected:"record",code:"invalid_type",input:a,inst:e}),r;let c=[],l=t.keyType._zod.values;if(l){r.value={};let m=new Set;for(let v of l)if(typeof v=="string"||typeof v=="number"||typeof v=="symbol"){m.add(typeof v=="number"?v.toString():v);let _=t.valueType._zod.run({value:a[v],issues:[]},o);_ instanceof Promise?c.push(_.then(k=>{k.issues.length&&r.issues.push(...le(v,k.issues)),r.value[v]=k.value})):(_.issues.length&&r.issues.push(...le(v,_.issues)),r.value[v]=_.value)}let h;for(let v in a)m.has(v)||(h=h??[],h.push(v));h&&h.length>0&&r.issues.push({code:"unrecognized_keys",input:a,inst:e,keys:h})}else{r.value={};for(let m of Reflect.ownKeys(a)){if(m==="__proto__")continue;let h=t.keyType._zod.run({value:m,issues:[]},o);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof m=="string"&&Rt.test(m)&&h.issues.length){let k=t.keyType._zod.run({value:Number(m),issues:[]},o);if(k instanceof Promise)throw new Error("Async schemas not supported in object keys currently");k.issues.length===0&&(h=k)}if(h.issues.length){t.mode==="loose"?r.value[m]=a[m]:r.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(k=>pe(k,o,oe())),input:m,path:[m],inst:e});continue}let _=t.valueType._zod.run({value:a[m],issues:[]},o);_ instanceof Promise?c.push(_.then(k=>{k.issues.length&&r.issues.push(...le(m,k.issues)),r.value[h.value]=k.value})):(_.issues.length&&r.issues.push(...le(m,_.issues)),r.value[h.value]=_.value)}}return c.length?Promise.all(c).then(()=>r):r}});var qr=I("$ZodEnum",(e,t)=>{F.init(e,t);let r=Ot(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(a=>xr.has(typeof a)).map(a=>typeof a=="string"?be(a):a.toString()).join("|")})$`),e._zod.parse=(a,c)=>{let l=a.value;return o.has(l)||a.issues.push({code:"invalid_value",values:r,input:l,inst:e}),a}}),Xr=I("$ZodLiteral",(e,t)=>{if(F.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(o=>typeof o=="string"?be(o):o?be(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,a)=>{let c=o.value;return r.has(c)||o.issues.push({code:"invalid_value",values:t.values,input:c,inst:e}),o}});var Yr=I("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new et(e.constructor.name);let a=t.transform(r.value,r);if(o.async)return(a instanceof Promise?a:Promise.resolve(a)).then(l=>(r.value=l,r));if(a instanceof Promise)throw new ee;return r.value=a,r}});function Ur(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}i(Ur,"handleOptionalResult");var Qr=I("$ZodOptional",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.optout="optional",V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${nt(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let a=t.innerType._zod.run(r,o);return a instanceof Promise?a.then(c=>Ur(c,r.value)):Ur(a,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,o)}});var en=I("$ZodNullable",(e,t)=>{F.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${nt(r.source)}|null)$`):void 0}),V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)});var tn=I("$ZodPipe",(e,t)=>{F.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let c=t.out._zod.run(r,o);return c instanceof Promise?c.then(l=>st(l,t.in,o)):st(c,t.in,o)}let a=t.in._zod.run(r,o);return a instanceof Promise?a.then(c=>st(c,t.out,o)):st(a,t.out,o)}});function st(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}i(st,"handlePipeResult");var rn=I("$ZodCustom",(e,t)=>{de.init(e,t),F.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,a=t.fn(o);if(a instanceof Promise)return a.then(c=>Mr(c,r,o,e));Mr(a,r,o,e)}});function Mr(e,t,r,o){if(!e){let a={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(a.params=o._zod.def.params),t.issues.push(wt(a))}}i(Mr,"handleRefineResult");var on;var Lt=class{static{i(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.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 o={...this.get(r)??{}};delete o.id;let a={...o,...this._map.get(t)};return Object.keys(a).length?a:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function an(){return new Lt}i(an,"registry");(on=globalThis).__zod_globalRegistry??(on.__zod_globalRegistry=an());var jt=globalThis.__zod_globalRegistry;function sn(e,t){return new e({type:"string",...L(t)})}i(sn,"_string");function un(e,t){return new e({type:"string",coerce:!0,...L(t)})}i(un,"_coercedString");function cn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...L(t)})}i(cn,"_url");function ln(e,t){return new e({type:"number",checks:[],...L(t)})}i(ln,"_number");function pn(e,t){return new e({type:"number",coerce:!0,checks:[],...L(t)})}i(pn,"_coercedNumber");function dn(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...L(t)})}i(dn,"_int");function mn(e,t){return new e({type:"boolean",...L(t)})}i(mn,"_boolean");function fn(e,t){return new e({type:"boolean",coerce:!0,...L(t)})}i(fn,"_coercedBoolean");function gn(e,t){return new e({type:"bigint",coerce:!0,...L(t)})}i(gn,"_coercedBigint");function yn(e){return new e({type:"any"})}i(yn,"_any");function hn(e){return new e({type:"unknown"})}i(hn,"_unknown");function vn(e,t){return new e({type:"void",...L(t)})}i(vn,"_void");function xn(e,t){return new e({type:"date",coerce:!0,...L(t)})}i(xn,"_coercedDate");function lt(e,t){return new zr({check:"greater_than",...L(t),value:e,inclusive:!0})}i(lt,"_gte");function Y(e,t){return new kr({check:"min_length",...L(t),minimum:e})}i(Y,"_minLength");function me(e,t){return new wr({check:"string_format",format:"regex",...L(t),pattern:e})}i(me,"_regex");function Pn(e,t,r){let o=L(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}i(Pn,"_custom");var B=I("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");F.init(e,t),e.def=t,e.type=t.type,e.parse=(r,o)=>it(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Ne(e,r,o),e.parseAsync=async(r,o)=>at(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Ce(e,r,o),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]},{parent:!0}),e.with=e.check,e.clone=(r,o)=>ot(e,r,o),e.brand=()=>e,e.register=((r,o)=>(r.add(e,o),e)),e.apply=r=>r(e)}),dt=I("ZodMiniString",(e,t)=>{ct.init(e,t),B.init(e,t)});function n(e){return sn(dt,e)}i(n,"string");var _n=I("ZodMiniStringFormat",(e,t)=>{Nt.init(e,t),dt.init(e,t)});var Pi=I("ZodMiniURL",(e,t)=>{Lr.init(e,t),_n.init(e,t)});function In(e){return cn(Pi,e)}i(In,"url");var mt=I("ZodMiniNumber",(e,t)=>{Ct.init(e,t),B.init(e,t)});function G(e){return ln(mt,e)}i(G,"number");var _i=I("ZodMiniNumberFormat",(e,t)=>{jr.init(e,t),mt.init(e,t)});function Tn(e){return dn(_i,e)}i(Tn,"int");var Ft=I("ZodMiniBoolean",(e,t)=>{Ut.init(e,t),B.init(e,t)});function M(e){return mn(Ft,e)}i(M,"boolean");var bn=I("ZodMiniBigInt",(e,t)=>{Fr.init(e,t),B.init(e,t)});var Ii=I("ZodMiniAny",(e,t)=>{Zr.init(e,t),B.init(e,t)});function Me(){return yn(Ii)}i(Me,"any");var Ti=I("ZodMiniUnknown",(e,t)=>{Vr.init(e,t),B.init(e,t)});function A(){return hn(Ti)}i(A,"unknown");var bi=I("ZodMiniVoid",(e,t)=>{Br.init(e,t),B.init(e,t)});function En(e){return vn(bi,e)}i(En,"_void");var $n=I("ZodMiniDate",(e,t)=>{Hr.init(e,t),B.init(e,t)});var Ei=I("ZodMiniArray",(e,t)=>{Wr.init(e,t),B.init(e,t)});function w(e,t){return new Ei({type:"array",element:e,...L(t)})}i(w,"array");var $i=I("ZodMiniObject",(e,t)=>{Gr.init(e,t),B.init(e,t),V(e,"shape",()=>t.shape)});function u(e,t){let r={type:"object",shape:e??{},...L(t)};return new $i(r)}i(u,"object");var Si=I("ZodMiniUnion",(e,t)=>{Mt.init(e,t),B.init(e,t)});function R(e,t){return new Si({type:"union",options:e,...L(t)})}i(R,"union");var Ai=I("ZodMiniDiscriminatedUnion",(e,t)=>{Kr.init(e,t),B.init(e,t)});function fe(e,t,r){return new Ai({type:"union",options:t,discriminator:e,...L(r)})}i(fe,"discriminatedUnion");var zi=I("ZodMiniRecord",(e,t)=>{Jr.init(e,t),B.init(e,t)});function z(e,t,r){return new zi({type:"record",keyType:e,valueType:t,...L(r)})}i(z,"record");var Oi=I("ZodMiniEnum",(e,t)=>{qr.init(e,t),B.init(e,t),e.options=Object.values(t.entries)});function N(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Oi({type:"enum",entries:r,...L(t)})}i(N,"_enum");var ki=I("ZodMiniLiteral",(e,t)=>{Xr.init(e,t),B.init(e,t)});function b(e,t){return new ki({type:"literal",values:Array.isArray(e)?e:[e],...L(t)})}i(b,"literal");var wi=I("ZodMiniTransform",(e,t)=>{Yr.init(e,t),B.init(e,t)});function ge(e){return new wi({type:"transform",transform:e})}i(ge,"transform");var Ri=I("ZodMiniOptional",(e,t)=>{Qr.init(e,t),B.init(e,t)});function f(e){return new Ri({type:"optional",innerType:e})}i(f,"optional");var Di=I("ZodMiniNullable",(e,t)=>{en.init(e,t),B.init(e,t)});function Le(e){return new Di({type:"nullable",innerType:e})}i(Le,"nullable");var Ni=I("ZodMiniPipe",(e,t)=>{tn.init(e,t),B.init(e,t)});function ye(e,t){return new Ni({type:"pipe",in:e,out:t})}i(ye,"pipe");var Ci=I("ZodMiniCustom",(e,t)=>{rn.init(e,t),B.init(e,t)});function ft(e,t){return Pn(Ci,e??(()=>!0),t)}i(ft,"custom");var je={};mr(je,{bigint:()=>Zi,boolean:()=>Fi,date:()=>Vi,number:()=>ji,string:()=>Li});function Li(e){return un(dt,e)}i(Li,"string");function ji(e){return pn(mt,e)}i(ji,"number");function Fi(e){return fn(Ft,e)}i(Fi,"boolean");function Zi(e){return gn(bn,e)}i(Zi,"bigint");function Vi(e){return xn($n,e)}i(Vi,"date");var Vt=u({retryOnFailure:u({defaultValue:f(M()),hide:f(M())}),continueOnFailure:u({defaultValue:f(M()),hide:f(M())})}),Zt=class{constructor(t,r,o,a,c,l,m,h,v,_,k){this.name=t;this.displayName=r;this.description=o;this.props=a;this.run=c;this.test=l;this.requireAuth=m;this.errorHandlingOptions=h;this.outputSchema=v;this.audience=_;this.aiMetadata=k}static{i(this,"IAction")}},he=i(e=>new Zt(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 U=u({displayName:n(),description:f(n())}),D=i((e,t)=>u({type:b(t),required:M(),defaultValue:f(Me())}),"TPropertyValue");var K=u({...U.shape,...D(n(),"SHORT_TEXT").shape}),ie=u({...U.shape,...D(n(),"LONG_TEXT").shape});var An=u({label:n(),value:A()}),gt=u({disabled:f(M()),placeholder:f(n()),options:w(An)});var J=u({...U.shape,options:gt,...D(A(),"STATIC_DROPDOWN").shape}),ae=u({...U.shape,options:gt,...D(w(A()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var Bt=u({...U.shape,...D(A(),"DROPDOWN").shape,refreshers:w(n())}),Fe=u({...U.shape,...D(w(A()),"MULTI_SELECT_DROPDOWN").shape,refreshers:w(n())});var se=u({...U.shape,...D(M(),"CHECKBOX").shape});var ue=u({...U.shape,...D(G(),"NUMBER").shape});var Ze=u({...U.shape,streaming:f(M()),...D(A(),"FILE").shape});var Ve=u({...U.shape,...D(n(),"DATE_TIME").shape});var zn=z(n(),R([K,ie,J,Fe,ae,se,ue,Ze,Ve])),Be=u({...U.shape,properties:zn,...D(w(A()),"ARRAY").shape});var He=u({...U.shape,...D(R([z(n(),A())]),"JSON").shape});var On=R([K,J,He,Be,ae]),Hi=z(n(),On),Ht=u({refreshers:w(n()),...U.shape,...D(A(),"DYNAMIC").shape});var yt=u({...U.shape,...D(En(),"MARKDOWN").shape});var We=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(We||{}),$e=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))($e||{}),Se=(y=>(y.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",y.COMMUNICATION="COMMUNICATION",y.COMMERCE="COMMERCE",y.CORE="CORE",y.UNIVERSAL_AI="UNIVERSAL_AI",y.FLOW_CONTROL="FLOW_CONTROL",y.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",y.ACCOUNTING="ACCOUNTING",y.PRODUCTIVITY="PRODUCTIVITY",y.CONTENT_AND_FILES="CONTENT_AND_FILES",y.DEVELOPER_TOOLS="DEVELOPER_TOOLS",y.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",y.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",y.HUMAN_RESOURCES="HUMAN_RESOURCES",y.PAYMENT_PROCESSING="PAYMENT_PROCESSING",y.MARKETING="MARKETING",y.SALES_AND_CRM="SALES_AND_CRM",y))(Se||{});var Ge=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(Ge||{}),Wt="both_client_credentials_and_authorization_code";var ve=(a=>(a.POLLING="POLLING",a.WEBHOOK="WEBHOOK",a.APP_WEBHOOK="APP_WEBHOOK",a.MANUAL="MANUAL",a))(ve||{}),Ke=(c=>(c.NONE="NONE",c.HEADER_PRESENT="HEADER_PRESENT",c.QUERY_PRESENT="QUERY_PRESENT",c.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",c.HEAD_REQUEST="HEAD_REQUEST",c))(Ke||{}),Wi=u({strategy:N(Ke),paramName:f(n())}),Je=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(Je||{});var ht=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(ht||{}),kn=u({status:f(G()),body:f(A()),headers:f(z(n(),n()))}),wn=u({type:b("DELAY"),resumeDateTime:n(),requestIdToReply:f(n()),handlerId:f(n()),streamStepProgress:f(N(ht))}),Rn=u({type:b("WEBHOOK"),requestId:n(),requestIdToReply:f(n()),response:kn,handlerId:f(n()),streamStepProgress:f(N(ht))}),Gi=R([wn,Rn]);var Ki=u({body:A(),rawBody:f(A()),headers:z(n(),n()),queryParams:z(n(),n())});function W(e){return e==null}i(W,"isNil");var Gt=Qe(require("crypto"),1);var Ji=128,Pe,Ae,qi=i(e=>{!Pe||Pe.length<e?(Pe=Buffer.allocUnsafe(e*Ji),Gt.default.randomFillSync(Pe),Ae=0):Ae+e>Pe.length&&(Gt.default.randomFillSync(Pe),Ae=0),Ae+=e},"fillPool"),Xi=i(e=>(qi(e|=0),Pe.subarray(Ae-e,Ae)),"random"),Yi=i((e,t,r)=>{let o=(2<<31-Math.clz32(e.length-1|1))-1,a=Math.ceil(1.6*o*t/e.length);return(c=t)=>{let l="";for(;;){let m=r(a),h=a;for(;h--;)if(l+=e[m[h]&o]||"",l.length===c)return l}}},"customRandom"),Nn=i((e,t=21)=>Yi(e,t,Xi),"customAlphabet");var Qi="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Cn=21,gh=n().check(me(new RegExp(`^[0-9a-zA-Z]{${Cn}}$`))),ea=Nn(Qi,Cn);var xe=ye(ge(e=>e instanceof Date?e.toISOString():e),n()),q={id:n(),created:xe,updated:xe},j=i(e=>f(Le(e)),"Nullable");function Kt(e){return f(Le(N(e)))}i(Kt,"NullableEnum");var vh=ye(ge(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),f(M())),vt=i(e=>ye(ge(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),f(w(e))),"OptionalArrayFromQuery");var _h=z(n(),A());var qe=(_=>(_.OPENAI="openai",_.OPENROUTER="openrouter",_.ANTHROPIC="anthropic",_.AZURE="azure",_.GOOGLE="google",_.ACTIVEPIECES="activepieces",_.CLOUDFLARE_GATEWAY="cloudflare-gateway",_.CUSTOM="custom",_.BEDROCK="bedrock",_.MISTRAL="mistral",_))(qe||{});var Rh=n().check(me(/^#[0-9A-Fa-f]{6}$/));var Nh=u({filename:n(),data:A(),type:b("file"),mimetype:f(n())});var ta=Qe(Mn());var Zh=u({...q,name:n(),permissions:w(n()),platformId:j(n()),type:n(),userCount:f(G())});var Ln=(o=>(o.AGENT_DECIDE="agent-decide",o.CHOOSE_YOURSELF="choose-yourself",o.LEAVE_EMPTY="leave-empty",o))(Ln||{}),Jt=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(Jt||{}),qt=(o=>(o.SSE="sse",o.STREAMABLE_HTTP="streamable-http",o.SIMPLE_HTTP="http",o))(qt||{});var Xt=(o=>(o.TEXT="text",o.NUMBER="number",o.BOOLEAN="boolean",o))(Xt||{});var Yt=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(Yt||{});var ra=u({mode:N(Ln),value:A()}),na=u({auth:f(n()),fields:z(n(),ra)}),oa=u({pieceName:n(),pieceVersion:n(),actionName:n(),predefinedInput:f(na)}),ia=u({type:b("PIECE"),toolName:n().check(Y(1)),pieceMetadata:oa}),aa=u({type:b("none")}),sa=u({type:b("access_token"),accessToken:n()}),ua=u({type:b("api_key"),apiKey:n(),apiKeyHeader:n()}),ca=u({type:b("headers"),headers:z(n(),n())}),la=fe("type",[aa,sa,ua,ca]),jn=u({type:b("FLOW"),toolName:n().check(Y(1)),externalFlowId:n(),flowDisplayName:f(n())}),Fn=u({type:b("MCP"),toolName:n().check(Y(1)),serverUrl:In(),protocol:N(qt),auth:la}),Zn=u({type:b("KNOWLEDGE_BASE"),toolName:n().check(Y(1)),sourceType:N(Jt),sourceId:n(),sourceName:n()}),pa=fe("type",[ia,jn,Fn,Zn]),da=u({displayName:n(),description:f(n()),type:N(Xt)}),Vn=u({type:b("MARKDOWN"),markdown:n()}),ze={type:b("TOOL_CALL"),input:j(z(n(),A())),output:f(A()),toolName:n(),status:N(Yt),toolCallId:n(),startTime:n(),endTime:f(n())},xv=u(ze),Bn=fe("toolCallType",[u({...ze,toolCallType:b("PIECE"),pieceName:n(),pieceVersion:n(),actionName:n()}),u({...ze,toolCallType:b("FLOW"),displayName:n(),externalFlowId:n()}),u({...ze,toolCallType:b("MCP"),displayName:n(),serverUrl:n()}),u({...ze,toolCallType:b("KNOWLEDGE_BASE"),displayName:n(),sourceType:n()}),u({...ze,toolCallType:b("UNKNOWN"),displayName:n()})]),ma=R([Vn,Bn]);var Qt=(r=>(r.IMAGE="image",r.TEXT="text",r))(Qt||{}),ce=u({apiKey:n()}),fa=ce,ga=u({apiKey:n(),apiKeyHash:n()}),ya=ce,ha=ce,va=ce,xa=ce,Pa=ce,_a=ce,Ia=ce,Jn=u({accessKeyId:n().check(Y(1)),secretAccessKey:n().check(Y(1))}),Ta=u({}),ba=u({}),Ea=u({}),$a=u({}),Sa=u({}),Aa=u({}),qn=u({modelId:n(),modelName:n(),modelType:N(Qt)}),Xn=u({apiKeyHeader:n(),baseUrl:n(),models:w(qn),defaultHeaders:f(z(n(),n()))}),Yn=u({accountId:n(),gatewayId:n(),models:w(qn),vertexProject:f(n()),vertexRegion:f(n())}),Qn=u({resourceName:n(),apiVersion:ye(ge(e=>typeof e=="string"&&e.trim().length===0?void 0:e),f(n()))}),eo=u({region:n().check(Y(1))}),za=R([fa,va,xa,Pa,_a,ha,ya,ga,Jn,Ia]),to=R([Xn,Yn,Qn,eo,Ta,Ea,$a,Sa,ba,Aa]),Oa=u({id:n(),name:n(),type:N(Qt)}),ka=u({id:n(),name:n(),provider:N(qe),config:to,enabledForChat:M()}),wa=u({provider:N(qe),config:to,auth:za,platformId:n()});var Tv={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"},Hn=["gpt-5.5","gpt-5.4-mini","gpt-5.4-nano","gpt-4.1","gpt-4.1-mini"],Ra=["claude-sonnet-4-6","claude-opus-4-7","claude-haiku-4-5"],Da=["claude-sonnet-4.6","claude-opus-4.7","claude-haiku-4.5"],Wn=["gemini-2.5-pro","gemini-2.5-flash","gemini-3.1-pro-preview","gemini-3-flash-preview"],Na=["grok-4.20","grok-4.1-fast"],Ca={openai:Hn,anthropic:Ra,google:Wn,activepieces:[...Da.map(e=>`anthropic/${e}`),...Hn.map(e=>`openai/${e}`),...Wn.map(e=>`google/${e}`),...Na.map(e=>`x-ai/${e}`)]};var Gn=128e3,Ua={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function Ma({provider:e}){return e?Ua[e]??Gn:Gn}i(Ma,"getMaxContextTokens");var Kn={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"},La={anthropic:"native",google:"native",openrouter:"plugin",activepieces:"plugin"},ja=new Set(["anthropic","mistral"]);function te(e){return{chatModels:Ca[e],maxContextTokens:Ma({provider:e}),defaultEmbeddingModel:Kn[e],supportsEmbedding:Kn[e]!==void 0,supportsImageGeneration:!ja.has(e),webSearch:La[e]}}i(te,"buildProviderCapabilities");var Fa={openai:te("openai"),anthropic:te("anthropic"),openrouter:te("openrouter"),azure:te("azure"),google:te("google"),"cloudflare-gateway":te("cloudflare-gateway"),custom:te("custom"),bedrock:te("bedrock"),mistral:te("mistral"),activepieces:te("activepieces")};var Za=u({base64Url:n(),fileName:n(),extension:f(n())}),Va=u({mimeType:n(),url:n(),fileName:f(n())}),er=R([Za,Va]);var Ba=R([u({type:b("file"),value:er}),u({type:b("markdown"),value:n(),files:f(w(er))})]),Ha=u({sessionId:n(),message:n(),files:f(w(n()))});var no=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(no||{}),oo=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(oo||{}),tr=(o=>(o.RECORD_CREATED="RECORD_CREATED",o.RECORD_UPDATED="RECORD_UPDATED",o.RECORD_DELETED="RECORD_DELETED",o))(tr||{});var Wa=R([u({...q,name:n(),externalId:n(),type:b("STATIC_DROPDOWN"),tableId:n(),projectId:n(),data:u({options:w(u({value:n()}))})}),u({...q,name:n(),externalId:n(),type:R([b("TEXT"),b("NUMBER"),b("DATE")]),tableId:n(),projectId:n()})]),Ga=u({...q,name:n(),folderId:j(n()),projectId:n(),externalId:n(),status:Kt(oo),trigger:Kt(no)}),Ka=u({...q,tableId:n(),projectId:n(),cells:z(n(),u({updated:n(),created:n(),value:A(),fieldName:n()}))}),Ja=u({events:w(N(tr)),webhookUrl:n(),flowId:n()}),qa=u({fields:w(u({id:n(),name:n()})),rows:w(z(n(),n())),name:n()}),Xa=u({projectId:n(),limit:f(je.number()),cursor:f(n()),name:f(n()),externalIds:vt(n()),folderId:f(n()),folderIds:vt(n())}),Ya=u({records:w(w(u({fieldId:n(),value:ao()}))),tableId:n()}),Qa=u({cells:f(w(u({fieldId:n(),value:ao()}))),tableId:n(),agentUpdate:f(M())}),io=fe("operator",[_e("eq"),_e("neq"),_e("gt"),_e("gte"),_e("lt"),_e("lte"),_e("co"),ro("exists"),ro("not_exists")]),es=u({tableId:n(),limit:f(je.number()),cursor:f(n()),filters:vt(io)});function ao(){return ye(ge(e=>e==null?e:String(e)),Le(n()))}i(ao,"coerceToString");function _e(e){return u({fieldId:n(),operator:b(e),value:n()})}i(_e,"valueFilter");function ro(e){return u({fieldId:n(),operator:b(e)})}i(ro,"existenceFilter");var ts=u({status:f(G()),body:f(A()),headers:f(z(n(),n()))}),rs=u({...q,deleted:j(xe),ownerId:n(),displayName:n(),platformId:n(),externalId:j(n())});var so=u({name:n(),description:f(n()),type:n(),required:M()}),ns=u({pieceName:n(),triggerName:n(),input:u({toolName:n(),toolDescription:n(),inputSchema:w(so),returnsResponse:M()})});var uo="^[0-9]+\\.[0-9]+\\.[0-9]+$",Zv=new RegExp(uo),is="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",Vv=n().check(me(new RegExp(uo))),Bv=n().check(me(new RegExp(is))),as=u({packageType:b("ARCHIVE"),pieceType:N($e),pieceName:n(),pieceVersion:n(),archiveId:n(),platformId:n()}),co=u({packageType:b("REGISTRY"),pieceType:b("OFFICIAL"),pieceName:n(),pieceVersion:n()}),lo=u({packageType:b("REGISTRY"),pieceType:b("CUSTOM"),pieceName:n(),pieceVersion:n(),platformId:n()}),Hv=R([co,lo]),Wv=R([as,co,lo]);var ss=fe("type",[u({type:b("CRON_EXPRESSION"),cronExpression:n(),timezone:n()}),u({type:b("INTERVAL"),intervalMs:Tn().check(lt(6e4))})]),Gv=u({...q,type:N(ve),projectId:n(),flowId:n(),triggerName:n(),schedule:j(ss),flowVersionId:n(),pieceName:n(),pieceVersion:n(),deleted:j(n()),simulate:M()}),po=(d=>(d.UNKNOWN="UNKNOWN",d.FLOW_RUN_LOG="FLOW_RUN_LOG",d.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",d.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",d.FLOW_STEP_FILE="FLOW_STEP_FILE",d.SAMPLE_DATA="SAMPLE_DATA",d.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",d.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",d.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",d.PROJECT_RELEASE="PROJECT_RELEASE",d.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",d.PLATFORM_ASSET="PLATFORM_ASSET",d.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",d.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",d.KNOWLEDGE_BASE="KNOWLEDGE_BASE",d.FLOW_BUNDLE="FLOW_BUNDLE",d))(po||{}),mo=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(mo||{}),fo=(r=>(r.S3="S3",r.DB="DB",r))(fo||{}),Kv=u({...q,projectId:j(n()),platformId:j(n()),type:N(po),compression:N(mo),data:f(A()),location:N(fo),size:j(G()),fileName:j(n()),s3Key:j(n()),metadata:j(z(n(),n()))}),go=(o=>(o.ADMIN="ADMIN",o.MEMBER="MEMBER",o.OPERATOR="OPERATOR",o))(go||{}),yo=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(yo||{}),Jv=u({id:n(),email:n(),firstName:n(),status:N(yo),externalId:j(n()),platformId:j(n()),platformRole:N(go),lastName:n(),created:xe,updated:xe,lastActiveDate:j(xe),imageUrl:j(n())});var rr=u({...U.shape,...D(z(n(),A()),"OBJECT").shape});var Po=u({...U.shape,...D(n(),"COLOR").shape});var nr=R([K,ie,yt,se,J,ae,Bt,Fe,Ht,ue,Be,rr,He,Ve,Ze,Po]),H={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 re=u({displayName:n(),description:f(n())});var _o=u({username:n(),password:n()}),or=u({...re.shape,username:u({displayName:n(),description:f(n())}),password:u({displayName:n(),description:f(n())}),...D(_o,"BASIC_AUTH").shape});var ps=z(n(),R([K,ie,ue,se,J])),ir=u({...re.shape,props:ps,...D(A(),"CUSTOM_AUTH").shape});var Ie=u({...re.shape,...D(u({auth:n()}),"SECRET_TEXT").shape});var ds=z(n(),R([K,ie,Ie,ue,se,J,ae,yt])),Io=u({...re.shape,props:ds,...D(A(),"OIDC").shape});var ar=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(ar||{}),To=R([K,Ie,J]),bo=z(n(),To),ms=u({props:f(z(n(),To)),authUrl:n(),tokenUrl:n(),scope:w(n()),prompt:f(R([b("none"),b("consent"),b("login"),b("omit")])),pkce:f(M()),pkceMethod:f(R([b("plain"),b("S256")])),authorizationMethod:f(N(ar)),grantType:f(R([N(Ge),b(Wt)])),extra:f(z(n(),n()))}),Eo=u({access_token:n(),props:f(bo),data:z(n(),Me())}),sr=u({...re.shape,...ms.shape,...D(Eo,"OAUTH2").shape});var Oe=R([or,ir,Io,sr,Ie]),Xe="Connection",ur={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||Xe}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||Xe,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||Xe}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||Xe}},None(){}};var SP={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 fs=u({...U.shape,...D(A(),"CUSTOM").shape,code:n()});var ys=R([nr,Oe]),cr=z(n(),ys),GP=z(n(),nr);var $o=R([u({strategy:b("CRON"),cronExpression:n()}),u({strategy:b("NONE")})]),ke=class{constructor(t,r,o,a,c,l,m,h,v,_,k,P,s,p,g,d,y,x,C){this.name=t;this.displayName=r;this.description=o;this.requireAuth=a;this.props=c;this.type=l;this.handshakeConfiguration=m;this.onHandshake=h;this.renewConfiguration=v;this.onRenew=_;this.onEnable=k;this.onDisable=P;this.onStart=s;this.run=p;this.test=g;this.sampleData=d;this.testStrategy=y;this.outputSchema=x;this.aiMetadata=C}static{i(this,"ITrigger")}},So=i(e=>{switch(e.type){case"WEBHOOK":return new ke(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 ke(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 ke(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 ke(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,W(e.sampleData)&&W(e.test)?"SIMULATION":"TEST_FUNCTION",e.outputSchema,e.aiMetadata)}},"createTrigger");var Ao="2",Pt="0.82.0";var lr=class{constructor(t,r,o,a,c,l,m,h,v=Pt,_,k="",P){this.displayName=t;this.logoUrl=r;this.authors=o;this.events=a;this.categories=m;this.auth=h;this.minimumSupportedRelease=v;this.maximumSupportedRelease=_;this.description=k;this.deprecated=P;this._actions={};this._triggers={};this.getContextInfo=i(()=>({version:Ao}),"getContextInfo");(!hs(v)||vs(v,Pt))&&(this.minimumSupportedRelease=Pt),c.forEach(s=>this._actions[s.name]=s),l.forEach(s=>this._triggers[s.name]=s)}static{i(this,"Piece")}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth: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}},zo=i(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((r,o,a)=>o===a.findIndex(c=>c.type===r.type)))throw new Error("Auth properties must be unique by type");return new lr(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 hs(e){return/^\d+\.\d+\.\d+$/.test(e)}i(hs,"isValidSimpleSemver");function vs(e,t){let[r,o,a]=e.split(".").map(Number),[c,l,m]=t.split(".").map(Number);return r!==c?r<c:o!==l?o<l:a<m}i(vs,"isSemverLessThan");var xs=f(z(n(),z(n(),n()))),Oo=u({id:f(n()),name:n(),displayName:n(),logoUrl:n(),description:n(),authors:w(n()),platformId:f(n()),directoryPath:f(n()),auth:f(R([Oe,w(Oe)])),version:n(),categories:f(w(N(Se))),minimumSupportedRelease:f(n()),maximumSupportedRelease:f(n()),deprecated:f(M()),i18n:xs}),Ps=N(["human","ai","both"]),ko=u({description:f(n()),idempotent:f(M())}),wo=u({name:n(),displayName:n(),description:n(),props:cr,requireAuth:M(),errorHandlingOptions:f(Vt),outputSchema:f(ft()),audience:f(Ps),aiMetadata:f(ko)}),Ro=u({name:n(),displayName:n(),description:n(),props:cr,errorHandlingOptions:f(Vt),type:N(ve),sampleData:A(),handshakeConfiguration:f(ft()),renewConfiguration:f($o),testStrategy:N(Je),outputSchema:f(ft()),aiMetadata:f(ko)}),_s=u({...Oo.shape,actions:z(n(),wo),triggers:z(n(),Ro)}),Is=u({...Oo.shape,actions:G(),triggers:G(),suggestedActions:f(w(wo)),suggestedTriggers:f(w(Ro))}),Do=u({projectUsage:G(),pieceType:N($e),packageType:N(We),platformId:f(n()),archiveId:f(n())}),G_=u({..._s.shape,...Do.shape}),K_=u({...Is.shape,...Do.shape}),J_=u({name:n(),version:n()});var Ts=Qe(require("path")),bs=Qe(require("fs/promises"));var Uo=require("node:stream");var _t=class{constructor(t,r){this.baseUrl=t;this.authenticationConverter=r}static{i(this,"BaseHttpClient")}getUrl(t){let r=new URL(`${this.baseUrl}${t.url}`),o=`${r.origin}${r.pathname}`,a=new URLSearchParams;return r.searchParams.forEach((c,l)=>{a.append(l,c)}),{urlWithoutQueryParams:o,queryParams:a}}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 It=class{static{i(this,"DelegatingAuthenticationConverter")}constructor(t=new pr,r=new dr){this.converters={BEARER_TOKEN:t,BASIC:r}}convert(t,r){return this.converters[t.type].convert(t,r)}},pr=class{static{i(this,"BearerTokenAuthenticationConverter")}convert(t,r){return r.Authorization=`Bearer ${t.token}`,r}},dr=class{static{i(this,"BasicTokenAuthenticationConverter")}convert(t,r){let o=`${t.username}:${t.password}`,a=Buffer.from(o).toString("base64");return r.Authorization=`Basic ${a}`,r}};var Tt=class extends Error{constructor(r,o){let a=o.status||500,c=Buffer.isBuffer(o.responseBody)?o.responseBody.toString():o.responseBody;super(JSON.stringify({response:{status:a,body:c},request:{body:r}}));this.requestBody=r;this.status=a,this.responseBody=c}static{i(this,"HttpError")}errorMessage(){return{response:{status:this.status,body:this.responseBody},request:{body:this.requestBody}}}get response(){return{status:this.status,body:this.responseBody}}get request(){return{body:this.requestBody}}};var bt=class extends _t{static{i(this,"FetchHttpClient")}constructor(t="",r=new It){super(t,r)}async sendRequest(t,r){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:o,queryParams:a}=this.getUrl(t),c=this.getHeaders(t),l=t.queryParams??{};for(let[C,Q]of Object.entries(l))a.append(C,Q);let m=a.toString(),h=m?`${o}?${m}`:o,v=t.responseType??"json",_=t.followRedirects??!0,k=t.retries??0,{body:P,extraHeaders:s,isStream:p}=Es(t.method)?$s(t.body,c):{body:void 0,extraHeaders:{},isStream:!1},g=As({...c,...s}),d=await Ss(async()=>{let C=new AbortController,Q=t.timeout&&t.timeout>0?setTimeout(()=>C.abort(),t.timeout):void 0;try{let Te={method:t.method.toString(),headers:g,body:P,redirect:_?"follow":"manual",signal:C.signal};return p&&(Te.duplex="half"),r?.dispatcher!==void 0&&(Te.dispatcher=r.dispatcher),await fetch(h,Te)}finally{Q!==void 0&&clearTimeout(Q)}},k),y=_?300:400;if(d.status<200||d.status>=y){let C=await No(d,v),Q=new Tt(t.body,{status:d.status,responseBody:C});throw console.error("[HttpClient#(sanitized error message)] Request failed:",Q),Q}let x=await No(d,v);return{status:d.status,headers:zs(d.headers),body:x}}};function Es(e){return e!=="GET"&&e!=="HEAD"}i(Es,"acceptsRequestBody");function $s(e,t){if(ks(e))return{body:void 0,extraHeaders:{},isStream:!1};if(Os(e)){let o=new Uo.PassThrough;return e.on("error",a=>o.destroy(a)),e.pipe(o),{body:o,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}}i($s,"serializeBody");async function No(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}}}}i(No,"parseResponseBody");async function Ss(e,t){let r;for(let o=0;o<=t;o++)try{let a=await e();if(a.status>=500&&o<t){await Co(o);continue}return a}catch(a){if(r=a,o<t){await Co(o);continue}throw a}throw r}i(Ss,"sendWithRetries");function Co(e){let t=Math.min(1e3*2**e,3e4);return new Promise(r=>setTimeout(r,t))}i(Co,"backoff");function As(e){let t={};for(let[r,o]of Object.entries(e))o!==void 0&&(t[r.toLowerCase()]=Array.isArray(o)?o.join(", "):o);return t}i(As,"normalizeHeaders");function zs(e){let t={};return e.forEach((r,o)=>{t[o]=r}),t}i(zs,"toHttpHeaders");function Os(e){return typeof e=="object"&&e!==null&&typeof e.getHeaders=="function"&&typeof e.pipe=="function"&&typeof e.on=="function"}i(Os,"isNodeFormData");function ks(e){return e==null}i(ks,"isNil");var ne=new bt;var Ye={async poll(e,{store:t,auth:r,propsValue:o,maxItemsToPoll:a,files:c,server:l}){switch(e.strategy){case 0:{let m=await t.get("lastPoll");if(W(m))throw new Error("lastPoll doesn't exist in the store.");let h=await e.items({store:t,auth:r,propsValue:o,lastFetchEpochMS:m,server:l}),v=h.reduce((_,k)=>Math.max(_,k.epochMilliSeconds),m);return await t.put("lastPoll",v),h.filter(_=>_.epochMilliSeconds>m).map(_=>_.data)}case 1:{let m=await t.get("lastItem"),h=await e.items({store:t,auth:r,propsValue:o,lastItemId:m,files:c,server:l}),v=h.findIndex(P=>P.id===m),_=[];W(m)||v==-1?_=h??[]:_=h?.slice(0,v)??[],W(a)||(_=_.slice(-a));let k=_?.[0]?.id;return W(k)||await t.put("lastItem",k),_.map(P=>P.data)}}},async onEnable(e,{store:t,auth:r,propsValue:o,server:a}){switch(e.strategy){case 0:{await t.put("lastPoll",Date.now());break}case 1:{let l=(await e.items({store:t,auth:r,propsValue:o,lastItemId:null,server:a}))?.[0]?.id;W(l)?await t.delete("lastItem"):await t.put("lastItem",l);break}}},async onDisable(e,t){switch(e.strategy){case 0:case 1:return}},async test(e,{auth:t,propsValue:r,store:o,files:a,server:c}){let l=[];switch(e.strategy){case 0:{l=await e.items({store:o,auth:t,propsValue:r,lastFetchEpochMS:0,server:c});break}case 1:{l=await e.items({store:o,auth:t,propsValue:r,lastItemId:null,files:a,server:c});break}}return ws(l.map(m=>m.data))}};function ws(e){return e.length<=5?e:e.slice(0,5)}i(ws,"getFirstFiveOrAll");var Mo=he({name:"askQuestion",displayName:"Ask Question",description:"Sends a question to a Wonderchat bot; returns the bot\u2019s answer.",audience:"both",aiMetadata:{description:"Sends a question to a specific Wonderchat chatbot (identified by chatbotId) and returns the bot\u2019s generated answer. Use to query a deployed knowledge-base chatbot programmatically. Optionally pass a chatlogId to continue an existing chat session plus custom context/contextUrl to ground the answer. Not idempotent: each call posts a new message and produces a fresh AI-generated reply.",idempotent:!1},auth:X,props:{chatbotId:H.ShortText({displayName:"Chatbot Id",description:"The ID of your chatbot (can be found in the URL when viewing your bot: /bot/YOUR_BOT_ID)",required:!0}),question:H.LongText({displayName:"Question",description:"The question you wish to ask your chatbot",required:!0}),chatlogId:H.ShortText({displayName:"Chatlog Id",description:'The ID of your chat session (can be found under Chatlog Details section, labeled as "ID")',required:!1}),context:H.LongText({displayName:"Custom context",description:"Additional custom context about the chat session (e.g., user information)",required:!1}),contextUrl:H.LongText({displayName:"Context URL",description:"URL of the page the user is on to provide additional context",required:!1})},async run({propsValue:e}){let{chatbotId:t,question:r,chatlogId:o,context:a,contextUrl:c}=e,l={chatbotId:t,question:r};return o&&(l.chatlogId=o),a&&(l.context=a),c&&(l.contextUrl=c),(await ne.sendRequest({method:"POST",url:"https://app.wonderchat.io/api/v1/chat",headers:{"Content-Type":"application/json"},body:l})).body}});var Lo=he({name:"addPage",displayName:"Add Page",description:"Add new pages to your chatbot\u2019s knowledge base.",audience:"both",aiMetadata:{description:"Adds one or more webpage URLs to a specific Wonderchat chatbot\u2019s knowledge base (identified by chatbotId), triggering Wonderchat to crawl and ingest them. Use when an agent needs to expand or update what a bot can answer from. Optionally provide a session cookie to crawl pages behind a login. Not idempotent: each call appends/re-ingests pages into the knowledge base.",idempotent:!1},auth:X,props:{chatbotId:H.ShortText({displayName:"Chatbot Id",description:"The ID of your chatbot (can be found in the URL when viewing your bot: /bot/YOUR_BOT_ID)",required:!0}),urls:H.Array({displayName:"URLs",description:`List of webpage URLs to add to your chatbot's knowledge base (e.g., "https://wonderchat.io")`,required:!1}),sessionCookie:H.LongText({displayName:"Session cookie",description:"Session cookie for crawling sites behind login",required:!1})},async run({auth:e,propsValue:t}){let r=e.secret_text,{chatbotId:o,urls:a,sessionCookie:c}=t,l={apiKey:r,chatbotId:o};return c&&(l.sessionCookie=c),a&&(l.urls=a),(await ne.sendRequest({method:"POST",url:"https://app.wonderchat.io/api/v1/add-pages",headers:{"Content-Type":"application/json"},body:l})).body}});var jo=he({name:"addTag",displayName:"Add Tag",description:"Add custom tags to a specific chatlog.",audience:"both",aiMetadata:{description:"Adds one or more custom tags to a specific Wonderchat chatlog (chat session identified by chatlogId). Use to label or categorize a conversation. Idempotent: tags are applied as a set, so re-adding the same tags leaves the chatlog\u2019s tag set unchanged.",idempotent:!0},auth:X,props:{chatlogId:H.ShortText({displayName:"Chatlog Id",description:'The ID of your chat session (can be found under Chatlog Details section, labeled as "ID")',required:!0}),tags:H.Array({displayName:"Tags",description:"List of URLs to add to your chatbot",required:!0})},async run({auth:e,propsValue:t}){let r=e.secret_text,{chatlogId:o,tags:a}=t;return(await ne.sendRequest({method:"POST",url:"https://app.wonderchat.io/api/v1/add-tags-to-chatlog",headers:{"Content-Type":"application/json"},body:{apiKey:r,chatlogId:o,tags:a}})).body}});var Fo=he({name:"removeTag",displayName:"Remove Tag",description:"Remove specific tags from a chatlog.",audience:"both",aiMetadata:{description:"Removes one or more tags from a specific Wonderchat chatlog (chat session identified by chatlogId). Use to clear or correct labels on a conversation. Idempotent: re-running with the same tags leaves the chatlog\u2019s tag set unchanged once those tags are already absent.",idempotent:!0},auth:X,props:{chatlogId:H.ShortText({displayName:"Chatlog Id",description:'The ID of your chat session (can be found under Chatlog Details section, labeled as "ID")',required:!0}),tags:H.Array({displayName:"Tags",description:"List of tags to remove",required:!0})},async run({auth:e,propsValue:t}){let r=e.secret_text,{chatlogId:o,tags:a}=t;return(await ne.sendRequest({method:"POST",url:"https://app.wonderchat.io/api/v1/delete-tags-from-chatlog",headers:{"Content-Type":"application/json"},body:{apiKey:r,chatlogId:o,tags:a}})).body}});var $t={strategy:0,items:i(async({auth:e,propsValue:t,lastFetchEpochMS:r})=>(await ne.sendRequest({method:"POST",url:"https://app.wonderchat.io/api/v1/messages",headers:{"Content-Type":"application/json"},body:{apiKey:e.secret_text,chatlogId:t.chatlogId}})).body.messages.filter(l=>l.type==="user").filter(l=>new Date(l.createdAt).getTime()>r).map(l=>({epochMilliSeconds:new Date(l.createdAt).getTime(),data:l})),"items")},Zo=So({auth:X,name:"newUserMessage",displayName:"New User Message",description:"Triggers when a new message is sent by a user in a specific chatlog.",aiMetadata:{description:"Fires when an end user sends a new message in a specific Wonderchat chat session (identified by chatlogId). Polls the chatlog\u2019s messages and emits only newly arrived user-typed messages (bot replies are excluded). Use to react to incoming visitor messages in a single tracked conversation."},props:{chatlogId:H.ShortText({displayName:"Chatlog ID",description:'The ID of your chat session (can be found under Chatlog Details section, labeled as "ID")',required:!0})},sampleData:{content:"I would want to now more about the products pricing strategy",type:"user",createdAt:"2023-12-01T06:35:15.456Z"},type:"POLLING",async test(e){return await Ye.poll($t,e)},async onEnable(e){let{store:t,auth:r,propsValue:o}=e;await Ye.onEnable($t,{store:t,auth:r,propsValue:o})},async onDisable(e){let{store:t,auth:r,propsValue:o}=e;await Ye.onEnable($t,{store:t,auth:r,propsValue:o})},async run(e){return await Ye.poll($t,e)}});var X=ur.SecretText({displayName:"API Key",description:`
2
2
  1. Log in to your Wonderchat account.
3
3
  2. Click on your **Profile card**.
4
4
  2. Go to your **User settings**.
5
5
  3. Click on the the **API keys** tab.
6
6
  3. If you already have a key, copy it, if not generate one.
7
- `,required:!0}),ms=ho({displayName:"Wonderchat",description:"Wonderchat is a no-code chatbot platform that lets you deploy AI-powered chatbots for websites quickly.",auth:X,minimumSupportedRelease:"0.36.1",logoUrl:"https://cdn.activepieces.com/pieces/wonderchat.png",categories:["ARTIFICIAL_INTELLIGENCE"],authors:["devroy10","sanket-a11y"],actions:[$o,Eo,zo,So],triggers:[Ao]});0&&(module.exports={wonderchat,wonderchatAuth});
7
+ `,required:!0}),Rs=zo({displayName:"Wonderchat",description:"Wonderchat is a no-code chatbot platform that lets you deploy AI-powered chatbots for websites quickly.",auth:X,minimumSupportedRelease:"0.36.1",logoUrl:"https://cdn.activepieces.com/pieces/wonderchat.png",categories:["ARTIFICIAL_INTELLIGENCE"],authors:["devroy10","sanket-a11y"],actions:[Mo,Lo,jo,Fo],triggers:[Zo]});0&&(module.exports={wonderchat,wonderchatAuth});