@winible/winible-typed 2.22.9 → 2.22.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ShouldRemoveSubscriberStatus = exports.SubscriptionPlanType = exports.VerifyStatus = exports.TemporalUnit = exports.DiscountType = exports.UserStoreRole = exports.UserRole = exports.UserStatus = void 0;
3
+ exports.RewardType = exports.RewardFrequency = exports.ShouldRemoveSubscriberStatus = exports.SubscriptionPlanType = exports.VerifyStatus = exports.TemporalUnit = exports.DiscountType = exports.UserStoreRole = exports.UserRole = exports.UserStatus = void 0;
4
4
  var UserStatus;
5
5
  (function (UserStatus) {
6
6
  UserStatus["PENDING_REVIEW"] = "PENDING_REVIEW";
@@ -48,4 +48,14 @@ var ShouldRemoveSubscriberStatus;
48
48
  ShouldRemoveSubscriberStatus["TRUE"] = "TRUE";
49
49
  ShouldRemoveSubscriberStatus["FALSE"] = "FALSE";
50
50
  })(ShouldRemoveSubscriberStatus = exports.ShouldRemoveSubscriberStatus || (exports.ShouldRemoveSubscriberStatus = {}));
51
+ var RewardFrequency;
52
+ (function (RewardFrequency) {
53
+ RewardFrequency["SINGLE"] = "SINGLE";
54
+ RewardFrequency["RECURRING"] = "RECURRING";
55
+ })(RewardFrequency = exports.RewardFrequency || (exports.RewardFrequency = {}));
56
+ var RewardType;
57
+ (function (RewardType) {
58
+ RewardType["CENTS"] = "CENTS";
59
+ RewardType["PERCENTAGE"] = "PERCENTAGE";
60
+ })(RewardType = exports.RewardType || (exports.RewardType = {}));
51
61
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAyCA,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,+CAAiC,CAAA;IACjC,mCAAqB,CAAA;IACrB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AAe;IACzB,oCAAiB,CAAA;IACjB,0CAAuB,CAAA;AACzB,CAAC,EAHW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAG1B;AAED,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,uCAAyB,CAAA;AAC3B,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB"}
@@ -0,0 +1,98 @@
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 sequelize_1 = require("sequelize");
7
+ const pb_sequelize_1 = __importDefault(require("./pb-sequelize"));
8
+ const types_1 = require("../src/types");
9
+ const user_1 = __importDefault(require("./user"));
10
+ // order of InferAttributes & InferCreationAttributes is important.
11
+ class AffiliateCode extends sequelize_1.Model {
12
+ }
13
+ AffiliateCode.init({
14
+ id: {
15
+ type: sequelize_1.DataTypes.BIGINT,
16
+ primaryKey: true,
17
+ allowNull: false,
18
+ defaultValue: pb_sequelize_1.default.fn("next_id"),
19
+ },
20
+ affiliateCode: {
21
+ type: sequelize_1.DataTypes.STRING,
22
+ field: "affiliate_code",
23
+ allowNull: false,
24
+ },
25
+ userId: {
26
+ type: sequelize_1.DataTypes.BIGINT,
27
+ field: "user_id",
28
+ defaultValue: null,
29
+ references: {
30
+ model: user_1.default,
31
+ },
32
+ },
33
+ creatorId: {
34
+ type: sequelize_1.DataTypes.BIGINT,
35
+ allowNull: false,
36
+ field: "creator_id",
37
+ references: {
38
+ model: user_1.default,
39
+ },
40
+ },
41
+ emailInvite: {
42
+ type: sequelize_1.DataTypes.STRING,
43
+ allowNull: false,
44
+ field: "email_invite",
45
+ },
46
+ pageViews: {
47
+ type: sequelize_1.DataTypes.INTEGER,
48
+ allowNull: false,
49
+ field: "page_views",
50
+ defaultValue: 0,
51
+ },
52
+ rewardFrequency: {
53
+ type: sequelize_1.DataTypes.ENUM(...Object.values(types_1.RewardFrequency)),
54
+ field: "reward_frequency",
55
+ },
56
+ rewardType: {
57
+ type: sequelize_1.DataTypes.ENUM(...Object.values(types_1.RewardType)),
58
+ field: "reward_type",
59
+ },
60
+ rewardAmountInCents: {
61
+ type: sequelize_1.DataTypes.INTEGER,
62
+ field: "reward_amount_in_cents",
63
+ },
64
+ rewardAmountInPercent: {
65
+ type: sequelize_1.DataTypes.FLOAT,
66
+ field: "reward_amount_in_percent",
67
+ },
68
+ allPlansEligible: {
69
+ type: sequelize_1.DataTypes.STRING,
70
+ field: "all_plans_eligible",
71
+ },
72
+ allPostsEligible: {
73
+ type: sequelize_1.DataTypes.STRING,
74
+ field: "all_posts_eligible",
75
+ },
76
+ pricingOptionIdsEligible: {
77
+ type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.BIGINT),
78
+ field: "pricing_option_ids_eligible",
79
+ defaultValue: [],
80
+ },
81
+ createdAt: sequelize_1.DataTypes.DATE,
82
+ updatedAt: sequelize_1.DataTypes.DATE,
83
+ }, {
84
+ tableName: "affiliate_codes",
85
+ sequelize: pb_sequelize_1.default,
86
+ });
87
+ AffiliateCode.belongsTo(user_1.default, {
88
+ foreignKey: "userId",
89
+ as: "User",
90
+ targetKey: "id",
91
+ });
92
+ AffiliateCode.belongsTo(user_1.default, {
93
+ foreignKey: "creatorId",
94
+ as: "Creator",
95
+ targetKey: "id",
96
+ });
97
+ exports.default = AffiliateCode;
98
+ //# sourceMappingURL=affiliate-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"affiliate-code.js","sourceRoot":"","sources":["../../typed-model/affiliate-code.ts"],"names":[],"mappings":";;;;;AAAA,yCAMmB;AAEnB,kEAAuC;AACvC,wCAA2D;AAC3D,kDAA0B;AAE1B,mEAAmE;AACnE,MAAM,aAAc,SAAQ,iBAG3B;CAqBA;AAED,aAAa,CAAC,IAAI,CAChB;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,MAAM;QAC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EAAE;QAChB,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,oBAAoB;KAC5B;IACD,gBAAgB,EAAE;QAChB,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,oBAAoB;KAC5B;IACD,wBAAwB,EAAE;QACxB,IAAI,EAAE,qBAAS,CAAC,KAAK,CAAC,qBAAS,CAAC,MAAM,CAAC;QACvC,KAAK,EAAE,6BAA6B;QACpC,YAAY,EAAE,EAAE;KACjB;IAED,SAAS,EAAE,qBAAS,CAAC,IAAI;IACzB,SAAS,EAAE,qBAAS,CAAC,IAAI;CAC1B,EACD;IACE,SAAS,EAAE,iBAAiB;IAC5B,SAAS,EAAT,sBAAS;CACV,CACF,CAAC;AAEF,aAAa,CAAC,SAAS,CAAC,cAAI,EAAE;IAC5B,UAAU,EAAE,QAAQ;IACpB,EAAE,EAAE,MAAM;IACV,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,aAAa,CAAC,SAAS,CAAC,cAAI,EAAE;IAC5B,UAAU,EAAE,WAAW;IACvB,EAAE,EAAE,SAAS;IACb,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,kBAAe,aAAa,CAAC"}
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.pbSequelize = exports.CancellationReason = exports.CancellationOffer = exports.PrivateFeedUsers = exports.FeaturedCreator = exports.PostsOnIntegrations = exports.SubscriberTelegramIntegration = exports.TelegramIntegration = exports.StoresOnOrganizations = exports.UsersOnOrganizations = exports.Organization = exports.SubscriberDiscordIntegration = exports.DiscordIntegration = exports.SportOnPosts = exports.Sport = exports.Integration = exports.UsersOnCreators = exports.Store = exports.Application = exports.NotificationPreference = exports.SubscribersOnCreators = exports.SubscriptionPricingOptionOnCoupons = exports.User = exports.LeagueOnUsers = exports.League = exports.Withdrawal = exports.RecurlyAccount = exports.FreeSubscriptionPlan = exports.SubscriptionPricingOption = exports.SubscriptionCoupon = exports.SubscriptionPlanOnPost = exports.SubscriptionPlanOnUsers = exports.SubscriptionPlan = exports.PostsOnUsers = exports.Post = exports.Notification = exports.Media = exports.MediaAsset = exports.Transaction = exports.ContentLike = void 0;
6
+ exports.pbSequelize = exports.AffiliateCode = exports.CancellationReason = exports.CancellationOffer = exports.PrivateFeedUsers = exports.FeaturedCreator = exports.PostsOnIntegrations = exports.SubscriberTelegramIntegration = exports.TelegramIntegration = exports.StoresOnOrganizations = exports.UsersOnOrganizations = exports.Organization = exports.SubscriberDiscordIntegration = exports.DiscordIntegration = exports.SportOnPosts = exports.Sport = exports.Integration = exports.UsersOnCreators = exports.Store = exports.Application = exports.NotificationPreference = exports.SubscribersOnCreators = exports.SubscriptionPricingOptionOnCoupons = exports.User = exports.LeagueOnUsers = exports.League = exports.Withdrawal = exports.RecurlyAccount = exports.FreeSubscriptionPlan = exports.SubscriptionPricingOption = exports.SubscriptionCoupon = exports.SubscriptionPlanOnPost = exports.SubscriptionPlanOnUsers = exports.SubscriptionPlan = exports.PostsOnUsers = exports.Post = exports.Notification = exports.Media = exports.MediaAsset = exports.Transaction = exports.ContentLike = void 0;
7
7
  var content_like_1 = require("./content-like");
