@pofky/asc-mcp 1.2.0 → 1.8.0

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 (119) hide show
  1. package/LIMITATIONS.md +41 -0
  2. package/README.md +91 -10
  3. package/USER_GUIDE.md +185 -0
  4. package/dist/client.d.ts +5 -0
  5. package/dist/client.d.ts.map +1 -1
  6. package/dist/client.js +58 -1
  7. package/dist/client.js.map +1 -1
  8. package/dist/doctor.d.ts +28 -0
  9. package/dist/doctor.d.ts.map +1 -0
  10. package/dist/doctor.js +178 -0
  11. package/dist/doctor.js.map +1 -0
  12. package/dist/editable.d.ts +9 -0
  13. package/dist/editable.d.ts.map +1 -0
  14. package/dist/editable.js +20 -0
  15. package/dist/editable.js.map +1 -0
  16. package/dist/elicitation.d.ts +39 -0
  17. package/dist/elicitation.d.ts.map +1 -0
  18. package/dist/elicitation.js +63 -0
  19. package/dist/elicitation.js.map +1 -0
  20. package/dist/gate.d.ts +8 -0
  21. package/dist/gate.d.ts.map +1 -0
  22. package/dist/gate.js +17 -0
  23. package/dist/gate.js.map +1 -0
  24. package/dist/index.js +308 -16
  25. package/dist/index.js.map +1 -1
  26. package/dist/license.js +1 -1
  27. package/dist/prompts.d.ts.map +1 -1
  28. package/dist/prompts.js +101 -0
  29. package/dist/prompts.js.map +1 -1
  30. package/dist/sampling.d.ts +53 -0
  31. package/dist/sampling.d.ts.map +1 -0
  32. package/dist/sampling.js +109 -0
  33. package/dist/sampling.js.map +1 -0
  34. package/dist/setup.d.ts +19 -0
  35. package/dist/setup.d.ts.map +1 -0
  36. package/dist/setup.js +153 -0
  37. package/dist/setup.js.map +1 -0
  38. package/dist/tools/age-rating.d.ts +14 -0
  39. package/dist/tools/age-rating.d.ts.map +1 -0
  40. package/dist/tools/age-rating.js +125 -0
  41. package/dist/tools/age-rating.js.map +1 -0
  42. package/dist/tools/app-details.js +2 -2
  43. package/dist/tools/availability.d.ts +20 -0
  44. package/dist/tools/availability.d.ts.map +1 -0
  45. package/dist/tools/availability.js +96 -0
  46. package/dist/tools/availability.js.map +1 -0
  47. package/dist/tools/builds.d.ts +26 -0
  48. package/dist/tools/builds.d.ts.map +1 -0
  49. package/dist/tools/builds.js +108 -0
  50. package/dist/tools/builds.js.map +1 -0
  51. package/dist/tools/draft-review-response.d.ts +37 -0
  52. package/dist/tools/draft-review-response.d.ts.map +1 -0
  53. package/dist/tools/draft-review-response.js +236 -0
  54. package/dist/tools/draft-review-response.js.map +1 -0
  55. package/dist/tools/eu-trader.d.ts +12 -0
  56. package/dist/tools/eu-trader.d.ts.map +1 -0
  57. package/dist/tools/eu-trader.js +25 -0
  58. package/dist/tools/eu-trader.js.map +1 -0
  59. package/dist/tools/guide.d.ts +38 -0
  60. package/dist/tools/guide.d.ts.map +1 -0
  61. package/dist/tools/guide.js +273 -0
  62. package/dist/tools/guide.js.map +1 -0
  63. package/dist/tools/iap.d.ts +43 -0
  64. package/dist/tools/iap.d.ts.map +1 -0
  65. package/dist/tools/iap.js +360 -0
  66. package/dist/tools/iap.js.map +1 -0
  67. package/dist/tools/list-apps.js +1 -1
  68. package/dist/tools/list-reviews.js +2 -2
  69. package/dist/tools/local-build.d.ts +26 -0
  70. package/dist/tools/local-build.d.ts.map +1 -0
  71. package/dist/tools/local-build.js +100 -0
  72. package/dist/tools/local-build.js.map +1 -0
  73. package/dist/tools/privacy.d.ts +15 -0
  74. package/dist/tools/privacy.d.ts.map +1 -0
  75. package/dist/tools/privacy.js +32 -0
  76. package/dist/tools/privacy.js.map +1 -0
  77. package/dist/tools/release-control.d.ts +22 -0
  78. package/dist/tools/release-control.d.ts.map +1 -0
  79. package/dist/tools/release-control.js +85 -0
  80. package/dist/tools/release-control.js.map +1 -0
  81. package/dist/tools/release-preflight.d.ts.map +1 -1
  82. package/dist/tools/release-preflight.js +139 -0
  83. package/dist/tools/release-preflight.js.map +1 -1
  84. package/dist/tools/review-screenshot.d.ts +14 -0
  85. package/dist/tools/review-screenshot.d.ts.map +1 -0
  86. package/dist/tools/review-screenshot.js +72 -0
  87. package/dist/tools/review-screenshot.js.map +1 -0
  88. package/dist/tools/review-status.js +2 -2
  89. package/dist/tools/sales-report.js +3 -3
  90. package/dist/tools/sales-report.js.map +1 -1
  91. package/dist/tools/screenshots.d.ts +15 -0
  92. package/dist/tools/screenshots.d.ts.map +1 -0
  93. package/dist/tools/screenshots.js +106 -0
  94. package/dist/tools/screenshots.js.map +1 -0
  95. package/dist/tools/signing.d.ts +21 -0
  96. package/dist/tools/signing.d.ts.map +1 -0
  97. package/dist/tools/signing.js +101 -0
  98. package/dist/tools/signing.js.map +1 -0
  99. package/dist/tools/submission.d.ts +47 -0
  100. package/dist/tools/submission.d.ts.map +1 -0
  101. package/dist/tools/submission.js +199 -0
  102. package/dist/tools/submission.js.map +1 -0
  103. package/dist/tools/testflight.d.ts +20 -0
  104. package/dist/tools/testflight.d.ts.map +1 -0
  105. package/dist/tools/testflight.js +75 -0
  106. package/dist/tools/testflight.js.map +1 -0
  107. package/dist/tools/triage-reviews.d.ts +35 -0
  108. package/dist/tools/triage-reviews.d.ts.map +1 -0
  109. package/dist/tools/triage-reviews.js +194 -0
  110. package/dist/tools/triage-reviews.js.map +1 -0
  111. package/dist/tools/update-version-metadata.d.ts +17 -0
  112. package/dist/tools/update-version-metadata.d.ts.map +1 -0
  113. package/dist/tools/update-version-metadata.js +148 -0
  114. package/dist/tools/update-version-metadata.js.map +1 -0
  115. package/dist/tools/version-control.d.ts +21 -0
  116. package/dist/tools/version-control.d.ts.map +1 -0
  117. package/dist/tools/version-control.js +144 -0
  118. package/dist/tools/version-control.js.map +1 -0
  119. package/package.json +5 -2
