yxuse 3.0.56 → 3.0.57

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 (47) hide show
  1. package/lib/index.cjs12.js +1 -1
  2. package/lib/index.cjs12.js.gz +0 -0
  3. package/lib/index.cjs12.js.map +1 -1
  4. package/lib/index.cjs2.js +1 -1
  5. package/lib/index.cjs2.js.map +1 -1
  6. package/lib/index.cjs3.js +1 -1
  7. package/lib/index.cjs3.js.map +1 -1
  8. package/lib/index.cjs4.js +1 -1
  9. package/lib/index.cjs4.js.map +1 -1
  10. package/lib/index.cjs5.js +5 -5
  11. package/lib/index.cjs5.js.gz +0 -0
  12. package/lib/index.cjs5.js.map +1 -1
  13. package/lib/index.cjs6.js +3 -3
  14. package/lib/index.cjs6.js.gz +0 -0
  15. package/lib/index.cjs6.js.map +1 -1
  16. package/lib/index.cjs7.js +4 -4
  17. package/lib/index.cjs7.js.gz +0 -0
  18. package/lib/index.cjs7.js.map +1 -1
  19. package/lib/index.es12.js +99 -209
  20. package/lib/index.es12.js.gz +0 -0
  21. package/lib/index.es12.js.map +1 -1
  22. package/lib/index.es2.js +54 -90
  23. package/lib/index.es2.js.map +1 -1
  24. package/lib/index.es3.js +6 -26
  25. package/lib/index.es3.js.map +1 -1
  26. package/lib/index.es4.js +12 -32
  27. package/lib/index.es4.js.map +1 -1
  28. package/lib/index.es5.js +125 -169
  29. package/lib/index.es5.js.gz +0 -0
  30. package/lib/index.es5.js.map +1 -1
  31. package/lib/index.es6.js +162 -184
  32. package/lib/index.es6.js.gz +0 -0
  33. package/lib/index.es6.js.map +1 -1
  34. package/lib/index.es7.js +118 -162
  35. package/lib/index.es7.js.gz +0 -0
  36. package/lib/index.es7.js.map +1 -1
  37. package/lib/mqtt.min.cjs.js +1 -1
  38. package/lib/mqtt.min.cjs.js.gz +0 -0
  39. package/lib/mqtt.min.cjs.js.map +1 -1
  40. package/lib/mqtt.min.es.js +21 -37
  41. package/lib/mqtt.min.es.js.gz +0 -0
  42. package/lib/mqtt.min.es.js.map +1 -1
  43. package/lib/style.css +1 -1
  44. package/lib/style.css.gz +0 -0
  45. package/package.json +1 -1
  46. package/types/components/YxForm/type.d.ts +11 -1
  47. package/types/components/YxUpload/index.vue.d.ts +2 -1
package/lib/index.es5.js CHANGED
@@ -1,46 +1,12 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
2
  var __typeError = (msg) => {
6
3
  throw TypeError(msg);
7
4
  };
