@heybox/hb-sdk 0.9.6-alpha.11 → 0.9.6-alpha.14

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 (48) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +4 -1
  3. package/THIRD_PARTY_NOTICES.md +472 -48
  4. package/dist/cli-chunks/{artifact-BW6SD1G6.cjs → artifact-DTqf7LjW.cjs} +6 -5
  5. package/dist/cli-chunks/{build-B0Id0UTN.cjs → build-BY4DoIBI.cjs} +6 -5
  6. package/dist/cli-chunks/{create-DVu93Ekp.cjs → create-DG-eZzS2.cjs} +322 -4
  7. package/dist/cli-chunks/{dev-CeSjpEZQ.cjs → dev-BeSGi9u8.cjs} +20 -16
  8. package/dist/cli-chunks/{dev-context-CVc_BsWR.cjs → dev-context-7fvQuwt0.cjs} +22 -14
  9. package/dist/cli-chunks/{doctor-BF9mtkJr.cjs → doctor-DcxJh-U3.cjs} +1 -1
  10. package/dist/cli-chunks/{games-BKnDCklM.cjs → games-CbQNW3Z3.cjs} +1 -1
  11. package/dist/cli-chunks/{index-Cgui_8Rk.cjs → index-NJUh9sVX.cjs} +1 -1
  12. package/dist/cli-chunks/{index-Rp3UMZIO.cjs → index-lnwfzT8S.cjs} +73 -20
  13. package/dist/cli-chunks/index.esm-CvMA_ppV.cjs +7977 -0
  14. package/dist/cli-chunks/{index.esm-BK0eVYaM.cjs → index.esm-DOXvj-ZK.cjs} +7 -6
  15. package/dist/cli-chunks/{login-DpeDN-mt.cjs → login-PYy4XDVv.cjs} +1 -1
  16. package/dist/cli-chunks/{project-vite-Cg3jYqAJ.cjs → project-vite-Dzd2JLIc.cjs} +1 -1
  17. package/dist/cli-chunks/{remote-BQ-9rhTb.cjs → remote-r0tXpJh6.cjs} +13 -8
  18. package/dist/cli-chunks/{runtime-permission-env-BgipCJ0Z.cjs → runtime-permission-env-CN2K4GG7.cjs} +52 -6990
  19. package/dist/cli-chunks/{skill-D7pd4yPq.cjs → skill-BbrtzJTC.cjs} +2 -2
  20. package/dist/cli-chunks/{version-DbjRZkb6.cjs → version-SpegXNoR.cjs} +1 -1
  21. package/dist/cli.cjs +1 -1
  22. package/dist/devtools/browser-dev-host/assets/browser-dev-host-DdLOxwBk.js +228 -0
  23. package/dist/devtools/browser-dev-host/assets/desktop-app-launch-DeuOZXeW.js +6 -0
  24. package/dist/devtools/browser-dev-host/assets/index-B-2wxdQX.js +567 -0
  25. package/dist/devtools/browser-dev-host/assets/index-ophYZqpX.css +1 -0
  26. package/dist/devtools/browser-dev-host/assets/linux-DwJAcUeD.svg +1 -0
  27. package/dist/devtools/browser-dev-host/index.html +6 -4
  28. package/dist/index.cjs.js +1030 -155
  29. package/dist/index.esm.js +1030 -155
  30. package/dist/miniapp-publish.cjs.js +1071 -130
  31. package/dist/miniapp-publish.esm.js +1071 -130
  32. package/dist/protocol.cjs.js +727 -158
  33. package/dist/protocol.esm.js +711 -159
  34. package/dist/templates/vanilla-vite-js/README.md.ejs +27 -0
  35. package/dist/templates/vanilla-vite-js/package.json.ejs +1 -1
  36. package/dist/templates/vanilla-vite-js/src/user-game-data.js.ejs +1 -0
  37. package/dist/vite.cjs.js +1076 -133
  38. package/dist/vite.esm.js +1076 -133
  39. package/package.json +6 -7
  40. package/skill/SKILL.md +4 -0
  41. package/skill/skill.json +5 -5
  42. package/types/index.d.ts +386 -9
  43. package/types/miniapp-publish/index.d.ts +18 -2
  44. package/types/protocol.d.ts +1 -1
  45. package/dist/devtools/browser-dev-host/assets/browser-dev-host-DVlT56iQ.js +0 -100
  46. package/dist/devtools/browser-dev-host/assets/desktop-app-launch-BzRxl_MM.js +0 -6
  47. package/dist/devtools/browser-dev-host/assets/index-CHYEXFEg.css +0 -1
  48. package/dist/devtools/browser-dev-host/assets/index-DY5ZynQp.js +0 -586
package/dist/index.esm.js CHANGED
@@ -408,6 +408,16 @@ const COMPANION_SESSION_OUTPUT_EVENT = 'companion.session.output';
408
408
  const COMPANION_SESSION_EXIT_EVENT = 'companion.session.exit';
409
409
  const COMPANION_SESSION_OWNERSHIP_LOST_EVENT = 'companion.session.ownershipLost';
410
410
 
411
+ /** 游戏资料内部 wire:业务方法由 SDK 映射为精确资源请求。 */
412
+ const USER_GAMES_GET_OVERVIEW_METHOD = 'user.games.getOverview';
413
+ const USER_DATA_QUERY_METHOD = 'user.data.query';
414
+ const USER_DATA_SYNC_METHOD = 'user.data.sync';
415
+ const USER_DATA_FILE_METHOD = 'user.data.file';
416
+ const USER_DATA_PERMISSION_REQUEST_METHOD = 'user.dataPermission.request';
417
+ const USER_DATA_PERMISSION_GET_METHOD = 'user.dataPermission.get';
418
+ const USER_DATA_PERMISSION_OPEN_SETTINGS_METHOD = 'user.dataPermission.openSettings';
419
+ const USER_DATA_PERMISSION_REVOKE_SESSION_METHOD = 'user.dataPermission.revokeSession';
420
+
411
421
  const WORKSPACE_CARDS_REQUEST_REFRESH_METHOD = 'workspaceCards.requestRefresh';
412
422
  const AUTH_GET_ACCOUNT_STATE_METHOD = 'auth.getAccountState';
413
423
  const AUTH_LOGIN_METHOD = 'auth.login';
@@ -555,7 +565,7 @@ const COMPANION_SHOW_NOTIFICATION_METHOD = 'companion.showNotification';
555
565
  * @since 0.3.1
556
566
  */