@@ -0,0 +1,21 @@
1
+ import type { ASCClient } from "../client.js";
2
+ import type { Tier } from "../types.js";
3
+ export interface SetupSigningArgs {
4
+ app_id: string;
5
+ /** Where to write the generated ExportOptions.plist. Defaults to ./ExportOptions.plist. */
6
+ output_plist?: string;
7
+ }
8
+ /**
9
+ * Prepare an App Store binary export WITHOUT needing the cloud-signing
10
+ * permission that many API keys lack. It downloads the app's existing
11
+ * IOS_APP_STORE provisioning profiles (main app + extensions) from App Store
12
+ * Connect, installs them where Xcode looks, and writes a manual-signing
13
+ * ExportOptions.plist that build_and_archive can use directly.
14
+ *
15
+ * Prerequisite: an "Apple Distribution" certificate must already be in the
16
+ * login keychain (created once in Xcode > Settings > Accounts > Manage
17
+ * Certificates, or the Developer portal). Certificate creation is not exposed
18
+ * to API keys.
19
+ */
20
+ export declare function setupAppStoreSigning(client: ASCClient, args: SetupSigningArgs, tier: Tier): Promise<string>;
21
+ //# sourceMappingURL=signing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../../src/tools/signing.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AA4BxC,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,2FAA2F;IAC3F,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,gBAAgB,EACtB,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,MAAM,CAAC,CAqEjB"}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setupAppStoreSigning = setupAppStoreSigning;
4
+ const node_fs_1 = require("node:fs");
5
+ const node_os_1 = require("node:os");
6
+ const node_path_1 = require("node:path");
7
+ const gate_js_1 = require("../gate.js");
8
+ /**
9
+ * The downloaded profile is a CMS (PKCS7) blob that embeds an XML plist in
10
+ * plaintext. Pull the fields we need without shelling out to `security`.
11
+ */
12
+ function parseProfile(contentB64) {
13
+ const buf = Buffer.from(contentB64, "base64").toString("latin1");
14
+ const start = buf.indexOf("<plist");
15
+ const end = buf.indexOf("</plist>");
16
+ if (start < 0 || end < 0)
17
+ return {};
18
+ const xml = buf.slice(start, end + 8);
19
+ const teamId = xml.match(/<key>TeamIdentifier<\/key>\s*<array>\s*<string>([^<]+)<\/string>/)?.[1];
20
+ const name = xml.match(/<key>Name<\/key>\s*<string>([^<]+)<\/string>/)?.[1];
21
+ const appId = xml.match(/<key>application-identifier<\/key>\s*<string>([^<]+)<\/string>/)?.[1];
22
+ // application-identifier is "TEAMID.com.bundle.id"; strip the team prefix.
23
+ const bundleId = appId && teamId && appId.startsWith(teamId + ".") ? appId.slice(teamId.length + 1) : appId;
24
+ return { teamId, name, bundleId };
25
+ }
26
+ /**
27
+ * Prepare an App Store binary export WITHOUT needing the cloud-signing
28
+ * permission that many API keys lack. It downloads the app's existing
29
+ * IOS_APP_STORE provisioning profiles (main app + extensions) from App Store
30
+ * Connect, installs them where Xcode looks, and writes a manual-signing
31
+ * ExportOptions.plist that build_and_archive can use directly.
32
+ *
33
+ * Prerequisite: an "Apple Distribution" certificate must already be in the
34
+ * login keychain (created once in Xcode > Settings > Accounts > Manage
35
+ * Certificates, or the Developer portal). Certificate creation is not exposed
36
+ * to API keys.
37
+ */
38
+ async function setupAppStoreSigning(client, args, tier) {
39
+ const gate = (0, gate_js_1.requirePro)(tier, "Preparing App Store signing");
40
+ if (gate)
41
+ return gate;
42
+ // The app's bundle id is the prefix every profile we want must match.
43
+ const appRes = await client.get(`/v1/apps/${args.app_id}`, {
44
+ "fields[apps]": "bundleId",
45
+ });
46
+ const app = Array.isArray(appRes.data) ? appRes.data[0] : appRes.data;
47
+ const appBundle = app?.attributes?.bundleId;
48
+ if (!appBundle)
49
+ return "Could not resolve the app's bundle id.";
50
+ const profRes = await client.getAll("/v1/profiles", {
51
+ "fields[profiles]": "name,uuid,profileContent,profileType",
52
+ limit: "200",
53
+ });
54
+ const profiles = (Array.isArray(profRes.data) ? profRes.data : [profRes.data]).filter(Boolean);
55
+ const dir = (0, node_path_1.join)((0, node_os_1.homedir)(), "Library", "MobileDevice", "Provisioning Profiles");
56
+ (0, node_fs_1.mkdirSync)(dir, { recursive: true });
57
+ const installed = [];
58
+ let teamId;
59
+ for (const p of profiles) {
60
+ if (p.attributes.profileType !== "IOS_APP_STORE")
61
+ continue;
62
+ const meta = parseProfile(p.attributes.profileContent);
63
+ if (!meta.bundleId)
64
+ continue;
65
+ // Keep the main app bundle and any extension under it (e.g. .GlasynWidget).
66
+ if (meta.bundleId !== appBundle && !meta.bundleId.startsWith(appBundle + "."))
67
+ continue;
68
+ teamId = teamId ?? meta.teamId;
69
+ (0, node_fs_1.writeFileSync)((0, node_path_1.join)(dir, `${p.attributes.uuid}.mobileprovision`), Buffer.from(p.attributes.profileContent, "base64"));
70
+ installed.push({ bundleId: meta.bundleId, name: p.attributes.name });
71
+ }
72
+ if (installed.length === 0) {
73
+ return (`No IOS_APP_STORE provisioning profiles found for ${appBundle}.\n` +
74
+ "Create one in the Developer portal (Certificates, Identifiers & Profiles > Profiles > +, " +
75
+ "App Store distribution) or let Xcode generate it once via Product > Archive > Distribute App. " +
76
+ "Profile creation is not available to API keys.");
77
+ }
78
+ if (!teamId)
79
+ return "Installed profiles but could not read the team id from them.";
80
+ const mappings = installed
81
+ .map((m) => ` <key>${m.bundleId}</key><string>${m.name}</string>`)
82
+ .join("\n");
83
+ const plist = `<?xml version="1.0" encoding="UTF-8"?>\n` +
84
+ `<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n` +
85
+ `<plist version="1.0">\n<dict>\n` +
86
+ ` <key>method</key><string>app-store-connect</string>\n` +
87
+ ` <key>teamID</key><string>${teamId}</string>\n` +
88
+ ` <key>signingStyle</key><string>manual</string>\n` +
89
+ ` <key>signingCertificate</key><string>Apple Distribution</string>\n` +
90
+ ` <key>provisioningProfiles</key>\n <dict>\n${mappings}\n </dict>\n` +
91
+ ` <key>manageAppVersionAndBuildNumber</key><false/>\n` +
92
+ ` <key>uploadSymbols</key><true/>\n` +
93
+ `</dict>\n</plist>\n`;
94
+ const outPath = args.output_plist || (0, node_path_1.join)(process.cwd(), "ExportOptions.plist");
95
+ (0, node_fs_1.writeFileSync)(outPath, plist);
96
+ return (`App Store signing ready (team ${teamId}).\n` +
97
+ `Installed ${installed.length} profile(s): ${installed.map((m) => `${m.bundleId} -> "${m.name}"`).join(", ")}.\n` +
98
+ `Wrote ExportOptions.plist: ${outPath}\n\n` +
99
+ `Next: build_and_archive with export_options_plist set to this path, then upload_binary.`);
100
+ }
101
+ //# sourceMappingURL=signing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signing.js","sourceRoot":"","sources":["../../src/tools/signing.ts"],"names":[],"mappings":";;AAkDA,oDAyEC;AA3HD,qCAAmD;AACnD,qCAAkC;AAClC,yCAAiC;AAGjC,wCAAwC;AASxC;;;GAGG;AACH,SAAS,YAAY,CAAC,UAAkB;IACtC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjE,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACpC,IAAI,KAAK,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IACpC,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,kEAAkE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClG,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,8CAA8C,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5E,MAAM,KAAK,GAAG,GAAG,CAAC,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SAAS,KAAK;YAClE,2FAA2F;YAC3F,gGAAgG;YAChG,gDAAgD,CACjD,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,MAAM;QAAE,OAAO,8DAA8D,CAAC;IAEnF,MAAM,QAAQ,GAAG,SAAS;SACvB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,QAAQ,iBAAiB,CAAC,CAAC,IAAI,WAAW,CAAC;SACpE,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,MAAM,KAAK,GACT,0CAA0C;QAC1C,0GAA0G;QAC1G,iCAAiC;QACjC,yDAAyD;QACzD,8BAA8B,MAAM,aAAa;QACjD,oDAAoD;QACpD,sEAAsE;QACtE,gDAAgD,QAAQ,eAAe;QACvE,uDAAuD;QACvD,qCAAqC;QACrC,qBAAqB,CAAC;IAExB,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,IAAI,IAAA,gBAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,qBAAqB,CAAC,CAAC;IAChF,IAAA,uBAAa,EAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAE9B,OAAO,CACL,iCAAiC,MAAM,MAAM;QAC7C,aAAa,SAAS,CAAC,MAAM,gBAAgB,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,QAAQ,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;QACjH,8BAA8B,OAAO,MAAM;QAC3C,yFAAyF,CAC1F,CAAC;AACJ,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { type ASCClient } from "../client.js";
2
+ import type { Tier } from "../types.js";
3
+ export interface AppMetadataArgs {
4
+ app_id: string;
5
+ primary_category?: string;
6
+ secondary_category?: string;
7
+ copyright?: string;
8
+ /** DOES_NOT_USE_THIRD_PARTY_CONTENT | USES_THIRD_PARTY_CONTENT */
9
+ content_rights?: "DOES_NOT_USE_THIRD_PARTY_CONTENT" | "USES_THIRD_PARTY_CONTENT";
10
+ /** Export compliance: true if the app uses non-exempt encryption (most apps: false). */
11
+ uses_non_exempt_encryption?: boolean;
12
+ }
13
+ /**
14
+ * Set the submission-required app basics that App Review checks but which are
15
+ * easy to miss: primary/secondary category, copyright line, content-rights
16
+ * declaration, and export-compliance (encryption). Each is applied only if
17
+ * provided. Categories are appCategory ids like HEALTH_AND_FITNESS.
18
+ */
19
+ export declare function setAppMetadata(client: ASCClient, args: AppMetadataArgs, tier: Tier): Promise<string>;
20
+ export interface AppPriceArgs {
21
+ app_id: string;
22
+ /** 0 for a free app, or a USA price tier in dollars (e.g. 1.99). */
23
+ price_usd: number;
24
+ }
25
+ /**
26
+ * Set the app's base price by creating its price schedule (USA base territory,
27
+ * auto-equalized to all others). Use price_usd: 0 for a free app. Required:
28
+ * an app cannot be submitted until pricing is set.
29
+ */
30
+ export declare function setAppPrice(client: ASCClient, args: AppPriceArgs, tier: Tier): Promise<string>;
31
+ export interface ReviewContactArgs {
32
+ app_id: string;
33
+ first_name: string;
34
+ last_name: string;
35
+ phone: string;
36
+ email: string;
37
+ notes?: string;
38
+ demo_account_name?: string;
39
+ demo_account_password?: string;
40
+ }
41
+ /**
42
+ * Set the App Review contact + (optional) demo account on the editable version's
43
+ * appStoreReviewDetail. Required before submission. Idempotent: creates the
44
+ * detail if absent, otherwise updates it.
45
+ */
46
+ export declare function setReviewContact(client: ASCClient, args: ReviewContactArgs, tier: Tier): Promise<string>;
47
+ //# sourceMappingURL=submission.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submission.d.ts","sourceRoot":"","sources":["../../src/tools/submission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAqBxC,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,cAAc,CAAC,EAAE,kCAAkC,GAAG,0BAA0B,CAAC;IACjF,wFAAwF;IACxF,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,eAAe,EACrB,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,MAAM,CAAC,CA8DjB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,MAAM,CAAC,CAiDjB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,iBAAiB,EACvB,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,MAAM,CAAC,CAyCjB"}
@@ -0,0 +1,199 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setAppMetadata = setAppMetadata;
4
+ exports.setAppPrice = setAppPrice;
5
+ exports.setReviewContact = setReviewContact;
6
+ const client_js_1 = require("../client.js");
7
+ const gate_js_1 = require("../gate.js");
8
+ const EDITABLE = new Set([
9
+ "PREPARE_FOR_SUBMISSION",
10
+ "DEVELOPER_REJECTED",
11
+ "REJECTED",
12
+ "METADATA_REJECTED",
13
+ "INVALID_BINARY",
14
+ ]);
15
+ async function editableVersionId(client, appId) {
16
+ const res = await client.get(`/v1/apps/${appId}/appStoreVersions`, { "fields[appStoreVersions]": "versionString,appStoreState", limit: "5" });
17
+ const versions = (Array.isArray(res.data) ? res.data : [res.data]).filter(Boolean);
18
+ const v = versions.find((x) => EDITABLE.has(x.attributes.appStoreState));
19
+ return v ? { id: v.id, version: v.attributes.versionString } : null;
20
+ }
21
+ /**
22
+ * Set the submission-required app basics that App Review checks but which are
23
+ * easy to miss: primary/secondary category, copyright line, content-rights
24
+ * declaration, and export-compliance (encryption). Each is applied only if
25
+ * provided. Categories are appCategory ids like HEALTH_AND_FITNESS.
26
+ */
27
+ async function setAppMetadata(client, args, tier) {
28
+ const gate = (0, gate_js_1.requirePro)(tier, "Setting app submission metadata");
29
+ if (gate)
30
+ return gate;
31
+ const changes = [];
32
+ // Categories live on appInfos relationships.
33
+ if (args.primary_category || args.secondary_category) {
34
+ const infoRes = await client.get(`/v1/apps/${args.app_id}/appInfos`, { limit: "1" });
35
+ const appInfo = Array.isArray(infoRes.data) ? infoRes.data[0] : infoRes.data;
36
+ if (!appInfo)
37
+ return "Could not resolve the app's appInfo.";
38
+ const infoId = appInfo.id;
39
+ const rels = {};
40
+ if (args.primary_category)
41
+ rels.primaryCategory = { data: { type: "appCategories", id: args.primary_category } };
42
+ if (args.secondary_category)
43
+ rels.secondaryCategory = { data: { type: "appCategories", id: args.secondary_category } };
44
+ await client.patch(`/v1/appInfos/${infoId}`, {
45
+ data: { type: "appInfos", id: infoId, relationships: rels },
46
+ });
47
+ if (args.primary_category)
48
+ changes.push(`primary category ${args.primary_category}`);
49
+ if (args.secondary_category)
50
+ changes.push(`secondary category ${args.secondary_category}`);
51
+ }
52
+ // Copyright is a version attribute.
53
+ if (args.copyright !== undefined) {
54
+ const v = await editableVersionId(client, args.app_id);
55
+ if (!v)
56
+ return "No editable version to set copyright on.";
57
+ await client.patch(`/v1/appStoreVersions/${v.id}`, {
58
+ data: { type: "appStoreVersions", id: v.id, attributes: { copyright: args.copyright } },
59
+ });
60
+ changes.push(`copyright "${args.copyright}"`);
61
+ }
62
+ // Content-rights is an app attribute.
63
+ if (args.content_rights) {
64
+ await client.patch(`/v1/apps/${args.app_id}`, {
65
+ data: { type: "apps", id: args.app_id, attributes: { contentRightsDeclaration: args.content_rights } },
66
+ });
67
+ changes.push(`content rights ${args.content_rights}`);
68
+ }
69
+ // Export compliance lives on the build (newest).
70
+ if (args.uses_non_exempt_encryption !== undefined) {
71
+ const buildRes = await client.get("/v1/builds", {
72
+ "filter[app]": args.app_id,
73
+ "fields[builds]": "version",
74
+ sort: "-uploadedDate",
75
+ limit: "1",
76
+ });
77
+ const build = Array.isArray(buildRes.data) ? buildRes.data[0] : buildRes.data;
78
+ if (build) {
79
+ await client.patch(`/v1/builds/${build.id}`, {
80
+ data: {
81
+ type: "builds",
82
+ id: build.id,
83
+ attributes: { usesNonExemptEncryption: args.uses_non_exempt_encryption },
84
+ },
85
+ });
86
+ changes.push(`export compliance usesNonExemptEncryption=${args.uses_non_exempt_encryption}`);
87
+ }
88
+ }
89
+ if (!changes.length)
90
+ return "Nothing to set. Provide at least one of category/copyright/content-rights/encryption.";
91
+ return "App submission metadata set:\n" + changes.map((c) => `- ${c}`).join("\n");
92
+ }
93
+ /**
94
+ * Set the app's base price by creating its price schedule (USA base territory,
95
+ * auto-equalized to all others). Use price_usd: 0 for a free app. Required:
96
+ * an app cannot be submitted until pricing is set.
97
+ */
98
+ async function setAppPrice(client, args, tier) {
99
+ const gate = (0, gate_js_1.requirePro)(tier, "Setting the app price");
100
+ if (gate)
101
+ return gate;
102
+ // Find the matching USA app price point.
103
+ const res = await client.getAll(`/v1/apps/${args.app_id}/appPricePoints`, { "filter[territory]": "USA", limit: "200" });
104
+ const points = (Array.isArray(res.data) ? res.data : [res.data]).filter(Boolean);
105
+ let best = null;
106
+ for (const p of points) {
107
+ const price = Number(p.attributes.customerPrice);
108
+ const diff = Math.abs(price - args.price_usd);
109
+ if (!best || diff < best.diff)
110
+ best = { id: p.id, price: p.attributes.customerPrice, diff };
111
+ }
112
+ if (!best)
113
+ return "No matching app price point found.";
114
+ const tempId = "${price-1}";
115
+ try {
116
+ await client.post("/v1/appPriceSchedules", {
117
+ data: {
118
+ type: "appPriceSchedules",
119
+ relationships: {
120
+ app: { data: { type: "apps", id: args.app_id } },
121
+ baseTerritory: { data: { type: "territories", id: "USA" } },
122
+ manualPrices: { data: [{ type: "appPrices", id: tempId }] },
123
+ },
124
+ },
125
+ included: [
126
+ {
127
+ type: "appPrices",
128
+ id: tempId,
129
+ attributes: { startDate: null },
130
+ relationships: {
131
+ appPricePoint: { data: { type: "appPricePoints", id: best.id } },
132
+ },
133
+ },
134
+ ],
135
+ });
136
+ }
137
+ catch (err) {
138
+ if (err instanceof client_js_1.ASCAPIError && /already exists|conflict/i.test(err.body)) {
139
+ return `App price schedule already exists. Current base ≈ $${best.price}.`;
140
+ }
141
+ throw err;
142
+ }
143
+ return best.price === "0.0" || Number(best.price) === 0
144
+ ? "App price set to Free (all territories)."
145
+ : `App base price set to $${best.price}/USA (auto-equalized to all territories).`;
146
+ }
147
+ /**
148
+ * Set the App Review contact + (optional) demo account on the editable version's
149
+ * appStoreReviewDetail. Required before submission. Idempotent: creates the
150
+ * detail if absent, otherwise updates it.
151
+ */
152
+ async function setReviewContact(client, args, tier) {
153
+ const gate = (0, gate_js_1.requirePro)(tier, "Setting the App Review contact");
154
+ if (gate)
155
+ return gate;
156
+ const v = await editableVersionId(client, args.app_id);
157
+ if (!v)
158
+ return "No editable version to attach review details to.";
159
+ const attributes = {
160
+ contactFirstName: args.first_name,
161
+ contactLastName: args.last_name,
162
+ contactPhone: args.phone,
163
+ contactEmail: args.email,
164
+ demoAccountRequired: Boolean(args.demo_account_name),
165
+ };
166
+ if (args.notes)
167
+ attributes.notes = args.notes;
168
+ if (args.demo_account_name)
169
+ attributes.demoAccountName = args.demo_account_name;
170
+ if (args.demo_account_password)
171
+ attributes.demoAccountPassword = args.demo_account_password;
172
+ // Does a review detail already exist for this version?
173
+ let existingId = null;
174
+ try {
175
+ const ex = await client.get(`/v1/appStoreVersions/${v.id}/appStoreReviewDetail`);
176
+ if (ex.data && !Array.isArray(ex.data))
177
+ existingId = ex.data.id;
178
+ }
179
+ catch (err) {
180
+ if (!(err instanceof client_js_1.ASCAPIError && err.status === 404))
181
+ throw err;
182
+ }
183
+ if (existingId) {
184
+ await client.patch(`/v1/appStoreReviewDetails/${existingId}`, {
185
+ data: { type: "appStoreReviewDetails", id: existingId, attributes },
186
+ });
187
+ }
188
+ else {
189
+ await client.post("/v1/appStoreReviewDetails", {
190
+ data: {
191
+ type: "appStoreReviewDetails",
192
+ attributes,
193
+ relationships: { appStoreVersion: { data: { type: "appStoreVersions", id: v.id } } },
194
+ },
195
+ });
196
+ }
197
+ return `App Review contact set for version ${v.version}: ${args.first_name} ${args.last_name}, ${args.email}.`;
198
+ }
199
+ //# sourceMappingURL=submission.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submission.js","sourceRoot":"","sources":["../../src/tools/submission.ts"],"names":[],"mappings":";;AAuCA,wCAkEC;AAaD,kCAqDC;AAkBD,4CA6CC;AA1OD,4CAA2D;AAE3D,wCAAwC;AAExC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;IACvB,wBAAwB;IACxB,oBAAoB;IACpB,UAAU;IACV,mBAAmB;IACnB,gBAAgB;CACjB,CAAC,CAAC;AAEH,KAAK,UAAU,iBAAiB,CAAC,MAAiB,EAAE,KAAa;IAC/D,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAC1B,YAAY,KAAK,mBAAmB,EACpC,EAAE,0BAA0B,EAAE,6BAA6B,EAAE,KAAK,EAAE,GAAG,EAAE,CAC1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U,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;IAClE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,CAAC,GAAG,YAAY,uBAAW,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC;YAAE,MAAM,GAAG,CAAC;IACrE,CAAC;IAED,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,MAAM,CAAC,KAAK,CAAC,6BAA6B,UAAU,EAAE,EAAE;YAC5D,IAAI,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE;SACpE,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,MAAM,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE;YAC7C,IAAI,EAAE;gBACJ,IAAI,EAAE,uBAAuB;gBAC7B,UAAU;gBACV,aAAa,EAAE,EAAE,eAAe,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE;aACrF;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,sCAAsC,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,KAAK,GAAG,CAAC;AACjH,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { ASCClient } from "../client.js";
2
+ import type { Tier } from "../types.js";
3
+ /** List the app's TestFlight beta groups. */
4
+ export declare function listBetaGroups(client: ASCClient, args: {
5
+ app_id: string;
6
+ }, tier: Tier): Promise<string>;
7
+ /** Assign a build to a TestFlight beta group so testers can install it. */
8
+ export declare function assignBuildToGroup(client: ASCClient, args: {
9
+ app_id: string;
10
+ group_id: string;
11
+ build_id?: string;
12
+ }, tier: Tier): Promise<string>;
13
+ /** Invite an external tester by email and add them to a beta group. */
14
+ export declare function inviteBetaTester(client: ASCClient, args: {
15
+ group_id: string;
16
+ email: string;
17
+ first_name?: string;
18
+ last_name?: string;
19
+ }, tier: Tier): Promise<string>;
20
+ //# sourceMappingURL=testflight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testflight.d.ts","sourceRoot":"","sources":["../../src/tools/testflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAYxC,6CAA6C;AAC7C,wBAAsB,cAAc,CAClC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,EACxB,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED,2EAA2E;AAC3E,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,EAC7D,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,MAAM,CAAC,CAyBjB;AAED,uEAAuE;AACvE,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,EAClF,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,MAAM,CAAC,CAsBjB"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listBetaGroups = listBetaGroups;
4
+ exports.assignBuildToGroup = assignBuildToGroup;
5
+ exports.inviteBetaTester = inviteBetaTester;
6
+ const gate_js_1 = require("../gate.js");
7
+ /** List the app's TestFlight beta groups. */
8
+ async function listBetaGroups(client, args, tier) {
9
+ const gate = (0, gate_js_1.requirePro)(tier, "Listing beta groups");
10
+ if (gate)
11
+ return gate;
12
+ const res = await client.get("/v1/betaGroups", {
13
+ "filter[app]": args.app_id,
14
+ "fields[betaGroups]": "name,isInternalGroup",
15
+ limit: "50",
16
+ });
17
+ const groups = Array.isArray(res.data) ? res.data : [res.data];
18
+ if (!groups.length)
19
+ return "No beta groups. Create one in TestFlight first.";
20
+ return ("Beta groups:\n" +
21
+ groups
22
+ .map((g) => `- ${g.attributes.name} [${g.id}]${g.attributes.isInternalGroup ? " (internal)" : ""}`)
23
+ .join("\n"));
24
+ }
25
+ /** Assign a build to a TestFlight beta group so testers can install it. */
26
+ async function assignBuildToGroup(client, args, tier) {
27
+ const gate = (0, gate_js_1.requirePro)(tier, "Assigning a build to TestFlight");
28
+ if (gate)
29
+ return gate;
30
+ let buildId = args.build_id;
31
+ let buildVersion = buildId ?? "";
32
+ if (!buildId) {
33
+ const res = await client.get("/v1/builds", {
34
+ "filter[app]": args.app_id,
35
+ "filter[processingState]": "VALID",
36
+ sort: "-uploadedDate",
37
+ "fields[builds]": "version",
38
+ limit: "1",
39
+ });
40
+ const builds = Array.isArray(res.data) ? res.data : [res.data];
41
+ const newest = builds[0];
42
+ if (!newest)
43
+ return "No processed (VALID) build available. Check list_builds.";
44
+ buildId = newest.id;
45
+ buildVersion = newest.attributes.version;
46
+ }
47
+ await client.post(`/v1/betaGroups/${args.group_id}/relationships/builds`, {
48
+ data: [{ type: "builds", id: buildId }],
49
+ });
50
+ return `Assigned build ${buildVersion} [${buildId}] to beta group ${args.group_id}. Testers can now install it.`;
51
+ }
52
+ /** Invite an external tester by email and add them to a beta group. */
53
+ async function inviteBetaTester(client, args, tier) {
54
+ const gate = (0, gate_js_1.requirePro)(tier, "Inviting a beta tester");
55
+ if (gate)
56
+ return gate;
57
+ if (!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(args.email)) {
58
+ return `"${args.email}" is not a valid email.`;
59
+ }
60
+ await client.post("/v1/betaTesters", {
61
+ data: {
62
+ type: "betaTesters",
63
+ attributes: {
64
+ email: args.email,
65
+ firstName: args.first_name ?? "",
66
+ lastName: args.last_name ?? "",
67
+ },
68
+ relationships: {
69
+ betaGroups: { data: [{ type: "betaGroups", id: args.group_id }] },
70
+ },
71
+ },
72
+ });
73
+ return `Invited ${args.email} to beta group ${args.group_id}. Apple emails them a TestFlight invite.`;
74
+ }
75
+ //# sourceMappingURL=testflight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testflight.js","sourceRoot":"","sources":["../../src/tools/testflight.ts"],"names":[],"mappings":";;AAcA,wCAqBC;AAGD,gDA6BC;AAGD,4CA0BC;AA9FD,wCAAwC;AAWxC,6CAA6C;AACtC,KAAK,UAAU,cAAc,CAClC,MAAiB,EACjB,IAAwB,EACxB,IAAU;IAEV,MAAM,IAAI,GAAG,IAAA,oBAAU,EAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;IACrD,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IAEtB,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAa,gBAAgB,EAAE;QACzD,aAAa,EAAE,IAAI,CAAC,MAAM;QAC1B,oBAAoB,EAAE,sBAAsB;QAC5C,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/D,IAAI,CAAC,MAAM,CAAC,MAAM;QAAE,OAAO,iDAAiD,CAAC;IAC7E,OAAO,CACL,gBAAgB;QAChB,MAAM;aACH,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC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Y,KAAK,OAAO,mBAAmB,IAAI,CAAC,QAAQ,+BAA+B,CAAC;AACnH,CAAC;AAED,uEAAuE;AAChE,KAAK,UAAU,gBAAgB,CACpC,MAAiB,EACjB,IAAkF,EAClF,IAAU;IAEV,MAAM,IAAI,GAAG,IAAA,oBAAU,EAAC,IAAI,EAAE,wBAAwB,CAAC,CAAC;IACxD,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IAEtB,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACnD,OAAO,IAAI,IAAI,CAAC,KAAK,yBAAyB,CAAC;IACjD,CAAC;IAED,MAAM,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE;QACnC,IAAI,EAAE;YACJ,IAAI,EAAE,aAAa;YACnB,UAAU,EAAE;gBACV,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,SAAS,EAAE,IAAI,CAAC,UAAU,IAAI,EAAE;gBAChC,QAAQ,EAAE,IAAI,CAAC,SAAS,IAAI,EAAE;aAC/B;YACD,aAAa,EAAE;gBACb,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE;aAClE;SACF;KACF,CAAC,CAAC;IACH,OAAO,WAAW,IAAI,CAAC,KAAK,kBAAkB,IAAI,CAAC,QAAQ,0CAA0C,CAAC;AACxG,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * triage_reviews tool (Pro). Uses MCP Sampling to cluster customer reviews
3
+ * into themes on the user's own Claude (zero cost to us).
4
+ *
5
+ * Pipeline:
6
+ * 1. Fetch up to `limit` reviews via the ASC API (reuses list_reviews logic)
7
+ * 2. If none, return empty result, skip Sampling
8
+ * 3. Ask the user's client to cluster via Sampling
9
+ * 4. Parse JSON response from the model; degrade gracefully on parse error
10
+ */
11
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
12
+ import type { ASCClient } from "../client.js";
13
+ import type { Tier } from "../types.js";
14
+ interface Theme {
15
+ theme: string;
16
+ count: number;
17
+ action_bucket: "bug" | "missing_feature" | "pricing" | "ux" | "content" | "other";
18
+ quote: string;
19
+ }
20
+ export interface TriageResult {
21
+ app_id: string;
22
+ reviews_analyzed: number;
23
+ themes: Theme[];
24
+ note?: string;
25
+ degraded: boolean;
26
+ }
27
+ export declare function triageReviews(server: McpServer, client: ASCClient, args: {
28
+ app_id: string;
29
+ rating?: number;
30
+ limit?: number;
31
+ days?: number;
32
+ }, tier: Tier): Promise<TriageResult>;
33
+ export declare function formatTriageForAgent(res: TriageResult): string;
34
+ export {};
35
+ //# sourceMappingURL=triage-reviews.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triage-reviews.d.ts","sourceRoot":"","sources":["../../src/tools/triage-reviews.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAYxC,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,KAAK,GAAG,iBAAiB,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC;IAClF,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB;AAuBD,wBAAsB,aAAa,CACjC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EACxE,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,YAAY,CAAC,CA4GvB;AA2CD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAkB9D"}