@activepieces/piece-bigin-by-zoho 0.1.3 → 0.1.5

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 (92) hide show
  1. package/package.json +7 -22
  2. package/src/index.js +1 -121
  3. package/README.md +0 -7
  4. package/src/index.d.ts +0 -2
  5. package/src/index.js.map +0 -1
  6. package/src/lib/actions/create-call.d.ts +0 -15
  7. package/src/lib/actions/create-call.js +0 -158
  8. package/src/lib/actions/create-call.js.map +0 -1
  9. package/src/lib/actions/create-company.d.ts +0 -13
  10. package/src/lib/actions/create-company.js +0 -104
  11. package/src/lib/actions/create-company.js.map +0 -1
  12. package/src/lib/actions/create-contact.d.ts +0 -17
  13. package/src/lib/actions/create-contact.js +0 -126
  14. package/src/lib/actions/create-contact.js.map +0 -1
  15. package/src/lib/actions/create-event.d.ts +0 -17
  16. package/src/lib/actions/create-event.js +0 -356
  17. package/src/lib/actions/create-event.js.map +0 -1
  18. package/src/lib/actions/create-pipeline-record.d.ts +0 -15
  19. package/src/lib/actions/create-pipeline-record.js +0 -215
  20. package/src/lib/actions/create-pipeline-record.js.map +0 -1
  21. package/src/lib/actions/create-task.d.ts +0 -15
  22. package/src/lib/actions/create-task.js +0 -376
  23. package/src/lib/actions/create-task.js.map +0 -1
  24. package/src/lib/actions/search-company-record.d.ts +0 -4
  25. package/src/lib/actions/search-company-record.js +0 -54
  26. package/src/lib/actions/search-company-record.js.map +0 -1
  27. package/src/lib/actions/search-contact-record.d.ts +0 -4
  28. package/src/lib/actions/search-contact-record.js +0 -78
  29. package/src/lib/actions/search-contact-record.js.map +0 -1
  30. package/src/lib/actions/search-pipeline-records.d.ts +0 -4
  31. package/src/lib/actions/search-pipeline-records.js +0 -49
  32. package/src/lib/actions/search-pipeline-records.js.map +0 -1
  33. package/src/lib/actions/search-product.d.ts +0 -4
  34. package/src/lib/actions/search-product.js +0 -56
  35. package/src/lib/actions/search-product.js.map +0 -1
  36. package/src/lib/actions/search-user.d.ts +0 -6
  37. package/src/lib/actions/search-user.js +0 -71
  38. package/src/lib/actions/search-user.js.map +0 -1
  39. package/src/lib/actions/update-company.d.ts +0 -6
  40. package/src/lib/actions/update-company.js +0 -220
  41. package/src/lib/actions/update-company.js.map +0 -1
  42. package/src/lib/actions/update-contact.d.ts +0 -6
  43. package/src/lib/actions/update-contact.js +0 -244
  44. package/src/lib/actions/update-contact.js.map +0 -1
  45. package/src/lib/actions/update-event.d.ts +0 -12
  46. package/src/lib/actions/update-event.js +0 -462
  47. package/src/lib/actions/update-event.js.map +0 -1
  48. package/src/lib/actions/update-pipeline-record.d.ts +0 -13
  49. package/src/lib/actions/update-pipeline-record.js +0 -201
  50. package/src/lib/actions/update-pipeline-record.js.map +0 -1
  51. package/src/lib/actions/update-task.d.ts +0 -12
  52. package/src/lib/actions/update-task.js +0 -445
  53. package/src/lib/actions/update-task.js.map +0 -1
  54. package/src/lib/common/constants.d.ts +0 -22
  55. package/src/lib/common/constants.js +0 -70
  56. package/src/lib/common/constants.js.map +0 -1
  57. package/src/lib/common/helpers.d.ts +0 -10
  58. package/src/lib/common/helpers.js +0 -40
  59. package/src/lib/common/helpers.js.map +0 -1
  60. package/src/lib/common/props.d.ts +0 -9
  61. package/src/lib/common/props.js +0 -215
  62. package/src/lib/common/props.js.map +0 -1
  63. package/src/lib/common/request.d.ts +0 -34
  64. package/src/lib/common/request.js +0 -224
  65. package/src/lib/common/request.js.map +0 -1
  66. package/src/lib/triggers/company-updated.d.ts +0 -2
  67. package/src/lib/triggers/company-updated.js +0 -61
  68. package/src/lib/triggers/company-updated.js.map +0 -1
  69. package/src/lib/triggers/contact-updated.d.ts +0 -2
  70. package/src/lib/triggers/contact-updated.js +0 -61
  71. package/src/lib/triggers/contact-updated.js.map +0 -1
  72. package/src/lib/triggers/new-call-created.d.ts +0 -2
  73. package/src/lib/triggers/new-call-created.js +0 -61
  74. package/src/lib/triggers/new-call-created.js.map +0 -1
  75. package/src/lib/triggers/new-company-created.d.ts +0 -2
  76. package/src/lib/triggers/new-company-created.js +0 -61
  77. package/src/lib/triggers/new-company-created.js.map +0 -1
  78. package/src/lib/triggers/new-contact-created.d.ts +0 -2
  79. package/src/lib/triggers/new-contact-created.js +0 -70
  80. package/src/lib/triggers/new-contact-created.js.map +0 -1
  81. package/src/lib/triggers/new-event-created.d.ts +0 -2
  82. package/src/lib/triggers/new-event-created.js +0 -61
  83. package/src/lib/triggers/new-event-created.js.map +0 -1
  84. package/src/lib/triggers/new-pipeline-record.d.ts +0 -2
  85. package/src/lib/triggers/new-pipeline-record.js +0 -61
  86. package/src/lib/triggers/new-pipeline-record.js.map +0 -1
  87. package/src/lib/triggers/new-task-created.d.ts +0 -2
  88. package/src/lib/triggers/new-task-created.js +0 -61
  89. package/src/lib/triggers/new-task-created.js.map +0 -1
  90. package/src/lib/triggers/pipeline-record-updated.d.ts +0 -2
  91. package/src/lib/triggers/pipeline-record-updated.js +0 -61
  92. package/src/lib/triggers/pipeline-record-updated.js.map +0 -1
package/package.json CHANGED
@@ -1,27 +1,12 @@
1
1
  {
2
2
  "name": "@activepieces/piece-bigin-by-zoho",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
- "types": "./src/index.d.ts",
7
- "dependencies": {
8
- "@sinclair/typebox": "0.34.11",
9
- "ai": "^6.0.0",
10
- "axios": "1.13.5",
11
- "axios-retry": "4.4.1",
12
- "deepmerge-ts": "7.1.0",
13
- "form-data": "4.0.4",
14
- "mime-types": "2.1.35",
15
- "nanoid": "3.3.8",
16
- "semver": "7.6.0",
17
- "socket.io-client": "4.8.1",
18
- "tslib": "^2.3.0",
19
- "zod": "4.1.13",
20
- "@activepieces/pieces-common": "0.11.6",
21
- "@activepieces/pieces-framework": "0.25.4",
22
- "@activepieces/shared": "0.37.0"
23
- },
24
- "resolutions": {
25
- "rollup": "npm:@rollup/wasm-node"
26
- }
6
+ "dependencies": {},
7
+ "files": [
8
+ "src/index.js",
9
+ "package.json",
10
+ "src/i18n"
11
+ ]
27
12
  }
