@segment/action-destinations 3.94.0 → 3.94.1-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/destinations/actions-pardot/generated-types.d.ts +5 -0
  2. package/dist/destinations/{intercom/trackEvent → actions-pardot}/generated-types.js +0 -0
  3. package/dist/destinations/actions-pardot/generated-types.js.map +1 -0
  4. package/dist/destinations/actions-pardot/index.d.ts +4 -0
  5. package/dist/destinations/actions-pardot/index.js +62 -0
  6. package/dist/destinations/actions-pardot/index.js.map +1 -0
  7. package/dist/destinations/actions-pardot/pa-operations.d.ts +17 -0
  8. package/dist/destinations/actions-pardot/pa-operations.js +51 -0
  9. package/dist/destinations/actions-pardot/pa-operations.js.map +1 -0
  10. package/dist/destinations/actions-pardot/pa-properties.d.ts +2 -0
  11. package/dist/destinations/actions-pardot/pa-properties.js +13 -0
  12. package/dist/destinations/actions-pardot/pa-properties.js.map +1 -0
  13. package/dist/destinations/actions-pardot/pa-type.d.ts +15 -0
  14. package/dist/destinations/actions-pardot/pa-type.js +3 -0
  15. package/dist/destinations/actions-pardot/pa-type.js.map +1 -0
  16. package/dist/destinations/actions-pardot/prospects/generated-types.d.ts +19 -0
  17. package/dist/destinations/actions-pardot/prospects/generated-types.js +3 -0
  18. package/dist/destinations/actions-pardot/prospects/generated-types.js.map +1 -0
  19. package/dist/destinations/{intercom/trackEvent → actions-pardot/prospects}/index.d.ts +0 -0
  20. package/dist/destinations/actions-pardot/prospects/index.js +204 -0
  21. package/dist/destinations/actions-pardot/prospects/index.js.map +1 -0
  22. package/dist/destinations/cordial/addProductToCart/index.js +1 -1
  23. package/dist/destinations/cordial/addProductToCart/index.js.map +1 -1
  24. package/dist/destinations/cordial/index.js +1 -1
  25. package/dist/destinations/cordial/index.js.map +1 -1
  26. package/dist/destinations/cordial/removeProductFromCart/index.js.map +1 -1
  27. package/dist/destinations/cordial/upsertOrder/index.js +8 -8
  28. package/dist/destinations/cordial/upsertOrder/index.js.map +1 -1
  29. package/dist/destinations/customerio/trackEvent/index.js.map +1 -1
  30. package/dist/destinations/engage-messaging-sendgrid/generated-types.d.ts +1 -0
  31. package/dist/destinations/engage-messaging-sendgrid/index.js +5 -0
  32. package/dist/destinations/engage-messaging-sendgrid/index.js.map +1 -1
  33. package/dist/destinations/engage-messaging-sendgrid/sendEmail/generated-types.d.ts +8 -0
  34. package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js +61 -1
  35. package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js.map +1 -1
  36. package/dist/destinations/engage-messaging-twilio/sendSms/generated-types.d.ts +4 -0
  37. package/dist/destinations/engage-messaging-twilio/sendSms/index.js +21 -1
  38. package/dist/destinations/engage-messaging-twilio/sendSms/index.js.map +1 -1
  39. package/dist/destinations/facebook-conversions-api/custom/index.js +0 -3
  40. package/dist/destinations/facebook-conversions-api/custom/index.js.map +1 -1
  41. package/dist/destinations/google-analytics-4/ga4-functions.js +15 -6
  42. package/dist/destinations/google-analytics-4/ga4-functions.js.map +1 -1
  43. package/dist/destinations/google-enhanced-conversions/generated-types.d.ts +1 -1
  44. package/dist/destinations/google-enhanced-conversions/index.js +3 -7
  45. package/dist/destinations/google-enhanced-conversions/index.js.map +1 -1
  46. package/dist/destinations/google-enhanced-conversions/postConversion/index.js +7 -1
  47. package/dist/destinations/google-enhanced-conversions/postConversion/index.js.map +1 -1
  48. package/dist/destinations/index.js +3 -1
  49. package/dist/destinations/index.js.map +1 -1
  50. package/dist/destinations/intercom/groupIdentifyContact/generated-types.d.ts +0 -2
  51. package/dist/destinations/intercom/groupIdentifyContact/index.js +36 -44
  52. package/dist/destinations/intercom/groupIdentifyContact/index.js.map +1 -1
  53. package/dist/destinations/intercom/identifyContact/index.js +54 -24
  54. package/dist/destinations/intercom/identifyContact/index.js.map +1 -1
  55. package/dist/destinations/intercom/index.d.ts +1 -1
  56. package/dist/destinations/intercom/index.js +8 -24
  57. package/dist/destinations/intercom/index.js.map +1 -1
  58. package/dist/destinations/mixpanel/alias/index.js +1 -2
  59. package/dist/destinations/mixpanel/alias/index.js.map +1 -1
  60. package/dist/destinations/mixpanel/generated-types.d.ts +0 -1
  61. package/dist/destinations/mixpanel/groupIdentifyUser/index.js +1 -2
  62. package/dist/destinations/mixpanel/groupIdentifyUser/index.js.map +1 -1
  63. package/dist/destinations/mixpanel/identifyUser/index.js +2 -4
  64. package/dist/destinations/mixpanel/identifyUser/index.js.map +1 -1
  65. package/dist/destinations/mixpanel/index.js +0 -9
  66. package/dist/destinations/mixpanel/index.js.map +1 -1
  67. package/dist/destinations/mixpanel/trackEvent/index.js +1 -1
  68. package/dist/destinations/mixpanel/trackEvent/index.js.map +1 -1
  69. package/dist/destinations/mixpanel/utils.d.ts +0 -5
  70. package/dist/destinations/mixpanel/utils.js +1 -13
  71. package/dist/destinations/mixpanel/utils.js.map +1 -1
  72. package/dist/destinations/salesforce/lead/index.js +2 -1
  73. package/dist/destinations/salesforce/lead/index.js.map +1 -1
  74. package/dist/destinations/salesforce-marketing-cloud/contact/generated-types.d.ts +2 -0
  75. package/dist/destinations/salesforce-marketing-cloud/contact/generated-types.js +3 -0
  76. package/dist/destinations/salesforce-marketing-cloud/contact/generated-types.js.map +1 -0
  77. package/dist/destinations/salesforce-marketing-cloud/contact/index.d.ts +5 -0
  78. package/dist/destinations/salesforce-marketing-cloud/contact/index.js +11 -0
  79. package/dist/destinations/salesforce-marketing-cloud/contact/index.js.map +1 -0
  80. package/dist/destinations/salesforce-marketing-cloud/generated-types.d.ts +2 -0
  81. package/dist/destinations/salesforce-marketing-cloud/generated-types.js +3 -0
  82. package/dist/destinations/salesforce-marketing-cloud/generated-types.js.map +1 -0
  83. package/dist/destinations/salesforce-marketing-cloud/index.d.ts +4 -0
  84. package/dist/destinations/salesforce-marketing-cloud/index.js +27 -0
  85. package/dist/destinations/salesforce-marketing-cloud/index.js.map +1 -0
  86. package/dist/lib/engage-test-data/create-messaging-test-event.d.ts +2 -0
  87. package/dist/lib/engage-test-data/create-messaging-test-event.js +63 -0
  88. package/dist/lib/engage-test-data/create-messaging-test-event.js.map +1 -0
  89. package/package.json +4 -4
  90. package/dist/destinations/intercom/trackEvent/generated-types.d.ts +0 -12
  91. package/dist/destinations/intercom/trackEvent/generated-types.js.map +0 -1
  92. package/dist/destinations/intercom/trackEvent/index.js +0 -111
  93. package/dist/destinations/intercom/trackEvent/index.js.map +0 -1
  94. package/dist/destinations/intercom/util.d.ts +0 -11
  95. package/dist/destinations/intercom/util.js +0 -48
  96. package/dist/destinations/intercom/util.js.map +0 -1
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const contact_1 = __importDefault(require("./contact"));
7
+ const destination = {
8
+ name: 'Salesforce Marketing Cloud (Actions)',
9
+ slug: 'actions-salesforce-marketing-cloud',
10
+ mode: 'cloud',
11
+ authentication: {
12
+ scheme: 'oauth2',
13
+ fields: {}
14
+ },
15
+ extendRequest({ auth }) {
16
+ return {
17
+ headers: {
18
+ authorization: `Bearer ${auth?.accessToken}`
19
+ }
20
+ };
21
+ },
22
+ actions: {
23
+ contact: contact_1.default
24
+ }
25
+ };
26
+ exports.default = destination;
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/salesforce-marketing-cloud/index.ts"],"names":[],"mappings":";;;;;AAGA,wDAA+B;AAE/B,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,sCAAsC;IAC5C,IAAI,EAAE,oCAAoC;IAC1C,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,EAAE;KAoBX;IACD,aAAa,CAAC,EAAE,IAAI,EAAE;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;aAC7C;SACF,CAAA;IACH,CAAC;IAOD,OAAO,EAAE;QACP,OAAO,EAAP,iBAAO;KACR;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,2 @@
1
+ import type { SegmentEvent } from '@segment/actions-core';
2
+ export declare function createMessagingTestEvent(event?: Partial<SegmentEvent>): SegmentEvent;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createMessagingTestEvent = void 0;
4
+ const uuid_1 = require("@lukeed/uuid");
5
+ function createMessagingTestEvent(event = {}) {
6
+ return {
7
+ anonymousId: uuid_1.v4(),
8
+ context: {
9
+ ip: '8.8.8.8',
10
+ library: {
11
+ name: 'analytics.js',
12
+ version: '2.11.1'
13
+ },
14
+ locale: 'en-US',
15
+ location: {
16
+ city: 'San Francisco',
17
+ country: 'United States',
18
+ latitude: 40.2964197,
19
+ longitude: -76.9411617,
20
+ speed: 0
21
+ },
22
+ page: {
23
+ path: '/academy/',
24
+ referrer: '',
25
+ search: '',
26
+ title: 'Analytics Academy',
27
+ url: 'https://segment.com/academy/'
28
+ },
29
+ timezone: 'Europe/Amsterdam',
30
+ userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'
31
+ },
32
+ event: 'Test Event',
33
+ messageId: uuid_1.v4(),
34
+ properties: {
35
+ firstName: 'First Name',
36
+ lastName: 'Browning'
37
+ },
38
+ receivedAt: new Date().toISOString(),
39
+ sentAt: new Date().toISOString(),
40
+ timestamp: new Date().toISOString(),
41
+ traits: {},
42
+ type: 'track',
43
+ userId: 'user1234',
44
+ external_ids: [
45
+ {
46
+ collection: 'users',
47
+ encoding: 'none',
48
+ groups: [
49
+ {
50
+ id: uuid_1.v4(),
51
+ isSubscribed: true
52
+ }
53
+ ] || undefined,
54
+ id: uuid_1.v4() + '@unittest.com',
55
+ isSubscribed: true,
56
+ type: 'email'
57
+ }
58
+ ],
59
+ ...event
60
+ };
61
+ }
62
+ exports.createMessagingTestEvent = createMessagingTestEvent;
63
+ //# sourceMappingURL=create-messaging-test-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-messaging-test-event.js","sourceRoot":"","sources":["../../../src/lib/engage-test-data/create-messaging-test-event.ts"],"names":[],"mappings":";;;AAAA,uCAA2C;AAG3C,SAAgB,wBAAwB,CAAC,QAA+B,EAAE;IACxE,OAAO;QACL,WAAW,EAAE,SAAM,EAAE;QACrB,OAAO,EAAE;YACP,EAAE,EAAE,SAAS;YACb,OAAO,EAAE;gBACP,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,QAAQ;aAClB;YACD,MAAM,EAAE,OAAO;YACf,QAAQ,EAAE;gBACR,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE,eAAe;gBACxB,QAAQ,EAAE,UAAU;gBACpB,SAAS,EAAE,CAAC,UAAU;gBACtB,KAAK,EAAE,CAAC;aACT;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,WAAW;gBACjB,QAAQ,EAAE,EAAE;gBACZ,MAAM,EAAE,EAAE;gBACV,KAAK,EAAE,mBAAmB;gBAC1B,GAAG,EAAE,8BAA8B;aACpC;YACD,QAAQ,EAAE,kBAAkB;YAC5B,SAAS,EACP,uIAAuI;SAC1I;QACD,KAAK,EAAE,YAAY;QACnB,SAAS,EAAE,SAAM,EAAE;QACnB,UAAU,EAAE;YACV,SAAS,EAAE,YAAY;YACvB,QAAQ,EAAE,UAAU;SACrB;QACD,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAChC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,UAAU;QAClB,YAAY,EAAE;YACZ;gBACE,UAAU,EAAE,OAAO;gBACnB,QAAQ,EAAE,MAAM;gBAChB,MAAM,EACJ;oBACE;wBACE,EAAE,EAAE,SAAM,EAAE;wBACZ,YAAY,EAAE,IAAI;qBACnB;iBACF,IAAI,SAAS;gBAChB,EAAE,EAAE,SAAM,EAAE,GAAG,eAAe;gBAC9B,YAAY,EAAE,IAAI;gBAClB,IAAI,EAAE,OAAO;aACd;SACF;QACD,GAAG,KAAK;KACT,CAAA;AACH,CAAC;AA1DD,4DA0DC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@segment/action-destinations",
3
3
  "description": "Destination Actions engine and definitions.",
