markpdfdown 0.3.3 → 0.4.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7096,16 +7096,16 @@ function createHashHistory(options = {}) {
7096
7096
  options
7097
7097
  );
7098
7098
  }
7099
- function invariant(value, message) {
7099
+ function invariant(value, message2) {
7100
7100
  if (value === false || value === null || typeof value === "undefined") {
7101
- throw new Error(message);
7101
+ throw new Error(message2);
7102
7102
  }
7103
7103
  }
7104
- function warning$3(cond, message) {
7104
+ function warning$3(cond, message2) {
7105
7105
  if (!cond) {
7106
- if (typeof console !== "undefined") console.warn(message);
7106
+ if (typeof console !== "undefined") console.warn(message2);
7107
7107
  try {
7108
- throw new Error(message);
7108
+ throw new Error(message2);
7109
7109
  } catch (e2) {
7110
7110
  }
7111
7111
  }
@@ -8000,7 +8000,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
8000
8000
  }
8001
8001
  function DefaultErrorComponent() {
8002
8002
  let error = useRouteError();
8003
- let message = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error);
8003
+ let message2 = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error);
8004
8004
  let stack = error instanceof Error ? error.stack : null;
8005
8005
  let lightgrey = "rgba(200,200,200, 0.5)";
8006
8006
  let preStyles = { padding: "0.5rem", backgroundColor: lightgrey };
@@ -8013,7 +8013,7 @@ function DefaultErrorComponent() {
8013
8013
  );
8014
8014
  devInfo = /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ reactExports.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ reactExports.createElement("code", { style: codeStyles }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ reactExports.createElement("code", { style: codeStyles }, "errorElement"), " prop on your route."));
8015
8015
  }
8016
- return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ reactExports.createElement("h3", { style: { fontStyle: "italic" } }, message), stack ? /* @__PURE__ */ reactExports.createElement("pre", { style: preStyles }, stack) : null, devInfo);
8016
+ return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ reactExports.createElement("h3", { style: { fontStyle: "italic" } }, message2), stack ? /* @__PURE__ */ reactExports.createElement("pre", { style: preStyles }, stack) : null, devInfo);
8017
8017
  }
8018
8018
  var defaultErrorElement = /* @__PURE__ */ reactExports.createElement(DefaultErrorComponent, null);