8
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __spreadValues = (a, b) => {
10
- for (var prop in b || (b = {}))
11
- if (__hasOwnProp.call(b, prop))
12
- __defNormalProp(a, prop, b[prop]);
13
- if (__getOwnPropSymbols)
14
- for (var prop of __getOwnPropSymbols(b)) {
15
- if (__propIsEnum.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- }
18
- return a;
19
- };
20
6
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
7
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
22
8
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
23
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
24
- var __async = (__this, __arguments, generator) => {
25
- return new Promise((resolve, reject) => {
26
- var fulfilled = (value) => {
27
- try {
28
- step(generator.next(value));
29
- } catch (e) {
30
- reject(e);
31
- }
32
- };
33
- var rejected = (value) => {
34
- try {
35
- step(generator.throw(value));
36
- } catch (e) {
37
- reject(e);
38
- }
39
- };
40
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
41
- step((generator = generator.apply(__this, __arguments)).next());
42
- });
43
- };
44
10
  var _elId;
45
11
  import { g as getCommentUntreatedCount, b as getUserThemeList } from "./index.es4.js";
46
12
  import { createElementBlock, openBlock, createStaticVNode, createElementVNode, withDirectives, toDisplayString, vShow, resolveComponent, createBlock, Transition, withCtx, normalizeClass, createCommentVNode, normalizeStyle, Fragment, renderList, resolveDynamicComponent, useCssVars, createVNode, version as version$1, createApp } from "vue";
@@ -16559,7 +16525,7 @@ var autoScroll = throttle(function(evt, options, rootEl2, isFallback) {
16559
16525
  clearInterval(autoScrolls[layersOut].pid);
16560
16526
  if (vx != 0 || vy != 0) {
16561
16527
  scrollThisInstance = true;
16562
- autoScrolls[layersOut].pid = setInterval(function() {
16528
+ autoScrolls[layersOut].pid = setInterval((function() {
16563
16529
  if (isFallback && this.layer === 0) {
16564
16530
  Sortable.active._onTouchMove(touchEvt$1);
16565
16531
  }
@@ -16571,7 +16537,7 @@ var autoScroll = throttle(function(evt, options, rootEl2, isFallback) {
16571
16537
  }
16572
16538
  }
16573
16539
  scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
16574
- }.bind({
16540
+ }).bind({
16575
16541
  layer: layersOut
16576
16542
  }), 24);
16577
16543
  }
@@ -18898,12 +18864,12 @@ const localforage = /* @__PURE__ */ getDefaultExportFromCjs(localforageExports);
18898
18864
  localforage.config({
18899
18865
  name: "yxI18n"
18900
18866
  });
18901
- const dbSetItem = (key, value) => __async(void 0, null, function* () {
18902
- yield localforage.setItem(key, value);
18903
- });
18904
- const dbGetItem = (key) => __async(void 0, null, function* () {
18905
- return yield localforage.getItem(key);
18906
- });
18867
+ const dbSetItem = async (key, value) => {
18868
+ await localforage.setItem(key, value);
18869
+ };
18870
+ const dbGetItem = async (key) => {
18871
+ return await localforage.getItem(key);
18872
+ };
18907
18873
  const setLang = (lang2) => {
18908
18874
  changeSystemConfig("lang", lang2);
18909
18875
  };
@@ -18913,9 +18879,9 @@ const defaultApiUrl = {
18913
18879
  const config$1 = {
18914
18880
  URL: getSystemConfig("translateApiUrl") || defaultApiUrl.URL
18915
18881
  };
18916
- const translate = (_0) => __async(void 0, [_0], function* ({ words, systemFlag, toSource = "en", fromSource = "zh", translateApiUrl }) {
18882
+ const translate = async ({ words, systemFlag, toSource = "en", fromSource = "zh", translateApiUrl }) => {
18917
18883
  try {
18918
- const { data } = yield http.post(
18884
+ const { data } = await http.post(
18919
18885
  translateApiUrl ? translateApiUrl : config$1.URL,
18920
18886
  {
18921
18887
  words,
@@ -18929,22 +18895,22 @@ const translate = (_0) => __async(void 0, [_0], function* ({ words, systemFlag,
18929
18895
  } catch (e) {
18930
18896
  return null;
18931
18897
  }
18932
- });
18898
+ };
18933
18899
  const sqlKey = `${getSystemConfig("systemKey")}_${window.lang}`;
18934
18900
  const whitelistApi = [
18935
18901
  "/gateway/integrated-management/api/v1/theme/list",
18936
18902
  "/gateway/integrated-management/api/v1/translate/get",
18937
18903
  ...getSystemConfig("whitelistTranslateApi")
18938
18904
  ];
18939
- const getYxI18nThesaurus = () => __async(void 0, null, function* () {
18940
- const lang2 = yield dbGetItem("lang");
18941
- return yield dbGetItem(`${getSystemConfig("systemKey")}_${lang2}`);
18942
- });
18943
- const handleTranslation = (data) => __async(void 0, null, function* () {
18905
+ const getYxI18nThesaurus = async () => {
18906
+ const lang2 = await dbGetItem("lang");
18907
+ return await dbGetItem(`${getSystemConfig("systemKey")}_${lang2}`);
18908
+ };
18909
+ const handleTranslation = async (data) => {
18944
18910
  let result = JSON.stringify(data);
18945
18911
  const chineseRegex = /[\u4e00-\u9fa5]+/g;
18946
18912
  const matches2 = result.match(chineseRegex);
18947
- const yxI18nThesaurus = yield getYxI18nThesaurus();
18913
+ const yxI18nThesaurus = await getYxI18nThesaurus();
18948
18914
  let waitWords = [];
18949
18915
  if (matches2) {
18950
18916
  for (const match of matches2) {
@@ -18957,22 +18923,20 @@ const handleTranslation = (data) => __async(void 0, null, function* () {
18957
18923
  }
18958
18924
  }
18959
18925
  if (waitWords.length > 0) {
18960
- const i18nMap = yield translatedText(waitWords);
18926
+ const i18nMap = await translatedText(waitWords);
18961
18927
  waitWords.forEach((word) => {
18962
18928
  result = result.replace(new RegExp(word, "g"), i18nMap[word]);
18963
18929
  });
18964
- const newYxI18nThesaurus = __spreadValues(__spreadValues({}, yxI18nThesaurus), i18nMap);
18965
- yield dbSetItem(sqlKey, newYxI18nThesaurus);
18930
+ const newYxI18nThesaurus = { ...yxI18nThesaurus, ...i18nMap };
18931
+ await dbSetItem(sqlKey, newYxI18nThesaurus);
18966
18932
  waitWords = [];
18967
18933
  }
18968
18934
  }
18969
18935
  return JSON.parse(result);
18970
- });
18971
- function translatedText(words) {
18972
- return __async(this, null, function* () {
18973
- const result = yield translate({ words, toSource: window.lang, systemFlag: getSystemConfig("systemKey") });
18974
- return result;
18975
- });
18936
+ };
18937
+ async function translatedText(words) {
18938
+ const result = await translate({ words, toSource: window.lang, systemFlag: getSystemConfig("systemKey") });
18939
+ return result;
18976
18940
  }
18977
18941
  var lodash = { exports: {} };
18978
18942
  /**
@@ -24496,21 +24460,19 @@ class Translate {
24496
24460
  this.translateApiUrl = null;
24497
24461
  this.maxWordsLength = 100;
24498
24462
  }
24499
- initTranslate(_0) {
24500
- return __async(this, arguments, function* ({
24501
- to,
24502
- systemKey,
24503
- translateApiUrl,
24504
- asyncThesaurusList
24505
- }) {
24506
- if (to === "zh") return;
24507
- if (to === "cht") return this.handleTraditionalChinese();
24508
- if (translateApiUrl) {
24509
- this.translateApiUrl = translateApiUrl;
24510
- }
24511
- yield this.initConfig({ to, systemKey, asyncThesaurusList });
24512
- this.observerRouteChange();
24513
- });
24463
+ async initTranslate({
24464
+ to,
24465
+ systemKey,
24466
+ translateApiUrl,
24467
+ asyncThesaurusList
24468
+ }) {
24469
+ if (to === "zh") return;
24470
+ if (to === "cht") return this.handleTraditionalChinese();
24471
+ if (translateApiUrl) {
24472
+ this.translateApiUrl = translateApiUrl;
24473
+ }
24474
+ await this.initConfig({ to, systemKey, asyncThesaurusList });
24475
+ this.observerRouteChange();
24514
24476
  }
24515
24477
  // 繁体字处理
24516
24478
  handleTraditionalChinese() {
@@ -24740,28 +24702,26 @@ class Translate {
24740
24702
  }
24741
24703
  }
24742
24704
  //等待本次同步后,收集未翻译的字符,去后端进行翻译
24743
- translateUnknownWords(unknownWords, size) {
24744
- return __async(this, null, function* () {
24745
- if (unknownWords.length == 0) return;
24746
- const unknownWordsFilter = unknownWords.filter((item) => (item + "").trim() !== "");
24747
- if (unknownWordsFilter.length === 0) return;
24748
- const words = Array.from(new Set(unknownWordsFilter));
24749
- const result = yield translate({
24750
- words,
24751
- toSource: this.to,
24752
- systemFlag: this.systemKey,
24753
- translateApiUrl: this.translateApiUrl
24754
- });
24755
- if (!result || Object.keys(result).length === 0) {
24756
- this.unknownWords = [];
24757
- return;
24758
- }
24759
- this.yxI18nThesaurus = __spreadValues(__spreadValues({}, this.yxI18nThesaurus), result);
24760
- yield dbSetItem(this.dbKey, this.yxI18nThesaurus);
24761
- this.unknownWords = [];
24762
- this.replaceUnknownWordsNodeList();
24763
- this.startMicroTaskQueue();
24705
+ async translateUnknownWords(unknownWords, size) {
24706
+ if (unknownWords.length == 0) return;
24707
+ const unknownWordsFilter = unknownWords.filter((item) => (item + "").trim() !== "");
24708
+ if (unknownWordsFilter.length === 0) return;
24709
+ const words = Array.from(new Set(unknownWordsFilter));
24710
+ const result = await translate({
24711
+ words,
24712
+ toSource: this.to,
24713
+ systemFlag: this.systemKey,
24714
+ translateApiUrl: this.translateApiUrl
24764
24715
  });
24716
+ if (!result || Object.keys(result).length === 0) {
24717
+ this.unknownWords = [];
24718
+ return;
24719
+ }
24720
+ this.yxI18nThesaurus = { ...this.yxI18nThesaurus, ...result };
24721
+ await dbSetItem(this.dbKey, this.yxI18nThesaurus);
24722
+ this.unknownWords = [];
24723
+ this.replaceUnknownWordsNodeList();
24724
+ this.startMicroTaskQueue();
24765
24725
  }
24766
24726
  replaceUnknownWordsNodeList(isClear = false) {
24767
24727
  if (this.unknownWordsNode.size > 0) {
@@ -24774,49 +24734,47 @@ class Translate {
24774
24734
  }
24775
24735
  }
24776
24736
  //初始化配置
24777
- initConfig(_0) {
24778
- return __async(this, arguments, function* ({ to, systemKey, asyncThesaurusList }) {
24779
- this.to = to || this.to;
24780
- this.systemKey = systemKey || this.systemKey;
24781
- this.dbKey = `${this.systemKey}_${this.to}`;
24782
- document.querySelector("html").classList.add(to);
24783
- this.rootDocument = document.querySelector("body");
24784
- const lang2 = yield dbGetItem("lang");
24785
- lang2 !== to ? yield dbSetItem("lang", to) : "";
24786
- const db = yield dbGetItem(this.dbKey);
24787
- const asyncThesaurus = () => __async(this, null, function* () {
24788
- const result = yield translate({
24737
+ async initConfig({ to, systemKey, asyncThesaurusList }) {
24738
+ this.to = to || this.to;
24739
+ this.systemKey = systemKey || this.systemKey;
24740
+ this.dbKey = `${this.systemKey}_${this.to}`;
24741
+ document.querySelector("html").classList.add(to);
24742
+ this.rootDocument = document.querySelector("body");
24743
+ const lang2 = await dbGetItem("lang");
24744
+ lang2 !== to ? await dbSetItem("lang", to) : "";
24745
+ const db = await dbGetItem(this.dbKey);
24746
+ const asyncThesaurus = async () => {
24747
+ const result = await translate({
24748
+ words: [],
24749
+ toSource: this.to,
24750
+ systemFlag: this.systemKey,
24751
+ translateApiUrl: this.translateApiUrl
24752
+ });
24753
+ this.yxI18nThesaurus = result;
24754
+ await dbSetItem(this.dbKey, this.yxI18nThesaurus);
24755
+ };
24756
+ if (!db) {
24757
+ await dbSetItem(this.dbKey, {});
24758
+ asyncThesaurus();
24759
+ } else {
24760
+ try {
24761
+ asyncThesaurus();
24762
+ } catch (error) {
24763
+ this.yxI18nThesaurus = db;
24764
+ }
24765
+ }
24766
+ if (asyncThesaurusList && asyncThesaurusList.length > 0) {
24767
+ for (const systemKey2 of asyncThesaurusList) {
24768
+ const result = await translate({
24789
24769
  words: [],
24790
24770
  toSource: this.to,
24791
- systemFlag: this.systemKey,
24771
+ systemFlag: systemKey2,
24792
24772
  translateApiUrl: this.translateApiUrl
24793
24773
  });
24794
- this.yxI18nThesaurus = result;
24795
- yield dbSetItem(this.dbKey, this.yxI18nThesaurus);
24796
- });
24797
- if (!db) {
24798
- yield dbSetItem(this.dbKey, {});
24799
- asyncThesaurus();
24800
- } else {
24801
- try {
24802
- asyncThesaurus();
24803
- } catch (error) {
24804
- this.yxI18nThesaurus = db;
24805
- }
24806
- }
24807
- if (asyncThesaurusList && asyncThesaurusList.length > 0) {
24808
- for (const systemKey2 of asyncThesaurusList) {
24809
- const result = yield translate({
24810
- words: [],
24811
- toSource: this.to,
24812
- systemFlag: systemKey2,
24813
- translateApiUrl: this.translateApiUrl
24814
- });
24815
- const dbKey = `${systemKey2}_${this.to}`;
24816
- yield dbSetItem(dbKey, result);
24817
- }
24774
+ const dbKey = `${systemKey2}_${this.to}`;
24775
+ await dbSetItem(dbKey, result);
24818
24776
  }
24819
- });
24777
+ }
24820
24778
  }
24821
24779
  getYxI18nThesaurus() {
24822
24780
  return this.yxI18nThesaurus;
@@ -24824,18 +24782,18 @@ class Translate {
24824
24782
  }
24825
24783
  const yxTranslate = new Translate();
24826
24784
  const initTranslate = yxTranslate.initTranslate;
24827
- const changeLang = (to) => __async(void 0, null, function* () {
24785
+ const changeLang = async (to) => {
24828
24786
  setLang(to);
24829
- const lang2 = yield dbGetItem("lang");
24787
+ const lang2 = await dbGetItem("lang");
24830
24788
  if (lang2 !== to) {
24831
- yield dbSetItem("lang", to);
24789
+ await dbSetItem("lang", to);
24832
24790
  new BC(BC_LANG_NAME).postMessage(JSON.stringify({ type: "lang" }));
24833
24791
  location.reload();
24834
24792
  }
24835
- });
24836
- const getLang = () => __async(void 0, null, function* () {
24837
- return (yield dbGetItem("lang")) || "";
24838
- });
24793
+ };
24794
+ const getLang = async () => {
24795
+ return await dbGetItem("lang") || "";
24796
+ };
24839
24797
  const getWordByYxI18nThesaurus = (word) => {
24840
24798
  const i18nThesaurus = yxTranslate.getYxI18nThesaurus();
24841
24799
  return i18nThesaurus[word] || word;
@@ -24844,21 +24802,21 @@ const getZhWordByYxI18nThesaurus = (word) => {
24844
24802
  const i18nThesaurus = yxTranslate.getYxI18nThesaurus();
24845
24803
  return Object.keys(i18nThesaurus).find((key) => i18nThesaurus[key] === word) || word;
24846
24804
  };
24847
- const loadCustomThesaurus = (systemKey, lang2) => __async(void 0, null, function* () {
24805
+ const loadCustomThesaurus = async (systemKey, lang2) => {
24848
24806
  if (lang2 === "zh") return {};
24849
24807
  try {
24850
- const thesaurus = yield translate({
24808
+ const thesaurus = await translate({
24851
24809
  words: [],
24852
24810
  toSource: lang2,
24853
24811
  systemFlag: systemKey,
24854
24812
  translateApiUrl: yxTranslate.translateApiUrl
24855
24813
  });
24856
- yield dbSetItem(`${systemKey}_${lang2}`, thesaurus);
24814
+ await dbSetItem(`${systemKey}_${lang2}`, thesaurus);
24857
24815
  return thesaurus;
24858
24816
  } catch (error) {
24859
24817
  return dbGetItem(`${systemKey}_${lang2}`);
24860
24818
  }
24861
- });
24819
+ };
24862
24820
  const translate2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
24863
24821
  __proto__: null,
24864
24822
  changeLang,
@@ -25168,11 +25126,9 @@ const __default__ = {
25168
25126
  toolWrap.style.setProperty("--tool-left", left);
25169
25127
  toolWrap.style.setProperty("--tool-top", top);
25170
25128
  },
25171
- getCount() {
25172
- return __async(this, null, function* () {
25173
- const { data } = yield getCommentUntreatedCount();
25174
- this.badgeValue = data.count;
25175
- });
25129
+ async getCount() {
25130
+ const { data } = await getCommentUntreatedCount();
25131
+ this.badgeValue = data.count;
25176
25132
  },
25177
25133
  /** 点击悬浮球事件 */
25178
25134
  handlerClickTool(e) {
@@ -25310,17 +25266,17 @@ const _Toolbar = class _Toolbar {
25310
25266
  _elId = new WeakMap();
25311
25267
  _Toolbar.instance = null;
25312
25268
  let Toolbar = _Toolbar;
25313
- const install = (config2) => __async(void 0, null, function* () {
25269
+ const install = async (config2) => {
25314
25270
  var _a;
25315
- config2 = __spreadValues(__spreadValues({}, defaultConfig), config2);
25271
+ config2 = { ...defaultConfig, ...config2 };
25316
25272
  let themeId = getCurTheme();
25317
25273
  try {
25318
- yield handleSystemConfig(config2);
25319
- const { data } = yield http.get(config2 == null ? void 0 : config2.themeApiUrl, {}, { headers: { noLoading: true } });
25274
+ await handleSystemConfig(config2);
25275
+ const { data } = await http.get(config2 == null ? void 0 : config2.themeApiUrl, {}, { headers: { noLoading: true } });
25320
25276
  window["YX_THEME_LIST"] = data;
25321
25277
  if (config2.isRenderLang && config2.systemKey) {
25322
- const lang2 = yield getLang();
25323
- yield initTranslate({ to: lang2 ? lang2 : config2.lang, systemKey: config2.systemKey });
25278
+ const lang2 = await getLang();
25279
+ await initTranslate({ to: lang2 ? lang2 : config2.lang, systemKey: config2.systemKey });
25324
25280
  }
25325
25281
  if (config2.isRenderToolbar) {
25326
25282
  new Toolbar({ theme: data, isRenderIssue: config2.isRenderIssue, isRenderLang: config2.isRenderLang });
@@ -25332,7 +25288,7 @@ const install = (config2) => __async(void 0, null, function* () {
25332
25288
  themeUrl = theme3.themeUrl;
25333
25289
  themeId = theme3.id;
25334
25290
  }
25335
- const themeCssVar = yield setCssVar(themeUrl);
25291
+ const themeCssVar = await setCssVar(themeUrl);
25336
25292
  saveCssVar({ themeCssVar, themeId });
25337
25293
  initTtcFont();
25338
25294
  new BC(BC_THEME_NAME).onmessage = (event) => {
@@ -25347,9 +25303,9 @@ const install = (config2) => __async(void 0, null, function* () {
25347
25303
  initTtcFont();
25348
25304
  updateTheme();
25349
25305
  }
25350
- });
25306
+ };
25351
25307
  const handleSystemConfig = (config2) => {
25352
- setSystemConfig(__spreadValues({}, config2));
25308
+ setSystemConfig({ ...config2 });
25353
25309
  };
25354
25310
  const initTtcFont = () => {
25355
25311
  const style = document.createElement("style");
@@ -25365,8 +25321,8 @@ const saveCssVar = ({ themeCssVar, themeId }) => {
25365
25321
  };
25366
25322
  localStorage.setItem("ttcGlobalState", JSON.stringify(globalState));
25367
25323
  };
25368
- const changeTheme = (theme3) => __async(void 0, null, function* () {
25369
- const themeCssVar = yield setCssVar(theme3.themeUrl);
25324
+ const changeTheme = async (theme3) => {
25325
+ const themeCssVar = await setCssVar(theme3.themeUrl);
25370
25326
  saveCssVar({ themeCssVar, themeId: theme3 == null ? void 0 : theme3.id });
25371
25327
  new BC(BC_THEME_NAME).postMessage(
25372
25328
  JSON.stringify({
@@ -25379,7 +25335,7 @@ const changeTheme = (theme3) => __async(void 0, null, function* () {
25379
25335
  })
25380
25336
  );
25381
25337
  yxSubscribe.publish({ type: "theme", data: theme3 });
25382
- });
25338
+ };
25383
25339
  const updateTheme = () => {
25384
25340
  const themeCssVar = getCurThemeCssVar();
25385
25341
  const root = document.documentElement;
@@ -25392,9 +25348,9 @@ const updateTheme = () => {
25392
25348
  }
25393
25349
  });
25394
25350
  };
25395
- const setCssVar = (themeUrl) => __async(void 0, null, function* () {
25396
- const cssVar = yield fetch(themeUrl);
25397
- const themeCssVar = yield cssVar.json();
25351
+ const setCssVar = async (themeUrl) => {
25352
+ const cssVar = await fetch(themeUrl);
25353
+ const themeCssVar = await cssVar.json();
25398
25354
  const cssText = () => {
25399
25355
  let cssText2 = ":root {\n";
25400
25356
  Object.keys(themeCssVar).forEach((classifyName) => {
@@ -25421,13 +25377,13 @@ const setCssVar = (themeUrl) => __async(void 0, null, function* () {
25421
25377
  document.head.appendChild(styleTag);
25422
25378
  }
25423
25379
  return themeCssVar;
25424
- });
25425
- const getDefaultThemeUrl = () => __async(void 0, null, function* () {
25426
- const { data } = yield getUserThemeList();
25380
+ };
25381
+ const getDefaultThemeUrl = async () => {
25382
+ const { data } = await getUserThemeList();
25427
25383
  const defaultTheme = data.find((item) => item.defaultTheme === 1);
25428
25384
  const defaultThemeUrl = defaultTheme ? defaultTheme.themeUrl : data[0].themeUrl;
25429
25385
  return defaultThemeUrl;
25430
- });
25386
+ };
25431
25387
  const getCurTheme = () => {
25432
25388
  var _a;
25433
25389
  const ttcGlobalState = localStorage.getItem("ttcGlobalState");
Binary file