4
- "version": "3.94.0",
4
+ "version": "3.94.1-alpha.11",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",
@@ -38,8 +38,8 @@
38
38
  "dependencies": {
39
39
  "@amplitude/ua-parser-js": "^0.7.25",
40
40
  "@segment/a1-notation": "^2.1.4",
41
- "@segment/actions-core": "^3.31.0",
42
- "@segment/actions-shared": "^1.14.0",
41
+ "@segment/actions-core": "^3.31.1-alpha.22",
42
+ "@segment/actions-shared": "^1.14.1-alpha.20",
43
43
  "cheerio": "^1.0.0-rc.10",
44
44
  "dayjs": "^1.10.7",
45
45
  "escape-goat": "^3",
@@ -65,5 +65,5 @@
65
65
  "lcov"
66
66
  ]
67
67
  },
68
- "gitHead": "a2890853b4842b917ffc8ed30890fc83b5ab6c4c"
68
+ "gitHead": "a054076332f3a13801a5c8dfef883fb6dc326400"
69
69
  }
@@ -1,12 +0,0 @@
1
- export interface Payload {
2
- event_name: string;
3
- created_at: string | number;
4
- user_id?: string;
5
- email?: string;
6
- revenue?: number;
7
- currency?: string;
8
- id?: string;
9
- metadata?: {
10
- [k: string]: unknown;
11
- };
12
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/intercom/trackEvent/generated-types.ts"],"names":[],"mappings":""}
@@ -1,111 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const actions_core_1 = require("@segment/actions-core");
4
- const util_1 = require("../util");
5
- const action = {
6
- title: 'Track Event',
7
- description: 'Submit an event to Intercom.',
8
- defaultSubscription: 'type = "track"',
9
- fields: {
10
- event_name: {
11
- type: 'string',
12
- required: true,
13
- description: 'The name of the event that occurred. Names are treated as case insensitive. Periods and dollar signs in event names are replaced with hyphens.',
14
- label: 'Event Name',
15
- default: {
16
- '@path': '$.event'
17
- }
18
- },
19
- created_at: {
20
- type: 'datetime',
21
- required: true,
22
- description: 'The time the event occurred as a UTC Unix timestamp. Segment will convert to Unix if not already converted.',
23
- label: 'Event Timestamp',
24
- default: {
25
- '@path': '$.timestamp'
26
- }
27
- },
28
- user_id: {
29
- type: 'string',
30
- description: 'Your identifier for the user who performed the event. User ID is required if no email or Contact ID is provided.',
31
- label: 'User ID',
32
- default: {
33
- '@path': '$.userId'
34
- }
35
- },
36
- email: {
37
- type: 'string',
38
- description: 'The email address for the user who performed the event. Email is required if no User ID or Contact ID is provided.',
39
- label: 'Email Address',
40
- format: 'email',
41
- default: {
42
- '@path': '$.properties.email'
43
- }
44
- },
45
- revenue: {
46
- label: 'Revenue',
47
- type: 'number',
48
- description: 'The amount associated with a purchase. Segment will multiply by 100 as Intercom requires the amount in cents.',
49
- default: {
50
- '@path': '$.properties.revenue'
51
- }
52
- },
53
- currency: {
54
- label: 'Currency',
55
- type: 'string',
56
- description: 'The currency of the purchase amount. Segment will default to USD if revenue is provided without a currency.',
57
- default: {
58
- '@path': '$.properties.currency'
59
- }
60
- },
61
- id: {
62
- label: 'Contact ID',
63
- description: "Intercom's unique identifier for the contact. If no Contact ID is provided, Segment will use User ID or Email to find a user or lead.",
64
- type: 'string'
65
- },
66
- metadata: {
67
- type: 'object',
68
- description: 'Optional metadata describing the event. Each event can contain up to ten metadata key-value pairs. If you send more than ten keys, Intercom will ignore the rest. Intercom does not support nested JSON structures within metadata.',
69
- label: 'Event Metadata',
70
- default: {
71
- '@path': '$.properties'
72
- }
73
- }
74
- },
75
- perform: async (request, { payload }) => {
76
- payload.created_at = util_1.convertValidTimestamp(payload.created_at);
77
- delete payload.metadata?.email;
78
- if (payload.email && !payload.user_id && !payload.id) {
79
- const contact = await util_1.getUniqueIntercomContact(request, payload);
80
- if (contact) {
81
- payload.id = contact.id;
82
- }
83
- else {
84
- throw new actions_core_1.IntegrationError('No unique contact found', 'Contact not found', 404);
85
- }
86
- }
87
- possiblyPopulatePrice(payload);
88
- return request('https://api.intercom.io/events', {
89
- method: 'POST',
90
- json: payload
91
- });
92
- }
93
- };
94
- function possiblyPopulatePrice(payload) {
95
- const { revenue, currency } = payload;
96
- delete payload.revenue;
97
- delete payload.currency;
98
- delete payload.metadata?.revenue;
99
- delete payload.metadata?.currency;
100
- if (revenue || revenue === 0) {
101
- if (!payload.metadata) {
102
- payload.metadata = {};
103
- }
104
- payload.metadata.price = {
105
- amount: revenue * 100,
106
- currency: currency || 'USD'
107
- };
108
- }
109
- }
110
- exports.default = action;
111
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/intercom/trackEvent/index.ts"],"names":[],"mappings":"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"}
@@ -1,11 +0,0 @@
1
- import { RequestClient } from '@segment/actions-core';
2
- interface IntercomContact {
3
- id: string;
4
- }
5
- interface SearchPayload {
6
- external_id?: string;
7
- email?: string;
8
- }
9
- export declare function getUniqueIntercomContact(request: RequestClient, payload: SearchPayload): Promise<IntercomContact | undefined>;
10
- export declare const convertValidTimestamp: <Value = unknown>(value: Value) => number | Value;
11
- export {};
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.convertValidTimestamp = exports.getUniqueIntercomContact = void 0;
7
- const dayjs_1 = __importDefault(require("../../lib/dayjs"));
8
- async function getUniqueIntercomContact(request, payload) {
9
- const { external_id, email } = payload;
10
- let query;
11
- if (external_id) {
12
- query = {
13
- field: 'external_id',
14
- operator: '=',
15
- value: external_id
16
- };
17
- }
18
- else if (email) {
19
- query = {
20
- field: 'email',
21
- operator: '=',
22
- value: email
23
- };
24
- }
25
- else {
26
- return;
27
- }
28
- const response = await request('https://api.intercom.io/contacts/search', {
29
- method: 'POST',
30
- json: { query }
31
- });
32
- if (response?.data?.total_count === 1) {
33
- return response.data.data[0];
34
- }
35
- }
36
- exports.getUniqueIntercomContact = getUniqueIntercomContact;
37
- const convertValidTimestamp = (value) => {
38
- if (typeof value !== 'string' || /^\d+$/.test(value)) {
39
- return value;
40
- }
41
- const maybeDate = dayjs_1.default.utc(value);
42
- if (maybeDate.isValid()) {
43
- return maybeDate.unix();
44
- }
45
- return value;
46
- };
47
- exports.convertValidTimestamp = convertValidTimestamp;
48
- //# sourceMappingURL=util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/destinations/intercom/util.ts"],"names":[],"mappings":";;;;;;AACA,4DAAmC;AAqB5B,KAAK,UAAU,wBAAwB,CAAC,OAAsB,EAAE,OAAsB;IAC3F,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,OAAO,CAAA;IACtC,IAAI,KAAK,CAAA;IACT,IAAI,WAAW,EAAE;QACf,KAAK,GAAG;YACN,KAAK,EAAE,aAAa;YACpB,QAAQ,EAAE,GAAG;YACb,KAAK,EAAE,WAAW;SACnB,CAAA;KACF;SAAM,IAAI,KAAK,EAAE;QAChB,KAAK,GAAG;YACN,KAAK,EAAE,OAAO;YACd,QAAQ,EAAE,GAAG;YACb,KAAK,EAAE,KAAK;SACb,CAAA;KACF;SAAM;QACL,OAAM;KACP;IAED,MAAM,QAAQ,GAAyC,MAAM,OAAO,CAAC,yCAAyC,EAAE;QAC9G,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,EAAE,KAAK,EAAE;KAChB,CAAC,CAAA;IAEF,IAAI,QAAQ,EAAE,IAAI,EAAE,WAAW,KAAK,CAAC,EAAE;QACrC,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAC7B;AACH,CAAC;AA3BD,4DA2BC;AAEM,MAAM,qBAAqB,GAAG,CAAkB,KAAY,EAAkB,EAAE;IAKrF,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QACpD,OAAO,KAAK,CAAA;KACb;IAED,MAAM,SAAS,GAAG,eAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAElC,IAAI,SAAS,CAAC,OAAO,EAAE,EAAE;QACvB,OAAO,SAAS,CAAC,IAAI,EAAE,CAAA;KACxB;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAhBY,QAAA,qBAAqB,yBAgBjC"}