8
8
  Object.defineProperty(exports, "ContentLike", { enumerable: true, get: function () { return __importDefault(content_like_1).default; } });
9
9
  var transaction_1 = require("./transaction");
@@ -82,6 +82,8 @@ var cancellation_offer_1 = require("./cancellation_offer");
82
82
  Object.defineProperty(exports, "CancellationOffer", { enumerable: true, get: function () { return __importDefault(cancellation_offer_1).default; } });
83
83
  var cancellation_reason_1 = require("./cancellation_reason");
84
84
  Object.defineProperty(exports, "CancellationReason", { enumerable: true, get: function () { return __importDefault(cancellation_reason_1).default; } });
85
+ var affiliate_code_1 = require("./affiliate-code");
86
+ Object.defineProperty(exports, "AffiliateCode", { enumerable: true, get: function () { return __importDefault(affiliate_code_1).default; } });
85
87
  var pb_sequelize_1 = require("./pb-sequelize");
86
88
  Object.defineProperty(exports, "pbSequelize", { enumerable: true, get: function () { return __importDefault(pb_sequelize_1).default; } });
87
89
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../typed-model/index.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAwD;AAA/C,4HAAA,OAAO,OAAe;AAC/B,6CAAuD;AAA9C,2HAAA,OAAO,OAAe;AAC/B,6CAAsD;AAA7C,0HAAA,OAAO,OAAc;AAC9B,iCAA2C;AAAlC,+GAAA,OAAO,OAAS;AACzB,+CAAyD;AAAhD,6HAAA,OAAO,OAAgB;AAChC,+BAAyC;AAAhC,6GAAA,OAAO,OAAQ;AACxB,mDAA2D;AAAlD,+HAAA,OAAO,OAAgB;AAChC,yDAAkE;AAAzD,sIAAA,OAAO,OAAoB;AACpC,2EAAkF;AAAzE,sJAAA,OAAO,OAA2B;AAC3C,yEAAgF;AAAvE,oJAAA,OAAO,OAA0B;AAC1C,6DAAsE;AAA7D,0IAAA,OAAO,OAAsB;AACtC,6EAAqF;AAA5E,yJAAA,OAAO,OAA6B;AAC7C,mEAA2E;AAAlE,+IAAA,OAAO,OAAwB;AACxC,qDAA8D;AAArD,kIAAA,OAAO,OAAkB;AAClC,2CAAqD;AAA5C,yHAAA,OAAO,OAAc;AAC9B,mCAA6C;AAApC,iHAAA,OAAO,OAAU;AAC1B,qDAA6D;AAApD,iIAAA,OAAO,OAAiB;AACjC,+BAAyC;AAAhC,6GAAA,OAAO,OAAQ;AACxB,mGAAyG;AAAhG,6KAAA,OAAO,OAAsC;AACtD,qEAA6E;AAApE,iJAAA,OAAO,OAAyB;AACzC,qEAA8E;AAArE,kJAAA,OAAO,OAA0B;AAC1C,6CAAuD;AAA9C,2HAAA,OAAO,OAAe;AAC/B,iCAA2C;AAAlC,+GAAA,OAAO,OAAS;AACzB,yDAAiE;AAAxD,qIAAA,OAAO,OAAmB;AAC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package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@winible/winible-typed",
3
- "version": "2.22.9",
3
+ "version": "2.22.11",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/src/types.ts CHANGED
@@ -85,3 +85,13 @@ export enum ShouldRemoveSubscriberStatus {
85
85
  TRUE = "TRUE",
86
86
  FALSE = "FALSE",
87
87
  }