557
567
  function isMiniProgramBridgeMessage(value) {
558
- if (!isRecord$3(value))
568
+ if (!isRecord$5(value))
559
569
  return false;
560
570
  if (value.namespace !== MINI_PROGRAM_MESSAGE_NAMESPACE || (value.version !== 1 && value.version !== 2) || !isNonEmptyString$1(value.nonce)) {
561
571
  return false;
@@ -707,7 +717,7 @@ function isMiniProgramRelativePath(value) {
707
717
  * @since 0.8.0
708
718
  */
709
719
  function isMiniProgramPathRootRef(value) {
710
- if (!isRecord$3(value))
720
+ if (!isRecord$5(value))
711
721
  return false;
712
722
  if (value.kind === 'sandbox')
713
723
  return hasOnlyKeys(value, ['kind']);
@@ -774,7 +784,7 @@ function isMiniProgramPathRootRef(value) {
774
784
  * @since 0.8.0
775
785
  */
776
786
  function isMiniProgramFileRef(value) {
777
- if (!isRecord$3(value) || value.kind !== 'file')
787
+ if (!isRecord$5(value) || value.kind !== 'file')
778
788
  return false;
779
789
  if (isNonEmptyString$1(value.handleId)) {
780
790
  return hasOnlyKeys(value, ['kind', 'handleId']);
@@ -842,7 +852,7 @@ function isMiniProgramFileRef(value) {
842
852
  * @since 0.8.0
843
853
  */
844
854
  function isMiniProgramDirectoryRef(value) {
845
- if (!isRecord$3(value) || value.kind !== 'directory')
855
+ if (!isRecord$5(value) || value.kind !== 'directory')
846
856
  return false;
847
857
  if (isNonEmptyString$1(value.handleId)) {
848
858
  return hasOnlyKeys(value, ['kind', 'handleId']);
@@ -919,7 +929,7 @@ function isMiniProgramDirectoryRef(value) {
919
929
  * @since 0.8.0
920
930
  */
921
931
  function isMiniProgramFileDescriptor(value) {
922
- return (isRecord$3(value) &&
932
+ return (isRecord$5(value) &&
923
933
  value.kind === 'file' &&
924
934
  isNonEmptyString$1(value.name) &&
925
935
  isFileMode(value.mode) &&
@@ -972,20 +982,20 @@ const MEDIA_PICK_ITEM_KEYS = ['type', 'mimeType', 'size', 'width', 'height', 'pr
972
982
  * @since 0.9.3
973
983
  */
974
984
  function isMiniProgramMediaPickItem(value) {
975
- if (!isRecord$3(value) || (value.type !== 'image' && value.type !== 'video'))
985
+ if (!isRecord$5(value) || (value.type !== 'image' && value.type !== 'video'))
976
986
  return false;
977
987
  const isVideo = value.type === 'video';
978
988
  if (!hasOnlyKeys(value, isVideo ? [...MEDIA_PICK_ITEM_KEYS, 'durationMs'] : MEDIA_PICK_ITEM_KEYS))
979
989
  return false;
980
990
  if (!isNonEmptyString$1(value.mimeType) ||
981
- !isNonNegativeSafeInteger(value.size) ||
991
+ !isNonNegativeSafeInteger$1(value.size) ||
982
992
  !isPositiveSafeInteger$1(value.width) ||
983
993
  !isPositiveSafeInteger$1(value.height) ||
984
994
  !isNonEmptyString$1(value.previewUrl) ||
985
995
  !isDirectFileDescriptor(value.file)) {
986
996
  return false;
987
997
  }
988
- return isVideo ? isNonNegativeSafeInteger(value.durationMs) : true;
998
+ return isVideo ? isNonNegativeSafeInteger$1(value.durationMs) : true;
989
999
  }
990
1000
  /**
991
1001
  * 判断未知值是否为整批 `media.pick` 结果。
@@ -1143,9 +1153,9 @@ function isMiniProgramByteArray(value) {
1143
1153
  * @since 0.8.0
1144
1154
  */
1145
1155
  function isMiniProgramFileStat(value) {
1146
- return (isRecord$3(value) &&
1156
+ return (isRecord$5(value) &&
1147
1157
  value.kind === 'file' &&
1148
- isNonNegativeSafeInteger(value.size) &&
1158
+ isNonNegativeSafeInteger$1(value.size) &&
1149
1159
  (value.modifiedAt === undefined || isNonNegativeFiniteNumber(value.modifiedAt)) &&
1150
1160
  (value.createdAt === undefined || isNonNegativeFiniteNumber(value.createdAt)) &&
1151
1161
  hasOnlyKeys(value, ['kind', 'size', 'modifiedAt', 'createdAt']));
@@ -1204,28 +1214,28 @@ function isMiniProgramFileStat(value) {
1204
1214
  * @since 0.8.0
1205
1215
  */
1206
1216
  function isMiniProgramDownloadProgressPayload(value) {
1207
- if (!isRecord$3(value) ||
1208
- !isNonNegativeSafeInteger(value.loaded) ||
1217
+ if (!isRecord$5(value) ||
1218
+ !isNonNegativeSafeInteger$1(value.loaded) ||
1209
1219
  typeof value.lengthComputable !== 'boolean' ||
1210
1220
  !hasOnlyKeys(value, ['loaded', 'total', 'lengthComputable'])) {
1211
1221
  return false;
1212
1222
  }
1213
1223
  if (!value.lengthComputable)
1214
1224
  return value.total === undefined;
1215
- return isNonNegativeSafeInteger(value.total) && value.loaded <= value.total;
1225
+ return isNonNegativeSafeInteger$1(value.total) && value.loaded <= value.total;
1216
1226
  }
1217
1227
  function isMiniProgramCompanionPrepareProgress(value) {
1218
- if (!isRecord$3(value))
1228
+ if (!isRecord$5(value))
1219
1229
  return false;
1220
1230
  if (value.phase === 'downloading') {
1221
- return (isNonNegativeSafeInteger(value.loaded) &&
1222
- (value.total === undefined || (isNonNegativeSafeInteger(value.total) && value.loaded <= value.total)) &&
1231
+ return (isNonNegativeSafeInteger$1(value.loaded) &&
1232
+ (value.total === undefined || (isNonNegativeSafeInteger$1(value.total) && value.loaded <= value.total)) &&
1223
1233
  hasOnlyKeys(value, ['phase', 'loaded', 'total']));
1224
1234
  }
1225
1235
  if (value.phase !== 'verifying' && value.phase !== 'extracting')
1226
1236
  return false;
1227
- return (isNonNegativeSafeInteger(value.processed) &&
1228
- isNonNegativeSafeInteger(value.total) &&
1237
+ return (isNonNegativeSafeInteger$1(value.processed) &&
1238
+ isNonNegativeSafeInteger$1(value.total) &&
1229
1239
  value.processed <= value.total &&
1230
1240
  hasOnlyKeys(value, ['phase', 'processed', 'total']));
1231
1241
  }
@@ -1233,15 +1243,15 @@ function isMiniProgramOperationProgressPayload(value) {
1233
1243
  return isMiniProgramDownloadProgressPayload(value) || isMiniProgramCompanionPrepareProgress(value);
1234
1244
  }
1235
1245
  function isSDKHandshakePayload(value) {
1236
- return isRecord$3(value) && isNonEmptyString$1(value.href) && typeof value.userAgent === 'string' && isNonEmptyString$1(value.sdkVersion);
1246
+ return isRecord$5(value) && isNonEmptyString$1(value.href) && typeof value.userAgent === 'string' && isNonEmptyString$1(value.sdkVersion);
1237
1247
  }
1238
1248
  function isBridgeError(value) {
1239
- return isRecord$3(value) && isNonEmptyString$1(value.code) && typeof value.message === 'string';
1249
+ return isRecord$5(value) && isNonEmptyString$1(value.code) && typeof value.message === 'string';
1240
1250
  }
1241
1251
  function isFileMode(value) {
1242
1252
  return value === 'read' || value === 'readwrite';
1243
1253
  }
1244
- function isNonNegativeSafeInteger(value) {
1254
+ function isNonNegativeSafeInteger$1(value) {
1245
1255
  return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0;
1246
1256
  }
1247
1257
  function isPositiveSafeInteger$1(value) {
@@ -1257,10 +1267,217 @@ function hasOnlyKeys(value, allowedKeys) {
1257
1267
  const allowed = new Set(allowedKeys);
1258
1268
  return Object.keys(value).every((key) => allowed.has(key));
1259
1269
  }
1260
- function isRecord$3(value) {
1270
+ function isRecord$5(value) {
1261
1271
  return typeof value === 'object' && value !== null && !Array.isArray(value);
1262
1272
  }
1263
1273
 
1274
+ /**
1275
+ * 首发游戏与资源目录(冻结范围)。
1276
+ *
1277
+ * @remarks
1278
+ * 本版只开放 4 个游戏、8 项资源,资源 key 精确匹配,**不接受通配符、前缀或未登记的 key**。
1279
+ * 目录是 Manifest 声明、Host 门禁、SDK 具名方法与概览的唯一事实源:新增资源必须在代码中显式
1280
+ * 登记并重新生成机器可读目录,不会因为上游新增解析分支而自动扩大已有声明或许可。
1281
+ *
1282
+ * `disclosureRevision` 描述披露字段与用途的版本。本版所有资源都从 `1` 开始;只要字段或用途实质
1283
+ * 变化就必须递增,并让旧的持久许可指纹失配后重新确认。
1284
+ *
1285
+ * @since 0.9.6
1286
+ * @hbPlatform android
1287
+ * @hbPlatform ios
1288
+ * @hbPlatform ohos
1289
+ * @hbPlatform windows
1290
+ * @hbPlatform macos
1291
+ * @hbClient android none
1292
+ * @hbClient ios none
1293
+ * @hbClient ohos none
1294
+ * @hbClient windows none
1295
+ * @hbClient macos none
1296
+ */
1297
+ /**
1298
+ * 首发公开 GameId(冻结顺序)。
1299
+ *
1300
+ * @since 0.9.6
1301
+ */
1302
+ const USER_GAME_DATA_GAMES = {
1303
+ ark: '明日方舟',
1304
+ black_myth_wukong: '黑神话悟空',
1305
+ task_bar_hero: '任务栏英雄',
1306
+ phantom_blade_zero: '影之刃零',
1307
+ };
1308
+ const USER_GAME_DATA_GAME_IDS = Object.keys(USER_GAME_DATA_GAMES);
1309
+ /**
1310
+ * 首发 8 项资源的公开目录。
1311
+ *
1312
+ * @remarks
1313
+ * - `ark` 与 `ark_lottery` 映射到同一游戏的 profile / gacha 两项资源,**来源资格不合并**。
1314
+ * - 明日方舟不提供 `saves`;三款存档不提供 profile / gacha 方法。
1315
+ * - 存档资源的 Steam AppID 与 `gamesaves.Client.Parsed` 的分支冻结一致:2358720、
1316
+ * 3678970、4115450。原始文件支持不等于已支持结构化解析,两个资源分别声明与许可。
1317
+ *
1318
+ * @since 0.9.6
1319
+ * @hbPlatform android
1320
+ * @hbPlatform ios
1321
+ * @hbPlatform ohos
1322
+ * @hbPlatform windows
1323
+ * @hbPlatform macos
1324
+ * @hbClient android none
1325
+ * @hbClient ios none
1326
+ * @hbClient ohos none
1327
+ * @hbClient windows none
1328
+ * @hbClient macos none
1329
+ */
1330
+ const GAME_DATA_RESOURCE_CATALOG = [
1331
+ {
1332
+ key: 'game.ark.profile',
1333
+ game: 'ark',
1334
+ family: 'profile',
1335
+ name: '明日方舟角色与养成资料',
1336
+ disclosureRevision: 1,
1337
+ queries: { get: { schema: 'ark.profile', version: 1 } },
1338
+ sync: false,
1339
+ file: false,
1340
+ },
1341
+ {
1342
+ key: 'game.ark.gacha',
1343
+ game: 'ark',
1344
+ family: 'gacha',
1345
+ name: '明日方舟抽卡记录与分析',
1346
+ disclosureRevision: 1,
1347
+ queries: {
1348
+ get: { schema: 'ark.gacha-analysis', version: 1 },
1349
+ list: { schema: 'ark.gacha-record-page', version: 1, page: { defaultSize: 50, maxSize: 100 } },
1350
+ },
1351
+ sync: false,
1352
+ file: false,
1353
+ },
1354
+ {
1355
+ key: 'game.black_myth_wukong.save_analysis',
1356
+ game: 'black_myth_wukong',
1357
+ family: 'save_analysis',
1358
+ name: '黑神话悟空存档解析结果',
1359
+ disclosureRevision: 1,
1360
+ queries: { get: { schema: 'black_myth_wukong.save', version: 1 } },
1361
+ sync: true,
1362
+ file: false,
1363
+ },
1364
+ {
1365
+ key: 'game.black_myth_wukong.save_files',
1366
+ game: 'black_myth_wukong',
1367
+ family: 'save_files',
1368
+ name: '黑神话悟空云存档文件',
1369
+ disclosureRevision: 1,
1370
+ queries: { list: { schema: 'save-file-page', version: 1 } },
1371
+ sync: true,
1372
+ file: true,
1373
+ },
1374
+ {
1375
+ key: 'game.task_bar_hero.save_analysis',
1376
+ game: 'task_bar_hero',
1377
+ family: 'save_analysis',
1378
+ name: '任务栏英雄存档解析结果',
1379
+ disclosureRevision: 1,
1380
+ queries: { get: { schema: 'task_bar_hero.save', version: 1 } },
1381
+ sync: true,
1382
+ file: false,
1383
+ },
1384
+ {
1385
+ key: 'game.task_bar_hero.save_files',
1386
+ game: 'task_bar_hero',
1387
+ family: 'save_files',
1388
+ name: '任务栏英雄云存档文件',
1389
+ disclosureRevision: 1,
1390
+ queries: { list: { schema: 'save-file-page', version: 1 } },
1391
+ sync: true,
1392
+ file: true,
1393
+ },
1394
+ {
1395
+ key: 'game.phantom_blade_zero.save_analysis',
1396
+ game: 'phantom_blade_zero',
1397
+ family: 'save_analysis',
1398
+ name: '影之刃零存档解析结果',
1399
+ disclosureRevision: 1,
1400
+ queries: { get: { schema: 'phantom_blade_zero.save', version: 1 } },
1401
+ sync: true,
1402
+ file: false,
1403
+ },
1404
+ {
1405
+ key: 'game.phantom_blade_zero.save_files',
1406
+ game: 'phantom_blade_zero',
1407
+ family: 'save_files',
1408
+ name: '影之刃零云存档文件',
1409
+ disclosureRevision: 1,
1410
+ queries: { list: { schema: 'save-file-page', version: 1 } },
1411
+ sync: true,
1412
+ file: true,
1413
+ },
1414
+ ];
1415
+ const USER_GAME_DATA_RESOURCE_KEYS = GAME_DATA_RESOURCE_CATALOG.map((resource) => resource.key);
1416
+ const RESOURCE_KEY_SET = new Set(USER_GAME_DATA_RESOURCE_KEYS);
1417
+ const GAME_ID_SET = new Set(USER_GAME_DATA_GAME_IDS);
1418
+ /**
1419
+ * 判断字符串是否为已发布的精确资源 key。
1420
+ *
1421
+ * @param key - 候选字符串;来自 `unknown` 边界时调用方必须先完成字符串检查。
1422
+ * @returns 与 {@link USER_GAME_DATA_RESOURCE_KEYS} 中某项精确相等时返回 `true` 并收窄类型。
1423
+ *
1424
+ * @remarks
1425
+ * 匹配大小写敏感且不做 trim 之外的归一化:`'*'`、`'game.ark'`、`'game.ark.gacha.*'` 等
1426
+ * 通配符或前缀一律返回 `false`。返回 `true` 只表示该 key 已登记在公开目录,不代表当前小程序
1427
+ * 已声明、平台已批准或用户已许可;这些门禁必须分别校验。
1428
+ *
1429
+ * @example
1430
+ * ```ts
1431
+ * isUserGameDataResourceKey('game.ark.profile'); // true
1432
+ * isUserGameDataResourceKey('game.ark'); // false:前缀不是资源
1433
+ * isUserGameDataResourceKey('game.ark.*'); // false:禁止通配符
1434
+ * ```
1435
+ *
1436
+ * @since 0.9.6
1437
+ * @hbPlatform android
1438
+ * @hbPlatform ios
1439
+ * @hbPlatform ohos
1440
+ * @hbPlatform windows
1441
+ * @hbPlatform macos
1442
+ * @hbClient android none
1443
+ * @hbClient ios none
1444
+ * @hbClient ohos none
1445
+ * @hbClient windows none
1446
+ * @hbClient macos none
1447
+ */
1448
+ function isUserGameDataResourceKey(key) {
1449
+ return RESOURCE_KEY_SET.has(key);
1450
+ }
1451
+ /**
1452
+ * 判断字符串是否为已发布的公开 GameId。
1453
+ *
1454
+ * @since 0.9.6
1455
+ */
1456
+ function isUserGameDataGameId(gameId) {
1457
+ return GAME_ID_SET.has(gameId);
1458
+ }
1459
+ /** 从同一目录派生内部操作,不维护第二套游戏白名单。 */
1460
+ function getUserDataResourceContract(key) {
1461
+ const resource = GAME_DATA_RESOURCE_CATALOG.find((entry) => entry.key === key);
1462
+ if (!resource)
1463
+ return undefined;
1464
+ const queries = resource.queries;
1465
+ const operations = Object.keys(queries);
1466
+ if (resource.sync)
1467
+ operations.push('sync');
1468
+ if (resource.file)
1469
+ operations.push('file');
1470
+ return {
1471
+ key: resource.key,
1472
+ game: resource.game,
1473
+ name: resource.name,
1474
+ family: resource.family,
1475
+ disclosureRevision: resource.disclosureRevision,
1476
+ queries,
1477
+ operations,
1478
+ };
1479
+ }
1480
+
1264
1481
  const MINI_PROGRAM_PERMISSION_KEYS = [
1265
1482
  'userInfo',
1266
1483
  'steamLibrary',
@@ -1276,6 +1493,7 @@ const MINI_PROGRAM_PERMISSION_KEYS = [
1276
1493
  'companion',
1277
1494
  'appProtocol',
1278
1495
  'workspaceCards',
1496
+ 'user_game_data',
1279
1497
  ];
1280
1498
  new Set(MINI_PROGRAM_PERMISSION_KEYS);
1281
1499
 
@@ -1898,6 +2116,7 @@ const _parse = (_Err) => (schema, value, _ctx, _params) => {
1898
2116
  }
1899
2117
  return result.value;
1900
2118
  };
2119
+ const parse$1 = /* @__PURE__*/ _parse($ZodRealError);
1901
2120
  const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
1902
2121
  const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
1903
2122
  let result = schema._zod.run({ value, issues: [] }, ctx);
@@ -1910,6 +2129,7 @@ const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
1910
2129
  }
1911
2130
  return result.value;
1912
2131
  };
2132
+ const parseAsync$1 = /* @__PURE__*/ _parseAsync($ZodRealError);
1913
2133
  const _safeParse = (_Err) => (schema, value, _ctx) => {
1914
2134
  const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
1915
2135
  const result = schema._zod.run({ value, issues: [] }, ctx);
@@ -2036,14 +2256,14 @@ function datetime$1(args) {
2036
2256
  const timeRegex = `${time}(?:${opts.join("|")})`;
2037
2257
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
2038
2258
  }
2039
- const string$1 = (params) => {
2259
+ const string$2 = (params) => {
2040
2260
  const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
2041
2261
  return new RegExp(`^${regex}$`);
2042
2262
  };
2043
2263
  const integer = /^-?\d+$/;
2044
- const number$1 = /^-?\d+(?:\.\d+)?$/;
2264
+ const number$2 = /^-?\d+(?:\.\d+)?$/;
2045
2265
  const boolean$1 = /^(?:true|false)$/i;
2046
- const _null$2 = /^null$/i;
2266
+ const _null$3 = /^null$/i;
2047
2267
  // regex for string with no uppercase letters
2048
2268
  const lowercase = /^[^A-Z]*$/;
2049
2269
  // regex for string with no lowercase letters
@@ -2629,7 +2849,7 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
2629
2849
  });
2630
2850
  const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
2631
2851
  $ZodType.init(inst, def);
2632
- inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? string$1(inst._zod.bag);
2852
+ inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? string$2(inst._zod.bag);
2633
2853
  inst._zod.parse = (payload, _) => {
2634
2854
  if (def.coerce)
2635
2855
  try {
@@ -2964,7 +3184,7 @@ const $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def) => {
2964
3184
  });
2965
3185
  const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
2966
3186
  $ZodType.init(inst, def);
2967
- inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
3187
+ inst._zod.pattern = inst._zod.bag.pattern ?? number$2;
2968
3188
  inst._zod.parse = (payload, _ctx) => {
2969
3189
  if (def.coerce)
2970
3190
  try {
@@ -3019,7 +3239,7 @@ const $ZodBoolean = /*@__PURE__*/ $constructor("$ZodBoolean", (inst, def) => {
3019
3239
  });
3020
3240
  const $ZodNull = /*@__PURE__*/ $constructor("$ZodNull", (inst, def) => {
3021
3241
  $ZodType.init(inst, def);
3022
- inst._zod.pattern = _null$2;
3242
+ inst._zod.pattern = _null$3;
3023
3243
  inst._zod.values = new Set([null]);
3024
3244
  inst._zod.parse = (payload, _ctx) => {
3025
3245
  const input = payload.value;
@@ -3703,7 +3923,7 @@ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
3703
3923
  }
3704
3924
  // Numeric string fallback: if key is a numeric string and failed, retry with Number(key)
3705
3925
  // This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals
3706
- const checkNumericKey = typeof key === "string" && number$1.test(key) && keyResult.issues.length;
3926
+ const checkNumericKey = typeof key === "string" && number$2.test(key) && keyResult.issues.length;
3707
3927
  if (checkNumericKey) {
3708
3928
  const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
3709
3929
  if (retryResult instanceof Promise) {
@@ -4452,7 +4672,7 @@ function _boolean(Class, params) {
4452
4672
  });
4453
4673
  }
4454
4674
  // @__NO_SIDE_EFFECTS__
4455
- function _null$1(Class, params) {
4675
+ function _null$2(Class, params) {
4456
4676
  return new Class({
4457
4677
  type: "null",
4458
4678
  ...normalizeParams(params),
@@ -5703,7 +5923,7 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
5703
5923
  return this.check(_overwrite(fn));
5704
5924
  },
5705
5925
  optional() {
5706
- return optional(this);
5926
+ return optional$1(this);
5707
5927
  },
5708
5928
  exactOptional() {
5709
5929
  return exactOptional(this);
@@ -5712,16 +5932,16 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
5712
5932
  return nullable(this);
5713
5933
  },
5714
5934
  nullish() {
5715
- return optional(nullable(this));
5935
+ return optional$1(nullable(this));
5716
5936
  },
5717
5937
  nonoptional(params) {
5718
5938
  return nonoptional(this, params);
5719
5939
  },
5720
5940
  array() {
5721
- return array(this);
5941
+ return array$1(this);
5722
5942
  },
5723
5943
  or(arg) {
5724
- return union([this, arg]);
5944
+ return union$1([this, arg]);
5725
5945
  },
5726
5946
  and(arg) {
5727
5947
  return intersection(this, arg);
@@ -5867,7 +6087,7 @@ const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
5867
6087
  inst.time = (params) => inst.check(time(params));
5868
6088
  inst.duration = (params) => inst.check(duration(params));
5869
6089
  });
5870
- function string(params) {
6090
+ function string$1(params) {
5871
6091
  return _string(ZodString, params);
5872
6092
  }
5873
6093
  const ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def) => {
@@ -5996,10 +6216,10 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
5996
6216
  return this.check(_lte(value, params));
5997
6217
  },
5998
6218
  int(params) {
5999
- return this.check(int(params));
6219
+ return this.check(int$1(params));
6000
6220
  },
6001
6221
  safe(params) {
6002
- return this.check(int(params));
6222
+ return this.check(int$1(params));
6003
6223
  },
6004
6224
  positive(params) {
6005
6225
  return this.check(_gt(0, params));
@@ -6032,14 +6252,14 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
6032
6252
  inst.isFinite = true;
6033
6253
  inst.format = bag.format ?? null;
6034
6254
  });
6035
- function number(params) {
6255
+ function number$1(params) {
6036
6256
  return _number(ZodNumber, params);
6037
6257
  }
6038
6258
  const ZodNumberFormat = /*@__PURE__*/ $constructor("ZodNumberFormat", (inst, def) => {
6039
6259
  $ZodNumberFormat.init(inst, def);
6040
6260
  ZodNumber.init(inst, def);
6041
6261
  });
6042
- function int(params) {
6262
+ function int$1(params) {
6043
6263
  return _int(ZodNumberFormat, params);
6044
6264
  }
6045
6265
  const ZodBoolean = /*@__PURE__*/ $constructor("ZodBoolean", (inst, def) => {
@@ -6055,8 +6275,8 @@ const ZodNull = /*@__PURE__*/ $constructor("ZodNull", (inst, def) => {
6055
6275
  ZodType.init(inst, def);
6056
6276
  inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json);
6057
6277
  });
6058
- function _null(params) {
6059
- return _null$1(ZodNull, params);
6278
+ function _null$1(params) {
6279
+ return _null$2(ZodNull, params);
6060
6280
  }
6061
6281
  const ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def) => {
6062
6282
  $ZodUnknown.init(inst, def);
@@ -6071,7 +6291,7 @@ const ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def) => {
6071
6291
  ZodType.init(inst, def);
6072
6292
  inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json);
6073
6293
  });
6074
- function never(params) {
6294
+ function never$1(params) {
6075
6295
  return _never(ZodNever, params);
6076
6296
  }
6077
6297
  const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
@@ -6097,7 +6317,7 @@ const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
6097
6317
  },
6098
6318
  });
6099
6319
  });
6100
- function array(element, params) {
6320
+ function array$1(element, params) {
6101
6321
  return _array(ZodArray, element, params);
6102
6322
  }
6103
6323
  const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
@@ -6121,7 +6341,7 @@ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
6121
6341
  return this.clone({ ...this._zod.def, catchall: unknown() });
6122
6342
  },
6123
6343
  strict() {
6124
- return this.clone({ ...this._zod.def, catchall: never() });
6344
+ return this.clone({ ...this._zod.def, catchall: never$1() });
6125
6345
  },
6126
6346
  strip() {
6127
6347
  return this.clone({ ...this._zod.def, catchall: undefined });
@@ -6172,7 +6392,7 @@ const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
6172
6392
  inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
6173
6393
  inst.options = def.options;
6174
6394
  });
6175
- function union(options, params) {
6395
+ function union$1(options, params) {
6176
6396
  return new ZodUnion({
6177
6397
  type: "union",
6178
6398
  options: options,
@@ -6216,7 +6436,7 @@ function record$1(keyType, valueType, params) {
6216
6436
  if (!valueType || !valueType._zod) {
6217
6437
  return new ZodRecord({
6218
6438
  type: "record",
6219
- keyType: string(),
6439
+ keyType: string$1(),
6220
6440
  valueType: keyType,
6221
6441
  ...normalizeParams(valueType),
6222
6442
  });
@@ -6290,7 +6510,7 @@ const ZodLiteral = /*@__PURE__*/ $constructor("ZodLiteral", (inst, def) => {
6290
6510
  },
6291
6511
  });
6292
6512
  });
6293
- function literal(value, params) {
6513
+ function literal$1(value, params) {
6294
6514
  return new ZodLiteral({
6295
6515
  type: "literal",
6296
6516
  values: Array.isArray(value) ? value : [value],
@@ -6346,7 +6566,7 @@ const ZodOptional = /*@__PURE__*/ $constructor("ZodOptional", (inst, def) => {
6346
6566
  inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
6347
6567
  inst.unwrap = () => inst._zod.def.innerType;
6348
6568
  });
6349
- function optional(innerType) {
6569
+ function optional$1(innerType) {
6350
6570
  return new ZodOptional({
6351
6571
  type: "optional",
6352
6572
  innerType: innerType,
@@ -6487,7 +6707,7 @@ function superRefine(fn, params) {
6487
6707
  }
6488
6708
  function json(params) {
6489
6709
  const jsonSchema = lazy(() => {
6490
- return union([string(params), number(), boolean(), _null(), array(jsonSchema), record$1(string(), jsonSchema)]);
6710
+ return union$1([string$1(params), number$1(), boolean(), _null$1(), array$1(jsonSchema), record$1(string$1(), jsonSchema)]);
6491
6711
  });
6492
6712
  return jsonSchema;
6493
6713
  }
@@ -6560,7 +6780,7 @@ var viewElevationSchema = _enum(["flat", "raised"]);
6560
6780
  var viewWidthSchema = _enum(["auto", "fill"]);
6561
6781
  var viewBoxSizeSchema = _enum(["md", "hero"]);
6562
6782
  var viewHeightSchema = _enum(["data-tile"]);
6563
- var viewGridColumnsSchema = union([literal(2), literal(3), literal(4)]);
6783
+ var viewGridColumnsSchema = union$1([literal$1(2), literal$1(3), literal$1(4)]);
6564
6784
  var viewTextVariantSchema = _enum([
6565
6785
  "display",
6566
6786
  "title",
@@ -6605,7 +6825,7 @@ var viewImageSizeSchema = _enum([
6605
6825
  "landscape-compact",
6606
6826
  "landscape-content"
6607
6827
  ]);
6608
- var viewIconSizeSchema = union([literal(16), literal(20), literal(24)]);
6828
+ var viewIconSizeSchema = union$1([literal$1(16), literal$1(20), literal$1(24)]);
6609
6829
  var viewIconColorSchema = _enum([
6610
6830
  "default",
6611
6831
  "secondary",
@@ -6625,28 +6845,28 @@ var viewImageOverlaySchema = _enum([
6625
6845
  var viewListVariantSchema = _enum(["media", "plain", "compact"]);
6626
6846
  var viewCarouselPaginationSchema = _enum(["none", "bullets", "fraction"]);
6627
6847
  var viewCarouselPaginationPlacementSchema = _enum(["inside", "outside"]);
6628
- var viewCarouselSlidesPerViewSchema = union([literal(1), literal(2), literal(3)]);
6848
+ var viewCarouselSlidesPerViewSchema = union$1([literal$1(1), literal$1(2), literal$1(3)]);
6629
6849
  var viewTransitionEffectSchema = _enum(["crossfade", "morph"]);
6630
6850
  var viewTransitionSchema = object({
6631
6851
  /** 新旧内容仅交叉淡化,或同时执行轻量位移与缩放变换。 */
6632
6852
  effect: viewTransitionEffectSchema
6633
6853
  });
6634
- var nodeIdSchema = string().trim().min(1).max(120);
6854
+ var nodeIdSchema = string$1().trim().min(1).max(120);
6635
6855
  var viewActionSchema = object({
6636
6856
  /** 完整 Command id。 */
6637
- commandId: string().trim().min(1).max(120),
6857
+ commandId: string$1().trim().min(1).max(120),
6638
6858
  /** Command 的 JSON 输入。 */
6639
6859
  input: json().optional(),
6640
6860
  /** 提交时并入 `input` 的用户输入绑定;键是 input 字段名,值是 `textField` 节点 id。 */
6641
- inputFrom: record$1(string().trim().min(1).max(40), nodeIdSchema).refine((value) => Object.keys(value).length <= VIEW_BUDGET.maxActionInputBindings, {
6861
+ inputFrom: record$1(string$1().trim().min(1).max(40), nodeIdSchema).refine((value) => Object.keys(value).length <= VIEW_BUDGET.maxActionInputBindings, {
6642
6862
  error: "\u5355\u4E2A\u52A8\u4F5C\u7ED1\u5B9A\u7684\u8F93\u5165\u5B57\u6BB5\u8FC7\u591A"
6643
6863
  }).optional()
6644
6864
  });
6645
- var textValueSchema = string().max(VIEW_BUDGET.maxTextLength);
6646
- var shortTextSchema = string().trim().min(1).max(200);
6865
+ var textValueSchema = string$1().max(VIEW_BUDGET.maxTextLength);
6866
+ var shortTextSchema = string$1().trim().min(1).max(200);
6647
6867
  var viewMeterSegmentSchema = object({
6648
6868
  /** 该数据段占整个容量的比例,值域 (0,1]。 */
6649
- value: number().positive().max(1),
6869
+ value: number$1().positive().max(1),
6650
6870
  /** 数据段的可访问说明。 */
6651
6871
  label: shortTextSchema,
6652
6872
  /** 数据段语气;缺省使用宿主上下文强调色。 */
@@ -6654,37 +6874,37 @@ var viewMeterSegmentSchema = object({
6654
6874
  });
6655
6875
  var viewBarChartItemSchema = object({
6656
6876
  /** 分类标签,例如星期“一”。 */
6657
- label: string().trim().min(1).max(20),
6877
+ label: string$1().trim().min(1).max(20),
6658
6878
  /** 非负原始值;宿主只按同组最大值归一化,不改变数据口径。 */
6659
- value: number().finite().nonnegative(),
6879
+ value: number$1().finite().nonnegative(),
6660
6880
  /** 精确值文本,例如“2 小时 30 分”。 */
6661
- valueLabel: string().trim().min(1).max(80).optional()
6881
+ valueLabel: string$1().trim().min(1).max(80).optional()
6662
6882
  });
6663
6883
  var viewTextSpanSchema = object({
6664
6884
  /** 片段文本;全部片段拼接后必须与所属节点的 `value` 完全一致。 */
6665
- text: string().min(1).max(VIEW_BUDGET.maxTextLength),
6885
+ text: string$1().min(1).max(VIEW_BUDGET.maxTextLength),
6666
6886
  /** 叠加在该片段上的语义标记;缺省即为普通文本。 */
6667
- marks: array(viewTextMarkSchema).max(4).optional()
6887
+ marks: array$1(viewTextMarkSchema).max(4).optional()
6668
6888
  });
6669
6889
  var viewImageFallbackSchema = object({
6670
6890
  /** 缺图时复用宿主当前应用的缓存模糊背景;不请求远程资源,缺省沿用图标或文本回退。 */
6671
- source: literal("app-ambient").optional(),
6891
+ source: literal$1("app-ambient").optional(),
6672
6892
  /** 回退图标名;宿主无法识别时退回文本。 */
6673
- icon: string().trim().min(1).max(80).optional(),
6893
+ icon: string$1().trim().min(1).max(80).optional(),
6674
6894
  /** 回退文本。 */
6675
- text: string().trim().max(120).optional()
6895
+ text: string$1().trim().max(120).optional()
6676
6896
  });
6677
6897
  var viewFieldItemSchema = object({
6678
6898
  label: shortTextSchema,
6679
- value: string().max(400).optional(),
6680
- placeholder: string().trim().max(120).optional()
6899
+ value: string$1().max(400).optional(),
6900
+ placeholder: string$1().trim().max(120).optional()
6681
6901
  });
6682
6902
  var viewListItemActionSchema = object({
6683
6903
  text: shortTextSchema,
6684
6904
  variant: viewButtonVariantSchema.optional(),
6685
6905
  tone: viewToneSchema.optional(),
6686
6906
  disabled: boolean().optional(),
6687
- disabledReason: string().trim().max(200).optional(),
6907
+ disabledReason: string$1().trim().max(200).optional(),
6688
6908
  action: viewActionSchema.optional()
6689
6909
  });
6690
6910
  var viewListItemBadgeSchema = object({
@@ -6694,9 +6914,9 @@ var viewListItemBadgeSchema = object({
6694
6914
  var viewListItemSchema = object({
6695
6915
  id: nodeIdSchema,
6696
6916
  title: shortTextSchema,
6697
- subtitle: string().trim().max(400).optional(),
6698
- meta: string().trim().max(120).optional(),
6699
- image: string().trim().max(2e3).optional(),
6917
+ subtitle: string$1().trim().max(400).optional(),
6918
+ meta: string$1().trim().max(120).optional(),
6919
+ image: string$1().trim().max(2e3).optional(),
6700
6920
  imageFallback: viewImageFallbackSchema.optional(),
6701
6921
  /** 媒体位外形;缺省保持历史横向缩略图。 */
6702
6922
  imageShape: viewListItemImageShapeSchema.optional(),
@@ -6707,7 +6927,7 @@ var viewListItemSchema = object({
6707
6927
  /** 列表图片是否以颜色传达业务含义;不影响卡片主次下的原色显示。 */
6708
6928
  imageColorRole: viewImageColorRoleSchema.optional(),
6709
6929
  /** 行首图标名;宿主不认识该名称时不渲染图标位。 */
6710
- icon: string().trim().min(1).max(80).optional(),
6930
+ icon: string$1().trim().min(1).max(80).optional(),
6711
6931
  /** 条目整体语气;作用于标题与行首图标。 */
6712
6932
  tone: viewToneSchema.optional(),
6713
6933
  /** 行尾状态标记;与 `meta` 并存时标记在前。 */
@@ -6717,7 +6937,7 @@ var viewListItemSchema = object({
6717
6937
  /** 当前不可激活。 */
6718
6938
  disabled: boolean().optional(),
6719
6939
  /** 不可激活的可读原因。 */
6720
- disabledReason: string().trim().max(200).optional(),
6940
+ disabledReason: string$1().trim().max(200).optional(),
6721
6941
  action: viewActionSchema.optional(),
6722
6942
  /** 行尾次级动作;宿主把它渲染成与整行动作并列的独立按钮。 */
6723
6943
  secondaryAction: viewListItemActionSchema.optional()
@@ -6725,7 +6945,7 @@ var viewListItemSchema = object({
6725
6945
  var viewRegionNoticeSchema = object({
6726
6946
  /** 稳定键;用户关闭后按该键记住,换一条提示会重新出现。 */
6727
6947
  id: nodeIdSchema,
6728
- text: string().trim().min(1).max(200),
6948
+ text: string$1().trim().min(1).max(200),
6729
6949
  tone: viewToneSchema.optional(),
6730
6950
  /** 是否允许用户关闭;关闭状态属于宿主自持呈现状态。 */
6731
6951
  dismissible: boolean().optional()
@@ -6801,18 +7021,18 @@ var layoutShape = {
6801
7021
  var boxShape = {
6802
7022
  ...layoutShape,
6803
7023
  action: viewActionSchema.optional(),
6804
- accessibilityLabel: string().min(1).max(80).optional(),
7024
+ accessibilityLabel: string$1().min(1).max(80).optional(),
6805
7025
  interaction: _enum(["soft", "media", "text", "content"]).optional()
6806
7026
  };
6807
7027
  var meterNodeSchema = object({
6808
7028
  ...baseNodeShape,
6809
- type: literal("meter"),
7029
+ type: literal$1("meter"),
6810
7030
  /** 比例值,值域 [0,1];超出值域是插件缺陷,按 schema 错误稳定失败。 */
6811
- value: number().min(0).max(1),
7031
+ value: number$1().min(0).max(1),
6812
7032
  /** 可访问名称;缺省时由宿主以百分比文本兜底。 */
6813
7033
  label: shortTextSchema.optional(),
6814
7034
  tone: viewToneSchema.optional(),
6815
- segments: array(viewMeterSegmentSchema).min(1).max(8).optional(),
7035
+ segments: array$1(viewMeterSegmentSchema).min(1).max(8).optional(),
6816
7036
  size: viewMeterSizeSchema.optional(),
6817
7037
  ticks: boolean().optional()
6818
7038
  }).refine(
@@ -6826,31 +7046,31 @@ var knownNodeSchema = lazy(
6826
7046
  () => discriminatedUnion("type", [
6827
7047
  object({
6828
7048
  ...boxShape,
6829
- type: literal("vstack"),
6830
- children: array(viewNodeSchema)
7049
+ type: literal$1("vstack"),
7050
+ children: array$1(viewNodeSchema)
6831
7051
  }),
6832
7052
  object({
6833
7053
  ...boxShape,
6834
- type: literal("hstack"),
7054
+ type: literal$1("hstack"),
6835
7055
  wrap: boolean().optional(),
6836
- children: array(viewNodeSchema)
7056
+ children: array$1(viewNodeSchema)
6837
7057
  }),
6838
7058
  object({
6839
7059
  ...boxShape,
6840
- type: literal("zstack"),
6841
- children: array(viewNodeSchema)
7060
+ type: literal$1("zstack"),
7061
+ children: array$1(viewNodeSchema)
6842
7062
  }),
6843
7063
  object({
6844
7064
  ...boxShape,
6845
- type: literal("grid"),
7065
+ type: literal$1("grid"),
6846
7066
  columns: viewGridColumnsSchema,
6847
- children: array(viewNodeSchema)
7067
+ children: array$1(viewNodeSchema)
6848
7068
  }),
6849
7069
  object({
6850
7070
  id: nodeIdSchema,
6851
- type: literal("carousel"),
7071
+ type: literal$1("carousel"),
6852
7072
  label: shortTextSchema,
6853
- children: array(viewNodeSchema).min(1).max(VIEW_BUDGET.maxCarouselSlides),
7073
+ children: array$1(viewNodeSchema).min(1).max(VIEW_BUDGET.maxCarouselSlides),
6854
7074
  fallback: viewNodeSchema.optional(),
6855
7075
  slidesPerView: viewCarouselSlidesPerViewSchema.optional(),
6856
7076
  gap: viewGapSchema.optional(),
@@ -6859,36 +7079,36 @@ var knownNodeSchema = lazy(
6859
7079
  navigation: boolean().optional(),
6860
7080
  pagination: viewCarouselPaginationSchema.optional(),
6861
7081
  paginationPlacement: viewCarouselPaginationPlacementSchema.optional(),
6862
- autoplayDelay: number().int().min(2e3).max(3e4).optional()
7082
+ autoplayDelay: number$1().int().min(2e3).max(3e4).optional()
6863
7083
  }),
6864
7084
  object({
6865
7085
  ...layoutShape,
6866
- type: literal("group"),
7086
+ type: literal$1("group"),
6867
7087
  title: shortTextSchema.optional(),
6868
7088
  collapsible: boolean().optional(),
6869
7089
  defaultExpanded: boolean().optional(),
6870
7090
  stickyTitle: boolean().optional(),
6871
- children: array(viewNodeSchema)
7091
+ children: array$1(viewNodeSchema)
6872
7092
  }),
6873
- object({ ...baseNodeShape, type: literal("spacer") }),
7093
+ object({ ...baseNodeShape, type: literal$1("spacer") }),
6874
7094
  object({
6875
7095
  ...baseNodeShape,
6876
- type: literal("text"),
7096
+ type: literal$1("text"),
6877
7097
  value: textValueSchema,
6878
- spans: array(viewTextSpanSchema).max(VIEW_BUDGET.maxTextSpans).optional(),
7098
+ spans: array$1(viewTextSpanSchema).max(VIEW_BUDGET.maxTextSpans).optional(),
6879
7099
  variant: viewTextVariantSchema.optional(),
6880
7100
  weight: viewTextWeightSchema.optional(),
6881
7101
  tone: viewTextToneSchema.optional(),
6882
7102
  paint: viewTextPaintSchema.optional(),
6883
- maxLines: number().int().positive().max(50).optional(),
7103
+ maxLines: number$1().int().positive().max(50).optional(),
6884
7104
  reserveLines: boolean().optional()
6885
7105
  }),
6886
7106
  object({
6887
7107
  ...baseNodeShape,
6888
- type: literal("image"),
7108
+ type: literal$1("image"),
6889
7109
  /** 图片资源地址;无原图且声明 app-ambient 回退时,用 app-ambient://current 直接选择宿主缓存。 */
6890
- src: string().trim().min(1).max(2e3),
6891
- aspectRatio: string().trim().max(20).optional(),
7110
+ src: string$1().trim().min(1).max(2e3),
7111
+ aspectRatio: string$1().trim().max(20).optional(),
6892
7112
  size: viewImageSizeSchema.optional(),
6893
7113
  fit: viewImageFitSchema.optional(),
6894
7114
  appearance: viewImageAppearanceSchema.optional(),
@@ -6899,34 +7119,34 @@ var knownNodeSchema = lazy(
6899
7119
  }),
6900
7120
  object({
6901
7121
  ...baseNodeShape,
6902
- type: literal("icon"),
6903
- name: string().trim().min(1).max(80),
7122
+ type: literal$1("icon"),
7123
+ name: string$1().trim().min(1).max(80),
6904
7124
  size: viewIconSizeSchema.optional(),
6905
7125
  color: viewIconColorSchema.optional(),
6906
7126
  tone: viewToneSchema.optional()
6907
7127
  }),
6908
7128
  object({
6909
7129
  ...baseNodeShape,
6910
- type: literal("fields"),
6911
- items: array(viewFieldItemSchema).max(VIEW_BUDGET.maxFieldItems)
7130
+ type: literal$1("fields"),
7131
+ items: array$1(viewFieldItemSchema).max(VIEW_BUDGET.maxFieldItems)
6912
7132
  }),
6913
7133
  object({
6914
7134
  ...baseNodeShape,
6915
- type: literal("list"),
7135
+ type: literal$1("list"),
6916
7136
  variant: viewListVariantSchema.optional(),
6917
- initialCount: number().int().positive().max(VIEW_BUDGET.maxListItems).optional(),
6918
- items: array(viewListItemSchema).max(VIEW_BUDGET.maxListItems)
7137
+ initialCount: number$1().int().positive().max(VIEW_BUDGET.maxListItems).optional(),
7138
+ items: array$1(viewListItemSchema).max(VIEW_BUDGET.maxListItems)
6919
7139
  }),
6920
7140
  object({
6921
7141
  ...baseNodeShape,
6922
- type: literal("badge"),
7142
+ type: literal$1("badge"),
6923
7143
  text: shortTextSchema,
6924
7144
  tone: _enum([...viewToneSchema.options, "primary", "primary-media"]).optional()
6925
7145
  }),
6926
- object({ ...baseNodeShape, type: literal("divider") }),
7146
+ object({ ...baseNodeShape, type: literal$1("divider") }),
6927
7147
  object({
6928
7148
  ...baseNodeShape,
6929
- type: literal("button"),
7149
+ type: literal$1("button"),
6930
7150
  text: shortTextSchema,
6931
7151
  variant: viewButtonVariantSchema.optional(),
6932
7152
  /**
@@ -6935,56 +7155,56 @@ var knownNodeSchema = lazy(
6935
7155
  */
6936
7156
  tone: viewToneSchema.optional(),
6937
7157
  disabled: boolean().optional(),
6938
- disabledReason: string().trim().max(200).optional(),
7158
+ disabledReason: string$1().trim().max(200).optional(),
6939
7159
  busy: boolean().optional(),
6940
7160
  action: viewActionSchema.optional()
6941
7161
  }),
6942
7162
  object({
6943
7163
  id: nodeIdSchema,
6944
- type: literal("switch"),
7164
+ type: literal$1("switch"),
6945
7165
  label: shortTextSchema,
6946
7166
  checked: boolean(),
6947
7167
  disabled: boolean().optional(),
6948
- disabledReason: string().trim().max(200).optional(),
7168
+ disabledReason: string$1().trim().max(200).optional(),
6949
7169
  busy: boolean().optional(),
6950
7170
  action: viewActionSchema.optional(),
6951
7171
  fallback: viewNodeSchema.optional()
6952
7172
  }),
6953
7173
  object({
6954
7174
  id: nodeIdSchema,
6955
- type: literal("expandable"),
6956
- collapsedLines: number().int().positive().max(50),
7175
+ type: literal$1("expandable"),
7176
+ collapsedLines: number$1().int().positive().max(50),
6957
7177
  expandText: shortTextSchema,
6958
7178
  collapseText: shortTextSchema,
6959
- children: array(viewNodeSchema)
7179
+ children: array$1(viewNodeSchema)
6960
7180
  }),
6961
7181
  object({
6962
7182
  id: nodeIdSchema,
6963
- type: literal("renderer"),
6964
- rendererViewId: string().trim().min(1).max(120),
7183
+ type: literal$1("renderer"),
7184
+ rendererViewId: string$1().trim().min(1).max(120),
6965
7185
  content: object({
6966
- resourceKey: string().trim().min(1).max(512),
7186
+ resourceKey: string$1().trim().min(1).max(512),
6967
7187
  space: _enum(["instance", "shared"]).optional()
6968
7188
  }).optional(),
6969
- aspectRatio: string().trim().max(20).optional(),
6970
- height: number().int().positive().max(2e3).optional()
7189
+ aspectRatio: string$1().trim().max(20).optional(),
7190
+ height: number$1().int().positive().max(2e3).optional()
6971
7191
  }),
6972
7192
  object({
6973
7193
  id: nodeIdSchema,
6974
- type: literal("frame"),
6975
- frameId: string().trim().min(1).max(120),
6976
- key: string().min(1).max(200).optional(),
7194
+ type: literal$1("frame"),
7195
+ frameId: string$1().trim().min(1).max(120),
7196
+ key: string$1().min(1).max(200).optional(),
6977
7197
  params: viewFrameParamsSchema.optional(),
6978
- aspectRatio: string().trim().max(20).optional(),
6979
- height: number().int().positive().max(2e3).optional()
7198
+ aspectRatio: string$1().trim().max(20).optional(),
7199
+ height: number$1().int().positive().max(2e3).optional()
6980
7200
  }),
6981
7201
  meterNodeSchema,
6982
7202
  object({
6983
7203
  ...baseNodeShape,
6984
- type: literal("radialProgress"),
6985
- value: number().min(0).max(1),
7204
+ type: literal$1("radialProgress"),
7205
+ value: number$1().min(0).max(1),
6986
7206
  label: shortTextSchema,
6987
- valueLabel: string().trim().min(1).max(40).optional(),
7207
+ valueLabel: string$1().trim().min(1).max(40).optional(),
6988
7208
  centerGraphic: viewRadialProgressCenterGraphicSchema.optional(),
6989
7209
  size: viewRadialProgressSizeSchema.optional(),
6990
7210
  tone: viewToneSchema.optional(),
@@ -6992,17 +7212,17 @@ var knownNodeSchema = lazy(
6992
7212
  }),
6993
7213
  object({
6994
7214
  ...baseNodeShape,
6995
- type: literal("sparkline"),
7215
+ type: literal$1("sparkline"),
6996
7216
  /** 原始数值序列,宿主归一化绘制;少于 2 个点不构成趋势,由 schema 拒绝。 */
6997
- values: array(number()).min(2).max(VIEW_BUDGET.maxSparklinePoints),
7217
+ values: array$1(number$1()).min(2).max(VIEW_BUDGET.maxSparklinePoints),
6998
7218
  /** 可访问名称;缺省时由宿主以末值文本兜底。 */
6999
7219
  label: shortTextSchema.optional(),
7000
7220
  tone: viewToneSchema.optional()
7001
7221
  }),
7002
7222
  object({
7003
7223
  ...baseNodeShape,
7004
- type: literal("barChart"),
7005
- items: array(viewBarChartItemSchema).min(2).max(VIEW_BUDGET.maxBarChartItems),
7224
+ type: literal$1("barChart"),
7225
+ items: array$1(viewBarChartItemSchema).min(2).max(VIEW_BUDGET.maxBarChartItems),
7006
7226
  label: shortTextSchema,
7007
7227
  size: viewBarChartSizeSchema.optional(),
7008
7228
  tone: viewToneSchema.optional(),
@@ -7010,27 +7230,27 @@ var knownNodeSchema = lazy(
7010
7230
  }),
7011
7231
  object({
7012
7232
  id: nodeIdSchema,
7013
- type: literal("tabs"),
7014
- items: array(
7233
+ type: literal$1("tabs"),
7234
+ items: array$1(
7015
7235
  object({
7016
7236
  id: nodeIdSchema,
7017
7237
  label: shortTextSchema,
7018
- badge: string().trim().max(40).optional(),
7019
- children: array(viewNodeSchema)
7238
+ badge: string$1().trim().max(40).optional(),
7239
+ children: array$1(viewNodeSchema)
7020
7240
  })
7021
7241
  ).min(1).max(VIEW_BUDGET.maxTabItems),
7022
7242
  fallback: viewNodeSchema.optional()
7023
7243
  }),
7024
7244
  object({
7025
7245
  id: nodeIdSchema,
7026
- type: literal("textField"),
7246
+ type: literal$1("textField"),
7027
7247
  label: shortTextSchema,
7028
- placeholder: string().trim().max(120).optional(),
7029
- value: string().max(VIEW_BUDGET.maxTextFieldLength).optional(),
7030
- maxLength: number().int().positive().max(VIEW_BUDGET.maxTextFieldLength).optional(),
7248
+ placeholder: string$1().trim().max(120).optional(),
7249
+ value: string$1().max(VIEW_BUDGET.maxTextFieldLength).optional(),
7250
+ maxLength: number$1().int().positive().max(VIEW_BUDGET.maxTextFieldLength).optional(),
7031
7251
  disabled: boolean().optional(),
7032
7252
  clearable: boolean().optional(),
7033
- resetToken: string().trim().max(120).optional(),
7253
+ resetToken: string$1().trim().max(120).optional(),
7034
7254
  submitAction: viewActionSchema.optional(),
7035
7255
  fallback: viewNodeSchema.optional()
7036
7256
  })
@@ -7038,13 +7258,13 @@ var knownNodeSchema = lazy(
7038
7258
  );
7039
7259
  var unknownNodeSchema = lazy(
7040
7260
  () => looseObject({
7041
- type: string().trim().min(1).max(80).refine((type) => !isKnownViewNodeType(type), {
7261
+ type: string$1().trim().min(1).max(80).refine((type) => !isKnownViewNodeType(type), {
7042
7262
  error: "\u5DF2\u77E5\u8282\u70B9\u7C7B\u578B\u5FC5\u987B\u5339\u914D\u5176\u81EA\u8EAB schema\uFF0C\u4E0D\u80FD\u9000\u5316\u4E3A\u672A\u77E5\u8282\u70B9"
7043
7263
  }),
7044
7264
  fallback: viewNodeSchema.optional()
7045
7265
  })
7046
7266
  );
7047
- var viewNodeSchema = union([knownNodeSchema, unknownNodeSchema]);
7267
+ var viewNodeSchema = union$1([knownNodeSchema, unknownNodeSchema]);
7048
7268
  var viewRegionStatusSchema = _enum(["ready", "loading", "empty", "error"]);
7049
7269
  var viewRetryPresentationSchema = _enum(["button", "inline"]);
7050
7270
  var viewRegionSchema = object({
@@ -7056,15 +7276,15 @@ var viewRegionSchema = object({
7056
7276
  /** 仅在 `status` 为 `error` 时有意义。 */
7057
7277
  retry: viewActionSchema.optional(),
7058
7278
  /** 覆盖宿主默认错误文案;仅用于 `error` Region。 */
7059
- errorText: string().trim().min(1).max(200).optional(),
7279
+ errorText: string$1().trim().min(1).max(200).optional(),
7060
7280
  /** 重试动作的宿主呈现方式;`inline` 使用 Accent 文字动作。 */
7061
7281
  retryPresentation: viewRetryPresentationSchema.optional(),
7062
7282
  /** 覆盖宿主默认空态文案;显式空字符串表示只呈现业务视觉锚点。 */
7063
- emptyText: string().trim().max(200).optional(),
7283
+ emptyText: string$1().trim().max(200).optional(),
7064
7284
  /** 顶部瞬时说明;出现与消失不参与节点预算,也不引起内容重排。 */
7065
7285
  notice: viewRegionNoticeSchema.optional(),
7066
7286
  /** `ready` 时是真实内容,`loading` 时是占位蓝图,`empty/error` 时可选保留业务视觉锚点。 */
7067
- nodes: array(viewNodeSchema).default([])
7287
+ nodes: array$1(viewNodeSchema).default([])
7068
7288
  }).superRefine((region2, context) => {
7069
7289
  if (region2.refreshing === true && region2.status !== "ready") {
7070
7290
  context.addIssue({
@@ -7097,10 +7317,10 @@ var viewRegionSchema = object({
7097
7317
  });
7098
7318
  object({
7099
7319
  /** 文档 schema 的整数 major 版本。 */
7100
- schema: number().int().positive(),
7320
+ schema: number$1().int().positive(),
7101
7321
  /** Runtime 更新文档时由包内 renderer 执行的渐进增强过渡。 */
7102
7322
  transition: viewTransitionSchema.optional(),
7103
- regions: array(viewRegionSchema).max(VIEW_BUDGET.maxRegions)
7323
+ regions: array$1(viewRegionSchema).max(VIEW_BUDGET.maxRegions)
7104
7324
  });
7105
7325
  function fail(message) {
7106
7326
  throw new Error(`workspaceCards: ${message}`);
@@ -7161,6 +7381,317 @@ function validateWorkspaceCardParams(value) {
7161
7381
  visit(value);
7162
7382
  }
7163
7383
 
7384
+ const ZodMiniType = /*@__PURE__*/ $constructor("ZodMiniType", (inst, def) => {
7385
+ if (!inst._zod)
7386
+ throw new Error("Uninitialized schema in ZodMiniType.");
7387
+ $ZodType.init(inst, def);
7388
+ inst.def = def;
7389
+ inst.type = def.type;
7390
+ inst.parse = (data, params) => parse$1(inst, data, params, { callee: inst.parse });
7391
+ inst.safeParse = (data, params) => safeParse$1(inst, data, params);
7392
+ inst.parseAsync = async (data, params) => parseAsync$1(inst, data, params, { callee: inst.parseAsync });
7393
+ inst.safeParseAsync = async (data, params) => safeParseAsync$1(inst, data, params);
7394
+ inst.check = (...checks) => {
7395
+ return inst.clone({
7396
+ ...def,
7397
+ checks: [
7398
+ ...(def.checks ?? []),
7399
+ ...checks.map((ch) => typeof ch === "function"
7400
+ ? {
7401
+ _zod: { check: ch, def: { check: "custom" }, onattach: [] },
7402
+ }
7403
+ : ch),
7404
+ ],
7405
+ }, { parent: true });
7406
+ };
7407
+ inst.with = inst.check;
7408
+ inst.clone = (_def, params) => clone(inst, _def, params);
7409
+ inst.brand = () => inst;
7410
+ inst.register = ((reg, meta) => {
7411
+ reg.add(inst, meta);
7412
+ return inst;
7413
+ });
7414
+ inst.apply = (fn) => fn(inst);
7415
+ });
7416
+ const ZodMiniString = /*@__PURE__*/ $constructor("ZodMiniString", (inst, def) => {
7417
+ $ZodString.init(inst, def);
7418
+ ZodMiniType.init(inst, def);
7419
+ });
7420
+ // @__NO_SIDE_EFFECTS__
7421
+ function string(params) {
7422
+ return _string(ZodMiniString, params);
7423
+ }
7424
+ const ZodMiniNumber = /*@__PURE__*/ $constructor("ZodMiniNumber", (inst, def) => {
7425
+ $ZodNumber.init(inst, def);
7426
+ ZodMiniType.init(inst, def);
7427
+ });
7428
+ // @__NO_SIDE_EFFECTS__
7429
+ function number(params) {
7430
+ return _number(ZodMiniNumber, params);
7431
+ }
7432
+ const ZodMiniNumberFormat = /*@__PURE__*/ $constructor("ZodMiniNumberFormat", (inst, def) => {
7433
+ $ZodNumberFormat.init(inst, def);
7434
+ ZodMiniNumber.init(inst, def);
7435
+ });
7436
+ // int
7437
+ // @__NO_SIDE_EFFECTS__
7438
+ function int(params) {
7439
+ return _int(ZodMiniNumberFormat, params);
7440
+ }
7441
+ const ZodMiniNull = /*@__PURE__*/ $constructor("ZodMiniNull", (inst, def) => {
7442
+ $ZodNull.init(inst, def);
7443
+ ZodMiniType.init(inst, def);
7444
+ });
7445
+ // @__NO_SIDE_EFFECTS__
7446
+ function _null(params) {
7447
+ return _null$2(ZodMiniNull, params);
7448
+ }
7449
+ const ZodMiniNever = /*@__PURE__*/ $constructor("ZodMiniNever", (inst, def) => {
7450
+ $ZodNever.init(inst, def);
7451
+ ZodMiniType.init(inst, def);
7452
+ });
7453
+ // @__NO_SIDE_EFFECTS__
7454
+ function never(params) {
7455
+ return _never(ZodMiniNever, params);
7456
+ }
7457
+ const ZodMiniArray = /*@__PURE__*/ $constructor("ZodMiniArray", (inst, def) => {
7458
+ $ZodArray.init(inst, def);
7459
+ ZodMiniType.init(inst, def);
7460
+ });
7461
+ // @__NO_SIDE_EFFECTS__
7462
+ function array(element, params) {
7463
+ return new ZodMiniArray({
7464
+ type: "array",
7465
+ element: element,
7466
+ ...normalizeParams(params),
7467
+ });
7468
+ }
7469
+ const ZodMiniObject = /*@__PURE__*/ $constructor("ZodMiniObject", (inst, def) => {
7470
+ $ZodObject.init(inst, def);
7471
+ ZodMiniType.init(inst, def);
7472
+ defineLazy(inst, "shape", () => def.shape);
7473
+ });
7474
+ // strictObject
7475
+ // @__NO_SIDE_EFFECTS__
7476
+ function strictObject(shape, params) {
7477
+ return new ZodMiniObject({
7478
+ type: "object",
7479
+ shape,
7480
+ catchall: never(),
7481
+ ...normalizeParams(params),
7482
+ });
7483
+ }
7484
+ const ZodMiniUnion = /*@__PURE__*/ $constructor("ZodMiniUnion", (inst, def) => {
7485
+ $ZodUnion.init(inst, def);
7486
+ ZodMiniType.init(inst, def);
7487
+ });
7488
+ // @__NO_SIDE_EFFECTS__
7489
+ function union(options, params) {
7490
+ return new ZodMiniUnion({
7491
+ type: "union",
7492
+ options: options,
7493
+ ...normalizeParams(params),
7494
+ });
7495
+ }
7496
+ const ZodMiniLiteral = /*@__PURE__*/ $constructor("ZodMiniLiteral", (inst, def) => {
7497
+ $ZodLiteral.init(inst, def);
7498
+ ZodMiniType.init(inst, def);
7499
+ });
7500
+ // @__NO_SIDE_EFFECTS__
7501
+ function literal(value, params) {
7502
+ return new ZodMiniLiteral({
7503
+ type: "literal",
7504
+ values: Array.isArray(value) ? value : [value],
7505
+ ...normalizeParams(params),
7506
+ });
7507
+ }
7508
+ const ZodMiniOptional = /*@__PURE__*/ $constructor("ZodMiniOptional", (inst, def) => {
7509
+ $ZodOptional.init(inst, def);
7510
+ ZodMiniType.init(inst, def);
7511
+ });
7512
+ // @__NO_SIDE_EFFECTS__
7513
+ function optional(innerType) {
7514
+ return new ZodMiniOptional({
7515
+ type: "optional",
7516
+ innerType: innerType,
7517
+ });
7518
+ }
7519
+ const ZodMiniLazy = /*@__PURE__*/ $constructor("ZodMiniLazy", (inst, def) => {
7520
+ $ZodLazy.init(inst, def);
7521
+ ZodMiniType.init(inst, def);
7522
+ });
7523
+ // export function lazy<T extends object>(getter: () => T): T {
7524
+ // return util.createTransparentProxy<T>(getter);
7525
+ // }
7526
+ // @__NO_SIDE_EFFECTS__
7527
+ function _lazy(getter) {
7528
+ return new ZodMiniLazy({
7529
+ type: "lazy",
7530
+ getter: getter,
7531
+ });
7532
+ }
7533
+
7534
+ // 由 scripts/generate-user-data-contract.mjs 从公开 DTO 生成,请勿手改。
7535
+ const definitions = {
7536
+ "ArkGachaAnalysisRecord": strictObject({ "name": string(), "timestamp": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "diff": number(), "negativeDiff": number(), "tag": string(), "missUp": union([literal(false), literal(true)]) }),
7537
+ "GachaRecord": strictObject({ "id": string(), "name": string(), "pool": string(), "rarity": number(), "timestamp": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]) }),
7538
+ "TaskBarHeroSave": strictObject({ "update_time": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "game_version": string(), "account_version": string(), "play_time": number(), "last_saved_time": string(), "common": _lazy(() => definitions["TaskBarHeroCommon"]), "summary": _lazy(() => definitions["TaskBarHeroSummary"]), "heroes": union([_null(), array(_lazy(() => definitions["TaskBarHeroHero"]))]), "rune_save_data": union([_null(), array(_lazy(() => definitions["TaskBarHeroRune"]))]), "pets": union([_null(), array(_lazy(() => definitions["TaskBarHeroPet"]))]), "attributes": union([_null(), array(_lazy(() => definitions["TaskBarHeroAttribute"]))]), "inventory_slots": union([_null(), array(_lazy(() => definitions["TaskBarHeroItemSlot"]))]), "stash_slots": union([_null(), array(_lazy(() => definitions["TaskBarHeroItemSlot"]))]), "item_instances": union([_null(), array(_lazy(() => definitions["TaskBarHeroItemInstance"]))]), "values": _lazy(() => definitions["TaskBarHeroValueSummary"]) }),
7539
+ "TaskBarHeroCommon": strictObject({ "max_completed_stage": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "current_stage_key": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "current_stage_wave": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "arranged_hero_keys": union([_null(), array(union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]))]), "arranged_pet_key": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]) }),
7540
+ "TaskBarHeroSummary": strictObject({ "max_hero_level": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "learned_rune_count": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "unlocked_hero": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "total_hero": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "item_count": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "inventory_slots": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "stash_slots": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]) }),
7541
+ "TaskBarHeroHero": strictObject({ "hero_key": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "hero_level": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "is_unlock": union([literal(false), literal(true)]), "hero_exp": number(), "ability_point": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "allocated_hero_ability_point": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "equipped_item_ids": union([_null(), array(string())]), "equipped_skill_keys": union([_null(), array(union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]))]), "unlocked_attribute_group_keys": union([_null(), array(union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]))]) }),
7542
+ "TaskBarHeroRune": strictObject({ "rune_key": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "level": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]) }),
7543
+ "TaskBarHeroPet": strictObject({ "pet_key": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "is_unlock": union([literal(false), literal(true)]) }),
7544
+ "TaskBarHeroAttribute": strictObject({ "key": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "level": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]) }),
7545
+ "TaskBarHeroItemSlot": strictObject({ "index": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "item_unique_id": string(), "is_unlock": union([literal(false), literal(true)]), "is_unlocked_by_rune": union([literal(false), literal(true)]) }),
7546
+ "TaskBarHeroItemInstance": strictObject({ "item_key": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "unique_id": string(), "is_chaotic": union([literal(false), literal(true)]), "is_blocked": union([literal(false), literal(true)]), "is_server_pending_item": union([literal(false), literal(true)]), "enchant_count": union([_null(), array(union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]))]), "enchant_data": union([_null(), array(_lazy(() => definitions["TaskBarHeroEnchantData"]))]), "item_get_source_type": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "decoration_applied_total_count": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "engraving_applied_total_count": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "inscription_applied_total_count": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]) }),
7547
+ "TaskBarHeroEnchantData": strictObject({ "stat_mod_key": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "tier": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "value": number(), "recipe_type": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "mod_type": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "material_key": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "stat_type": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]) }),
7548
+ "TaskBarHeroValueSummary": strictObject({ "market_value": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "price_state": string(), "currency": string() }),
7549
+ "PhantomBladeZeroUnavailableValue": strictObject({ "value": _null(), "reason": string() }),
7550
+ "PhantomBladeZeroClearanceRecord": strictObject({ "Cycle": optional(union([_null(), number()])), "Ending": number(), "Difficulty": number(), "GameTime": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "Completion": number(), "DiedTimes": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]) }),
7551
+ "PhantomBladeZeroSlotProgress": strictObject({ "playTimeSeconds": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "playTime": string(), "lastLaunch": _lazy(() => definitions["PhantomBladeZeroUnavailableValue"]), "narrativePercentage": number(), "chapter": string(), "remainingDays": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]) }),
7552
+ "PhantomBladeZeroSlotCombat": strictObject({ "loadout": optional(_lazy(() => definitions["PhantomBladeZeroSlotLoadout"])), "totalDeaths": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "cycleDeaths": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "bossKillTotal": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "currentMainWeapon": optional(union([_null(), _lazy(() => definitions["PhantomBladeZeroNamedItem"])])), "mainWeapon": _lazy(() => definitions["PhantomBladeZeroCollectionCount"]), "currentShaqi": optional(union([_null(), _lazy(() => definitions["PhantomBladeZeroNamedItem"])])), "shaqi": _lazy(() => definitions["PhantomBladeZeroCollectionCount"]) }),
7553
+ "PhantomBladeZeroSlotLoadout": strictObject({ "states": optional(union([_null(), array(_lazy(() => definitions["PhantomBladeZeroLoadoutState"]))])), "main_weapons": union([_null(), array(string())]), "shaqi_weapons": union([_null(), array(string())]), "accessory_ids": union([_null(), array(string())]), "top_medicine": string(), "bottom_medicine": string(), "current_weapon_index": number(), "current_shaqi_weapon_index": number() }),
7554
+ "PhantomBladeZeroLoadoutState": strictObject({ "category": string(), "id": string(), "level": optional(number()), "soul_forged": optional(union([literal(false), literal(true)])), "reincarnation_count": optional(number()) }),
7555
+ "PhantomBladeZeroNamedItem": strictObject({ "id": string(), "name": string() }),
7556
+ "PhantomBladeZeroCollectionCount": strictObject({ "unknown": optional(union([string(), number()])), "done": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "total": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]) }),
7557
+ "PhantomBladeZeroSlotAchievementSummary": strictObject({ "unlocked": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "total": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "reason": string() }),
7558
+ "PhantomBladeZeroBossGroup": strictObject({ "map": string(), "mapName": string(), "count": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "bosses": union([_null(), array(_lazy(() => definitions["PhantomBladeZeroBoss"]))]) }),
7559
+ "PhantomBladeZeroBoss": strictObject({ "id": string(), "classPath": string(), "map": string(), "mapName": string(), "encountered": union([literal(false), literal(true)]), "killed": union([literal(false), literal(true)]), "kill": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "attempt": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "bestTimeMs": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "records": union([_null(), array(_lazy(() => definitions["PhantomBladeZeroBossRecord"]))]) }),
7560
+ "PhantomBladeZeroBossRecord": strictObject({ "cycle": string(), "diff": string(), "diffName": string(), "kill": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "attempt": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "bestTimeMs": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]) }),
7561
+ "PhantomBladeZeroSlotCollectibles": strictObject({ "overall": _lazy(() => definitions["PhantomBladeZeroCollectionSummary"]), "craneBellCount": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "byBigMap": union([_null(), array(_lazy(() => definitions["PhantomBladeZeroBigMapProgress"]))]), "currentChapter": _lazy(() => definitions["PhantomBladeZeroChapterProgress"]) }),
7562
+ "PhantomBladeZeroCollectionSummary": strictObject({ "bell": _lazy(() => definitions["PhantomBladeZeroCollectionCount"]), "weapon": _lazy(() => definitions["PhantomBladeZeroCollectionCount"]), "shaqi": _lazy(() => definitions["PhantomBladeZeroCollectionCount"]), "accessory": _lazy(() => definitions["PhantomBladeZeroCollectionCount"]), "medicine": _lazy(() => definitions["PhantomBladeZeroCollectionCount"]), "challenge": _lazy(() => definitions["PhantomBladeZeroCollectionCount"]), "hupo": _lazy(() => definitions["PhantomBladeZeroCollectionCount"]), "heishi": _lazy(() => definitions["PhantomBladeZeroCollectionCount"]), "flower": _lazy(() => definitions["PhantomBladeZeroCollectionCount"]) }),
7563
+ "PhantomBladeZeroBigMapProgress": strictObject({ "unknown": optional(union([string(), number()])), "mapID": string(), "name": string(), "pct": number(), "done": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "total": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "subMaps": union([_null(), array(string())]) }),
7564
+ "PhantomBladeZeroChapterProgress": strictObject({ "unknown": optional(union([string(), number()])), "mapID": string(), "pct": number(), "done": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "total": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "reason": string() }),
7565
+ "PhantomBladeZeroQuestBranch": strictObject({ "BranchID": string(), "TasksProgress": union([_null(), array(union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]))]), "BranchType": string() }),
7566
+ "PhantomBladeZeroInventoryItem": strictObject({ "id": string(), "amount": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]) }),
7567
+ "PhantomBladeZeroLocation": strictObject({ "map": string(), "mapName": string(), "x": number(), "y": number(), "z": number() }),
7568
+ "PhantomBladeZeroChallengeDetail": strictObject({ "key": optional(string()), "unknown": optional(union([literal(false), literal(true)])), "index": union([int().check(_gte(-9007199254740991), _lte(9007199254740991)), string().check(_regex(new RegExp("^-?(0|[1-9][0-9]*)$")))]), "guids": union([_null(), array(string())]), "done": union([literal(false), literal(true)]), "locs": union([_null(), array(_lazy(() => definitions["PhantomBladeZeroLocation"]))]) })};
7569
+ const SNAPSHOT_FIELDS = ['schema_version', 'canPersist', 'resources'];
7570
+ const SNAPSHOT_OPTIONAL_FIELDS = ['egressTier'];
7571
+ const EGRESS_TIER_SET = new Set(['upload', 'no_network']);
7572
+ const RESOURCE_STATE_REQUIRED_FIELDS = [
7573
+ 'resource',
7574
+ 'declared',
7575
+ 'available',
7576
+ 'decision',
7577
+ 'revision',
7578
+ 'sessionAllowed',
7579
+ 'allowed',
7580
+ 'name',
7581
+ 'purposeText',
7582
+ 'scopeFingerprint',
7583
+ ];
7584
+ const RESOURCE_STATE_OPTIONAL_FIELDS = ['consentFingerprint'];
7585
+ const DECISION_SET = new Set(['ask', 'allow', 'deny']);
7586
+ /**
7587
+ * 严格解析 Host 返回的数据许可快照。
7588
+ *
7589
+ * @param value - 桥方法返回的未知值。
7590
+ * @returns 合法时返回归一化并冻结的 {@link DataPermissionSnapshot},否则 `{ valid: false }`。
7591
+ *
7592
+ * @remarks
7593
+ * 校验项:`schema_version === 1`;`revision` 是非负安全整数;`resources` 只包含已发布精确资源 key
7594
+ * 且不重复;每个资源状态字段齐全、类型正确、`decision` 合法;`consentFingerprint` 只允许出现在持久
7595
+ * `allow` 上。未知字段一律拒绝,避免 Host 把私人决定或额外私有字段顺带塞进公开页面。
7596
+ *
7597
+ * @since 0.9.6
7598
+ */
7599
+ function parseDataPermissionSnapshot(value) {
7600
+ if (!hasExactFields(value, SNAPSHOT_FIELDS, SNAPSHOT_OPTIONAL_FIELDS))
7601
+ return { valid: false };
7602
+ if (value.schema_version !== 1)
7603
+ return { valid: false };
7604
+ if (typeof value.canPersist !== 'boolean')
7605
+ return { valid: false };
7606
+ if (!Array.isArray(value.resources))
7607
+ return { valid: false };
7608
+ if (value.resources.length > USER_GAME_DATA_RESOURCE_KEYS.length)
7609
+ return { valid: false };
7610
+ if (value.egressTier !== undefined && (typeof value.egressTier !== 'string' || !EGRESS_TIER_SET.has(value.egressTier))) {
7611
+ return { valid: false };
7612
+ }
7613
+ const seen = new Set();
7614
+ const resources = [];
7615
+ for (const entry of value.resources) {
7616
+ const parsed = parseResourceState(entry);
7617
+ if (!parsed)
7618
+ return { valid: false };
7619
+ if (seen.has(parsed.resource))
7620
+ return { valid: false };
7621
+ seen.add(parsed.resource);
7622
+ resources.push(parsed);
7623
+ }
7624
+ return {
7625
+ valid: true,
7626
+ snapshot: Object.freeze({
7627
+ schema_version: 1,
7628
+ canPersist: value.canPersist,
7629
+ resources: Object.freeze(resources),
7630
+ ...(value.egressTier === undefined ? {} : { egressTier: value.egressTier }),
7631
+ }),
7632
+ };
7633
+ }
7634
+ function parseResourceState(value) {
7635
+ if (!hasExactFields(value, RESOURCE_STATE_REQUIRED_FIELDS, RESOURCE_STATE_OPTIONAL_FIELDS)) {
7636
+ return undefined;
7637
+ }
7638
+ if (typeof value.resource !== 'string' || !isUserGameDataResourceKey(value.resource))
7639
+ return undefined;
7640
+ if (typeof value.declared !== 'boolean')
7641
+ return undefined;
7642
+ if (typeof value.available !== 'boolean')
7643
+ return undefined;
7644
+ if (typeof value.decision !== 'string' || !DECISION_SET.has(value.decision))
7645
+ return undefined;
7646
+ if (!isNonNegativeSafeInteger(value.revision))
7647
+ return undefined;
7648
+ if (typeof value.name !== 'string' || typeof value.purposeText !== 'string' || typeof value.scopeFingerprint !== 'string')
7649
+ return undefined;
7650
+ if (typeof value.allowed !== 'boolean' || typeof value.sessionAllowed !== 'boolean')
7651
+ return undefined;
7652
+ const hasFingerprint = Object.prototype.hasOwnProperty.call(value, 'consentFingerprint');
7653
+ if (hasFingerprint) {
7654
+ if (value.decision !== 'allow')
7655
+ return undefined;
7656
+ if (typeof value.consentFingerprint !== 'string' || value.consentFingerprint.length === 0) {
7657
+ return undefined;
7658
+ }
7659
+ }
7660
+ return {
7661
+ resource: value.resource,
7662
+ declared: value.declared,
7663
+ available: value.available,
7664
+ decision: value.decision,
7665
+ revision: value.revision,
7666
+ name: value.name,
7667
+ purposeText: value.purposeText,
7668
+ scopeFingerprint: value.scopeFingerprint,
7669
+ sessionAllowed: value.sessionAllowed,
7670
+ allowed: value.allowed,
7671
+ ...(hasFingerprint ? { consentFingerprint: value.consentFingerprint } : {}),
7672
+ };
7673
+ }
7674
+ function isRecord$2(value) {
7675
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
7676
+ }
7677
+ function isNonNegativeSafeInteger(value) {
7678
+ return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0;
7679
+ }
7680
+ function hasExactFields(value, required, optional = []) {
7681
+ if (!isRecord$2(value))
7682
+ return false;
7683
+ const keys = Object.keys(value);
7684
+ for (const key of keys) {
7685
+ if (!required.includes(key) && !optional.includes(key))
7686
+ return false;
7687
+ }
7688
+ for (const key of required) {
7689
+ if (!Object.prototype.hasOwnProperty.call(value, key))
7690
+ return false;
7691
+ }
7692
+ return true;
7693
+ }
7694
+
7164
7695
  /** 仅 SDK 内部拥有状态更新入口,业务只可读。 */
7165
7696
  function createWorkspaceCardsModule(client) {
7166
7697
  let context = null;
@@ -7509,7 +8040,7 @@ function createMessageId() {
7509
8040
  /** 构建时替换为当前发布包的实际版本。 */
7510
8041
  const HB_SDK_VERSION = typeof undefined === 'string'
7511
8042
  ? undefined
7512
- : '0.9.6-alpha.11';
8043
+ : '0.9.6-alpha.14';
7513
8044
 
7514
8045
  const RUNTIME_MODES = new Set(['production', 'preview', 'development', 'unknown']);
7515
8046
  const OPERATING_SYSTEM_NAMES = new Set(['android', 'ios', 'ohos', 'windows', 'macos', 'linux', 'unknown']);
@@ -7555,8 +8086,17 @@ function readRecord$1(value) {
7555
8086
  }
7556
8087
 
7557
8088
  const DEFAULT_TIMEOUT = 10000;
7558
- // 选择器等待、截图延迟、登录和关注确认由 Host 管理,使用长操作生命周期,不设固定总时长。
7559
- const HOST_MANAGED_TIMEOUT_METHODS = new Set([FILES_PICK_FILES_METHOD, FILES_PICK_DIRECTORY_METHOD, FILES_SAVE_FILE_METHOD, SHARE_SCREENSHOT_METHOD, SHARE_SCREENSHOT_LONG_METHOD, USER_REQUEST_FOLLOW_AUTHOR_METHOD]);
8089
+ // 这些操作等待 Host 的真实终态或用户选择,不使用普通请求的固定总时长。
8090
+ const HOST_MANAGED_TIMEOUT_METHODS = new Set([
8091
+ FILES_PICK_FILES_METHOD, FILES_PICK_DIRECTORY_METHOD, FILES_SAVE_FILE_METHOD,
8092
+ SHARE_SCREENSHOT_METHOD, SHARE_SCREENSHOT_LONG_METHOD, USER_REQUEST_FOLLOW_AUTHOR_METHOD,
8093
+ USER_DATA_FILE_METHOD, USER_DATA_SYNC_METHOD,
8094
+ USER_DATA_PERMISSION_REQUEST_METHOD, USER_DATA_PERMISSION_OPEN_SETTINGS_METHOD,
8095
+ ]);
8096
+ /** SDK 内部共用的长操作分类;资料模块与普通 request 使用同一超时策略。 */
8097
+ function isHostManagedOperation(method) {
8098
+ return HOST_MANAGED_TIMEOUT_METHODS.has(method);
8099
+ }
7560
8100
  const HANDSHAKE_RETRY_INTERVAL = 250;
7561
8101
  /** 底层 bridge client,负责握手、请求响应、事件分发与超时清理。 */
7562
8102
  class MiniProgramBridgeClient {
@@ -7639,7 +8179,7 @@ class MiniProgramBridgeClient {
7639
8179
  }
7640
8180
  /** 调用父容器开放能力。 */
7641
8181
  async request(method, ...args) {
7642
- return this.performRequest(method, args[0], !HOST_MANAGED_TIMEOUT_METHODS.has(method), undefined, true);
8182
+ return this.performRequest(method, args[0], !isHostManagedOperation(method), undefined, true);
7643
8183
  }
7644
8184
  /** 发起不使用固定总时长 timer 的长操作。 */
7645
8185
  async requestOperation(method, payload, options = {}) {
@@ -11643,8 +12183,327 @@ function getSteamGameList(requester, options) {
11643
12183
  return requester.request(USER_GET_STEAM_GAME_LIST_METHOD, options);
11644
12184
  }
11645
12185
 
12186
+ function isRecord$1(value) {
12187
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
12188
+ }
12189
+ function requireRecord(value, label) {
12190
+ if (!isRecord$1(value))
12191
+ throw createSDKError('INVALID_RESPONSE', `${label}响应无效`);
12192
+ return value;
12193
+ }
12194
+ function requireString(value, label) {
12195
+ if (typeof value !== 'string')
12196
+ throw createSDKError('INVALID_RESPONSE', `${label}响应无效`);
12197
+ return value;
12198
+ }
12199
+ function readReadMeta(value) {
12200
+ if (value === undefined)
12201
+ return {};
12202
+ const input = requireRecord(value, 'meta');
12203
+ if (input.cacheHit !== undefined && typeof input.cacheHit !== 'boolean')
12204
+ throw createSDKError('INVALID_RESPONSE', 'meta 响应无效');
12205
+ return {
12206
+ ...(typeof input.cacheHit === 'boolean' ? { cacheHit: input.cacheHit } : {}),
12207
+ ...(typeof input.sourceRevision === 'string' ? { sourceRevision: input.sourceRevision } : {}),
12208
+ };
12209
+ }
12210
+ async function requestUserGameData(requester, method, payload, signal, cancelledCode = 'REQUEST_CANCELLED', cancelledMessage = '资料请求已取消') {
12211
+ if (signal?.aborted)
12212
+ throw createSDKError(cancelledCode, cancelledMessage);
12213
+ const operation = requester;
12214
+ const cancellableSignal = signal && typeof signal.addEventListener === 'function' ? signal : undefined;
12215
+ if (typeof operation.requestOperation === 'function' && (isHostManagedOperation(method) || cancellableSignal))
12216
+ return operation.requestOperation(method, payload, {
12217
+ ...(cancellableSignal ? { signal: cancellableSignal } : {}),
12218
+ createAbortError: () => createSDKError(cancelledCode, cancelledMessage),
12219
+ });
12220
+ const send = requester.request.bind(requester);
12221
+ return send(method, payload);
12222
+ }
12223
+ /** 只是 SDK 调用组合:真实授权、账号和交付策略仍由 Runtime 决定。 */
12224
+ function decorateBlocked(requester, value, retry) {
12225
+ if (typeof value.resource !== 'string' ||
12226
+ !isUserGameDataResourceKey(value.resource) ||
12227
+ !['login_required', 'permission_required', 'permission_denied', 'source_not_linked', 'source_login_required'].includes(String(value.reason)))
12228
+ throw createSDKError('INVALID_RESPONSE', '资料阻塞状态无效');
12229
+ const resource = value.resource;
12230
+ const message = requireString(value.message, '资料说明');
12231
+ const blocked = { status: 'blocked', resource, reason: value.reason, message };
12232
+ if (value.interaction === undefined)
12233
+ return blocked;
12234
+ const interaction = requireRecord(value.interaction, '交互');
12235
+ if (!['permission', 'manage', 'user_login'].includes(String(interaction.type)))
12236
+ throw createSDKError('INVALID_RESPONSE', '交互类型无效');
12237
+ return {
12238
+ ...blocked,
12239
+ action: Object.freeze({
12240
+ resource,
12241
+ type: interaction.type,
12242
+ label: requireString(interaction.label, '交互说明'),
12243
+ async resolve(options = {}) {
12244
+ try {
12245
+ const result = await requestUserGameData(requester, USER_DATA_PERMISSION_REQUEST_METHOD, { resource }, options.signal);
12246
+ if (result.status === 'cancelled')
12247
+ return null;
12248
+ return retry(options.signal);
12249
+ }
12250
+ catch (cause) {
12251
+ if (options.signal?.aborted || (isRecord$1(cause) && ['REQUEST_CANCELLED', 'AUTH_CANCELLED', 'LOGIN_CANCELLED'].includes(String(cause.code))))
12252
+ return null;
12253
+ throw cause;
12254
+ }
12255
+ },
12256
+ }),
12257
+ };
12258
+ }
12259
+ function convertWireReadResult(requester, value, convert, retry, schemaVersion) {
12260
+ const input = requireRecord(value, '资料');
12261
+ if (input.status !== 'blocked' && input.schemaVersion !== schemaVersion)
12262
+ throw createSDKError('REQUEST_UNSUPPORTED', 'SDK 与宿主正文版本不匹配');
12263
+ if (input.status === 'ready')
12264
+ return { status: 'ready', data: convert(input.data), meta: readReadMeta(input.meta) };
12265
+ if (input.status === 'empty' && (input.reason === 'no_data' || input.reason === 'not_ready'))
12266
+ return { status: 'empty', reason: input.reason, message: requireString(input.message, '空资料说明'), meta: readReadMeta(input.meta) };
12267
+ if (input.status === 'blocked')
12268
+ return decorateBlocked(requester, input, retry);
12269
+ throw createSDKError('INVALID_RESPONSE', '资料状态无效');
12270
+ }
12271
+ function convertWireSyncResult(requester, value, retry) {
12272
+ const input = requireRecord(value, '同步');
12273
+ if (input.status === 'succeeded')
12274
+ return { status: 'succeeded' };
12275
+ if (input.status === 'blocked')
12276
+ return decorateBlocked(requester, input, retry);
12277
+ throw createSDKError('INVALID_RESPONSE', '同步状态无效');
12278
+ }
12279
+
12280
+ /** 游戏门面与存档门面共用的精确资源映射,不依赖任一门面工厂。 */
12281
+ function resourceFor(game, family) {
12282
+ const resource = GAME_DATA_RESOURCE_CATALOG.find((value) => value.game === game && value.family === family);
12283
+ if (!resource)
12284
+ throw createSDKError('REQUEST_UNSUPPORTED', '游戏没有开放这类资料');
12285
+ return resource.key;
12286
+ }
12287
+ function queryPayload(game, family, operation) {
12288
+ const resource = resourceFor(game, family);
12289
+ const query = getUserDataResourceContract(resource).queries[operation];
12290
+ if (!query)
12291
+ throw createSDKError('REQUEST_UNSUPPORTED', '未开放资料操作');
12292
+ return { resource, operation, schemaVersion: query.version };
12293
+ }
12294
+
12295
+ /** 创建响应校验失败错误。 */
12296
+ function invalidResponse(message) {
12297
+ return createSDKError('INVALID_RESPONSE', message);
12298
+ }
12299
+ /**
12300
+ * 创建单个云存档文件对象。
12301
+ *
12302
+ * @remarks
12303
+ * 对象只持有查询快照中的 `gameId`/`saveId`/`fileId` 与公开元数据,冻结后不可改写。`downloadFile()`
12304
+ * 不接受 URL、路径或文件 ID,因此不能借对象把下载目标换成其它资源;字节始终由 Host 的受控
12305
+ * 文件句柄交付。
12306
+ */
12307
+ function createSaveFileInfo(requester, gameId, saveId, value) {
12308
+ const record = requireRecord(value, '存档文件元数据');
12309
+ const fileId = requireString(record.fileId, '存档文件 fileId');
12310
+ const name = requireString(record.name, '存档文件 name');
12311
+ if (typeof record.sizeBytes !== 'number' || !Number.isFinite(record.sizeBytes) || record.sizeBytes < 0) {
12312
+ throw invalidResponse('存档文件 sizeBytes 响应不合法');
12313
+ }
12314
+ const modifiedAt = requireString(record.modifiedAt, '存档文件 modifiedAt');
12315
+ return Object.freeze({
12316
+ fileId,
12317
+ name,
12318
+ sizeBytes: record.sizeBytes,
12319
+ modifiedAt,
12320
+ async downloadFile({ signal } = {}) {
12321
+ const descriptor = await requestUserGameData(requester, USER_DATA_FILE_METHOD, { resource: resourceFor(gameId, 'save_files'), saveId, fileId }, signal, 'DOWNLOAD_CANCELLED', '存档下载已取消').catch((error) => {
12322
+ if (signal?.aborted)
12323
+ throw createSDKError('DOWNLOAD_CANCELLED', '存档下载已取消');
12324
+ throw error;
12325
+ });
12326
+ // Host 必须返回只读 direct 文件描述符;写模式、URL/路径或其它形状都按非法响应拒绝。
12327
+ if (!isMiniProgramFileDescriptor(descriptor) || descriptor.mode !== 'read') {
12328
+ throw invalidResponse('存档文件必须为只读文件描述符');
12329
+ }
12330
+ const ref = descriptor.ref;
12331
+ if (!('handleId' in ref) || typeof ref.handleId !== 'string' || ref.handleId.length === 0) {
12332
+ throw invalidResponse('存档文件必须为受控只读文件句柄');
12333
+ }
12334
+ return getFileHandleRegistry(requester).createFile(descriptor);
12335
+ },
12336
+ });
12337
+ }
12338
+ /** 创建单个存档批次;只暴露公开字段,不透传宿主附加的账号或数据库元数据。 */
12339
+ function createSaveInfo(requester, gameId, value) {
12340
+ const record = requireRecord(value, '存档批次');
12341
+ const saveId = requireString(record.saveId, '存档批次 saveId');
12342
+ if (!Array.isArray(record.files))
12343
+ throw invalidResponse('存档批次 files 响应不合法');
12344
+ return Object.freeze({
12345
+ saveId,
12346
+ createdAt: requireString(record.createdAt, '存档批次 createdAt'),
12347
+ files: record.files.map((file) => createSaveFileInfo(requester, gameId, saveId, file)),
12348
+ });
12349
+ }
12350
+ /** 校验存档列表;空数组是合法的 `ready` 结果。 */
12351
+ function convertSaveInfoList(requester, gameId, value) {
12352
+ if (!Array.isArray(value))
12353
+ throw invalidResponse('云存档列表响应不合法');
12354
+ return value.map((entry) => createSaveInfo(requester, gameId, entry));
12355
+ }
12356
+ /**
12357
+ * 创建云存档三方法模块。
12358
+ *
12359
+ * @param requester - 模块发起请求所需的 bridge 能力。
12360
+ * @param gameId - 已开放的存档游戏,方法只作用于该游戏。
12361
+ * @returns `saves` 对象;每次调用重新解析当前来源、许可与解析结果。
12362
+ * @remarks
12363
+ * `list` 不触发同步或解析;`sync` 等待文件同步终态;`getLatestStructuredData` 只读已有结果。
12364
+ * `list()` 交付的文件对象取得受控只读文件句柄,不拼接 URL 或
12365
+ * 路径;四者都不接受账号、Steam AppID 或文件路径参数。
12366
+ *
12367
+ * @since 0.9.6
12368
+ * @hbPlatform android
12369
+ * @hbPlatform ios
12370
+ * @hbPlatform ohos
12371
+ * @hbPlatform windows
12372
+ * @hbPlatform macos
12373
+ * @hbClient android none
12374
+ * @hbClient ios none
12375
+ * @hbClient ohos none
12376
+ * @hbClient windows none
12377
+ * @hbClient macos none
12378
+ */
12379
+ function createUserSavesModule(requester, gameId) {
12380
+ const list = async (options = {}) => {
12381
+ const payload = queryPayload(gameId, 'save_files', 'list');
12382
+ const result = await requestUserGameData(requester, USER_DATA_QUERY_METHOD, payload, options.signal);
12383
+ return convertWireReadResult(requester, result, (value) => {
12384
+ const page = requireRecord(value, '存档列表');
12385
+ if (page.hasMore !== false || page.nextCursor !== undefined)
12386
+ throw invalidResponse('存档列表必须完整返回');
12387
+ return convertSaveInfoList(requester, gameId, page.items);
12388
+ }, (signal) => list({ signal }), payload.schemaVersion);
12389
+ };
12390
+ const sync = async (options = {}) => {
12391
+ const result = await requestUserGameData(requester, USER_DATA_SYNC_METHOD, { game: gameId }, options.signal);
12392
+ return convertWireSyncResult(requester, result, (signal) => sync({ signal }));
12393
+ };
12394
+ const getLatestStructuredData = async (options = {}) => {
12395
+ const payload = queryPayload(gameId, 'save_analysis', 'get');
12396
+ const result = await requestUserGameData(requester, USER_DATA_QUERY_METHOD, payload, options.signal);
12397
+ return convertWireReadResult(requester, result, (value) => requireRecord(value, '存档解析正文'), (signal) => getLatestStructuredData({ signal }), payload.schemaVersion);
12398
+ };
12399
+ return Object.freeze({ list, sync, getLatestStructuredData });
12400
+ }
12401
+
12402
+ function validate(value) {
12403
+ return requireRecord(value, '资料正文');
12404
+ }
12405
+ function createArkGameModule(requester) {
12406
+ const getProfile = async (options = {}) => {
12407
+ const payload = queryPayload('ark', 'profile', 'get');
12408
+ const result = await requestUserGameData(requester, USER_DATA_QUERY_METHOD, payload, options.signal);
12409
+ return convertWireReadResult(requester, result, (value) => validate(value), (signal) => getProfile({ signal }), payload.schemaVersion);
12410
+ };
12411
+ const getGachaAnalysis = async (options = {}) => {
12412
+ const payload = queryPayload('ark', 'gacha', 'get');
12413
+ const result = await requestUserGameData(requester, USER_DATA_QUERY_METHOD, payload, options.signal);
12414
+ return convertWireReadResult(requester, result, (value) => validate(value), (signal) => getGachaAnalysis({ signal }), payload.schemaVersion);
12415
+ };
12416
+ const listGachaRecords = async (options = {}) => {
12417
+ const payload = {
12418
+ ...queryPayload('ark', 'gacha', 'list'),
12419
+ ...(options.cursor === undefined ? {} : { cursor: options.cursor }),
12420
+ ...(options.limit === undefined ? {} : { limit: options.limit }),
12421
+ };
12422
+ const result = await requestUserGameData(requester, USER_DATA_QUERY_METHOD, payload, options.signal);
12423
+ return convertWireReadResult(requester, result, (value) => {
12424
+ const page = requireRecord(value, '分页');
12425
+ if (!Array.isArray(page.items) || typeof page.hasMore !== 'boolean')
12426
+ throw createSDKError('INVALID_RESPONSE', '分页正文无效');
12427
+ return page;
12428
+ }, (signal) => listGachaRecords({ ...options, signal }), payload.schemaVersion);
12429
+ };
12430
+ return Object.freeze({ getProfile, getGachaAnalysis, listGachaRecords });
12431
+ }
12432
+ function createUserGamesModule(requester) {
12433
+ const factories = {
12434
+ ark: () => createArkGameModule(requester),
12435
+ black_myth_wukong: () => ({ saves: createUserSavesModule(requester, 'black_myth_wukong') }),
12436
+ task_bar_hero: () => ({ saves: createUserSavesModule(requester, 'task_bar_hero') }),
12437
+ phantom_blade_zero: () => ({ saves: createUserSavesModule(requester, 'phantom_blade_zero') }),
12438
+ };
12439
+ return Object.freeze({
12440
+ get(game) {
12441
+ if (!isUserGameDataGameId(game))
12442
+ throw createSDKError('REQUEST_UNSUPPORTED', '尚未开放该游戏资料');
12443
+ return factories[game]();
12444
+ },
12445
+ async getOverview(options = {}) {
12446
+ const result = await requester.request(USER_GAMES_GET_OVERVIEW_METHOD, options);
12447
+ if (!Array.isArray(result))
12448
+ throw createSDKError('INVALID_RESPONSE', '资料概览无效');
12449
+ return {
12450
+ status: 'ready',
12451
+ meta: {},
12452
+ data: result.map((value) => {
12453
+ const game = requireRecord(value, '游戏概览');
12454
+ if (typeof game.game !== 'string' || !isUserGameDataGameId(game.game) || !Array.isArray(game.resources))
12455
+ throw createSDKError('INVALID_RESPONSE', '游戏概览无效');
12456
+ return {
12457
+ game: game.game,
12458
+ name: requireString(game.name, '游戏名'),
12459
+ resources: game.resources.map((value) => {
12460
+ const resource = requireRecord(value, '资源概览');
12461
+ if (typeof resource.resource !== 'string' || !isUserGameDataResourceKey(resource.resource) || resource.status !== 'not_checked')
12462
+ throw createSDKError('INVALID_RESPONSE', '资源概览无效');
12463
+ return {
12464
+ resource: resource.resource,
12465
+ name: requireString(resource.name, '资源名'),
12466
+ statusText: requireString(resource.statusText, '状态'),
12467
+ status: 'not_checked',
12468
+ };
12469
+ }),
12470
+ };
12471
+ }),
12472
+ };
12473
+ },
12474
+ });
12475
+ }
12476
+
12477
+ function createUserDataPermissionModule(requester) {
12478
+ function snapshot(value) {
12479
+ const parsed = parseDataPermissionSnapshot(value);
12480
+ if (!parsed.valid)
12481
+ throw createSDKError('INVALID_RESPONSE', '本机许可快照无效');
12482
+ return parsed.snapshot;
12483
+ }
12484
+ return {
12485
+ async request(resource, options = {}) {
12486
+ const result = await requestUserGameData(requester, USER_DATA_PERMISSION_REQUEST_METHOD, { resource }, options.signal);
12487
+ if (!result || !['allowed', 'denied', 'cancelled'].includes(result.status))
12488
+ throw createSDKError('INVALID_RESPONSE', '许可确认结果无效');
12489
+ return result;
12490
+ },
12491
+ async get() {
12492
+ return snapshot(await requester.request(USER_DATA_PERMISSION_GET_METHOD, {}));
12493
+ },
12494
+ async revokeSession(resource) {
12495
+ return snapshot(await requester.request(USER_DATA_PERMISSION_REVOKE_SESSION_METHOD, resource === undefined ? {} : { resource }));
12496
+ },
12497
+ async openSettings() {
12498
+ return snapshot(await requester.request(USER_DATA_PERMISSION_OPEN_SETTINGS_METHOD, {}));
12499
+ },
12500
+ };
12501
+ }
12502
+
11646
12503
  function createUserModule(requester) {
11647
12504
  return {
12505
+ games: createUserGamesModule(requester),
12506
+ dataPermission: createUserDataPermissionModule(requester),
11648
12507
  requestFollowAuthor: () => requestFollowAuthor(requester),
11649
12508
  getFollowStatus: () => getFollowStatus(requester),
11650
12509
  showAppreciation: () => requester.request(USER_SHOW_APPRECIATION_METHOD),
@@ -11931,7 +12790,10 @@ class MiniProgramSDK {
11931
12790
  navigation;
11932
12791
  /** 云端数据相关开放能力。 */
11933
12792
  cloud;
11934
- /** 查询、同步并读取当前用户的 Steam 游戏存档。 */
12793
+ /**
12794
+ * 查询、同步并读取当前用户的 Steam 游戏存档。
12795
+ * @deprecated Since 0.9.6-alpha.12. 请改用 {@link UserGamesModule.get},使用返回对象的 saves 能力;此入口将在 0.10.0 移除。
12796
+ */
11935
12797
  gameSaves;
11936
12798
  /** 受管桌面程序能力。 */
11937
12799
  companion;
@@ -12371,6 +13233,16 @@ const auth = {
12371
13233
  };
12372
13234
  /** 默认 SDK 实例的用户资料模块。 */
12373
13235
  const user = {
13236
+ dataPermission: {
13237
+ request: (resource, options) => getDefaultSDK().user.dataPermission.request(resource, options),
13238
+ get: () => getDefaultSDK().user.dataPermission.get(),
13239
+ revokeSession: (resource) => getDefaultSDK().user.dataPermission.revokeSession(resource),
13240
+ openSettings: () => getDefaultSDK().user.dataPermission.openSettings(),
13241
+ },
13242
+ games: {
13243
+ getOverview: (options) => getDefaultSDK().user.games.getOverview(options),
13244
+ get: (gameId) => getDefaultSDK().user.games.get(gameId),
13245
+ },
12374
13246
  requestFollowAuthor: () => getDefaultSDK().user.requestFollowAuthor(),
12375
13247
  getFollowStatus: () => getDefaultSDK().user.getFollowStatus(),
12376
13248
  showAppreciation: () => getDefaultSDK().user.showAppreciation(),
@@ -12434,13 +13306,16 @@ const navigation = {
12434
13306
  reload: () => getDefaultSDK().navigation.reload(),
12435
13307
  openAppPage: (options) => getDefaultSDK().navigation.openAppPage(options),
12436
13308
  };
12437
- /** 默认 SDK 实例的 cloud 模块。 */
12438
- /** 当前用户的游戏存档能力。 */
13309
+ /**
13310
+ * 当前用户的游戏存档能力。
13311
+ * @deprecated Since 0.9.6-alpha.12. 请改用 {@link UserGamesModule.get},使用返回对象的 saves 能力;此入口将在 0.10.0 移除。
13312
+ */
12439
13313
  const gameSaves = {
12440
13314
  list: (gameId) => getDefaultSDK().gameSaves.list(gameId),
12441
13315
  getLatestStructuredData: (gameId) => getDefaultSDK().gameSaves.getLatestStructuredData(gameId),
12442
13316
  sync: (gameId, options) => getDefaultSDK().gameSaves.sync(gameId, options),
12443
13317
  };
13318
+ /** 默认 SDK 实例的 cloud 模块。 */
12444
13319
  const cloud = {
12445
13320
  leaderboard: {
12446
13321
  submit: (options) => getDefaultSDK().cloud.leaderboard.submit(options),