package/src/index.js CHANGED
@@ -1,121 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.biginByZoho = exports.biginAuth = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const constants_1 = require("./lib/common/constants");
7
- const helpers_1 = require("./lib/common/helpers");
8
- const new_contact_created_1 = require("./lib/triggers/new-contact-created");
9
- const shared_1 = require("@activepieces/shared");
10
- const company_updated_1 = require("./lib/triggers/company-updated");
11
- const contact_updated_1 = require("./lib/triggers/contact-updated");
12
- const new_call_created_1 = require("./lib/triggers/new-call-created");
13
- const new_company_created_1 = require("./lib/triggers/new-company-created");
14
- const new_task_created_1 = require("./lib/triggers/new-task-created");
15
- const new_event_created_1 = require("./lib/triggers/new-event-created");
16
- const new_pipeline_record_1 = require("./lib/triggers/new-pipeline-record");
17
- const pipeline_record_updated_1 = require("./lib/triggers/pipeline-record-updated");
18
- const create_company_1 = require("./lib/actions/create-company");
19
- const update_company_1 = require("./lib/actions/update-company");
20
- const create_contact_1 = require("./lib/actions/create-contact");
21
- const update_contact_1 = require("./lib/actions/update-contact");
22
- const create_task_1 = require("./lib/actions/create-task");
23
- const update_task_1 = require("./lib/actions/update-task");
24
- const create_call_1 = require("./lib/actions/create-call");
25
- const request_1 = require("./lib/common/request");
26
- const create_event_1 = require("./lib/actions/create-event");
27
- const update_event_1 = require("./lib/actions/update-event");
28
- const create_pipeline_record_1 = require("./lib/actions/create-pipeline-record");
29
- const update_pipeline_record_1 = require("./lib/actions/update-pipeline-record");
30
- const search_pipeline_records_1 = require("./lib/actions/search-pipeline-records");
31
- const search_company_record_1 = require("./lib/actions/search-company-record");
32
- const search_contact_record_1 = require("./lib/actions/search-contact-record");
33
- const search_product_1 = require("./lib/actions/search-product");
34
- const search_user_1 = require("./lib/actions/search-user");
35
- exports.biginAuth = pieces_framework_1.PieceAuth.OAuth2({
36
- authUrl: '{domain}/oauth/v2/auth',
37
- tokenUrl: '{domain}/oauth/v2/token',
38
- required: true,
39
- scope: [
40
- 'ZohoBigin.modules.ALL',
41
- 'ZohoBigin.settings.ALL',
42
- 'ZohoBigin.users.ALL',
43
- 'ZohoBigin.notifications.ALL',
44
- 'ZohoSearch.securesearch.READ',
45
- ],
46
- props: {
47
- domain: pieces_framework_1.Property.StaticDropdown({
48
- displayName: 'Your Data Center Region',
49
- description: 'Select your Zoho data center region for your account',
50
- required: true,
51
- options: {
52
- options: constants_1.DATA_CENTER_REGIONS.map((region) => ({
53
- label: region.LABEL,
54
- value: (0, helpers_1.getZohoBiginAccountAuthorizationUrl)(region.REGION),
55
- })),
56
- },
57
- defaultValue: (0, helpers_1.getZohoBiginAccountAuthorizationUrl)(constants_1.DATA_CENTER_REGIONS[0].REGION),
58
- }),
59
- },
60
- validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
61
- var _b;
62
- const { domain } = auth.props;
63
- if (!domain) {
64
- return {
65
- valid: false,
66
- error: 'Please select your data center region.',
67
- };
68
- }
69
- try {
70
- const region = constants_1.DATA_CENTER_REGIONS.find((r) => r.ACCOUNTS_DOMAIN === domain || (0, helpers_1.getZohoBiginAccountAuthorizationUrl)(r.REGION) === domain);
71
- const apiDomain = (_b = region === null || region === void 0 ? void 0 : region.API_DOMAIN) !== null && _b !== void 0 ? _b : 'https://www.zohoapis.com';
72
- yield request_1.biginApiService.fetchModules(auth.access_token, apiDomain);
73
- return { valid: true };
74
- }
75
- catch (_c) {
76
- return {
77
- valid: false,
78
- error: 'Could not validate OAuth credentials. please check your Client ID, Secret, and Region.',
79
- };
80
- }
81
- }),
82
- });
83
- exports.biginByZoho = (0, pieces_framework_1.createPiece)({
84
- displayName: 'Bigin by Zoho CRM',
85
- description: 'Bigin by Zoho CRM is a lightweight CRM designed for small businesses to manage contacts, companies, deals (pipeline records), tasks, calls, and events.',
86
- auth: exports.biginAuth,
87
- minimumSupportedRelease: '0.36.1',
88
- categories: [shared_1.PieceCategory.SALES_AND_CRM],
89
- logoUrl: 'https://cdn.activepieces.com/pieces/bigin-by-zoho.png',
90
- authors: ['gs03dev'],
91
- actions: [
92
- create_company_1.createCompany,
93
- update_company_1.updateCompany,
94
- create_contact_1.createContact,
95
- update_contact_1.updateContact,
96
- create_task_1.createTask,
97
- update_task_1.updateTask,
98
- create_call_1.createCall,
99
- create_event_1.createEvent,
100
- update_event_1.updateEvent,
101
- create_pipeline_record_1.createPipelineRecord,
102
- update_pipeline_record_1.updatePipelineRecord,
103
- search_pipeline_records_1.searchPipelineRecord,
104
- search_company_record_1.searchCompanyRecord,
105
- search_contact_record_1.searchContactRecord,
106
- search_product_1.searchProductRecord,
107
- search_user_1.searchUser
108
- ],
109
- triggers: [
110
- new_contact_created_1.newContactCreated,
111
- contact_updated_1.contactUpdated,
112
- new_company_created_1.newCompanyCreated,
113
- company_updated_1.companyUpdated,
114
- new_call_created_1.newCallCreated,
115
- new_task_created_1.newTaskCreated,
116
- new_event_created_1.newEventCreated,
117
- new_pipeline_record_1.newPipelineRecordCreated,
118
- pipeline_record_updated_1.pipelineRecordUpdated,
119
- ],
120
- });
121
- //# sourceMappingURL=index.js.map
1
+ "use strict";var bi=Object.create;var He=Object.defineProperty;var xi=Object.getOwnPropertyDescriptor;var Ti=Object.getOwnPropertyNames;var Ii=Object.getPrototypeOf,Ei=Object.prototype.hasOwnProperty;var o=(e,t)=>He(e,"name",{value:t,configurable:!0});var Si=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Dr=(e,t)=>{for(var r in t)He(e,r,{get:t[r],enumerable:!0})},Rr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ti(t))!Ei.call(e,i)&&i!==r&&He(e,i,{get:()=>t[i],enumerable:!(n=xi(t,i))||n.enumerable});return e};var lt=(e,t,r)=>(r=e!=null?bi(Ii(e)):{},Rr(t||!e||!e.__esModule?He(r,"default",{value:e,enumerable:!0}):r,e)),$i=e=>Rr(He({},"__esModule",{value:!0}),e);var Qn=Si((Xn,At)=>{(function(e){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),d="%[0-9a-z]{1,}",m="(?:[0-9a-f]+::?)+",l={zoneIndex:new RegExp(d,"i"),native:new RegExp(`^(::)?(${m})?([0-9a-f]+)?(::)?(${d})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${d})?)$`,"i"),transitional:new RegExp(`^((?:${m})|(?:::)(?:${m})?)${t}\\.${t}\\.${t}\\.${t}(${d})?$`,"i")};function c(u,f){if(u.indexOf("::")!==u.lastIndexOf("::"))return null;let _=0,v=-1,x=(u.match(l.zoneIndex)||[])[0],E,L;for(x&&(x=x.substring(1),u=u.replace(/%.+$/,""));(v=u.indexOf(":",v+1))>=0;)_++;if(u.substr(0,2)==="::"&&_--,u.substr(-2,2)==="::"&&_--,_>f)return null;for(L=f-_,E=":";L--;)E+="0:";return u=u.replace("::",E),u[0]===":"&&(u=u.slice(1)),u[u.length-1]===":"&&(u=u.slice(0,-1)),f=function(){let re=u.split(":"),ze=[];for(let Lt=0;Lt<re.length;Lt++)ze.push(parseInt(re[Lt],16));return ze}(),{parts:f,zoneId:x}}o(c,"expandIPv6");function a(u,f,_,v){if(u.length!==f.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let x=0,E;for(;v>0;){if(E=_-v,E<0&&(E=0),u[x]>>E!==f[x]>>E)return!1;v-=_,x+=1}return!0}o(a,"matchCIDR");function y(u){if(i.test(u))return parseInt(u,16);if(u[0]==="0"&&!isNaN(parseInt(u[1],10))){if(n.test(u))return parseInt(u,8);throw new Error(`ipaddr: cannot parse ${u} as octal`)}return parseInt(u,10)}o(y,"parseIntAuto");function P(u,f){for(;u.length<f;)u=`0${u}`;return u}o(P,"padPart");let h={};h.IPv4=function(){function u(f){if(f.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let _,v;for(_=0;_<f.length;_++)if(v=f[_],!(0<=v&&v<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=f}return o(u,"IPv4"),u.prototype.SpecialRanges={unspecified:[[new u([0,0,0,0]),8]],broadcast:[[new u([255,255,255,255]),32]],multicast:[[new u([224,0,0,0]),4]],linkLocal:[[new u([169,254,0,0]),16]],loopback:[[new u([127,0,0,0]),8]],carrierGradeNat:[[new u([100,64,0,0]),10]],private:[[new u([10,0,0,0]),8],[new u([172,16,0,0]),12],[new u([192,168,0,0]),16]],reserved:[[new u([192,0,0,0]),24],[new u([192,0,2,0]),24],[new u([192,88,99,0]),24],[new u([198,18,0,0]),15],[new u([198,51,100,0]),24],[new u([203,0,113,0]),24],[new u([240,0,0,0]),4]],as112:[[new u([192,175,48,0]),24],[new u([192,31,196,0]),24]],amt:[[new u([192,52,193,0]),24]]},u.prototype.kind=function(){return"ipv4"},u.prototype.match=function(f,_){let v;if(_===void 0&&(v=f,f=v[0],_=v[1]),f.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return a(this.octets,f.octets,8,_)},u.prototype.prefixLengthFromSubnetMask=function(){let f=0,_=!1,v={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},x,E,L;for(x=3;x>=0;x-=1)if(E=this.octets[x],E in v){if(L=v[E],_&&L!==0)return null;L!==8&&(_=!0),f+=L}else return null;return 32-f},u.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},u.prototype.toByteArray=function(){return this.octets.slice(0)},u.prototype.toIPv4MappedAddress=function(){return h.IPv6.parse(`::ffff:${this.toString()}`)},u.prototype.toNormalizedString=function(){return this.toString()},u.prototype.toString=function(){return this.octets.join(".")},u}(),h.IPv4.broadcastAddressFromCIDR=function(u){try{let f=this.parseCIDR(u),_=f[0].toByteArray(),v=this.subnetMaskFromPrefixLength(f[1]).toByteArray(),x=[],E=0;for(;E<4;)x.push(parseInt(_[E],10)|parseInt(v[E],10)^255),E++;return new this(x)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.isIPv4=function(u){return this.parser(u)!==null},h.IPv4.isValid=function(u){try{return new this(this.parser(u)),!0}catch{return!1}},h.IPv4.isValidCIDR=function(u){try{return this.parseCIDR(u),!0}catch{return!1}},h.IPv4.isValidFourPartDecimal=function(u){return!!(h.IPv4.isValid(u)&&u.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},h.IPv4.isValidCIDRFourPartDecimal=function(u){let f=u.match(/^(.+)\/(\d+)$/);return!h.IPv4.isValidCIDR(u)||!f?!1:h.IPv4.isValidFourPartDecimal(f[1])},h.IPv4.networkAddressFromCIDR=function(u){let f,_,v,x,E;try{for(f=this.parseCIDR(u),v=f[0].toByteArray(),E=this.subnetMaskFromPrefixLength(f[1]).toByteArray(),x=[],_=0;_<4;)x.push(parseInt(v[_],10)&parseInt(E[_],10)),_++;return new this(x)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.parse=function(u){let f=this.parser(u);if(f===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(f)},h.IPv4.parseCIDR=function(u){let f;if(f=u.match(/^(.+)\/(\d+)$/)){let _=parseInt(f[2]);if(_>=0&&_<=32){let v=[this.parse(f[1]),_];return Object.defineProperty(v,"toString",{value:o(function(){return this.join("/")},"value")}),v}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},h.IPv4.parser=function(u){let f,_,v;if(f=u.match(r.fourOctet))return function(){let x=f.slice(1,6),E=[];for(let L=0;L<x.length;L++)_=x[L],E.push(y(_));return E}();if(f=u.match(r.longValue)){if(v=y(f[1]),v>4294967295||v<0)throw new Error("ipaddr: address outside defined range");return function(){let x=[],E;for(E=0;E<=24;E+=8)x.push(v>>E&255);return x}().reverse()}else return(f=u.match(r.twoOctet))?function(){let x=f.slice(1,4),E=[];if(v=y(x[1]),v>16777215||v<0)throw new Error("ipaddr: address outside defined range");return E.push(y(x[0])),E.push(v>>16&255),E.push(v>>8&255),E.push(v&255),E}():(f=u.match(r.threeOctet))?function(){let x=f.slice(1,5),E=[];if(v=y(x[2]),v>65535||v<0)throw new Error("ipaddr: address outside defined range");return E.push(y(x[0])),E.push(y(x[1])),E.push(v>>8&255),E.push(v&255),E}():null},h.IPv4.subnetMaskFromPrefixLength=function(u){if(u=parseInt(u),u<0||u>32)throw new Error("ipaddr: invalid IPv4 prefix length");let f=[0,0,0,0],_=0,v=Math.floor(u/8);for(;_<v;)f[_]=255,_++;return v<4&&(f[v]=Math.pow(2,u%8)-1<<8-u%8),new this(f)},h.IPv6=function(){function u(f,_){let v,x;if(f.length===16)for(this.parts=[],v=0;v<=14;v+=2)this.parts.push(f[v]<<8|f[v+1]);else if(f.length===8)this.parts=f;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(v=0;v<this.parts.length;v++)if(x=this.parts[v],!(0<=x&&x<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");_&&(this.zoneId=_)}return o(u,"IPv6"),u.prototype.SpecialRanges={unspecified:[new u([0,0,0,0,0,0,0,0]),128],linkLocal:[new u([65152,0,0,0,0,0,0,0]),10],multicast:[new u([65280,0,0,0,0,0,0,0]),8],loopback:[new u([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new u([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new u([0,0,0,0,0,65535,0,0]),96],discard:[new u([256,0,0,0,0,0,0,0]),64],rfc6145:[new u([0,0,0,0,65535,0,0,0]),96],rfc6052:[new u([100,65435,0,0,0,0,0,0]),96],"6to4":[new u([8194,0,0,0,0,0,0,0]),16],teredo:[new u([8193,0,0,0,0,0,0,0]),32],benchmarking:[new u([8193,2,0,0,0,0,0,0]),48],amt:[new u([8193,3,0,0,0,0,0,0]),32],as112v6:[[new u([8193,4,274,0,0,0,0,0]),48],[new u([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new u([8193,16,0,0,0,0,0,0]),28],orchid2:[new u([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new u([8193,48,0,0,0,0,0,0]),28],reserved:[[new u([8193,0,0,0,0,0,0,0]),23],[new u([8193,3512,0,0,0,0,0,0]),32]]},u.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},u.prototype.kind=function(){return"ipv6"},u.prototype.match=function(f,_){let v;if(_===void 0&&(v=f,f=v[0],_=v[1]),f.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return a(this.parts,f.parts,16,_)},u.prototype.prefixLengthFromSubnetMask=function(){let f=0,_=!1,v={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},x,E;for(let L=7;L>=0;L-=1)if(x=this.parts[L],x in v){if(E=v[x],_&&E!==0)return null;E!==16&&(_=!0),f+=E}else return null;return 128-f},u.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},u.prototype.toByteArray=function(){let f,_=[],v=this.parts;for(let x=0;x<v.length;x++)f=v[x],_.push(f>>8),_.push(f&255);return _},u.prototype.toFixedLengthString=function(){let f=function(){let v=[];for(let x=0;x<this.parts.length;x++)v.push(P(this.parts[x].toString(16),4));return v}.call(this).join(":"),_="";return this.zoneId&&(_=`%${this.zoneId}`),f+_},u.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let f=this.parts.slice(-2),_=f[0],v=f[1];return new h.IPv4([_>>8,_&255,v>>8,v&255])},u.prototype.toNormalizedString=function(){let f=function(){let v=[];for(let x=0;x<this.parts.length;x++)v.push(this.parts[x].toString(16));return v}.call(this).join(":"),_="";return this.zoneId&&(_=`%${this.zoneId}`),f+_},u.prototype.toRFC5952String=function(){let f=/((^|:)(0(:|$)){2,})/g,_=this.toNormalizedString(),v=0,x=-1,E;for(;E=f.exec(_);)E[0].length>x&&(v=E.index,x=E[0].length);return x<0?_:`${_.substring(0,v)}::${_.substring(v+x)}`},u.prototype.toString=function(){return this.toRFC5952String()},u}(),h.IPv6.broadcastAddressFromCIDR=function(u){try{let f=this.parseCIDR(u),_=f[0].toByteArray(),v=this.subnetMaskFromPrefixLength(f[1]).toByteArray(),x=[],E=0;for(;E<16;)x.push(parseInt(_[E],10)|parseInt(v[E],10)^255),E++;return new this(x)}catch(f){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${f})`)}},h.IPv6.isIPv6=function(u){return this.parser(u)!==null},h.IPv6.isValid=function(u){if(typeof u=="string"&&u.indexOf(":")===-1)return!1;try{let f=this.parser(u);return new this(f.parts,f.zoneId),!0}catch{return!1}},h.IPv6.isValidCIDR=function(u){if(typeof u=="string"&&u.indexOf(":")===-1)return!1;try{return this.parseCIDR(u),!0}catch{return!1}},h.IPv6.networkAddressFromCIDR=function(u){let f,_,v,x,E;try{for(f=this.parseCIDR(u),v=f[0].toByteArray(),E=this.subnetMaskFromPrefixLength(f[1]).toByteArray(),x=[],_=0;_<16;)x.push(parseInt(v[_],10)&parseInt(E[_],10)),_++;return new this(x)}catch(L){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${L})`)}},h.IPv6.parse=function(u){let f=this.parser(u);if(f.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(f.parts,f.zoneId)},h.IPv6.parseCIDR=function(u){let f,_,v;if((_=u.match(/^(.+)\/(\d+)$/))&&(f=parseInt(_[2]),f>=0&&f<=128))return v=[this.parse(_[1]),f],Object.defineProperty(v,"toString",{value:o(function(){return this.join("/")},"value")}),v;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},h.IPv6.parser=function(u){let f,_,v,x,E,L;if(v=u.match(l.deprecatedTransitional))return this.parser(`::ffff:${v[1]}`);if(l.native.test(u))return c(u,8);if((v=u.match(l.transitional))&&(L=v[6]||"",f=v[1],v[1].endsWith("::")||(f=f.slice(0,-1)),f=c(f+L,6),f.parts)){for(E=[parseInt(v[2]),parseInt(v[3]),parseInt(v[4]),parseInt(v[5])],_=0;_<E.length;_++)if(x=E[_],!(0<=x&&x<=255))return null;return f.parts.push(E[0]<<8|E[1]),f.parts.push(E[2]<<8|E[3]),{parts:f.parts,zoneId:f.zoneId}}return null},h.IPv6.subnetMaskFromPrefixLength=function(u){if(u=parseInt(u),u<0||u>128)throw new Error("ipaddr: invalid IPv6 prefix length");let f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],_=0,v=Math.floor(u/8);for(;_<v;)f[_]=255,_++;return v<16&&(f[v]=Math.pow(2,u%8)-1<<8-u%8),new this(f)},h.fromByteArray=function(u){let f=u.length;if(f===4)return new h.IPv4(u);if(f===16)return new h.IPv6(u);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},h.isValid=function(u){return h.IPv6.isValid(u)||h.IPv4.isValid(u)},h.isValidCIDR=function(u){return h.IPv6.isValidCIDR(u)||h.IPv4.isValidCIDR(u)},h.parse=function(u){if(h.IPv6.isValid(u))return h.IPv6.parse(u);if(h.IPv4.isValid(u))return h.IPv4.parse(u);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},h.parseCIDR=function(u){try{return h.IPv6.parseCIDR(u)}catch{try{return h.IPv4.parseCIDR(u)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},h.process=function(u){let f=this.parse(u);return f.kind()==="ipv6"&&f.isIPv4MappedAddress()?f.toIPv4Address():f},h.subnetMatch=function(u,f,_){let v,x,E,L;_==null&&(_="unicast");for(x in f)if(Object.prototype.hasOwnProperty.call(f,x)){for(E=f[x],E[0]&&!(E[0]instanceof Array)&&(E=[E]),v=0;v<E.length;v++)if(L=E[v],u.kind()===L[0].kind()&&u.match.apply(u,L))return x}return _},typeof At<"u"&&At.exports?At.exports=h:e.ipaddr=h})(Xn)});var oc={};Dr(oc,{biginByZoho:()=>nc});module.exports=$i(oc);var Ai=Object.freeze({status:"aborted"});function S(e,t,r){function n(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:m,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);let a=m.prototype,y=Object.keys(a);for(let P=0;P<y.length;P++){let h=y[P];h in l||(l[h]=a[h].bind(l))}}o(n,"init");let i=r?.Parent??Object;class d extends i{static{o(this,"Definition")}}Object.defineProperty(d,"name",{value:e});function m(l){var c;let a=r?.Parent?new d:this;n(a,l),(c=a._zod).deferred??(c.deferred=[]);for(let y of a._zod.deferred)y();return a}return o(m,"_"),Object.defineProperty(m,"init",{value:n}),Object.defineProperty(m,Symbol.hasInstance,{value:o(l=>r?.Parent&&l instanceof r.Parent?!0:l?._zod?.traits?.has(e),"value")}),Object.defineProperty(m,"name",{value:e}),m}o(S,"$constructor");var wi=Symbol("zod_brand"),ue=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},dt=class extends Error{static{o(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},jt={};function fe(e){return e&&Object.assign(jt,e),jt}o(fe,"config");function Bt(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}o(Bt,"getEnumValues");function Mr(e,t){return typeof t=="bigint"?t.toString():t}o(Mr,"jsonStringifyReplacer");function mt(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}o(mt,"cached");function Ur(e){return e==null}o(Ur,"nullish");function ft(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}o(ft,"cleanRegex");var Cr=Symbol("evaluating");function X(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Cr)return n===void 0&&(n=Cr,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}o(X,"defineLazy");var Zt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ve(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(Ve,"isObject");var ki=mt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Lr(e){if(Ve(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Ve(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}o(Lr,"isPlainObject");var jr=new Set(["string","number","symbol"]);function Ne(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(Ne,"escapeRegex");function gt(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}o(gt,"clone");function G(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:o(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:o(()=>t.error,"error")}:t}o(G,"normalizeParams");function Fr(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}o(Fr,"optionalKeys");var zi={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 Oe(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}o(Oe,"aborted");function Pe(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}o(Pe,"prefixIssues");function pt(e){return typeof e=="string"?e:e?.message}o(pt,"unwrapMessage");function be(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=pt(e.inst?._zod.def?.error?.(e))??pt(t?.error?.(e))??pt(r.customError?.(e))??pt(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}o(be,"finalizeIssue");function Br(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}o(Br,"getLengthableOrigin");function Ht(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}o(Ht,"issue");var Zr=o((e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Mr,2),Object.defineProperty(e,"toString",{value:o(()=>e.message,"value"),enumerable:!1})},"initializer"),Hr=S("$ZodError",Zr),We=S("$ZodError",Zr,{Parent:Error});var Oi=o(e=>(t,r,n,i)=>{let d=n?Object.assign(n,{async:!1}):{async:!1},m=t._zod.run({value:r,issues:[]},d);if(m instanceof Promise)throw new ue;if(m.issues.length){let l=new(i?.Err??e)(m.issues.map(c=>be(c,d,fe())));throw Zt(l,i?.callee),l}return m.value},"_parse"),yt=Oi(We),Di=o(e=>async(t,r,n,i)=>{let d=n?Object.assign(n,{async:!0}):{async:!0},m=t._zod.run({value:r,issues:[]},d);if(m instanceof Promise&&(m=await m),m.issues.length){let l=new(i?.Err??e)(m.issues.map(c=>be(c,d,fe())));throw Zt(l,i?.callee),l}return m.value},"_parseAsync"),ht=Di(We),Ri=o(e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},d=t._zod.run({value:r,issues:[]},i);if(d instanceof Promise)throw new ue;return d.issues.length?{success:!1,error:new(e??Hr)(d.issues.map(m=>be(m,i,fe())))}:{success:!0,data:d.value}},"_safeParse"),qe=Ri(We),Ci=o(e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},d=t._zod.run({value:r,issues:[]},i);return d instanceof Promise&&(d=await d),d.issues.length?{success:!1,error:new e(d.issues.map(m=>be(m,i,fe())))}:{success:!0,data:d.value}},"_safeParseAsync"),Ge=Ci(We);var Mi="(?:(?:\\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])))",Ui=new RegExp(`^${Mi}$`);var Vr=o(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),Wr=/^-?\d+n?$/;var Vt=/^-?\d+(?:\.\d+)?$/,qr=/^(?:true|false)$/i;var De=S("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Gr=S("$ZodCheckMinLength",(e,t)=>{var r;De.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!Ur(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let m=Br(i);n.issues.push({origin:m,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}});var Wt=S("$ZodCheckStringFormat",(e,t)=>{var r,n;De.init(e,t),e._zod.onattach.push(i=>{let d=i._zod.bag;d.format=t.format,t.pattern&&(d.patterns??(d.patterns=new Set),d.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Kr=S("$ZodCheckRegex",(e,t)=>{Wt.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 Jr={major:4,minor:3,patch:6};var K=S("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Jr;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let d of i._zod.onattach)d(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=o((m,l,c)=>{let a=Oe(m),y;for(let P of l){if(P._zod.def.when){if(!P._zod.def.when(m))continue}else if(a)continue;let h=m.issues.length,u=P._zod.check(m);if(u instanceof Promise&&c?.async===!1)throw new ue;if(y||u instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await u,m.issues.length!==h&&(a||(a=Oe(m,h)))});else{if(m.issues.length===h)continue;a||(a=Oe(m,h))}}return y?y.then(()=>m):m},"runChecks"),d=o((m,l,c)=>{if(Oe(m))return m.aborted=!0,m;let a=i(l,n,c);if(a instanceof Promise){if(c.async===!1)throw new ue;return a.then(y=>e._zod.parse(y,c))}return e._zod.parse(a,c)},"handleCanaryResult");e._zod.run=(m,l)=>{if(l.skipChecks)return e._zod.parse(m,l);if(l.direction==="backward"){let a=e._zod.parse({value:m.value,issues:[]},{...l,skipChecks:!0});return a instanceof Promise?a.then(y=>d(y,m,l)):d(a,m,l)}let c=e._zod.parse(m,l);if(c instanceof Promise){if(l.async===!1)throw new ue;return c.then(a=>i(a,n,l))}return i(c,n,l)}}X(e,"~standard",()=>({validate:o(i=>{try{let d=qe(e,i);return d.success?{value:d.data}:{issues:d.error?.issues}}catch{return Ge(e,i).then(m=>m.success?{value:m.data}:{issues:m.error?.issues})}},"validate"),vendor:"zod",version:1}))}),Pt=S("$ZodString",(e,t)=>{K.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Vr(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),qt=S("$ZodStringFormat",(e,t)=>{Wt.init(e,t),Pt.init(e,t)});var rn=S("$ZodURL",(e,t)=>{qt.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}});var nn=S("$ZodNumber",(e,t)=>{K.init(e,t),e._zod.pattern=e._zod.bag.pattern??Vt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let d=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...d?{received:d}:{}}),r}});var Gt=S("$ZodBoolean",(e,t)=>{K.init(e,t),e._zod.pattern=qr,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),on=S("$ZodBigInt",(e,t)=>{K.init(e,t),e._zod.pattern=Wr,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var an=S("$ZodAny",(e,t)=>{K.init(e,t),e._zod.parse=r=>r}),sn=S("$ZodUnknown",(e,t)=>{K.init(e,t),e._zod.parse=r=>r});var cn=S("$ZodVoid",(e,t)=>{K.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),r}}),un=S("$ZodDate",(e,t)=>{K.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,d=i instanceof Date;return d&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...d?{received:"Invalid Date"}:{},inst:e}),r}});function Xr(e,t,r){e.issues.length&&t.issues.push(...Pe(r,e.issues)),t.value[r]=e.value}o(Xr,"handleArrayResult");var ln=S("$ZodArray",(e,t)=>{K.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let d=[];for(let m=0;m<i.length;m++){let l=i[m],c=t.element._zod.run({value:l,issues:[]},n);c instanceof Promise?d.push(c.then(a=>Xr(a,r,m))):Xr(c,r,m)}return d.length?Promise.all(d).then(()=>r):r}});function _t(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...Pe(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}o(_t,"handlePropertyResult");function Li(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Fr(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}o(Li,"normalizeDef");function ji(e,t,r,n,i,d){let m=[],l=i.keySet,c=i.catchall._zod,a=c.def.type,y=c.optout==="optional";for(let P in t){if(l.has(P))continue;if(a==="never"){m.push(P);continue}let h=c.run({value:t[P],issues:[]},n);h instanceof Promise?e.push(h.then(u=>_t(u,r,P,t,y))):_t(h,r,P,t,y)}return m.length&&r.issues.push({code:"unrecognized_keys",keys:m,input:t,inst:d}),e.length?Promise.all(e).then(()=>r):r}o(ji,"handleCatchall");var dn=S("$ZodObject",(e,t)=>{if(K.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let l=t.shape;Object.defineProperty(t,"shape",{get:o(()=>{let c={...l};return Object.defineProperty(t,"shape",{value:c}),c},"get")})}let n=mt(()=>Li(t));X(e._zod,"propValues",()=>{let l=t.shape,c={};for(let a in l){let y=l[a]._zod;if(y.values){c[a]??(c[a]=new Set);for(let P of y.values)c[a].add(P)}}return c});let i=Ve,d=t.catchall,m;e._zod.parse=(l,c)=>{m??(m=n.value);let a=l.value;if(!i(a))return l.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),l;l.value={};let y=[],P=m.shape;for(let h of m.keys){let u=P[h],f=u._zod.optout==="optional",_=u._zod.run({value:a[h],issues:[]},c);_ instanceof Promise?y.push(_.then(v=>_t(v,l,h,a,f))):_t(_,l,h,a,f)}return d?ji(y,a,l,c,n.value,e):y.length?Promise.all(y).then(()=>l):l}});function Qr(e,t,r,n){for(let d of e)if(d.issues.length===0)return t.value=d.value,t;let i=e.filter(d=>!Oe(d));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(d=>d.issues.map(m=>be(m,n,fe())))}),t)}o(Qr,"handleUnionResults");var Kt=S("$ZodUnion",(e,t)=>{K.init(e,t),X(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),X(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),X(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),X(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){let i=t.options.map(d=>d._zod.pattern);return new RegExp(`^(${i.map(d=>ft(d.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,d)=>{if(r)return n(i,d);let m=!1,l=[];for(let c of t.options){let a=c._zod.run({value:i.value,issues:[]},d);if(a instanceof Promise)l.push(a),m=!0;else{if(a.issues.length===0)return a;l.push(a)}}return m?Promise.all(l).then(c=>Qr(c,i,e,d)):Qr(l,i,e,d)}});var pn=S("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Kt.init(e,t);let r=e._zod.parse;X(e._zod,"propValues",()=>{let i={};for(let d of t.options){let m=d._zod.propValues;if(!m||Object.keys(m).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(let[l,c]of Object.entries(m)){i[l]||(i[l]=new Set);for(let a of c)i[l].add(a)}}return i});let n=mt(()=>{let i=t.options,d=new Map;for(let m of i){let l=m._zod.propValues?.[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(m)}"`);for(let c of l){if(d.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);d.set(c,m)}}return d});e._zod.parse=(i,d)=>{let m=i.value;if(!Ve(m))return i.issues.push({code:"invalid_type",expected:"object",input:m,inst:e}),i;let l=n.value.get(m?.[t.discriminator]);return l?l._zod.run(i,d):t.unionFallback?r(i,d):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:m,path:[t.discriminator],inst:e}),i)}});var mn=S("$ZodRecord",(e,t)=>{K.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Lr(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let d=[],m=t.keyType._zod.values;if(m){r.value={};let l=new Set;for(let a of m)if(typeof a=="string"||typeof a=="number"||typeof a=="symbol"){l.add(typeof a=="number"?a.toString():a);let y=t.valueType._zod.run({value:i[a],issues:[]},n);y instanceof Promise?d.push(y.then(P=>{P.issues.length&&r.issues.push(...Pe(a,P.issues)),r.value[a]=P.value})):(y.issues.length&&r.issues.push(...Pe(a,y.issues)),r.value[a]=y.value)}let c;for(let a in i)l.has(a)||(c=c??[],c.push(a));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c})}else{r.value={};for(let l of Reflect.ownKeys(i)){if(l==="__proto__")continue;let c=t.keyType._zod.run({value:l,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Vt.test(l)&&c.issues.length){let P=t.keyType._zod.run({value:Number(l),issues:[]},n);if(P instanceof Promise)throw new Error("Async schemas not supported in object keys currently");P.issues.length===0&&(c=P)}if(c.issues.length){t.mode==="loose"?r.value[l]=i[l]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(P=>be(P,n,fe())),input:l,path:[l],inst:e});continue}let y=t.valueType._zod.run({value:i[l],issues:[]},n);y instanceof Promise?d.push(y.then(P=>{P.issues.length&&r.issues.push(...Pe(l,P.issues)),r.value[c.value]=P.value})):(y.issues.length&&r.issues.push(...Pe(l,y.issues)),r.value[c.value]=y.value)}}return d.length?Promise.all(d).then(()=>r):r}});var fn=S("$ZodEnum",(e,t)=>{K.init(e,t);let r=Bt(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>jr.has(typeof i)).map(i=>typeof i=="string"?Ne(i):i.toString()).join("|")})$`),e._zod.parse=(i,d)=>{let m=i.value;return n.has(m)||i.issues.push({code:"invalid_value",values:r,input:m,inst:e}),i}}),gn=S("$ZodLiteral",(e,t)=>{if(K.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?Ne(n):n?Ne(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let d=n.value;return r.has(d)||n.issues.push({code:"invalid_value",values:t.values,input:d,inst:e}),n}});var yn=S("$ZodTransform",(e,t)=>{K.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new dt(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(m=>(r.value=m,r));if(i instanceof Promise)throw new ue;return r.value=i,r}});function en(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}o(en,"handleOptionalResult");var hn=S("$ZodOptional",(e,t)=>{K.init(e,t),e._zod.optin="optional",e._zod.optout="optional",X(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),X(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${ft(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(d=>en(d,r.value)):en(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var vn=S("$ZodNullable",(e,t)=>{K.init(e,t),X(e._zod,"optin",()=>t.innerType._zod.optin),X(e._zod,"optout",()=>t.innerType._zod.optout),X(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${ft(r.source)}|null)$`):void 0}),X(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)});var _n=S("$ZodPipe",(e,t)=>{K.init(e,t),X(e._zod,"values",()=>t.in._zod.values),X(e._zod,"optin",()=>t.in._zod.optin),X(e._zod,"optout",()=>t.out._zod.optout),X(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let d=t.out._zod.run(r,n);return d instanceof Promise?d.then(m=>vt(m,t.in,n)):vt(d,t.in,n)}let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(d=>vt(d,t.out,n)):vt(i,t.out,n)}});function vt(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}o(vt,"handlePipeResult");var Pn=S("$ZodCustom",(e,t)=>{De.init(e,t),K.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(d=>tn(d,r,n,e));tn(i,r,n,e)}});function tn(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(Ht(i))}}o(tn,"handleRefineResult");var xn,Hi=Symbol("ZodOutput"),Vi=Symbol("ZodInput"),Yt=class{static{o(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Tn(){return new Yt}o(Tn,"registry");(xn=globalThis).__zod_globalRegistry??(xn.__zod_globalRegistry=Tn());var Jt=globalThis.__zod_globalRegistry;function In(e,t){return new e({type:"string",...G(t)})}o(In,"_string");function En(e,t){return new e({type:"string",coerce:!0,...G(t)})}o(En,"_coercedString");function Sn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...G(t)})}o(Sn,"_url");function $n(e,t){return new e({type:"number",checks:[],...G(t)})}o($n,"_number");function An(e,t){return new e({type:"number",coerce:!0,checks:[],...G(t)})}o(An,"_coercedNumber");function wn(e,t){return new e({type:"boolean",...G(t)})}o(wn,"_boolean");function kn(e,t){return new e({type:"boolean",coerce:!0,...G(t)})}o(kn,"_coercedBoolean");function zn(e,t){return new e({type:"bigint",coerce:!0,...G(t)})}o(zn,"_coercedBigint");function Nn(e){return new e({type:"any"})}o(Nn,"_any");function On(e){return new e({type:"unknown"})}o(On,"_unknown");function Dn(e,t){return new e({type:"void",...G(t)})}o(Dn,"_void");function Rn(e,t){return new e({type:"date",coerce:!0,...G(t)})}o(Rn,"_coercedDate");function ce(e,t){return new Gr({check:"min_length",...G(t),minimum:e})}o(ce,"_minLength");function xe(e,t){return new Kr({check:"string_format",format:"regex",...G(t),pattern:e})}o(xe,"_regex");function Cn(e,t,r){let n=G(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}o(Cn,"_custom");var Q=S("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");K.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>yt(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>qe(e,r,n),e.parseAsync=async(r,n)=>ht(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Ge(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>gt(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.apply=r=>r(e)}),xt=S("ZodMiniString",(e,t)=>{Pt.init(e,t),Q.init(e,t)});function s(e){return In(xt,e)}o(s,"string");var Mn=S("ZodMiniStringFormat",(e,t)=>{qt.init(e,t),xt.init(e,t)});var ta=S("ZodMiniURL",(e,t)=>{rn.init(e,t),Mn.init(e,t)});function Un(e){return Sn(ta,e)}o(Un,"url");var Xt=S("ZodMiniNumber",(e,t)=>{nn.init(e,t),Q.init(e,t)});function oe(e){return $n(Xt,e)}o(oe,"number");var Qt=S("ZodMiniBoolean",(e,t)=>{Gt.init(e,t),Q.init(e,t)});function Z(e){return wn(Qt,e)}o(Z,"boolean");var Ln=S("ZodMiniBigInt",(e,t)=>{on.init(e,t),Q.init(e,t)});var ra=S("ZodMiniAny",(e,t)=>{an.init(e,t),Q.init(e,t)});function Ye(){return Nn(ra)}o(Ye,"any");var na=S("ZodMiniUnknown",(e,t)=>{sn.init(e,t),Q.init(e,t)});function N(){return On(na)}o(N,"unknown");var oa=S("ZodMiniVoid",(e,t)=>{cn.init(e,t),Q.init(e,t)});function jn(e){return Dn(oa,e)}o(jn,"_void");var Fn=S("ZodMiniDate",(e,t)=>{un.init(e,t),Q.init(e,t)});var ia=S("ZodMiniArray",(e,t)=>{ln.init(e,t),Q.init(e,t)});function R(e,t){return new ia({type:"array",element:e,...G(t)})}o(R,"array");var aa=S("ZodMiniObject",(e,t)=>{dn.init(e,t),Q.init(e,t),X(e,"shape",()=>t.shape)});function g(e,t){let r={type:"object",shape:e??{},...G(t)};return new aa(r)}o(g,"object");var sa=S("ZodMiniUnion",(e,t)=>{Kt.init(e,t),Q.init(e,t)});function C(e,t){return new sa({type:"union",options:e,...G(t)})}o(C,"union");var ca=S("ZodMiniDiscriminatedUnion",(e,t)=>{pn.init(e,t),Q.init(e,t)});function Re(e,t,r){return new ca({type:"union",options:t,discriminator:e,...G(r)})}o(Re,"discriminatedUnion");var ua=S("ZodMiniRecord",(e,t)=>{mn.init(e,t),Q.init(e,t)});function O(e,t,r){return new ua({type:"record",keyType:e,valueType:t,...G(r)})}o(O,"record");var la=S("ZodMiniEnum",(e,t)=>{fn.init(e,t),Q.init(e,t),e.options=Object.values(t.entries)});function U(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new la({type:"enum",entries:r,...G(t)})}o(U,"_enum");var da=S("ZodMiniLiteral",(e,t)=>{gn.init(e,t),Q.init(e,t)});function A(e,t){return new da({type:"literal",values:Array.isArray(e)?e:[e],...G(t)})}o(A,"literal");var pa=S("ZodMiniTransform",(e,t)=>{yn.init(e,t),Q.init(e,t)});function Te(e){return new pa({type:"transform",transform:e})}o(Te,"transform");var ma=S("ZodMiniOptional",(e,t)=>{hn.init(e,t),Q.init(e,t)});function b(e){return new ma({type:"optional",innerType:e})}o(b,"optional");var fa=S("ZodMiniNullable",(e,t)=>{vn.init(e,t),Q.init(e,t)});function Je(e){return new fa({type:"nullable",innerType:e})}o(Je,"nullable");var ga=S("ZodMiniPipe",(e,t)=>{_n.init(e,t),Q.init(e,t)});function Ie(e,t){return new ga({type:"pipe",in:e,out:t})}o(Ie,"pipe");var ya=S("ZodMiniCustom",(e,t)=>{Pn.init(e,t),Q.init(e,t)});function Tt(e,t){return Cn(ya,e??(()=>!0),t)}o(Tt,"custom");var Xe={};Dr(Xe,{bigint:()=>Ta,boolean:()=>xa,date:()=>Ia,number:()=>ba,string:()=>Pa});function Pa(e){return En(xt,e)}o(Pa,"string");function ba(e){return An(Xt,e)}o(ba,"number");function xa(e){return kn(Qt,e)}o(xa,"boolean");function Ta(e){return zn(Ln,e)}o(Ta,"bigint");function Ia(e){return Rn(Fn,e)}o(Ia,"date");var tr=g({retryOnFailure:g({defaultValue:b(Z()),hide:b(Z())}),continueOnFailure:g({defaultValue:b(Z()),hide:b(Z())})}),er=class{constructor(t,r,n,i,d,m,l,c,a,y,P){this.name=t;this.displayName=r;this.description=n;this.props=i;this.run=d;this.test=m;this.requireAuth=l;this.errorHandlingOptions=c;this.outputSchema=a;this.audience=y;this.aiMetadata=P}static{o(this,"IAction")}},F=o(e=>new er(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 B=g({displayName:s(),description:b(s())}),M=o((e,t)=>g({type:A(t),required:Z(),defaultValue:b(Ye())}),"TPropertyValue");var ie=g({...B.shape,...M(s(),"SHORT_TEXT").shape}),ge=g({...B.shape,...M(s(),"LONG_TEXT").shape});var Zn=g({label:s(),value:N()}),It=g({disabled:b(Z()),placeholder:b(s()),options:R(Zn)});var ae=g({...B.shape,options:It,...M(N(),"STATIC_DROPDOWN").shape}),ye=g({...B.shape,options:It,...M(R(N()),"STATIC_MULTI_SELECT_DROPDOWN").shape});var rr=g({...B.shape,...M(N(),"DROPDOWN").shape,refreshers:R(s())}),Qe=g({...B.shape,...M(R(N()),"MULTI_SELECT_DROPDOWN").shape,refreshers:R(s())});var he=g({...B.shape,...M(Z(),"CHECKBOX").shape});var ve=g({...B.shape,...M(oe(),"NUMBER").shape});var et=g({...B.shape,...M(N(),"FILE").shape});var tt=g({...B.shape,...M(s(),"DATE_TIME").shape});var Hn=O(s(),C([ie,ge,ae,Qe,ye,he,ve,et,tt])),rt=g({...B.shape,properties:Hn,...M(R(N()),"ARRAY").shape});var nt=g({...B.shape,...M(C([O(s(),N())]),"JSON").shape});var Vn=C([ie,ae,nt,rt,ye]),Sa=O(s(),Vn),nr=g({refreshers:R(s()),...B.shape,...M(N(),"DYNAMIC").shape});var Et=g({...B.shape,...M(jn(),"MARKDOWN").shape});var ot=(r=>(r.ARCHIVE="ARCHIVE",r.REGISTRY="REGISTRY",r))(ot||{}),Ce=(r=>(r.CUSTOM="CUSTOM",r.OFFICIAL="OFFICIAL",r))(Ce||{}),Me=(x=>(x.ARTIFICIAL_INTELLIGENCE="ARTIFICIAL_INTELLIGENCE",x.COMMUNICATION="COMMUNICATION",x.COMMERCE="COMMERCE",x.CORE="CORE",x.UNIVERSAL_AI="UNIVERSAL_AI",x.FLOW_CONTROL="FLOW_CONTROL",x.BUSINESS_INTELLIGENCE="BUSINESS_INTELLIGENCE",x.ACCOUNTING="ACCOUNTING",x.PRODUCTIVITY="PRODUCTIVITY",x.CONTENT_AND_FILES="CONTENT_AND_FILES",x.DEVELOPER_TOOLS="DEVELOPER_TOOLS",x.CUSTOMER_SUPPORT="CUSTOMER_SUPPORT",x.FORMS_AND_SURVEYS="FORMS_AND_SURVEYS",x.HUMAN_RESOURCES="HUMAN_RESOURCES",x.PAYMENT_PROCESSING="PAYMENT_PROCESSING",x.MARKETING="MARKETING",x.SALES_AND_CRM="SALES_AND_CRM",x))(Me||{});var it=(r=>(r.AUTHORIZATION_CODE="authorization_code",r.CLIENT_CREDENTIALS="client_credentials",r))(it||{}),or="both_client_credentials_and_authorization_code";var ne=(i=>(i.POLLING="POLLING",i.WEBHOOK="WEBHOOK",i.APP_WEBHOOK="APP_WEBHOOK",i.MANUAL="MANUAL",i))(ne||{}),at=(d=>(d.NONE="NONE",d.HEADER_PRESENT="HEADER_PRESENT",d.QUERY_PRESENT="QUERY_PRESENT",d.BODY_PARAM_PRESENT="BODY_PARAM_PRESENT",d.HEAD_REQUEST="HEAD_REQUEST",d))(at||{}),$a=g({strategy:U(at),paramName:b(s())}),st=(r=>(r.SIMULATION="SIMULATION",r.TEST_FUNCTION="TEST_FUNCTION",r))(st||{});var St=(r=>(r.WEBSOCKET="WEBSOCKET",r.NONE="NONE",r))(St||{}),Wn=g({status:b(oe()),body:b(N()),headers:b(O(s(),s()))}),qn=g({type:A("DELAY"),resumeDateTime:s(),requestIdToReply:b(s()),handlerId:b(s()),streamStepProgress:b(U(St))}),Gn=g({type:A("WEBHOOK"),requestId:s(),requestIdToReply:b(s()),response:Wn,handlerId:b(s()),streamStepProgress:b(U(St))}),Aa=C([qn,Gn]);var wa=g({body:N(),rawBody:b(N()),headers:O(s(),s()),queryParams:O(s(),s())});function Ee(e){return e==null}o(Ee,"isNil");var ir=lt(require("crypto"),1);var ka=128,Ae,Ue,za=o(e=>{!Ae||Ae.length<e?(Ae=Buffer.allocUnsafe(e*ka),ir.default.randomFillSync(Ae),Ue=0):Ue+e>Ae.length&&(ir.default.randomFillSync(Ae),Ue=0),Ue+=e},"fillPool"),Na=o(e=>(za(e|=0),Ae.subarray(Ue-e,Ue)),"random"),Oa=o((e,t,r)=>{let n=(2<<31-Math.clz32(e.length-1|1))-1,i=Math.ceil(1.6*n*t/e.length);return(d=t)=>{let m="";for(;;){let l=r(i),c=i;for(;c--;)if(m+=e[l[c]&n]||"",m.length===d)return m}}},"customRandom"),Yn=o((e,t=21)=>Oa(e,t,Na),"customAlphabet");var Da="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Jn=21,Fh=s().check(xe(new RegExp(`^[0-9a-zA-Z]{${Jn}}$`))),Ra=Yn(Da,Jn);var Se=Ie(Te(e=>e instanceof Date?e.toISOString():e),s()),se={id:s(),created:Se,updated:Se},q=o(e=>b(Je(e)),"Nullable");function ar(e){return b(Je(U(e)))}o(ar,"NullableEnum");var Hh=Ie(Te(e=>e==="true"||e===!0?!0:e==="false"||e===!1?!1:void 0),b(Z())),$t=o(e=>Ie(Te(t=>Array.isArray(t)?t:t!==void 0?[t]:void 0),b(R(e))),"OptionalArrayFromQuery");var qh=O(s(),N());var ct=(y=>(y.OPENAI="openai",y.OPENROUTER="openrouter",y.ANTHROPIC="anthropic",y.AZURE="azure",y.GOOGLE="google",y.ACTIVEPIECES="activepieces",y.CLOUDFLARE_GATEWAY="cloudflare-gateway",y.CUSTOM="custom",y.BEDROCK="bedrock",y.MISTRAL="mistral",y))(ct||{});var iv=s().check(xe(/^#[0-9A-Fa-f]{6}$/));var sv=g({filename:s(),data:N(),type:A("file"),mimetype:b(s())});var Ca=lt(Qn());var fv=g({...se,name:s(),permissions:R(s()),platformId:q(s()),type:s(),userCount:b(oe())});var eo=(n=>(n.AGENT_DECIDE="agent-decide",n.CHOOSE_YOURSELF="choose-yourself",n.LEAVE_EMPTY="leave-empty",n))(eo||{}),sr=(r=>(r.FILE="FILE",r.TABLE="TABLE",r))(sr||{}),cr=(n=>(n.SSE="sse",n.STREAMABLE_HTTP="streamable-http",n.SIMPLE_HTTP="http",n))(cr||{});var ur=(n=>(n.TEXT="text",n.NUMBER="number",n.BOOLEAN="boolean",n))(ur||{});var lr=(r=>(r.IN_PROGRESS="in-progress",r.COMPLETED="completed",r))(lr||{});var Ma=g({mode:U(eo),value:N()}),Ua=g({auth:b(s()),fields:O(s(),Ma)}),La=g({pieceName:s(),pieceVersion:s(),actionName:s(),predefinedInput:b(Ua)}),ja=g({type:A("PIECE"),toolName:s().check(ce(1)),pieceMetadata:La}),Fa=g({type:A("none")}),Ba=g({type:A("access_token"),accessToken:s()}),Za=g({type:A("api_key"),apiKey:s(),apiKeyHeader:s()}),Ha=g({type:A("headers"),headers:O(s(),s())}),Va=Re("type",[Fa,Ba,Za,Ha]),to=g({type:A("FLOW"),toolName:s().check(ce(1)),externalFlowId:s(),flowDisplayName:b(s())}),ro=g({type:A("MCP"),toolName:s().check(ce(1)),serverUrl:Un(),protocol:U(cr),auth:Va}),no=g({type:A("KNOWLEDGE_BASE"),toolName:s().check(ce(1)),sourceType:U(sr),sourceId:s(),sourceName:s()}),Wa=Re("type",[ja,to,ro,no]),qa=g({displayName:s(),description:b(s()),type:U(ur)}),oo=g({type:A("MARKDOWN"),markdown:s()}),Le={type:A("TOOL_CALL"),input:q(O(s(),N())),output:b(N()),toolName:s(),status:U(lr),toolCallId:s(),startTime:s(),endTime:b(s())},Fv=g(Le),io=Re("toolCallType",[g({...Le,toolCallType:A("PIECE"),pieceName:s(),pieceVersion:s(),actionName:s()}),g({...Le,toolCallType:A("FLOW"),displayName:s(),externalFlowId:s()}),g({...Le,toolCallType:A("MCP"),displayName:s(),serverUrl:s()}),g({...Le,toolCallType:A("KNOWLEDGE_BASE"),displayName:s(),sourceType:s()}),g({...Le,toolCallType:A("UNKNOWN"),displayName:s()})]),Ga=C([oo,io]);var dr=(r=>(r.IMAGE="image",r.TEXT="text",r))(dr||{}),_e=g({apiKey:s()}),Ka=_e,Ya=g({apiKey:s(),apiKeyHash:s()}),Ja=_e,Xa=_e,Qa=_e,es=_e,ts=_e,rs=_e,ns=_e,ao=g({accessKeyId:s().check(ce(1)),secretAccessKey:s().check(ce(1))}),os=g({}),is=g({}),as=g({}),ss=g({}),cs=g({}),us=g({}),so=g({modelId:s(),modelName:s(),modelType:U(dr)}),co=g({apiKeyHeader:s(),baseUrl:s(),models:R(so),defaultHeaders:b(O(s(),s()))}),uo=g({accountId:s(),gatewayId:s(),models:R(so),vertexProject:b(s()),vertexRegion:b(s())}),lo=g({resourceName:s(),apiVersion:Ie(Te(e=>typeof e=="string"&&e.trim().length===0?void 0:e),b(s()))}),po=g({region:s().check(ce(1))}),ls=C([Ka,Qa,es,ts,rs,Xa,Ja,Ya,ao,ns]),mo=C([co,uo,lo,po,os,as,ss,cs,is,us]),ds=g({id:s(),name:s(),type:U(dr)}),ps=g({id:s(),name:s(),provider:U(ct),config:mo,enabledForChat:Z()}),ms=g({provider:U(ct),config:mo,auth:ls,platformId:s()});var Vv={openai:"openai",anthropic:"anthropic","google-ai-studio":"google","google-vertex-ai":"google"};var fs=g({base64Url:s(),fileName:s(),extension:b(s())}),gs=g({mimeType:s(),url:s(),fileName:b(s())}),pr=C([fs,gs]);var ys=C([g({type:A("file"),value:pr}),g({type:A("markdown"),value:s(),files:b(R(pr))})]),hs=g({sessionId:s(),message:s(),files:b(R(s()))});var go=(r=>(r.ON_NEW_RECORD="ON_NEW_RECORD",r.ON_UPDATE_RECORD="ON_UPDATE_RECORD",r))(go||{}),yo=(r=>(r.ENABLED="ENABLED",r.DISABLED="DISABLED",r))(yo||{}),mr=(n=>(n.RECORD_CREATED="RECORD_CREATED",n.RECORD_UPDATED="RECORD_UPDATED",n.RECORD_DELETED="RECORD_DELETED",n))(mr||{});var vs=C([g({...se,name:s(),externalId:s(),type:A("STATIC_DROPDOWN"),tableId:s(),projectId:s(),data:g({options:R(g({value:s()}))})}),g({...se,name:s(),externalId:s(),type:C([A("TEXT"),A("NUMBER"),A("DATE")]),tableId:s(),projectId:s()})]),_s=g({...se,name:s(),folderId:q(s()),projectId:s(),externalId:s(),status:ar(yo),trigger:ar(go)}),Ps=g({...se,tableId:s(),projectId:s(),cells:O(s(),g({updated:s(),created:s(),value:N(),fieldName:s()}))}),bs=g({events:R(U(mr)),webhookUrl:s(),flowId:s()}),xs=g({fields:R(g({id:s(),name:s()})),rows:R(O(s(),s())),name:s()}),Ts=g({projectId:s(),limit:b(Xe.number()),cursor:b(s()),name:b(s()),externalIds:$t(s()),folderId:b(s()),folderIds:$t(s())}),Is=g({records:R(R(g({fieldId:s(),value:vo()}))),tableId:s()}),Es=g({cells:b(R(g({fieldId:s(),value:vo()}))),tableId:s(),agentUpdate:b(Z())}),ho=Re("operator",[we("eq"),we("neq"),we("gt"),we("gte"),we("lt"),we("lte"),we("co"),fo("exists"),fo("not_exists")]),Ss=g({tableId:s(),limit:b(Xe.number()),cursor:b(s()),filters:$t(ho)});function vo(){return Ie(Te(e=>e==null?e:String(e)),Je(s()))}o(vo,"coerceToString");function we(e){return g({fieldId:s(),operator:A(e),value:s()})}o(we,"valueFilter");function fo(e){return g({fieldId:s(),operator:A(e)})}o(fo,"existenceFilter");var $s=g({status:b(oe()),body:b(N()),headers:b(O(s(),s()))}),As=g({...se,deleted:q(Se),ownerId:s(),displayName:s(),platformId:s(),externalId:q(s())});var _o=g({name:s(),description:b(s()),type:s(),required:Z()}),ws=g({pieceName:s(),triggerName:s(),input:g({toolName:s(),toolDescription:s(),inputSchema:R(_o),returnsResponse:Z()})});var Po="^[0-9]+\\.[0-9]+\\.[0-9]+$",l_=new RegExp(Po),zs="^([~^])?[0-9]+\\.[0-9]+\\.[0-9]+$",d_=s().check(xe(new RegExp(Po))),p_=s().check(xe(new RegExp(zs))),Ns=g({packageType:A("ARCHIVE"),pieceType:U(Ce),pieceName:s(),pieceVersion:s(),archiveId:s(),platformId:s()}),bo=g({packageType:A("REGISTRY"),pieceType:A("OFFICIAL"),pieceName:s(),pieceVersion:s()}),xo=g({packageType:A("REGISTRY"),pieceType:A("CUSTOM"),pieceName:s(),pieceVersion:s(),platformId:s()}),m_=C([bo,xo]),f_=C([Ns,bo,xo]),To=(t=>(t.CRON_EXPRESSION="CRON_EXPRESSION",t))(To||{}),Os=g({type:U(To),cronExpression:s(),timezone:s()}),g_=g({...se,type:U(ne),projectId:s(),flowId:s(),triggerName:s(),schedule:q(Os),flowVersionId:s(),pieceName:s(),pieceVersion:s(),deleted:q(s()),simulate:Z()}),Io=(v=>(v.UNKNOWN="UNKNOWN",v.FLOW_RUN_LOG="FLOW_RUN_LOG",v.FLOW_RUN_LOG_SLICE="FLOW_RUN_LOG_SLICE",v.PACKAGE_ARCHIVE="PACKAGE_ARCHIVE",v.FLOW_STEP_FILE="FLOW_STEP_FILE",v.SAMPLE_DATA="SAMPLE_DATA",v.TRIGGER_PAYLOAD="TRIGGER_PAYLOAD",v.SAMPLE_DATA_INPUT="SAMPLE_DATA_INPUT",v.TRIGGER_EVENT_FILE="TRIGGER_EVENT_FILE",v.PROJECT_RELEASE="PROJECT_RELEASE",v.FLOW_VERSION_BACKUP="FLOW_VERSION_BACKUP",v.PLATFORM_ASSET="PLATFORM_ASSET",v.USER_PROFILE_PICTURE="USER_PROFILE_PICTURE",v.WEBHOOK_PAYLOAD="WEBHOOK_PAYLOAD",v.KNOWLEDGE_BASE="KNOWLEDGE_BASE",v.FLOW_BUNDLE="FLOW_BUNDLE",v))(Io||{}),Eo=(r=>(r.NONE="NONE",r.ZSTD="ZSTD",r))(Eo||{}),So=(r=>(r.S3="S3",r.DB="DB",r))(So||{}),y_=g({...se,projectId:q(s()),platformId:q(s()),type:U(Io),compression:U(Eo),data:b(N()),location:U(So),size:q(oe()),fileName:q(s()),s3Key:q(s()),metadata:q(O(s(),s()))}),$o=(n=>(n.ADMIN="ADMIN",n.MEMBER="MEMBER",n.OPERATOR="OPERATOR",n))($o||{}),Ao=(r=>(r.ACTIVE="ACTIVE",r.INACTIVE="INACTIVE",r))(Ao||{}),h_=g({id:s(),email:s(),firstName:s(),status:U(Ao),externalId:q(s()),platformId:q(s()),platformRole:U($o),lastName:s(),created:Se,updated:Se,lastActiveDate:q(Se),imageUrl:q(s())});var fr=g({...B.shape,...M(O(s(),N()),"OBJECT").shape});var No=g({...B.shape,...M(s(),"COLOR").shape});var gr=C([ie,ge,Et,he,ae,ye,rr,Qe,nr,ve,rt,fr,nt,tt,et,No]),p={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 le=g({displayName:s(),description:b(s())});var Oo=g({username:s(),password:s()}),yr=g({...le.shape,username:g({displayName:s(),description:b(s())}),password:g({displayName:s(),description:b(s())}),...M(Oo,"BASIC_AUTH").shape});var Ms=O(s(),C([ie,ge,ve,he,ae])),hr=g({...le.shape,props:Ms,...M(N(),"CUSTOM_AUTH").shape});var ke=g({...le.shape,...M(g({auth:s()}),"SECRET_TEXT").shape});var Us=O(s(),C([ie,ge,ke,ve,he,ae,ye,Et])),Do=g({...le.shape,props:Us,...M(N(),"OIDC").shape});var vr=(r=>(r.HEADER="HEADER",r.BODY="BODY",r))(vr||{}),Ro=C([ie,ke,ae]),Co=O(s(),Ro),Ls=g({props:b(O(s(),Ro)),authUrl:s(),tokenUrl:s(),scope:R(s()),prompt:b(C([A("none"),A("consent"),A("login"),A("omit")])),pkce:b(Z()),pkceMethod:b(C([A("plain"),A("S256")])),authorizationMethod:b(U(vr)),grantType:b(C([U(it),A(or)])),extra:b(O(s(),s()))}),Mo=g({access_token:s(),props:b(Co),data:O(s(),Ye())}),_r=g({...le.shape,...Ls.shape,...M(Mo,"OAUTH2").shape});var je=C([yr,hr,Do,_r,ke]),ut="Connection",Pr={SecretText(e){return{...e,valueSchema:void 0,type:"SECRET_TEXT"}},OAuth2(e){return{...e,valueSchema:void 0,type:"OAUTH2",displayName:e.displayName||ut}},BasicAuth(e){return{...e,valueSchema:void 0,type:"BASIC_AUTH",displayName:e.displayName||ut,required:!0}},CustomAuth(e){return{...e,valueSchema:void 0,type:"CUSTOM_AUTH",displayName:e.displayName||ut}},OIDC(e){return{...e,valueSchema:void 0,type:"OIDC",displayName:e.displayName||ut}},None(){}};var KP={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 js=g({...B.shape,...M(N(),"CUSTOM").shape,code:s()});var Bs=C([gr,je]),br=O(s(),Bs),gb=O(s(),gr);var Uo=C([g({strategy:A("CRON"),cronExpression:s()}),g({strategy:A("NONE")})]),Fe=class{constructor(t,r,n,i,d,m,l,c,a,y,P,h,u,f,_,v,x,E,L){this.name=t;this.displayName=r;this.description=n;this.requireAuth=i;this.props=d;this.type=m;this.handshakeConfiguration=l;this.onHandshake=c;this.renewConfiguration=a;this.onRenew=y;this.onEnable=P;this.onDisable=h;this.onStart=u;this.run=f;this.test=_;this.sampleData=v;this.testStrategy=x;this.outputSchema=E;this.aiMetadata=L}static{o(this,"ITrigger")}},te=o(e=>{switch(e.type){case"WEBHOOK":return new Fe(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 Fe(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 Fe(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 Fe(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,Ee(e.sampleData)&&Ee(e.test)?"SIMULATION":"TEST_FUNCTION",e.outputSchema,e.aiMetadata)}},"createTrigger");var Lo="2",wt="0.82.0";var xr=class{constructor(t,r,n,i,d,m,l,c,a=wt,y,P=""){this.displayName=t;this.logoUrl=r;this.authors=n;this.events=i;this.categories=l;this.auth=c;this.minimumSupportedRelease=a;this.maximumSupportedRelease=y;this.description=P;this._actions={};this._triggers={};this.getContextInfo=o(()=>({version:Lo}),"getContextInfo");(!Zs(a)||Hs(a,wt))&&(this.minimumSupportedRelease=wt),d.forEach(h=>this._actions[h.name]=h),m.forEach(h=>this._triggers[h.name]=h)}static{o(this,"Piece")}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth:this.auth,minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,contextInfo:this.getContextInfo?.()}}getAction(t){return this._actions[t]}getTrigger(t){return this._triggers[t]}actions(){return this._actions}triggers(){return this._triggers}},jo=o(e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((r,n,i)=>n===i.findIndex(d=>d.type===r.type)))throw new Error("Auth properties must be unique by type");return new xr(e.displayName,e.logoUrl,e.authors??[],e.events,e.actions,e.triggers,e.categories??[],e.auth,e.minimumSupportedRelease,e.maximumSupportedRelease,e.description)},"createPiece");function Zs(e){return/^\d+\.\d+\.\d+$/.test(e)}o(Zs,"isValidSimpleSemver");function Hs(e,t){let[r,n,i]=e.split(".").map(Number),[d,m,l]=t.split(".").map(Number);return r!==d?r<d:n!==m?n<m:i<l}o(Hs,"isSemverLessThan");var Vs=b(O(s(),O(s(),s()))),Fo=g({id:b(s()),name:s(),displayName:s(),logoUrl:s(),description:s(),authors:R(s()),platformId:b(s()),directoryPath:b(s()),auth:b(C([je,R(je)])),version:s(),categories:b(R(U(Me))),minimumSupportedRelease:b(s()),maximumSupportedRelease:b(s()),i18n:Vs}),Ws=U(["human","ai","both"]),Bo=g({description:b(s()),idempotent:b(Z())}),Zo=g({name:s(),displayName:s(),description:s(),props:br,requireAuth:Z(),errorHandlingOptions:b(tr),outputSchema:b(Tt()),audience:b(Ws),aiMetadata:b(Bo)}),Ho=g({name:s(),displayName:s(),description:s(),props:br,errorHandlingOptions:b(tr),type:U(ne),sampleData:N(),handshakeConfiguration:b(Tt()),renewConfiguration:b(Uo),testStrategy:U(st),outputSchema:b(Tt()),aiMetadata:b(Bo)}),qs=g({...Fo.shape,actions:O(s(),Zo),triggers:O(s(),Ho)}),Gs=g({...Fo.shape,actions:oe(),triggers:oe(),suggestedActions:b(R(Ho)),suggestedTriggers:b(R(Zo))}),Vo=g({projectUsage:oe(),tags:b(R(s())),pieceType:U(Ce),packageType:U(ot),platformId:b(s()),archiveId:b(s())}),gx=g({...qs.shape,...Vo.shape}),yx=g({...Gs.shape,...Vo.shape}),hx=g({name:s(),version:s()});var Ks=lt(require("path")),Ys=lt(require("fs/promises"));var kt=[{REGION:"US",ACCOUNTS_DOMAIN:"https://accounts.zoho.com",API_DOMAIN:"https://www.zohoapis.com",LABEL:"United States (.com)"},{REGION:"AU",ACCOUNTS_DOMAIN:"https://accounts.zoho.com.au",API_DOMAIN:"https://www.zohoapis.com.au",LABEL:"Australia (.com.au)"},{REGION:"EU",ACCOUNTS_DOMAIN:"https://accounts.zoho.eu",API_DOMAIN:"https://www.zohoapis.eu",LABEL:"Europe (.eu)"},{REGION:"IN",ACCOUNTS_DOMAIN:"https://accounts.zoho.in",API_DOMAIN:"https://www.zohoapis.in",LABEL:"India (.in)"},{REGION:"CN",ACCOUNTS_DOMAIN:"https://accounts.zoho.com.cn",API_DOMAIN:"https://www.zohoapis.com.cn",LABEL:"China (.com.cn)"},{REGION:"JP",ACCOUNTS_DOMAIN:"https://accounts.zoho.jp",API_DOMAIN:"https://www.zohoapis.jp",LABEL:"Japan (.jp)"},{REGION:"SA",ACCOUNTS_DOMAIN:"https://accounts.zoho.sa",API_DOMAIN:"https://www.zohoapis.sa",LABEL:"Saudi Arabia (.sa)"},{REGION:"CA",ACCOUNTS_DOMAIN:"https://accounts.zohocloud.ca",API_DOMAIN:"https://www.zohoapis.ca",LABEL:"Canada (.ca)"}],H="bigin_webhook_token",V={WEBHOOKS:"/actions/watch",USERS:"/users",COMPANIES:"/Accounts",PIPELINES:"/Pipelines",CONTACTS:"/Contacts",TASKS:"/Tasks",CALLS:"/Calls",EVENTS:"/Events",MODULES:"/settings/modules",LAYOUTS:"/settings/layouts",TAGS:"/settings/tags",PRODUCTS:"/Products",FIELDS:"/settings/fields"};var zt=class{constructor(t,r){this.baseUrl=t;this.authenticationConverter=r}static{o(this,"BaseHttpClient")}getUrl(t){let r=new URL(`${this.baseUrl}${t.url}`),n=`${r.origin}${r.pathname}`,i=new URLSearchParams;return r.searchParams.forEach((d,m)=>{i.append(m,d)}),{urlWithoutQueryParams:n,queryParams:i}}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 Nt=class{static{o(this,"DelegatingAuthenticationConverter")}constructor(t=new Tr,r=new Ir){this.converters={BEARER_TOKEN:t,BASIC:r}}convert(t,r){return this.converters[t.type].convert(t,r)}},Tr=class{static{o(this,"BearerTokenAuthenticationConverter")}convert(t,r){return r.Authorization=`Bearer ${t.token}`,r}},Ir=class{static{o(this,"BasicTokenAuthenticationConverter")}convert(t,r){let n=`${t.username}:${t.password}`,i=Buffer.from(n).toString("base64");return r.Authorization=`Basic ${i}`,r}};var Ot=class extends Error{constructor(r,n){let i=n.status||500,d=Buffer.isBuffer(n.responseBody)?n.responseBody.toString():n.responseBody;super(JSON.stringify({response:{status:i,body:d},request:{body:r}}));this.requestBody=r;this.status=i,this.responseBody=d}static{o(this,"HttpError")}errorMessage(){return{response:{status:this.status,body:this.responseBody},request:{body:this.requestBody}}}get response(){return{status:this.status,body:this.responseBody}}get request(){return{body:this.requestBody}}};var Dt=class extends zt{static{o(this,"FetchHttpClient")}constructor(t="",r=new Nt){super(t,r)}async sendRequest(t,r){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";let{urlWithoutQueryParams:n,queryParams:i}=this.getUrl(t),d=this.getHeaders(t),m=t.queryParams??{};for(let[L,re]of Object.entries(m))i.append(L,re);let l=i.toString(),c=l?`${n}?${l}`:n,a=t.responseType??"json",y=t.followRedirects??!0,P=t.retries??0,{body:h,extraHeaders:u,isStream:f}=Js(t.body,d),_=Qs({...d,...u}),v=await Xs(async()=>{let L=new AbortController,re=t.timeout&&t.timeout>0?setTimeout(()=>L.abort(),t.timeout):void 0;try{let ze={method:t.method.toString(),headers:_,body:h,redirect:y?"follow":"manual",signal:L.signal};return f&&(ze.duplex="half"),r?.dispatcher!==void 0&&(ze.dispatcher=r.dispatcher),await fetch(c,ze)}finally{re!==void 0&&clearTimeout(re)}},P),x=y?300:400;if(v.status<200||v.status>=x){let L=await Wo(v,a),re=new Ot(t.body,{status:v.status,responseBody:L});throw console.error("[HttpClient#(sanitized error message)] Request failed:",re),re}let E=await Wo(v,a);return{status:v.status,headers:ec(v.headers),body:E}}};function Js(e,t){return rc(e)?{body:void 0,extraHeaders:{},isStream:!1}:tc(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}}o(Js,"serializeBody");async function Wo(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}}}}o(Wo,"parseResponseBody");async function Xs(e,t){let r;for(let n=0;n<=t;n++)try{let i=await e();if(i.status>=500&&n<t){await qo(n);continue}return i}catch(i){if(r=i,n<t){await qo(n);continue}throw i}throw r}o(Xs,"sendWithRetries");function qo(e){let t=Math.min(1e3*2**e,3e4);return new Promise(r=>setTimeout(r,t))}o(qo,"backoff");function Qs(e){let t={};for(let[r,n]of Object.entries(e))n!==void 0&&(t[r]=Array.isArray(n)?n.join(", "):n);return t}o(Qs,"normalizeHeaders");function ec(e){let t={};return e.forEach((r,n)=>{t[n]=r}),t}o(ec,"toHttpHeaders");function tc(e){return typeof e=="object"&&e!==null&&typeof e.getHeaders=="function"&&typeof e.pipe=="function"}o(tc,"isNodeFormData");function rc(e){return e==null}o(rc,"isNil");var Go=new Dt;async function W({method:e,path:t,body:r,access_token:n}){return await Go.sendRequest({method:e,url:t,headers:{Accept:"application/json",Authorization:`Zoho-oauthtoken ${n}`,"Content-Type":"application/json"},body:r}).then(i=>i.body).catch(i=>{throw new Error(`Error in request to ${t}: ${i.message||JSON.stringify(i)}`)})}o(W,"fireHttpRequest");var T={createWebhook:o(async(e,t,r)=>await W({method:"POST",path:`${r}/bigin/v2${V.WEBHOOKS}`,body:t,access_token:e}),"createWebhook"),deleteWebhook:o(async(e,t,r)=>W({method:"DELETE",path:`${t}/bigin/v2${V.WEBHOOKS}?channel_ids=${r}`,access_token:e}),"deleteWebhook"),fetchUsers:o(async(e,t,r)=>{let n=new URLSearchParams;r?.type&&n.set("type",r.type),r?.page&&n.set("page",String(r.page)),r?.per_page&&n.set("per_page",String(r.per_page));let i=n.toString();return W({method:"GET",path:`${t}/bigin/v2${V.USERS}${i?`?${i}`:""}`,access_token:e})},"fetchUsers"),createCompany:o(async(e,t,r)=>W({method:"POST",path:`${t}/bigin/v2${V.COMPANIES}`,access_token:e,body:r}),"createCompany"),updateCompany:o(async(e,t,r)=>W({method:"PUT",path:`${t}/bigin/v2${V.COMPANIES}`,access_token:e,body:r}),"updateCompany"),fetchCompanies:o(async(e,t)=>W({method:"GET",path:`${t}/bigin/v2${V.COMPANIES}?fields=Owner,Account_Name,Phone,Website,Tag,Description,Billing_Street,Billing_State,Billing_Country,Billing_Code`,access_token:e}),"fetchCompanies"),createContact:o(async(e,t,r)=>W({method:"POST",path:`${t}/bigin/v2${V.CONTACTS}`,access_token:e,body:r}),"createContact"),updateContact:o(async(e,t,r)=>W({method:"PUT",path:`${t}/bigin/v2${V.CONTACTS}`,access_token:e,body:r}),"updateContact"),fetchTags:o(async(e,t,r)=>W({method:"GET",path:`${t}/bigin/v2${V.TAGS}?module=${r}`,access_token:e}),"fetchTags"),fetchContacts:o(async(e,t)=>W({method:"GET",path:`${t}/bigin/v2${V.CONTACTS}?fields=First_Name,Last_Name,Title,Email,Mobile,Email_Opt_Out,Owner,Account_Name,Tag,Description,Mailing_Street,Mailing_City,Mailing_State,Mailing_Country,Mailing_Zip`,access_token:e}),"fetchContacts"),fetchPipelinesRecords:o(async(e,t)=>W({method:"GET",path:`${t}/bigin/v2${V.PIPELINES}?fields=Deal_Name,Stage,Owner,Description,Contact_Name,Account_Name,Amount,Closing_Date,Sub_Pipeline,Tag`,access_token:e}),"fetchPipelinesRecords"),createPipelineRecord:o(async(e,t,r)=>W({method:"POST",path:`${t}/bigin/v2${V.PIPELINES}`,access_token:e,body:r}),"createPipelineRecord"),updatePipelineRecord:o(async(e,t,r)=>W({method:"PUT",path:`${t}/bigin/v2${V.PIPELINES}`,access_token:e,body:r}),"updatePipelineRecord"),fetchProducts:o(async(e,t)=>W({method:"GET",path:`${t}/bigin/v2${V.PRODUCTS}?fields=Product_Name,Owner,Product_Code,Product_Category,Unit_Price,Description,Tag,Product_Active`,access_token:e}),"fetchProducts"),fetchTasks:o(async(e,t)=>W({method:"GET",path:`${t}/bigin/v2${V.TASKS}?fields=Subject,Status,Owner,Due_Date,Description,Priority,Related_To,Tags,Remind_At,Recurring_Activity,$related_module`,access_token:e}),"fetchTasks"),createCall:o(async(e,t,r)=>W({method:"POST",path:`${t}/bigin/v2${V.CALLS}`,access_token:e,body:r}),"createCall"),createEvent:o(async(e,t,r)=>W({method:"POST",path:`${t}/bigin/v2${V.EVENTS}`,access_token:e,body:r}),"createEvent"),fetchEvents:o(async(e,t)=>W({method:"GET",path:`${t}/bigin/v2${V.EVENTS}?fields=Owner,Event_Title,Start_DateTime,End_DateTime,Description,Recurring_Activity,Participants,Related_To,Tag,Remind_At,$related_module,All_day,Venue`,access_token:e}),"fetchEvents"),updateEvent:o(async(e,t,r)=>W({method:"PUT",path:`${t}/bigin/v2${V.EVENTS}`,access_token:e,body:r}),"updateEvent"),createTask:o(async(e,t,r)=>W({method:"POST",path:`${t}/bigin/v2${V.TASKS}`,access_token:e,body:r}),"createTask"),updateTask:o(async(e,t,r)=>W({method:"PUT",path:`${t}/bigin/v2${V.TASKS}`,access_token:e,body:r}),"updateTask"),fetchModules:o(async(e,t)=>W({method:"GET",path:`${t}/bigin/v2${V.MODULES}`,access_token:e}),"fetchModules"),fetchLayouts:o(async(e,t,r)=>W({method:"GET",path:`${t}/bigin/v2${V.LAYOUTS}?module=${r}`,access_token:e}),"fetchLayouts"),fetchModuleFields:o(async(e,t,r)=>W({method:"GET",path:`${t}/bigin/v2${V.FIELDS}?module=${r}`,access_token:e}),"fetchModuleFields"),searchRecords:o(async(e,t,r,n)=>W({method:"GET",path:`${t}/bigin/v2/${r}/search?${encodeURIComponent(n.key)}=${encodeURIComponent(n.value)}`,access_token:e}),"searchRecords")};function j(e){return{disabled:!0,options:[],placeholder:e}}o(j,"handleDropdownError");function de(e){return e.First_Name||e.Last_Name?`${e.First_Name??""} ${e.Last_Name??""}`.trim():e?.Deal_Name||e?.Pipeline_Name||e?.Account_Name||e?.id}o(de,"getSafeLabel");function pe(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error("Invalid date provided");return t.toISOString().replace(/\.\d{3}Z$/,"+00:00")}o(pe,"formatDateTime");function me(e){let t=new Date(e),r=o(n=>n.toString().padStart(2,"0"),"pad");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}`}o(me,"formatDateOnly");function Rt(e){return e==="CN"?"https://accounts.zoho.com.cn":"https://accounts.zoho.com"}o(Rt,"getZohoBiginAccountAuthorizationUrl");var I=Pr.OAuth2({authUrl:"{domain}/oauth/v2/auth",tokenUrl:"{domain}/oauth/v2/token",required:!0,scope:["ZohoBigin.modules.ALL","ZohoBigin.settings.ALL","ZohoBigin.users.ALL","ZohoBigin.notifications.ALL","ZohoSearch.securesearch.READ"],props:{domain:p.StaticDropdown({displayName:"Your Data Center Region",description:"Select your Zoho data center region for your account",required:!0,options:{options:kt.map(e=>({label:e.LABEL,value:Rt(e.REGION)}))},defaultValue:Rt(kt[0].REGION)})},validate:o(async({auth:e})=>{let{domain:t}=e.props;if(!t)return{valid:!1,error:"Please select your data center region."};try{let n=kt.find(i=>i.ACCOUNTS_DOMAIN===t||Rt(i.REGION)===t)?.API_DOMAIN??"https://www.zohoapis.com";return await T.fetchModules(e.access_token,n),{valid:!0}}catch{return{valid:!1,error:"Could not validate OAuth credentials. please check your Client ID, Secret, and Region."}}},"validate")});var Er="bigin_created_contact_trigger",Ko=te({auth:I,name:"newContactCreated",displayName:"New Contact Created",description:"Triggers when a new contact is created",aiMetadata:{description:"Fires when a new contact (person) record is created in Bigin CRM, via a Contacts.create webhook. Represents a newly added person."},props:{},sampleData:{server_time:1754252081534,query_params:{},module:"Contacts",resource_uri:"https://www.zohoapis.com/bigin/v1/Contacts",ids:["6913232000000583260"],affected_fields:[],operation:"insert",channel_id:"1722705400"},type:"WEBHOOK",async onEnable(e){try{let t=Date.now().toString(),{api_domain:r}=e.auth.data,n={watch:[{channel_id:t,events:["Contacts.create"],notify_url:e.webhookUrl,token:H}]};await T.createWebhook(e.auth.access_token,n,r),await e.store.put(Er,t)}catch{console.error("Failed to enable Zoho webhook")}},async onDisable(e){let t=await e.store.get(Er);if(!t)return;let{api_domain:r}=e.auth.data;await T.deleteWebhook(e.auth.access_token,r,t),await e.store.delete(Er)},async run(e){let{token:t}=e.payload.body;if(t!==H)throw new Error("Invalid webhook token");return[e.payload.body]}});var Sr="bigin_company_updated_trigger",Yo=te({auth:I,name:"companyUpdated",displayName:"Company Updated",description:"Triggers when a company record is updated",aiMetadata:{description:"Fires when an existing company (account) record is edited in Bigin CRM, via an Accounts.edit webhook. Represents a change to an organization already in the CRM."},props:{},sampleData:{},type:"WEBHOOK",async onEnable(e){try{let t=Date.now().toString(),{api_domain:r}=e.auth.data,n={watch:[{channel_id:t,events:["Accounts.edit"],notify_url:e.webhookUrl,token:H}]};await T.createWebhook(e.auth.access_token,n,r),await e.store.put(Sr,t)}catch{console.error("Failed to enable Zoho webhook")}},async onDisable(e){let t=await e.store.get(Sr);if(!t)return;let{api_domain:r}=e.auth.data;await T.deleteWebhook(e.auth.access_token,r,t),await e.store.delete(Sr)},async run(e){let{token:t}=e.payload.body;if(t!==H)throw new Error("Invalid webhook token");return[e.payload.body]}});var $r="bigin_updated_contact_trigger",Jo=te({auth:I,name:"contactUpdated",displayName:"Contact Updated",description:"Triggers when a contact is updated",aiMetadata:{description:"Fires when an existing contact (person) record is edited in Bigin CRM, via a Contacts.edit webhook. Represents a change to a person already in the CRM."},props:{},sampleData:{},type:"WEBHOOK",async onEnable(e){try{let t=Date.now().toString(),{api_domain:r}=e.auth.data,n={watch:[{channel_id:t,events:["Contacts.edit"],notify_url:e.webhookUrl,token:H}]};await T.createWebhook(e.auth.access_token,n,r),await e.store.put($r,t)}catch{console.error("Failed to enable Zoho webhook")}},async onDisable(e){let t=await e.store.get($r);if(!t)return;let{api_domain:r}=e.auth.data;await T.deleteWebhook(e.auth.access_token,r,t),await e.store.delete($r)},async run(e){let{token:t}=e.payload.body;if(t!==H)throw new Error("Invalid webhook token");return[e.payload.body]}});var Ar="bigin_new_call_created_trigger",Xo=te({auth:I,name:"newCallCreated",displayName:"New Call Created",description:"Triggers when a new call log is created",aiMetadata:{description:"Fires when a new call log entry is created in Bigin CRM, via a Calls.create webhook. Represents a newly recorded phone interaction."},props:{},sampleData:{},type:"WEBHOOK",async onEnable(e){try{let t=Date.now().toString(),{api_domain:r}=e.auth.data,n={watch:[{channel_id:t,events:["Calls.create"],notify_url:e.webhookUrl,token:H}]};await T.createWebhook(e.auth.access_token,n,r),await e.store.put(Ar,t)}catch{console.error("Failed to enable Zoho webhook")}},async onDisable(e){let t=await e.store.get(Ar);if(!t)return;let{api_domain:r}=e.auth.data;await T.deleteWebhook(e.auth.access_token,r,t),await e.store.delete(Ar)},async run(e){let{token:t}=e.payload.body;if(t!==H)throw new Error("Invalid webhook token");return[e.payload.body]}});var wr="bigin_new_company_created_trigger",Qo=te({auth:I,name:"newCompanyCreated",displayName:"New Company Created",description:"Triggers when a new company record is created",aiMetadata:{description:"Fires when a new company (account) record is created in Bigin CRM, via an Accounts.create webhook. Represents a newly added organization."},props:{},sampleData:{},type:"WEBHOOK",async onEnable(e){try{let t=Date.now().toString(),{api_domain:r}=e.auth.data,n={watch:[{channel_id:t,events:["Accounts.create"],notify_url:e.webhookUrl,token:H}]};await T.createWebhook(e.auth.access_token,n,r),await e.store.put(wr,t)}catch{console.error("Failed to enable Zoho webhook")}},async onDisable(e){let t=await e.store.get(wr);if(!t)return;let{api_domain:r}=e.auth.data;await T.deleteWebhook(e.auth.access_token,r,t),await e.store.delete(wr)},async run(e){let{token:t}=e.payload.body;if(t!==H)throw new Error("Invalid webhook token");return[e.payload.body]}});var kr="bigin_new_task_created_trigger",ei=te({auth:I,name:"newTaskCreated",displayName:"New Task Created",description:"Triggers when a new task is created",aiMetadata:{description:"Fires when a new task is created in Bigin CRM, via a Tasks.create webhook. Represents a newly added piece of follow-up work."},props:{},sampleData:{},type:"WEBHOOK",async onEnable(e){try{let t=Date.now().toString(),{api_domain:r}=e.auth.data,n={watch:[{channel_id:t,events:["Tasks.create"],notify_url:e.webhookUrl,token:H}]};await T.createWebhook(e.auth.access_token,n,r),await e.store.put(kr,t)}catch{console.error("Failed to enable Zoho webhook")}},async onDisable(e){let t=await e.store.get(kr);if(!t)return;let{api_domain:r}=e.auth.data;await T.deleteWebhook(e.auth.access_token,r,t),await e.store.delete(kr)},async run(e){let{token:t}=e.payload.body;if(t!==H)throw new Error("Invalid webhook token");return[e.payload.body]}});var zr="bigin_new_event_created_trigger",ti=te({auth:I,name:"newEventCreated",displayName:"New Event Created",description:"Triggers when a new event is created",aiMetadata:{description:"Fires when a new calendar event is created in Bigin CRM, via an Events.create webhook. Represents a newly scheduled meeting or appointment."},props:{},sampleData:{},type:"WEBHOOK",async onEnable(e){try{let t=Date.now().toString(),{api_domain:r}=e.auth.data,n={watch:[{channel_id:t,events:["Events.create"],notify_url:e.webhookUrl,token:H}]};await T.createWebhook(e.auth.access_token,n,r),await e.store.put(zr,t)}catch{console.error("Failed to enable Zoho webhook")}},async onDisable(e){let t=await e.store.get(zr);if(!t)return;let{api_domain:r}=e.auth.data;await T.deleteWebhook(e.auth.access_token,r,t),await e.store.delete(zr)},async run(e){let{token:t}=e.payload.body;if(t!==H)throw new Error("Invalid webhook token");return[e.payload.body]}});var Nr="bigin_new_pipeline_record_created_trigger",ri=te({auth:I,name:"newPipelineRecordCreated",displayName:"New Pipeline Record Created",description:"Triggers when a new pipeline record is created",aiMetadata:{description:"Fires when a new pipeline record (deal) is created in Bigin CRM, via a Pipelines.create webhook. Represents a newly opened sales opportunity."},props:{},sampleData:{},type:"WEBHOOK",async onEnable(e){try{let t=Date.now().toString(),{api_domain:r}=e.auth.data,n={watch:[{channel_id:t,events:["Pipelines.create"],notify_url:e.webhookUrl,token:H}]};await T.createWebhook(e.auth.access_token,n,r),await e.store.put(Nr,t)}catch{console.error("Failed to enable Zoho webhook")}},async onDisable(e){let t=await e.store.get(Nr);if(!t)return;let{api_domain:r}=e.auth.data;await T.deleteWebhook(e.auth.access_token,r,t),await e.store.delete(Nr)},async run(e){let{token:t}=e.payload.body;if(t!==H)throw new Error("Invalid webhook token");return[e.payload.body]}});var Or="bigin_pipeline_record_updated_trigger",ni=te({auth:I,name:"pipelineRecordUpdated",displayName:"Pipeline Record Updated",description:"Triggers when a pipeline record is updated",aiMetadata:{description:"Fires when an existing pipeline record (deal) is edited in Bigin CRM, via a Pipelines.edit webhook. Represents a change to a deal already in the CRM, such as a stage or amount update."},props:{},sampleData:{},type:"WEBHOOK",async onEnable(e){try{let t=Date.now().toString(),{api_domain:r}=e.auth.data,n={watch:[{channel_id:t,events:["Pipelines.edit"],notify_url:e.webhookUrl,token:H}]};await T.createWebhook(e.auth.access_token,n,r),await e.store.put(Or,t)}catch{console.error("Failed to enable Zoho webhook")}},async onDisable(e){let t=await e.store.get(Or);if(!t)return;let{api_domain:r}=e.auth.data;await T.deleteWebhook(e.auth.access_token,r,t),await e.store.delete(Or)},async run(e){let{token:t}=e.payload.body;if(t!==H)throw new Error("Invalid webhook token");return[e.payload.body]}});var ee=p.Dropdown({auth:I,displayName:"Owner",description:"Select the owner to which the record will be assigned.",required:!1,refreshers:["auth"],options:o(async({auth:e})=>{if(!e)return j("Please connect your account first");let{api_domain:t}=e;try{let r=await T.fetchUsers(e.access_token,t),n=Array.isArray(r?.users)?r.users:[];return n.length===0?j("No users found"):{disabled:!1,options:n.map(d=>({label:(typeof d.full_name=="string"&&d.full_name.trim()!==""?d.full_name:[d.first_name,d.last_name].filter(l=>typeof l=="string"&&l.trim()!=="").join(" "))||d.email||d.id,value:d.id}))}}catch{return j("Failed to load users")}},"options")}),$e=p.Dropdown({auth:I,displayName:"Company",description:"The ID of the company to which the record will be associated. If not provided, the record will not be associated with any company.",required:!1,refreshers:["auth"],options:o(async({auth:e})=>e?{options:(await T.fetchCompanies(e.access_token,e.api_domain)).data.map(r=>({label:r.Account_Name,value:r.id}))}:j("Please Connect your account first"),"options")}),Be=p.Dropdown({auth:I,displayName:"Contacts",description:"The ID of the contact to which the record will be associated. If not provided, the record will not be associated with any contact.",required:!1,refreshers:["auth"],options:o(async({auth:e})=>e?{options:(await T.fetchContacts(e.access_token,e.api_domain)).data.map(r=>({label:r.First_Name+" "+r.Last_Name,value:r.id}))}:j("Please Connect your account first"),"options")}),Ct=p.MultiSelectDropdown({auth:I,displayName:"Secondary Contacts",description:"Provide a list of additional contacts associated with the record",required:!1,refreshers:["auth"],options:o(async({auth:e})=>e?{options:(await T.fetchContacts(e.access_token,e.api_domain)).data.map(r=>({label:r.First_Name+" "+r.Last_Name,value:r.id}))}:j("Please Connect your account first"),"options")}),oi=p.Dropdown({auth:I,displayName:"Pipeline Record",description:"Select a pipeline record",required:!1,refreshers:["auth"],options:o(async({auth:e})=>e?{options:(await T.fetchPipelinesRecords(e.access_token,e.api_domain)).data.map(r=>({label:r.Deal_Name,value:JSON.stringify(r)}))}:j("Please Connect your account first"),"options")}),Mt=o((e,t,r)=>p.Dropdown({auth:I,displayName:e,description:t,required:!1,refreshers:["auth"],options:o(async({auth:n})=>n?{options:(await T.fetchLayouts(n.access_token,n.api_domain,r)).layouts.map(d=>({label:d.name,value:JSON.stringify(d)}))}:j("Please Connect your account first"),"options")}),"layoutsDropdown"),Ut=p.MultiSelectDropdown({auth:I,displayName:"Associated Products",description:"Provide a list of products associated with the record",required:!1,refreshers:["auth"],options:o(async({auth:e})=>{if(!e)return j("Please Connect your account first");let t=await T.fetchProducts(e.access_token,e.api_domain);return!Array.isArray(t.data)||t.data.length===0?j("No products found. Please add products first."):{options:t.data.map(r=>({label:r.Product_Name,value:JSON.stringify(r)}))}},"options")}),J=o((e,t)=>p.MultiSelectDropdown({auth:I,displayName:"Tags",description:`Select tags to associate with this module, "${e}".`,required:!1,refreshers:["auth"],defaultValue:t||[],options:o(async({auth:r})=>{if(!r)return j("Please Connect your account first");try{let n=await T.fetchTags(r.access_token,r.api_domain,e),i=Array.isArray(n?.tags)?n.tags:[];return i.length===0?j("No tags found. Please add tags first."):{options:i.map(d=>({label:d.name,value:d.name}))}}catch{return j("Failed to load tags")}},"options")}),"tagsDropdown"),Ze=o((e,t,r,n)=>p.Dropdown({auth:I,displayName:e,description:t,required:!0,refreshers:["auth","pipeline"],defaultValue:n,options:o(async({auth:i,pipeline:d})=>{if(!i)return j("Please connect your account first");if(!d)return j("Please select a Pipeline first");let{access_token:m,api_domain:l}=i,a=(await T.fetchLayouts(m,l,"Pipelines"))?.layouts||[],y=JSON.parse(d);return{options:(a.find(f=>f.id===y.id).sections.find(f=>f.api_name==="Pipeline Information")?.fields.find(f=>f.field_label===r)).pick_list_values.map(f=>({label:f.display_value,value:f.actual_value}))}},"options")}),"SubPipelineorStageDropdown");var ii=F({auth:I,name:"createCompany",displayName:"Create Company",description:"Creates a Company Record",audience:"both",aiMetadata:{description:"Creates a new company (account) record in Bigin CRM with a name plus optional phone, website, billing address, owner, tags, and description. Use to add an organization the business deals with. Not idempotent: each call creates a new company even if one with the same name already exists, so search first if you need to avoid duplicates.",idempotent:!1},props:{accountName:p.ShortText({displayName:"Account Name",description:"Provide the name of the company",required:!0}),phone:p.ShortText({displayName:"Phone",description:"Provide a phone number for the company",required:!1}),website:p.ShortText({displayName:"Website",description:"Provide a website URL for the company",required:!1}),tag:J("Accounts"),description:p.LongText({displayName:"Description",description:"Provide additional descriptions or notes related to the company",required:!1}),owner:ee,billingStreet:p.ShortText({displayName:"Billing Street",description:"The street address of the company",required:!1}),billingCity:p.ShortText({displayName:"Billing City",description:"The city where the company is located",required:!1}),billingState:p.ShortText({displayName:"Billing State",description:"The state or province where the company is located",required:!1}),billingCountry:p.ShortText({displayName:"Billing Country",description:"The country of the company",required:!1}),billingCode:p.ShortText({displayName:"Billing Code",description:"The ZIP or postal code of the company",required:!1})},async run(e){try{let{accountName:t,owner:r,phone:n,website:i,tag:d,description:m,billingStreet:l,billingCity:c,billingState:a,billingCountry:y,billingCode:P}=e.propsValue,h={Account_Name:t,Phone:n,Website:i,Description:m,Billing_Street:l,Billing_City:c,Billing_State:a,Billing_Country:y,Billing_Code:P,Owner:r?{id:r}:void 0,Tag:Array.isArray(d)&&d.length>0?d.map(f=>({name:f})):void 0};return Object.keys(h).forEach(f=>{let _=h[f];(_==null||typeof _=="string"&&_.trim()===""||Array.isArray(_)&&_.length===0)&&delete h[f]}),{message:"Company created successfully",data:(await T.createCompany(e.auth.access_token,e.auth.api_domain,{data:[h]})).data[0]}}catch(t){throw console.error("Error creating company:",t),new Error(t instanceof Error?`Failed to create company: ${t.message}`:"Failed to create company due to an unknown error")}}});var ai=F({auth:I,name:"updateCompany",displayName:"Update Company",description:"Updates an existing Company and prepopulates its fields for editing.",audience:"both",aiMetadata:{description:"Updates an existing company (account) record in Bigin CRM, identified by selecting the company; its current fields are prepopulated and any you set are overwritten (owner, tags, billing address, and module-defined fields). Use to modify an organization that already exists. Idempotent: re-sending the same field values leaves the record in the same state.",idempotent:!0},props:{companyId:p.Dropdown({auth:I,displayName:"Select Company",description:"Choose a company to update",required:!0,refreshers:["auth"],options:o(async e=>e.auth?{options:(await T.fetchCompanies(e.auth.access_token,e.auth.data.api_domain)).data.map(r=>({label:r.Account_Name,value:JSON.stringify(r)}))}:j("Please connect your account first"),"options")}),owner:ee,companyDetails:p.DynamicProperties({auth:I,displayName:"Company Details",description:"These fields will be prepopulated with company data",refreshers:["companyId","auth"],required:!0,props:o(async({companyId:e,auth:t})=>{if(!e)return{};let r=JSON.parse(e),{access_token:n,data:i}=t,d=i.api_domain,[m,l]=await Promise.all([T.fetchModuleFields(n,d,"Accounts"),T.fetchUsers(n,d)]),c=(l.users||[]).map(P=>({label:`${P.first_name??""} ${P.last_name??""}`.trim(),value:P.id})),a={},y=m.fields||[];for(let P of y){let h=P.api_name;if(P.read_only||P.field_read_only||!P.view_type||P.view_type.edit!==!0||h==="Tag"||h==="id")continue;let u=r[h]??void 0;switch(h==="Owner"&&(u=r.Owner?.id),P.data_type?.toLowerCase()){case"picklist":{let f=(P.pick_list_values||[]).map(_=>({label:_.display_value,value:_.actual_value}));a[h]=p.StaticDropdown({displayName:P.display_label||P.field_label||h,description:P.tooltip||void 0,required:!1,defaultValue:u,options:{options:f}});break}case"multiselectpicklist":{let f=(P.pick_list_values||[]).map(_=>({label:_.display_value,value:_.actual_value}));a[h]=p.StaticMultiSelectDropdown({displayName:P.display_label||P.field_label||h,description:P.tooltip||void 0,required:!1,defaultValue:u,options:{options:f}});break}case"boolean":{a[h]=p.Checkbox({displayName:P.display_label||P.field_label||h,description:P.tooltip||void 0,required:!1,defaultValue:!!u});break}case"date":{a[h]=p.ShortText({displayName:P.display_label||P.field_label||h,description:P.tooltip||void 0,required:!1,defaultValue:u});break}case"datetime":{a[h]=p.DateTime({displayName:P.display_label||P.field_label||h,description:P.tooltip||void 0,required:!1,defaultValue:u});break}case"integer":case"long":case"double":case"decimal":case"currency":case"percent":{a[h]=p.Number({displayName:P.display_label||P.field_label||h,description:P.tooltip||void 0,required:!1,defaultValue:u});break}default:{if(h==="Owner"){a[h]=p.StaticDropdown({displayName:"Owner",description:P.tooltip||void 0,required:!1,defaultValue:u,options:{options:c}});break}if(h==="Description"){a[h]=p.LongText({displayName:"Description",description:P.tooltip||void 0,required:!1,defaultValue:u});break}a[h]=p.ShortText({displayName:P.display_label||P.field_label||h,description:P.tooltip||void 0,required:!1,defaultValue:typeof u=="string"?u:void 0})}}}return a},"props")}),tag:J("Accounts")},async run(e){try{let r=JSON.parse(e.propsValue.companyId).id,n=e.propsValue.companyDetails,i={id:r};for(let[m,l]of Object.entries(n||{}))l==null||typeof l=="string"&&l.trim()===""||(m==="Owner"?i.Owner={id:l}:m==="Tag"?i.Tag=l.map(c=>({name:c})):i[m]=l);return e.propsValue.owner&&(i.Owner={id:e.propsValue.owner}),e.propsValue.tag&&Array.isArray(e.propsValue.tag)&&e.propsValue.tag.length>0&&(i.Tag=e.propsValue.tag.map(m=>({name:m}))),{message:"Company updated successfully",data:(await T.updateCompany(e.auth.access_token,e.auth.api_domain,{data:[i]})).data[0]}}catch(t){throw console.error("Error updating company:",t),new Error(t)}}});var si=F({auth:I,name:"createContact",displayName:"Create Contact",description:"Creates a Contact Record",audience:"both",aiMetadata:{description:"Creates a new contact (person) record in Bigin CRM. Last name is required; optionally set email, mobile, title, owner, associated company, tags, mailing address, and description. Use to add a person to the CRM. Not idempotent: each call creates a new contact even with identical details, so search first to avoid duplicates.",idempotent:!1},props:{firstName:p.ShortText({displayName:"First Name",description:"First name of the contact",required:!1}),lastName:p.ShortText({displayName:"Last Name",description:"Last name of the contact",required:!0}),title:p.ShortText({displayName:"Title",description:"Job title of the contact",required:!1}),email:p.ShortText({displayName:"Email",description:"Email address of the contact",required:!1}),mobile:p.ShortText({displayName:"Mobile",description:"Mobile phone number",required:!1}),emailOptOut:p.Checkbox({displayName:"Email Opt Out",description:"Whether the contact has opted out of emails",required:!1,defaultValue:!1}),owner:ee,accountName:$e,tag:J("Contacts"),description:p.LongText({displayName:"Description",description:"Provide additional descriptions or notes related to the contact",required:!1}),mailingStreet:p.ShortText({displayName:"Mailing Street",description:"Street address for mailing",required:!1}),mailingCity:p.ShortText({displayName:"Mailing City",description:"City for mailing address",required:!1}),mailingState:p.ShortText({displayName:"Mailing State",description:"State for mailing address",required:!1}),mailingCountry:p.ShortText({displayName:"Mailing Country",description:"Country for mailing address",required:!1}),mailingZip:p.ShortText({displayName:"Mailing Zip",description:"ZIP/postal code",required:!1})},async run(e){try{let{firstName:t,lastName:r,title:n,email:i,mobile:d,emailOptOut:m,owner:l,accountName:c,tag:a,description:y,mailingStreet:P,mailingCity:h,mailingState:u,mailingCountry:f,mailingZip:_}=e.propsValue,v={First_Name:t,Last_Name:r,Title:n,Email:i,Mobile:d,Email_Opt_Out:m,Owner:l?{id:l}:void 0,Account_Name:c?{id:c}:void 0,Tag:a?.length?a.map(L=>({name:L})):void 0,Description:y,Mailing_Street:P,Mailing_City:h,Mailing_State:u,Mailing_Country:f,Mailing_Zip:_};Object.keys(v).forEach(L=>{let re=v[L];(re==null||typeof re=="string"&&re.trim()===""||Array.isArray(re)&&re.length===0)&&delete v[L]});let x={data:[v]};return{message:"Contact created successfully",data:(await T.createContact(e.auth.access_token,e.auth.data.api_domain,x)).data[0]}}catch(t){throw console.error("Error creating contact:",t),new Error(t instanceof Error?`Failed to create contact: ${t.message}`:"Failed to create contact due to an unknown error")}}});var ci=F({auth:I,name:"updateContact",displayName:"Update Contact",description:"Select and update an existing Contact record.",audience:"both",aiMetadata:{description:"Updates an existing contact (person) record in Bigin CRM, identified by selecting the contact; its current fields are prepopulated and any you set are overwritten (owner, associated company, tags, and module-defined fields). Use to modify a person who already exists. Idempotent: re-sending the same field values leaves the record in the same state.",idempotent:!0},props:{contactId:p.Dropdown({auth:I,displayName:"Select Contact",description:"Choose a contact to update",required:!0,refreshers:["auth"],options:o(async({auth:e})=>e?{options:(await T.fetchContacts(e.access_token,e.data.api_domain)).data.map(r=>({label:`${r.First_Name??""} ${r.Last_Name}`.trim(),value:JSON.stringify(r)}))}:j("Please connect first"),"options")}),contactDetails:p.DynamicProperties({auth:I,displayName:"Contact Fields",description:"Edit any of these fields",refreshers:["contactId","auth"],required:!0,props:o(async({contactId:e,auth:t})=>{if(!e)return{};let r=JSON.parse(e),{access_token:n,data:i}=t,d=i.api_domain,[m,l,c]=await Promise.all([T.fetchModuleFields(n,d,"Contacts"),T.fetchUsers(n,d),T.fetchCompanies(n,d)]),a=(l.users||[]).map(u=>({label:`${u.first_name??""} ${u.last_name??""}`.trim(),value:u.id})),y=(c.data||[]).map(u=>({label:u.Account_Name,value:u.id})),P={},h=m.fields||[];for(let u of h){let f=u.api_name;if(u.read_only||u.field_read_only||!u.view_type||u.view_type.edit!==!0||f==="Tag"||f==="id")continue;let _=r[f]??void 0;switch(f==="Owner"&&(_=r.Owner?.id),f==="Account_Name"&&(_=r.Account_Name?.id),u.data_type?.toLowerCase()){case"picklist":{let v=(u.pick_list_values||[]).map(x=>({label:x.display_value,value:x.actual_value}));P[f]=p.StaticDropdown({displayName:u.display_label||u.field_label||f,description:u.tooltip||void 0,required:!1,defaultValue:_,options:{options:v}});break}case"multiselectpicklist":{let v=(u.pick_list_values||[]).map(x=>({label:x.display_value,value:x.actual_value}));P[f]=p.StaticMultiSelectDropdown({displayName:u.display_label||u.field_label||f,description:u.tooltip||void 0,required:!1,defaultValue:_,options:{options:v}});break}case"boolean":{P[f]=p.Checkbox({displayName:u.display_label||u.field_label||f,description:u.tooltip||void 0,required:!1,defaultValue:!!_});break}case"date":{P[f]=p.ShortText({displayName:u.display_label||u.field_label||f,description:u.tooltip||void 0,required:!1,defaultValue:_});break}case"datetime":{P[f]=p.DateTime({displayName:u.display_label||u.field_label||f,description:u.tooltip||void 0,required:!1,defaultValue:_});break}case"integer":case"long":case"double":case"decimal":case"currency":case"percent":{P[f]=p.Number({displayName:u.display_label||u.field_label||f,description:u.tooltip||void 0,required:!1,defaultValue:_});break}default:{if(f==="Owner"){P[f]=p.StaticDropdown({displayName:"Owner",description:u.tooltip||void 0,required:!1,defaultValue:_,options:{options:a}});break}if(f==="Account_Name"){P[f]=p.StaticDropdown({displayName:"Company",description:u.tooltip||void 0,required:!1,defaultValue:_,options:{options:y}});break}if(f==="Description"){P[f]=p.LongText({displayName:"Description",description:u.tooltip||void 0,required:!1,defaultValue:_});break}P[f]=p.ShortText({displayName:u.display_label||u.field_label||f,description:u.tooltip||void 0,required:!1,defaultValue:typeof _=="string"?_:void 0})}}}return P},"props")}),accountName:$e,tag:J("Contacts")},async run(e){try{let{contactDetails:t,contactId:r,accountName:n,tag:i}=e.propsValue,d={id:JSON.parse(r).id};if(t&&typeof t=="object")for(let[c,a]of Object.entries(t))a==null||typeof a=="string"&&a.trim()===""||Array.isArray(a)&&a.length===0||(c==="Owner"||c==="Account_Name"?d[c]={id:a}:c==="Tag"?d.Tag=a.map(y=>({name:y})):d[c]=a);n&&(d.Account_Name={id:n}),i&&Array.isArray(i)&&i.length>0&&(d.Tag=i.map(c=>({name:c})));let m={data:[d]};return{message:"Contact updated successfully",data:(await T.updateContact(e.auth.access_token,e.auth.data.api_domain,m)).data[0]}}catch(t){throw console.error("Error updating contact:",t),new Error(t instanceof Error?`Failed to update contact: ${t.message}`:"Failed to update contact due to an unknown error")}}});var ui=F({auth:I,name:"createTask",displayName:"Create Task",description:"Creates a new Task",audience:"both",aiMetadata:{description:"Creates a new task in Bigin CRM with a subject plus optional due date, owner, priority, status, description, and tags. Supports optional recurrence (daily/weekly/monthly/yearly RRULE) and reminders, and can be linked to a related Contact, Pipeline, or Company record. Use to schedule follow-up work. Not idempotent: each call creates a new task.",idempotent:!1},props:{subject:p.ShortText({displayName:"Subject",description:"Provide the subject or title of the task",required:!0}),owner:ee,dueDate:p.DateTime({displayName:"Due Date",description:"Provide the due date of the task (YYYY-MM-DD format)",required:!1}),enableRecurring:p.Checkbox({displayName:"Make Task Recurring",description:"make this task recurring",required:!1}),recurringInfo:p.DynamicProperties({auth:I,displayName:"Recurring Info",description:"Please note: Due Date must be set above for recurring tasks",refreshers:["enableRecurring"],required:!1,props:o((e,t)=>e.enableRecurring?{freq:p.StaticDropdown({displayName:"Frequency",required:!0,options:{options:[{label:"Daily",value:"DAILY"},{label:"Weekly",value:"WEEKLY"},{label:"Monthly",value:"MONTHLY"},{label:"Yearly",value:"YEARLY"}]}}),interval:p.Number({displayName:"Interval",required:!0,description:"Indicates the time gap between each event. The INTERVAL value range from 1 to 99. For example, an INTERVAL of 2 for a WEEKLY recurring event means that there will be a two-week gap between each event.",defaultValue:1}),count:p.Number({displayName:"Count",required:!0,defaultValue:1,description:"Indicates the number of events you want to create. THE COUNT value range from 1 to 99. For example, a COUNT of 3 creates three individual events."}),byday:p.StaticDropdown({displayName:"By Day",required:!1,description:"Indicates the day of the week the event repeats. The possible values are SU, MO, TU, WE, TH, FR, or SA. This is applicable only for weekly, and monthly events.",options:{options:[{label:"Sunday",value:"SU"},{label:"Monday",value:"MO"},{label:"Tuesday",value:"TU"},{label:"Wednesday",value:"WE"},{label:"Thursday",value:"TH"},{label:"Friday",value:"FR"},{label:"Saturday",value:"SA"}]}}),bymonthday:p.Number({displayName:"By Month Day",required:!1,description:" Indicates the day of the month the event repeats. The BYMONTHDAY value range from 1 to 31. This is applicable only for weekly and monthly events."}),bysetpos:p.StaticDropdown({displayName:"By Set Position",required:!1,description:"Indicates the week of the month the event repeats. The possible values are 1 for the first week of the month, 2 for the second week of the month, 3 the for third week of the month, 4 for the fourth week of the month, or -1 for the last week of the month. This is applicable only for weekly and monthly events.",options:{options:[{label:"First Week of the Month",value:"1"},{label:"Second Week of the Month",value:"2"},{label:"Third Week of the Month",value:"3"},{label:"Fourth Week of the Month",value:"4"},{label:"Last Week of the Month",value:"-1"}]}}),until:p.ShortText({displayName:"Until (YYYY-MM-DD)",description:"Date the recurrence ends. Format: YYYY-MM-DD",required:!1})}:{},"props")}),enableReminder:p.Checkbox({displayName:"Enable Reminder",description:"Enable reminder for this task",required:!1}),reminderInfo:p.DynamicProperties({displayName:"Reminder Information",auth:I,refreshers:["enableReminder"],required:!1,props:o((e,t)=>e.enableReminder?{reminderAction:p.StaticDropdown({displayName:"Reminder Action",description:"How the reminder should be shown",required:!1,options:{options:[{label:"Email",value:"EMAIL"},{label:"Popup",value:"POPUP"},{label:"Email and Popup",value:"EMAILANDPOPUP"}]}}),reminderType:p.StaticDropdown({displayName:"Reminder Type",description:"When to trigger the reminder",required:!1,options:{options:[{label:"Specific Date & Time",value:"datetime"},{label:"Days Before",value:"days_before"},{label:"Weeks Before",value:"weeks_before"}]}}),reminderDateTime:p.DateTime({displayName:"Reminder Date & Time",description:"Specific date and time for reminder (for non-recurring tasks)",required:!1}),reminderDaysBefore:p.Number({displayName:"Days Before",description:"Number of days before the task to send reminder",required:!1,defaultValue:1}),reminderWeeksBefore:p.Number({displayName:"Weeks Before",description:"Number of weeks before the task to send reminder",required:!1,defaultValue:1}),reminderTime:p.ShortText({displayName:"Reminder Time",description:"Time for reminder in HH:MM format (24-hour, for recurring tasks)",required:!1})}:{},"props")}),relatedModule:p.StaticDropdown({displayName:"Related Module",description:"Select the type of entity the task is related to. Options: Contacts, Pipelines, Companies.",required:!1,defaultValue:"Contacts",options:{options:[{label:"Contacts",value:"Contacts"},{label:"Pipelines",value:"Pipelines"},{label:"Companies",value:"Companies"}]}}),relatedTo:p.Dropdown({auth:I,displayName:"Related To",description:"Select the specific record the task is related to.",required:!1,refreshers:["auth","relatedModule"],defaultValue:{},options:o(async({auth:e,relatedModule:t})=>{if(!e)return j("Please connect first");if(!t)return{options:[]};let{access_token:r,data:n}=e,i=n.api_domain,m={Contacts:o(()=>T.fetchContacts(r,i),"Contacts"),Pipelines:o(()=>T.fetchPipelinesRecords(r,i),"Pipelines"),Companies:o(()=>T.fetchCompanies(r,i),"Companies")}[t];return{options:((await m())?.data||[]).map(a=>({label:de(a),value:a.id}))}},"options")}),description:p.LongText({displayName:"Description",description:"Provide additional descriptions or notes related to the task",required:!1}),priority:p.StaticDropdown({displayName:"Priority",description:"Provide the priority level of the task",required:!1,options:{options:[{label:"High",value:"High"},{label:"Normal",value:"Normal"},{label:"Low",value:"Low"},{label:"Lowest",value:"Lowest"},{label:"Highest",value:"Highest"}]}}),status:p.StaticDropdown({displayName:"Status",description:"Provide the current status of the task.",required:!1,options:{options:[{label:"In Progress",value:"In Progress"},{label:"Completed",value:"Completed"},{label:"Deferred",value:"Deferred"},{label:"Waiting for input",value:"Waiting on someone else"},{label:"Not Started",value:"Not Started"}]}}),tag:J("Tasks")},async run({auth:e,propsValue:t}){let{access_token:r,data:n}=e,i=n.api_domain,d={Subject:t.subject};if(t.owner&&(d.Owner={id:t.owner}),t.dueDate&&(d.Due_Date=me(t.dueDate)),t.enableRecurring&&t.recurringInfo){let l=t.recurringInfo,c=[];if(!["DAILY","WEEKLY","MONTHLY","YEARLY"].includes(l.freq))throw new Error("Invalid recurrence frequency. Allowed values: DAILY, WEEKLY, MONTHLY, YEARLY");if(c.push(`FREQ=${l.freq}`),l.interval!==void 0){let y=Number(l.interval);if(Number.isNaN(y)||y<1||y>99)throw new Error("Interval must be a number between 1 and 99");c.push(`INTERVAL=${l.interval}`)}if(l.count!==void 0){let y=Number(l.count);if(Number.isNaN(y)||y<1||y>99)throw new Error("Count must be a number between 1 and 99");c.push(`COUNT=${l.count}`)}if(l.byday&&c.push(`BYDAY=${l.byday}`),l.bymonthday!==void 0){let y=Number(l.bymonthday);if(Number.isNaN(y)||y<1||y>31)throw new Error("BYMONTHDAY must be a number between 1 and 31");c.push(`BYMONTHDAY=${l.bymonthday}`)}if(l.bysetpos){if(!["1","2","3","4","-1"].includes(String(l.bysetpos)))throw new Error("BYSETPOS must be one of 1, 2, 3, 4, -1");c.push(`BYSETPOS=${l.bysetpos}`)}if(l.until){let y=me(l.until);c.push(`UNTIL=${y}`)}d.Recurring_Activity={RRULE:c.join(";")+";"}}if(t.enableReminder&&t.reminderInfo){let l=t.reminderInfo,a=`ACTION=${l.reminderAction||"EMAIL"}`,y=l.reminderTime||"09:00";if(t.recurringInfo&&l.reminderType==="days_before"){let P=l.reminderDaysBefore||1;a+=`;TRIGGER=P${P}D;TRIGGER_TIME=${y}`}else if(t.recurringInfo&&l.reminderType==="weeks_before"){let P=l.reminderWeeksBefore||1;a+=`;TRIGGER=P${P}W;TRIGGER_TIME=${y}`}else l.reminderDateTime&&(a+=`;TRIGGER=DATE-TIME:${pe(l.reminderDateTime)}`);d.Remind_At={ALARM:a}}if(t.relatedTo&&t.relatedModule){let c={Contacts:"Contacts",Pipelines:"Deals",Companies:"Accounts"}[t.relatedModule]||"Contacts";d.Related_To={id:t.relatedTo},d.$related_module=c}t.description&&(d.Description=t.description),t.priority&&(d.Priority=t.priority),t.status&&(d.Status=t.status),t.tag&&Array.isArray(t.tag)&&t.tag.length>0&&(d.Tag=t.tag.map(l=>({name:l})));let m={data:[d]};try{return(await T.createTask(r,i,m)).data[0]}catch(l){throw console.error("Error creating task:",l),new Error(l instanceof Error?`Failed to create task: ${l.message}`:"Failed to create task due to an unknown error")}}});var li=F({auth:I,name:"updateTask",displayName:"Update Task",description:"updates a Task",audience:"both",aiMetadata:{description:"Updates an existing task in Bigin CRM, identified by selecting the task; its current fields are prepopulated and any you set are overwritten (subject, owner, due date, priority, status, description, tags), with optional recurrence and reminder settings and a related Contact/Pipeline/Company link. Use to modify a task that already exists. Idempotent: re-sending the same field values leaves the record in the same state.",idempotent:!0},props:{taskId:p.Dropdown({displayName:"Select Task",description:"Choose a task to update",auth:I,required:!0,refreshers:["auth"],options:o(async e=>e.auth?{options:(await T.fetchTasks(e.auth.access_token,e.auth.data.api_domain)).data.map(r=>({label:r.Subject,value:JSON.stringify(r)}))}:j("Please connect your account first"),"options")}),owner:ee,taskDetails:p.DynamicProperties({auth:I,displayName:"Task Details",description:"These fields will be prepopulated with task data",refreshers:["taskId","auth"],required:!0,props:o(async({taskId:e,auth:t})=>{if(!e||!t)return{};let r=JSON.parse(e),{access_token:n,data:i}=t,d=i.api_domain,m=await T.fetchModuleFields(n,d,"Tasks"),l={};for(let c of m.fields||[]){let a=c.api_name;if(c.read_only||c.field_read_only||!c.view_type||c.view_type.edit!==!0||a==="Tag"||a==="id")continue;let y=r[a]??void 0;switch(c.data_type?.toLowerCase()){case"picklist":{let P=(c.pick_list_values||[]).map(h=>({label:h.display_value,value:h.actual_value}));l[a]=p.StaticDropdown({displayName:c.display_label||c.field_label||a,description:c.tooltip||void 0,required:!1,defaultValue:y,options:{options:P}});break}case"multiselectpicklist":{let P=(c.pick_list_values||[]).map(h=>({label:h.display_value,value:h.actual_value}));l[a]=p.StaticMultiSelectDropdown({displayName:c.display_label||c.field_label||a,description:c.tooltip||void 0,required:!1,defaultValue:y,options:{options:P}});break}case"boolean":{l[a]=p.Checkbox({displayName:c.display_label||c.field_label||a,description:c.tooltip||void 0,required:!1,defaultValue:!!y});break}case"date":{l[a]=p.ShortText({displayName:c.display_label||c.field_label||a,description:c.tooltip||"Format: YYYY-MM-DD",required:!1,defaultValue:y});break}case"datetime":{l[a]=p.DateTime({displayName:c.display_label||c.field_label||a,description:c.tooltip||"Format: ISO 8601 (YYYY-MM-DDTHH:mm:ss\xB1HH:mm)",required:!1,defaultValue:y});break}case"integer":case"long":case"double":case"decimal":case"currency":case"percent":{l[a]=p.Number({displayName:c.display_label||c.field_label||a,description:c.tooltip||void 0,required:!1,defaultValue:y});break}default:{if(a==="Description"){l[a]=p.LongText({displayName:"Description",required:!1,defaultValue:y});break}l[a]=p.ShortText({displayName:c.display_label||c.field_label||a,description:c.tooltip||void 0,required:!1,defaultValue:typeof y=="string"?y:void 0})}}}return l},"props")}),enableRecurring:p.Checkbox({displayName:"Make Task Recurring",description:"make this task recurring",required:!1}),recurringInfo:p.DynamicProperties({auth:I,displayName:"Recurring Info",description:"Please note: Due Date must be set above for recurring tasks",refreshers:["enableRecurring"],required:!1,props:o((e,t)=>e.enableRecurring?{freq:p.StaticDropdown({displayName:"Frequency",required:!0,options:{options:[{label:"Daily",value:"DAILY"},{label:"Weekly",value:"WEEKLY"},{label:"Monthly",value:"MONTHLY"}]}}),interval:p.Number({displayName:"Interval",required:!0,description:"Indicates the time gap between each event. The INTERVAL value range from 1 to 99. For example, an INTERVAL of 2 for a WEEKLY recurring event means that there will be a two-week gap between each event."}),count:p.Number({displayName:"Count",required:!0,description:"Indicates the number of events you want to create. THE COUNT value range from 1 to 99. For example, a COUNT of 3 creates three individual events."}),byday:p.StaticDropdown({displayName:"By Day",required:!1,description:"Indicates the day of the week the event repeats. The possible values are SU, MO, TU, WE, TH, FR, or SA. This is applicable only for weekly, and monthly events.",options:{options:[{label:"Sunday",value:"SU"},{label:"Monday",value:"MO"},{label:"Tuesday",value:"TU"},{label:"Wednesday",value:"WE"},{label:"Thursday",value:"TH"},{label:"Friday",value:"FR"},{label:"Saturday",value:"SA"}]}}),bymonthday:p.Number({displayName:"By Month Day",required:!1,description:" Indicates the day of the month the event repeats. The BYMONTHDAY value range from 1 to 31. This is applicable only for weekly and monthly events."}),bysetpos:p.StaticDropdown({displayName:"By Set Position",required:!1,description:"Indicates the week of the month the event repeats. The possible values are 1 for the first week of the month, 2 for the second week of the month, 3 the for third week of the month, 4 for the fourth week of the month, or -1 for the last week of the month. This is applicable only for weekly and monthly events.",options:{options:[{label:"First Week of the Month",value:"1"},{label:"Second Week of the Month",value:"2"},{label:"Third Week of the Month",value:"3"},{label:"Fourth Week of the Month",value:"4"},{label:"Last Week of the Month",value:"-1"}]}})}:{},"props")}),enableReminder:p.Checkbox({displayName:"Enable Reminder",description:"Enable reminder for this task",required:!1}),reminderInfo:p.DynamicProperties({auth:I,displayName:"Reminder Information",refreshers:["enableReminder"],required:!1,props:o((e,t)=>e.enableReminder?{reminderAction:p.StaticDropdown({displayName:"Reminder Action",description:"How the reminder should be shown",required:!1,options:{options:[{label:"Email",value:"EMAIL"},{label:"Popup",value:"POPUP"},{label:"Email and Popup",value:"EMAILANDPOPUP"}]}}),reminderType:p.StaticDropdown({displayName:"Reminder Type",description:"When to trigger the reminder",required:!1,options:{options:[{label:"Specific Date & Time",value:"datetime"},{label:"Days Before",value:"days_before"},{label:"Weeks Before",value:"weeks_before"}]}}),reminderDateTime:p.DateTime({displayName:"Reminder Date & Time",description:"Specific date and time for reminder (for non-recurring tasks)",required:!1}),reminderDaysBefore:p.Number({displayName:"Days Before",description:"Number of days before the task to send reminder",required:!1}),reminderWeeksBefore:p.Number({displayName:"Weeks Before",description:"Number of weeks before the task to send reminder",required:!1}),reminderTime:p.ShortText({displayName:"Reminder Time",description:"Time for reminder in HH:MM format (24-hour, for recurring tasks)",required:!1})}:{},"props")}),relatedModule:p.Dropdown({displayName:"Related Module",description:"Select the type of entity the task is related to. Options: Contacts, Pipelines, Companies.",required:!1,refreshers:["auth"],defaultValue:"Contacts",auth:I,options:o(async()=>({options:[{label:"Contacts",value:"Contacts"},{label:"Pipelines",value:"Pipelines"},{label:"Companies",value:"Companies"}]}),"options")}),relatedTo:p.Dropdown({auth:I,displayName:"Related To",description:"Select the specific record the task is related to.",required:!1,refreshers:["auth","relatedModule"],options:o(async({auth:e,relatedModule:t})=>{if(!e)return j("Please connect first");if(!t)return{options:[]};let{access_token:r,data:n}=e,i=n.api_domain,m={Contacts:o(()=>T.fetchContacts(r,i),"Contacts"),Pipelines:o(()=>T.fetchPipelinesRecords(r,i),"Pipelines"),Companies:o(()=>T.fetchCompanies(r,i),"Companies")}[t];return{options:((await m())?.data||[]).map(a=>({label:de(a),value:a.id}))}},"options")}),tag:J("Tasks")},async run({auth:e,propsValue:t}){let{access_token:r,data:n}=e,i=n.api_domain,d=JSON.parse(t.taskId).id,m=t.taskDetails,l={Subject:m.subject,id:d};if(m.owner&&(l.Owner={id:m.owner}),m.dueDate){let a=new Date(m.dueDate);l.Due_Date=a.toISOString().split("T")[0]}if(t.enableRecurring&&t.recurringInfo){if(!m.dueDate)throw new Error("Due Date is required when creating recurring tasks");let a=t.recurringInfo,y=[`FREQ=${a.freq}`],P=new Date(m.dueDate);y.push(`DTSTART=${P.toISOString().split("T")[0]}`),a.interval&&y.push(`INTERVAL=${a.interval}`),a.count&&y.push(`COUNT=${a.count}`),a.byday&&y.push(`BYDAY=${a.byday}`),a.bymonthday&&y.push(`BYMONTHDAY=${a.bymonthday}`),a.bysetpos&&y.push(`BYSETPOS=${a.bysetpos}`),a.until&&y.push(`UNTIL=${a.until}`),l.Recurring_Activity={RRULE:y.join(";")+";"}}if(t.enableReminder&&t.reminderInfo){let a=t.reminderInfo,P=`ACTION=${a.reminderAction||"EMAIL"}`,h=a.reminderTime||"09:00";if(t.recurringInfo&&a.reminderType==="days_before"){let u=a.reminderDaysBefore||1;P+=`;TRIGGER=-P${u}D;TRIGGER_TIME=${h}`}else if(t.recurringInfo&&a.reminderType==="weeks_before"){let u=a.reminderWeeksBefore||1;P+=`;TRIGGER=-P${u}W;TRIGGER_TIME=${h}`}else if(a.reminderDateTime){let u=new Date(a.reminderDateTime);P+=`;TRIGGER=DATE-TIME:${u.toISOString()}`}l.Remind_At={ALARM:P}}if(t.relatedTo&&t.relatedModule){let y={Contacts:"Contacts",Pipelines:"Deals",Companies:"Accounts"}[t.relatedModule]||"Contacts";l.Related_To={id:t.relatedTo},l.$related_module=y}m.description&&(l.Description=m.description),m.priority&&(l.Priority=m.priority),m.status&&(l.Status=m.status),m.tag&&Array.isArray(m.tag)&&m.tag.length>0&&(l.Tag=m.tag.map(a=>({name:a})));let c={data:[l]};try{return(await T.updateTask(r,i,c)).data[0]}catch(a){throw console.error("Error updating task:",a),new Error(a)}}});var di=F({auth:I,name:"createCall",displayName:"Create Call",description:"Creates a Call Log Entry Record",audience:"both",aiMetadata:{description:"Logs a call in Bigin CRM with a required start time, duration in minutes, and type (Outbound, Inbound, or Missed), plus optional subject, description, agenda, reminder, dialed number, owner, contact, and a related Pipeline or Company record. Use to record a phone interaction. Not idempotent: each call creates a new call log entry.",idempotent:!1},props:{callStartTime:p.DateTime({displayName:"Call Start Time",description:"Provide the start time of the call in ISO8601 format.",required:!0}),callDuration:p.Number({displayName:"Call Duration (minutes)",description:"Provide the duration of the call in minutes (numeric). For example, 30 for a 30-minute call.",required:!0}),callType:p.StaticDropdown({displayName:"Call Type",description:"Type of call",required:!0,options:{options:[{label:"Outbound",value:"Outbound"},{label:"Inbound",value:"Inbound"},{label:"Missed",value:"Missed"}]}}),owner:ee,contactName:Be,subject:p.ShortText({displayName:"Subject",description:"Subject of the call",required:!1}),description:p.LongText({displayName:"Description",description:"Description or notes about the call",required:!1}),callAgenda:p.LongText({displayName:"Call Agenda",description:"Agenda or purpose of the call",required:!1}),reminder:p.DateTime({displayName:"Reminder",description:"Reminder date and time for the call",required:!1}),dialledNumber:p.ShortText({displayName:"Dialed Number",description:"Provide the number dialed for the call.",required:!1}),relatedModule:p.StaticDropdown({displayName:"Related Module",description:"Select the type of entity the call is related to.",required:!1,defaultValue:"Pipelines",options:{options:[{label:"Pipelines",value:"Pipelines"},{label:"Companies",value:"Companies"}]}}),relatedTo:p.Dropdown({auth:I,displayName:"Related To",description:"Select the specific record the call is related to.",required:!1,refreshers:["auth","relatedModule"],defaultValue:{},options:o(async({auth:e,relatedModule:t})=>{if(!e)return j("Please connect first");if(!t)return{options:[]};let{access_token:r,data:n}=e,i=n.api_domain,m={Pipelines:o(()=>T.fetchPipelinesRecords(r,i),"Pipelines"),Companies:o(()=>T.fetchCompanies(r,i),"Companies")}[t];return{options:((await m())?.data||[]).map(a=>({label:de(a),value:a.id}))}},"options")}),tag:J("Calls")},async run({auth:e,propsValue:t}){try{let{access_token:r,data:n}=e,i=n.api_domain,d={Call_Start_Time:pe(t.callStartTime),Call_Duration:Number(t.callDuration),Call_Type:t.callType};if(t.subject&&(d.Subject=t.subject),t.description&&(d.Description=t.description),t.callAgenda&&(d.Call_Agenda=t.callAgenda),t.reminder&&(d.Reminder=pe(t.reminder)),t.dialledNumber&&(d.Dialled_Number=t.dialledNumber),t.owner&&(d.Owner={id:t.owner}),t.contactName&&(d.Contact_Name={id:t.contactName}),t.relatedTo&&t.relatedModule){let l={Pipelines:"Deals",Companies:"Accounts"};d.$related_module=l[t.relatedModule]||"Deals",d.Related_To={id:t.relatedTo}}return t.tag&&(d.Tag=t.tag.map(l=>({name:l}))),{message:"Call log Entry created successfully",data:(await T.createCall(r,i,{data:[d]})).data[0]}}catch(r){throw console.error("Error creating call log entry:",r),new Error(r instanceof Error?`Failed to create call log entry: ${r.message}`:"Failed to create call log entry due to an unknown error")}}});var pi=F({auth:I,name:"createEvent",displayName:"Create Event",description:"Creates a new event in Bigin",audience:"both",aiMetadata:{description:"Creates a calendar event in Bigin CRM with a title, start and end date/time (end must be after start), plus optional all-day flag, venue, participants, description, and tags. Supports optional recurrence (daily/weekly/monthly/yearly RRULE) and reminders, and can be linked to a related Contact, Pipeline, or Company record. Use to schedule a meeting or appointment. Not idempotent: each call creates a new event.",idempotent:!1},props:{eventTitle:p.ShortText({displayName:"Event Title",description:"Provide the title or name of the event",required:!0}),owner:ee,startDateTime:p.DateTime({displayName:"Start Date & Time",description:"Start date and time of the event",required:!0}),endDateTime:p.DateTime({displayName:"End Date & Time",description:"End date and time of the event",required:!0}),allDay:p.Checkbox({displayName:"All Day Event",description:"Mark this as an all-day event",required:!1}),enableRecurring:p.Checkbox({displayName:"Make Event Recurring",description:"Make this event recurring",required:!1}),recurringInfo:p.DynamicProperties({auth:I,displayName:"Recurring Info",refreshers:["enableRecurring"],required:!1,props:o((e,t)=>e.enableRecurring?{freq:p.StaticDropdown({displayName:"Frequency",required:!0,options:{options:[{label:"Daily",value:"DAILY"},{label:"Weekly",value:"WEEKLY"},{label:"Monthly",value:"MONTHLY"},{label:"Yearly",value:"YEARLY"}]}}),interval:p.Number({displayName:"Interval",required:!0,description:"Indicates the time gap between each event. The INTERVAL value range from 1 to 99. For example, an INTERVAL of 2 for a WEEKLY recurring event means that there will be a two-week gap between each event.",defaultValue:1}),count:p.Number({displayName:"Count",required:!0,defaultValue:1,description:"Indicates the number of events you want to create. THE COUNT value range from 1 to 99. For example, a COUNT of 3 creates three individual events."}),byday:p.StaticDropdown({displayName:"By Day",required:!1,description:"Indicates the day of the week the event repeats. The possible values are SU, MO, TU, WE, TH, FR, or SA. This is applicable only for weekly, and monthly events.",options:{options:[{label:"Sunday",value:"SU"},{label:"Monday",value:"MO"},{label:"Tuesday",value:"TU"},{label:"Wednesday",value:"WE"},{label:"Thursday",value:"TH"},{label:"Friday",value:"FR"},{label:"Saturday",value:"SA"}]}}),bymonthday:p.Number({displayName:"By Month Day",required:!1,description:" Indicates the day of the month the event repeats. The BYMONTHDAY value range from 1 to 31. This is applicable only for weekly and monthly events."}),bysetpos:p.StaticDropdown({displayName:"By Set Position",required:!1,description:"Indicates the week of the month the event repeats. The possible values are 1 for the first week of the month, 2 for the second week of the month, 3 the for third week of the month, 4 for the fourth week of the month, or -1 for the last week of the month. This is applicable only for weekly and monthly events.",options:{options:[{label:"First Week of the Month",value:"1"},{label:"Second Week of the Month",value:"2"},{label:"Third Week of the Month",value:"3"},{label:"Fourth Week of the Month",value:"4"},{label:"Last Week of the Month",value:"-1"}]}}),until:p.ShortText({displayName:"Until (YYYY-MM-DD)",description:"Date the recurrence ends. Format: YYYY-MM-DD",required:!1})}:{},"props")}),enableReminder:p.Checkbox({displayName:"Enable Reminder",description:"Enable reminder for this event",required:!1}),reminderInfo:p.DynamicProperties({auth:I,displayName:"Reminder Information",refreshers:["enableReminder"],required:!1,props:o((e,t)=>e.enableReminder?{reminderList:p.Array({displayName:"Reminder List",description:'Add multiple reminders (e.g., "1 hour", "30 minutes")',required:!1,properties:{unit:p.Number({displayName:"Time Value",description:"Number of time units (e.g., 1, 30)",required:!0}),period:p.StaticDropdown({displayName:"Time Period",required:!0,options:{options:[{label:"Days",value:"days"},{label:"Weeks",value:"weeks"}]}})}})}:{},"props")}),venue:p.ShortText({displayName:"Venue",description:"Location or venue of the event",required:!1}),relatedModule:p.StaticDropdown({displayName:"Related Module",description:"Select the type of entity the event is related to",required:!1,defaultValue:"Contacts",options:{options:[{label:"Contacts",value:"Contacts"},{label:"Pipelines",value:"Pipelines"},{label:"Companies",value:"Companies"}]}}),relatedTo:p.Dropdown({auth:I,displayName:"Related To",description:"Select the specific record the event is related to",required:!1,refreshers:["auth","relatedModule"],defaultValue:{},options:o(async({auth:e,relatedModule:t})=>{if(!e)return j("Please connect your account first");if(!t)return{options:[]};let{access_token:r,data:n}=e,i=n.api_domain,m={Contacts:o(()=>T.fetchContacts(r,i),"Contacts"),Pipelines:o(()=>T.fetchPipelinesRecords(r,i),"Pipelines"),Companies:o(()=>T.fetchCompanies(r,i),"Companies")}[t||"Contacts"];return{options:((await m())?.data||[]).map(a=>({label:de(a),value:a.id}))}},"options")}),participants:p.Array({displayName:"Participants",description:"Add participants to the event",required:!1,properties:{type:p.StaticDropdown({displayName:"Participant Type",required:!0,options:{options:[{label:"User",value:"user"},{label:"Email",value:"email"},{label:"Contact",value:"contact"}]}}),participant:p.ShortText({displayName:"Participant ID/Email",description:"User ID, email address, or contact ID based on type",required:!0})}}),description:p.LongText({displayName:"Description",description:"Additional descriptions or notes related to the event",required:!1}),tag:J("Events")},async run({auth:e,propsValue:t}){let{access_token:r,data:n}=e,i=n.api_domain,d=new Date(t.startDateTime);if(new Date(t.endDateTime)<=d)throw new Error("End date/time must be after start date/time");let l={Event_Title:t.eventTitle,Start_DateTime:pe(t.startDateTime),End_DateTime:pe(t.endDateTime)};if(t.owner&&(l.Owner={id:t.owner}),t.allDay&&(l.All_day=t.allDay),t.enableRecurring&&t.recurringInfo){let a=t.recurringInfo,y=[];if(!["DAILY","WEEKLY","MONTHLY","YEARLY"].includes(a.freq))throw new Error("Invalid recurrence frequency. Allowed values: DAILY, WEEKLY, MONTHLY, YEARLY");if(y.push(`FREQ=${a.freq}`),a.interval!==void 0){let h=Number(a.interval);if(Number.isNaN(h)||h<1||h>99)throw new Error("Interval must be a number between 1 and 99");y.push(`INTERVAL=${a.interval}`)}if(a.count!==void 0){let h=Number(a.count);if(Number.isNaN(h)||h<1||h>99)throw new Error("Count must be a number between 1 and 99");y.push(`COUNT=${a.count}`)}if(a.byday&&y.push(`BYDAY=${a.byday}`),a.bymonthday!==void 0){let h=Number(a.bymonthday);if(Number.isNaN(h)||h<1||h>31)throw new Error("BYMONTHDAY must be a number between 1 and 31");y.push(`BYMONTHDAY=${a.bymonthday}`)}if(a.bysetpos){if(!["1","2","3","4","-1"].includes(String(a.bysetpos)))throw new Error("BYSETPOS must be one of 1, 2, 3, 4, -1");y.push(`BYSETPOS=${a.bysetpos}`)}if(a.until){let h=me(a.until);y.push(`UNTIL=${h}`)}l.Recurring_Activity={RRULE:y.join(";")+";"}}if(t.enableReminder&&t.reminderInfo){let a=t.reminderInfo.reminderList;l.Remind_At=a.map(y=>({unit:y.unit,period:y.period}))}if(t.venue&&(l.Venue=t.venue),t.relatedTo&&t.relatedModule){let y={Contacts:"Contacts",Pipelines:"Deals",Companies:"Accounts"}[t.relatedModule];l.Related_To={id:t.relatedTo},l.$related_module=y}t.participants&&Array.isArray(t.participants)&&(l.Participants=t.participants.map(a=>({type:a.type,participant:a.participant}))),t.description&&(l.Description=t.description),t.tag&&Array.isArray(t.tag)&&t.tag.length>0&&(l.Tag=t.tag.map(a=>({name:a})));let c={data:[l]};try{return(await T.createEvent(r,i,c)).data[0]}catch(a){throw console.error("Error creating event:",a),new Error(a instanceof Error?`Failed to create event: ${a.message}`:"Failed to create event due to an unknown error")}}});var mi=F({auth:I,name:"updateEvent",displayName:"Update Event",description:"Updates an existing event in Bigin",audience:"both",aiMetadata:{description:"Updates an existing calendar event in Bigin CRM, identified by selecting the event; its current fields are prepopulated and any you set are overwritten (title, start/end time, all-day, venue, participants, owner, tags), with optional recurrence and reminder settings. Use to modify an event that already exists. Idempotent: re-sending the same field values leaves the record in the same state.",idempotent:!0},props:{eventId:p.Dropdown({auth:I,displayName:"Select Event",description:"Choose the event to update",required:!0,refreshers:["auth"],options:o(async({auth:e})=>{if(!e)return j("Please connect your account first");let{access_token:t,data:r}=e,n=r.api_domain;try{return{options:((await T.fetchEvents(t,n))?.data||[]).map(m=>({label:`${m.Event_Title} - ${m.Start_DateTime}`,value:JSON.stringify(m)}))}}catch{return j("Failed to fetch events")}},"options")}),eventFields:p.DynamicProperties({auth:I,displayName:"Event Fields",refreshers:["auth","eventId"],required:!1,props:o(async({eventId:e,auth:t})=>{if(!e)return{};let r=JSON.parse(e),{access_token:n,data:i}=t,d=i.api_domain,m=await T.fetchModuleFields(n,d,"Events"),l={};for(let c of m.fields||[]){let a=c.api_name;if(c.read_only||c.field_read_only||!c.view_type||c.view_type.edit!==!0||a==="Tag"||a==="id"||a==="Owner"||a==="Related_To"||a==="$related_module"||a==="Recurring_Activity"||a==="Remind_At"||a==="Participants")continue;let y=r[a]??void 0;switch(c.data_type?.toLowerCase()){case"picklist":{let P=(c.pick_list_values||[]).map(h=>({label:h.display_value,value:h.actual_value}));l[a]=p.StaticDropdown({displayName:c.display_label||c.field_label||a,description:c.tooltip||void 0,required:!1,defaultValue:y,options:{options:P}});break}case"multiselectpicklist":{let P=(c.pick_list_values||[]).map(h=>({label:h.display_value,value:h.actual_value}));l[a]=p.StaticMultiSelectDropdown({displayName:c.display_label||c.field_label||a,description:c.tooltip||void 0,required:!1,defaultValue:y,options:{options:P}});break}case"boolean":{l[a]=p.Checkbox({displayName:c.display_label||c.field_label||a,description:c.tooltip||void 0,required:!1,defaultValue:!!y});break}case"date":{l[a]=p.ShortText({displayName:c.display_label||c.field_label||a,description:c.tooltip||"Format: YYYY-MM-DD",required:!1,defaultValue:y});break}case"datetime":{l[a]=p.DateTime({displayName:c.display_label||c.field_label||a,description:c.tooltip||"Format: ISO 8601 (YYYY-MM-DDTHH:mm:ss\xB1HH:mm)",required:!1,defaultValue:y});break}case"integer":case"long":case"double":case"decimal":case"currency":case"percent":{l[a]=p.Number({displayName:c.display_label||c.field_label||a,description:c.tooltip||void 0,required:!1,defaultValue:y});break}default:{if(a==="Description"){l[a]=p.LongText({displayName:"Description",required:!1,defaultValue:y});break}l[a]=p.ShortText({displayName:c.display_label||c.field_label||a,description:c.tooltip||void 0,required:!1,defaultValue:typeof y=="string"?y:void 0})}}}return l.Participants=p.Array({displayName:"Participants",description:"Add participants to the event",required:!1,defaultValue:r.Participants||[],properties:{type:p.StaticDropdown({displayName:"Participant Type",required:!0,options:{options:[{label:"User",value:"user"},{label:"Email",value:"email"},{label:"Contact",value:"contact"}]}}),participant:p.ShortText({displayName:"Participant ID/Email",description:"User ID, email address, or contact ID based on type",required:!0})}}),l},"props")}),enableRecurring:p.Checkbox({displayName:"Make Event Recurring",description:"Make this event recurring",required:!1}),recurringInfo:p.DynamicProperties({displayName:"Recurring Info",refreshers:["enableRecurring"],required:!1,auth:I,props:o((e,t)=>e.enableRecurring?{freq:p.StaticDropdown({displayName:"Frequency",required:!0,options:{options:[{label:"Daily",value:"DAILY"},{label:"Weekly",value:"WEEKLY"},{label:"Monthly",value:"MONTHLY"}]}}),interval:p.Number({displayName:"Interval",required:!0,description:"Indicates the time gap between each event. The INTERVAL value range from 1 to 99. For example, an INTERVAL of 2 for a WEEKLY recurring event means that there will be a two-week gap between each event.",defaultValue:1}),count:p.Number({displayName:"Count",required:!0,defaultValue:1,description:"Indicates the number of events you want to create. THE COUNT value range from 1 to 99. For example, a COUNT of 3 creates three individual events."}),byday:p.StaticDropdown({displayName:"By Day",required:!1,description:"Indicates the day of the week the event repeats. The possible values are SU, MO, TU, WE, TH, FR, or SA. This is applicable only for weekly, and monthly events.",options:{options:[{label:"Sunday",value:"SU"},{label:"Monday",value:"MO"},{label:"Tuesday",value:"TU"},{label:"Wednesday",value:"WE"},{label:"Thursday",value:"TH"},{label:"Friday",value:"FR"},{label:"Saturday",value:"SA"}]}}),bymonthday:p.Number({displayName:"By Month Day",required:!1,description:" Indicates the day of the month the event repeats. The BYMONTHDAY value range from 1 to 31. This is applicable only for weekly and monthly events."}),bysetpos:p.StaticDropdown({displayName:"By Set Position",required:!1,description:"Indicates the week of the month the event repeats. The possible values are 1 for the first week of the month, 2 for the second week of the month, 3 the for third week of the month, 4 for the fourth week of the month, or -1 for the last week of the month. This is applicable only for weekly and monthly events.",options:{options:[{label:"First Week of the Month",value:"1"},{label:"Second Week of the Month",value:"2"},{label:"Third Week of the Month",value:"3"},{label:"Fourth Week of the Month",value:"4"},{label:"Last Week of the Month",value:"-1"}]}})}:{},"props")}),enableReminder:p.Checkbox({displayName:"Enable Reminder",description:"Enable reminder for this event",required:!1}),reminderInfo:p.DynamicProperties({auth:I,displayName:"Reminder Information",refreshers:["enableReminder"],required:!1,props:o((e,t)=>e.enableReminder?{reminderList:p.Array({displayName:"Reminder List",description:'Add multiple reminders (e.g., "1 hour", "30 minutes")',required:!1,properties:{unit:p.Number({displayName:"Time Value",description:"Number of time units (e.g., 1, 30)",required:!0}),period:p.StaticDropdown({displayName:"Time Period",required:!0,options:{options:[{label:"Days",value:"days"},{label:"Weeks",value:"weeks"}]}})}})}:{},"props")}),owner:ee,relatedModule:p.Dropdown({auth:I,displayName:"Related Module",description:"Select the type of entity the event is related to",required:!1,refreshers:["auth"],options:o(async()=>({options:[{label:"Contacts",value:"Contacts"},{label:"Pipelines",value:"Pipelines"},{label:"Companies",value:"Companies"}]}),"options")}),relatedTo:p.Dropdown({auth:I,displayName:"Related To",description:"Select the specific record the event is related to",required:!1,refreshers:["auth","relatedModule"],options:o(async({auth:e,relatedModule:t})=>{if(!e)return j("Please connect your account first");if(!t)return{options:[]};let{access_token:r,api_domain:n}=e,d={Contacts:o(()=>T.fetchContacts(r,n),"Contacts"),Pipelines:o(()=>T.fetchPipelinesRecords(r,n),"Pipelines"),Companies:o(()=>T.fetchCompanies(r,n),"Companies")}[t||"Contacts"];return{options:((await d())?.data||[]).map(c=>({label:de(c),value:c.id}))}},"options")}),tag:J("Events")},async run({auth:e,propsValue:t}){let{access_token:r,api_domain:n}=e,d={id:JSON.parse(t.eventId).id},m=t.eventFields;if(t.owner&&(d.Owner={id:t.owner}),m&&typeof m=="object"){for(let[c,a]of Object.entries(m))if(!(a==null||typeof a=="string"&&a.trim()===""||Array.isArray(a)&&a.length===0)){if(c==="Participants"){d.Participants=a.map(y=>({type:y.type,participant:y.participant}));continue}if(c==="Start_DateTime"||c==="End_DateTime"){d[c]=pe(a);continue}if(c==="All_day"){d.All_day=a;continue}d[c]=a}}if(t.enableRecurring){let c=[],{recurringInfo:a}=t;a.freq&&c.push(`FREQ=${a.freq}`),a.interval&&c.push(`INTERVAL=${a.interval}`),a.count&&c.push(`COUNT=${a.count}`),a.byday&&c.push(`BYDAY=${a.byday}`),a.bymonthday&&c.push(`BYMONTHDAY=${a.bymonthday}`),a.bysetpos&&c.push(`BYSETPOS=${a.bysetpos}`),c.length>0&&(d.Recurring_Activity={RRULE:c.join(";")+";"})}if(t.enableReminder&&t.reminderInfo?.reminderList){let c=t.reminderInfo?.reminderList;d.Remind_At=c.map(a=>({unit:a.unit,period:a.period}))}if(m?.venue&&(d.Venue=m.venue),t.relatedTo&&t.relatedModule){let a={Contacts:"Contacts",Pipelines:"Deals",Companies:"Accounts"}[t.relatedModule];d.Related_To={id:t.relatedTo},d.$related_module=a}if(t.tag&&Array.isArray(t.tag)&&t.tag.length>0&&(d.Tag=t.tag.map(c=>({name:c}))),Object.keys(d).length===0)throw new Error("No fields to update. Please modify at least one field.");let l={data:[d]};try{return(await T.updateEvent(r,n,l)).data[0]}catch(c){throw console.error("Error updating event:",c),new Error(c instanceof Error?`Failed to update event: ${c.message}`:"Failed to update event due to an unknown error")}}});var fi=F({auth:I,name:"createPipeline",displayName:"Create Pipeline",description:"Creates a new pipeline record in Bigin",audience:"both",aiMetadata:{description:"Creates a new pipeline record (deal) in Bigin CRM with a deal name, pipeline, sub-pipeline, stage, and closing date, plus optional amount, owner, company, contact, secondary contacts, associated products, tags, and module-defined fields. Use to open a new sales opportunity. Not idempotent: each call creates a new deal.",idempotent:!1},props:{dealName:p.ShortText({displayName:"Deal Name",description:"Provide the name for the pipeline record (deal)",required:!0}),pipeline:Mt("Pipelines","Provide the Team Pipeline to which the pipeline record (deal) belongs","Pipelines"),subPipeline:Ze("Sub Pipeline","Pick one of the configured sub-pipelines","Sub Pipeline"),stage:Ze("Stage","Provide the current stage of the pipeline record (deal) within the Sub-Pipeline","Stage"),amount:p.Number({displayName:"Amount",description:"The amount of the pipeline record (deal)",required:!1}),secondaryContacts:Ct,closingDate:p.DateTime({displayName:"Closing Date",description:"Provide the expected or actual closing date of the pipeline record (deal) in YYYY-MM-DD format",required:!0}),owner:ee,accountName:$e,contactName:Be,associatedProducts:Ut,tag:J("Pipelines"),additionalFields:p.DynamicProperties({auth:I,displayName:"Additional Fields",description:"Optional fields from the Pipelines module",refreshers:["auth"],required:!1,props:o(async({auth:e})=>{if(!e)return{};let{access_token:t,api_domain:r}=e,n=await T.fetchModuleFields(t,r,"Pipelines"),i={};for(let d of n.fields||[]){let m=d.api_name;if(["Deal_Name","Sub_Pipeline","Stage","Owner","Account_Name","Contact_Name","Tag","Pipeline","Associated_Products","Secondary_Contacts","Closing_Date","id"].includes(m)||d.read_only||d.field_read_only||!d.view_type||d.view_type.create!==!0)continue;let l=d.display_label||d.field_label||m;switch(d.data_type?.toLowerCase()){case"picklist":{let c=(d.pick_list_values||[]).map(a=>({label:a.display_value,value:a.actual_value}));i[m]=p.StaticDropdown({displayName:l,required:!1,options:{options:c}});break}case"multiselectpicklist":{let c=(d.pick_list_values||[]).map(a=>({label:a.display_value,value:a.actual_value}));i[m]=p.StaticMultiSelectDropdown({displayName:l,required:!1,options:{options:c}});break}case"boolean":{i[m]=p.Checkbox({displayName:l,required:!1});break}case"date":{i[m]=p.ShortText({displayName:l,required:!1});break}case"datetime":{i[m]=p.DateTime({displayName:l,required:!1});break}case"integer":case"long":case"double":case"decimal":case"currency":case"percent":{i[m]=p.Number({displayName:l,required:!1});break}default:i[m]=p.ShortText({displayName:l,required:!1})}}return i},"props")})},async run({propsValue:e,auth:t}){let r={Deal_Name:e.dealName,Sub_Pipeline:e.subPipeline,Stage:e.stage};if(e.owner&&(r.Owner={id:e.owner}),e.accountName&&(r.Account_Name={id:e.accountName}),e.contactName&&(r.Contact_Name={id:e.contactName}),e.amount&&(r.Amount=e.amount),e.closingDate?r.Closing_Date=me(e.closingDate):r.Closing_Date=me(new Date),e.pipeline){let n=JSON.parse(e.pipeline);r.Pipeline={id:n.id,name:n.name}}if(e.associatedProducts&&(r.Associated_Products=e.associatedProducts.map(n=>{let i=JSON.parse(n);return{id:i.id,name:i.name}})),e.tag&&(r.Tag=e.tag.map(n=>({name:n}))),e.additionalFields&&typeof e.additionalFields=="object")for(let[n,i]of Object.entries(e.additionalFields))i==null||typeof i=="string"&&i.trim()===""||Array.isArray(i)&&i.length===0||["Deal_Name","Sub_Pipeline","Stage","Owner","Account_Name","Contact_Name","Tag","Pipeline","Associated_Products","Secondary_Contacts","Closing_Date"].includes(n)||(r[n]=i);try{let{access_token:n,data:i}=t,d=i.api_domain,l=(await T.createPipelineRecord(n,d,{data:[r]})).data[0];if(e.secondaryContacts&&Array.isArray(e.secondaryContacts)&&l?.details?.id){let c=e.secondaryContacts.map(a=>String(a)).filter(a=>a!==e.contactName);c.length>0&&await T.updatePipelineRecord(n,d,{data:[{id:l.details.id,Secondary_Contacts:c.map(a=>({id:a}))}]})}return l}catch(n){throw console.error("Error creating pipeline:",n),new Error(n instanceof Error?`Failed to create pipeline: ${n.message}`:"Failed to create pipeline due to an unknown error")}}});var gi=F({auth:I,name:"updatePipeline",displayName:"Update Pipeline",description:"updates a pipeline record in Bigin",audience:"both",aiMetadata:{description:"Updates an existing pipeline record (deal) in Bigin CRM, identified by selecting the record; any fields you set are overwritten (deal name, sub-pipeline, stage, amount, closing date, owner, company, contact, secondary contacts, associated products, tags). Use to advance a deal stage or revise its details. Idempotent: re-sending the same field values leaves the record in the same state.",idempotent:!0},props:{pipelineRecordId:oi,pipelineDetails:p.DynamicProperties({auth:I,displayName:"Pipeline Details",description:"These fields will be prepopulated with pipeline data",refreshers:["pipelineRecordId","auth"],required:!0,props:o(async({pipelineRecordId:e,auth:t})=>{let r=JSON.parse(e);if(!r.id)throw new Error("Pipeline ID is required to update the record");let{access_token:i,api_domain:d}=t,m=await T.fetchModuleFields(i,d,"Pipelines"),l={};for(let c of m.fields||[]){let a=c.api_name;if(c.read_only||c.field_read_only||!c.view_type||c.view_type.edit!==!0||a==="Tag"||a==="id"||a==="Secondary_Contacts")continue;let y=r[a]??void 0;switch(c.data_type?.toLowerCase()){case"picklist":{let P=(c.pick_list_values||[]).map(h=>({label:h.display_value,value:h.actual_value}));l[a]=p.StaticDropdown({displayName:c.display_label||c.field_label||a,description:c.tooltip||void 0,required:!1,defaultValue:y,options:{options:P}});break}case"multiselectpicklist":{let P=(c.pick_list_values||[]).map(h=>({label:h.display_value,value:h.actual_value}));l[a]=p.StaticMultiSelectDropdown({displayName:c.display_label||c.field_label||a,description:c.tooltip||void 0,required:!1,defaultValue:y,options:{options:P}});break}case"boolean":{l[a]=p.Checkbox({displayName:c.display_label||c.field_label||a,description:c.tooltip||void 0,required:!1,defaultValue:!!y});break}case"date":{l[a]=p.ShortText({displayName:c.display_label||c.field_label||a,description:c.tooltip||"Format: YYYY-MM-DD",required:!1,defaultValue:y});break}case"datetime":{l[a]=p.DateTime({displayName:c.display_label||c.field_label||a,description:c.tooltip||"Format: ISO 8601 (YYYY-MM-DDTHH:mm:ss\xB1HH:mm)",required:!1,defaultValue:y});break}case"integer":case"long":case"double":case"decimal":case"currency":case"percent":{l[a]=p.Number({displayName:c.display_label||c.field_label||a,description:c.tooltip||void 0,required:!1,defaultValue:y});break}default:l[a]=p.ShortText({displayName:c.display_label||c.field_label||a,description:c.tooltip||void 0,required:!1,defaultValue:typeof y=="string"?y:void 0})}}return l},"props")}),pipeline:Mt("Pipelines","Provide the Team Pipeline to which the pipeline record (deal) belongs","Pipelines"),subPipeline:Ze("Sub Pipeline","Pick one of the configured sub-pipelines","Sub Pipeline"),stage:Ze("Stage","Provide the current stage of the pipeline record (deal) within the Sub-Pipeline","Stage"),owner:ee,accountName:$e,contactName:Be,secondaryContacts:Ct,associatedProducts:Ut,tag:J("Pipelines")},async run({propsValue:e,auth:t}){let r=JSON.parse(e.pipelineRecordId),n={id:r.id};if(e.owner&&(n.Owner=e.owner),e.accountName&&(n.Account_Name={id:e.accountName}),e.contactName&&(n.Contact_Name={id:e.contactName}),e.subPipeline&&(n["Sub Pipeline"]=e.subPipeline),e.stage&&(n.Stage=e.stage),e.pipelineDetails.dealName&&(n.Deal_Name=e.pipelineDetails.dealName),e.pipelineDetails.amount&&(n.Amount=e.pipelineDetails.amount),e.pipelineDetails.closingDate&&(n.Closing_Date=me(e.pipelineDetails.closingDate)),e.pipeline){let m=JSON.parse(e.pipeline);n.Pipeline={id:m.id,name:m.name}}e.associatedProducts&&(n.Associated_Products=e.associatedProducts.map(m=>{let l=JSON.parse(m);return{id:l.id,name:l.name}})),e.tag&&(n.Tag=e.tag.map(m=>({name:m})));let{access_token:i,api_domain:d}=t;try{let m=await T.updatePipelineRecord(i,d,{data:[n]});if(e.secondaryContacts&&Array.isArray(e.secondaryContacts)){let l=e.secondaryContacts.map(c=>String(c)).filter(c=>c!==e.contactName);l.length>0&&await T.updatePipelineRecord(i,d,{data:[{id:r.id,Secondary_Contacts:l.map(c=>({id:c}))}]})}return{message:"Pipeline record updated successfully",pipelineRecord:m.data[0]}}catch(m){throw console.error("Error updating pipeline record:",m),new Error(m)}}});var yi=F({auth:I,name:"searchPipelineRecord",displayName:"Search Pipeline Record",description:"Searches deals by name via criteria or word",audience:"both",aiMetadata:{description:"Searches pipeline records (deals) in Bigin CRM and returns matches. Choose between Criteria mode (matches the Deal Name with equals or starts-with) and Word mode (a free-text word search across the module). Use to find a deal by name before referencing or updating it. Idempotent: read-only, repeating the search returns the same matches.",idempotent:!0},props:{mode:p.StaticDropdown({displayName:"Search Mode",required:!0,defaultValue:"criteria",options:{options:[{label:"Criteria (Deal Name)",value:"criteria"},{label:"Word",value:"word"}]}}),dealName:p.ShortText({displayName:"Search Term",description:"Deal Name (criteria) or word",required:!0})},async run({auth:e,propsValue:t}){let{dealName:r,mode:n}=t,{access_token:i,data:d}=e,m=d.api_domain;try{return{message:"Pipeline record search completed successfully",data:(await T.searchRecords(i,m,"Pipelines",n==="word"?{key:"word",value:r}:{key:"criteria",value:`(Deal_Name:equals:${r})OR(Deal_Name:starts_with:${r})`})).data}}catch(l){throw new Error(`Error searching pipeline record: ${l.message}`)}}});var hi=F({auth:I,name:"searchCompanyRecord",displayName:"Search Company Record",description:"Searches companies by full name (criteria) or word",audience:"both",aiMetadata:{description:"Searches company (account) records in Bigin CRM and returns matches. Choose between Criteria mode (matches the Account Name with equals or starts-with) and Word mode (a free-text word search across the module). Use to find a company by name before referencing or updating it. Idempotent: read-only, repeating the search returns the same matches.",idempotent:!0},props:{mode:p.StaticDropdown({displayName:"Search Mode",required:!0,defaultValue:"criteria",options:{options:[{label:"Criteria (full name)",value:"criteria"},{label:"Word",value:"word"}]}}),companyName:p.ShortText({displayName:"Search Term",description:"Company full name (criteria) or word",required:!0})},async run({auth:e,propsValue:t}){let{companyName:r,mode:n}=t,{access_token:i,data:d}=e,m=d.api_domain;try{return{message:"Company record search completed successfully",data:(await T.searchRecords(i,m,"Accounts",n==="word"?{key:"word",value:r}:{key:"criteria",value:`(Account_Name:equals:${r})OR(Account_Name:starts_with:${r})`})).data}}catch(l){throw new Error(`Error searching company record: ${l.message}`)}}});var vi=F({auth:I,name:"searchContactRecord",displayName:"Search Contact Record",description:"Searches contacts by criteria, email, phone, or word",audience:"both",aiMetadata:{description:"Searches contact (person) records in Bigin CRM and returns matches. The search mode selects what the term is matched against: Criteria (name/email/mobile with equals or starts-with), a dedicated Email lookup, a dedicated Phone lookup, or a free-text Word search. Use to find a person by name, email, or phone before referencing or updating them. Idempotent: read-only, repeating the search returns the same matches.",idempotent:!0},props:{mode:p.StaticDropdown({displayName:"Search Mode",description:"Choose how to search Contacts",required:!0,defaultValue:"criteria",options:{options:[{label:"Criteria (name/email/mobile)",value:"criteria"},{label:"Email",value:"email"},{label:"Phone",value:"phone"},{label:"Word",value:"word"}]}}),searchTerm:p.ShortText({displayName:"Search Term",description:"Text, email, phone, or word based on the selected mode",required:!0})},async run({auth:e,propsValue:t}){let{searchTerm:r,mode:n}=t,{access_token:i,data:d}=e,m=d.api_domain,l="criteria",c="";n==="email"?(l="email",c=r):n==="phone"?(l="phone",c=r):n==="word"?(l="word",c=r):c=["First_Name","Last_Name","Email","Mobile"].flatMap(a=>[`${a}:equals:${r}`,`${a}:starts_with:${r}`]).map(a=>`(${a})`).join("OR");try{return{message:"Contact record search completed successfully",data:(await T.searchRecords(i,m,"Contacts",{key:l,value:c})).data}}catch(a){throw new Error(`Error searching contact record: ${a.message}`)}}});var _i=F({auth:I,name:"searchProductRecord",displayName:"Search Product Record",description:"Searches products by name/code via criteria or word",audience:"both",aiMetadata:{description:"Searches product records in Bigin CRM and returns matches. Choose between Criteria mode (matches Product Name or Product Code with equals or starts-with) and Word mode (a free-text word search across the module). Use to find a product by name or code before associating it with a deal. Idempotent: read-only, repeating the search returns the same matches.",idempotent:!0},props:{mode:p.StaticDropdown({displayName:"Search Mode",required:!0,defaultValue:"criteria",options:{options:[{label:"Criteria (name/code)",value:"criteria"},{label:"Word",value:"word"}]}}),searchTerm:p.ShortText({displayName:"Search Term",description:"Product name/code (criteria) or word",required:!0})},async run({auth:e,propsValue:t}){let{searchTerm:r,mode:n}=t,{access_token:i,data:d}=e,m=d.api_domain,l=["Product_Name","Product_Code"].flatMap(c=>[`${c}:equals:${r}`,`${c}:starts_with:${r}`]).map(c=>`(${c})`).join("OR");try{return{message:"Product record search completed successfully",data:(await T.searchRecords(i,m,"Products",n==="word"?{key:"word",value:r}:{key:"criteria",value:l})).data}}catch(c){throw new Error(`Error searching product record: ${c.message}`)}}});var Pi=F({auth:I,name:"searchUser",displayName:"Search User",description:"Locate users by email.",audience:"both",aiMetadata:{description:"Finds Bigin CRM org users whose email contains the given term (case-insensitive substring match), filtering client-side over the user list; an optional user-type filter (e.g. active, admin, current user) and pagination narrow the fetched set. Use to resolve a user id for assigning records as owner. Idempotent: read-only, repeating the search returns the same matches.",idempotent:!0},props:{email:p.ShortText({displayName:"Email",description:"User email address (full or partial, case-insensitive match)",required:!0}),type:p.StaticDropdown({displayName:"User Type (optional)",required:!1,options:{options:[{label:"All Users",value:"AllUsers"},{label:"Active Users",value:"ActiveUsers"},{label:"Deactive Users",value:"DeactiveUsers"},{label:"Confirmed Users",value:"ConfirmedUsers"},{label:"Not Confirmed Users",value:"NotConfirmedUsers"},{label:"Deleted Users",value:"DeletedUsers"},{label:"Active Confirmed Users",value:"ActiveConfirmedUsers"},{label:"Admin Users",value:"AdminUsers"},{label:"Active Confirmed Admins",value:"ActiveConfirmedAdmins"},{label:"Current User",value:"CurrentUser"}]}}),page:p.Number({displayName:"Page",required:!1,description:"Page index (default 1)"}),per_page:p.Number({displayName:"Per Page",required:!1,description:"Records per page (max 200, default 200)"})},async run({auth:e,propsValue:t}){let{access_token:r,data:n}=e,i=n.api_domain,d=String(t.email||"").toLowerCase(),m={};t.type&&(m.type=t.type),t.page&&(m.page=Number(t.page)),t.per_page&&(m.per_page=Number(t.per_page));let l=await T.fetchUsers(r,i,m),a=(Array.isArray(l.users)?l.users:[]).filter(y=>String(y.email||"").toLowerCase().includes(d));return{message:"User search completed successfully",count:a.length,data:a}}});var nc=jo({displayName:"Bigin by Zoho CRM",description:"Bigin by Zoho CRM is a lightweight CRM designed for small businesses to manage contacts, companies, deals (pipeline records), tasks, calls, and events.",auth:I,minimumSupportedRelease:"0.36.1",categories:["SALES_AND_CRM"],logoUrl:"https://cdn.activepieces.com/pieces/bigin-by-zoho.png",authors:["gs03dev"],actions:[ii,ai,si,ci,ui,li,di,pi,mi,fi,gi,yi,hi,vi,_i,Pi],triggers:[Ko,Jo,Qo,Yo,Xo,ei,ti,ri,ni]});0&&(module.exports={biginByZoho});
package/README.md DELETED
@@ -1,7 +0,0 @@
1
- # pieces-bigin-by-zoho
2
-
3
- This library was generated with [Nx](https://nx.dev).
4
-
5
- ## Building
6
-
7
- Run `nx build pieces-bigin-by-zoho` to build the library.
package/src/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const biginAuth: import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>;
2
- export declare const biginByZoho: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
package/src/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/bigin-by-zoho/src/index.ts"],"names":[],"mappings":";;;;AACA,qEAAkF;AAClF,sDAA6D;AAC7D,kDAA2E;AAC3E,4EAAuE;AACvE,iDAAqD;AACrD,oEAAgE;AAChE,oEAAgE;AAChE,sEAAiE;AACjE,4EAAuE;AACvE,sEAAiE;AACjE,wEAAmE;AACnE,4EAA8E;AAC9E,oFAA+E;AAC/E,iEAA6D;AAC7D,iEAA6D;AAC7D,iEAA6D;AAC7D,iEAA6D;AAC7D,2DAAuD;AACvD,2DAAuD;AACvD,2DAAuD;AACvD,kDAAuD;AACvD,6DAAyD;AACzD,6DAAyD;AACzD,iFAA4E;AAC5E,iFAA4E;AAC5E,mFAA6E;AAC7E,+EAA0E;AAC1E,+EAA0E;AAC1E,iEAAmE;AACnE,2DAAuD;AAE1C,QAAA,SAAS,GAAG,4BAAS,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,wBAAwB;IACjC,QAAQ,EAAE,yBAAyB;IACnC,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,uBAAuB;QACvB,wBAAwB;QACxB,qBAAqB;QACrB,6BAA6B;QAC7B,8BAA8B;KAC/B;IACD,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC9B,WAAW,EAAE,yBAAyB;YACtC,WAAW,EAAE,sDAAsD;YACnE,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,+BAAmB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;oBAC5C,KAAK,EAAE,MAAM,CAAC,KAAK;oBACnB,KAAK,EAAE,IAAA,6CAAmC,EAAC,MAAM,CAAC,MAAM,CAAC;iBAC1D,CAAC,CAAC;aACJ;YACD,YAAY,EAAE,IAAA,6CAAmC,EAC/C,+BAAmB,CAAC,CAAC,CAAC,CAAC,MAAM,CAC9B;SACF,CAAC;KACH;IACD,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;;QACvB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,KAAY,CAAC;QACrC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,wCAAwC;aAChD,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,+BAAmB,CAAC,IAAI,CACrC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,KAAK,MAAM,IAAI,IAAA,6CAAmC,EAAC,CAAC,CAAC,MAAM,CAAC,KAAK,MAAM,CAChG,CAAC;YACF,MAAM,SAAS,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,mCAAI,0BAA0B,CAAC;YACnE,MAAM,yBAAe,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;YACjE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,WAAM,CAAC;YACP,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EACH,wFAAwF;aAC3F,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,IAAA,8BAAW,EAAC;IACrC,WAAW,EAAE,mBAAmB;IAChC,WAAW,EACT,yJAAyJ;IAC3J,IAAI,EAAE,iBAAS;IACf,uBAAuB,EAAE,QAAQ;IACjC,UAAU,EAAE,CAAC,sBAAa,CAAC,aAAa,CAAC;IACzC,OAAO,EAAE,uDAAuD;IAChE,OAAO,EAAE,CAAC,SAAS,CAAC;IACpB,OAAO,EAAE;QACP,8BAAa;QACb,8BAAa;QACb,8BAAa;QACb,8BAAa;QACb,wBAAU;QACV,wBAAU;QACV,wBAAU;QACV,0BAAW;QACX,0BAAW;QACX,6CAAoB;QACpB,6CAAoB;QACpB,8CAAoB;QACpB,2CAAmB;QACnB,2CAAmB;QACnB,oCAAmB;QACnB,wBAAU;KACX;IACD,QAAQ,EAAE;QACR,uCAAiB;QACjB,gCAAc;QACd,uCAAiB;QACjB,gCAAc;QACd,iCAAc;QACd,iCAAc;QACd,mCAAe;QACf,8CAAwB;QACxB,+CAAqB;KACtB;CACF,CAAC,CAAC"}
@@ -1,15 +0,0 @@
1
- export declare const createCall: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- callStartTime: import("@activepieces/pieces-framework").DateTimeProperty<true>;
3
- callDuration: import("@activepieces/pieces-framework").NumberProperty<true>;
4
- callType: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
5
- owner: import("@activepieces/pieces-framework").DropdownProperty<unknown, false, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
6
- contactName: import("@activepieces/pieces-framework").DropdownProperty<unknown, false, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
7
- subject: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
- description: import("@activepieces/pieces-framework").LongTextProperty<false>;
9
- callAgenda: import("@activepieces/pieces-framework").LongTextProperty<false>;
10
- reminder: import("@activepieces/pieces-framework").DateTimeProperty<false>;
11
- dialledNumber: import("@activepieces/pieces-framework").ShortTextProperty<false>;
12
- relatedModule: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
13
- relatedTo: import("@activepieces/pieces-framework").DropdownProperty<any, false, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
14
- tag: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
15
- }>;