88
+
89
+ export enum RewardFrequency {
90
+ SINGLE = "SINGLE",
91
+ RECURRING = "RECURRING",
92
+ }
93
+
94
+ export enum RewardType {
95
+ CENTS = "CENTS",
96
+ PERCENTAGE = "PERCENTAGE",
97
+ }
@@ -0,0 +1,133 @@
1
+ import {
2
+ Model,
3
+ InferAttributes,
4
+ InferCreationAttributes,
5
+ CreationOptional,
6
+ DataTypes,
7
+ } from "sequelize";
8
+
9
+ import sequelize from "./pb-sequelize";
10
+ import { RewardFrequency, RewardType } from "../src/types";
11
+ import User from "./user";
12
+
13
+ // order of InferAttributes & InferCreationAttributes is important.
14
+ class AffiliateCode extends Model<
15
+ InferAttributes<AffiliateCode>,
16
+ InferCreationAttributes<AffiliateCode>
17
+ > {
18
+ // 'CreationOptional' is a special type that marks the field as optional
19
+ // when creating an instance of the model (such as using Model.create()).
20
+ declare id: CreationOptional<string>;
21
+ declare affiliateCode: string;
22
+ declare userId: string;
23
+ declare creatorId: string;
24
+ declare emailInvite: string;
25
+ declare pageViews: number;
26
+
27
+ declare rewardFrequency: RewardFrequency;
28
+ declare rewardType: RewardType;
29
+ declare rewardAmountInCents: number;
30
+ declare rewardAmountInPercent: number;
31
+
32
+ declare allPlansEligible: string;
33
+ declare allPostsEligible: string;
34
+ declare pricingOptionIdsEligible: string[];
35
+
36
+ declare createdAt: CreationOptional<Date>;
37
+ declare updatedAt: CreationOptional<Date>;
38
+ }
39
+
40
+ AffiliateCode.init(
41
+ {
42
+ id: {
43
+ type: DataTypes.BIGINT,
44
+ primaryKey: true,
45
+ allowNull: false,
46
+ defaultValue: sequelize.fn("next_id"),
47
+ },
48
+ affiliateCode: {
49
+ type: DataTypes.STRING,
50
+ field: "affiliate_code",
51
+ allowNull: false,
52
+ },
53
+ userId: {
54
+ type: DataTypes.BIGINT,
55
+ field: "user_id",
56
+ defaultValue: null,
57
+ references: {
58
+ model: User,
59
+ },
60
+ },
61
+ creatorId: {
62
+ type: DataTypes.BIGINT,
63
+ allowNull: false,
64
+ field: "creator_id",
65
+ references: {
66
+ model: User,
67
+ },
68
+ },
69
+ emailInvite: {
70
+ type: DataTypes.STRING,
71
+ allowNull: false,
72
+ field: "email_invite",
73
+ },
74
+ pageViews: {
75
+ type: DataTypes.INTEGER,
76
+ allowNull: false,
77
+ field: "page_views",
78
+ defaultValue: 0,
79
+ },
80
+
81
+ rewardFrequency: {
82
+ type: DataTypes.ENUM(...Object.values(RewardFrequency)),
83
+ field: "reward_frequency",
84
+ },
85
+ rewardType: {
86
+ type: DataTypes.ENUM(...Object.values(RewardType)),
87
+ field: "reward_type",
88
+ },
89
+ rewardAmountInCents: {
90
+ type: DataTypes.INTEGER,
91
+ field: "reward_amount_in_cents",
92
+ },
93
+ rewardAmountInPercent: {
94
+ type: DataTypes.FLOAT,
95
+ field: "reward_amount_in_percent",
96
+ },
97
+
98
+ allPlansEligible: {
99
+ type: DataTypes.STRING,
100
+ field: "all_plans_eligible",
101
+ },
102
+ allPostsEligible: {
103
+ type: DataTypes.STRING,
104
+ field: "all_posts_eligible",
105
+ },
106
+ pricingOptionIdsEligible: {
107
+ type: DataTypes.ARRAY(DataTypes.BIGINT),
108
+ field: "pricing_option_ids_eligible",
109
+ defaultValue: [],
110
+ },
111
+
112
+ createdAt: DataTypes.DATE,
113
+ updatedAt: DataTypes.DATE,
114
+ },
115
+ {
116
+ tableName: "affiliate_codes",
117
+ sequelize,
118
+ }
119
+ );
120
+
121
+ AffiliateCode.belongsTo(User, {
122
+ foreignKey: "userId",
123
+ as: "User",
124
+ targetKey: "id",
125
+ });
126
+
127
+ AffiliateCode.belongsTo(User, {
128
+ foreignKey: "creatorId",
129
+ as: "Creator",
130
+ targetKey: "id",
131
+ });
132
+
133
+ export default AffiliateCode;
@@ -37,4 +37,5 @@ export { default as FeaturedCreator } from "./featured-creator";
37
37
  export { default as PrivateFeedUsers } from "./private-feed-users";