8019
8019
  var RenderErrorBoundary = class extends reactExports.Component {
@@ -8319,10 +8319,10 @@ function useNavigateStable() {
8319
8319
  return navigate;
8320
8320
  }
8321
8321
  var alreadyWarned$1 = {};
8322
- function warningOnce$1(key, cond, message) {
8322
+ function warningOnce$1(key, cond, message2) {
8323
8323
  if (!cond && !alreadyWarned$1[key]) {
8324
8324
  alreadyWarned$1[key] = true;
8325
- warning$3(false, message);
8325
+ warning$3(false, message2);
8326
8326
  }
8327
8327
  }
8328
8328
  reactExports.memo(DataRoutes);
@@ -8563,9 +8563,9 @@ function getFormSubmissionInfo(target, basename2) {
8563
8563
  return { action, method: method4.toLowerCase(), encType, formData, body };
8564
8564
  }
8565
8565
  Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
8566
- function invariant2(value, message) {
8566
+ function invariant2(value, message2) {
8567
8567
  if (value === false || value === null || typeof value === "undefined") {
8568
- throw new Error(message);
8568
+ throw new Error(message2);
8569
8569
  }
8570
8570
  }
8571
8571
  function singleFetchUrl(reqUrl, basename2, trailingSlashAware, extension2) {
@@ -9463,24 +9463,24 @@ function toArray$7(children) {
9463
9463
  var warned = {};
9464
9464
  var preMessage = function preMessage2(fn) {
9465
9465
  };
9466
- function warning$2(valid2, message) {
9466
+ function warning$2(valid2, message2) {
9467
9467
  }
9468
- function note(valid2, message) {
9468
+ function note(valid2, message2) {
9469
9469
  }
9470
9470
  function resetWarned() {
9471
9471
  warned = {};
9472
9472
  }
9473
- function call(method4, valid2, message) {
9474
- if (!valid2 && !warned[message]) {
9475
- method4(false, message);
9476
- warned[message] = true;
9473
+ function call(method4, valid2, message2) {
9474
+ if (!valid2 && !warned[message2]) {
9475
+ method4(false, message2);
9476
+ warned[message2] = true;
9477
9477
  }
9478
9478
  }
9479
- function warningOnce(valid2, message) {
9480
- call(warning$2, valid2, message);
9479
+ function warningOnce(valid2, message2) {
9480
+ call(warning$2, valid2, message2);
9481
9481
  }
9482
- function noteOnce(valid2, message) {
9483
- call(note, valid2, message);
9482
+ function noteOnce(valid2, message2) {
9483
+ call(note, valid2, message2);
9484
9484
  }
9485
9485
  warningOnce.preMessage = preMessage;
9486
9486
  warningOnce.resetWarned = resetWarned;
@@ -14271,7 +14271,7 @@ function getAlphaColor$1(frontColor, backgroundColor) {
14271
14271
  a: 1
14272
14272
  }).toRgbString();
14273
14273
  }
14274
- var __rest$1a = function(s2, e2) {
14274
+ var __rest$1b = function(s2, e2) {
14275
14275
  var t2 = {};
14276
14276
  for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t2[p2] = s2[p2];
14277
14277
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) {
@@ -14282,7 +14282,7 @@ var __rest$1a = function(s2, e2) {
14282
14282
  function formatToken(derivativeToken) {
14283
14283
  const {
14284
14284
  override
14285
- } = derivativeToken, restToken = __rest$1a(derivativeToken, ["override"]);
14285
+ } = derivativeToken, restToken = __rest$1b(derivativeToken, ["override"]);
14286
14286
  const overrideTokens = Object.assign({}, override);
14287
14287
  Object.keys(seedToken).forEach((token2) => {
14288
14288
  delete overrideTokens[token2];
@@ -14436,7 +14436,7 @@ function formatToken(derivativeToken) {
14436
14436
  }), overrideTokens);
14437
14437
  return aliasToken;
14438
14438
  }
14439
- var __rest$19 = function(s2, e2) {
14439
+ var __rest$1a = function(s2, e2) {
14440
14440
  var t2 = {};
14441
14441
  for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t2[p2] = s2[p2];
14442
14442
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) {
@@ -14486,7 +14486,7 @@ const getComputedToken = (originToken, overrideToken, theme2) => {
14486
14486
  const derivativeToken = theme2.getDerivativeToken(originToken);
14487
14487
  const {
14488
14488
  override
14489
- } = overrideToken, components = __rest$19(overrideToken, ["override"]);
14489
+ } = overrideToken, components = __rest$1a(overrideToken, ["override"]);
14490
14490
  let mergedDerivativeToken = Object.assign(Object.assign({}, derivativeToken), {
14491
14491
  override
14492
14492
  });
@@ -14495,7 +14495,7 @@ const getComputedToken = (originToken, overrideToken, theme2) => {
14495
14495
  Object.entries(components).forEach(([key, value]) => {
14496
14496
  const {
14497
14497
  theme: componentTheme
14498
- } = value, componentTokens = __rest$19(value, ["theme"]);
14498
+ } = value, componentTokens = __rest$1a(value, ["theme"]);
14499
14499
  let mergedComponentToken = componentTokens;
14500
14500
  if (componentTheme) {
14501
14501
  mergedComponentToken = getComputedToken(Object.assign(Object.assign({}, mergedDerivativeToken), componentTokens), {
@@ -15438,7 +15438,7 @@ function MotionWrapper(props) {
15438
15438
  return children;
15439
15439
  }
15440
15440
  const PropWarning = () => null;
15441
- var __rest$18 = function(s2, e2) {
15441
+ var __rest$19 = function(s2, e2) {
15442
15442
  var t2 = {};
15443
15443
  for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t2[p2] = s2[p2];
15444
15444
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) {
@@ -15557,7 +15557,7 @@ const ProviderChildren = (props) => {
15557
15557
  switch: SWITCH,
15558
15558
  transfer,
15559
15559
  avatar,
15560
- message,
15560
+ message: message2,
15561
15561
  tag,
15562
15562
  table: table2,
15563
15563
  card,
@@ -15649,7 +15649,7 @@ const ProviderChildren = (props) => {
15649
15649
  switch: SWITCH,
15650
15650
  transfer,
15651
15651
  avatar,
15652
- message,
15652
+ message: message2,
15653
15653
  tag,
15654
15654
  table: table2,
15655
15655
  card,
@@ -15741,7 +15741,7 @@ const ProviderChildren = (props) => {
15741
15741
  token: token2,
15742
15742
  components,
15743
15743
  cssVar
15744
- } = _a, rest2 = __rest$18(_a, ["algorithm", "token", "components", "cssVar"]);
15744
+ } = _a, rest2 = __rest$19(_a, ["algorithm", "token", "components", "cssVar"]);
15745
15745
  const themeObj = algorithm && (!Array.isArray(algorithm) || algorithm.length > 0) ? createTheme(algorithm) : defaultTheme;
15746
15746
  const parsedComponents = {};
15747
15747
  Object.entries(components || {}).forEach(([componentName, componentToken]) => {
@@ -15819,8 +15819,8 @@ function camelCase(input) {
15819
15819
  return g.toUpperCase();
15820
15820
  });
15821
15821
  }
15822
- function warning$1(valid2, message) {
15823
- warningOnce(valid2, "[@ant-design/icons] ".concat(message));
15822
+ function warning$1(valid2, message2) {
15823
+ warningOnce(valid2, "[@ant-design/icons] ".concat(message2));
15824
15824
  }
15825
15825
  function isIconDefinition(target) {
15826
15826
  return _typeof$1(target) === "object" && typeof target.name === "string" && typeof target.theme === "string" && (_typeof$1(target.icon) === "object" || typeof target.icon === "function");
@@ -16245,7 +16245,7 @@ const prepareComponentToken$w = (token2) => {
16245
16245
  };
16246
16246
  };
16247
16247
  const useStyle$G = genStyleHooks("Alert", (token2) => [genBaseStyle$b(token2), genTypeStyle(token2), genActionStyle(token2)], prepareComponentToken$w);
16248
- var __rest$17 = function(s2, e2) {
16248
+ var __rest$18 = function(s2, e2) {
16249
16249
  var t2 = {};
16250
16250
  for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t2[p2] = s2[p2];
16251
16251
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) {
@@ -16297,7 +16297,7 @@ const Alert$1 = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
16297
16297
  const {
16298
16298
  description,
16299
16299
  prefixCls: customizePrefixCls,
16300
- message,
16300
+ message: message2,
16301
16301
  banner,
16302
16302
  className,
16303
16303
  rootClassName,
@@ -16312,7 +16312,7 @@ const Alert$1 = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
16312
16312
  closeIcon,
16313
16313
  action,
16314
16314
  id
16315
- } = props, otherProps = __rest$17(props, ["description", "prefixCls", "message", "banner", "className", "rootClassName", "style", "onMouseEnter", "onMouseLeave", "onClick", "afterClose", "showIcon", "closable", "closeText", "closeIcon", "action", "id"]);
16315
+ } = props, otherProps = __rest$18(props, ["description", "prefixCls", "message", "banner", "className", "rootClassName", "style", "onMouseEnter", "onMouseLeave", "onClick", "afterClose", "showIcon", "closable", "closeText", "closeIcon", "action", "id"]);
16316
16316
  const [closed, setClosed] = reactExports.useState(false);
16317
16317
  const internalRef = reactExports.useRef(null);
16318
16318
  reactExports.useImperativeHandle(ref, () => ({
@@ -16385,7 +16385,7 @@ const Alert$1 = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
16385
16385
  if (typeof merged === "object") {
16386
16386
  const {
16387
16387
  closeIcon: _2
16388
- } = merged, ariaProps = __rest$17(merged, ["closeIcon"]);
16388
+ } = merged, ariaProps = __rest$18(merged, ["closeIcon"]);
16389
16389
  return ariaProps;
16390
16390
  }
16391
16391
  return {};
@@ -16419,9 +16419,9 @@ const Alert$1 = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
16419
16419
  type: type4
16420
16420
  }) : null, /* @__PURE__ */ reactExports.createElement("div", {
16421
16421
  className: `${prefixCls}-content`
16422
- }, message ? /* @__PURE__ */ reactExports.createElement("div", {
16422
+ }, message2 ? /* @__PURE__ */ reactExports.createElement("div", {
16423
16423
  className: `${prefixCls}-message`
16424
- }, message) : null, description ? /* @__PURE__ */ reactExports.createElement("div", {
16424
+ }, message2) : null, description ? /* @__PURE__ */ reactExports.createElement("div", {
16425
16425
  className: `${prefixCls}-description`
16426
16426
  }, description) : null), action ? /* @__PURE__ */ reactExports.createElement("div", {
16427
16427
  className: `${prefixCls}-action`
@@ -16462,7 +16462,7 @@ let ErrorBoundary = /* @__PURE__ */ (function(_React$Component) {
16462
16462
  key: "render",
16463
16463
  value: function render10() {
16464
16464
  const {
16465
- message,
16465
+ message: message2,
16466
16466
  description,
16467
16467
  id,
16468
16468
  children
@@ -16472,7 +16472,7 @@ let ErrorBoundary = /* @__PURE__ */ (function(_React$Component) {
16472
16472
  info
16473
16473
  } = this.state;
16474
16474
  const componentStack = (info === null || info === void 0 ? void 0 : info.componentStack) || null;
16475
- const errorMessage = typeof message === "undefined" ? (error || "").toString() : message;
16475
+ const errorMessage = typeof message2 === "undefined" ? (error || "").toString() : message2;
16476
16476
  const errorDescription = typeof description === "undefined" ? componentStack : description;
16477
16477
  if (error) {
16478
16478
  return /* @__PURE__ */ reactExports.createElement(Alert$1, {
@@ -17060,7 +17060,7 @@ var Notifications = /* @__PURE__ */ reactExports.forwardRef(function(props, ref)
17060
17060
  close: function close2(key) {
17061
17061
  onNoticeClose(key);
17062
17062
  },
17063
- destroy: function destroy() {
17063
+ destroy: function destroy2() {
17064
17064
  setConfigList([]);
17065
17065
  }
17066
17066
  };
@@ -17162,7 +17162,7 @@ function useNotification$1() {
17162
17162
  stack,
17163
17163
  renderNotifications: renderNotifications2
17164
17164
  });
17165
- var _React$useState3 = reactExports.useState([]), _React$useState4 = _slicedToArray(_React$useState3, 2), taskQueue = _React$useState4[0], setTaskQueue = _React$useState4[1];
17165
+ var _React$useState3 = reactExports.useState([]), _React$useState4 = _slicedToArray(_React$useState3, 2), taskQueue2 = _React$useState4[0], setTaskQueue = _React$useState4[1];
17166
17166
  var open2 = useEvent(function(config) {
17167
17167
  var mergedConfig = mergeConfig(shareConfig, config);
17168
17168
  if (mergedConfig.key === null || mergedConfig.key === void 0) {
@@ -17187,7 +17187,7 @@ function useNotification$1() {
17187
17187
  }]);
17188
17188
  });
17189
17189
  },
17190
- destroy: function destroy() {
17190
+ destroy: function destroy2() {
17191
17191
  setTaskQueue(function(queue) {
17192
17192
  return [].concat(_toConsumableArray(queue), [{
17193
17193
  type: "destroy"
@@ -17200,8 +17200,8 @@ function useNotification$1() {
17200
17200
  setContainer(getContainer2());
17201
17201
  });
17202
17202
  reactExports.useEffect(function() {
17203
- if (notificationsRef.current && taskQueue.length) {
17204
- taskQueue.forEach(function(task) {
17203
+ if (notificationsRef.current && taskQueue2.length) {
17204
+ taskQueue2.forEach(function(task) {
17205
17205
  switch (task.type) {
17206
17206
  case "open":
17207
17207
  notificationsRef.current.open(task.config);
@@ -17220,13 +17220,13 @@ function useNotification$1() {
17220
17220
  if (oriTaskQueue !== oriQueue || !tgtTaskQueue) {
17221
17221
  oriTaskQueue = oriQueue;
17222
17222
  tgtTaskQueue = oriQueue.filter(function(task) {
17223
- return !taskQueue.includes(task);
17223
+ return !taskQueue2.includes(task);
17224
17224
  });
17225
17225
  }
17226
17226
  return tgtTaskQueue;
17227
17227
  });
17228
17228
  }
17229
- }, [taskQueue]);
17229
+ }, [taskQueue2]);
17230
17230
  return [api, contextHolder];
17231
17231
  }
17232
17232
  var LoadingOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" } }] }, "name": "loading", "theme": "outlined" };
@@ -17607,14 +17607,14 @@ const useStyle$F = genStyleHooks("Message", (token2) => {
17607
17607
  });
17608
17608
  return genMessageStyle(combinedToken);
17609
17609
  }, prepareComponentToken$v);
17610
- (function(s2, e2) {
17610
+ var __rest$17 = function(s2, e2) {
17611
17611
  var t2 = {};
17612
17612
  for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t2[p2] = s2[p2];
17613
17613
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) {
17614
17614
  if (e2.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i])) t2[p2[i]] = s2[p2[i]];
17615
17615
  }
17616
17616
  return t2;
17617
- });
17617
+ };
17618
17618
  const TypeIcon = {
17619
17619
  info: /* @__PURE__ */ reactExports.createElement(RefIcon$$, null),
17620
17620
  success: /* @__PURE__ */ reactExports.createElement(RefIcon$13, null),
@@ -17630,6 +17630,32 @@ const PureContent$1 = ({
17630
17630
  }) => /* @__PURE__ */ reactExports.createElement("div", {
17631
17631
  className: classNames(`${prefixCls}-custom-content`, `${prefixCls}-${type4}`)
17632
17632
  }, icon2 || TypeIcon[type4], /* @__PURE__ */ reactExports.createElement("span", null, children));
17633
+ const PurePanel$6 = (props) => {
17634
+ const {
17635
+ prefixCls: staticPrefixCls,
17636
+ className,
17637
+ type: type4,
17638
+ icon: icon2,
17639
+ content: content2
17640
+ } = props, restProps = __rest$17(props, ["prefixCls", "className", "type", "icon", "content"]);
17641
+ const {
17642
+ getPrefixCls
17643
+ } = reactExports.useContext(ConfigContext);
17644
+ const prefixCls = staticPrefixCls || getPrefixCls("message");
17645
+ const rootCls = useCSSVarCls(prefixCls);
17646
+ const [wrapCSSVar, hashId, cssVarCls] = useStyle$F(prefixCls, rootCls);
17647
+ return wrapCSSVar(/* @__PURE__ */ reactExports.createElement(Notify, Object.assign({}, restProps, {
17648
+ prefixCls,
17649
+ className: classNames(className, hashId, `${prefixCls}-notice-pure-panel`, cssVarCls, rootCls),
17650
+ eventKey: "pure",
17651
+ duration: null,
17652
+ content: /* @__PURE__ */ reactExports.createElement(PureContent$1, {
17653
+ prefixCls,
17654
+ type: type4,
17655
+ icon: icon2
17656
+ }, content2)
17657
+ })));
17658
+ };
17633
17659
  function getMotion$3(prefixCls, transitionName) {
17634
17660
  return {
17635
17661
  motionName: transitionName !== null && transitionName !== void 0 ? transitionName : `${prefixCls}-move-up`
@@ -17692,7 +17718,7 @@ const Holder$1 = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
17692
17718
  const {
17693
17719
  getPrefixCls,
17694
17720
  getPopupContainer,
17695
- message,
17721
+ message: message2,
17696
17722
  direction
17697
17723
  } = reactExports.useContext(ConfigContext);
17698
17724
  const prefixCls = staticPrefixCls || getPrefixCls("message");
@@ -17725,7 +17751,7 @@ const Holder$1 = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
17725
17751
  });
17726
17752
  reactExports.useImperativeHandle(ref, () => Object.assign(Object.assign({}, api), {
17727
17753
  prefixCls,
17728
- message
17754
+ message: message2
17729
17755
  }));
17730
17756
  return holder;
17731
17757
  });
@@ -17749,7 +17775,7 @@ function useInternalMessage(messageConfig) {
17749
17775
  const {
17750
17776
  open: originOpen,
17751
17777
  prefixCls,
17752
- message
17778
+ message: message2
17753
17779
  } = holderRef.current;
17754
17780
  const noticePrefixCls = `${prefixCls}-notice`;
17755
17781
  const {
@@ -17775,8 +17801,8 @@ function useInternalMessage(messageConfig) {
17775
17801
  icon: icon2
17776
17802
  }, content2),
17777
17803
  placement: "top",
17778
- className: classNames(type4 && `${noticePrefixCls}-${type4}`, className, message === null || message === void 0 ? void 0 : message.className),
17779
- style: Object.assign(Object.assign({}, message === null || message === void 0 ? void 0 : message.style), style2),
17804
+ className: classNames(type4 && `${noticePrefixCls}-${type4}`, className, message2 === null || message2 === void 0 ? void 0 : message2.className),
17805
+ style: Object.assign(Object.assign({}, message2 === null || message2 === void 0 ? void 0 : message2.style), style2),
17780
17806
  onClose: () => {
17781
17807
  onClose === null || onClose === void 0 ? void 0 : onClose();
17782
17808
  resolve();
@@ -17787,7 +17813,7 @@ function useInternalMessage(messageConfig) {
17787
17813
  };
17788
17814
  });
17789
17815
  };
17790
- const destroy = (key) => {
17816
+ const destroy2 = (key) => {
17791
17817
  var _a;
17792
17818
  if (key !== void 0) {
17793
17819
  close2(key);
@@ -17797,11 +17823,11 @@ function useInternalMessage(messageConfig) {
17797
17823
  };
17798
17824
  const clone = {
17799
17825
  open: open2,
17800
- destroy
17826
+ destroy: destroy2
17801
17827
  };
17802
17828
  const keys2 = ["info", "success", "warning", "error", "loading"];
17803
17829
  keys2.forEach((type4) => {
17804
- const typeOpen = (jointContent, duration, onClose) => {
17830
+ const typeOpen2 = (jointContent, duration, onClose) => {
17805
17831
  let config;
17806
17832
  if (jointContent && typeof jointContent === "object" && "content" in jointContent) {
17807
17833
  config = jointContent;
@@ -17826,7 +17852,7 @@ function useInternalMessage(messageConfig) {
17826
17852
  });
17827
17853
  return open2(mergedConfig);
17828
17854
  };
17829
- clone[type4] = typeOpen;
17855
+ clone[type4] = typeOpen2;
17830
17856
  });
17831
17857
  return clone;
17832
17858
  }, []);
@@ -22420,8 +22446,8 @@ function _validateRule() {
22420
22446
  _context2.t0 = _context2["catch"](10);
22421
22447
  if (_context2.t0.errors) {
22422
22448
  result = _context2.t0.errors.map(function(_ref4, index2) {
22423
- var message = _ref4.message;
22424
- var mergedMessage = message === CODE_LOGIC_ERROR ? messages2.default : message;
22449
+ var message2 = _ref4.message;
22450
+ var mergedMessage = message2 === CODE_LOGIC_ERROR ? messages2.default : message2;
22425
22451
  return /* @__PURE__ */ reactExports.isValidElement(mergedMessage) ? (
22426
22452
  // Wrap ReactNode with `key`
22427
22453
  /* @__PURE__ */ reactExports.cloneElement(mergedMessage, {
@@ -22755,11 +22781,11 @@ var Field = /* @__PURE__ */ (function(_React$Component) {
22755
22781
  });
22756
22782
  });
22757
22783
  _defineProperty(_assertThisInitialized(_this), "metaCache", null);
22758
- _defineProperty(_assertThisInitialized(_this), "triggerMetaEvent", function(destroy) {
22784
+ _defineProperty(_assertThisInitialized(_this), "triggerMetaEvent", function(destroy2) {
22759
22785
  var onMetaChange = _this.props.onMetaChange;
22760
22786
  if (onMetaChange) {
22761
22787
  var _meta = _objectSpread2(_objectSpread2({}, _this.getMeta()), {}, {
22762
- destroy
22788
+ destroy: destroy2
22763
22789
  });
22764
22790
  if (!isEqual(_this.metaCache, _meta)) {
22765
22791
  onMetaChange(_meta);
@@ -26032,7 +26058,7 @@ function confirm(config) {
26032
26058
  });
26033
26059
  let timeoutId;
26034
26060
  let reactUnmount;
26035
- function destroy(...args) {
26061
+ function destroy2(...args) {
26036
26062
  var _a;
26037
26063
  const triggerCancel = args.some((param) => param === null || param === void 0 ? void 0 : param.triggerCancel);
26038
26064
  if (triggerCancel) {
@@ -26071,7 +26097,7 @@ function confirm(config) {
26071
26097
  if (typeof config.afterClose === "function") {
26072
26098
  config.afterClose();
26073
26099
  }
26074
- destroy.apply(this, args);
26100
+ destroy2.apply(this, args);
26075
26101
  }
26076
26102
  });
26077
26103
  if (currentConfig.visible) {
@@ -26747,7 +26773,7 @@ const PureContent = (props) => {
26747
26773
  prefixCls,
26748
26774
  icon: icon2,
26749
26775
  type: type4,
26750
- message,
26776
+ message: message2,
26751
26777
  description,
26752
26778
  actions: actions2,
26753
26779
  role = "alert"
@@ -26769,7 +26795,7 @@ const PureContent = (props) => {
26769
26795
  role
26770
26796
  }, iconNode, /* @__PURE__ */ reactExports.createElement("div", {
26771
26797
  className: `${prefixCls}-message`
26772
- }, message), description && /* @__PURE__ */ reactExports.createElement("div", {
26798
+ }, message2), description && /* @__PURE__ */ reactExports.createElement("div", {
26773
26799
  className: `${prefixCls}-description`
26774
26800
  }, description), actions2 && /* @__PURE__ */ reactExports.createElement("div", {
26775
26801
  className: `${prefixCls}-actions`
@@ -26940,7 +26966,7 @@ function useInternalNotification(notificationConfig) {
26940
26966
  } = holderRef.current;
26941
26967
  const noticePrefixCls = `${prefixCls}-notice`;
26942
26968
  const {
26943
- message,
26969
+ message: message2,
26944
26970
  description,
26945
26971
  icon: icon2,
26946
26972
  type: type4,
@@ -26962,7 +26988,7 @@ function useInternalNotification(notificationConfig) {
26962
26988
  prefixCls: noticePrefixCls,
26963
26989
  icon: icon2,
26964
26990
  type: type4,
26965
- message,
26991
+ message: message2,
26966
26992
  description,
26967
26993
  actions: mergedActions,
26968
26994
  role
@@ -26973,7 +26999,7 @@ function useInternalNotification(notificationConfig) {
26973
26999
  closable: closable !== null && closable !== void 0 ? closable : !!realCloseIcon
26974
27000
  }));
26975
27001
  };
26976
- const destroy = (key) => {
27002
+ const destroy2 = (key) => {
26977
27003
  var _a, _b;
26978
27004
  if (key !== void 0) {
26979
27005
  (_a = holderRef.current) === null || _a === void 0 ? void 0 : _a.close(key);
@@ -26983,7 +27009,7 @@ function useInternalNotification(notificationConfig) {
26983
27009
  };
26984
27010
  const clone = {
26985
27011
  open: open2,
26986
- destroy
27012
+ destroy: destroy2
26987
27013
  };
26988
27014
  const keys2 = ["success", "info", "warning", "error"];
26989
27015
  keys2.forEach((type4) => {
@@ -27036,7 +27062,7 @@ const App$2 = (props) => {
27036
27062
  children,
27037
27063
  className,
27038
27064
  rootClassName,
27039
- message,
27065
+ message: message2,
27040
27066
  notification,
27041
27067
  style: style2,
27042
27068
  component = "div"
@@ -27052,9 +27078,9 @@ const App$2 = (props) => {
27052
27078
  });
27053
27079
  const appConfig = reactExports.useContext(AppConfigContext);
27054
27080
  const mergedAppConfig = React.useMemo(() => ({
27055
- message: Object.assign(Object.assign({}, appConfig.message), message),
27081
+ message: Object.assign(Object.assign({}, appConfig.message), message2),
27056
27082
  notification: Object.assign(Object.assign({}, appConfig.notification), notification)
27057
- }), [message, notification, appConfig.message, appConfig.notification]);
27083
+ }), [message2, notification, appConfig.message, appConfig.notification]);
27058
27084
  const [messageApi, messageContextHolder] = useMessage(mergedAppConfig.message);
27059
27085
  const [notificationApi, notificationContextHolder] = useNotification(mergedAppConfig.notification);
27060
27086
  const [ModalApi, ModalContextHolder] = useModal();
@@ -36875,7 +36901,7 @@ function InlineSubMenuList(_ref) {
36875
36901
  var _React$useContext = reactExports.useContext(MenuContext$1), prefixCls = _React$useContext.prefixCls, forceSubMenuRender = _React$useContext.forceSubMenuRender, motion2 = _React$useContext.motion, defaultMotions = _React$useContext.defaultMotions, mode = _React$useContext.mode;
36876
36902
  var sameModeRef = reactExports.useRef(false);
36877
36903
  sameModeRef.current = mode === fixedMode;
36878
- var _React$useState = reactExports.useState(!sameModeRef.current), _React$useState2 = _slicedToArray(_React$useState, 2), destroy = _React$useState2[0], setDestroy = _React$useState2[1];
36904
+ var _React$useState = reactExports.useState(!sameModeRef.current), _React$useState2 = _slicedToArray(_React$useState, 2), destroy2 = _React$useState2[0], setDestroy = _React$useState2[1];
36879
36905
  var mergedOpen = sameModeRef.current ? open2 : false;
36880
36906
  reactExports.useEffect(function() {
36881
36907
  if (sameModeRef.current) {
@@ -36893,7 +36919,7 @@ function InlineSubMenuList(_ref) {
36893
36919
  }
36894
36920
  return originOnVisibleChanged === null || originOnVisibleChanged === void 0 ? void 0 : originOnVisibleChanged(newVisible);
36895
36921
  };
36896
- if (destroy) {
36922
+ if (destroy2) {
36897
36923
  return null;
36898
36924
  }
36899
36925
  return /* @__PURE__ */ reactExports.createElement(InheritableContextProvider, {
@@ -52099,6 +52125,216 @@ const toList$1 = (candidate, skipEmpty = false) => {
52099
52125
  }
52100
52126
  return Array.isArray(candidate) ? candidate : [candidate];
52101
52127
  };
52128
+ let message = null;
52129
+ let act = (callback) => callback();
52130
+ let taskQueue = [];
52131
+ let defaultGlobalConfig = {};
52132
+ function getGlobalContext() {
52133
+ const {
52134
+ getContainer: getContainer2,
52135
+ duration,
52136
+ rtl,
52137
+ maxCount,
52138
+ top
52139
+ } = defaultGlobalConfig;
52140
+ const mergedContainer = (getContainer2 === null || getContainer2 === void 0 ? void 0 : getContainer2()) || document.body;
52141
+ return {
52142
+ getContainer: () => mergedContainer,
52143
+ duration,
52144
+ rtl,
52145
+ maxCount,
52146
+ top
52147
+ };
52148
+ }
52149
+ const GlobalHolder = /* @__PURE__ */ React.forwardRef((props, ref) => {
52150
+ const {
52151
+ messageConfig,
52152
+ sync
52153
+ } = props;
52154
+ const {
52155
+ getPrefixCls
52156
+ } = reactExports.useContext(ConfigContext);
52157
+ const prefixCls = defaultGlobalConfig.prefixCls || getPrefixCls("message");
52158
+ const appConfig = reactExports.useContext(AppConfigContext);
52159
+ const [api, holder] = useInternalMessage(Object.assign(Object.assign(Object.assign({}, messageConfig), {
52160
+ prefixCls
52161
+ }), appConfig.message));
52162
+ React.useImperativeHandle(ref, () => {
52163
+ const instance2 = Object.assign({}, api);
52164
+ Object.keys(instance2).forEach((method4) => {
52165
+ instance2[method4] = (...args) => {
52166
+ sync();
52167
+ return api[method4].apply(api, args);
52168
+ };
52169
+ });
52170
+ return {
52171
+ instance: instance2,
52172
+ sync
52173
+ };
52174
+ });
52175
+ return holder;
52176
+ });
52177
+ const GlobalHolderWrapper = /* @__PURE__ */ React.forwardRef((_2, ref) => {
52178
+ const [messageConfig, setMessageConfig] = React.useState(getGlobalContext);
52179
+ const sync = () => {
52180
+ setMessageConfig(getGlobalContext);
52181
+ };
52182
+ React.useEffect(sync, []);
52183
+ const global2 = globalConfig();
52184
+ const rootPrefixCls = global2.getRootPrefixCls();
52185
+ const rootIconPrefixCls = global2.getIconPrefixCls();
52186
+ const theme2 = global2.getTheme();
52187
+ const dom = /* @__PURE__ */ React.createElement(GlobalHolder, {
52188
+ ref,
52189
+ sync,
52190
+ messageConfig
52191
+ });
52192
+ return /* @__PURE__ */ React.createElement(ConfigProvider, {
52193
+ prefixCls: rootPrefixCls,
52194
+ iconPrefixCls: rootIconPrefixCls,
52195
+ theme: theme2
52196
+ }, global2.holderRender ? global2.holderRender(dom) : dom);
52197
+ });
52198
+ const flushMessageQueue = () => {
52199
+ if (!message) {
52200
+ const holderFragment = document.createDocumentFragment();
52201
+ const newMessage = {
52202
+ fragment: holderFragment
52203
+ };
52204
+ message = newMessage;
52205
+ act(() => {
52206
+ const reactRender2 = unstableSetRender();
52207
+ reactRender2(/* @__PURE__ */ React.createElement(GlobalHolderWrapper, {
52208
+ ref: (node2) => {
52209
+ const {
52210
+ instance: instance2,
52211
+ sync
52212
+ } = node2 || {};
52213
+ Promise.resolve().then(() => {
52214
+ if (!newMessage.instance && instance2) {
52215
+ newMessage.instance = instance2;
52216
+ newMessage.sync = sync;
52217
+ flushMessageQueue();
52218
+ }
52219
+ });
52220
+ }
52221
+ }), holderFragment);
52222
+ });
52223
+ return;
52224
+ }
52225
+ if (!message.instance) {
52226
+ return;
52227
+ }
52228
+ taskQueue.forEach((task) => {
52229
+ const {
52230
+ type: type4,
52231
+ skipped
52232
+ } = task;
52233
+ if (!skipped) {
52234
+ switch (type4) {
52235
+ case "open": {
52236
+ act(() => {
52237
+ const closeFn = message.instance.open(Object.assign(Object.assign({}, defaultGlobalConfig), task.config));
52238
+ closeFn === null || closeFn === void 0 ? void 0 : closeFn.then(task.resolve);
52239
+ task.setCloseFn(closeFn);
52240
+ });
52241
+ break;
52242
+ }
52243
+ case "destroy":
52244
+ act(() => {
52245
+ message === null || message === void 0 ? void 0 : message.instance.destroy(task.key);
52246
+ });
52247
+ break;
52248
+ // Other type open
52249
+ default: {
52250
+ act(() => {
52251
+ var _message$instance;
52252
+ const closeFn = (_message$instance = message.instance)[type4].apply(_message$instance, _toConsumableArray(task.args));
52253
+ closeFn === null || closeFn === void 0 ? void 0 : closeFn.then(task.resolve);
52254
+ task.setCloseFn(closeFn);
52255
+ });
52256
+ }
52257
+ }
52258
+ }
52259
+ });
52260
+ taskQueue = [];
52261
+ };
52262
+ function setMessageGlobalConfig(config) {
52263
+ defaultGlobalConfig = Object.assign(Object.assign({}, defaultGlobalConfig), config);
52264
+ act(() => {
52265
+ var _a;
52266
+ (_a = message === null || message === void 0 ? void 0 : message.sync) === null || _a === void 0 ? void 0 : _a.call(message);
52267
+ });
52268
+ }
52269
+ function open$1(config) {
52270
+ const result = wrapPromiseFn((resolve) => {
52271
+ let closeFn;
52272
+ const task = {
52273
+ type: "open",
52274
+ config,
52275
+ resolve,
52276
+ setCloseFn: (fn) => {
52277
+ closeFn = fn;
52278
+ }
52279
+ };
52280
+ taskQueue.push(task);
52281
+ return () => {
52282
+ if (closeFn) {
52283
+ act(() => {
52284
+ closeFn();
52285
+ });
52286
+ } else {
52287
+ task.skipped = true;
52288
+ }
52289
+ };
52290
+ });
52291
+ flushMessageQueue();
52292
+ return result;
52293
+ }
52294
+ function typeOpen(type4, args) {
52295
+ const result = wrapPromiseFn((resolve) => {
52296
+ let closeFn;
52297
+ const task = {
52298
+ type: type4,
52299
+ args,
52300
+ resolve,
52301
+ setCloseFn: (fn) => {
52302
+ closeFn = fn;
52303
+ }
52304
+ };
52305
+ taskQueue.push(task);
52306
+ return () => {
52307
+ if (closeFn) {
52308
+ act(() => {
52309
+ closeFn();
52310
+ });
52311
+ } else {
52312
+ task.skipped = true;
52313
+ }
52314
+ };
52315
+ });
52316
+ flushMessageQueue();
52317
+ return result;
52318
+ }
52319
+ const destroy = (key) => {
52320
+ taskQueue.push({
52321
+ type: "destroy",
52322
+ key
52323
+ });
52324
+ flushMessageQueue();
52325
+ };
52326
+ const methods = ["success", "info", "warning", "error", "loading"];
52327
+ const baseStaticMethods = {
52328
+ open: open$1,
52329
+ destroy,
52330
+ config: setMessageGlobalConfig,
52331
+ useMessage,
52332
+ _InternalPanelDoNotUseOrYouWillBeFired: PurePanel$6
52333
+ };
52334
+ const staticMethods = baseStaticMethods;
52335
+ methods.forEach((type4) => {
52336
+ staticMethods[type4] = (...args) => typeOpen(type4, args);
52337
+ });
52102
52338
  var __rest$h = function(s2, e2) {
52103
52339
  var t2 = {};
52104
52340
  for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t2[p2] = s2[p2];
@@ -64265,12 +64501,12 @@ function requireCopyToClipboard() {
64265
64501
  "default": "Text"
64266
64502
  };
64267
64503
  var defaultMessage = "Copy to clipboard: #{key}, Enter";
64268
- function format2(message) {
64504
+ function format2(message2) {
64269
64505
  var copyKey = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
64270
- return message.replace(/#{\s*key\s*}/g, copyKey);
64506
+ return message2.replace(/#{\s*key\s*}/g, copyKey);
64271
64507
  }
64272
64508
  function copy2(text2, options) {
64273
- var debug, message, reselectPrevious, range3, selection, mark2, success = false;
64509
+ var debug, message2, reselectPrevious, range3, selection, mark2, success = false;
64274
64510
  if (!options) {
64275
64511
  options = {};
64276
64512
  }
@@ -64329,8 +64565,8 @@ function requireCopyToClipboard() {
64329
64565
  } catch (err2) {
64330
64566
  debug && console.error("unable to copy using clipboardData: ", err2);
64331
64567
  debug && console.error("falling back to prompt");
64332
- message = format2("message" in options ? options.message : defaultMessage);
64333
- window.prompt(message, text2);
64568
+ message2 = format2("message" in options ? options.message : defaultMessage);
64569
+ window.prompt(message2, text2);
64334
64570
  }
64335
64571
  } finally {
64336
64572
  if (selection) {
@@ -66684,9 +66920,9 @@ const ListItem = /* @__PURE__ */ reactExports.forwardRef(({
66684
66920
  className: classNames(`${prefixCls}-list-item-progress`, motionClassName)
66685
66921
  }, loadingProgress);
66686
66922
  }));
66687
- const message = file.response && typeof file.response === "string" ? file.response : ((_a = file.error) === null || _a === void 0 ? void 0 : _a.statusText) || ((_b = file.error) === null || _b === void 0 ? void 0 : _b.message) || locale2.uploadError;
66923
+ const message2 = file.response && typeof file.response === "string" ? file.response : ((_a = file.error) === null || _a === void 0 ? void 0 : _a.statusText) || ((_b = file.error) === null || _b === void 0 ? void 0 : _b.message) || locale2.uploadError;
66688
66924
  const item = mergedStatus === "error" ? /* @__PURE__ */ reactExports.createElement(Tooltip2, {
66689
- title: message,
66925
+ title: message2,
66690
66926
  getPopupContainer: (node2) => node2.parentNode
66691
66927
  }, dom) : dom;
66692
66928
  return /* @__PURE__ */ reactExports.createElement("div", {
@@ -70398,7 +70634,7 @@ const getFileCategory = (fileName, fileType) => {
70398
70634
  };
70399
70635
  const UploadPanel = () => {
70400
70636
  const navigate = useNavigate();
70401
- const { message } = App$1.useApp();
70637
+ const { message: message2 } = App$1.useApp();
70402
70638
  const { t: t2 } = useTranslation("upload");
70403
70639
  const cloudContext = reactExports.useContext(CloudContext);
70404
70640
  const [fileList, setFileList] = reactExports.useState([]);
@@ -70423,7 +70659,7 @@ const UploadPanel = () => {
70423
70659
  if (result.success && result.data) {
70424
70660
  groups = result.data;
70425
70661
  } else {
70426
- message.error(result.error || t2("messages.fetch_models_failed"));
70662
+ message2.error(result.error || t2("messages.fetch_models_failed"));
70427
70663
  }
70428
70664
  const cloudGroup = {
70429
70665
  provider: CLOUD_PROVIDER_ID,
@@ -70449,7 +70685,7 @@ const UploadPanel = () => {
70449
70685
  }
70450
70686
  } catch (error) {
70451
70687
  console.error("Failed to fetch model list:", error);
70452
- message.error(
70688
+ message2.error(
70453
70689
  t2("messages.fetch_models_failed") + ": " + (error instanceof Error ? error.message : String(error))
70454
70690
  );
70455
70691
  } finally {
@@ -70457,7 +70693,7 @@ const UploadPanel = () => {
70457
70693
  }
70458
70694
  };
70459
70695
  fetchAllModels();
70460
- }, [message, t2]);
70696
+ }, [message2, t2]);
70461
70697
  const handleModelChange = (value) => {
70462
70698
  setSelectedModel(value);
70463
70699
  localStorage.setItem(SELECTED_MODEL_KEY, value);
@@ -70517,10 +70753,10 @@ const UploadPanel = () => {
70517
70753
  });
70518
70754
  });
70519
70755
  if (rejectedUnsupportedFiles.length > 0) {
70520
- message.error(t2("messages.invalid_file_type", { filename: rejectedUnsupportedFiles.join(", ") }));
70756
+ message2.error(t2("messages.invalid_file_type", { filename: rejectedUnsupportedFiles.join(", ") }));
70521
70757
  }
70522
70758
  if (rejectedOfficeFiles.length > 0) {
70523
- message.error(t2("messages.office_not_supported", { filename: rejectedOfficeFiles.join(", ") }));
70759
+ message2.error(t2("messages.office_not_supported", { filename: rejectedOfficeFiles.join(", ") }));
70524
70760
  }
70525
70761
  if (newFiles.length > 0) {
70526
70762
  setFileList((prevList) => [...prevList, ...newFiles]);
@@ -70528,7 +70764,7 @@ const UploadPanel = () => {
70528
70764
  }
70529
70765
  } catch (error) {
70530
70766
  console.error("Failed to select files:", error);
70531
- message.error(
70767
+ message2.error(
70532
70768
  t2("messages.select_failed") + ": " + (error instanceof Error ? error.message : String(error))
70533
70769
  );
70534
70770
  }
@@ -70545,11 +70781,11 @@ const UploadPanel = () => {
70545
70781
  beforeUpload: (file) => {
70546
70782
  const category = getFileCategory(file.name, file.type);
70547
70783
  if (category === "unsupported") {
70548
- message.error(t2("messages.invalid_file_type", { filename: file.name }));
70784
+ message2.error(t2("messages.invalid_file_type", { filename: file.name }));
70549
70785
  return Upload.LIST_IGNORE;
70550
70786
  }
70551
70787
  if (category === "office" && !canUseOfficeFiles) {
70552
- message.error(t2("messages.office_not_supported", { filename: file.name }));
70788
+ message2.error(t2("messages.office_not_supported", { filename: file.name }));
70553
70789
  return Upload.LIST_IGNORE;
70554
70790
  }
70555
70791
  const newFile = {
@@ -70569,11 +70805,11 @@ const UploadPanel = () => {
70569
70805
  };
70570
70806
  const handleConvert = async () => {
70571
70807
  if (fileList.length === 0) {
70572
- message.error(t2("messages.no_files"));
70808
+ message2.error(t2("messages.no_files"));
70573
70809
  return;
70574
70810
  }
70575
70811
  if (!selectedModel) {
70576
- message.error(t2("messages.no_model"));
70812
+ message2.error(t2("messages.no_model"));
70577
70813
  return;
70578
70814
  }
70579
70815
  try {
@@ -70595,11 +70831,11 @@ const UploadPanel = () => {
70595
70831
  if (result.success) {
70596
70832
  successCount2++;
70597
70833
  } else {
70598
- message.error(t2("cloud.upload_failed", { filename: file.name, error: result.error }));
70834
+ message2.error(t2("cloud.upload_failed", { filename: file.name, error: result.error }));
70599
70835
  }
70600
70836
  }
70601
70837
  if (successCount2 > 0) {
70602
- message.success(t2("cloud.upload_success", { count: successCount2 }));
70838
+ message2.success(t2("cloud.upload_success", { count: successCount2 }));
70603
70839
  setFileList([]);
70604
70840
  navigate("/list", { replace: true });
70605
70841
  }
@@ -70647,7 +70883,7 @@ const UploadPanel = () => {
70647
70883
  fileContent
70648
70884
  );
70649
70885
  } else {
70650
- message.error(t2("messages.invalid_file_path", { filename: file.name }));
70886
+ message2.error(t2("messages.invalid_file_path", { filename: file.name }));
70651
70887
  await window.api.task.delete(task.id);
70652
70888
  continue;
70653
70889
  }
@@ -70658,31 +70894,31 @@ const UploadPanel = () => {
70658
70894
  if (updateResult.success) {
70659
70895
  successCount++;
70660
70896
  } else {
70661
- message.error(t2("messages.update_status_failed", { filename: file.name }));
70897
+ message2.error(t2("messages.update_status_failed", { filename: file.name }));
70662
70898
  await window.api.task.delete(task.id);
70663
70899
  }
70664
70900
  } else {
70665
- message.error(
70901
+ message2.error(
70666
70902
  t2("messages.upload_failed", { filename: file.name }) + `: ${uploadResult.error || "Unknown error"}`
70667
70903
  );
70668
70904
  await window.api.task.delete(task.id);
70669
70905
  }
70670
70906
  } catch (error) {
70671
70907
  console.error(`Failed to upload file ${file.name}:`, error);
70672
- message.error(t2("messages.upload_failed", { filename: file.name }));
70908
+ message2.error(t2("messages.upload_failed", { filename: file.name }));
70673
70909
  await window.api.task.delete(task.id);
70674
70910
  }
70675
70911
  }
70676
70912
  if (successCount > 0) {
70677
- message.success(t2("messages.tasks_created", { count: successCount }));
70913
+ message2.success(t2("messages.tasks_created", { count: successCount }));
70678
70914
  setFileList([]);
70679
70915
  navigate("/list", { replace: true });
70680
70916
  } else {
70681
- message.error(t2("messages.upload_error"));
70917
+ message2.error(t2("messages.upload_error"));
70682
70918
  }
70683
70919
  } catch (error) {
70684
70920
  console.error("Failed to upload files:", error);
70685
- message.error(
70921
+ message2.error(
70686
70922
  t2("messages.upload_error") + ": " + (error instanceof Error ? error.message : String(error))
70687
70923
  );
70688
70924
  } finally {
@@ -70848,6 +71084,7 @@ function mapCloudTaskToTask(ct) {
70848
71084
  progress = 100;
70849
71085
  } else if (pageCount > 0) {
70850
71086
  progress = Math.round(pagesCompleted / pageCount * 100);
71087
+ progress = Math.max(0, Math.min(100, progress));
70851
71088
  }
70852
71089
  let type4 = ct.file_type;
70853
71090
  if (ct.file_type === "office") {
@@ -70884,7 +71121,7 @@ function mapCloudTasksToTasks(cloudTasks) {
70884
71121
  }
70885
71122
  const { Text: Text$4 } = Typography;
70886
71123
  const List = () => {
70887
- const { message, modal } = App$1.useApp();
71124
+ const { message: message2, modal } = App$1.useApp();
70888
71125
  const { t: t2 } = useTranslation("list");
70889
71126
  const { t: tCommon } = useTranslation("common");
70890
71127
  const cloudContext = reactExports.useContext(CloudContext);
@@ -70919,7 +71156,7 @@ const List = () => {
70919
71156
  combinedList = [...localResult.data.list];
70920
71157
  totalCount += localResult.data.total;
70921
71158
  } else {
70922
- message.error(localResult.error || t2("messages.fetch_failed"));
71159
+ message2.error(localResult.error || t2("messages.fetch_failed"));
70923
71160
  }
70924
71161
  if (cloudResult) {
70925
71162
  if (cloudResult.success && cloudResult.data) {
@@ -70952,11 +71189,11 @@ const List = () => {
70952
71189
  }));
70953
71190
  } catch (error) {
70954
71191
  console.error("Failed to fetch task list:", error);
70955
- message.error(t2("messages.fetch_failed"));
71192
+ message2.error(t2("messages.fetch_failed"));
70956
71193
  } finally {
70957
71194
  setLoading(false);
70958
71195
  }
70959
- }, [message, t2, cloudContext]);
71196
+ }, [message2, t2, cloudContext]);
70960
71197
  const handleTaskEvent = reactExports.useCallback((event) => {
70961
71198
  const { type: type4, taskId, task } = event;
70962
71199
  console.log(`[List] Received task event: ${type4}`, { taskId, task });
@@ -71129,14 +71366,14 @@ const List = () => {
71129
71366
  result = await window.api.task.delete(id);
71130
71367
  }
71131
71368
  if (result.success) {
71132
- message.success(t2("messages.delete_success"));
71369
+ message2.success(t2("messages.delete_success"));
71133
71370
  fetchTasks(pagination.current, pagination.pageSize);
71134
71371
  } else {
71135
- message.error(result.error || t2("messages.delete_failed"));
71372
+ message2.error(result.error || t2("messages.delete_failed"));
71136
71373
  }
71137
71374
  } catch (error) {
71138
71375
  console.error("Failed to delete task:", error);
71139
- message.error(t2("messages.delete_failed"));
71376
+ message2.error(t2("messages.delete_failed"));
71140
71377
  }
71141
71378
  }
71142
71379
  });
@@ -71151,14 +71388,14 @@ const List = () => {
71151
71388
  try {
71152
71389
  const result = await window.api.task.update(id, { status: status2 });
71153
71390
  if (result.success) {
71154
- message.success(t2("messages.action_success", { action: statusText }));
71391
+ message2.success(t2("messages.action_success", { action: statusText }));
71155
71392
  fetchTasks(pagination.current, pagination.pageSize);
71156
71393
  } else {
71157
- message.error(result.error || t2("messages.action_failed", { action: statusText }));
71394
+ message2.error(result.error || t2("messages.action_failed", { action: statusText }));
71158
71395
  }
71159
71396
  } catch (error) {
71160
71397
  console.error(`Failed to ${statusText} task:`, error);
71161
- message.error(t2("messages.action_failed", { action: statusText }));
71398
+ message2.error(t2("messages.action_failed", { action: statusText }));
71162
71399
  }
71163
71400
  }
71164
71401
  });
@@ -71180,13 +71417,13 @@ const List = () => {
71180
71417
  try {
71181
71418
  const result = await cloudContext.cancelTask(id);
71182
71419
  if (result.success) {
71183
- message.success(t2("messages.action_success", { action: t2("actions.cancel") }));
71420
+ message2.success(t2("messages.action_success", { action: t2("actions.cancel") }));
71184
71421
  fetchTasks(pagination.current, pagination.pageSize);
71185
71422
  } else {
71186
- message.error(result.error || t2("messages.action_failed", { action: t2("actions.cancel") }));
71423
+ message2.error(result.error || t2("messages.action_failed", { action: t2("actions.cancel") }));
71187
71424
  }
71188
71425
  } catch {
71189
- message.error(t2("messages.action_failed", { action: t2("actions.cancel") }));
71426
+ message2.error(t2("messages.action_failed", { action: t2("actions.cancel") }));
71190
71427
  }
71191
71428
  }
71192
71429
  });
@@ -71202,13 +71439,13 @@ const List = () => {
71202
71439
  try {
71203
71440
  const result = await cloudContext.retryTask(id);
71204
71441
  if (result.success) {
71205
- message.success(t2("messages.action_success", { action: t2("actions.retry") }));
71442
+ message2.success(t2("messages.action_success", { action: t2("actions.retry") }));
71206
71443
  fetchTasks(pagination.current, pagination.pageSize);
71207
71444
  } else {
71208
- message.error(result.error || t2("messages.action_failed", { action: t2("actions.retry") }));
71445
+ message2.error(result.error || t2("messages.action_failed", { action: t2("actions.retry") }));
71209
71446
  }
71210
71447
  } catch {
71211
- message.error(t2("messages.action_failed", { action: t2("actions.retry") }));
71448
+ message2.error(t2("messages.action_failed", { action: t2("actions.retry") }));
71212
71449
  }
71213
71450
  }
71214
71451
  });
@@ -71456,7 +71693,7 @@ const List = () => {
71456
71693
  const AddProvider = ({ onProviderAdded }) => {
71457
71694
  const [form2] = Form2.useForm();
71458
71695
  const [loading, setLoading] = reactExports.useState(false);
71459
- const { message } = App$1.useApp();
71696
+ const { message: message2 } = App$1.useApp();
71460
71697
  const { t: t2 } = useTranslation("provider");
71461
71698
  const handleAddProvider = async () => {
71462
71699
  try {
@@ -71466,16 +71703,16 @@ const AddProvider = ({ onProviderAdded }) => {
71466
71703
  if (!response.success) {
71467
71704
  throw new Error(response.error || t2("add_provider.failed"));
71468
71705
  }
71469
- message.success(t2("add_provider.success"));
71706
+ message2.success(t2("add_provider.success"));
71470
71707
  form2.resetFields();
71471
71708
  if (onProviderAdded && response.data.id) {
71472
71709
  onProviderAdded(response.data.id.toString());
71473
71710
  }
71474
71711
  } catch (error) {
71475
71712
  if (error instanceof Error) {
71476
- message.error(error.message);
71713
+ message2.error(error.message);
71477
71714
  } else {
71478
- message.error(t2("add_provider.failed"));
71715
+ message2.error(t2("add_provider.failed"));
71479
71716
  }
71480
71717
  } finally {
71481
71718
  setLoading(false);
@@ -71516,7 +71753,7 @@ const Provider = ({
71516
71753
  isPreset = false
71517
71754
  }) => {
71518
71755
  const [providerData, setProviderData] = reactExports.useState(null);
71519
- const { modal, message } = App$1.useApp();
71756
+ const { modal, message: message2 } = App$1.useApp();
71520
71757
  const { t: t2 } = useTranslation("provider");
71521
71758
  const { t: tCommon } = useTranslation("common");
71522
71759
  const [apiKey, setApiKey] = reactExports.useState("");
@@ -71593,11 +71830,11 @@ const Provider = ({
71593
71830
  setModels(result.data);
71594
71831
  } catch (error) {
71595
71832
  console.error("Failed to fetch models:", error);
71596
- message.error(
71833
+ message2.error(
71597
71834
  t2("messages.fetch_models_failed") + ": " + (error instanceof Error ? error.message : String(error))
71598
71835
  );
71599
71836
  }
71600
- }, [providerId, message, t2]);
71837
+ }, [providerId, message2, t2]);
71601
71838
  reactExports.useEffect(() => {
71602
71839
  if (providerId) {
71603
71840
  fetchModels();
@@ -71610,18 +71847,18 @@ const Provider = ({
71610
71847
  if (!result.success) {
71611
71848
  throw new Error(result.error || t2("messages.delete_model_failed"));
71612
71849
  }
71613
- message.success(t2("messages.delete_model_success"));
71850
+ message2.success(t2("messages.delete_model_success"));
71614
71851
  fetchModels();
71615
71852
  } catch (error) {
71616
71853
  console.error("Failed to delete model:", error);
71617
- message.error(
71854
+ message2.error(
71618
71855
  t2("messages.delete_model_failed") + ": " + (error instanceof Error ? error.message : String(error))
71619
71856
  );
71620
71857
  }
71621
71858
  };
71622
71859
  const addModel = async () => {
71623
71860
  if (!providerId || !newModelName || !newModelId) {
71624
- message.warning(t2("messages.add_model_warning"));
71861
+ message2.warning(t2("messages.add_model_warning"));
71625
71862
  return;
71626
71863
  }
71627
71864
  try {
@@ -71635,11 +71872,11 @@ const Provider = ({
71635
71872
  }
71636
71873
  setNewModelName("");
71637
71874
  setNewModelId("");
71638
- message.success(t2("messages.add_model_success"));
71875
+ message2.success(t2("messages.add_model_success"));
71639
71876
  fetchModels();
71640
71877
  } catch (error) {
71641
71878
  console.error("Failed to add model:", error);
71642
- message.error(
71879
+ message2.error(
71643
71880
  t2("messages.add_model_failed") + ": " + (error instanceof Error ? error.message : String(error))
71644
71881
  );
71645
71882
  }
@@ -71652,10 +71889,10 @@ const Provider = ({
71652
71889
  throw new Error(result.error || t2("messages.update_failed"));
71653
71890
  }
71654
71891
  setProviderData(result.data);
71655
- message.success(t2("messages.update_success"));
71892
+ message2.success(t2("messages.update_success"));
71656
71893
  } catch (error) {
71657
71894
  console.error("Failed to update provider:", error);
71658
- message.error(
71895
+ message2.error(
71659
71896
  t2("messages.update_failed") + ": " + (error instanceof Error ? error.message : String(error))
71660
71897
  );
71661
71898
  }
@@ -71671,10 +71908,10 @@ const Provider = ({
71671
71908
  if (!result.success) {
71672
71909
  throw new Error(result.error || t2("messages.test_failed"));
71673
71910
  }
71674
- message.success(t2("messages.test_success"));
71911
+ message2.success(t2("messages.test_success"));
71675
71912
  } catch (error) {
71676
71913
  console.error("Failed to test model connection:", error);
71677
- message.error(
71914
+ message2.error(
71678
71915
  t2("messages.test_failed") + ": " + (error instanceof Error ? error.message : String(error))
71679
71916
  );
71680
71917
  } finally {
@@ -71695,7 +71932,7 @@ const Provider = ({
71695
71932
  setFilteredModelList(result.data);
71696
71933
  } catch (error) {
71697
71934
  console.error("Failed to fetch model list:", error);
71698
- message.error(
71935
+ message2.error(
71699
71936
  t2("messages.fetch_model_list_failed") + ": " + (error instanceof Error ? error.message : String(error))
71700
71937
  );
71701
71938
  setModelList([]);
@@ -71728,7 +71965,7 @@ const Provider = ({
71728
71965
  const addModelFromList = async (model) => {
71729
71966
  if (!providerId) return;
71730
71967
  if (isModelExists(model.id)) {
71731
- message.warning(t2("messages.model_already_exists"));
71968
+ message2.warning(t2("messages.model_already_exists"));
71732
71969
  return;
71733
71970
  }
71734
71971
  setAddingModelIds((prev2) => new Set(prev2).add(model.id));
@@ -71741,11 +71978,11 @@ const Provider = ({
71741
71978
  if (!result.success) {
71742
71979
  throw new Error(result.error || t2("messages.add_model_failed"));
71743
71980
  }
71744
- message.success(t2("messages.add_model_success"));
71981
+ message2.success(t2("messages.add_model_success"));
71745
71982
  fetchModels();
71746
71983
  } catch (error) {
71747
71984
  console.error("Failed to add model:", error);
71748
- message.error(
71985
+ message2.error(
71749
71986
  t2("messages.add_model_failed") + ": " + (error instanceof Error ? error.message : String(error))
71750
71987
  );
71751
71988
  } finally {
@@ -71982,13 +72219,13 @@ const Provider = ({
71982
72219
  if (!result.success) {
71983
72220
  throw new Error(result.error || t2("messages.delete_provider_failed"));
71984
72221
  }
71985
- message.success(t2("messages.delete_provider_success"));
72222
+ message2.success(t2("messages.delete_provider_success"));
71986
72223
  if (onProviderDeleted) {
71987
72224
  onProviderDeleted();
71988
72225
  }
71989
72226
  } catch (error) {
71990
72227
  console.error("Failed to delete provider:", error);
71991
- message.error(
72228
+ message2.error(
71992
72229
  t2("messages.delete_provider_failed") + ": " + (error instanceof Error ? error.message : String(error))
71993
72230
  );
71994
72231
  }
@@ -72352,35 +72589,263 @@ const About = () => {
72352
72589
  );
72353
72590
  };
72354
72591
  const { Title, Text: Text$2 } = Typography;
72592
+ const initialPaymentDialogState = {
72593
+ open: false,
72594
+ phase: "idle",
72595
+ sessionId: null
72596
+ };
72355
72597
  const AccountCenter = () => {
72356
72598
  const { t: t2 } = useTranslation("account");
72357
72599
  const context = reactExports.useContext(CloudContext);
72358
- const [history2, setHistory] = reactExports.useState([]);
72359
- const [loadingHistory, setLoadingHistory] = reactExports.useState(false);
72360
- const [pagination, setPagination] = reactExports.useState({ current: 1, pageSize: 5, total: 0 });
72600
+ const [creditHistory, setCreditHistory] = reactExports.useState([]);
72601
+ const [paymentHistory, setPaymentHistory] = reactExports.useState([]);
72602
+ const [loadingCreditHistory, setLoadingCreditHistory] = reactExports.useState(false);
72603
+ const [loadingPaymentHistory, setLoadingPaymentHistory] = reactExports.useState(false);
72604
+ const [creditCurrentPage, setCreditCurrentPage] = reactExports.useState(1);
72605
+ const [paymentCurrentPage, setPaymentCurrentPage] = reactExports.useState(1);
72606
+ const [creditTotal, setCreditTotal] = reactExports.useState(0);
72607
+ const [paymentTotal, setPaymentTotal] = reactExports.useState(0);
72608
+ const [activeHistoryTab, setActiveHistoryTab] = reactExports.useState("credits");
72361
72609
  const [codeCopied, setCodeCopied] = reactExports.useState(false);
72362
- const fetchHistory = async (page = 1) => {
72610
+ const [selectedTopupAmount, setSelectedTopupAmount] = reactExports.useState(20);
72611
+ const [topupLoading, setTopupLoading] = reactExports.useState(false);
72612
+ const [paymentDialog, setPaymentDialog] = reactExports.useState(initialPaymentDialogState);
72613
+ const [reconcileLoading, setReconcileLoading] = reactExports.useState(false);
72614
+ const pollingActiveRef = reactExports.useRef(false);
72615
+ const pollingTimerRef = reactExports.useRef(null);
72616
+ const isAuthenticatedRef = reactExports.useRef(false);
72617
+ const celebrationTimerRef = reactExports.useRef(null);
72618
+ const [showCelebration, setShowCelebration] = reactExports.useState(false);
72619
+ const [celebrationKey, setCelebrationKey] = reactExports.useState(0);
72620
+ const topupOptions = [
72621
+ { amount: 5, credits: 7500 },
72622
+ { amount: 20, credits: 32e3 },
72623
+ { amount: 100, credits: 18e4 }
72624
+ ];
72625
+ const historyPageSize = 5;
72626
+ const fetchCreditHistory = reactExports.useCallback(async (page = 1) => {
72363
72627
  if (!context || !context.isAuthenticated) return;
72364
- setLoadingHistory(true);
72628
+ setLoadingCreditHistory(true);
72365
72629
  try {
72366
- const result = await context.getCreditHistory(page, pagination.pageSize);
72630
+ const result = await context.getCreditHistory(page, historyPageSize);
72367
72631
  if (result.success && result.data) {
72368
- setHistory(result.data);
72369
- setPagination((prev2) => ({ ...prev2, current: page, total: result.pagination?.total || 0 }));
72632
+ setCreditHistory(result.data);
72633
+ setCreditCurrentPage(page);
72634
+ setCreditTotal(result.pagination?.total || 0);
72370
72635
  }
72371
72636
  } catch (error) {
72372
- console.error("Failed to fetch history:", error);
72637
+ console.error("Failed to fetch credit history:", error);
72373
72638
  } finally {
72374
- setLoadingHistory(false);
72639
+ setLoadingCreditHistory(false);
72375
72640
  }
72376
- };
72641
+ }, [context, historyPageSize]);
72642
+ const fetchPaymentHistory = reactExports.useCallback(async (page = 1) => {
72643
+ if (!context || !context.isAuthenticated) return;
72644
+ setLoadingPaymentHistory(true);
72645
+ try {
72646
+ const result = await context.getPaymentHistory(page, historyPageSize);
72647
+ if (result.success && result.data) {
72648
+ setPaymentHistory(result.data);
72649
+ setPaymentCurrentPage(page);
72650
+ setPaymentTotal(result.pagination?.total || 0);
72651
+ }
72652
+ } catch (error) {
72653
+ console.error("Failed to fetch payment history:", error);
72654
+ } finally {
72655
+ setLoadingPaymentHistory(false);
72656
+ }
72657
+ }, [context, historyPageSize]);
72658
+ const stopPolling = reactExports.useCallback(() => {
72659
+ pollingActiveRef.current = false;
72660
+ if (pollingTimerRef.current) {
72661
+ clearTimeout(pollingTimerRef.current);
72662
+ pollingTimerRef.current = null;
72663
+ }
72664
+ }, []);
72665
+ const triggerCelebration = reactExports.useCallback(() => {
72666
+ if (celebrationTimerRef.current) {
72667
+ clearTimeout(celebrationTimerRef.current);
72668
+ }
72669
+ setCelebrationKey((prev2) => prev2 + 1);
72670
+ setShowCelebration(true);
72671
+ celebrationTimerRef.current = setTimeout(() => {
72672
+ setShowCelebration(false);
72673
+ celebrationTimerRef.current = null;
72674
+ }, 2600);
72675
+ }, []);
72676
+ const syncCreditsAndHistory = reactExports.useCallback(async () => {
72677
+ if (!context?.isAuthenticated) return;
72678
+ await context.refreshCredits();
72679
+ await Promise.all([
72680
+ fetchCreditHistory(creditCurrentPage),
72681
+ fetchPaymentHistory(paymentCurrentPage)
72682
+ ]);
72683
+ }, [context, fetchCreditHistory, fetchPaymentHistory, creditCurrentPage, paymentCurrentPage]);
72684
+ const applyFinalCheckoutStatus = reactExports.useCallback(async (statusData) => {
72685
+ const isSuccess = statusData.status === "completed";
72686
+ stopPolling();
72687
+ setPaymentDialog((prev2) => ({
72688
+ ...prev2,
72689
+ phase: isSuccess ? "success" : "failed",
72690
+ orderId: statusData.orderId,
72691
+ status: statusData.status,
72692
+ providerStatus: statusData.providerStatus,
72693
+ amountUsd: statusData.amountUsd,
72694
+ creditsAdded: statusData.creditsAdded,
72695
+ createdAt: statusData.createdAt,
72696
+ lastError: void 0
72697
+ }));
72698
+ await syncCreditsAndHistory();
72699
+ if (isSuccess) {
72700
+ triggerCelebration();
72701
+ staticMethods.success(t2("paid_credits.payment_success"));
72702
+ } else {
72703
+ staticMethods.error(t2("paid_credits.payment_failed"));
72704
+ }
72705
+ }, [stopPolling, syncCreditsAndHistory, t2, triggerCelebration]);
72706
+ const startCheckoutPolling = reactExports.useCallback((sessionId) => {
72707
+ if (!context?.isAuthenticated) return;
72708
+ stopPolling();
72709
+ isAuthenticatedRef.current = true;
72710
+ pollingActiveRef.current = true;
72711
+ const pollOnce = async () => {
72712
+ if (!pollingActiveRef.current || !isAuthenticatedRef.current) {
72713
+ return;
72714
+ }
72715
+ const result = await context.getCheckoutStatus(sessionId, 10);
72716
+ if (!pollingActiveRef.current || !isAuthenticatedRef.current) {
72717
+ return;
72718
+ }
72719
+ if (!result.success || !result.data) {
72720
+ setPaymentDialog((prev2) => prev2.sessionId === sessionId ? { ...prev2, lastError: result.error || t2("paid_credits.polling_failed") } : prev2);
72721
+ if (!pollingActiveRef.current || !isAuthenticatedRef.current) {
72722
+ return;
72723
+ }
72724
+ pollingTimerRef.current = setTimeout(() => {
72725
+ void pollOnce();
72726
+ }, 1500);
72727
+ return;
72728
+ }
72729
+ const statusData = result.data;
72730
+ setPaymentDialog((prev2) => prev2.sessionId === sessionId ? {
72731
+ ...prev2,
72732
+ phase: statusData.isFinal ? statusData.status === "completed" ? "success" : "failed" : "polling",
72733
+ orderId: statusData.orderId,
72734
+ status: statusData.status,
72735
+ providerStatus: statusData.providerStatus,
72736
+ amountUsd: statusData.amountUsd,
72737
+ creditsAdded: statusData.creditsAdded,
72738
+ createdAt: statusData.createdAt,
72739
+ lastError: void 0
72740
+ } : prev2);
72741
+ if (statusData.isFinal) {
72742
+ await applyFinalCheckoutStatus(statusData);
72743
+ return;
72744
+ }
72745
+ if (!pollingActiveRef.current || !isAuthenticatedRef.current) {
72746
+ return;
72747
+ }
72748
+ pollingTimerRef.current = setTimeout(() => {
72749
+ void pollOnce();
72750
+ }, 200);
72751
+ };
72752
+ void pollOnce();
72753
+ }, [applyFinalCheckoutStatus, context, stopPolling, t2]);
72377
72754
  reactExports.useEffect(() => {
72378
72755
  if (context?.isAuthenticated) {
72379
72756
  context.refreshCredits();
72380
- fetchHistory();
72757
+ void fetchCreditHistory();
72758
+ void fetchPaymentHistory();
72381
72759
  }
72382
72760
  }, [context?.isAuthenticated]);
72761
+ reactExports.useEffect(() => {
72762
+ const authed = Boolean(context?.isAuthenticated);
72763
+ isAuthenticatedRef.current = authed;
72764
+ if (!authed) {
72765
+ stopPolling();
72766
+ setReconcileLoading(false);
72767
+ setPaymentDialog((prev2) => prev2.open ? initialPaymentDialogState : prev2);
72768
+ }
72769
+ }, [context?.isAuthenticated, stopPolling]);
72770
+ reactExports.useEffect(() => () => {
72771
+ stopPolling();
72772
+ }, [stopPolling]);
72773
+ reactExports.useEffect(() => () => {
72774
+ if (celebrationTimerRef.current) {
72775
+ clearTimeout(celebrationTimerRef.current);
72776
+ }
72777
+ }, []);
72778
+ const closePaymentDialog = reactExports.useCallback(() => {
72779
+ stopPolling();
72780
+ setReconcileLoading(false);
72781
+ setPaymentDialog(initialPaymentDialogState);
72782
+ }, [stopPolling]);
72383
72783
  if (!context) return null;
72784
+ const handleManualReconcile = async () => {
72785
+ if (!paymentDialog.sessionId) return;
72786
+ setReconcileLoading(true);
72787
+ try {
72788
+ const result = await context.reconcileCheckout(paymentDialog.sessionId);
72789
+ if (!result.success || !result.data) {
72790
+ staticMethods.error(result.error || t2("paid_credits.reconcile_failed"));
72791
+ return;
72792
+ }
72793
+ const statusData = result.data;
72794
+ setPaymentDialog((prev2) => ({
72795
+ ...prev2,
72796
+ orderId: statusData.orderId,
72797
+ status: statusData.status,
72798
+ providerStatus: statusData.providerStatus,
72799
+ amountUsd: statusData.amountUsd,
72800
+ creditsAdded: statusData.creditsAdded,
72801
+ createdAt: statusData.createdAt,
72802
+ lastError: void 0
72803
+ }));
72804
+ if (statusData.isFinal) {
72805
+ await applyFinalCheckoutStatus(statusData);
72806
+ return;
72807
+ }
72808
+ if (!pollingActiveRef.current) {
72809
+ startCheckoutPolling(paymentDialog.sessionId);
72810
+ }
72811
+ staticMethods.info(t2("paid_credits.still_pending"));
72812
+ } catch (error) {
72813
+ console.error("Failed to reconcile checkout:", error);
72814
+ staticMethods.error(t2("paid_credits.reconcile_failed"));
72815
+ } finally {
72816
+ setReconcileLoading(false);
72817
+ }
72818
+ };
72819
+ const handleTopupClick = async () => {
72820
+ setTopupLoading(true);
72821
+ try {
72822
+ const result = await context.createCheckout(selectedTopupAmount);
72823
+ if (!result.success || !result.data) {
72824
+ staticMethods.error(result.error || t2("paid_credits.checkout_failed"));
72825
+ return;
72826
+ }
72827
+ const parsedUrl = new URL(result.data.checkoutUrl);
72828
+ if (parsedUrl.protocol !== "https:") {
72829
+ staticMethods.error(t2("paid_credits.checkout_invalid_url"));
72830
+ return;
72831
+ }
72832
+ window.api.shell.openExternal(parsedUrl.toString());
72833
+ setPaymentDialog({
72834
+ open: true,
72835
+ phase: "polling",
72836
+ sessionId: result.data.sessionId,
72837
+ amountUsd: result.data.amountUsd,
72838
+ creditsAdded: result.data.creditsToAdd
72839
+ });
72840
+ startCheckoutPolling(result.data.sessionId);
72841
+ staticMethods.success(t2("paid_credits.checkout_opened"));
72842
+ } catch (error) {
72843
+ console.error("Failed to create checkout:", error);
72844
+ staticMethods.error(t2("paid_credits.checkout_failed"));
72845
+ } finally {
72846
+ setTopupLoading(false);
72847
+ }
72848
+ };
72384
72849
  const { user, credits, isAuthenticated, login, logout, isLoading, deviceFlowStatus, userCode, authError, cancelLogin } = context;
72385
72850
  if (isLoading) {
72386
72851
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Card, { loading: true, bordered: false });
@@ -72479,16 +72944,31 @@ const AccountCenter = () => {
72479
72944
  }
72480
72945
  return translated !== i18nKey ? translated : type4;
72481
72946
  };
72482
- const columns2 = [
72947
+ const getOrderStatusLabel = (status2) => {
72948
+ if (!status2) return "-";
72949
+ return t2(`paid_credits.order_status_values.${status2}`, { defaultValue: status2 });
72950
+ };
72951
+ const getProviderStatusLabel = (status2) => {
72952
+ if (!status2) return "-";
72953
+ return t2(`paid_credits.provider_status_values.${status2}`, { defaultValue: status2 });
72954
+ };
72955
+ const paymentStatusColorMap = {
72956
+ pending: "gold",
72957
+ completed: "green",
72958
+ failed: "red",
72959
+ refunded: "purple"
72960
+ };
72961
+ const renderDateTime = (text2) => {
72962
+ if (!text2) return "-";
72963
+ const date4 = new Date(text2);
72964
+ return isNaN(date4.getTime()) ? text2 : date4.toLocaleString();
72965
+ };
72966
+ const creditColumns = [
72483
72967
  {
72484
72968
  title: t2("history.columns.time"),
72485
72969
  dataIndex: "createdAt",
72486
72970
  key: "createdAt",
72487
- render: (text2) => {
72488
- if (!text2) return "-";
72489
- const date4 = new Date(text2);
72490
- return isNaN(date4.getTime()) ? text2 : date4.toLocaleString();
72491
- }
72971
+ render: renderDateTime
72492
72972
  },
72493
72973
  {
72494
72974
  title: t2("history.columns.type"),
@@ -72520,7 +73000,67 @@ const AccountCenter = () => {
72520
73000
  }
72521
73001
  }
72522
73002
  ];
73003
+ const paymentColumns = [
73004
+ {
73005
+ title: t2("history.payment_columns.time"),
73006
+ dataIndex: "createdAt",
73007
+ key: "createdAt",
73008
+ render: renderDateTime
73009
+ },
73010
+ {
73011
+ title: t2("history.payment_columns.amount_usd"),
73012
+ dataIndex: "amountUsd",
73013
+ key: "amountUsd",
73014
+ align: "right",
73015
+ render: (amountUsd) => `$${amountUsd.toFixed(2)}`,
73016
+ width: 140
73017
+ },
73018
+ {
73019
+ title: t2("history.payment_columns.credits_added"),
73020
+ dataIndex: "creditsAdded",
73021
+ key: "creditsAdded",
73022
+ align: "right",
73023
+ render: (creditsAdded) => creditsAdded.toLocaleString(),
73024
+ width: 160
73025
+ },
73026
+ {
73027
+ title: t2("history.payment_columns.status"),
73028
+ dataIndex: "status",
73029
+ key: "status",
73030
+ width: 120,
73031
+ render: (status2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Tag, { color: paymentStatusColorMap[status2] || "default", children: getOrderStatusLabel(status2) })
73032
+ },
73033
+ {
73034
+ title: t2("history.payment_columns.provider_status"),
73035
+ dataIndex: "providerStatus",
73036
+ key: "providerStatus",
73037
+ width: 160,
73038
+ render: (providerStatus) => /* @__PURE__ */ jsxRuntimeExports.jsx(Tag, { children: getProviderStatusLabel(providerStatus) })
73039
+ }
73040
+ ];
72523
73041
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { padding: "0 24px 24px" }, children: [
73042
+ showCelebration ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "payment-celebration-overlay", "data-testid": "payment-success-celebration", "aria-hidden": "true", children: Array.from({ length: 90 }).map((_2, index2) => {
73043
+ const angleRad = (index2 * 137.5 + celebrationKey * 21) % 360 * (Math.PI / 180);
73044
+ const distance = 20 + index2 * 9 % 45;
73045
+ const style2 = {
73046
+ left: `${8 + index2 * 11 % 84}%`,
73047
+ top: `${12 + index2 * 17 % 76}%`,
73048
+ "--x": `${Math.cos(angleRad) * distance}vw`,
73049
+ "--y": `${Math.sin(angleRad) * distance + 30}vh`,
73050
+ "--rotate": `${220 + index2 * 37 % 260}deg`,
73051
+ "--delay": `${index2 % 12 * 0.04}s`,
73052
+ "--duration": `${1.1 + index2 * 5 % 8 * 0.14}s`,
73053
+ "--color": `hsl(${(index2 * 31 + celebrationKey * 19) % 360} 92% 60%)`
73054
+ };
73055
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
73056
+ "span",
73057
+ {
73058
+ className: "payment-celebration-particle",
73059
+ style: style2
73060
+ },
73061
+ `${celebrationKey}-${index2}`
73062
+ );
73063
+ }) }) : null,
72524
73064
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "flex", alignItems: "center", marginBottom: "24px" }, children: [
72525
73065
  /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar, { size: 80, src: user.avatarUrl, icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, {}) }),
72526
73066
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { marginLeft: "24px", flex: 1 }, children: [
@@ -72563,44 +73103,197 @@ const AccountCenter = () => {
72563
73103
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { marginTop: 4 }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text$2, { type: "secondary", style: { fontSize: "12px" }, children: t2("monthly_free.description") }) })
72564
73104
  ] }) }),
72565
73105
  /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: 12, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { variant: "borderless", style: { background: "#f9f0ff", position: "relative", height: "100%" }, children: [
72566
- /* @__PURE__ */ jsxRuntimeExports.jsx(
72567
- Statistic,
72568
- {
72569
- title: t2("paid_credits.title"),
72570
- value: credits.paid,
72571
- prefix: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$l, { style: { color: "#722ed1" } }),
72572
- valueStyle: { color: "#722ed1" }
72573
- }
72574
- ),
72575
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginTop: 4 }, children: [
72576
- /* @__PURE__ */ jsxRuntimeExports.jsx(Text$2, { type: "secondary", style: { fontSize: "12px" }, children: t2("paid_credits.description") }),
72577
- /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip2, { title: "Coming soon", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
73106
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-start", gap: 12 }, children: [
73107
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
73108
+ Statistic,
73109
+ {
73110
+ title: t2("paid_credits.title"),
73111
+ value: credits.paid,
73112
+ prefix: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$l, { style: { color: "#722ed1" } }),
73113
+ valueStyle: { color: "#722ed1" }
73114
+ }
73115
+ ),
73116
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
72578
73117
  Button$1,
72579
73118
  {
72580
73119
  type: "primary",
72581
- size: "small",
72582
- style: { backgroundColor: "#722ed1" },
72583
- disabled: true,
72584
- children: t2("paid_credits.recharge")
73120
+ size: "middle",
73121
+ style: { backgroundColor: "#722ed1", marginTop: 4 },
73122
+ onClick: handleTopupClick,
73123
+ loading: topupLoading,
73124
+ children: [
73125
+ t2("paid_credits.recharge"),
73126
+ " $",
73127
+ selectedTopupAmount
73128
+ ]
72585
73129
  }
72586
- ) })
72587
- ] })
73130
+ )
73131
+ ] }),
73132
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Row, { gutter: [8, 8], style: { marginTop: 6 }, children: topupOptions.map((option) => {
73133
+ const selected = selectedTopupAmount === option.amount;
73134
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: 8, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
73135
+ Button$1,
73136
+ {
73137
+ block: true,
73138
+ onClick: () => setSelectedTopupAmount(option.amount),
73139
+ style: {
73140
+ height: 68,
73141
+ borderRadius: 10,
73142
+ borderColor: selected ? "#722ed1" : "#d9d9d9",
73143
+ background: selected ? "#f4e8ff" : "#ffffff",
73144
+ boxShadow: selected ? "0 2px 8px rgba(114, 46, 209, 0.16)" : "none",
73145
+ padding: "8px 10px"
73146
+ },
73147
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { textAlign: "left", width: "100%", lineHeight: 1.15 }, children: [
73148
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { strong: true, style: { fontSize: 18, color: selected ? "#531dab" : "rgba(0,0,0,0.88)" }, children: [
73149
+ "$",
73150
+ option.amount
73151
+ ] }),
73152
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { marginTop: 2 }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", style: { fontSize: 12 }, children: [
73153
+ option.credits.toLocaleString(),
73154
+ " ",
73155
+ t2("history.columns.credits")
73156
+ ] }) })
73157
+ ] })
73158
+ }
73159
+ ) }, option.amount);
73160
+ }) })
72588
73161
  ] }) })
72589
73162
  ] }),
72590
73163
  /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {}),
72591
73164
  /* @__PURE__ */ jsxRuntimeExports.jsx(Title, { level: 4, style: { marginTop: "24px", marginBottom: "16px" }, children: t2("history.title") }),
72592
73165
  /* @__PURE__ */ jsxRuntimeExports.jsx(
72593
- ForwardTable,
73166
+ Tabs,
72594
73167
  {
72595
- dataSource: history2,
72596
- columns: columns2,
72597
- rowKey: "id",
72598
- loading: loadingHistory,
72599
- pagination: {
72600
- ...pagination,
72601
- onChange: (page) => fetchHistory(page)
72602
- },
72603
- size: "small"
73168
+ activeKey: activeHistoryTab,
73169
+ onChange: (key) => setActiveHistoryTab(key),
73170
+ items: [
73171
+ {
73172
+ key: "credits",
73173
+ label: t2("history.tabs.credits"),
73174
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
73175
+ ForwardTable,
73176
+ {
73177
+ dataSource: creditHistory,
73178
+ columns: creditColumns,
73179
+ rowKey: "id",
73180
+ loading: loadingCreditHistory,
73181
+ pagination: {
73182
+ current: creditCurrentPage,
73183
+ pageSize: historyPageSize,
73184
+ total: creditTotal,
73185
+ onChange: (page) => {
73186
+ void fetchCreditHistory(page);
73187
+ }
73188
+ },
73189
+ size: "small"
73190
+ }
73191
+ )
73192
+ },
73193
+ {
73194
+ key: "payments",
73195
+ label: t2("history.tabs.payments"),
73196
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
73197
+ ForwardTable,
73198
+ {
73199
+ dataSource: paymentHistory,
73200
+ columns: paymentColumns,
73201
+ rowKey: "id",
73202
+ loading: loadingPaymentHistory,
73203
+ pagination: {
73204
+ current: paymentCurrentPage,
73205
+ pageSize: historyPageSize,
73206
+ total: paymentTotal,
73207
+ onChange: (page) => {
73208
+ void fetchPaymentHistory(page);
73209
+ }
73210
+ },
73211
+ size: "small"
73212
+ }
73213
+ )
73214
+ }
73215
+ ]
73216
+ }
73217
+ ),
73218
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
73219
+ Modal,
73220
+ {
73221
+ open: paymentDialog.open,
73222
+ title: paymentDialog.phase === "polling" ? t2("paid_credits.payment_processing") : t2("paid_credits.payment_result"),
73223
+ onCancel: closePaymentDialog,
73224
+ maskClosable: false,
73225
+ closable: paymentDialog.phase !== "polling",
73226
+ footer: paymentDialog.phase === "polling" ? [
73227
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { onClick: closePaymentDialog, children: t2("paid_credits.cancel_waiting") }, "cancel"),
73228
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { type: "primary", loading: reconcileLoading, onClick: handleManualReconcile, children: t2("paid_credits.confirm_paid") }, "confirm")
73229
+ ] : [
73230
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { type: "primary", onClick: closePaymentDialog, children: t2("paid_credits.close_dialog") }, "close")
73231
+ ],
73232
+ children: paymentDialog.phase === "polling" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { direction: "vertical", size: 16, style: { width: "100%" }, children: [
73233
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [
73234
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Spin, { size: "small" }),
73235
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Text$2, { children: t2("paid_credits.waiting_for_confirmation") })
73236
+ ] }),
73237
+ paymentDialog.lastError ? /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { showIcon: true, type: "warning", message: paymentDialog.lastError }) : null,
73238
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "grid", gap: 4 }, children: [
73239
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73240
+ t2("paid_credits.session_id_label"),
73241
+ ": ",
73242
+ paymentDialog.sessionId || "-"
73243
+ ] }),
73244
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73245
+ t2("paid_credits.order_status_label"),
73246
+ ": ",
73247
+ getOrderStatusLabel(paymentDialog.status)
73248
+ ] }),
73249
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73250
+ t2("paid_credits.provider_status_label"),
73251
+ ": ",
73252
+ getProviderStatusLabel(paymentDialog.providerStatus)
73253
+ ] })
73254
+ ] })
73255
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { direction: "vertical", size: 16, style: { width: "100%" }, children: [
73256
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
73257
+ Alert,
73258
+ {
73259
+ showIcon: true,
73260
+ type: paymentDialog.phase === "success" ? "success" : "error",
73261
+ message: paymentDialog.phase === "success" ? t2("paid_credits.result_success") : t2("paid_credits.result_failed")
73262
+ }
73263
+ ),
73264
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "grid", gap: 4 }, children: [
73265
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73266
+ t2("paid_credits.session_id_label"),
73267
+ ": ",
73268
+ paymentDialog.sessionId || "-"
73269
+ ] }),
73270
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73271
+ t2("paid_credits.order_id_label"),
73272
+ ": ",
73273
+ paymentDialog.orderId || "-"
73274
+ ] }),
73275
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73276
+ t2("paid_credits.order_status_label"),
73277
+ ": ",
73278
+ getOrderStatusLabel(paymentDialog.status)
73279
+ ] }),
73280
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73281
+ t2("paid_credits.provider_status_label"),
73282
+ ": ",
73283
+ getProviderStatusLabel(paymentDialog.providerStatus)
73284
+ ] }),
73285
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73286
+ t2("paid_credits.amount_label"),
73287
+ ": $",
73288
+ paymentDialog.amountUsd ?? selectedTopupAmount
73289
+ ] }),
73290
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73291
+ t2("paid_credits.credits_added_label"),
73292
+ ": ",
73293
+ paymentDialog.creditsAdded ?? "-"
73294
+ ] })
73295
+ ] })
73296
+ ] })
72604
73297
  }
