pixelkiln 0.138.0 → 0.138.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -11550,24 +11550,7 @@ var RetroDiffusionProvider = class _RetroDiffusionProvider {
11550
11550
  const options = retroOptions(spec);
11551
11551
  const style = resolvedPromptStyle(spec, options);
11552
11552
  const count = options.numImages ?? 1;
11553
- const pixels = spec.width * spec.height;
11554
- let each;
11555
- if (style.startsWith("rd_advanced_animation__")) {
11556
- each = /__(?:custom_action|subtle_motion)$/.test(style) ? 0.25 : 0.14;
11557
- } else if (style.startsWith("rd_animation__")) {
11558
- each = /__(?:any_animation|8_dir_rotation)$/.test(style) ? 0.25 : 0.07;
11559
- } else if (/^rd_tile__tileset(?:_advanced)?$/.test(style)) {
11560
- each = 0.1;
11561
- } else if (style.startsWith("rd_pro__")) {
11562
- each = 0.18;
11563
- } else if (style.startsWith("rd_fast__")) {
11564
- each = Math.max(0.015, (pixels + 1e5) / 6e6);
11565
- } else if (isLowResolutionStyle(style)) {
11566
- each = Math.max(0.02, (pixels + 13700) / 6e5);
11567
- } else {
11568
- each = Math.max(0.025, (pixels + 5e4) / 2e6);
11569
- }
11570
- return { unit: "usd", amount: roundUsdEstimate(each * count), candidates: count };
11553
+ return { unit: "usd", amount: roundUsdEstimate(retroUsdPerImage(style, spec) * count), candidates: count };
11571
11554
  }
11572
11555
  validate(spec, styleImages) {
11573
11556
  const options = retroOptions(spec);
@@ -11782,6 +11765,24 @@ function validateTile(style, spec, styleImages, count, options) {
11782
11765
  }
11783
11766
  }
11784
11767
  }
11768
+ function retroUsdPerImage(style, spec) {
11769
+ if (style.startsWith("rd_advanced_animation__")) {
11770
+ return /__(?:custom_action|subtle_motion)$/.test(style) ? 0.25 : 0.14;
11771
+ }
11772
+ if (style.startsWith("rd_animation__")) {
11773
+ return /__(?:any_animation|8_dir_rotation)$/.test(style) ? 0.25 : 0.07;
11774
+ }
11775
+ if (/^rd_tile__tileset(?:_advanced)?$/.test(style)) return 0.1;
11776
+ if (style.startsWith("rd_tile__")) return 0.06;
11777
+ if (style.startsWith("rd_pro__")) return 0.18;
11778
+ if (style.startsWith("rd_core__")) return 0.1;
11779
+ if (style.startsWith("rd_plus__") || style.startsWith("rd_mini__")) return 0.06;
11780
+ if (style.startsWith("rd_lite__")) return 0.05;
11781
+ if (style.startsWith("rd_fast__") || style.endsWith(":rd_flux") || style === "item_sheet") return 0.03;
11782
+ const pixels = spec.width * spec.height;
11783
+ const formula = isLowResolutionStyle(style) ? (pixels + 13700) / 6e5 : (pixels + 5e4) / 2e6;
11784
+ return Math.max(0.06, formula);
11785
+ }
11785
11786
  function isLowResolutionStyle(style) {
11786
11787
  return /(?:^|__)(?:mc_|low_res|classic|skill_icon|topdown_item)/.test(style);
11787
11788
  }