38
38
  export { default as CancellationOffer } from "./cancellation_offer";
39
39
  export { default as CancellationReason } from "./cancellation_reason";
40
+ export { default as AffiliateCode } from "./affiliate-code";
40
41
  export { default as pbSequelize } from "./pb-sequelize";
@@ -1,51 +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
- const sequelize_1 = require("sequelize");
7
- const pb_sequelize_1 = __importDefault(require("./pb-sequelize"));
8
- const user_1 = __importDefault(require("./user"));
9
- // order of InferAttributes & InferCreationAttributes is important.
10
- class FeaturedCapper extends sequelize_1.Model {
11
- }
12
- FeaturedCapper.init({
13
- id: {
14
- type: sequelize_1.DataTypes.BIGINT,
15
- primaryKey: true,
16
- allowNull: false,
17
- defaultValue: pb_sequelize_1.default.fn("next_id"),
18
- },
19
- userId: {
20
- type: sequelize_1.DataTypes.BIGINT,
21
- allowNull: false,
22
- field: "user_id",
23
- references: {
24
- model: user_1.default,
25
- },
26
- },
27
- priority: {
28
- type: sequelize_1.DataTypes.SMALLINT,
29
- field: "priority",
30
- },
31
- customLabel: {
32
- type: sequelize_1.DataTypes.STRING,
33
- field: "custom_label",
34
- },
35
- createdAt: sequelize_1.DataTypes.DATE,
36
- updatedAt: sequelize_1.DataTypes.DATE,
37
- }, {
38
- tableName: "featured_cappers",
39
- sequelize: pb_sequelize_1.default,
40
- });
41
- user_1.default.hasOne(FeaturedCapper, {
42
- foreignKey: "userId",
43
- sourceKey: "id",
44
- });
45
- FeaturedCapper.hasOne(user_1.default, {
46
- foreignKey: "id",
47
- sourceKey: "userId",
48
- onDelete: "NO ACTION",
49
- });
50
- exports.default = FeaturedCapper;
51
- //# sourceMappingURL=featured-capper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"featured-capper.js","sourceRoot":"","sources":["../../typed-model/featured-capper.ts"],"names":[],"mappings":";;;;;AAAA,yCAMmB;AAEnB,kEAAuC;AACvC,kDAA0B;AAE1B,mEAAmE;AACnE,MAAM,cAAe,SAAQ,iBAG5B;CAUA;AAED,cAAc,CAAC,IAAI,CACjB;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,sBAAS,CAAC,EAAE,CAAC,SAAS,CAAC;KACtC;IACD,MAAM,EAAE;QACN,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE;YACV,KAAK,EAAE,cAAI;SACZ;KACF;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,qBAAS,CAAC,QAAQ;QACxB,KAAK,EAAE,UAAU;KAClB;IACD,WAAW,EAAE;QACX,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,cAAc;KACtB;IAED,SAAS,EAAE,qBAAS,CAAC,IAAI;IACzB,SAAS,EAAE,qBAAS,CAAC,IAAI;CAC1B,EACD;IACE,SAAS,EAAE,kBAAkB;IAC7B,SAAS,EAAT,sBAAS;CACV,CACF,CAAC;AAEF,cAAI,CAAC,MAAM,CAAC,cAAc,EAAE;IAC1B,UAAU,EAAE,QAAQ;IACpB,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,cAAc,CAAC,MAAM,CAAC,cAAI,EAAE;IAC1B,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,QAAQ;IACnB,QAAQ,EAAE,WAAW;CACtB,CAAC,CAAC;AAEH,kBAAe,cAAc,CAAC"}