72605
73298
  )
72606
73299
  ] });
@@ -74612,15 +75305,15 @@ function parseStyle(state, value) {
74612
75305
  /** @type {Error} */
74613
75306
  error
74614
75307
  );
74615
- const message = new VFileMessage("Cannot parse `style` attribute", {
75308
+ const message2 = new VFileMessage("Cannot parse `style` attribute", {
74616
75309
  ancestors: state.ancestors,
74617
75310
  cause,
74618
75311
  ruleId: "style",
74619
75312
  source: "hast-util-to-jsx-runtime"
74620
75313
  });
74621
- message.file = state.filePath || void 0;
74622
- message.url = docs + "#cannot-parse-style-attribute";
74623
- throw message;
75314
+ message2.file = state.filePath || void 0;
75315
+ message2.url = docs + "#cannot-parse-style-attribute";
75316
+ throw message2;
74624
75317
  }
74625
75318
  }
74626
75319
  function findComponentFromName(state, name$1, allowExpression) {
@@ -74658,7 +75351,7 @@ function findComponentFromName(state, name$1, allowExpression) {
74658
75351
  crashEstree(state);
74659
75352
  }
74660
75353
  function crashEstree(state, place) {
74661
- const message = new VFileMessage(
75354
+ const message2 = new VFileMessage(
74662
75355
  "Cannot handle MDX estrees without `createEvaluater`",
74663
75356
  {
74664
75357
  ancestors: state.ancestors,
@@ -74667,9 +75360,9 @@ function crashEstree(state, place) {
74667
75360
  source: "hast-util-to-jsx-runtime"
74668
75361
  }
74669
75362
  );
74670
- message.file = state.filePath || void 0;
74671
- message.url = docs + "#cannot-handle-mdx-estrees-without-createevaluater";
74672
- throw message;
75363
+ message2.file = state.filePath || void 0;
75364
+ message2.url = docs + "#cannot-handle-mdx-estrees-without-createevaluater";
75365
+ throw message2;
74673
75366
  }
74674
75367
  function transformStylesToCssCasing(domCasing) {
74675
75368
  const cssCasing = {};
@@ -79976,8 +80669,8 @@ const deserializer = ($, _2) => {
79976
80669
  return set2;
79977
80670
  }
79978
80671
  case ERROR: {
79979
- const { name: name2, message } = value;
79980
- return as(new env[name2](message), index2);
80672
+ const { name: name2, message: message2 } = value;
80673
+ return as(new env[name2](message2), index2);
79981
80674
  }
79982
80675
  case BIGINT:
79983
80676
  return as(BigInt(value), index2);
@@ -80117,8 +80810,8 @@ const serializer = (strict, json2, $, _2) => {
80117
80810
  return index2;
80118
80811
  }
80119
80812
  }
80120
- const { message } = value;
80121
- return as([TYPE, { name: type4, message }], value);
80813
+ const { message: message2 } = value;
80814
+ return as([TYPE, { name: type4, message: message2 }], value);
80122
80815
  };
80123
80816
  return pair;
80124
80817
  };
@@ -81317,9 +82010,9 @@ class VFile {
81317
82010
  * Message.
81318
82011
  */
81319
82012
  fail(causeOrReason, optionsOrParentOrPlace, origin) {
81320
- const message = this.message(causeOrReason, optionsOrParentOrPlace, origin);
81321
- message.fatal = true;
81322
- throw message;
82013
+ const message2 = this.message(causeOrReason, optionsOrParentOrPlace, origin);
82014
+ message2.fatal = true;
82015
+ throw message2;
81323
82016
  }
81324
82017
  /**
81325
82018
  * Create an info message for `reason` associated with the file.
@@ -81380,9 +82073,9 @@ class VFile {
81380
82073
  * Message.
81381
82074
  */
81382
82075
  info(causeOrReason, optionsOrParentOrPlace, origin) {
81383
- const message = this.message(causeOrReason, optionsOrParentOrPlace, origin);
81384
- message.fatal = void 0;
81385
- return message;
82076
+ const message2 = this.message(causeOrReason, optionsOrParentOrPlace, origin);
82077
+ message2.fatal = void 0;
82078
+ return message2;
81386
82079
  }
81387
82080
  /**
81388
82081
  * Create a message for `reason` associated with the file.
@@ -81443,19 +82136,19 @@ class VFile {
81443
82136
  * Message.
81444
82137
  */
81445
82138
  message(causeOrReason, optionsOrParentOrPlace, origin) {
81446
- const message = new VFileMessage(
82139
+ const message2 = new VFileMessage(
81447
82140
  // @ts-expect-error: the overloads are fine.
81448
82141
  causeOrReason,
81449
82142
  optionsOrParentOrPlace,
81450
82143
  origin
81451
82144
  );
81452
82145
  if (this.path) {
81453
- message.name = this.path + ":" + message.name;
81454
- message.file = this.path;
82146
+ message2.name = this.path + ":" + message2.name;
82147
+ message2.file = this.path;
81455
82148
  }
81456
- message.fatal = false;
81457
- this.messages.push(message);
81458
- return message;
82149
+ message2.fatal = false;
82150
+ this.messages.push(message2);
82151
+ return message2;
81459
82152
  }
81460
82153
  /**
81461
82154
  * Serialize the file.
@@ -82814,12 +83507,12 @@ class ParseError {
82814
83507
  // Error start position based on passed-in Token or ParseNode.
82815
83508
  // Length of affected text based on passed-in Token or ParseNode.
82816
83509
  // The underlying error message without any context added.
82817
- constructor(message, token2) {
83510
+ constructor(message2, token2) {
82818
83511
  this.name = void 0;
82819
83512
  this.position = void 0;
82820
83513
  this.length = void 0;
82821
83514
  this.rawMessage = void 0;
82822
- var error = "KaTeX parse error: " + message;
83515
+ var error = "KaTeX parse error: " + message2;
82823
83516
  var start;
82824
83517
  var end;
82825
83518
  var loc = token2 && token2.loc;
@@ -82854,7 +83547,7 @@ class ParseError {
82854
83547
  if (start != null && end != null) {
82855
83548
  self2.length = end - start;
82856
83549
  }
82857
- self2.rawMessage = message;
83550
+ self2.rawMessage = message2;
82858
83551
  return self2;
82859
83552
  }
82860
83553
  }
@@ -124625,7 +125318,7 @@ const { Text: Text$1 } = Typography;
124625
125318
  const Preview = () => {
124626
125319
  const { id } = useParams();
124627
125320
  const navigate = useNavigate();
124628
- const { message, modal } = App$1.useApp();
125321
+ const { message: message2, modal } = App$1.useApp();
124629
125322
  const { t: t2 } = useTranslation("settings");
124630
125323
  const { t: tCommon } = useTranslation("common");
124631
125324
  const [task, setTask] = reactExports.useState(null);
@@ -124642,15 +125335,15 @@ const Preview = () => {
124642
125335
  if (result.success && result.data) {
124643
125336
  setTask(result.data);
124644
125337
  } else {
124645
- message.error(result.error || t2("preview.fetch_task_failed"));
125338
+ message2.error(result.error || t2("preview.fetch_task_failed"));
124646
125339
  navigate("/list");
124647
125340
  }
124648
125341
  } catch (error) {
124649
125342
  console.error("Failed to fetch task:", error);
124650
- message.error(t2("preview.fetch_task_failed"));
125343
+ message2.error(t2("preview.fetch_task_failed"));
124651
125344
  navigate("/list");
124652
125345
  }
124653
- }, [id, message, navigate, t2]);
125346
+ }, [id, message2, navigate, t2]);
124654
125347
  const fetchPageDetail = reactExports.useCallback(async (page) => {
124655
125348
  if (!id) return;
124656
125349
  setLoading(true);
@@ -124661,17 +125354,17 @@ const Preview = () => {
124661
125354
  setTaskDetail(result.data);
124662
125355
  setImageError(!result.data.imageExists);
124663
125356
  } else {
124664
- message.error(result.error || t2("preview.fetch_page_failed"));
125357
+ message2.error(result.error || t2("preview.fetch_page_failed"));
124665
125358
  setTaskDetail(null);
124666
125359
  }
124667
125360
  } catch (error) {
124668
125361
  console.error("Failed to fetch page detail:", error);
124669
- message.error(t2("preview.fetch_page_failed"));
125362
+ message2.error(t2("preview.fetch_page_failed"));
124670
125363
  setTaskDetail(null);
124671
125364
  } finally {
124672
125365
  setLoading(false);
124673
125366
  }
124674
- }, [id, message, t2]);
125367
+ }, [id, message2, t2]);
124675
125368
  reactExports.useEffect(() => {
124676
125369
  if (!id) return;
124677
125370
  const handleTaskEvent = (event) => {
@@ -124687,7 +125380,7 @@ const Preview = () => {
124687
125380
  }
124688
125381
  break;
124689
125382
  case "task:deleted":
124690
- message.info(t2("preview.task_deleted"));
125383
+ message2.info(t2("preview.task_deleted"));
124691
125384
  navigate("/list");
124692
125385
  break;
124693
125386
  }
@@ -124696,7 +125389,7 @@ const Preview = () => {
124696
125389
  return () => {
124697
125390
  cleanup2();
124698
125391
  };
124699
- }, [id, message, navigate, t2]);
125392
+ }, [id, message2, navigate, t2]);
124700
125393
  reactExports.useEffect(() => {
124701
125394
  if (!id) return;
124702
125395
  const handleTaskDetailEvent = (event) => {
@@ -124722,22 +125415,22 @@ const Preview = () => {
124722
125415
  }, [currentPage, task, fetchPageDetail]);
124723
125416
  reactExports.useEffect(() => {
124724
125417
  if (task && task.status !== void 0 && (task.status === -1 || task.status === 1)) {
124725
- message.warning(t2("preview.task_not_started"));
125418
+ message2.warning(t2("preview.task_not_started"));
124726
125419
  navigate("/list");
124727
125420
  }
124728
- }, [task, message, navigate, t2]);
125421
+ }, [task, message2, navigate, t2]);
124729
125422
  const handleDownload = async () => {
124730
125423
  if (!id) return;
124731
125424
  try {
124732
125425
  const result = await window.api.file.downloadMarkdown(id);
124733
125426
  if (result.success) {
124734
- message.success(t2("preview.download_success"));
125427
+ message2.success(t2("preview.download_success"));
124735
125428
  } else {
124736
- message.error(result.error || t2("preview.download_failed"));
125429
+ message2.error(result.error || t2("preview.download_failed"));
124737
125430
  }
124738
125431
  } catch (error) {
124739
125432
  console.error("Download failed:", error);
124740
- message.error(t2("preview.download_failed"));
125433
+ message2.error(t2("preview.download_failed"));
124741
125434
  }
124742
125435
  };
124743
125436
  const handleDelete2 = async () => {
@@ -124752,14 +125445,14 @@ const Preview = () => {
124752
125445
  try {
124753
125446
  const result = await window.api.task.delete(id);
124754
125447
  if (result.success) {
124755
- message.success(t2("preview.delete_success"));
125448
+ message2.success(t2("preview.delete_success"));
124756
125449
  navigate("/list");
124757
125450
  } else {
124758
- message.error(result.error || t2("preview.delete_failed"));
125451
+ message2.error(result.error || t2("preview.delete_failed"));
124759
125452
  }
124760
125453
  } catch (error) {
124761
125454
  console.error("删除失败:", error);
124762
- message.error(t2("preview.delete_failed"));
125455
+ message2.error(t2("preview.delete_failed"));
124763
125456
  }
124764
125457
  }
124765
125458
  });
@@ -124775,14 +125468,14 @@ const Preview = () => {
124775
125468
  try {
124776
125469
  const result = await window.api.task.update(id, { status: 7 });
124777
125470
  if (result.success) {
124778
- message.success(t2("preview.cancel_success"));
125471
+ message2.success(t2("preview.cancel_success"));
124779
125472
  navigate("/list");
124780
125473
  } else {
124781
- message.error(result.error || t2("preview.cancel_failed"));
125474
+ message2.error(result.error || t2("preview.cancel_failed"));
124782
125475
  }
124783
125476
  } catch (error) {
124784
125477
  console.error("取消失败:", error);
124785
- message.error(t2("preview.cancel_failed"));
125478
+ message2.error(t2("preview.cancel_failed"));
124786
125479
  }
124787
125480
  }
124788
125481
  });
@@ -124798,13 +125491,13 @@ const Preview = () => {
124798
125491
  try {
124799
125492
  const result = await window.api.task.update(id, { status: 1 });
124800
125493
  if (result.success) {
124801
- message.success(t2("preview.retry_success"));
125494
+ message2.success(t2("preview.retry_success"));
124802
125495
  } else {
124803
- message.error(result.error || t2("preview.retry_failed"));
125496
+ message2.error(result.error || t2("preview.retry_failed"));
124804
125497
  }
124805
125498
  } catch (error) {
124806
125499
  console.error("重试失败:", error);
124807
- message.error(t2("preview.retry_failed"));
125500
+ message2.error(t2("preview.retry_failed"));
124808
125501
  }
124809
125502
  }
124810
125503
  });
@@ -124821,13 +125514,13 @@ const Preview = () => {
124821
125514
  try {
124822
125515
  const result = await window.api.taskDetail.retryFailed(id);
124823
125516
  if (result.success) {
124824
- message.success(t2("preview.retry_failed_success", { count: result.data?.retried || 0 }));
125517
+ message2.success(t2("preview.retry_failed_success", { count: result.data?.retried || 0 }));
124825
125518
  } else {
124826
- message.error(result.error || t2("preview.retry_failed"));
125519
+ message2.error(result.error || t2("preview.retry_failed"));
124827
125520
  }
124828
125521
  } catch (error) {
124829
125522
  console.error("重试失败页失败:", error);
124830
- message.error(t2("preview.retry_failed"));
125523
+ message2.error(t2("preview.retry_failed"));
124831
125524
  } finally {
124832
125525
  setRetryingFailed(false);
124833
125526
  }
@@ -124843,14 +125536,14 @@ const Preview = () => {
124843
125536
  try {
124844
125537
  const result = await window.api.taskDetail.retry(taskDetail.id);
124845
125538
  if (result.success) {
124846
- message.success(t2("preview.page_retry_success"));
125539
+ message2.success(t2("preview.page_retry_success"));
124847
125540
  fetchPageDetail(currentPage);
124848
125541
  } else {
124849
- message.error(result.error || t2("preview.page_retry_failed"));
125542
+ message2.error(result.error || t2("preview.page_retry_failed"));
124850
125543
  }
124851
125544
  } catch (error) {
124852
125545
  console.error("Failed to retry page:", error);
124853
- message.error(t2("preview.page_retry_failed"));
125546
+ message2.error(t2("preview.page_retry_failed"));
124854
125547
  } finally {
124855
125548
  setRetrying(false);
124856
125549
  }
@@ -125150,10 +125843,11 @@ const Preview = () => {
125150
125843
  ) });
125151
125844
  };
125152
125845
  const { Text } = Typography;
125846
+ const dedupeAndSortPages = (pageItems) => Array.from(new Map(pageItems.map((page) => [page.page, page])).values()).sort((a2, b) => a2.page - b.page);
125153
125847
  const CloudPreview = () => {
125154
125848
  const { id } = useParams();
125155
125849
  const navigate = useNavigate();
125156
- const { message, modal } = App$1.useApp();
125850
+ const { message: message2, modal } = App$1.useApp();
125157
125851
  const { t: t2 } = useTranslation("cloud-preview");
125158
125852
  const { t: tCommon } = useTranslation("common");
125159
125853
  const cloudContext = reactExports.useContext(CloudContext);
@@ -125167,6 +125861,9 @@ const CloudPreview = () => {
125167
125861
  const [imageUrl, setImageUrl] = reactExports.useState(null);
125168
125862
  const [imageError, setImageError] = reactExports.useState(false);
125169
125863
  const [imageLoading, setImageLoading] = reactExports.useState(false);
125864
+ const taskPagesPageSizeRef = reactExports.useRef(100);
125865
+ const attemptedFallbackPagesRef = reactExports.useRef(/* @__PURE__ */ new Set());
125866
+ const inFlightFallbackPagesRef = reactExports.useRef(/* @__PURE__ */ new Set());
125170
125867
  const currentPageData = pages.find((p2) => p2.page === currentPage);
125171
125868
  const fetchTask = reactExports.useCallback(async () => {
125172
125869
  if (!id || !cloudContext) return;
@@ -125175,21 +125872,39 @@ const CloudPreview = () => {
125175
125872
  if (result.success && result.data) {
125176
125873
  setTask(result.data);
125177
125874
  } else {
125178
- message.error(result.error || t2("fetch_task_failed"));
125875
+ message2.error(result.error || t2("fetch_task_failed"));
125179
125876
  navigate("/list");
125180
125877
  }
125181
125878
  } catch {
125182
- message.error(t2("fetch_task_failed"));
125879
+ message2.error(t2("fetch_task_failed"));
125183
125880
  navigate("/list");
125184
125881
  }
125185
- }, [id, cloudContext, message, navigate, t2]);
125882
+ }, [id, cloudContext, message2, navigate, t2]);
125186
125883
  const fetchPages = reactExports.useCallback(async () => {
125187
125884
  if (!id || !cloudContext) return;
125885
+ attemptedFallbackPagesRef.current.clear();
125886
+ inFlightFallbackPagesRef.current.clear();
125887
+ taskPagesPageSizeRef.current = 100;
125188
125888
  setLoading(true);
125189
125889
  try {
125190
- const result = await cloudContext.getTaskPages(id, 1, 200);
125191
- if (result.success && result.data) {
125192
- setPages(result.data);
125890
+ const requestedPageSize = 100;
125891
+ const result = await cloudContext.getTaskPages(id, 1, requestedPageSize);
125892
+ if (result.success) {
125893
+ const effectivePageSize = Math.max(1, result.pagination?.page_size || requestedPageSize);
125894
+ taskPagesPageSizeRef.current = effectivePageSize;
125895
+ const allPages = [...result.data || []];
125896
+ const totalApiPages = Math.max(1, result.pagination?.total_pages || 1);
125897
+ for (let apiPage = 2; apiPage <= totalApiPages; apiPage++) {
125898
+ try {
125899
+ const nextPageResult = await cloudContext.getTaskPages(id, apiPage, effectivePageSize);
125900
+ if (nextPageResult.success && nextPageResult.data?.length) {
125901
+ allPages.push(...nextPageResult.data);
125902
+ }
125903
+ } catch {
125904
+ console.error(`Failed to fetch page chunk ${apiPage}`);
125905
+ }
125906
+ }
125907
+ setPages(dedupeAndSortPages(allPages));
125193
125908
  }
125194
125909
  } catch {
125195
125910
  console.error("Failed to fetch pages");
@@ -125197,6 +125912,50 @@ const CloudPreview = () => {
125197
125912
  setLoading(false);
125198
125913
  }
125199
125914
  }, [id, cloudContext]);
125915
+ const ensureCurrentPageLoaded = reactExports.useCallback(async () => {
125916
+ if (!id || !cloudContext || loading) return;
125917
+ if (pages.some((page) => page.page === currentPage)) return;
125918
+ if (attemptedFallbackPagesRef.current.has(currentPage) || inFlightFallbackPagesRef.current.has(currentPage)) return;
125919
+ const targetPage = currentPage;
125920
+ let shouldMarkAttempted = true;
125921
+ let effectivePageSize = Math.max(1, taskPagesPageSizeRef.current || 1);
125922
+ let fallbackApiPage = Math.max(1, Math.floor((targetPage - 1) / effectivePageSize) + 1);
125923
+ inFlightFallbackPagesRef.current.add(targetPage);
125924
+ try {
125925
+ let result = await cloudContext.getTaskPages(id, fallbackApiPage, effectivePageSize);
125926
+ const responsePageSize = result.pagination?.page_size ? Math.max(1, result.pagination.page_size) : void 0;
125927
+ if (responsePageSize) {
125928
+ taskPagesPageSizeRef.current = responsePageSize;
125929
+ if (responsePageSize !== effectivePageSize) {
125930
+ effectivePageSize = responsePageSize;
125931
+ const correctedApiPage = Math.max(1, Math.floor((targetPage - 1) / effectivePageSize) + 1);
125932
+ if (correctedApiPage !== fallbackApiPage) {
125933
+ fallbackApiPage = correctedApiPage;
125934
+ result = await cloudContext.getTaskPages(id, fallbackApiPage, effectivePageSize);
125935
+ }
125936
+ }
125937
+ }
125938
+ const pageItems = (result.data || []).filter((page) => page.page === targetPage);
125939
+ if (result.success && pageItems?.length) {
125940
+ setPages((prev2) => dedupeAndSortPages([...prev2, ...pageItems]));
125941
+ }
125942
+ if (!result.success && !responsePageSize) {
125943
+ shouldMarkAttempted = false;
125944
+ }
125945
+ } catch {
125946
+ console.error("Failed to fetch current page data");
125947
+ } finally {
125948
+ inFlightFallbackPagesRef.current.delete(targetPage);
125949
+ if (shouldMarkAttempted) {
125950
+ attemptedFallbackPagesRef.current.add(targetPage);
125951
+ }
125952
+ }
125953
+ }, [id, cloudContext, currentPage, loading, pages]);
125954
+ reactExports.useEffect(() => {
125955
+ taskPagesPageSizeRef.current = 100;
125956
+ attemptedFallbackPagesRef.current.clear();
125957
+ inFlightFallbackPagesRef.current.clear();
125958
+ }, [id]);
125200
125959
  const loadPageImage = reactExports.useCallback(async () => {
125201
125960
  if (!id || !currentPageData) {
125202
125961
  setImageUrl(null);
@@ -125235,6 +125994,9 @@ const CloudPreview = () => {
125235
125994
  reactExports.useEffect(() => {
125236
125995
  loadPageImage();
125237
125996
  }, [loadPageImage]);
125997
+ reactExports.useEffect(() => {
125998
+ ensureCurrentPageLoaded();
125999
+ }, [ensureCurrentPageLoaded]);
125238
126000
  reactExports.useEffect(() => {
125239
126001
  if (!id || !window.api?.events?.onCloudTaskEvent) return;
125240
126002
  const handleEvent = (event) => {
@@ -125329,12 +126091,12 @@ const CloudPreview = () => {
125329
126091
  a2.download = (task?.file_name?.replace(/\.[^.]+$/, "") || "result") + ".md";
125330
126092
  a2.click();
125331
126093
  URL.revokeObjectURL(url2);
125332
- message.success(t2("download_success"));
126094
+ message2.success(t2("download_success"));
125333
126095
  } else {
125334
- message.error(result.error || t2("download_failed"));
126096
+ message2.error(result.error || t2("download_failed"));
125335
126097
  }
125336
126098
  } catch {
125337
- message.error(t2("download_failed"));
126099
+ message2.error(t2("download_failed"));
125338
126100
  } finally {
125339
126101
  setDownloading(false);
125340
126102
  }
@@ -125349,10 +126111,10 @@ const CloudPreview = () => {
125349
126111
  onOk: async () => {
125350
126112
  const result = await cloudContext.cancelTask(id);
125351
126113
  if (result.success) {
125352
- message.success(t2("cancel_success"));
126114
+ message2.success(t2("cancel_success"));
125353
126115
  navigate("/list");
125354
126116
  } else {
125355
- message.error(result.error || t2("cancel_failed"));
126117
+ message2.error(result.error || t2("cancel_failed"));
125356
126118
  }
125357
126119
  }
125358
126120
  });
@@ -125367,10 +126129,10 @@ const CloudPreview = () => {
125367
126129
  onOk: async () => {
125368
126130
  const result = await cloudContext.retryTask(id);
125369
126131
  if (result.success && result.data) {
125370
- message.success(t2("retry_success"));
126132
+ message2.success(t2("retry_success"));
125371
126133
  navigate(`/list/cloud-preview/${result.data.task_id}`);
125372
126134
  } else {
125373
- message.error(result.error || t2("retry_failed"));
126135
+ message2.error(result.error || t2("retry_failed"));
125374
126136
  }
125375
126137
  }
125376
126138
  });
@@ -125381,7 +126143,7 @@ const CloudPreview = () => {
125381
126143
  try {
125382
126144
  const result = await cloudContext.retryPage(id, currentPage);
125383
126145
  if (result.success) {
125384
- message.success(t2("page_retry_success"));
126146
+ message2.success(t2("page_retry_success"));
125385
126147
  setPages((prev2) => {
125386
126148
  const idx = prev2.findIndex((p2) => p2.page === currentPage);
125387
126149
  if (idx >= 0) {
@@ -125392,10 +126154,10 @@ const CloudPreview = () => {
125392
126154
  return prev2;
125393
126155
  });
125394
126156
  } else {
125395
- message.error(result.error || t2("page_retry_failed"));
126157
+ message2.error(result.error || t2("page_retry_failed"));
125396
126158
  }
125397
126159
  } catch {
125398
- message.error(t2("page_retry_failed"));
126160
+ message2.error(t2("page_retry_failed"));
125399
126161
  } finally {
125400
126162
  setRetrying(false);
125401
126163
  }
@@ -125428,12 +126190,12 @@ const CloudPreview = () => {
125428
126190
  }
125429
126191
  }
125430
126192
  if (retriedCount > 0) {
125431
- message.success(t2("retry_failed_success", { count: retriedCount }));
126193
+ message2.success(t2("retry_failed_success", { count: retriedCount }));
125432
126194
  } else {
125433
- message.error(t2("retry_failed"));
126195
+ message2.error(t2("retry_failed"));
125434
126196
  }
125435
126197
  } catch {
125436
- message.error(t2("retry_failed"));
126198
+ message2.error(t2("retry_failed"));
125437
126199
  } finally {
125438
126200
  setRetryingFailed(false);
125439
126201
  }
@@ -125451,10 +126213,10 @@ const CloudPreview = () => {
125451
126213
  onOk: async () => {
125452
126214
  const result = await cloudContext.deleteTask(id);
125453
126215
  if (result.success) {
125454
- message.success(t2("delete_success"));
126216
+ message2.success(t2("delete_success"));
125455
126217
  navigate("/list");
125456
126218
  } else {
125457
- message.error(result.error || t2("delete_failed"));
126219
+ message2.error(result.error || t2("delete_failed"));
125458
126220
  }
125459
126221
  }
125460
126222
  });
@@ -127755,9 +128517,9 @@ const sign_out_button$5 = "Sign Out";
127755
128517
  const credit_balance$5 = "Credit Balance";
127756
128518
  const credit_usage_hint$5 = "Lite: ~10 credits/page (A4); Pro & Ultra: 2x & 6x";
127757
128519
  const monthly_free$5 = { "title": "Free Credits", "monthly_label": "Monthly", "daily_label": "Today", "description": "3,000 free credits per month, resets on the 1st at 00:00 (UTC+0)", "daily_limit_tooltip": "Daily usage limit: {{limit}}" };
127758
- const paid_credits$5 = { "title": "Paid Credits", "description": "$1 USD = 1,500 credits", "recharge": "Recharge" };
128520
+ const paid_credits$5 = { "title": "Paid Credits", "description": "$1 USD = 1,500 credits", "recharge": "Recharge", "coming_soon": "Top-up will be available soon", "checkout_opened": "Checkout opened in your browser. Please complete payment there.", "checkout_failed": "Failed to create checkout session. Please try again.", "checkout_invalid_url": "Invalid checkout URL returned by server.", "payment_success": "Payment succeeded. Credits have been updated.", "payment_cancelled": "Payment was cancelled.", "payment_failed": "Payment failed. Please try again later.", "payment_callback_received": "Payment callback received. Syncing credits.", "payment_processing": "Waiting For Payment", "payment_result": "Payment Result", "waiting_for_confirmation": "Waiting for payment confirmation from server...", "cancel_waiting": "Cancel", "confirm_paid": "I've Completed Payment", "close_dialog": "Close", "reconcile_failed": "Failed to reconcile payment status. Please try again.", "still_pending": "Payment is still pending. Keep this dialog open.", "polling_failed": "Unable to query payment status. Retrying...", "session_id_label": "Session ID", "order_id_label": "Order ID", "order_status_label": "Order Status", "provider_status_label": "Provider Status", "amount_label": "Amount", "credits_added_label": "Credits To Add", "result_success": "Payment completed successfully.", "result_failed": "Payment failed or was not completed.", "order_status_values": { "pending": "Pending", "completed": "Completed", "failed": "Failed", "refunded": "Refunded" }, "provider_status_values": { "pending": "Pending", "processing": "Processing", "completed": "Completed", "failed": "Failed", "canceled": "Canceled", "expired": "Expired", "refunded": "Refunded", "unknown": "Unknown" } };
127759
128521
  const device_flow$5 = { "browser_opened": "A browser window has been opened for authorization", "enter_code_hint": "Enter the code below in your browser to complete sign in", "cancel": "Cancel", "try_again": "Try Again", "expired": "The authorization code has expired. Please try again.", "waiting": "Waiting for browser authorization..." };
127760
- const history$5 = { "title": "Credit History", "columns": { "time": "Time", "type": "Type", "description": "Description", "credits": "Credits" }, "types": { "consume": "Consumption", "pre_auth": "Pre-authorization", "settle": "Settlement", "pre_auth_release": "Release Frozen", "topup": "Top Up", "refund": "Refund", "bonus_grant": "Bonus", "bonus_expire": "Expired" } };
128522
+ const history$5 = { "title": "Credit History", "tabs": { "credits": "Credit Transactions", "payments": "Payment Orders" }, "columns": { "time": "Time", "type": "Type", "description": "Description", "credits": "Credits" }, "payment_columns": { "time": "Time", "amount_usd": "Amount (USD)", "credits_added": "Credits Added", "status": "Status", "provider_status": "Provider Status" }, "types": { "consume": "Consumption", "pre_auth": "Pre-authorization", "settle": "Settlement", "pre_auth_release": "Release Frozen", "topup": "Top Up", "refund": "Refund", "bonus_grant": "Bonus", "bonus_expire": "Expired" } };
127761
128523
  const enAccount = {
127762
128524
  title: title$a,
127763
128525
  sign_in_hint: sign_in_hint$5,
@@ -127915,9 +128677,9 @@ const sign_out_button$4 = "退出登录";
127915
128677
  const credit_balance$4 = "积分余额";
127916
128678
  const credit_usage_hint$4 = "Lite模型每页约消耗10积分,Pro、Ultra分别为Lite的2倍和6倍";
127917
128679
  const monthly_free$4 = { "title": "免费积分", "monthly_label": "本月剩余", "daily_label": "今日可用", "description": "每月可享3000免费积分,每月1号0点刷新额度(UTC+0)", "daily_limit_tooltip": "每日使用上限: {{limit}}" };
127918
- const paid_credits$4 = { "title": "付费积分", "description": "1美元可兑换1500积分", "recharge": "充值" };
128680
+ const paid_credits$4 = { "title": "付费积分", "description": "1美元可兑换1500积分", "recharge": "充值", "coming_soon": "充值功能即将上线", "checkout_opened": "支付页面已在浏览器打开,请完成支付。", "checkout_failed": "创建支付会话失败,请稍后重试。", "checkout_invalid_url": "服务端返回的支付链接无效。", "payment_success": "支付成功,积分已更新。", "payment_cancelled": "支付已取消。", "payment_failed": "支付失败,请稍后重试。", "payment_callback_received": "已收到支付回调,正在同步积分。", "payment_processing": "等待支付确认", "payment_result": "支付结果", "waiting_for_confirmation": "正在等待服务端确认支付状态...", "cancel_waiting": "取消", "confirm_paid": "我已完成支付", "close_dialog": "关闭", "reconcile_failed": "主动对账失败,请稍后重试。", "still_pending": "订单仍在处理中,请保持此窗口打开。", "polling_failed": "查询支付状态失败,正在重试...", "session_id_label": "会话ID", "order_id_label": "订单ID", "order_status_label": "订单状态", "provider_status_label": "支付通道状态", "amount_label": "金额", "credits_added_label": "预计到账积分", "result_success": "支付已完成。", "result_failed": "支付失败或未完成。", "order_status_values": { "pending": "待处理", "completed": "已完成", "failed": "失败", "refunded": "已退款" }, "provider_status_values": { "pending": "待处理", "processing": "处理中", "completed": "已完成", "failed": "失败", "canceled": "已取消", "expired": "已过期", "refunded": "已退款", "unknown": "未知" } };
127919
128681
  const device_flow$4 = { "browser_opened": "已打开浏览器窗口进行授权", "enter_code_hint": "请在浏览器中输入以下代码以完成登录", "cancel": "取消", "try_again": "重试", "expired": "授权码已过期,请重试。", "waiting": "等待浏览器授权..." };
127920
- const history$4 = { "title": "积分记录", "columns": { "time": "时间", "type": "类型", "description": "描述", "credits": "积分" }, "types": { "consume": "消费", "pre_auth": "预授权冻结", "settle": "逐页结算", "pre_auth_release": "释放冻结", "topup": "充值", "refund": "退款", "bonus_grant": "赠送", "bonus_expire": "过期" } };
128682
+ const history$4 = { "title": "积分记录", "tabs": { "credits": "积分流水", "payments": "支付订单" }, "columns": { "time": "时间", "type": "类型", "description": "描述", "credits": "积分" }, "payment_columns": { "time": "时间", "amount_usd": "金额(USD)", "credits_added": "到账积分", "status": "订单状态", "provider_status": "支付通道状态" }, "types": { "consume": "消费", "pre_auth": "预授权冻结", "settle": "逐页结算", "pre_auth_release": "释放冻结", "topup": "充值", "refund": "退款", "bonus_grant": "赠送", "bonus_expire": "过期" } };
127921
128683
  const zhAccount = {
127922
128684
  title: title$8,
127923
128685
  sign_in_hint: sign_in_hint$4,
@@ -128075,9 +128837,9 @@ const sign_out_button$3 = "ログアウト";
128075
128837
  const credit_balance$3 = "クレジット残高";
128076
128838
  const credit_usage_hint$3 = "Lite: 1ページ約10クレジット(A4)、Pro・UltraはLiteの2倍・6倍";
128077
128839
  const monthly_free$3 = { "title": "無料クレジット", "monthly_label": "月間残高", "daily_label": "本日利用可能", "description": "毎月3,000クレジットが無料、1日0時にリセット(UTC+0)", "daily_limit_tooltip": "1日の使用上限: {{limit}}" };
128078
- const paid_credits$3 = { "title": "有料クレジット", "description": "1ドル = 1,500クレジット", "recharge": "チャージ" };
128840
+ const paid_credits$3 = { "title": "有料クレジット", "description": "1ドル = 1,500クレジット", "recharge": "チャージ", "coming_soon": "チャージ機能は近日公開予定です", "checkout_opened": "決済ページをブラウザで開きました。支払いを完了してください。", "checkout_failed": "決済セッションの作成に失敗しました。後でもう一度お試しください。", "checkout_invalid_url": "サーバーから返された決済URLが無効です。", "payment_success": "決済が完了し、クレジットを更新しました。", "payment_cancelled": "決済はキャンセルされました。", "payment_failed": "決済に失敗しました。しばらくしてから再試行してください。", "payment_callback_received": "決済コールバックを受信しました。クレジットを同期中です。", "payment_processing": "支払い確認待ち", "payment_result": "支払い結果", "waiting_for_confirmation": "サーバーからの支払い確認を待機しています...", "cancel_waiting": "キャンセル", "confirm_paid": "支払い完了", "close_dialog": "閉じる", "reconcile_failed": "支払い照合に失敗しました。もう一度お試しください。", "still_pending": "支払いはまだ保留中です。このダイアログを開いたままにしてください。", "polling_failed": "支払いステータスの取得に失敗しました。再試行します...", "session_id_label": "セッションID", "order_id_label": "注文ID", "order_status_label": "注文ステータス", "provider_status_label": "決済プロバイダーステータス", "amount_label": "金額", "credits_added_label": "追加クレジット", "result_success": "支払いが完了しました。", "result_failed": "支払いに失敗したか、完了していません。", "order_status_values": { "pending": "保留中", "completed": "完了", "failed": "失敗", "refunded": "返金済み" }, "provider_status_values": { "pending": "保留中", "processing": "処理中", "completed": "完了", "failed": "失敗", "canceled": "キャンセル済み", "expired": "期限切れ", "refunded": "返金済み", "unknown": "不明" } };
128079
128841
  const device_flow$3 = { "browser_opened": "認証のためにブラウザウィンドウが開きました", "enter_code_hint": "ブラウザで以下のコードを入力してサインインを完了してください", "cancel": "キャンセル", "try_again": "再試行", "expired": "認証コードの有効期限が切れました。もう一度お試しください。", "waiting": "ブラウザでの認証を待っています..." };
128080
- const history$3 = { "title": "クレジット履歴", "columns": { "time": "日時", "type": "種類", "description": "説明", "credits": "クレジット" }, "types": { "consume": "消費", "pre_auth": "事前承認", "settle": "ページ精算", "pre_auth_release": "凍結解除", "topup": "チャージ", "refund": "返金", "bonus_grant": "ボーナス", "bonus_expire": "期限切れ" } };
128842
+ const history$3 = { "title": "クレジット履歴", "tabs": { "credits": "クレジット取引", "payments": "支払い注文" }, "columns": { "time": "日時", "type": "種類", "description": "説明", "credits": "クレジット" }, "payment_columns": { "time": "日時", "amount_usd": "金額 (USD)", "credits_added": "追加クレジット", "status": "注文ステータス", "provider_status": "決済プロバイダーステータス" }, "types": { "consume": "消費", "pre_auth": "事前承認", "settle": "ページ精算", "pre_auth_release": "凍結解除", "topup": "チャージ", "refund": "返金", "bonus_grant": "ボーナス", "bonus_expire": "期限切れ" } };
128081
128843
  const jaAccount = {
128082
128844
  title: title$6,
128083
128845
  sign_in_hint: sign_in_hint$3,
@@ -128235,9 +128997,9 @@ const sign_out_button$2 = "Выйти";
128235
128997
  const credit_balance$2 = "Баланс кредитов";
128236
128998
  const credit_usage_hint$2 = "Lite: ~10 кредитов/страница (A4); Pro и Ultra: в 2 и 6 раз";
128237
128999
  const monthly_free$2 = { "title": "Бесплатные кредиты", "monthly_label": "За месяц", "daily_label": "Сегодня", "description": "3 000 бесплатных кредитов в месяц, обновляется 1-го числа в 00:00 (UTC+0)", "daily_limit_tooltip": "Дневной лимит: {{limit}}" };
128238
- const paid_credits$2 = { "title": "Платные кредиты", "description": "1 доллар = 1 500 кредитов", "recharge": "Пополнить" };
129000
+ const paid_credits$2 = { "title": "Платные кредиты", "description": "1 доллар = 1 500 кредитов", "recharge": "Пополнить", "coming_soon": "Пополнение скоро будет доступно", "checkout_opened": "Страница оплаты открыта в браузере. Завершите оплату там.", "checkout_failed": "Не удалось создать сессию оплаты. Попробуйте позже.", "checkout_invalid_url": "Сервер вернул некорректную ссылку оплаты.", "payment_success": "Оплата успешна. Баланс кредитов обновлён.", "payment_cancelled": "Оплата отменена.", "payment_failed": "Оплата не удалась. Попробуйте позже.", "payment_callback_received": "Получен callback оплаты. Синхронизируем кредиты.", "payment_processing": "Ожидание подтверждения оплаты", "payment_result": "Результат оплаты", "waiting_for_confirmation": "Ожидание подтверждения статуса оплаты от сервера...", "cancel_waiting": "Отменить", "confirm_paid": "Я уже оплатил", "close_dialog": "Закрыть", "reconcile_failed": "Не удалось выполнить сверку платежа. Попробуйте снова.", "still_pending": "Платеж все еще в ожидании. Оставьте это окно открытым.", "polling_failed": "Не удалось получить статус платежа. Повторяем попытку...", "session_id_label": "ID сессии", "order_id_label": "ID заказа", "order_status_label": "Статус заказа", "provider_status_label": "Статус провайдера", "amount_label": "Сумма", "credits_added_label": "Начисляемые кредиты", "result_success": "Оплата успешно завершена.", "result_failed": "Оплата не выполнена или завершилась ошибкой.", "order_status_values": { "pending": "В ожидании", "completed": "Завершен", "failed": "Ошибка", "refunded": "Возврат" }, "provider_status_values": { "pending": "В ожидании", "processing": "Обработка", "completed": "Завершен", "failed": "Ошибка", "canceled": "Отменен", "expired": "Истек", "refunded": "Возврат", "unknown": "Неизвестно" } };
128239
129001
  const device_flow$2 = { "browser_opened": "Окно браузера открыто для авторизации", "enter_code_hint": "Введите код ниже в браузере для завершения входа", "cancel": "Отмена", "try_again": "Повторить", "expired": "Код авторизации истёк. Пожалуйста, попробуйте снова.", "waiting": "Ожидание авторизации в браузере..." };
128240
- const history$2 = { "title": "История кредитов", "columns": { "time": "Время", "type": "Тип", "description": "Описание", "credits": "Кредиты" }, "types": { "consume": "Расход", "pre_auth": "Предавторизация", "settle": "Постраничный расчёт", "pre_auth_release": "Разморозка", "topup": "Пополнение", "refund": "Возврат", "bonus_grant": "Бонус", "bonus_expire": "Истёк" } };
129002
+ const history$2 = { "title": "История кредитов", "tabs": { "credits": "Транзакции кредитов", "payments": "Платежные заказы" }, "columns": { "time": "Время", "type": "Тип", "description": "Описание", "credits": "Кредиты" }, "payment_columns": { "time": "Время", "amount_usd": "Сумма (USD)", "credits_added": "Начислено кредитов", "status": "Статус заказа", "provider_status": "Статус провайдера" }, "types": { "consume": "Расход", "pre_auth": "Предавторизация", "settle": "Постраничный расчёт", "pre_auth_release": "Разморозка", "topup": "Пополнение", "refund": "Возврат", "bonus_grant": "Бонус", "bonus_expire": "Истёк" } };
128241
129003
  const ruAccount = {
128242
129004
  title: title$4,
128243
129005
  sign_in_hint: sign_in_hint$2,
@@ -128395,9 +129157,9 @@ const sign_out_button$1 = "خروج";
128395
129157
  const credit_balance$1 = "موجودی اعتبار";
128396
129158
  const credit_usage_hint$1 = "Lite: حدود ۱۰ اعتبار/صفحه (A4); Pro و Ultra: ۲ برابر و ۶ برابر";
128397
129159
  const monthly_free$1 = { "title": "اعتبار رایگان", "monthly_label": "ماهانه", "daily_label": "امروز", "description": "۳٬۰۰۰ اعتبار رایگان در ماه، اول هر ماه ساعت ۰۰:۰۰ بازنشانی می‌شود (UTC+0)", "daily_limit_tooltip": "سقف استفاده روزانه: {{limit}}" };
128398
- const paid_credits$1 = { "title": "اعتبار پرداختی", "description": "۱ دلار = ۱٬۵۰۰ اعتبار", "recharge": "شارژ" };
129160
+ const paid_credits$1 = { "title": "اعتبار پرداختی", "description": "۱ دلار = ۱٬۵۰۰ اعتبار", "recharge": "شارژ", "coming_soon": "قابلیت شارژ به‌زودی فعال می‌شود", "checkout_opened": "صفحه پرداخت در مرورگر باز شد. لطفاً پرداخت را تکمیل کنید.", "checkout_failed": "ایجاد نشست پرداخت ناموفق بود. لطفاً دوباره تلاش کنید.", "checkout_invalid_url": "آدرس پرداخت بازگشتی از سرور نامعتبر است.", "payment_success": "پرداخت با موفقیت انجام شد و اعتبار به‌روزرسانی شد.", "payment_cancelled": "پرداخت لغو شد.", "payment_failed": "پرداخت ناموفق بود. لطفاً بعداً دوباره تلاش کنید.", "payment_callback_received": "بازگشت پرداخت دریافت شد. در حال همگام‌سازی اعتبار.", "payment_processing": "در انتظار تایید پرداخت", "payment_result": "نتیجه پرداخت", "waiting_for_confirmation": "در حال انتظار برای تایید وضعیت پرداخت از سرور...", "cancel_waiting": "لغو", "confirm_paid": "پرداخت را انجام دادم", "close_dialog": "بستن", "reconcile_failed": "تطبیق وضعیت پرداخت ناموفق بود. لطفاً دوباره تلاش کنید.", "still_pending": "پرداخت هنوز در حالت انتظار است. این پنجره را باز نگه دارید.", "polling_failed": "دریافت وضعیت پرداخت ناموفق بود. تلاش مجدد...", "session_id_label": "شناسه نشست", "order_id_label": "شناسه سفارش", "order_status_label": "وضعیت سفارش", "provider_status_label": "وضعیت ارائه‌دهنده", "amount_label": "مبلغ", "credits_added_label": "اعتبار افزوده", "result_success": "پرداخت با موفقیت تکمیل شد.", "result_failed": "پرداخت ناموفق بود یا تکمیل نشد.", "order_status_values": { "pending": "در انتظار", "completed": "تکمیل‌شده", "failed": "ناموفق", "refunded": "بازپرداخت‌شده" }, "provider_status_values": { "pending": "در انتظار", "processing": "در حال پردازش", "completed": "تکمیل‌شده", "failed": "ناموفق", "canceled": "لغو شده", "expired": "منقضی شده", "refunded": "بازپرداخت‌شده", "unknown": "نامشخص" } };
128399
129161
  const device_flow$1 = { "browser_opened": "پنجره مرورگر برای احراز هویت باز شد", "enter_code_hint": "کد زیر را در مرورگر خود وارد کنید تا ورود تکمیل شود", "cancel": "لغو", "try_again": "تلاش مجدد", "expired": "کد احراز هویت منقضی شده است. لطفاً دوباره تلاش کنید.", "waiting": "در انتظار احراز هویت از طریق مرورگر..." };
128400
- const history$1 = { "title": "تاریخچه اعتبار", "columns": { "time": "زمان", "type": "نوع", "description": "توضیحات", "credits": "اعتبار" }, "types": { "consume": "مصرف", "pre_auth": "پیش‌مجوز", "settle": "تسویه صفحه", "pre_auth_release": "آزادسازی مسدودی", "topup": "شارژ", "refund": "بازپرداخت", "bonus_grant": "جایزه", "bonus_expire": "منقضی شده" } };
129162
+ const history$1 = { "title": "تاریخچه اعتبار", "tabs": { "credits": "تراکنش‌های اعتبار", "payments": "سفارش‌های پرداخت" }, "columns": { "time": "زمان", "type": "نوع", "description": "توضیحات", "credits": "اعتبار" }, "payment_columns": { "time": "زمان", "amount_usd": "مبلغ (USD)", "credits_added": "اعتبار افزوده", "status": "وضعیت سفارش", "provider_status": "وضعیت ارائه‌دهنده" }, "types": { "consume": "مصرف", "pre_auth": "پیش‌مجوز", "settle": "تسویه صفحه", "pre_auth_release": "آزادسازی مسدودی", "topup": "شارژ", "refund": "بازپرداخت", "bonus_grant": "جایزه", "bonus_expire": "منقضی شده" } };
128401
129163
  const faAccount = {
128402
129164
  title: title$2,
128403
129165
  sign_in_hint: sign_in_hint$1,
@@ -128555,9 +129317,9 @@ const sign_out_button = "تسجيل الخروج";
128555
129317
  const credit_balance = "رصيد الاعتمادات";
128556
129318
  const credit_usage_hint = "Lite: ١٠ اعتمادات/صفحة تقريباً (A4); Pro و Ultra: ضعف و 6 أضعاف";
128557
129319
  const monthly_free = { "title": "الاعتمادات المجانية", "monthly_label": "الشهري", "daily_label": "اليوم", "description": "٣٬٠٠٠ اعتماد مجاني شهرياً، يُعاد تعيينه في الأول من كل شهر الساعة ٠٠:٠٠ (UTC+0)", "daily_limit_tooltip": "الحد اليومي للاستخدام: {{limit}}" };
128558
- const paid_credits = { "title": "الاعتمادات المدفوعة", "description": "١ دولار = ١٬٥٠٠ اعتماد", "recharge": "إعادة الشحن" };
129320
+ const paid_credits = { "title": "الاعتمادات المدفوعة", "description": "١ دولار = ١٬٥٠٠ اعتماد", "recharge": "إعادة الشحن", "coming_soon": "ستتوفر ميزة الشحن قريباً", "checkout_opened": "تم فتح صفحة الدفع في المتصفح. يرجى إكمال الدفع هناك.", "checkout_failed": "فشل إنشاء جلسة الدفع. يرجى المحاولة مرة أخرى لاحقاً.", "checkout_invalid_url": "رابط الدفع المُعاد من الخادم غير صالح.", "payment_success": "تم الدفع بنجاح وتم تحديث الرصيد.", "payment_cancelled": "تم إلغاء الدفع.", "payment_failed": "فشل الدفع. يرجى المحاولة مرة أخرى لاحقاً.", "payment_callback_received": "تم استلام رد الدفع. جارٍ مزامنة الرصيد.", "payment_processing": "بانتظار تأكيد الدفع", "payment_result": "نتيجة الدفع", "waiting_for_confirmation": "بانتظار تأكيد حالة الدفع من الخادم...", "cancel_waiting": "إلغاء", "confirm_paid": "أكملت الدفع", "close_dialog": "إغلاق", "reconcile_failed": "فشلت مطابقة حالة الدفع. يرجى المحاولة مرة أخرى.", "still_pending": "لا يزال الدفع قيد الانتظار. أبقِ هذه النافذة مفتوحة.", "polling_failed": "تعذر الاستعلام عن حالة الدفع. تتم إعادة المحاولة...", "session_id_label": "معرّف الجلسة", "order_id_label": "معرّف الطلب", "order_status_label": "حالة الطلب", "provider_status_label": "حالة المزود", "amount_label": "المبلغ", "credits_added_label": "الاعتمادات المضافة", "result_success": "اكتمل الدفع بنجاح.", "result_failed": "فشل الدفع أو لم يكتمل.", "order_status_values": { "pending": "قيد الانتظار", "completed": "مكتمل", "failed": "فشل", "refunded": "تم الاسترداد" }, "provider_status_values": { "pending": "قيد الانتظار", "processing": "جارٍ المعالجة", "completed": "مكتمل", "failed": "فشل", "canceled": "تم الإلغاء", "expired": "منتهي الصلاحية", "refunded": "تم الاسترداد", "unknown": "غير معروف" } };
128559
129321
  const device_flow = { "browser_opened": "تم فتح نافذة المتصفح للتفويض", "enter_code_hint": "أدخل الرمز أدناه في متصفحك لإتمام تسجيل الدخول", "cancel": "إلغاء", "try_again": "إعادة المحاولة", "expired": "انتهت صلاحية رمز التفويض. يرجى المحاولة مرة أخرى.", "waiting": "في انتظار التفويض عبر المتصفح..." };
128560
- const history = { "title": "سجل الاعتمادات", "columns": { "time": "الوقت", "type": "النوع", "description": "الوصف", "credits": "الاعتمادات" }, "types": { "consume": "استهلاك", "pre_auth": "تفويض مسبق", "settle": "تسوية صفحة", "pre_auth_release": "إلغاء التجميد", "topup": "شحن", "refund": "استرداد", "bonus_grant": "مكافأة", "bonus_expire": "منتهي الصلاحية" } };
129322
+ const history = { "title": "سجل الاعتمادات", "tabs": { "credits": "سجل الاعتمادات", "payments": "طلبات الدفع" }, "columns": { "time": "الوقت", "type": "النوع", "description": "الوصف", "credits": "الاعتمادات" }, "payment_columns": { "time": "الوقت", "amount_usd": "المبلغ (USD)", "credits_added": "الاعتمادات المضافة", "status": "حالة الطلب", "provider_status": "حالة المزود" }, "types": { "consume": "استهلاك", "pre_auth": "تفويض مسبق", "settle": "تسوية صفحة", "pre_auth_release": "إلغاء التجميد", "topup": "شحن", "refund": "استرداد", "bonus_grant": "مكافأة", "bonus_expire": "منتهي الصلاحية" } };
128561
129323
  const arAccount = {
128562
129324
  title,
128563
129325
  sign_in_hint,
@@ -128944,6 +129706,94 @@ const CloudProvider = ({ children }) => {
128944
129706
  return { success: false, error: error instanceof Error ? error.message : String(error) };
128945
129707
  }
128946
129708
  }, [isAuthenticated]);
129709
+ const createCheckout = reactExports.useCallback(async (amountUsd) => {
129710
+ if (!isAuthenticated) {
129711
+ return { success: false, error: "User not signed in" };
129712
+ }
129713
+ try {
129714
+ if (!window.api?.cloud?.createCheckout) {
129715
+ return { success: false, error: "Cloud API not available" };
129716
+ }
129717
+ const result = await window.api.cloud.createCheckout({ amountUsd });
129718
+ if (result.success && result.data) {
129719
+ return {
129720
+ success: true,
129721
+ data: {
129722
+ checkoutUrl: result.data.checkout_url,
129723
+ sessionId: result.data.session_id,
129724
+ amountUsd: result.data.amount_usd,
129725
+ creditsToAdd: result.data.credits_to_add
129726
+ }
129727
+ };
129728
+ }
129729
+ return { success: false, error: result.error || "Failed to create checkout session" };
129730
+ } catch (error) {
129731
+ console.error("Failed to create checkout session:", error);
129732
+ return {
129733
+ success: false,
129734
+ error: error instanceof Error ? error.message : String(error)
129735
+ };
129736
+ }
129737
+ }, [isAuthenticated]);
129738
+ const mapCheckoutStatus = reactExports.useCallback((data) => ({
129739
+ sessionId: data.session_id,
129740
+ orderId: data.order_id,
129741
+ status: data.status,
129742
+ providerStatus: data.provider_status,
129743
+ isFinal: data.is_final,
129744
+ changed: data.changed,
129745
+ amountUsd: data.amount_usd,
129746
+ creditsAdded: data.credits_added,
129747
+ createdAt: data.created_at
129748
+ }), []);
129749
+ const getCheckoutStatus = reactExports.useCallback(async (sessionId, waitSeconds = 10) => {
129750
+ if (!isAuthenticated) {
129751
+ return { success: false, error: "User not signed in" };
129752
+ }
129753
+ try {
129754
+ if (!window.api?.cloud?.getCheckoutStatus) {
129755
+ return { success: false, error: "Cloud API not available" };
129756
+ }
129757
+ const result = await window.api.cloud.getCheckoutStatus({ sessionId, waitSeconds });
129758
+ if (!result.success || !result.data) {
129759
+ return { success: false, error: result.error || "Failed to get checkout status" };
129760
+ }
129761
+ return {
129762
+ success: true,
129763
+ data: mapCheckoutStatus(result.data)
129764
+ };
129765
+ } catch (error) {
129766
+ console.error("Failed to get checkout status:", error);
129767
+ return {
129768
+ success: false,
129769
+ error: error instanceof Error ? error.message : String(error)
129770
+ };
129771
+ }
129772
+ }, [isAuthenticated, mapCheckoutStatus]);
129773
+ const reconcileCheckout = reactExports.useCallback(async (sessionId) => {
129774
+ if (!isAuthenticated) {
129775
+ return { success: false, error: "User not signed in" };
129776
+ }
129777
+ try {
129778
+ if (!window.api?.cloud?.reconcileCheckout) {
129779
+ return { success: false, error: "Cloud API not available" };
129780
+ }
129781
+ const result = await window.api.cloud.reconcileCheckout({ sessionId });
129782
+ if (!result.success || !result.data) {
129783
+ return { success: false, error: result.error || "Failed to reconcile checkout" };
129784
+ }
129785
+ return {
129786
+ success: true,
129787
+ data: mapCheckoutStatus(result.data)
129788
+ };
129789
+ } catch (error) {
129790
+ console.error("Failed to reconcile checkout:", error);
129791
+ return {
129792
+ success: false,
129793
+ error: error instanceof Error ? error.message : String(error)
129794
+ };
129795
+ }
129796
+ }, [isAuthenticated, mapCheckoutStatus]);
128947
129797
  const getCreditHistory = reactExports.useCallback(async (page = 1, pageSize = 10, type4) => {
128948
129798
  if (!isAuthenticated) {
128949
129799
  return { success: false, error: "User not signed in" };
@@ -128985,6 +129835,42 @@ const CloudProvider = ({ children }) => {
128985
129835
  };
128986
129836
  }
128987
129837
  }, [isAuthenticated]);
129838
+ const getPaymentHistory = reactExports.useCallback(async (page = 1, pageSize = 10) => {
129839
+ if (!isAuthenticated) {
129840
+ return { success: false, error: "User not signed in" };
129841
+ }
129842
+ try {
129843
+ if (window.api?.cloud) {
129844
+ const result = await window.api.cloud.getPaymentHistory({ page, pageSize });
129845
+ if (result.success) {
129846
+ const transformedData = (result.data || []).map((item) => ({
129847
+ id: item.id,
129848
+ amountUsd: item.amount_usd,
129849
+ creditsAdded: item.credits_added,
129850
+ status: item.status,
129851
+ providerStatus: item.provider_status,
129852
+ createdAt: item.created_at
129853
+ }));
129854
+ const pagination = result.pagination ? {
129855
+ page: result.pagination.page,
129856
+ pageSize: result.pagination.page_size,
129857
+ total: result.pagination.total,
129858
+ totalPages: result.pagination.total_pages
129859
+ } : void 0;
129860
+ return { success: true, data: transformedData, pagination };
129861
+ }
129862
+ return { success: false, error: result.error };
129863
+ } else {
129864
+ return { success: false, error: "Cloud API not available" };
129865
+ }
129866
+ } catch (error) {
129867
+ console.error("Failed to fetch payment history:", error);
129868
+ return {
129869
+ success: false,
129870
+ error: error instanceof Error ? error.message : String(error)
129871
+ };
129872
+ }
129873
+ }, [isAuthenticated]);
128988
129874
  reactExports.useEffect(() => {
128989
129875
  if (isAuthenticated) {
128990
129876
  refreshCredits();
@@ -129000,6 +129886,16 @@ const CloudProvider = ({ children }) => {
129000
129886
  window.api?.cloud?.sseDisconnect?.();
129001
129887
  };
129002
129888
  }, [isAuthenticated]);
129889
+ reactExports.useEffect(() => {
129890
+ if (!window.api?.events?.onPaymentCallback) return;
129891
+ const cleanup2 = window.api.events.onPaymentCallback((event) => {
129892
+ console.log("[CloudContext] Payment callback received:", event);
129893
+ if (isAuthenticated) {
129894
+ refreshCredits();
129895
+ }
129896
+ });
129897
+ return cleanup2;
129898
+ }, [isAuthenticated, refreshCredits]);
129003
129899
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
129004
129900
  CloudContext.Provider,
129005
129901
  {
@@ -129026,7 +129922,11 @@ const CloudProvider = ({ children }) => {
129026
129922
  retryPage,
129027
129923
  getTaskResult,
129028
129924
  downloadResult,
129029
- getCreditHistory
129925
+ createCheckout,
129926
+ getCheckoutStatus,
129927
+ reconcileCheckout,
129928
+ getCreditHistory,
129929
+ getPaymentHistory
129030
129930
  },
129031
129931
  children
129032
129932
  }