atmn 1.0.4 → 1.1.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/cli.js CHANGED
@@ -43674,6 +43674,7 @@ async function startOAuthFlow(clientId, options) {
43674
43674
  return { html: getErrorHtml(msg), error: new Error(msg) };
43675
43675
  }
43676
43676
  }, () => {
43677
+ options?.onUrl?.(authUrl.toString());
43677
43678
  if (options?.headless) {
43678
43679
  console.log(`
43679
43680
  Visit this URL to authenticate:
@@ -43776,7 +43777,7 @@ async function request(options) {
43776
43777
  requestInit.body = JSON.stringify(body);
43777
43778
  }
43778
43779
  try {
43779
- if (process.env.ATMN_DEBUG) {
43780
+ if (process.env["ATMN_DEBUG"]) {
43780
43781
  console.log(`[DEBUG] ${method} ${url.toString()}`);
43781
43782
  }
43782
43783
  const response = await fetch(url.toString(), requestInit);
@@ -43992,6 +43993,20 @@ async function getPlanDeletionInfo(options) {
43992
43993
  secretKey
43993
43994
  });
43994
43995
  }
43996
+ async function migrateProduct(options) {
43997
+ const { secretKey, fromProductId, fromVersion, toProductId, toVersion } = options;
43998
+ await request({
43999
+ method: "POST",
44000
+ path: "/v1/migrations",
44001
+ secretKey,
44002
+ body: {
44003
+ from_product_id: fromProductId,
44004
+ from_version: fromVersion,
44005
+ to_product_id: toProductId,
44006
+ to_version: toVersion
44007
+ }
44008
+ });
44009
+ }
43995
44010
  async function getPlanHasCustomers(options) {
43996
44011
  const { secretKey, planId, plan } = options;
43997
44012
  return await request({
@@ -44160,7 +44175,7 @@ function validateCustomerLimit(customerCount, maxCustomers = 50) {
44160
44175
  }
44161
44176
  }
44162
44177
  function getMaxCustomers() {
44163
- const envValue = process.env.ATMN_NUKE_MAX_CUSTOMERS;
44178
+ const envValue = process.env["ATMN_NUKE_MAX_CUSTOMERS"];
44164
44179
  if (envValue) {
44165
44180
  const parsed = parseInt(envValue, 10);
44166
44181
  if (!Number.isNaN(parsed) && parsed > 0) {
@@ -44378,19 +44393,19 @@ async function fetchEvents(options) {
44378
44393
  } = options;
44379
44394
  const body = {};
44380
44395
  if (customerId !== undefined) {
44381
- body.customer_id = customerId;
44396
+ body["customer_id"] = customerId;
44382
44397
  }
44383
44398
  if (featureId !== undefined) {
44384
- body.feature_id = featureId;
44399
+ body["feature_id"] = featureId;
44385
44400
  }
44386
44401
  if (customRange !== undefined) {
44387
- body.custom_range = customRange;
44402
+ body["custom_range"] = customRange;
44388
44403
  }
44389
44404
  if (offset !== undefined) {
44390
- body.offset = offset;
44405
+ body["offset"] = offset;
44391
44406
  }
44392
44407
  if (limit !== undefined) {
44393
- body.limit = limit;
44408
+ body["limit"] = limit;
44394
44409
  }
44395
44410
  return request({
44396
44411
  method: "POST",
@@ -44414,16 +44429,16 @@ async function fetchEventsAggregate(options) {
44414
44429
  feature_id: featureId
44415
44430
  };
44416
44431
  if (range !== undefined) {
44417
- body.range = range;
44432
+ body["range"] = range;
44418
44433
  }
44419
44434
  if (binSize !== undefined) {
44420
- body.bin_size = binSize;
44435
+ body["bin_size"] = binSize;
44421
44436
  }
44422
44437
  if (groupBy !== undefined && groupBy !== "") {
44423
- body.group_by = groupBy;
44438
+ body["group_by"] = groupBy;
44424
44439
  }
44425
44440
  if (customRange !== undefined) {
44426
- body.custom_range = customRange;
44441
+ body["custom_range"] = customRange;
44427
44442
  }
44428
44443
  return request({
44429
44444
  method: "POST",
@@ -44438,10 +44453,10 @@ var init_events = __esm(() => {
44438
44453
 
44439
44454
  // src/lib/api/endpoints/index.ts
44440
44455
  var init_endpoints = __esm(() => {
44456
+ init_events();
44441
44457
  init_features();
44442
44458
  init_organization();
44443
44459
  init_plans();
44444
- init_events();
44445
44460
  });
44446
44461
 
44447
44462
  // src/lib/transforms/apiToSdk/Transformer.ts
@@ -44554,67 +44569,86 @@ function createTransformer(config) {
44554
44569
  }
44555
44570
 
44556
44571
  // src/lib/transforms/apiToSdk/feature.ts
44572
+ function mapCreditSchema(api) {
44573
+ return (api.credit_schema ?? []).map((cs) => ({
44574
+ meteredFeatureId: cs.metered_feature_id,
44575
+ creditCost: cs.credit_cost
44576
+ }));
44577
+ }
44557
44578
  function transformApiFeature(apiFeature) {
44558
44579
  return featureTransformer.transform(apiFeature);
44559
44580
  }
44560
- var featureTransformer;
44581
+ var BASE_COMPUTE, featureTransformer;
44561
44582
  var init_feature = __esm(() => {
44583
+ BASE_COMPUTE = {
44584
+ eventNames: (api) => api.event_names && api.event_names.length > 0 ? api.event_names : undefined
44585
+ };
44562
44586
  featureTransformer = createTransformer({
44563
44587
  discriminator: "type",
44564
44588
  cases: {
44565
44589
  boolean: {
44566
- copy: ["id", "name", "event_names", "credit_schema", "archived"],
44590
+ copy: ["id", "name", "archived"],
44567
44591
  compute: {
44592
+ ...BASE_COMPUTE,
44568
44593
  type: () => "boolean"
44569
44594
  }
44570
44595
  },
44571
44596
  credit_system: {
44572
- copy: ["id", "name", "event_names", "credit_schema", "archived"],
44597
+ copy: ["id", "name", "archived"],
44573
44598
  compute: {
44599
+ ...BASE_COMPUTE,
44574
44600
  type: () => "credit_system",
44575
44601
  consumable: () => true,
44576
- credit_schema: (api) => api.credit_schema || []
44602
+ creditSchema: mapCreditSchema
44577
44603
  }
44578
44604
  },
44579
44605
  single_use: {
44580
- copy: ["id", "name", "event_names", "credit_schema", "archived"],
44606
+ copy: ["id", "name", "archived"],
44581
44607
  compute: {
44608
+ ...BASE_COMPUTE,
44582
44609
  type: () => "metered",
44583
44610
  consumable: () => true
44584
44611
  }
44585
44612
  },
44586
44613
  continuous_use: {
44587
- copy: ["id", "name", "event_names", "credit_schema", "archived"],
44614
+ copy: ["id", "name", "archived"],
44588
44615
  compute: {
44616
+ ...BASE_COMPUTE,
44589
44617
  type: () => "metered",
44590
44618
  consumable: () => false
44591
44619
  }
44592
44620
  },
44593
44621
  metered: {
44594
- copy: ["id", "name", "event_names", "credit_schema", "archived"],
44622
+ copy: ["id", "name", "archived"],
44595
44623
  compute: {
44624
+ ...BASE_COMPUTE,
44596
44625
  type: () => "metered",
44597
44626
  consumable: (api) => api.consumable ?? true
44598
44627
  }
44599
44628
  }
44600
44629
  },
44601
44630
  default: {
44602
- copy: ["id", "name", "event_names", "credit_schema", "archived"],
44631
+ copy: ["id", "name", "archived"],
44603
44632
  compute: {
44633
+ ...BASE_COMPUTE,
44604
44634
  type: () => "metered",
44605
44635
  consumable: () => true
44606
44636
  }
44607
44637
  }
44608
44638
  });
44609
44639
  });
44610
- // src/lib/transforms/apiToSdk/planFeature.ts
44611
- function transformApiPlanFeature(apiPlanFeature) {
44612
- return planFeatureTransformer.transform(apiPlanFeature);
44640
+ // src/lib/transforms/apiToSdk/planItem.ts
44641
+ function transformApiPlanItem(apiPlanItem) {
44642
+ return planItemTransformer.transform(apiPlanItem);
44613
44643
  }
44614
- var planFeatureTransformer;
44615
- var init_planFeature = __esm(() => {
44616
- planFeatureTransformer = createTransformer({
44617
- copy: ["feature_id", "unlimited", "proration"],
44644
+ var planItemTransformer;
44645
+ var init_planItem = __esm(() => {
44646
+ planItemTransformer = createTransformer({
44647
+ rename: {
44648
+ feature_id: "featureId",
44649
+ entity_feature_id: "entityFeatureId"
44650
+ },
44651
+ copy: ["unlimited"],
44618
44652
  swapFalse: ["unlimited"],
44619
44653
  compute: {
44620
44654
  included: (api) => api.unlimited ? undefined : api.included,
@@ -44625,7 +44659,9 @@ var init_planFeature = __esm(() => {
44625
44659
  if (api.reset) {
44626
44660
  return {
44627
44661
  interval: api.reset.interval,
44628
- interval_count: api.reset.interval_count
44662
+ ...api.reset.interval_count !== undefined && {
44663
+ intervalCount: api.reset.interval_count
44664
+ }
44629
44665
  };
44630
44666
  }
44631
44667
  return;
@@ -44635,17 +44671,34 @@ var init_planFeature = __esm(() => {
44635
44671
  return;
44636
44672
  return {
44637
44673
  amount: api.price.amount,
44638
- tiers: api.price.tiers,
44639
- billing_units: api.price.billing_units,
44640
- max_purchase: api.price.max_purchase ?? undefined,
44641
- billing_method: api.price.billing_method,
44674
+ tiers: api.price.tiers?.map((tier) => {
44675
+ const t = tier;
44676
+ return {
44677
+ to: t.to,
44678
+ amount: t.amount,
44679
+ ...t.flat_amount !== undefined && { flatAmount: t.flat_amount }
44680
+ };
44681
+ }),
44682
+ billingUnits: api.price.billing_units,
44683
+ maxPurchase: api.price.max_purchase ?? undefined,
44684
+ billingMethod: api.price.billing_method,
44685
+ tierBehavior: api.price.tier_behavior,
44642
44686
  interval: api.price.interval,
44643
- interval_count: api.price.interval_count
44687
+ ...api.price.interval_count !== undefined && {
44688
+ intervalCount: api.price.interval_count
44689
+ }
44644
44690
  };
44645
44691
  },
44692
+ proration: (api) => api.proration ? {
44693
+ onIncrease: api.proration.on_increase,
44694
+ onDecrease: api.proration.on_decrease
44695
+ } : undefined,
44646
44696
  rollover: (api) => api.rollover ? {
44647
- ...api.rollover,
44648
- max: api.rollover.max ?? 0
44697
+ max: api.rollover.max ?? 0,
44698
+ expiryDurationType: api.rollover.expiry_duration_type,
44699
+ ...api.rollover.expiry_duration_length !== undefined && {
44700
+ expiryDurationLength: api.rollover.expiry_duration_length
44701
+ }
44649
44702
  } : undefined
44650
44703
  }
44651
44704
  });
@@ -44657,9 +44710,13 @@ function transformApiPlan(apiPlan) {
44657
44710
  }
44658
44711
  var planTransformer;
44659
44712
  var init_plan = __esm(() => {
44660
- init_planFeature();
44713
+ init_planItem();
44661
44714
  planTransformer = createTransformer({
44662
- copy: ["id", "name", "description", "group", "add_on", "auto_enable", "free_trial"],
44715
+ copy: ["id", "name", "description", "group"],
44716
+ rename: {
44717
+ add_on: "addOn",
44718
+ auto_enable: "autoEnable"
44719
+ },
44663
44720
  swapNullish: ["group"],
44664
44721
  swapFalse: ["auto_enable", "add_on"],
44665
44722
  compute: {
@@ -44667,7 +44724,12 @@ var init_plan = __esm(() => {
44667
44724
  amount: api.price.amount,
44668
44725
  interval: api.price.interval
44669
44726
  } : undefined,
44670
- items: (api) => api.items && api.items.length > 0 ? api.items.map(transformApiPlanFeature) : undefined
44727
+ items: (api) => api.items && api.items.length > 0 ? api.items.map(transformApiPlanItem) : undefined,
44728
+ freeTrial: (api) => api.free_trial ? {
44729
+ durationLength: api.free_trial.duration_length,
44730
+ durationType: api.free_trial.duration_type,
44731
+ cardRequired: api.free_trial.card_required
44732
+ } : undefined
44671
44733
  }
44672
44734
  });
44673
44735
  });
@@ -44676,7 +44738,7 @@ var init_plan = __esm(() => {
44676
44738
  var init_apiToSdk = __esm(() => {
44677
44739
  init_feature();
44678
44740
  init_plan();
44679
- init_planFeature();
44741
+ init_planItem();
44680
44742
  });
44681
44743
 
44682
44744
  // src/lib/transforms/inPlaceUpdate/parseConfig.ts
@@ -44685,11 +44747,11 @@ function extractId(lines) {
44685
44747
  const joined = lines.join(`
44686
44748
  `);
44687
44749
  const match = joined.match(/id:\s*['"]([^'"]+)['"]/);
44688
- return match ? match[1] : null;
44750
+ return match ? match[1] ?? null : null;
44689
44751
  }
44690
44752
  function extractVarName(line) {
44691
44753
  const match = line.match(/export\s+const\s+(\w+)\s*=/);
44692
- return match ? match[1] : null;
44754
+ return match ? match[1] ?? null : null;
44693
44755
  }
44694
44756
  function determineEntityType(lines) {
44695
44757
  const joined = lines.join(`
@@ -44888,14 +44950,14 @@ function buildFeatureCode(feature) {
44888
44950
  if (feature.type === "metered") {
44889
44951
  lines.push(` consumable: ${feature.consumable},`);
44890
44952
  }
44891
- if (feature.event_names && feature.event_names.length > 0) {
44892
- lines.push(` event_names: ${formatValue(feature.event_names)},`);
44953
+ if (feature.eventNames && feature.eventNames.length > 0) {
44954
+ lines.push(` eventNames: ${formatValue(feature.eventNames)},`);
44893
44955
  }
44894
44956
  if (feature.archived) {
44895
44957
  lines.push(` archived: true,`);
44896
44958
  }
44897
- if (feature.type === "credit_system" && feature.credit_schema) {
44898
- lines.push(` credit_schema: ${formatValue(feature.credit_schema)},`);
44959
+ if (feature.type === "credit_system" && feature.creditSchema) {
44960
+ lines.push(` creditSchema: ${formatValue(feature.creditSchema)},`);
44899
44961
  }
44900
44962
  lines.push(`});`);
44901
44963
  return lines.join(`
@@ -44905,70 +44967,74 @@ var init_feature2 = () => {};
44905
44967
 
44906
44968
  // src/lib/transforms/sdkToCode/imports.ts
44907
44969
  function buildImports() {
44908
- return `import { feature, plan, planFeature } from 'atmn';`;
44970
+ return `import { feature, item, plan } from 'atmn';`;
44909
44971
  }
44910
44972
 
44911
- // src/lib/transforms/sdkToCode/planFeature.ts
44912
- function buildPlanFeatureCode(planFeature, _features, featureVarMap) {
44913
- const featureVarName = featureVarMap?.get(planFeature.feature_id);
44914
- const featureIdCode = featureVarName ? `${featureVarName}.id` : `'${planFeature.feature_id}'`;
44973
+ // src/lib/transforms/sdkToCode/planItem.ts
44974
+ function buildPlanItemCode(planItem, _features, featureVarMap) {
44975
+ const featureVarName = featureVarMap?.get(planItem.featureId);
44976
+ const featureIdCode = featureVarName ? `${featureVarName}.id` : `'${planItem.featureId}'`;
44915
44977
  const lines = [];
44916
- lines.push(` planFeature({`);
44917
- lines.push(` feature_id: ${featureIdCode},`);
44918
- if (planFeature.included !== undefined) {
44919
- lines.push(` included: ${planFeature.included},`);
44978
+ lines.push(` item({`);
44979
+ lines.push(` featureId: ${featureIdCode},`);
44980
+ if (planItem.included !== undefined) {
44981
+ lines.push(` included: ${planItem.included},`);
44920
44982
  }
44921
- if (planFeature.unlimited === true) {
44983
+ if (planItem.unlimited === true) {
44922
44984
  lines.push(` unlimited: true,`);
44923
44985
  }
44924
- if (planFeature.reset) {
44986
+ if (planItem.reset) {
44925
44987
  lines.push(` reset: {`);
44926
- if (planFeature.reset.interval) {
44927
- lines.push(` interval: '${planFeature.reset.interval}',`);
44988
+ if (planItem.reset.interval) {
44989
+ lines.push(` interval: '${planItem.reset.interval}',`);
44928
44990
  }
44929
- if (planFeature.reset.interval_count !== undefined) {
44930
- lines.push(` interval_count: ${planFeature.reset.interval_count},`);
44991
+ if (planItem.reset.intervalCount !== undefined) {
44992
+ lines.push(` intervalCount: ${planItem.reset.intervalCount},`);
44931
44993
  }
44932
44994
  lines.push(` },`);
44933
44995
  }
44934
- if (planFeature.price) {
44996
+ if (planItem.price) {
44935
44997
  lines.push(` price: {`);
44936
- if (planFeature.price.amount !== undefined) {
44937
- lines.push(` amount: ${planFeature.price.amount},`);
44998
+ if (planItem.price.amount !== undefined) {
44999
+ lines.push(` amount: ${planItem.price.amount},`);
44938
45000
  }
44939
- if (planFeature.price.tiers) {
44940
- const tiersCode = formatValue(planFeature.price.tiers);
45001
+ if (planItem.price.tiers) {
45002
+ const tiersCode = formatValue(planItem.price.tiers);
44941
45003
  lines.push(` tiers: ${tiersCode},`);
44942
45004
  }
44943
- if (planFeature.price.billing_units !== undefined) {
44944
- lines.push(` billing_units: ${planFeature.price.billing_units},`);
45005
+ const priceWithBilling = planItem.price;
45006
+ if (priceWithBilling.billingUnits !== undefined) {
45007
+ lines.push(` billingUnits: ${priceWithBilling.billingUnits},`);
45008
+ }
45009
+ if (priceWithBilling.billingMethod) {
45010
+ lines.push(` billingMethod: '${priceWithBilling.billingMethod}',`);
44945
45011
  }
44946
- if (planFeature.price.billing_method) {
44947
- lines.push(` billing_method: '${planFeature.price.billing_method}',`);
45012
+ if (priceWithBilling.maxPurchase !== undefined) {
45013
+ lines.push(` maxPurchase: ${priceWithBilling.maxPurchase},`);
44948
45014
  }
44949
- if (planFeature.price.max_purchase !== undefined) {
44950
- lines.push(` max_purchase: ${planFeature.price.max_purchase},`);
45015
+ if (priceWithBilling.tierBehavior !== undefined) {
45016
+ lines.push(` tierBehavior: '${priceWithBilling.tierBehavior}',`);
44951
45017
  }
44952
- const priceWithInterval = planFeature.price;
45018
+ const priceWithInterval = planItem.price;
44953
45019
  if (priceWithInterval.interval) {
44954
45020
  lines.push(` interval: '${priceWithInterval.interval}',`);
44955
45021
  }
44956
- if (priceWithInterval.interval_count !== undefined) {
44957
- lines.push(` interval_count: ${priceWithInterval.interval_count},`);
45022
+ if (priceWithInterval.intervalCount !== undefined) {
45023
+ lines.push(` intervalCount: ${priceWithInterval.intervalCount},`);
44958
45024
  }
44959
45025
  lines.push(` },`);
44960
45026
  }
44961
- if (planFeature.proration) {
44962
- lines.push(` proration: ${formatValue(planFeature.proration)},`);
45027
+ if (planItem.proration) {
45028
+ lines.push(` proration: ${formatValue(planItem.proration)},`);
44963
45029
  }
44964
- if (planFeature.rollover) {
44965
- lines.push(` rollover: ${formatValue(planFeature.rollover)},`);
45030
+ if (planItem.rollover) {
45031
+ lines.push(` rollover: ${formatValue(planItem.rollover)},`);
44966
45032
  }
44967
45033
  lines.push(` }),`);
44968
45034
  return lines.join(`
44969
45035
  `);
44970
45036
  }
44971
- var init_planFeature2 = () => {};
45037
+ var init_planItem2 = () => {};
44972
45038
 
44973
45039
  // src/lib/transforms/sdkToCode/plan.ts
44974
45040
  function buildPlanCode(plan, features, featureVarMap) {
@@ -44983,11 +45049,11 @@ function buildPlanCode(plan, features, featureVarMap) {
44983
45049
  if (plan.group !== undefined && plan.group !== null && plan.group !== "") {
44984
45050
  lines.push(` group: '${plan.group}',`);
44985
45051
  }
44986
- if (plan.add_on !== undefined) {
44987
- lines.push(` add_on: ${plan.add_on},`);
45052
+ if (plan.addOn !== undefined) {
45053
+ lines.push(` addOn: ${plan.addOn},`);
44988
45054
  }
44989
- if (plan.auto_enable !== undefined) {
44990
- lines.push(` auto_enable: ${plan.auto_enable},`);
45055
+ if (plan.autoEnable !== undefined) {
45056
+ lines.push(` autoEnable: ${plan.autoEnable},`);
44991
45057
  }
44992
45058
  if (plan.price) {
44993
45059
  lines.push(` price: {`);
@@ -44997,21 +45063,21 @@ function buildPlanCode(plan, features, featureVarMap) {
44997
45063
  }
44998
45064
  lines.push(` items: [`);
44999
45065
  if (plan.items && plan.items.length > 0) {
45000
- for (const planFeature of plan.items) {
45001
- const featureCode = buildPlanFeatureCode(planFeature, features, featureVarMap);
45002
- lines.push(featureCode);
45066
+ for (const planItem of plan.items) {
45067
+ const itemCode = buildPlanItemCode(planItem, features, featureVarMap);
45068
+ lines.push(itemCode);
45003
45069
  }
45004
45070
  }
45005
45071
  lines.push(` ],`);
45006
- if (plan.free_trial) {
45007
- lines.push(` free_trial: ${formatValue(plan.free_trial)},`);
45072
+ if (plan.freeTrial) {
45073
+ lines.push(` freeTrial: ${formatValue(plan.freeTrial)},`);
45008
45074
  }
45009
45075
  lines.push(`});`);
45010
45076
  return lines.join(`
45011
45077
  `);
45012
45078
  }
45013
45079
  var init_plan2 = __esm(() => {
45014
- init_planFeature2();
45080
+ init_planItem2();
45015
45081
  });
45016
45082
 
45017
45083
  // src/lib/transforms/inPlaceUpdate/updateConfig.ts
@@ -45148,12 +45214,19 @@ async function updateConfigInPlace(features, plans, cwd2 = process.cwd()) {
45148
45214
  `);
45149
45215
  if (lastFeatureBlockIndex >= 0) {
45150
45216
  outputBlocks.splice(lastFeatureBlockIndex + 1, 0, newFeatureCode);
45151
- lastPlanBlockIndex++;
45217
+ lastFeatureBlockIndex++;
45218
+ if (lastPlanBlockIndex >= 0) {
45219
+ lastPlanBlockIndex++;
45220
+ }
45152
45221
  } else if (sawFeaturesComment) {
45153
45222
  for (let i = 0;i < outputBlocks.length; i++) {
45154
- if (outputBlocks[i].toLowerCase().includes("feature") && (outputBlocks[i].trim().startsWith("//") || outputBlocks[i].trim().startsWith("/*"))) {
45223
+ const blk = outputBlocks[i];
45224
+ if (blk.toLowerCase().includes("feature") && (blk.trim().startsWith("//") || blk.trim().startsWith("/*"))) {
45155
45225
  outputBlocks.splice(i + 1, 0, newFeatureCode);
45156
- lastPlanBlockIndex++;
45226
+ lastFeatureBlockIndex = i + 1;
45227
+ if (lastPlanBlockIndex >= 0) {
45228
+ lastPlanBlockIndex++;
45229
+ }
45157
45230
  break;
45158
45231
  }
45159
45232
  }
@@ -45167,7 +45240,10 @@ async function updateConfigInPlace(features, plans, cwd2 = process.cwd()) {
45167
45240
  outputBlocks.splice(insertIdx, 0, `
45168
45241
  // Features
45169
45242
  ${newFeatureCode}`);
45170
- lastPlanBlockIndex++;
45243
+ lastFeatureBlockIndex = insertIdx;
45244
+ if (lastPlanBlockIndex >= 0) {
45245
+ lastPlanBlockIndex++;
45246
+ }
45171
45247
  }
45172
45248
  result.featuresAdded = newFeatures.length;
45173
45249
  }
@@ -45180,11 +45256,16 @@ ${newFeatureCode}`);
45180
45256
  outputBlocks.splice(lastPlanBlockIndex + 1, 0, newPlanCode);
45181
45257
  } else if (sawPlansComment) {
45182
45258
  for (let i = 0;i < outputBlocks.length; i++) {
45183
- if (outputBlocks[i].toLowerCase().includes("plan") && (outputBlocks[i].trim().startsWith("//") || outputBlocks[i].trim().startsWith("/*"))) {
45259
+ const blk = outputBlocks[i];
45260
+ if (blk.toLowerCase().includes("plan") && (blk.trim().startsWith("//") || blk.trim().startsWith("/*"))) {
45184
45261
  outputBlocks.splice(i + 1, 0, newPlanCode);
45185
45262
  break;
45186
45263
  }
45187
45264
  }
45265
+ } else if (lastFeatureBlockIndex >= 0) {
45266
+ outputBlocks.splice(lastFeatureBlockIndex + 1, 0, `
45267
+ // Plans
45268
+ ${newPlanCode}`);
45188
45269
  } else {
45189
45270
  outputBlocks.push(`
45190
45271
  // Plans
@@ -45255,7 +45336,7 @@ var init_sdkToCode = __esm(() => {
45255
45336
  init_configFile();
45256
45337
  init_feature2();
45257
45338
  init_plan2();
45258
- init_planFeature2();
45339
+ init_planItem2();
45259
45340
  });
45260
45341
 
45261
45342
  // src/lib/transforms/index.ts
@@ -45438,7 +45519,7 @@ var init_pull = __esm(() => {
45438
45519
  });
45439
45520
 
45440
45521
  // src/lib/version.ts
45441
- var APP_VERSION = "1.0.4";
45522
+ var APP_VERSION = "1.1.1";
45442
45523
 
45443
45524
  // ../node_modules/.pnpm/@tanstack+query-core@5.90.17/node_modules/@tanstack/query-core/build/modern/subscribable.js
45444
45525
  var Subscribable = class {
@@ -48665,6 +48746,7 @@ function Card({ title, children }) {
48665
48746
  cardWidth.registerWidth(id, contentWidth);
48666
48747
  return () => cardWidth.unregisterWidth(id);
48667
48748
  }
48749
+ return;
48668
48750
  }, [id, contentWidth, cardWidth]);
48669
48751
  const width = cardWidth?.width ?? Math.max(DEFAULT_WIDTH, contentWidth);
48670
48752
  return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
@@ -50550,7 +50632,8 @@ function QueryProvider({ children }) {
50550
50632
  return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(QueryClientProvider, {
50551
50633
  client: queryClient,
50552
50634
  children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(AuthRecoveryBoundary, {
50553
- onRetry: handleRetry
50635
+ onRetry: handleRetry,
50636
+ children: null
50554
50637
  }, undefined, false, undefined, this)
50555
50638
  }, undefined, false, undefined, this);
50556
50639
  }
@@ -60196,7 +60279,7 @@ This creates: $10/month base price that includes 1 unit, then $10 per additional
60196
60279
  ## Example Configuration
60197
60280
 
60198
60281
  \`\`\`typescript
60199
- import { feature, plan, planFeature } from "atmn";
60282
+ import { feature, plan, item } from "atmn";
60200
60283
 
60201
60284
  // Features
60202
60285
  export const messages = feature({
@@ -60217,10 +60300,10 @@ export const seats = feature({
60217
60300
  export const free = plan({
60218
60301
  id: "free",
60219
60302
  name: "Free",
60220
- auto_enable: true,
60303
+ autoEnable: true,
60221
60304
  items: [
60222
- planFeature({ feature_id: messages.id, included: 100 }),
60223
- planFeature({ feature_id: seats.id, included: 1 }),
60305
+ item({ featureId: messages.id, included: 100 }),
60306
+ item({ featureId: seats.id, included: 1 }),
60224
60307
  ],
60225
60308
  });
60226
60309
 
@@ -60232,23 +60315,23 @@ export const pro = plan({
60232
60315
  interval: "month",
60233
60316
  },
60234
60317
  items: [
60235
- planFeature({
60236
- feature_id: seats.id,
60318
+ item({
60319
+ featureId: seats.id,
60237
60320
  included: 5,
60238
60321
  price: {
60239
60322
  amount: 10,
60240
60323
  interval: "month",
60241
- billing_method: "usage_based",
60324
+ billingMethod: "usage_based",
60242
60325
  },
60243
60326
  }),
60244
- planFeature({
60245
- feature_id: messages.id,
60327
+ item({
60328
+ featureId: messages.id,
60246
60329
  included: 10_000,
60247
- entity_feature_id: seats.id,
60330
+ entityFeatureId: seats.id,
60248
60331
  price: {
60249
60332
  amount: 0.01,
60250
60333
  interval: "month",
60251
- billing_method: "usage_based",
60334
+ billingMethod: "usage_based",
60252
60335
  },
60253
60336
  }),
60254
60337
  ],
@@ -61120,7 +61203,7 @@ function useEventsFilter(featuresCount) {
61120
61203
  const presets = ["24h", "7d", "30d", "90d", "all"];
61121
61204
  setDraftFilters((prev) => ({
61122
61205
  ...prev,
61123
- timeRange: presets[activeIndex]
61206
+ timeRange: presets[activeIndex] ?? "24h"
61124
61207
  }));
61125
61208
  return;
61126
61209
  }
@@ -61656,7 +61739,8 @@ function createProdConfirmationPrompt() {
61656
61739
  ]
61657
61740
  };
61658
61741
  }
61659
- function createPlanVersioningPrompt(info) {
61742
+ function createPlanVersioningPrompt(info, env5) {
61743
+ const isSandbox = !env5 || env5 === "sandbox" /* Sandbox */;
61660
61744
  return {
61661
61745
  id: generatePromptId(),
61662
61746
  type: "plan_versioning",
@@ -61667,10 +61751,17 @@ function createPlanVersioningPrompt(info) {
61667
61751
  planName: info.plan.name
61668
61752
  },
61669
61753
  options: [
61754
+ ...isSandbox ? [
61755
+ {
61756
+ label: "Yes, migrate existing customers and create a new version",
61757
+ value: "version_and_migrate",
61758
+ isDefault: true
61759
+ }
61760
+ ] : [],
61670
61761
  {
61671
- label: "Yes, create new version",
61762
+ label: "Yes, but create a new version only",
61672
61763
  value: "version",
61673
- isDefault: true
61764
+ isDefault: !isSandbox
61674
61765
  },
61675
61766
  { label: "No, skip this plan", value: "skip", isDefault: false }
61676
61767
  ]
@@ -61815,59 +61906,101 @@ function createPlanDeletePrompt(info) {
61815
61906
  return createPlanDeleteNoCustomersPrompt(info);
61816
61907
  }
61817
61908
  var promptCounter = 0;
61909
+ var init_prompts = __esm(() => {
61910
+ init_env();
61911
+ });
61912
+
61913
+ // src/lib/transforms/sdkToApi/feature.ts
61914
+ function transformFeatureToApi(feature) {
61915
+ const base3 = {
61916
+ id: feature.id,
61917
+ name: feature.name,
61918
+ type: feature.type
61919
+ };
61920
+ if (feature.archived !== undefined) {
61921
+ base3.archived = feature.archived;
61922
+ }
61923
+ if (feature.eventNames !== undefined) {
61924
+ base3.event_names = feature.eventNames;
61925
+ }
61926
+ if (feature.type === "metered") {
61927
+ base3.consumable = feature.consumable;
61928
+ }
61929
+ if (feature.type === "credit_system" && feature.creditSchema) {
61930
+ base3.credit_schema = feature.creditSchema.map((entry) => ({
61931
+ metered_feature_id: entry.meteredFeatureId,
61932
+ credit_cost: entry.creditCost
61933
+ }));
61934
+ }
61935
+ return base3;
61936
+ }
61818
61937
 
61819
61938
  // src/lib/transforms/sdkToApi/plan.ts
61820
- function transformPlanFeature(feature) {
61939
+ function transformPlanItem(planItem) {
61821
61940
  const result = {
61822
- feature_id: feature.feature_id
61941
+ feature_id: planItem.featureId
61823
61942
  };
61824
- if (feature.included !== undefined) {
61825
- result.included = feature.included;
61943
+ if (planItem.included !== undefined) {
61944
+ result.included = planItem.included;
61826
61945
  }
61827
- if (feature.unlimited !== undefined) {
61828
- result.unlimited = feature.unlimited;
61946
+ if (planItem.unlimited !== undefined) {
61947
+ result.unlimited = planItem.unlimited;
61829
61948
  }
61830
- if (feature.reset) {
61949
+ if (planItem.reset) {
61831
61950
  result.reset = {
61832
- interval: feature.reset.interval,
61833
- ...feature.reset.interval_count !== undefined && {
61834
- interval_count: feature.reset.interval_count
61951
+ interval: planItem.reset.interval,
61952
+ ...planItem.reset.intervalCount !== undefined && {
61953
+ interval_count: planItem.reset.intervalCount
61835
61954
  }
61836
61955
  };
61837
61956
  }
61838
- if (feature.price) {
61839
- const priceInterval = feature.price.interval;
61840
- const priceIntervalCount = feature.price.interval_count;
61841
- const interval = priceInterval ?? feature.reset?.interval;
61842
- const intervalCount = priceIntervalCount ?? feature.reset?.interval_count;
61957
+ if (planItem.price) {
61958
+ const priceWithInterval = planItem.price;
61959
+ const priceInterval = priceWithInterval.interval;
61960
+ const priceIntervalCount = priceWithInterval.intervalCount;
61961
+ const interval = priceInterval ?? planItem.reset?.interval;
61962
+ const intervalCount = priceIntervalCount ?? planItem.reset?.intervalCount;
61963
+ const priceWithBilling = planItem.price;
61843
61964
  result.price = {
61844
61965
  interval,
61845
- billing_units: feature.price.billing_units ?? 1,
61846
- billing_method: feature.price.billing_method ?? "prepaid",
61847
- ...feature.price.amount !== undefined && {
61848
- amount: feature.price.amount
61966
+ billing_units: priceWithBilling.billingUnits ?? 1,
61967
+ billing_method: priceWithBilling.billingMethod ?? "prepaid",
61968
+ ...planItem.price.amount !== undefined && {
61969
+ amount: planItem.price.amount
61970
+ },
61971
+ ...planItem.price.tiers && {
61972
+ tiers: planItem.price.tiers.map((tier) => {
61973
+ const t = tier;
61974
+ return {
61975
+ to: t.to,
61976
+ amount: t.amount,
61977
+ ...t.flatAmount !== undefined && { flat_amount: t.flatAmount }
61978
+ };
61979
+ })
61849
61980
  },
61850
- ...feature.price.tiers && { tiers: feature.price.tiers },
61851
61981
  ...intervalCount !== undefined && {
61852
61982
  interval_count: intervalCount
61853
61983
  },
61854
- ...feature.price.max_purchase !== undefined && {
61855
- max_purchase: feature.price.max_purchase
61984
+ ...priceWithBilling.maxPurchase !== undefined && {
61985
+ max_purchase: priceWithBilling.maxPurchase
61986
+ },
61987
+ ...priceWithBilling.tierBehavior !== undefined && {
61988
+ tier_behavior: priceWithBilling.tierBehavior
61856
61989
  }
61857
61990
  };
61858
61991
  }
61859
- if (feature.proration) {
61992
+ if (planItem.proration) {
61860
61993
  result.proration = {
61861
- on_increase: feature.proration.on_increase,
61862
- on_decrease: feature.proration.on_decrease
61994
+ on_increase: planItem.proration.onIncrease,
61995
+ on_decrease: planItem.proration.onDecrease
61863
61996
  };
61864
61997
  }
61865
- if (feature.rollover) {
61998
+ if (planItem.rollover) {
61866
61999
  result.rollover = {
61867
- max: feature.rollover.max ?? 0,
61868
- expiry_duration_type: feature.rollover.expiry_duration_type,
61869
- ...feature.rollover.expiry_duration_length !== undefined && {
61870
- expiry_duration_length: feature.rollover.expiry_duration_length
62000
+ max: planItem.rollover.max ?? 0,
62001
+ expiry_duration_type: planItem.rollover.expiryDurationType,
62002
+ ...planItem.rollover.expiryDurationLength !== undefined && {
62003
+ expiry_duration_length: planItem.rollover.expiryDurationLength
61871
62004
  }
61872
62005
  };
61873
62006
  }
@@ -61884,11 +62017,11 @@ function transformPlanToApi(plan) {
61884
62017
  if (plan.group !== undefined) {
61885
62018
  result.group = plan.group;
61886
62019
  }
61887
- if (plan.add_on !== undefined) {
61888
- result.add_on = plan.add_on;
62020
+ if (plan.addOn !== undefined) {
62021
+ result.add_on = plan.addOn;
61889
62022
  }
61890
- if (plan.auto_enable !== undefined) {
61891
- result.auto_enable = plan.auto_enable;
62023
+ if (plan.autoEnable !== undefined) {
62024
+ result.auto_enable = plan.autoEnable;
61892
62025
  }
61893
62026
  if (plan.price) {
61894
62027
  result.price = {
@@ -61897,13 +62030,13 @@ function transformPlanToApi(plan) {
61897
62030
  };
61898
62031
  }
61899
62032
  if (plan.items && plan.items.length > 0) {
61900
- result.items = plan.items.map(transformPlanFeature);
62033
+ result.items = plan.items.map(transformPlanItem);
61901
62034
  }
61902
- if (plan.free_trial) {
62035
+ if (plan.freeTrial) {
61903
62036
  result.free_trial = {
61904
- duration_type: plan.free_trial.duration_type,
61905
- duration_length: plan.free_trial.duration_length,
61906
- card_required: plan.free_trial.card_required
62037
+ duration_type: plan.freeTrial.durationType,
62038
+ duration_length: plan.freeTrial.durationLength,
62039
+ card_required: plan.freeTrial.cardRequired
61907
62040
  };
61908
62041
  }
61909
62042
  return result;
@@ -61932,7 +62065,7 @@ async function checkFeatureDeleteInfo(featureId, localFeatures, remoteFeatures)
61932
62065
  const secretKey = getSecretKey();
61933
62066
  const remoteFeature = remoteFeatures.find((f) => f.id === featureId);
61934
62067
  const featureType = remoteFeature?.type;
61935
- const referencingCreditSystems = localFeatures.filter((f) => f.type === "credit_system" && f.credit_schema?.some((cs) => cs.metered_feature_id === featureId));
62068
+ const referencingCreditSystems = localFeatures.filter((f) => f.type === "credit_system" && f.creditSchema?.some((cs) => cs.meteredFeatureId === featureId));
61936
62069
  if (referencingCreditSystems.length >= 1) {
61937
62070
  return {
61938
62071
  id: featureId,
@@ -61989,7 +62122,7 @@ async function checkPlanForVersioning(plan, remotePlans, localFeatureIds, remote
61989
62122
  isArchived: false
61990
62123
  };
61991
62124
  }
61992
- const missingFeatureIds = (plan.items || []).map((item) => item.feature_id).filter((featureId) => !remoteFeatureIds.has(featureId));
62125
+ const missingFeatureIds = (plan.items || []).map((item) => item.featureId).filter((featureId) => !remoteFeatureIds.has(featureId));
61993
62126
  const missingLocalFeatureIds = missingFeatureIds.filter((featureId) => localFeatureIds.has(featureId));
61994
62127
  const missingUnknownFeatureIds = missingFeatureIds.filter((featureId) => !localFeatureIds.has(featureId));
61995
62128
  if (missingLocalFeatureIds.length > 0) {
@@ -62091,13 +62224,13 @@ function normalizeFeatureForCompare(f) {
62091
62224
  if (f.type === "metered" && "consumable" in f) {
62092
62225
  result.consumable = f.consumable;
62093
62226
  }
62094
- if (f.event_names && f.event_names.length > 0) {
62095
- result.event_names = [...f.event_names].sort();
62227
+ if (f.eventNames && f.eventNames.length > 0) {
62228
+ result.eventNames = [...f.eventNames].sort();
62096
62229
  }
62097
- if (f.credit_schema && f.credit_schema.length > 0) {
62098
- result.credit_schema = [...f.credit_schema].sort((a2, b) => a2.metered_feature_id.localeCompare(b.metered_feature_id)).map((cs) => ({
62099
- metered_feature_id: cs.metered_feature_id,
62100
- credit_cost: cs.credit_cost
62230
+ if (f.creditSchema && f.creditSchema.length > 0) {
62231
+ result.creditSchema = [...f.creditSchema].sort((a2, b) => a2.meteredFeatureId.localeCompare(b.meteredFeatureId)).map((cs) => ({
62232
+ meteredFeatureId: cs.meteredFeatureId,
62233
+ creditCost: cs.creditCost
62101
62234
  }));
62102
62235
  }
62103
62236
  return result;
@@ -62105,17 +62238,17 @@ function normalizeFeatureForCompare(f) {
62105
62238
  function normalizePlanFeatureForCompare(pf) {
62106
62239
  const f = pf;
62107
62240
  const result = {
62108
- feature_id: pf.feature_id
62241
+ featureId: pf.featureId
62109
62242
  };
62110
- if (f.included != null)
62243
+ if (f.included != null && f.included !== 0)
62111
62244
  result.included = f.included;
62112
62245
  if (f.unlimited === true)
62113
62246
  result.unlimited = true;
62114
62247
  const reset2 = f.reset;
62115
62248
  if (reset2 != null) {
62116
62249
  const r = { interval: reset2.interval };
62117
- if (reset2.interval_count != null && reset2.interval_count !== 1) {
62118
- r.interval_count = reset2.interval_count;
62250
+ if (reset2.intervalCount != null && reset2.intervalCount !== 1) {
62251
+ r.intervalCount = reset2.intervalCount;
62119
62252
  }
62120
62253
  result.reset = r;
62121
62254
  }
@@ -62124,21 +62257,21 @@ function normalizePlanFeatureForCompare(pf) {
62124
62257
  const p = {};
62125
62258
  if (price.amount != null)
62126
62259
  p.amount = price.amount;
62127
- if (price.billing_method != null)
62128
- p.billing_method = price.billing_method;
62260
+ if (price.billingMethod != null)
62261
+ p.billingMethod = price.billingMethod;
62129
62262
  if (price.interval != null)
62130
62263
  p.interval = price.interval;
62131
- if (price.interval_count != null && price.interval_count !== 1) {
62132
- p.interval_count = price.interval_count;
62264
+ if (price.intervalCount != null && price.intervalCount !== 1) {
62265
+ p.intervalCount = price.intervalCount;
62133
62266
  }
62134
62267
  if (price.tiers != null && Array.isArray(price.tiers) && price.tiers.length > 0) {
62135
62268
  p.tiers = price.tiers;
62136
62269
  }
62137
- if (price.billing_units != null && price.billing_units !== 1) {
62138
- p.billing_units = price.billing_units;
62270
+ if (price.billingUnits != null && price.billingUnits !== 1) {
62271
+ p.billingUnits = price.billingUnits;
62139
62272
  }
62140
- if (price.max_purchase != null)
62141
- p.max_purchase = price.max_purchase;
62273
+ if (price.maxPurchase != null)
62274
+ p.maxPurchase = price.maxPurchase;
62142
62275
  if (Object.keys(p).length > 0)
62143
62276
  result.price = p;
62144
62277
  }
@@ -62151,7 +62284,7 @@ function normalizePlanFeatureForCompare(pf) {
62151
62284
  return result;
62152
62285
  }
62153
62286
  function getPlanFeatureIds(plan) {
62154
- return (plan.items || []).map((item) => item.feature_id);
62287
+ return (plan.items || []).map((item) => item.featureId);
62155
62288
  }
62156
62289
  function normalizePlanForCompare(plan) {
62157
62290
  const result = {
@@ -62164,25 +62297,25 @@ function normalizePlanForCompare(plan) {
62164
62297
  if (plan.group != null && plan.group !== "") {
62165
62298
  result.group = plan.group;
62166
62299
  }
62167
- if (plan.add_on === true)
62168
- result.add_on = true;
62169
- if (plan.auto_enable === true)
62170
- result.auto_enable = true;
62300
+ if (plan.addOn === true)
62301
+ result.addOn = true;
62302
+ if (plan.autoEnable === true)
62303
+ result.autoEnable = true;
62171
62304
  if (plan.price != null) {
62172
62305
  result.price = {
62173
62306
  amount: plan.price.amount,
62174
62307
  interval: plan.price.interval
62175
62308
  };
62176
62309
  }
62177
- if (plan.free_trial != null) {
62178
- result.free_trial = {
62179
- duration_type: plan.free_trial.duration_type,
62180
- duration_length: plan.free_trial.duration_length,
62181
- card_required: plan.free_trial.card_required
62310
+ if (plan.freeTrial != null) {
62311
+ result.freeTrial = {
62312
+ durationLength: plan.freeTrial.durationLength,
62313
+ durationType: plan.freeTrial.durationType,
62314
+ cardRequired: plan.freeTrial.cardRequired
62182
62315
  };
62183
62316
  }
62184
62317
  if (plan.items != null && plan.items.length > 0) {
62185
- result.items = [...plan.items].sort((a2, b) => a2.feature_id.localeCompare(b.feature_id)).map(normalizePlanFeatureForCompare);
62318
+ result.items = [...plan.items].sort((a2, b) => a2.featureId.localeCompare(b.featureId)).map(normalizePlanFeatureForCompare);
62186
62319
  }
62187
62320
  return result;
62188
62321
  }
@@ -62327,10 +62460,11 @@ async function analyzePush(localFeatures, localPlans) {
62327
62460
  }
62328
62461
  async function pushFeature(feature) {
62329
62462
  const secretKey = getSecretKey();
62463
+ const apiFeature = transformFeatureToApi(feature);
62330
62464
  try {
62331
62465
  await upsertFeature({
62332
62466
  secretKey,
62333
- feature
62467
+ feature: apiFeature
62334
62468
  });
62335
62469
  return { action: "created" };
62336
62470
  } catch (error) {
@@ -62339,7 +62473,7 @@ async function pushFeature(feature) {
62339
62473
  await updateFeature({
62340
62474
  secretKey,
62341
62475
  featureId: feature.id,
62342
- feature
62476
+ feature: apiFeature
62343
62477
  });
62344
62478
  return { action: "updated" };
62345
62479
  }
@@ -62360,10 +62494,10 @@ async function pushPlan(plan, remotePlans) {
62360
62494
  } else if (plan.group === null && remotePlan.group !== undefined && remotePlan.group !== null) {
62361
62495
  updatePayload.group = null;
62362
62496
  }
62363
- if (plan.add_on === undefined && remotePlan.add_on === true) {
62497
+ if (plan.addOn === undefined && remotePlan.addOn === true) {
62364
62498
  updatePayload.add_on = false;
62365
62499
  }
62366
- if (plan.auto_enable === undefined && remotePlan.auto_enable === true) {
62500
+ if (plan.autoEnable === undefined && remotePlan.autoEnable === true) {
62367
62501
  updatePayload.auto_enable = false;
62368
62502
  }
62369
62503
  await updatePlan({ secretKey, planId: plan.id, plan: updatePayload });
@@ -62412,7 +62546,7 @@ function getPriceInterval(feature) {
62412
62546
  return;
62413
62547
  const price = feature.price;
62414
62548
  if (price.interval) {
62415
- return { interval: price.interval, interval_count: price.interval_count };
62549
+ return { interval: price.interval, intervalCount: price.intervalCount };
62416
62550
  }
62417
62551
  return;
62418
62552
  }
@@ -62428,9 +62562,9 @@ function isConsumableFeature(feature) {
62428
62562
  }
62429
62563
  function validatePlanFeature(planFeature, planId, featureIndex, features) {
62430
62564
  const errors2 = [];
62431
- const featureId = planFeature.feature_id || `(no feature_id)`;
62565
+ const featureId = planFeature.featureId || `(no featureId)`;
62432
62566
  const basePath = `plan "${planId}" → items[${featureIndex}] (${featureId})`;
62433
- const featureDefinition = features.find((f) => f.id === planFeature.feature_id);
62567
+ const featureDefinition = features.find((f) => f.id === planFeature.featureId);
62434
62568
  const topLevelReset = planFeature.reset;
62435
62569
  const priceInterval = getPriceInterval(planFeature);
62436
62570
  const hasTopLevelReset = topLevelReset !== undefined;
@@ -62461,10 +62595,10 @@ function validatePlanFeature(planFeature, planId, featureIndex, features) {
62461
62595
  }
62462
62596
  }
62463
62597
  if (planFeature.price) {
62464
- if (!planFeature.price.billing_method) {
62598
+ if (!planFeature.price.billingMethod) {
62465
62599
  errors2.push({
62466
62600
  path: `${basePath} → price`,
62467
- message: `"billing_method" is required when "price" is defined. Must be "prepaid" or "usage_based".`
62601
+ message: `"billingMethod" is required when "price" is defined. Must be "prepaid" or "usage_based".`
62468
62602
  });
62469
62603
  }
62470
62604
  if ((planFeature.price.amount !== undefined || planFeature.price.tiers) && !hasAnyReset) {
@@ -62536,7 +62670,7 @@ function validatePlan(plan, features) {
62536
62670
  });
62537
62671
  }
62538
62672
  }
62539
- if (plan.auto_enable === true && plan.free_trial?.card_required === true) {
62673
+ if (plan.autoEnable === true && plan.freeTrial?.cardRequired === true) {
62540
62674
  errors2.push({
62541
62675
  path: `plan "${planId}"`,
62542
62676
  message: `"auto_enable" cannot be true when "free_trial.card_required" is true. Customers cannot be auto-enrolled in a trial that requires card input.`
@@ -62546,10 +62680,10 @@ function validatePlan(plan, features) {
62546
62680
  for (let i2 = 0;i2 < plan.items.length; i2++) {
62547
62681
  const planFeature = plan.items[i2];
62548
62682
  if (planFeature) {
62549
- if (!planFeature.feature_id) {
62683
+ if (!planFeature.featureId) {
62550
62684
  errors2.push({
62551
62685
  path: `plan "${planId}" → items[${i2}]`,
62552
- message: `"feature_id" is required.`
62686
+ message: `"featureId" is required.`
62553
62687
  });
62554
62688
  }
62555
62689
  errors2.push(...validatePlanFeature(planFeature, planId, i2, features));
@@ -62589,10 +62723,10 @@ function validateFeature(feature) {
62589
62723
  }
62590
62724
  }
62591
62725
  if (feature.type === "credit_system") {
62592
- if (!feature.credit_schema || feature.credit_schema.length === 0) {
62726
+ if (!feature.creditSchema || feature.creditSchema.length === 0) {
62593
62727
  errors2.push({
62594
62728
  path: `feature "${featureId}"`,
62595
- message: `"credit_schema" is required for credit_system features.`
62729
+ message: `"creditSchema" is required for credit_system features.`
62596
62730
  });
62597
62731
  }
62598
62732
  }
@@ -62687,7 +62821,7 @@ function buildPromptQueue(analysis, environment) {
62687
62821
  }
62688
62822
  for (const planInfo of analysis.plansToUpdate) {
62689
62823
  if (planInfo.willVersion) {
62690
- prompts.push(createPlanVersioningPrompt(planInfo));
62824
+ prompts.push(createPlanVersioningPrompt(planInfo, environment));
62691
62825
  }
62692
62826
  }
62693
62827
  for (const info of analysis.featuresToDelete) {
@@ -62771,7 +62905,7 @@ async function syncArchivedFeaturesToConfig(config, archivedFeatureIds, cwd2) {
62771
62905
  }
62772
62906
  await writeConfig(Array.from(localFeaturesById.values()), config.plans, cwd2);
62773
62907
  }
62774
- async function executePushWithDefaults(config, analysis, prompts, cwd2) {
62908
+ async function executePushWithDefaults(config, analysis, prompts, cwd2, environment) {
62775
62909
  const result = {
62776
62910
  success: true,
62777
62911
  featuresCreated: [],
@@ -62802,7 +62936,13 @@ async function executePushWithDefaults(config, analysis, prompts, cwd2) {
62802
62936
  await unarchiveFeature2(feature.id);
62803
62937
  }
62804
62938
  }
62805
- const allFeatures = config.features;
62939
+ const allFeatures = [...config.features].sort((a2, b) => {
62940
+ if (a2.type === "credit_system" && b.type !== "credit_system")
62941
+ return 1;
62942
+ if (a2.type !== "credit_system" && b.type === "credit_system")
62943
+ return -1;
62944
+ return 0;
62945
+ });
62806
62946
  for (const feature of allFeatures) {
62807
62947
  const isArchived = analysis.archivedFeatures.some((af) => af.id === feature.id);
62808
62948
  if (isArchived) {
@@ -62835,12 +62975,10 @@ async function executePushWithDefaults(config, analysis, prompts, cwd2) {
62835
62975
  const planUpdateById = new Map(refreshedPlanUpdates.map((planInfo) => [planInfo.plan.id, planInfo]));
62836
62976
  for (const planInfo of analysis.plansToUpdate) {
62837
62977
  const refreshedPlanInfo = planUpdateById.get(planInfo.plan.id) ?? planInfo;
62838
- if (refreshedPlanInfo.willVersion) {
62839
- const promptId = prompts.find((p) => p.type === "plan_versioning" && p.entityId === planInfo.plan.id)?.id;
62840
- const response = promptId ? responses.get(promptId) : undefined;
62841
- if (response === "skip") {
62842
- continue;
62843
- }
62978
+ const versioningPromptId = prompts.find((p) => p.type === "plan_versioning" && p.entityId === planInfo.plan.id)?.id;
62979
+ const versioningResponse = versioningPromptId ? responses.get(versioningPromptId) : undefined;
62980
+ if (refreshedPlanInfo.willVersion && versioningResponse === "skip") {
62981
+ continue;
62844
62982
  }
62845
62983
  if (planInfo.isArchived || refreshedPlanInfo.isArchived) {
62846
62984
  const promptId = prompts.find((p) => p.type === "plan_archived" && p.entityId === planInfo.plan.id)?.id;
@@ -62850,6 +62988,23 @@ async function executePushWithDefaults(config, analysis, prompts, cwd2) {
62850
62988
  }
62851
62989
  }
62852
62990
  await pushPlan(planInfo.plan, remotePlans);
62991
+ if (refreshedPlanInfo.willVersion && versioningResponse === "version_and_migrate") {
62992
+ const secretKey = getKey(environment);
62993
+ const updatedPlans = await fetchPlans({
62994
+ secretKey,
62995
+ includeArchived: false
62996
+ });
62997
+ const updatedPlan = updatedPlans.find((p) => p.id === planInfo.plan.id);
62998
+ if (updatedPlan && updatedPlan.version > 1) {
62999
+ await migrateProduct({
63000
+ secretKey,
63001
+ fromProductId: planInfo.plan.id,
63002
+ fromVersion: updatedPlan.version - 1,
63003
+ toProductId: planInfo.plan.id,
63004
+ toVersion: updatedPlan.version
63005
+ });
63006
+ }
63007
+ }
62853
63008
  if (refreshedPlanInfo.willVersion) {
62854
63009
  result.plansUpdated.push(refreshedPlanInfo.plan.id);
62855
63010
  } else {
@@ -62914,7 +63069,14 @@ async function executeCleanPush(config, analysis) {
62914
63069
  };
62915
63070
  const remoteData = await fetchRemoteData();
62916
63071
  const remotePlans = remoteData.plans;
62917
- for (const feature of config.features) {
63072
+ const sortedFeatures = [...config.features].sort((a2, b) => {
63073
+ if (a2.type === "credit_system" && b.type !== "credit_system")
63074
+ return 1;
63075
+ if (a2.type !== "credit_system" && b.type === "credit_system")
63076
+ return -1;
63077
+ return 0;
63078
+ });
63079
+ for (const feature of sortedFeatures) {
62918
63080
  const pushResult = await pushFeature(feature);
62919
63081
  if (pushResult.action === "created") {
62920
63082
  result.featuresCreated.push(feature.id);
@@ -62988,7 +63150,7 @@ Push requires confirmation for the following:`));
62988
63150
  Pushing to ${envLabel}...`));
62989
63151
  let result;
62990
63152
  if (prompts.length > 0) {
62991
- result = await executePushWithDefaults(config, analysis, prompts, cwd2);
63153
+ result = await executePushWithDefaults(config, analysis, prompts, cwd2, environment);
62992
63154
  } else {
62993
63155
  result = await executeCleanPush(config, analysis);
62994
63156
  }
@@ -63022,15 +63184,18 @@ Push complete!`));
63022
63184
  }
63023
63185
  var init_headless = __esm(() => {
63024
63186
  init_source();
63187
+ init_endpoints();
63025
63188
  init_headlessAuthRecovery();
63026
63189
  init_env();
63027
63190
  init_writeConfig();
63191
+ init_prompts();
63028
63192
  init_push();
63029
63193
  });
63030
63194
 
63031
63195
  // src/commands/push/index.ts
63032
63196
  var init_push2 = __esm(() => {
63033
63197
  init_headless();
63198
+ init_prompts();
63034
63199
  init_push();
63035
63200
  });
63036
63201
 
@@ -63186,7 +63351,7 @@ ${formatValidationErrors2(validation.errors)}`);
63186
63351
  }
63187
63352
  for (const planInfo of analysisResult.plansToUpdate) {
63188
63353
  if (planInfo.willVersion) {
63189
- prompts.push(createPlanVersioningPrompt(planInfo));
63354
+ prompts.push(createPlanVersioningPrompt(planInfo, environment));
63190
63355
  }
63191
63356
  }
63192
63357
  for (const info of analysisResult.featuresToDelete) {
@@ -63235,7 +63400,13 @@ ${formatValidationErrors2(validation.errors)}`);
63235
63400
  const allFeatures = [
63236
63401
  ...config.features.filter((f) => !analysis?.archivedFeatures.some((af) => af.id === f.id)),
63237
63402
  ...config.features.filter((f) => analysis?.archivedFeatures.some((af) => af.id === f.id))
63238
- ];
63403
+ ].sort((a2, b) => {
63404
+ if (a2.type === "credit_system" && b.type !== "credit_system")
63405
+ return 1;
63406
+ if (a2.type !== "credit_system" && b.type === "credit_system")
63407
+ return -1;
63408
+ return 0;
63409
+ });
63239
63410
  for (const feature of allFeatures) {
63240
63411
  const isArchived = analysis?.archivedFeatures.some((af) => af.id === feature.id);
63241
63412
  if (isArchived) {
@@ -63306,7 +63477,25 @@ ${formatValidationErrors2(validation.errors)}`);
63306
63477
  }
63307
63478
  }
63308
63479
  setPlanProgress((prev) => new Map(prev).set(planInfo.plan.id, "pushing"));
63480
+ const versioningResponse = resolvedPlanInfo.willVersion ? promptResponses.get(promptQueue.find((p) => p.type === "plan_versioning" && p.entityId === planInfo.plan.id)?.id || "") : undefined;
63309
63481
  await pushPlan(planInfo.plan, remotePlans);
63482
+ if (resolvedPlanInfo.willVersion && versioningResponse === "version_and_migrate") {
63483
+ const secretKey = getKey(environment);
63484
+ const updatedPlans = await fetchPlans({
63485
+ secretKey,
63486
+ includeArchived: false
63487
+ });
63488
+ const updatedPlan = updatedPlans.find((p) => p.id === planInfo.plan.id);
63489
+ if (updatedPlan && updatedPlan.version > 1) {
63490
+ await migrateProduct({
63491
+ secretKey,
63492
+ fromProductId: planInfo.plan.id,
63493
+ fromVersion: updatedPlan.version - 1,
63494
+ toProductId: planInfo.plan.id,
63495
+ toVersion: updatedPlan.version
63496
+ });
63497
+ }
63498
+ }
63310
63499
  if (resolvedPlanInfo.willVersion) {
63311
63500
  versioned.push(planInfo.plan.id);
63312
63501
  setPlanProgress((prev) => new Map(prev).set(planInfo.plan.id, "versioned"));
@@ -63513,10 +63702,11 @@ ${formatValidationErrors2(validation.errors)}`);
63513
63702
  var import_react43;
63514
63703
  var init_usePush = __esm(() => {
63515
63704
  init_modern2();
63705
+ init_writeConfig();
63516
63706
  init_push2();
63517
63707
  init_client2();
63708
+ init_endpoints();
63518
63709
  init_env();
63519
- init_writeConfig();
63520
63710
  init_useOrganization();
63521
63711
  import_react43 = __toESM(require_react(), 1);
63522
63712
  });
@@ -63548,11 +63738,11 @@ var init_linear_config = __esm(() => {
63548
63738
  {
63549
63739
  id: "free",
63550
63740
  name: "Free",
63551
- auto_enable: true,
63741
+ autoEnable: true,
63552
63742
  items: [
63553
- { feature_id: "teams", included: 2 },
63554
- { feature_id: "issues", included: 250, reset: { interval: "one_off" } },
63555
- { feature_id: "seats", unlimited: true }
63743
+ { featureId: "teams", included: 2 },
63744
+ { featureId: "issues", included: 250, reset: { interval: "one_off" } },
63745
+ { featureId: "seats", unlimited: true }
63556
63746
  ]
63557
63747
  },
63558
63748
  {
@@ -63561,17 +63751,17 @@ var init_linear_config = __esm(() => {
63561
63751
  price: { amount: 12, interval: "month" },
63562
63752
  items: [
63563
63753
  {
63564
- feature_id: "seats",
63754
+ featureId: "seats",
63565
63755
  included: 1,
63566
63756
  price: {
63567
63757
  amount: 12,
63568
- billing_method: "usage_based",
63569
- billing_units: 1,
63758
+ billingMethod: "usage_based",
63759
+ billingUnits: 1,
63570
63760
  interval: "month"
63571
63761
  }
63572
63762
  },
63573
- { feature_id: "teams", included: 5 },
63574
- { feature_id: "issues", unlimited: true }
63763
+ { featureId: "teams", included: 5 },
63764
+ { featureId: "issues", unlimited: true }
63575
63765
  ]
63576
63766
  },
63577
63767
  {
@@ -63580,17 +63770,17 @@ var init_linear_config = __esm(() => {
63580
63770
  price: { amount: 18, interval: "month" },
63581
63771
  items: [
63582
63772
  {
63583
- feature_id: "seats",
63773
+ featureId: "seats",
63584
63774
  included: 1,
63585
63775
  price: {
63586
63776
  amount: 18,
63587
- billing_method: "usage_based",
63588
- billing_units: 1,
63777
+ billingMethod: "usage_based",
63778
+ billingUnits: 1,
63589
63779
  interval: "month"
63590
63780
  }
63591
63781
  },
63592
- { feature_id: "teams", unlimited: true },
63593
- { feature_id: "issues", unlimited: true }
63782
+ { featureId: "teams", unlimited: true },
63783
+ { featureId: "issues", unlimited: true }
63594
63784
  ]
63595
63785
  }
63596
63786
  ];
@@ -63604,13 +63794,13 @@ var init_openai_config = __esm(() => {
63604
63794
  id: "credits",
63605
63795
  name: "Credits",
63606
63796
  type: "credit_system",
63607
- credit_schema: [
63608
- { metered_feature_id: "gpt5_mini_input", credit_cost: 0.25 },
63609
- { metered_feature_id: "gpt5_mini_output", credit_cost: 2 },
63610
- { metered_feature_id: "gpt52_input", credit_cost: 1.75 },
63611
- { metered_feature_id: "gpt52_output", credit_cost: 14 },
63612
- { metered_feature_id: "gpt52_pro_input", credit_cost: 21 },
63613
- { metered_feature_id: "gpt52_pro_output", credit_cost: 168 }
63797
+ creditSchema: [
63798
+ { meteredFeatureId: "gpt5_mini_input", creditCost: 0.25 },
63799
+ { meteredFeatureId: "gpt5_mini_output", creditCost: 2 },
63800
+ { meteredFeatureId: "gpt52_input", creditCost: 1.75 },
63801
+ { meteredFeatureId: "gpt52_output", creditCost: 14 },
63802
+ { meteredFeatureId: "gpt52_pro_input", creditCost: 21 },
63803
+ { meteredFeatureId: "gpt52_pro_output", creditCost: 168 }
63614
63804
  ]
63615
63805
  },
63616
63806
  {
@@ -63654,23 +63844,23 @@ var init_openai_config = __esm(() => {
63654
63844
  {
63655
63845
  id: "free",
63656
63846
  name: "Free",
63657
- auto_enable: true,
63847
+ autoEnable: true,
63658
63848
  items: [
63659
- { feature_id: "credits", included: 2000, reset: { interval: "one_off" } }
63849
+ { featureId: "credits", included: 2000, reset: { interval: "one_off" } }
63660
63850
  ]
63661
63851
  },
63662
63852
  {
63663
63853
  id: "credits-top-up",
63664
63854
  name: "Credits Top-Up",
63665
- add_on: true,
63855
+ addOn: true,
63666
63856
  items: [
63667
63857
  {
63668
- feature_id: "credits",
63858
+ featureId: "credits",
63669
63859
  price: {
63670
63860
  amount: 10,
63671
- billing_method: "prepaid",
63672
- billing_units: 1e4,
63673
- interval: "one_off"
63861
+ billingMethod: "prepaid",
63862
+ billingUnits: 1e4,
63863
+ interval: "month"
63674
63864
  }
63675
63865
  }
63676
63866
  ]
@@ -63686,11 +63876,11 @@ var init_railway_config = __esm(() => {
63686
63876
  id: "credits",
63687
63877
  name: "Credits",
63688
63878
  type: "credit_system",
63689
- credit_schema: [
63690
- { metered_feature_id: "memory", credit_cost: 0.039 },
63691
- { metered_feature_id: "cpu", credit_cost: 0.078 },
63692
- { metered_feature_id: "egress", credit_cost: 5 },
63693
- { metered_feature_id: "storage", credit_cost: 1.5 }
63879
+ creditSchema: [
63880
+ { meteredFeatureId: "memory", creditCost: 0.039 },
63881
+ { meteredFeatureId: "cpu", creditCost: 0.078 },
63882
+ { meteredFeatureId: "egress", creditCost: 5 },
63883
+ { meteredFeatureId: "storage", creditCost: 1.5 }
63694
63884
  ]
63695
63885
  },
63696
63886
  {
@@ -63722,9 +63912,9 @@ var init_railway_config = __esm(() => {
63722
63912
  {
63723
63913
  id: "free",
63724
63914
  name: "Free",
63725
- auto_enable: true,
63915
+ autoEnable: true,
63726
63916
  items: [
63727
- { feature_id: "credits", included: 500, reset: { interval: "one_off" } }
63917
+ { featureId: "credits", included: 500, reset: { interval: "one_off" } }
63728
63918
  ]
63729
63919
  },
63730
63920
  {
@@ -63733,13 +63923,13 @@ var init_railway_config = __esm(() => {
63733
63923
  price: { amount: 5, interval: "month" },
63734
63924
  items: [
63735
63925
  {
63736
- feature_id: "credits",
63926
+ featureId: "credits",
63737
63927
  included: 500,
63928
+ reset: { interval: "month" },
63738
63929
  price: {
63739
63930
  amount: 0.01,
63740
- billing_method: "usage_based",
63741
- billing_units: 1,
63742
- interval: "month"
63931
+ billingMethod: "usage_based",
63932
+ billingUnits: 1
63743
63933
  }
63744
63934
  }
63745
63935
  ]
@@ -63750,13 +63940,13 @@ var init_railway_config = __esm(() => {
63750
63940
  price: { amount: 20, interval: "month" },
63751
63941
  items: [
63752
63942
  {
63753
- feature_id: "credits",
63943
+ featureId: "credits",
63754
63944
  included: 2000,
63755
63945
  reset: { interval: "month" },
63756
63946
  price: {
63757
63947
  amount: 0.01,
63758
- billing_method: "usage_based",
63759
- billing_units: 1
63948
+ billingMethod: "usage_based",
63949
+ billingUnits: 1
63760
63950
  }
63761
63951
  }
63762
63952
  ]
@@ -63785,10 +63975,10 @@ var init_t3chat_config = __esm(() => {
63785
63975
  {
63786
63976
  id: "free",
63787
63977
  name: "Free",
63788
- auto_enable: true,
63978
+ autoEnable: true,
63789
63979
  items: [
63790
63980
  {
63791
- feature_id: "standard_messages",
63981
+ featureId: "standard_messages",
63792
63982
  included: 100,
63793
63983
  reset: { interval: "month" }
63794
63984
  }
@@ -63800,12 +63990,12 @@ var init_t3chat_config = __esm(() => {
63800
63990
  price: { amount: 8, interval: "month" },
63801
63991
  items: [
63802
63992
  {
63803
- feature_id: "standard_messages",
63993
+ featureId: "standard_messages",
63804
63994
  included: 1500,
63805
63995
  reset: { interval: "month" }
63806
63996
  },
63807
63997
  {
63808
- feature_id: "premium_messages",
63998
+ featureId: "premium_messages",
63809
63999
  included: 100,
63810
64000
  reset: { interval: "month" }
63811
64001
  }
@@ -63814,11 +64004,11 @@ var init_t3chat_config = __esm(() => {
63814
64004
  {
63815
64005
  id: "premium-credits",
63816
64006
  name: "Premium Credits",
63817
- add_on: true,
63818
- price: { amount: 8, interval: "one_off" },
64007
+ addOn: true,
64008
+ price: { amount: 8, interval: "month" },
63819
64009
  items: [
63820
64010
  {
63821
- feature_id: "premium_messages",
64011
+ featureId: "premium_messages",
63822
64012
  included: 100,
63823
64013
  reset: { interval: "one_off" }
63824
64014
  }
@@ -64190,6 +64380,7 @@ function PromptCard({
64190
64380
  cardWidth.registerWidth(id, contentWidth);
64191
64381
  return () => cardWidth.unregisterWidth(id);
64192
64382
  }
64383
+ return;
64193
64384
  }, [id, contentWidth, cardWidth]);
64194
64385
  const width = cardWidth?.width ?? Math.max(DEFAULT_WIDTH2, contentWidth);
64195
64386
  return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
@@ -64435,7 +64626,7 @@ var init_components = __esm(async () => {
64435
64626
  import fs14 from "node:fs";
64436
64627
  import path12 from "node:path";
64437
64628
  function writeEmptyConfig(targetDir) {
64438
- const content = `import { plan, feature, planFeature } from 'atmn'
64629
+ const content = `import { feature, item, plan } from 'atmn'
64439
64630
  `;
64440
64631
  const configPath = targetDir ? path12.join(targetDir, "autumn.config.ts") : resolveConfigPath();
64441
64632
  fs14.writeFileSync(configPath, content, "utf-8");
@@ -65313,801 +65504,6 @@ var init_NukeAnimation = __esm(async () => {
65313
65504
  jsx_dev_runtime17 = __toESM(require_jsx_dev_runtime(), 1);
65314
65505
  });
65315
65506
 
65316
- // ../node_modules/.pnpm/react@19.1.1/node_modules/react/cjs/react.development.js
65317
- var require_react_development2 = __commonJS((exports, module) => {
65318
- (function() {
65319
- function defineDeprecationWarning(methodName, info) {
65320
- Object.defineProperty(Component.prototype, methodName, {
65321
- get: function() {
65322
- console.warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
65323
- }
65324
- });
65325
- }
65326
- function getIteratorFn(maybeIterable) {
65327
- if (maybeIterable === null || typeof maybeIterable !== "object")
65328
- return null;
65329
- maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
65330
- return typeof maybeIterable === "function" ? maybeIterable : null;
65331
- }
65332
- function warnNoop(publicInstance, callerName) {
65333
- publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
65334
- var warningKey = publicInstance + "." + callerName;
65335
- didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", callerName, publicInstance), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
65336
- }
65337
- function Component(props, context2, updater) {
65338
- this.props = props;
65339
- this.context = context2;
65340
- this.refs = emptyObject;
65341
- this.updater = updater || ReactNoopUpdateQueue;
65342
- }
65343
- function ComponentDummy() {}
65344
- function PureComponent2(props, context2, updater) {
65345
- this.props = props;
65346
- this.context = context2;
65347
- this.refs = emptyObject;
65348
- this.updater = updater || ReactNoopUpdateQueue;
65349
- }
65350
- function testStringCoercion(value) {
65351
- return "" + value;
65352
- }
65353
- function checkKeyStringCoercion(value) {
65354
- try {
65355
- testStringCoercion(value);
65356
- var JSCompiler_inline_result = false;
65357
- } catch (e) {
65358
- JSCompiler_inline_result = true;
65359
- }
65360
- if (JSCompiler_inline_result) {
65361
- JSCompiler_inline_result = console;
65362
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
65363
- var JSCompiler_inline_result$jscomp$0 = typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
65364
- JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
65365
- return testStringCoercion(value);
65366
- }
65367
- }
65368
- function getComponentNameFromType(type) {
65369
- if (type == null)
65370
- return null;
65371
- if (typeof type === "function")
65372
- return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
65373
- if (typeof type === "string")
65374
- return type;
65375
- switch (type) {
65376
- case REACT_FRAGMENT_TYPE:
65377
- return "Fragment";
65378
- case REACT_PROFILER_TYPE:
65379
- return "Profiler";
65380
- case REACT_STRICT_MODE_TYPE:
65381
- return "StrictMode";
65382
- case REACT_SUSPENSE_TYPE:
65383
- return "Suspense";
65384
- case REACT_SUSPENSE_LIST_TYPE:
65385
- return "SuspenseList";
65386
- case REACT_ACTIVITY_TYPE:
65387
- return "Activity";
65388
- }
65389
- if (typeof type === "object")
65390
- switch (typeof type.tag === "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
65391
- case REACT_PORTAL_TYPE:
65392
- return "Portal";
65393
- case REACT_CONTEXT_TYPE:
65394
- return (type.displayName || "Context") + ".Provider";
65395
- case REACT_CONSUMER_TYPE:
65396
- return (type._context.displayName || "Context") + ".Consumer";
65397
- case REACT_FORWARD_REF_TYPE:
65398
- var innerType = type.render;
65399
- type = type.displayName;
65400
- type || (type = innerType.displayName || innerType.name || "", type = type !== "" ? "ForwardRef(" + type + ")" : "ForwardRef");
65401
- return type;
65402
- case REACT_MEMO_TYPE:
65403
- return innerType = type.displayName || null, innerType !== null ? innerType : getComponentNameFromType(type.type) || "Memo";
65404
- case REACT_LAZY_TYPE:
65405
- innerType = type._payload;
65406
- type = type._init;
65407
- try {
65408
- return getComponentNameFromType(type(innerType));
65409
- } catch (x) {}
65410
- }
65411
- return null;
65412
- }
65413
- function getTaskName(type) {
65414
- if (type === REACT_FRAGMENT_TYPE)
65415
- return "<>";
65416
- if (typeof type === "object" && type !== null && type.$$typeof === REACT_LAZY_TYPE)
65417
- return "<...>";
65418
- try {
65419
- var name = getComponentNameFromType(type);
65420
- return name ? "<" + name + ">" : "<...>";
65421
- } catch (x) {
65422
- return "<...>";
65423
- }
65424
- }
65425
- function getOwner() {
65426
- var dispatcher = ReactSharedInternals.A;
65427
- return dispatcher === null ? null : dispatcher.getOwner();
65428
- }
65429
- function UnknownOwner() {
65430
- return Error("react-stack-top-frame");
65431
- }
65432
- function hasValidKey(config) {
65433
- if (hasOwnProperty.call(config, "key")) {
65434
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
65435
- if (getter && getter.isReactWarning)
65436
- return false;
65437
- }
65438
- return config.key !== undefined;
65439
- }
65440
- function defineKeyPropWarningGetter(props, displayName) {
65441
- function warnAboutAccessingKey() {
65442
- specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
65443
- }
65444
- warnAboutAccessingKey.isReactWarning = true;
65445
- Object.defineProperty(props, "key", {
65446
- get: warnAboutAccessingKey,
65447
- configurable: true
65448
- });
65449
- }
65450
- function elementRefGetterWithDeprecationWarning() {
65451
- var componentName = getComponentNameFromType(this.type);
65452
- didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
65453
- componentName = this.props.ref;
65454
- return componentName !== undefined ? componentName : null;
65455
- }
65456
- function ReactElement(type, key2, self2, source, owner, props, debugStack, debugTask) {
65457
- self2 = props.ref;
65458
- type = {
65459
- $$typeof: REACT_ELEMENT_TYPE,
65460
- type,
65461
- key: key2,
65462
- props,
65463
- _owner: owner
65464
- };
65465
- (self2 !== undefined ? self2 : null) !== null ? Object.defineProperty(type, "ref", {
65466
- enumerable: false,
65467
- get: elementRefGetterWithDeprecationWarning
65468
- }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
65469
- type._store = {};
65470
- Object.defineProperty(type._store, "validated", {
65471
- configurable: false,
65472
- enumerable: false,
65473
- writable: true,
65474
- value: 0
65475
- });
65476
- Object.defineProperty(type, "_debugInfo", {
65477
- configurable: false,
65478
- enumerable: false,
65479
- writable: true,
65480
- value: null
65481
- });
65482
- Object.defineProperty(type, "_debugStack", {
65483
- configurable: false,
65484
- enumerable: false,
65485
- writable: true,
65486
- value: debugStack
65487
- });
65488
- Object.defineProperty(type, "_debugTask", {
65489
- configurable: false,
65490
- enumerable: false,
65491
- writable: true,
65492
- value: debugTask
65493
- });
65494
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
65495
- return type;
65496
- }
65497
- function cloneAndReplaceKey(oldElement, newKey) {
65498
- newKey = ReactElement(oldElement.type, newKey, undefined, undefined, oldElement._owner, oldElement.props, oldElement._debugStack, oldElement._debugTask);
65499
- oldElement._store && (newKey._store.validated = oldElement._store.validated);
65500
- return newKey;
65501
- }
65502
- function isValidElement(object) {
65503
- return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
65504
- }
65505
- function escape3(key2) {
65506
- var escaperLookup = { "=": "=0", ":": "=2" };
65507
- return "$" + key2.replace(/[=:]/g, function(match) {
65508
- return escaperLookup[match];
65509
- });
65510
- }
65511
- function getElementKey(element, index) {
65512
- return typeof element === "object" && element !== null && element.key != null ? (checkKeyStringCoercion(element.key), escape3("" + element.key)) : index.toString(36);
65513
- }
65514
- function noop$1() {}
65515
- function resolveThenable(thenable) {
65516
- switch (thenable.status) {
65517
- case "fulfilled":
65518
- return thenable.value;
65519
- case "rejected":
65520
- throw thenable.reason;
65521
- default:
65522
- switch (typeof thenable.status === "string" ? thenable.then(noop$1, noop$1) : (thenable.status = "pending", thenable.then(function(fulfilledValue) {
65523
- thenable.status === "pending" && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
65524
- }, function(error) {
65525
- thenable.status === "pending" && (thenable.status = "rejected", thenable.reason = error);
65526
- })), thenable.status) {
65527
- case "fulfilled":
65528
- return thenable.value;
65529
- case "rejected":
65530
- throw thenable.reason;
65531
- }
65532
- }
65533
- throw thenable;
65534
- }
65535
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
65536
- var type = typeof children;
65537
- if (type === "undefined" || type === "boolean")
65538
- children = null;
65539
- var invokeCallback = false;
65540
- if (children === null)
65541
- invokeCallback = true;
65542
- else
65543
- switch (type) {
65544
- case "bigint":
65545
- case "string":
65546
- case "number":
65547
- invokeCallback = true;
65548
- break;
65549
- case "object":
65550
- switch (children.$$typeof) {
65551
- case REACT_ELEMENT_TYPE:
65552
- case REACT_PORTAL_TYPE:
65553
- invokeCallback = true;
65554
- break;
65555
- case REACT_LAZY_TYPE:
65556
- return invokeCallback = children._init, mapIntoArray(invokeCallback(children._payload), array, escapedPrefix, nameSoFar, callback);
65557
- }
65558
- }
65559
- if (invokeCallback) {
65560
- invokeCallback = children;
65561
- callback = callback(invokeCallback);
65562
- var childKey = nameSoFar === "" ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
65563
- isArrayImpl(callback) ? (escapedPrefix = "", childKey != null && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c3) {
65564
- return c3;
65565
- })) : callback != null && (isValidElement(callback) && (callback.key != null && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(callback, escapedPrefix + (callback.key == null || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(userProvidedKeyEscapeRegex, "$&/") + "/") + childKey), nameSoFar !== "" && invokeCallback != null && isValidElement(invokeCallback) && invokeCallback.key == null && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
65566
- return 1;
65567
- }
65568
- invokeCallback = 0;
65569
- childKey = nameSoFar === "" ? "." : nameSoFar + ":";
65570
- if (isArrayImpl(children))
65571
- for (var i2 = 0;i2 < children.length; i2++)
65572
- nameSoFar = children[i2], type = childKey + getElementKey(nameSoFar, i2), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
65573
- else if (i2 = getIteratorFn(children), typeof i2 === "function")
65574
- for (i2 === children.entries && (didWarnAboutMaps || console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."), didWarnAboutMaps = true), children = i2.call(children), i2 = 0;!(nameSoFar = children.next()).done; )
65575
- nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i2++), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
65576
- else if (type === "object") {
65577
- if (typeof children.then === "function")
65578
- return mapIntoArray(resolveThenable(children), array, escapedPrefix, nameSoFar, callback);
65579
- array = String(children);
65580
- throw Error("Objects are not valid as a React child (found: " + (array === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead.");
65581
- }
65582
- return invokeCallback;
65583
- }
65584
- function mapChildren(children, func, context2) {
65585
- if (children == null)
65586
- return children;
65587
- var result = [], count2 = 0;
65588
- mapIntoArray(children, result, "", "", function(child) {
65589
- return func.call(context2, child, count2++);
65590
- });
65591
- return result;
65592
- }
65593
- function lazyInitializer(payload) {
65594
- if (payload._status === -1) {
65595
- var ctor = payload._result;
65596
- ctor = ctor();
65597
- ctor.then(function(moduleObject) {
65598
- if (payload._status === 0 || payload._status === -1)
65599
- payload._status = 1, payload._result = moduleObject;
65600
- }, function(error) {
65601
- if (payload._status === 0 || payload._status === -1)
65602
- payload._status = 2, payload._result = error;
65603
- });
65604
- payload._status === -1 && (payload._status = 0, payload._result = ctor);
65605
- }
65606
- if (payload._status === 1)
65607
- return ctor = payload._result, ctor === undefined && console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
65608
-
65609
- Your code should look like:
65610
- const MyComponent = lazy(() => import('./MyComponent'))
65611
-
65612
- Did you accidentally put curly braces around the import?`, ctor), "default" in ctor || console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
65613
-
65614
- Your code should look like:
65615
- const MyComponent = lazy(() => import('./MyComponent'))`, ctor), ctor.default;
65616
- throw payload._result;
65617
- }
65618
- function resolveDispatcher() {
65619
- var dispatcher = ReactSharedInternals.H;
65620
- dispatcher === null && console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
65621
- 1. You might have mismatching versions of React and the renderer (such as React DOM)
65622
- 2. You might be breaking the Rules of Hooks
65623
- 3. You might have more than one copy of React in the same app
65624
- See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`);
65625
- return dispatcher;
65626
- }
65627
- function noop5() {}
65628
- function enqueueTask(task) {
65629
- if (enqueueTaskImpl === null)
65630
- try {
65631
- var requireString = ("require" + Math.random()).slice(0, 7);
65632
- enqueueTaskImpl = (module && module[requireString]).call(module, "timers").setImmediate;
65633
- } catch (_err) {
65634
- enqueueTaskImpl = function(callback) {
65635
- didWarnAboutMessageChannel === false && (didWarnAboutMessageChannel = true, typeof MessageChannel === "undefined" && console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));
65636
- var channel = new MessageChannel;
65637
- channel.port1.onmessage = callback;
65638
- channel.port2.postMessage(undefined);
65639
- };
65640
- }
65641
- return enqueueTaskImpl(task);
65642
- }
65643
- function aggregateErrors(errors2) {
65644
- return 1 < errors2.length && typeof AggregateError === "function" ? new AggregateError(errors2) : errors2[0];
65645
- }
65646
- function popActScope(prevActQueue, prevActScopeDepth) {
65647
- prevActScopeDepth !== actScopeDepth - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
65648
- actScopeDepth = prevActScopeDepth;
65649
- }
65650
- function recursivelyFlushAsyncActWork(returnValue, resolve7, reject) {
65651
- var queue = ReactSharedInternals.actQueue;
65652
- if (queue !== null)
65653
- if (queue.length !== 0)
65654
- try {
65655
- flushActQueue(queue);
65656
- enqueueTask(function() {
65657
- return recursivelyFlushAsyncActWork(returnValue, resolve7, reject);
65658
- });
65659
- return;
65660
- } catch (error) {
65661
- ReactSharedInternals.thrownErrors.push(error);
65662
- }
65663
- else
65664
- ReactSharedInternals.actQueue = null;
65665
- 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve7(returnValue);
65666
- }
65667
- function flushActQueue(queue) {
65668
- if (!isFlushing) {
65669
- isFlushing = true;
65670
- var i2 = 0;
65671
- try {
65672
- for (;i2 < queue.length; i2++) {
65673
- var callback = queue[i2];
65674
- do {
65675
- ReactSharedInternals.didUsePromise = false;
65676
- var continuation = callback(false);
65677
- if (continuation !== null) {
65678
- if (ReactSharedInternals.didUsePromise) {
65679
- queue[i2] = callback;
65680
- queue.splice(0, i2);
65681
- return;
65682
- }
65683
- callback = continuation;
65684
- } else
65685
- break;
65686
- } while (1);
65687
- }
65688
- queue.length = 0;
65689
- } catch (error) {
65690
- queue.splice(0, i2 + 1), ReactSharedInternals.thrownErrors.push(error);
65691
- } finally {
65692
- isFlushing = false;
65693
- }
65694
- }
65695
- }
65696
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
65697
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler");
65698
- Symbol.for("react.provider");
65699
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, didWarnStateUpdateForUnmountedComponent = {}, ReactNoopUpdateQueue = {
65700
- isMounted: function() {
65701
- return false;
65702
- },
65703
- enqueueForceUpdate: function(publicInstance) {
65704
- warnNoop(publicInstance, "forceUpdate");
65705
- },
65706
- enqueueReplaceState: function(publicInstance) {
65707
- warnNoop(publicInstance, "replaceState");
65708
- },
65709
- enqueueSetState: function(publicInstance) {
65710
- warnNoop(publicInstance, "setState");
65711
- }
65712
- }, assign = Object.assign, emptyObject = {};
65713
- Object.freeze(emptyObject);
65714
- Component.prototype.isReactComponent = {};
65715
- Component.prototype.setState = function(partialState, callback) {
65716
- if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null)
65717
- throw Error("takes an object of state variables to update or a function which returns an object of state variables.");
65718
- this.updater.enqueueSetState(this, partialState, callback, "setState");
65719
- };
65720
- Component.prototype.forceUpdate = function(callback) {
65721
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
65722
- };
65723
- var deprecatedAPIs = {
65724
- isMounted: [
65725
- "isMounted",
65726
- "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
65727
- ],
65728
- replaceState: [
65729
- "replaceState",
65730
- "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
65731
- ]
65732
- }, fnName;
65733
- for (fnName in deprecatedAPIs)
65734
- deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
65735
- ComponentDummy.prototype = Component.prototype;
65736
- deprecatedAPIs = PureComponent2.prototype = new ComponentDummy;
65737
- deprecatedAPIs.constructor = PureComponent2;
65738
- assign(deprecatedAPIs, Component.prototype);
65739
- deprecatedAPIs.isPureReactComponent = true;
65740
- var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = {
65741
- H: null,
65742
- A: null,
65743
- T: null,
65744
- S: null,
65745
- V: null,
65746
- actQueue: null,
65747
- isBatchingLegacy: false,
65748
- didScheduleLegacyUpdate: false,
65749
- didUsePromise: false,
65750
- thrownErrors: [],
65751
- getCurrentStack: null,
65752
- recentlyCreatedOwnerStacks: 0
65753
- }, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
65754
- return null;
65755
- };
65756
- deprecatedAPIs = {
65757
- react_stack_bottom_frame: function(callStackForError) {
65758
- return callStackForError();
65759
- }
65760
- };
65761
- var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
65762
- var didWarnAboutElementRef = {};
65763
- var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(deprecatedAPIs, UnknownOwner)();
65764
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
65765
- var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = typeof reportError === "function" ? reportError : function(error) {
65766
- if (typeof window === "object" && typeof window.ErrorEvent === "function") {
65767
- var event = new window.ErrorEvent("error", {
65768
- bubbles: true,
65769
- cancelable: true,
65770
- message: typeof error === "object" && error !== null && typeof error.message === "string" ? String(error.message) : String(error),
65771
- error
65772
- });
65773
- if (!window.dispatchEvent(event))
65774
- return;
65775
- } else if (typeof process === "object" && typeof process.emit === "function") {
65776
- process.emit("uncaughtException", error);
65777
- return;
65778
- }
65779
- console.error(error);
65780
- }, didWarnAboutMessageChannel = false, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = false, isFlushing = false, queueSeveralMicrotasks = typeof queueMicrotask === "function" ? function(callback) {
65781
- queueMicrotask(function() {
65782
- return queueMicrotask(callback);
65783
- });
65784
- } : enqueueTask;
65785
- deprecatedAPIs = Object.freeze({
65786
- __proto__: null,
65787
- c: function(size) {
65788
- return resolveDispatcher().useMemoCache(size);
65789
- }
65790
- });
65791
- exports.Children = {
65792
- map: mapChildren,
65793
- forEach: function(children, forEachFunc, forEachContext) {
65794
- mapChildren(children, function() {
65795
- forEachFunc.apply(this, arguments);
65796
- }, forEachContext);
65797
- },
65798
- count: function(children) {
65799
- var n2 = 0;
65800
- mapChildren(children, function() {
65801
- n2++;
65802
- });
65803
- return n2;
65804
- },
65805
- toArray: function(children) {
65806
- return mapChildren(children, function(child) {
65807
- return child;
65808
- }) || [];
65809
- },
65810
- only: function(children) {
65811
- if (!isValidElement(children))
65812
- throw Error("React.Children.only expected to receive a single React element child.");
65813
- return children;
65814
- }
65815
- };
65816
- exports.Component = Component;
65817
- exports.Fragment = REACT_FRAGMENT_TYPE;
65818
- exports.Profiler = REACT_PROFILER_TYPE;
65819
- exports.PureComponent = PureComponent2;
65820
- exports.StrictMode = REACT_STRICT_MODE_TYPE;
65821
- exports.Suspense = REACT_SUSPENSE_TYPE;
65822
- exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
65823
- exports.__COMPILER_RUNTIME = deprecatedAPIs;
65824
- exports.act = function(callback) {
65825
- var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
65826
- actScopeDepth++;
65827
- var queue = ReactSharedInternals.actQueue = prevActQueue !== null ? prevActQueue : [], didAwaitActCall = false;
65828
- try {
65829
- var result = callback();
65830
- } catch (error) {
65831
- ReactSharedInternals.thrownErrors.push(error);
65832
- }
65833
- if (0 < ReactSharedInternals.thrownErrors.length)
65834
- throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
65835
- if (result !== null && typeof result === "object" && typeof result.then === "function") {
65836
- var thenable = result;
65837
- queueSeveralMicrotasks(function() {
65838
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));
65839
- });
65840
- return {
65841
- then: function(resolve7, reject) {
65842
- didAwaitActCall = true;
65843
- thenable.then(function(returnValue) {
65844
- popActScope(prevActQueue, prevActScopeDepth);
65845
- if (prevActScopeDepth === 0) {
65846
- try {
65847
- flushActQueue(queue), enqueueTask(function() {
65848
- return recursivelyFlushAsyncActWork(returnValue, resolve7, reject);
65849
- });
65850
- } catch (error$0) {
65851
- ReactSharedInternals.thrownErrors.push(error$0);
65852
- }
65853
- if (0 < ReactSharedInternals.thrownErrors.length) {
65854
- var _thrownError = aggregateErrors(ReactSharedInternals.thrownErrors);
65855
- ReactSharedInternals.thrownErrors.length = 0;
65856
- reject(_thrownError);
65857
- }
65858
- } else
65859
- resolve7(returnValue);
65860
- }, function(error) {
65861
- popActScope(prevActQueue, prevActScopeDepth);
65862
- 0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
65863
- });
65864
- }
65865
- };
65866
- }
65867
- var returnValue$jscomp$0 = result;
65868
- popActScope(prevActQueue, prevActScopeDepth);
65869
- prevActScopeDepth === 0 && (flushActQueue(queue), queue.length !== 0 && queueSeveralMicrotasks(function() {
65870
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"));
65871
- }), ReactSharedInternals.actQueue = null);
65872
- if (0 < ReactSharedInternals.thrownErrors.length)
65873
- throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
65874
- return {
65875
- then: function(resolve7, reject) {
65876
- didAwaitActCall = true;
65877
- prevActScopeDepth === 0 ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
65878
- return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve7, reject);
65879
- })) : resolve7(returnValue$jscomp$0);
65880
- }
65881
- };
65882
- };
65883
- exports.cache = function(fn) {
65884
- return function() {
65885
- return fn.apply(null, arguments);
65886
- };
65887
- };
65888
- exports.captureOwnerStack = function() {
65889
- var getCurrentStack = ReactSharedInternals.getCurrentStack;
65890
- return getCurrentStack === null ? null : getCurrentStack();
65891
- };
65892
- exports.cloneElement = function(element, config, children) {
65893
- if (element === null || element === undefined)
65894
- throw Error("The argument must be a React element, but you passed " + element + ".");
65895
- var props = assign({}, element.props), key2 = element.key, owner = element._owner;
65896
- if (config != null) {
65897
- var JSCompiler_inline_result;
65898
- a: {
65899
- if (hasOwnProperty.call(config, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(config, "ref").get) && JSCompiler_inline_result.isReactWarning) {
65900
- JSCompiler_inline_result = false;
65901
- break a;
65902
- }
65903
- JSCompiler_inline_result = config.ref !== undefined;
65904
- }
65905
- JSCompiler_inline_result && (owner = getOwner());
65906
- hasValidKey(config) && (checkKeyStringCoercion(config.key), key2 = "" + config.key);
65907
- for (propName in config)
65908
- !hasOwnProperty.call(config, propName) || propName === "key" || propName === "__self" || propName === "__source" || propName === "ref" && config.ref === undefined || (props[propName] = config[propName]);
65909
- }
65910
- var propName = arguments.length - 2;
65911
- if (propName === 1)
65912
- props.children = children;
65913
- else if (1 < propName) {
65914
- JSCompiler_inline_result = Array(propName);
65915
- for (var i2 = 0;i2 < propName; i2++)
65916
- JSCompiler_inline_result[i2] = arguments[i2 + 2];
65917
- props.children = JSCompiler_inline_result;
65918
- }
65919
- props = ReactElement(element.type, key2, undefined, undefined, owner, props, element._debugStack, element._debugTask);
65920
- for (key2 = 2;key2 < arguments.length; key2++)
65921
- owner = arguments[key2], isValidElement(owner) && owner._store && (owner._store.validated = 1);
65922
- return props;
65923
- };
65924
- exports.createContext = function(defaultValue) {
65925
- defaultValue = {
65926
- $$typeof: REACT_CONTEXT_TYPE,
65927
- _currentValue: defaultValue,
65928
- _currentValue2: defaultValue,
65929
- _threadCount: 0,
65930
- Provider: null,
65931
- Consumer: null
65932
- };
65933
- defaultValue.Provider = defaultValue;
65934
- defaultValue.Consumer = {
65935
- $$typeof: REACT_CONSUMER_TYPE,
65936
- _context: defaultValue
65937
- };
65938
- defaultValue._currentRenderer = null;
65939
- defaultValue._currentRenderer2 = null;
65940
- return defaultValue;
65941
- };
65942
- exports.createElement = function(type, config, children) {
65943
- for (var i2 = 2;i2 < arguments.length; i2++) {
65944
- var node = arguments[i2];
65945
- isValidElement(node) && node._store && (node._store.validated = 1);
65946
- }
65947
- i2 = {};
65948
- node = null;
65949
- if (config != null)
65950
- for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = true, console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")), hasValidKey(config) && (checkKeyStringCoercion(config.key), node = "" + config.key), config)
65951
- hasOwnProperty.call(config, propName) && propName !== "key" && propName !== "__self" && propName !== "__source" && (i2[propName] = config[propName]);
65952
- var childrenLength = arguments.length - 2;
65953
- if (childrenLength === 1)
65954
- i2.children = children;
65955
- else if (1 < childrenLength) {
65956
- for (var childArray = Array(childrenLength), _i = 0;_i < childrenLength; _i++)
65957
- childArray[_i] = arguments[_i + 2];
65958
- Object.freeze && Object.freeze(childArray);
65959
- i2.children = childArray;
65960
- }
65961
- if (type && type.defaultProps)
65962
- for (propName in childrenLength = type.defaultProps, childrenLength)
65963
- i2[propName] === undefined && (i2[propName] = childrenLength[propName]);
65964
- node && defineKeyPropWarningGetter(i2, typeof type === "function" ? type.displayName || type.name || "Unknown" : type);
65965
- var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
65966
- return ReactElement(type, node, undefined, undefined, getOwner(), i2, propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack, propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
65967
- };
65968
- exports.createRef = function() {
65969
- var refObject = { current: null };
65970
- Object.seal(refObject);
65971
- return refObject;
65972
- };
65973
- exports.forwardRef = function(render2) {
65974
- render2 != null && render2.$$typeof === REACT_MEMO_TYPE ? console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).") : typeof render2 !== "function" ? console.error("forwardRef requires a render function but was given %s.", render2 === null ? "null" : typeof render2) : render2.length !== 0 && render2.length !== 2 && console.error("forwardRef render functions accept exactly two parameters: props and ref. %s", render2.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined.");
65975
- render2 != null && render2.defaultProps != null && console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");
65976
- var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render: render2 }, ownName;
65977
- Object.defineProperty(elementType, "displayName", {
65978
- enumerable: false,
65979
- configurable: true,
65980
- get: function() {
65981
- return ownName;
65982
- },
65983
- set: function(name) {
65984
- ownName = name;
65985
- render2.name || render2.displayName || (Object.defineProperty(render2, "name", { value: name }), render2.displayName = name);
65986
- }
65987
- });
65988
- return elementType;
65989
- };
65990
- exports.isValidElement = isValidElement;
65991
- exports.lazy = function(ctor) {
65992
- return {
65993
- $$typeof: REACT_LAZY_TYPE,
65994
- _payload: { _status: -1, _result: ctor },
65995
- _init: lazyInitializer
65996
- };
65997
- };
65998
- exports.memo = function(type, compare) {
65999
- type == null && console.error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
66000
- compare = {
66001
- $$typeof: REACT_MEMO_TYPE,
66002
- type,
66003
- compare: compare === undefined ? null : compare
66004
- };
66005
- var ownName;
66006
- Object.defineProperty(compare, "displayName", {
66007
- enumerable: false,
66008
- configurable: true,
66009
- get: function() {
66010
- return ownName;
66011
- },
66012
- set: function(name) {
66013
- ownName = name;
66014
- type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
66015
- }
66016
- });
66017
- return compare;
66018
- };
66019
- exports.startTransition = function(scope) {
66020
- var prevTransition = ReactSharedInternals.T, currentTransition = {};
66021
- ReactSharedInternals.T = currentTransition;
66022
- currentTransition._updatedFibers = new Set;
66023
- try {
66024
- var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
66025
- onStartTransitionFinish !== null && onStartTransitionFinish(currentTransition, returnValue);
66026
- typeof returnValue === "object" && returnValue !== null && typeof returnValue.then === "function" && returnValue.then(noop5, reportGlobalError);
66027
- } catch (error) {
66028
- reportGlobalError(error);
66029
- } finally {
66030
- prevTransition === null && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")), ReactSharedInternals.T = prevTransition;
66031
- }
66032
- };
66033
- exports.unstable_useCacheRefresh = function() {
66034
- return resolveDispatcher().useCacheRefresh();
66035
- };
66036
- exports.use = function(usable) {
66037
- return resolveDispatcher().use(usable);
66038
- };
66039
- exports.useActionState = function(action, initialState3, permalink) {
66040
- return resolveDispatcher().useActionState(action, initialState3, permalink);
66041
- };
66042
- exports.useCallback = function(callback, deps) {
66043
- return resolveDispatcher().useCallback(callback, deps);
66044
- };
66045
- exports.useContext = function(Context) {
66046
- var dispatcher = resolveDispatcher();
66047
- Context.$$typeof === REACT_CONSUMER_TYPE && console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?");
66048
- return dispatcher.useContext(Context);
66049
- };
66050
- exports.useDebugValue = function(value, formatterFn) {
66051
- return resolveDispatcher().useDebugValue(value, formatterFn);
66052
- };
66053
- exports.useDeferredValue = function(value, initialValue) {
66054
- return resolveDispatcher().useDeferredValue(value, initialValue);
66055
- };
66056
- exports.useEffect = function(create2, createDeps, update) {
66057
- create2 == null && console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?");
66058
- var dispatcher = resolveDispatcher();
66059
- if (typeof update === "function")
66060
- throw Error("useEffect CRUD overload is not enabled in this build of React.");
66061
- return dispatcher.useEffect(create2, createDeps);
66062
- };
66063
- exports.useId = function() {
66064
- return resolveDispatcher().useId();
66065
- };
66066
- exports.useImperativeHandle = function(ref, create2, deps) {
66067
- return resolveDispatcher().useImperativeHandle(ref, create2, deps);
66068
- };
66069
- exports.useInsertionEffect = function(create2, deps) {
66070
- create2 == null && console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?");
66071
- return resolveDispatcher().useInsertionEffect(create2, deps);
66072
- };
66073
- exports.useLayoutEffect = function(create2, deps) {
66074
- create2 == null && console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?");
66075
- return resolveDispatcher().useLayoutEffect(create2, deps);
66076
- };
66077
- exports.useMemo = function(create2, deps) {
66078
- return resolveDispatcher().useMemo(create2, deps);
66079
- };
66080
- exports.useOptimistic = function(passthrough, reducer) {
66081
- return resolveDispatcher().useOptimistic(passthrough, reducer);
66082
- };
66083
- exports.useReducer = function(reducer, initialArg, init) {
66084
- return resolveDispatcher().useReducer(reducer, initialArg, init);
66085
- };
66086
- exports.useRef = function(initialValue) {
66087
- return resolveDispatcher().useRef(initialValue);
66088
- };
66089
- exports.useState = function(initialState3) {
66090
- return resolveDispatcher().useState(initialState3);
66091
- };
66092
- exports.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
66093
- return resolveDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
66094
- };
66095
- exports.useTransition = function() {
66096
- return resolveDispatcher().useTransition();
66097
- };
66098
- exports.version = "19.1.1";
66099
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
66100
- })();
66101
- });
66102
-
66103
- // ../node_modules/.pnpm/react@19.1.1/node_modules/react/index.js
66104
- var require_react2 = __commonJS((exports, module) => {
66105
- var react_development = __toESM(require_react_development2());
66106
- if (false) {} else {
66107
- module.exports = react_development;
66108
- }
66109
- });
66110
-
66111
65507
  // ../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js
66112
65508
  var require_cjs = __commonJS((exports, module) => {
66113
65509
  var isMergeableObject = function isMergeableObject2(value) {
@@ -66544,7 +65940,7 @@ var init_theme15 = __esm(() => {
66544
65940
  init_theme12();
66545
65941
  init_theme13();
66546
65942
  init_theme14();
66547
- import_react57 = __toESM(require_react2(), 1);
65943
+ import_react57 = __toESM(require_react(), 1);
66548
65944
  import_deepmerge = __toESM(require_cjs(), 1);
66549
65945
  defaultTheme2 = {
66550
65946
  components: {
@@ -66571,7 +65967,7 @@ var import_react58;
66571
65967
  var init_badge = __esm(async () => {
66572
65968
  init_theme15();
66573
65969
  await init_build2();
66574
- import_react58 = __toESM(require_react2(), 1);
65970
+ import_react58 = __toESM(require_react(), 1);
66575
65971
  });
66576
65972
 
66577
65973
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/badge/index.js
@@ -66584,7 +65980,7 @@ var import_react59;
66584
65980
  var init_confirm_input = __esm(async () => {
66585
65981
  init_theme15();
66586
65982
  await init_build2();
66587
- import_react59 = __toESM(require_react2(), 1);
65983
+ import_react59 = __toESM(require_react(), 1);
66588
65984
  });
66589
65985
 
66590
65986
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/confirm-input/index.js
@@ -66603,7 +65999,7 @@ var init_constants2 = __esm(() => {
66603
65999
  var import_react60, UnorderedListItemContext;
66604
66000
  var init_unordered_list_item_context = __esm(() => {
66605
66001
  init_constants2();
66606
- import_react60 = __toESM(require_react2(), 1);
66002
+ import_react60 = __toESM(require_react(), 1);
66607
66003
  UnorderedListItemContext = import_react60.createContext({
66608
66004
  marker: defaultMarker
66609
66005
  });
@@ -66620,13 +66016,13 @@ var init_unordered_list_item = __esm(async () => {
66620
66016
  init_theme15();
66621
66017
  init_unordered_list_item_context();
66622
66018
  await init_build2();
66623
- import_react61 = __toESM(require_react2(), 1);
66019
+ import_react61 = __toESM(require_react(), 1);
66624
66020
  });
66625
66021
 
66626
66022
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/unordered-list/unordered-list-context.js
66627
66023
  var import_react62, UnorderedListContext;
66628
66024
  var init_unordered_list_context = __esm(() => {
66629
- import_react62 = __toESM(require_react2(), 1);
66025
+ import_react62 = __toESM(require_react(), 1);
66630
66026
  UnorderedListContext = import_react62.createContext({
66631
66027
  depth: 0
66632
66028
  });
@@ -66665,7 +66061,7 @@ var init_unordered_list = __esm(async () => {
66665
66061
  init_build2(),
66666
66062
  init_unordered_list_item()
66667
66063
  ]);
66668
- import_react63 = __toESM(require_react2(), 1);
66064
+ import_react63 = __toESM(require_react(), 1);
66669
66065
  UnorderedList.Item = UnorderedListItem;
66670
66066
  });
66671
66067
 
@@ -66684,7 +66080,7 @@ var init_multi_select_option = __esm(async () => {
66684
66080
  init_figures();
66685
66081
  init_theme15();
66686
66082
  await init_build2();
66687
- import_react64 = __toESM(require_react2(), 1);
66083
+ import_react64 = __toESM(require_react(), 1);
66688
66084
  });
66689
66085
 
66690
66086
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/lib/option-map.js
@@ -66867,7 +66263,7 @@ var import_react65, reducer = (state, action) => {
66867
66263
  };
66868
66264
  var init_use_multi_select_state = __esm(() => {
66869
66265
  init_option_map();
66870
- import_react65 = __toESM(require_react2(), 1);
66266
+ import_react65 = __toESM(require_react(), 1);
66871
66267
  });
66872
66268
 
66873
66269
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/multi-select/use-multi-select.js
@@ -66920,7 +66316,7 @@ var init_multi_select = __esm(async () => {
66920
66316
  init_multi_select_option(),
66921
66317
  init_use_multi_select()
66922
66318
  ]);
66923
- import_react66 = __toESM(require_react2(), 1);
66319
+ import_react66 = __toESM(require_react(), 1);
66924
66320
  });
66925
66321
 
66926
66322
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/multi-select/index.js
@@ -66948,7 +66344,7 @@ var import_react67;
66948
66344
  var init_progress_bar = __esm(async () => {
66949
66345
  init_theme15();
66950
66346
  await init_build2();
66951
- import_react67 = __toESM(require_react2(), 1);
66347
+ import_react67 = __toESM(require_react(), 1);
66952
66348
  });
66953
66349
 
66954
66350
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/progress-bar/index.js
@@ -66957,190 +66353,26 @@ var init_progress_bar2 = __esm(async () => {
66957
66353
  });
66958
66354
 
66959
66355
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/select/select-option.js
66960
- function SelectOption({ isFocused, isSelected, children }) {
66961
- const { styles: styles7 } = useComponentTheme("Select");
66962
- return import_react68.default.createElement(Box_default, { ...styles7.option({ isFocused }) }, isFocused && import_react68.default.createElement(Text, { ...styles7.focusIndicator() }, figures_default.pointer), import_react68.default.createElement(Text, { ...styles7.label({ isFocused, isSelected }) }, children), isSelected && import_react68.default.createElement(Text, { ...styles7.selectedIndicator() }, figures_default.tick));
66963
- }
66964
66356
  var import_react68;
66965
66357
  var init_select_option = __esm(async () => {
66966
- init_figures();
66967
66358
  init_theme15();
66968
66359
  await init_build2();
66969
- import_react68 = __toESM(require_react2(), 1);
66360
+ import_react68 = __toESM(require_react(), 1);
66970
66361
  });
66971
66362
 
66972
66363
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/select/use-select-state.js
66973
- import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
66974
- var import_react69, reducer2 = (state, action) => {
66975
- switch (action.type) {
66976
- case "focus-next-option": {
66977
- if (!state.focusedValue) {
66978
- return state;
66979
- }
66980
- const item = state.optionMap.get(state.focusedValue);
66981
- if (!item) {
66982
- return state;
66983
- }
66984
- const next = item.next;
66985
- if (!next) {
66986
- return state;
66987
- }
66988
- const needsToScroll = next.index >= state.visibleToIndex;
66989
- if (!needsToScroll) {
66990
- return {
66991
- ...state,
66992
- focusedValue: next.value
66993
- };
66994
- }
66995
- const nextVisibleToIndex = Math.min(state.optionMap.size, state.visibleToIndex + 1);
66996
- const nextVisibleFromIndex = nextVisibleToIndex - state.visibleOptionCount;
66997
- return {
66998
- ...state,
66999
- focusedValue: next.value,
67000
- visibleFromIndex: nextVisibleFromIndex,
67001
- visibleToIndex: nextVisibleToIndex
67002
- };
67003
- }
67004
- case "focus-previous-option": {
67005
- if (!state.focusedValue) {
67006
- return state;
67007
- }
67008
- const item = state.optionMap.get(state.focusedValue);
67009
- if (!item) {
67010
- return state;
67011
- }
67012
- const previous = item.previous;
67013
- if (!previous) {
67014
- return state;
67015
- }
67016
- const needsToScroll = previous.index <= state.visibleFromIndex;
67017
- if (!needsToScroll) {
67018
- return {
67019
- ...state,
67020
- focusedValue: previous.value
67021
- };
67022
- }
67023
- const nextVisibleFromIndex = Math.max(0, state.visibleFromIndex - 1);
67024
- const nextVisibleToIndex = nextVisibleFromIndex + state.visibleOptionCount;
67025
- return {
67026
- ...state,
67027
- focusedValue: previous.value,
67028
- visibleFromIndex: nextVisibleFromIndex,
67029
- visibleToIndex: nextVisibleToIndex
67030
- };
67031
- }
67032
- case "select-focused-option": {
67033
- return {
67034
- ...state,
67035
- previousValue: state.value,
67036
- value: state.focusedValue
67037
- };
67038
- }
67039
- case "reset": {
67040
- return action.state;
67041
- }
67042
- }
67043
- }, createDefaultState2 = ({ visibleOptionCount: customVisibleOptionCount, defaultValue, options }) => {
67044
- const visibleOptionCount = typeof customVisibleOptionCount === "number" ? Math.min(customVisibleOptionCount, options.length) : options.length;
67045
- const optionMap = new OptionMap(options);
67046
- return {
67047
- optionMap,
67048
- visibleOptionCount,
67049
- focusedValue: optionMap.first?.value,
67050
- visibleFromIndex: 0,
67051
- visibleToIndex: visibleOptionCount,
67052
- previousValue: defaultValue,
67053
- value: defaultValue
67054
- };
67055
- }, useSelectState = ({ visibleOptionCount = 5, options, defaultValue, onChange }) => {
67056
- const [state, dispatch] = import_react69.useReducer(reducer2, { visibleOptionCount, defaultValue, options }, createDefaultState2);
67057
- const [lastOptions, setLastOptions] = import_react69.useState(options);
67058
- if (options !== lastOptions && !isDeepStrictEqual3(options, lastOptions)) {
67059
- dispatch({
67060
- type: "reset",
67061
- state: createDefaultState2({ visibleOptionCount, defaultValue, options })
67062
- });
67063
- setLastOptions(options);
67064
- }
67065
- const focusNextOption = import_react69.useCallback(() => {
67066
- dispatch({
67067
- type: "focus-next-option"
67068
- });
67069
- }, []);
67070
- const focusPreviousOption = import_react69.useCallback(() => {
67071
- dispatch({
67072
- type: "focus-previous-option"
67073
- });
67074
- }, []);
67075
- const selectFocusedOption = import_react69.useCallback(() => {
67076
- dispatch({
67077
- type: "select-focused-option"
67078
- });
67079
- }, []);
67080
- const visibleOptions = import_react69.useMemo(() => {
67081
- return options.map((option, index) => ({
67082
- ...option,
67083
- index
67084
- })).slice(state.visibleFromIndex, state.visibleToIndex);
67085
- }, [options, state.visibleFromIndex, state.visibleToIndex]);
67086
- import_react69.useEffect(() => {
67087
- if (state.value && state.previousValue !== state.value) {
67088
- onChange?.(state.value);
67089
- }
67090
- }, [state.previousValue, state.value, options, onChange]);
67091
- return {
67092
- focusedValue: state.focusedValue,
67093
- visibleFromIndex: state.visibleFromIndex,
67094
- visibleToIndex: state.visibleToIndex,
67095
- value: state.value,
67096
- visibleOptions,
67097
- focusNextOption,
67098
- focusPreviousOption,
67099
- selectFocusedOption
67100
- };
67101
- };
66364
+ var import_react69;
67102
66365
  var init_use_select_state = __esm(() => {
67103
66366
  init_option_map();
67104
- import_react69 = __toESM(require_react2(), 1);
66367
+ import_react69 = __toESM(require_react(), 1);
67105
66368
  });
67106
66369
 
67107
66370
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/select/use-select.js
67108
- var useSelect = ({ isDisabled = false, state }) => {
67109
- use_input_default((_input, key2) => {
67110
- if (key2.downArrow) {
67111
- state.focusNextOption();
67112
- }
67113
- if (key2.upArrow) {
67114
- state.focusPreviousOption();
67115
- }
67116
- if (key2.return) {
67117
- state.selectFocusedOption();
67118
- }
67119
- }, { isActive: !isDisabled });
67120
- };
67121
66371
  var init_use_select = __esm(async () => {
67122
66372
  await init_build2();
67123
66373
  });
67124
66374
 
67125
66375
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/select/select.js
67126
- function Select({ isDisabled = false, visibleOptionCount = 5, highlightText, options, defaultValue, onChange }) {
67127
- const state = useSelectState({
67128
- visibleOptionCount,
67129
- options,
67130
- defaultValue,
67131
- onChange
67132
- });
67133
- useSelect({ isDisabled, state });
67134
- const { styles: styles7 } = useComponentTheme("Select");
67135
- return import_react70.default.createElement(Box_default, { ...styles7.container() }, state.visibleOptions.map((option) => {
67136
- let label = option.label;
67137
- if (highlightText && option.label.includes(highlightText)) {
67138
- const index = option.label.indexOf(highlightText);
67139
- label = import_react70.default.createElement(import_react70.default.Fragment, null, option.label.slice(0, index), import_react70.default.createElement(Text, { ...styles7.highlightedText() }, highlightText), option.label.slice(index + highlightText.length));
67140
- }
67141
- return import_react70.default.createElement(SelectOption, { key: option.value, isFocused: !isDisabled && state.focusedValue === option.value, isSelected: state.value === option.value }, label);
67142
- }));
67143
- }
67144
66376
  var import_react70;
67145
66377
  var init_select = __esm(async () => {
67146
66378
  init_theme15();
@@ -67150,7 +66382,7 @@ var init_select = __esm(async () => {
67150
66382
  init_select_option(),
67151
66383
  init_use_select()
67152
66384
  ]);
67153
- import_react70 = __toESM(require_react2(), 1);
66385
+ import_react70 = __toESM(require_react(), 1);
67154
66386
  });
67155
66387
 
67156
66388
  // ../node_modules/.pnpm/cli-spinners@3.4.0/node_modules/cli-spinners/spinners.json
@@ -68885,7 +68117,7 @@ function useSpinner({ type = "dots" }) {
68885
68117
  var import_react71;
68886
68118
  var init_use_spinner = __esm(() => {
68887
68119
  init_cli_spinners();
68888
- import_react71 = __toESM(require_react2(), 1);
68120
+ import_react71 = __toESM(require_react(), 1);
68889
68121
  });
68890
68122
 
68891
68123
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/spinner/spinner.js
@@ -68899,7 +68131,7 @@ var init_spinner = __esm(async () => {
68899
68131
  init_theme15();
68900
68132
  init_use_spinner();
68901
68133
  await init_build2();
68902
- import_react72 = __toESM(require_react2(), 1);
68134
+ import_react72 = __toESM(require_react(), 1);
68903
68135
  });
68904
68136
 
68905
68137
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/spinner/index.js
@@ -68909,7 +68141,7 @@ var init_spinner2 = __esm(async () => {
68909
68141
  });
68910
68142
 
68911
68143
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/text-input/use-text-input-state.js
68912
- var import_react73, reducer3 = (state, action) => {
68144
+ var import_react73, reducer2 = (state, action) => {
68913
68145
  switch (action.type) {
68914
68146
  case "move-cursor-left": {
68915
68147
  return {
@@ -68942,7 +68174,7 @@ var import_react73, reducer3 = (state, action) => {
68942
68174
  }
68943
68175
  }
68944
68176
  }, useTextInputState = ({ defaultValue = "", suggestions, onChange, onSubmit }) => {
68945
- const [state, dispatch] = import_react73.useReducer(reducer3, {
68177
+ const [state, dispatch] = import_react73.useReducer(reducer2, {
68946
68178
  previousValue: defaultValue,
68947
68179
  value: defaultValue,
68948
68180
  cursorOffset: defaultValue.length
@@ -68998,7 +68230,7 @@ var import_react73, reducer3 = (state, action) => {
68998
68230
  };
68999
68231
  };
69000
68232
  var init_use_text_input_state = __esm(() => {
69001
- import_react73 = __toESM(require_react2(), 1);
68233
+ import_react73 = __toESM(require_react(), 1);
69002
68234
  });
69003
68235
 
69004
68236
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/text-input/use-text-input.js
@@ -69057,7 +68289,7 @@ var import_react74, cursor, useTextInput = ({ isDisabled = false, state, placeho
69057
68289
  var init_use_text_input = __esm(async () => {
69058
68290
  init_source2();
69059
68291
  await init_build2();
69060
- import_react74 = __toESM(require_react2(), 1);
68292
+ import_react74 = __toESM(require_react(), 1);
69061
68293
  cursor = source_default2.inverse(" ");
69062
68294
  });
69063
68295
 
@@ -69085,7 +68317,7 @@ var init_text_input = __esm(async () => {
69085
68317
  init_build2(),
69086
68318
  init_use_text_input()
69087
68319
  ]);
69088
- import_react75 = __toESM(require_react2(), 1);
68320
+ import_react75 = __toESM(require_react(), 1);
69089
68321
  });
69090
68322
 
69091
68323
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/text-input/index.js
@@ -69097,7 +68329,7 @@ var init_text_input2 = __esm(async () => {
69097
68329
  var import_react76, OrderedListItemContext;
69098
68330
  var init_ordered_list_item_context = __esm(() => {
69099
68331
  init_figures();
69100
- import_react76 = __toESM(require_react2(), 1);
68332
+ import_react76 = __toESM(require_react(), 1);
69101
68333
  OrderedListItemContext = import_react76.createContext({
69102
68334
  marker: figures_default.line
69103
68335
  });
@@ -69114,13 +68346,13 @@ var init_ordered_list_item = __esm(async () => {
69114
68346
  init_theme15();
69115
68347
  init_ordered_list_item_context();
69116
68348
  await init_build2();
69117
- import_react77 = __toESM(require_react2(), 1);
68349
+ import_react77 = __toESM(require_react(), 1);
69118
68350
  });
69119
68351
 
69120
68352
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/ordered-list/ordered-list-context.js
69121
68353
  var import_react78, OrderedListContext;
69122
68354
  var init_ordered_list_context = __esm(() => {
69123
- import_react78 = __toESM(require_react2(), 1);
68355
+ import_react78 = __toESM(require_react(), 1);
69124
68356
  OrderedListContext = import_react78.createContext({
69125
68357
  marker: ""
69126
68358
  });
@@ -69156,7 +68388,7 @@ var init_ordered_list = __esm(async () => {
69156
68388
  init_build2(),
69157
68389
  init_ordered_list_item()
69158
68390
  ]);
69159
- import_react79 = __toESM(require_react2(), 1);
68391
+ import_react79 = __toESM(require_react(), 1);
69160
68392
  OrderedList.Item = OrderedListItem;
69161
68393
  });
69162
68394
 
@@ -69168,7 +68400,7 @@ var init_ordered_list2 = __esm(async () => {
69168
68400
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/password-input/use-password-input-state.js
69169
68401
  var import_react80;
69170
68402
  var init_use_password_input_state = __esm(() => {
69171
- import_react80 = __toESM(require_react2(), 1);
68403
+ import_react80 = __toESM(require_react(), 1);
69172
68404
  });
69173
68405
 
69174
68406
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/password-input/use-password-input.js
@@ -69176,7 +68408,7 @@ var import_react81, cursor2;
69176
68408
  var init_use_password_input = __esm(async () => {
69177
68409
  init_source2();
69178
68410
  await init_build2();
69179
- import_react81 = __toESM(require_react2(), 1);
68411
+ import_react81 = __toESM(require_react(), 1);
69180
68412
  cursor2 = source_default2.inverse(" ");
69181
68413
  });
69182
68414
 
@@ -69189,7 +68421,7 @@ var init_password_input = __esm(async () => {
69189
68421
  init_build2(),
69190
68422
  init_use_password_input()
69191
68423
  ]);
69192
- import_react82 = __toESM(require_react2(), 1);
68424
+ import_react82 = __toESM(require_react(), 1);
69193
68425
  });
69194
68426
 
69195
68427
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/password-input/index.js
@@ -69202,7 +68434,7 @@ var import_react83;
69202
68434
  var init_status_message = __esm(async () => {
69203
68435
  init_theme15();
69204
68436
  await init_build2();
69205
- import_react83 = __toESM(require_react2(), 1);
68437
+ import_react83 = __toESM(require_react(), 1);
69206
68438
  });
69207
68439
 
69208
68440
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/status-message/index.js
@@ -69215,7 +68447,7 @@ var import_react84;
69215
68447
  var init_alert = __esm(async () => {
69216
68448
  init_theme15();
69217
68449
  await init_build2();
69218
- import_react84 = __toESM(require_react2(), 1);
68450
+ import_react84 = __toESM(require_react(), 1);
69219
68451
  });
69220
68452
 
69221
68453
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/alert/index.js
@@ -69226,7 +68458,7 @@ var init_alert2 = __esm(async () => {
69226
68458
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/email-input/use-email-input-state.js
69227
68459
  var import_react85;
69228
68460
  var init_use_email_input_state = __esm(() => {
69229
- import_react85 = __toESM(require_react2(), 1);
68461
+ import_react85 = __toESM(require_react(), 1);
69230
68462
  });
69231
68463
 
69232
68464
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/email-input/use-email-input.js
@@ -69234,7 +68466,7 @@ var import_react86, cursor3;
69234
68466
  var init_use_email_input = __esm(async () => {
69235
68467
  init_source2();
69236
68468
  await init_build2();
69237
- import_react86 = __toESM(require_react2(), 1);
68469
+ import_react86 = __toESM(require_react(), 1);
69238
68470
  cursor3 = source_default2.inverse(" ");
69239
68471
  });
69240
68472
 
@@ -69247,7 +68479,7 @@ var init_email_input = __esm(async () => {
69247
68479
  init_build2(),
69248
68480
  init_use_email_input()
69249
68481
  ]);
69250
- import_react87 = __toESM(require_react2(), 1);
68482
+ import_react87 = __toESM(require_react(), 1);
69251
68483
  });
69252
68484
 
69253
68485
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/email-input/index.js
@@ -80276,7 +79508,7 @@ var init_uint8array_extras = __esm(() => {
80276
79508
  });
80277
79509
 
80278
79510
  // ../node_modules/.pnpm/conf@13.1.0/node_modules/conf/dist/source/index.js
80279
- import { isDeepStrictEqual as isDeepStrictEqual4 } from "node:util";
79511
+ import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
80280
79512
  import process38 from "node:process";
80281
79513
  import fs17 from "node:fs";
80282
79514
  import path17 from "node:path";
@@ -80514,7 +79746,7 @@ var init_source4 = __esm(() => {
80514
79746
  const onChange = () => {
80515
79747
  const oldValue = currentValue;
80516
79748
  const newValue = getter();
80517
- if (isDeepStrictEqual4(newValue, oldValue)) {
79749
+ if (isDeepStrictEqual3(newValue, oldValue)) {
80518
79750
  return;
80519
79751
  }
80520
79752
  currentValue = newValue;
@@ -80823,7 +80055,7 @@ function HeadlessInitFlow() {
80823
80055
  /* @__PURE__ */ jsx_dev_runtime43.jsxDEV(Text, {
80824
80056
  children: "Checking authentication..."
80825
80057
  }, undefined, false, undefined, this),
80826
- authState === "waiting" && /* @__PURE__ */ jsx_dev_runtime43.jsxDEV(Text, {
80058
+ authState === "authenticating" && /* @__PURE__ */ jsx_dev_runtime43.jsxDEV(Text, {
80827
80059
  dimColor: true,
80828
80060
  children: "Waiting for authentication... (timeout: 5 minutes)"
80829
80061
  }, undefined, false, undefined, this),
@@ -83489,7 +82721,7 @@ class CustomersController {
83489
82721
  offset
83490
82722
  };
83491
82723
  if (this.searchQuery.trim()) {
83492
- body.search = this.searchQuery.trim();
82724
+ body["search"] = this.searchQuery.trim();
83493
82725
  }
83494
82726
  const response = await request({
83495
82727
  method: "POST",
@@ -83532,7 +82764,7 @@ class CustomersController {
83532
82764
  selectByIndex(index) {
83533
82765
  if (index >= 0 && index < this.items.length) {
83534
82766
  this.selectedIndex = index;
83535
- return this.items[index];
82767
+ return this.items[index] ?? null;
83536
82768
  }
83537
82769
  return null;
83538
82770
  }
@@ -83540,21 +82772,21 @@ class CustomersController {
83540
82772
  const index = this.items.findIndex((c3) => c3.id === id);
83541
82773
  if (index !== -1) {
83542
82774
  this.selectedIndex = index;
83543
- return this.items[index];
82775
+ return this.items[index] ?? null;
83544
82776
  }
83545
82777
  return null;
83546
82778
  }
83547
82779
  selectPrev() {
83548
82780
  if (this.selectedIndex > 0) {
83549
82781
  this.selectedIndex--;
83550
- return this.items[this.selectedIndex];
82782
+ return this.items[this.selectedIndex] ?? null;
83551
82783
  }
83552
82784
  return null;
83553
82785
  }
83554
82786
  selectNext() {
83555
82787
  if (this.selectedIndex < this.items.length - 1) {
83556
82788
  this.selectedIndex++;
83557
- return this.items[this.selectedIndex];
82789
+ return this.items[this.selectedIndex] ?? null;
83558
82790
  }
83559
82791
  return null;
83560
82792
  }
@@ -83839,12 +83071,12 @@ function outputSingleCustomer(customer, format2) {
83839
83071
  const featureName = balance.feature?.name ?? balance.feature_id;
83840
83072
  if (balance.unlimited) {
83841
83073
  console.log(` - ${featureName}: Unlimited`);
83842
- } else if (balance.balance !== undefined) {
83843
- const used = balance.used ?? 0;
83844
- const total = balance.balance;
83074
+ } else if (balance.feature?.type !== "boolean") {
83075
+ const used = balance.usage;
83076
+ const total = balance.current_balance;
83845
83077
  console.log(` - ${featureName}: ${used}/${total} used`);
83846
83078
  } else {
83847
- console.log(` - ${featureName}: ${balance.enabled ? "ON" : "OFF"}`);
83079
+ console.log(` - ${featureName}: ON`);
83848
83080
  }
83849
83081
  }
83850
83082
  }
@@ -85700,22 +84932,23 @@ var formatAmount = ({
85700
84932
  return `${firstAmount} - ${lastAmount}`;
85701
84933
  };
85702
84934
 
85703
- // src/commands/preview/planFeatureToItem.ts
84935
+ // src/commands/preview/planItemToItem.ts
85704
84936
  var planFeatureToItem = ({
85705
84937
  planFeature
85706
84938
  }) => {
85707
- const pf = planFeature;
85708
- const includedValue = planFeature.included ?? pf.granted;
84939
+ const pi = planFeature;
84940
+ const includedValue = planFeature.included ?? pi.granted;
85709
84941
  const interval = planFeature.reset?.interval ?? planFeature.price?.interval ?? null;
85710
- const intervalCount = planFeature.reset?.interval_count ?? planFeature.price?.interval_count ?? null;
84942
+ const priceWithInterval = planFeature.price;
84943
+ const intervalCount = planFeature.reset?.intervalCount ?? priceWithInterval?.intervalCount ?? null;
85711
84944
  return {
85712
- feature_id: planFeature.feature_id,
84945
+ feature_id: planFeature.featureId,
85713
84946
  included_usage: planFeature.unlimited ? "inf" : includedValue ?? null,
85714
84947
  interval,
85715
84948
  interval_count: intervalCount,
85716
84949
  price: planFeature.price?.amount ?? null,
85717
84950
  tiers: planFeature.price?.tiers ?? null,
85718
- billing_units: planFeature.price?.billing_units ?? null
84951
+ billing_units: planFeature.price?.billingUnits ?? null
85719
84952
  };
85720
84953
  }, featureToDisplayFeature = ({
85721
84954
  feature
@@ -85878,15 +85111,15 @@ var getIntervalDisplay = (item) => {
85878
85111
  }
85879
85112
  }
85880
85113
  let freeTrial;
85881
- if (plan.free_trial) {
85882
- const { duration_length, duration_type } = plan.free_trial;
85883
- const durationUnit = duration_length === 1 ? duration_type : `${duration_type}s`;
85884
- freeTrial = `${duration_length} ${durationUnit} free trial`;
85114
+ if (plan.freeTrial) {
85115
+ const { durationLength, durationType } = plan.freeTrial;
85116
+ const durationUnit = durationLength === 1 ? durationType : `${durationType}s`;
85117
+ freeTrial = `${durationLength} ${durationUnit} free trial`;
85885
85118
  }
85886
85119
  const featureDisplays = [];
85887
85120
  if (plan.items) {
85888
85121
  for (const planFeature of plan.items) {
85889
- const feature = features5.find((f) => f.id === planFeature.feature_id);
85122
+ const feature = features5.find((f) => f.id === planFeature.featureId);
85890
85123
  if (feature) {
85891
85124
  const display = getPlanFeatureDisplay({
85892
85125
  planFeature,
@@ -85896,7 +85129,7 @@ var getIntervalDisplay = (item) => {
85896
85129
  featureDisplays.push(display);
85897
85130
  } else {
85898
85131
  featureDisplays.push({
85899
- primary_text: planFeature.feature_id
85132
+ primary_text: planFeature.featureId
85900
85133
  });
85901
85134
  }
85902
85135
  }
@@ -87013,6 +86246,8 @@ function renderStackedChart(list, binSize) {
87013
86246
  let foundGroup = false;
87014
86247
  for (let i2 = 0;i2 < groupKeys.length; i2++) {
87015
86248
  const groupKey = groupKeys[i2];
86249
+ if (!groupKey)
86250
+ continue;
87016
86251
  const groupVal = bucket.groupValues[groupKey] ?? 0;
87017
86252
  const prevCumulative = cumulative;
87018
86253
  cumulative += groupVal;
@@ -87418,7 +86653,7 @@ function useChartDimensions() {
87418
86653
  return { maxBarHeight, maxBuckets };
87419
86654
  }
87420
86655
  function getGroupColor(index) {
87421
- return GROUP_COLORS2[index % GROUP_COLORS2.length];
86656
+ return GROUP_COLORS2[index % GROUP_COLORS2.length] ?? "blue";
87422
86657
  }
87423
86658
  function hasGroupedData(data) {
87424
86659
  return data.some((bucket) => Object.keys(bucket.groupedValues).length > 0);
@@ -87579,6 +86814,8 @@ function StackedChart({
87579
86814
  let foundColor = "gray";
87580
86815
  for (let i2 = 0;i2 < groupKeys.length; i2++) {
87581
86816
  const groupKey = groupKeys[i2];
86817
+ if (!groupKey)
86818
+ continue;
87582
86819
  const groupVal = bucket.groupTotals[groupKey] ?? 0;
87583
86820
  const prevCumulative = cumulative;
87584
86821
  cumulative += groupVal;
@@ -88289,24 +87526,27 @@ function EventsView({
88289
87526
  };
88290
87527
  const titleBarItems = [];
88291
87528
  titleBarItems.push({
88292
- label: viewMode === "aggregate" ? "Aggregate" : "List",
87529
+ label: "View",
87530
+ value: viewMode === "aggregate" ? "Aggregate" : "List",
88293
87531
  color: viewMode === "aggregate" ? "yellow" : "white"
88294
87532
  });
88295
87533
  if (viewMode === "aggregate") {
88296
87534
  const binSizeLabel = BIN_SIZE_OPTIONS.find((t) => t.value === binSize)?.label ?? binSize;
88297
87535
  titleBarItems.push({
88298
- label: binSizeLabel,
87536
+ label: "Bin",
87537
+ value: binSizeLabel,
88299
87538
  color: "cyan"
88300
87539
  });
88301
87540
  }
88302
87541
  if (hasActiveFilters || cliCustomerId || cliFeatureId) {
88303
87542
  titleBarItems.push({
88304
- label: "Filtered",
87543
+ label: "Filter",
87544
+ value: "active",
88305
87545
  color: "cyan"
88306
87546
  });
88307
87547
  }
88308
87548
  const showFilterPanel = isFilterOpen;
88309
- const showDetailSheet = state.sheetOpen && state.selectedItem && !isFilterOpen && viewMode === "list";
87549
+ const showDetailSheet = state.sheetOpen && !!state.selectedItem && !isFilterOpen && viewMode === "list";
88310
87550
  const sideOpen = showFilterPanel || showDetailSheet;
88311
87551
  const getAggregatePaginationText = () => {
88312
87552
  try {
@@ -88429,7 +87669,7 @@ function EventsView({
88429
87669
  }, undefined, true, undefined, this)
88430
87670
  ]
88431
87671
  }, undefined, true, undefined, this) : showDetailSheet ? /* @__PURE__ */ jsx_dev_runtime77.jsxDEV(EventSheet, {
88432
- event: state?.selectedItem,
87672
+ event: state.selectedItem,
88433
87673
  isFocused: state?.focusTarget === "sheet",
88434
87674
  copiedFeedback: showingFeedback
88435
87675
  }, undefined, false, undefined, this) : undefined,
@@ -88615,6 +87855,256 @@ var init_events3 = __esm(async () => {
88615
87855
  await init_command7();
88616
87856
  });
88617
87857
 
87858
+ // src/commands/test-diff/command.ts
87859
+ import fs18 from "node:fs";
87860
+ import { resolve as resolve9 } from "node:path";
87861
+ import { pathToFileURL as pathToFileURL4 } from "node:url";
87862
+ import createJiti4 from "jiti";
87863
+ function valuesEqual2(a2, b) {
87864
+ if (a2 === b)
87865
+ return true;
87866
+ if (a2 == null && b == null)
87867
+ return true;
87868
+ if (a2 == null || b == null)
87869
+ return false;
87870
+ if (typeof a2 !== typeof b)
87871
+ return false;
87872
+ if (Array.isArray(a2) && Array.isArray(b)) {
87873
+ if (a2.length !== b.length)
87874
+ return false;
87875
+ return a2.every((item, i2) => valuesEqual2(item, b[i2]));
87876
+ }
87877
+ if (typeof a2 === "object" && typeof b === "object") {
87878
+ const aObj = a2;
87879
+ const bObj = b;
87880
+ const allKeys = new Set([...Object.keys(aObj), ...Object.keys(bObj)]);
87881
+ for (const key2 of allKeys) {
87882
+ if (!valuesEqual2(aObj[key2], bObj[key2]))
87883
+ return false;
87884
+ }
87885
+ return true;
87886
+ }
87887
+ return false;
87888
+ }
87889
+ function normalizeFeatureForCompare2(f) {
87890
+ const result = { id: f.id, name: f.name, type: f.type };
87891
+ if (f.type === "metered" && "consumable" in f) {
87892
+ result.consumable = f.consumable;
87893
+ }
87894
+ if (f.eventNames && f.eventNames.length > 0) {
87895
+ result.eventNames = [...f.eventNames].sort();
87896
+ }
87897
+ if (f.creditSchema && f.creditSchema.length > 0) {
87898
+ result.creditSchema = [...f.creditSchema].sort((a2, b) => a2.meteredFeatureId.localeCompare(b.meteredFeatureId)).map((cs) => ({ meteredFeatureId: cs.meteredFeatureId, creditCost: cs.creditCost }));
87899
+ }
87900
+ return result;
87901
+ }
87902
+ function normalizePlanFeatureForCompare2(pf) {
87903
+ const result = { featureId: pf.featureId };
87904
+ if (pf.included != null && pf.included !== 0)
87905
+ result.included = pf.included;
87906
+ if (pf.unlimited === true)
87907
+ result.unlimited = true;
87908
+ const reset2 = pf.reset;
87909
+ if (reset2 != null) {
87910
+ const r = { interval: reset2.interval };
87911
+ if (reset2.intervalCount != null && reset2.intervalCount !== 1)
87912
+ r.intervalCount = reset2.intervalCount;
87913
+ result.reset = r;
87914
+ }
87915
+ const price = pf.price;
87916
+ if (price != null) {
87917
+ const p = {};
87918
+ if (price.amount != null)
87919
+ p.amount = price.amount;
87920
+ if (price.billingMethod != null)
87921
+ p.billingMethod = price.billingMethod;
87922
+ if (price.interval != null)
87923
+ p.interval = price.interval;
87924
+ if (price.intervalCount != null && price.intervalCount !== 1)
87925
+ p.intervalCount = price.intervalCount;
87926
+ if (price.tiers != null && Array.isArray(price.tiers) && price.tiers.length > 0)
87927
+ p.tiers = price.tiers;
87928
+ if (price.billingUnits != null && price.billingUnits !== 1)
87929
+ p.billingUnits = price.billingUnits;
87930
+ if (price.maxPurchase != null)
87931
+ p.maxPurchase = price.maxPurchase;
87932
+ if (Object.keys(p).length > 0)
87933
+ result.price = p;
87934
+ }
87935
+ const proration = pf.proration;
87936
+ if (proration != null)
87937
+ result.proration = proration;
87938
+ const rollover = pf.rollover;
87939
+ if (rollover != null)
87940
+ result.rollover = rollover;
87941
+ return result;
87942
+ }
87943
+ function normalizePlanForCompare2(plan) {
87944
+ const result = { id: plan.id, name: plan.name };
87945
+ if (plan.description != null && plan.description !== "")
87946
+ result.description = plan.description;
87947
+ if (plan.group != null && plan.group !== "")
87948
+ result.group = plan.group;
87949
+ if (plan.addOn === true)
87950
+ result.addOn = true;
87951
+ if (plan.autoEnable === true)
87952
+ result.autoEnable = true;
87953
+ if (plan.price != null) {
87954
+ result.price = { amount: plan.price.amount, interval: plan.price.interval };
87955
+ }
87956
+ if (plan.freeTrial != null) {
87957
+ result.freeTrial = {
87958
+ durationLength: plan.freeTrial.durationLength,
87959
+ durationType: plan.freeTrial.durationType,
87960
+ cardRequired: plan.freeTrial.cardRequired
87961
+ };
87962
+ }
87963
+ if (plan.items != null && plan.items.length > 0) {
87964
+ result.items = [...plan.items].sort((a2, b) => a2.featureId.localeCompare(b.featureId)).map((pf) => normalizePlanFeatureForCompare2(pf));
87965
+ }
87966
+ return result;
87967
+ }
87968
+ function diffObjects(a2, b, path18 = "") {
87969
+ const diffs = [];
87970
+ const allKeys = new Set([...Object.keys(a2), ...Object.keys(b)]);
87971
+ for (const key2 of allKeys) {
87972
+ const fullPath = path18 ? `${path18}.${key2}` : key2;
87973
+ const av = a2[key2];
87974
+ const bv = b[key2];
87975
+ if (!valuesEqual2(av, bv)) {
87976
+ diffs.push(` ${source_default.yellow(fullPath)}:
87977
+ ` + ` local: ${source_default.green(JSON.stringify(av))}
87978
+ ` + ` remote: ${source_default.red(JSON.stringify(bv))}`);
87979
+ }
87980
+ }
87981
+ return diffs;
87982
+ }
87983
+ async function loadLocalConfig3(cwd2) {
87984
+ const configPath = resolveConfigPath(cwd2);
87985
+ if (!fs18.existsSync(configPath)) {
87986
+ throw new Error(`Config file not found at ${configPath}. Run 'atmn pull' first.`);
87987
+ }
87988
+ const absolutePath = resolve9(configPath);
87989
+ const fileUrl = pathToFileURL4(absolutePath).href;
87990
+ const jiti = createJiti4(import.meta.url);
87991
+ const mod = await jiti.import(fileUrl);
87992
+ const plans5 = [];
87993
+ const features5 = [];
87994
+ const modRecord = mod;
87995
+ const defaultExport = modRecord.default;
87996
+ if (defaultExport?.plans && defaultExport?.features) {
87997
+ if (Array.isArray(defaultExport.plans))
87998
+ plans5.push(...defaultExport.plans);
87999
+ if (Array.isArray(defaultExport.features))
88000
+ features5.push(...defaultExport.features);
88001
+ } else if (defaultExport?.products && defaultExport?.features) {
88002
+ if (Array.isArray(defaultExport.products))
88003
+ plans5.push(...defaultExport.products);
88004
+ if (Array.isArray(defaultExport.features))
88005
+ features5.push(...defaultExport.features);
88006
+ } else {
88007
+ for (const [key2, value] of Object.entries(modRecord)) {
88008
+ if (key2 === "default")
88009
+ continue;
88010
+ const obj = value;
88011
+ if (obj && typeof obj === "object") {
88012
+ if ("type" in obj)
88013
+ features5.push(obj);
88014
+ else if (Array.isArray(obj.items) || "id" in obj)
88015
+ plans5.push(obj);
88016
+ }
88017
+ }
88018
+ }
88019
+ return { features: features5, plans: plans5 };
88020
+ }
88021
+ async function testDiffCommand() {
88022
+ console.log(source_default.cyan("Loading local config..."));
88023
+ const { features: localFeatures, plans: localPlans } = await loadLocalConfig3(process.cwd());
88024
+ console.log(source_default.cyan("Fetching remote data..."));
88025
+ const remoteData = await fetchRemoteData();
88026
+ const remoteFeaturesById = new Map(remoteData.features.map((f) => [f.id, f]));
88027
+ const remotePlansById = new Map(remoteData.plans.map((p) => [p.id, p]));
88028
+ console.log("");
88029
+ console.log(source_default.bold("━━━ FEATURE DIFF ━━━"));
88030
+ let featureChanges = 0;
88031
+ for (const local of localFeatures) {
88032
+ const remote = remoteFeaturesById.get(local.id);
88033
+ if (!remote) {
88034
+ console.log(source_default.green(` [NEW] ${local.id}`));
88035
+ featureChanges++;
88036
+ continue;
88037
+ }
88038
+ const localNorm = normalizeFeatureForCompare2(local);
88039
+ const remoteNorm = normalizeFeatureForCompare2(remote);
88040
+ if (!valuesEqual2(localNorm, remoteNorm)) {
88041
+ console.log(source_default.yellow(` [CHANGED] ${local.id}`));
88042
+ const diffs = diffObjects(localNorm, remoteNorm);
88043
+ for (const d of diffs)
88044
+ console.log(d);
88045
+ featureChanges++;
88046
+ }
88047
+ }
88048
+ if (featureChanges === 0)
88049
+ console.log(source_default.gray(" (no feature changes)"));
88050
+ console.log("");
88051
+ console.log(source_default.bold("━━━ PLAN DIFF ━━━"));
88052
+ let planChanges = 0;
88053
+ for (const local of localPlans) {
88054
+ const remote = remotePlansById.get(local.id);
88055
+ if (!remote) {
88056
+ console.log(source_default.green(` [NEW] ${local.id}`));
88057
+ planChanges++;
88058
+ continue;
88059
+ }
88060
+ const localNorm = normalizePlanForCompare2(local);
88061
+ const remoteNorm = normalizePlanForCompare2(remote);
88062
+ if (!valuesEqual2(localNorm, remoteNorm)) {
88063
+ console.log(source_default.yellow(` [CHANGED] ${local.id}`));
88064
+ const diffs = diffObjects(localNorm, remoteNorm);
88065
+ for (const d of diffs)
88066
+ console.log(d);
88067
+ planChanges++;
88068
+ } else {
88069
+ console.log(source_default.gray(` [same] ${local.id}`));
88070
+ }
88071
+ }
88072
+ if (planChanges === 0)
88073
+ console.log(source_default.gray(" (no plan changes)"));
88074
+ console.log("");
88075
+ console.log(source_default.bold("━━━ RAW NORMALIZED (plans) ━━━"));
88076
+ for (const local of localPlans) {
88077
+ const remote = remotePlansById.get(local.id);
88078
+ if (!remote)
88079
+ continue;
88080
+ const localNorm = normalizePlanForCompare2(local);
88081
+ const remoteNorm = normalizePlanForCompare2(remote);
88082
+ console.log(source_default.cyan(`
88083
+ [${local.id}] local:`));
88084
+ console.log(JSON.stringify(localNorm, null, 2).split(`
88085
+ `).map((l) => ` ${l}`).join(`
88086
+ `));
88087
+ console.log(source_default.magenta(` [${local.id}] remote:`));
88088
+ console.log(JSON.stringify(remoteNorm, null, 2).split(`
88089
+ `).map((l) => ` ${l}`).join(`
88090
+ `));
88091
+ }
88092
+ }
88093
+ var init_command8 = __esm(() => {
88094
+ init_source();
88095
+ init_env();
88096
+ init_push();
88097
+ });
88098
+
88099
+ // src/commands/test-diff/index.ts
88100
+ var exports_test_diff = {};
88101
+ __export(exports_test_diff, {
88102
+ testDiffCommand: () => testDiffCommand
88103
+ });
88104
+ var init_test_diff = __esm(() => {
88105
+ init_command8();
88106
+ });
88107
+
88618
88108
  // src/cli.tsx
88619
88109
  init_source();
88620
88110
 
@@ -88739,7 +88229,7 @@ async function Nuke(options) {
88739
88229
  console.log(source_default.red("No API key found. Run `atmn login` first."));
88740
88230
  process.exit(1);
88741
88231
  }
88742
- const isSandbox = isSandboxKey2(apiKey);
88232
+ const isSandbox = await isSandboxKey2(apiKey);
88743
88233
  if (isSandbox) {
88744
88234
  const secretKey = getKey("sandbox" /* Sandbox */);
88745
88235
  try {
@@ -89636,7 +89126,7 @@ function TemplateRow({
89636
89126
  }, tier.name, false, undefined, this))
89637
89127
  }, undefined, false, undefined, this),
89638
89128
  hasCreditSystem && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(CreditSchemaCard, {
89639
- costs: template.creditSystem?.costs,
89129
+ costs: template.creditSystem?.costs ?? [],
89640
89130
  height: tiersHeight,
89641
89131
  width: creditSchemaWidth
89642
89132
  }, undefined, false, undefined, this)
@@ -90164,9 +89654,9 @@ function HandoffStep({
90164
89654
  }, undefined, false, undefined, this),
90165
89655
  /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(Box_default, {
90166
89656
  marginTop: 1,
90167
- children: /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(Select, {
90168
- options: aiChoiceOptions,
90169
- onChange: handleAiChoice
89657
+ children: /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(SelectMenu, {
89658
+ items: aiChoiceOptions,
89659
+ onSelect: (item) => handleAiChoice(item.value)
90170
89660
  }, undefined, false, undefined, this)
90171
89661
  }, undefined, false, undefined, this)
90172
89662
  ]
@@ -90235,7 +89725,7 @@ function HandoffStep({
90235
89725
  }, undefined, true, undefined, this),
90236
89726
  /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(TextInput2, {
90237
89727
  placeholder: process.cwd(),
90238
- value: customPath,
89728
+ defaultValue: customPath,
90239
89729
  onChange: setCustomPath,
90240
89730
  onSubmit: handleCustomPathSubmit
90241
89731
  }, undefined, false, undefined, this)
@@ -90321,9 +89811,9 @@ function HandoffStep({
90321
89811
  }, undefined, false, undefined, this),
90322
89812
  /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(Box_default, {
90323
89813
  marginTop: 1,
90324
- children: /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(Select, {
90325
- options: nextStepsOptions,
90326
- onChange: handleNextStepsChoice
89814
+ children: /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(SelectMenu, {
89815
+ items: nextStepsOptions,
89816
+ onSelect: (item) => handleNextStepsChoice(item.value)
90327
89817
  }, undefined, false, undefined, this)
90328
89818
  }, undefined, false, undefined, this)
90329
89819
  ]
@@ -90826,6 +90316,17 @@ program.command("config").description("Get and set global configuration").option
90826
90316
  const args = [key2, value].filter((a2) => a2 !== undefined);
90827
90317
  configCommand2(args, { global: options.global });
90828
90318
  });
90319
+ program.command("test-diff", { hidden: true }).description("Debug: show normalized diff between local config and remote").action(async () => {
90320
+ const { testDiffCommand: testDiffCommand2 } = await Promise.resolve().then(() => (init_test_diff(), exports_test_diff));
90321
+ try {
90322
+ await testDiffCommand2();
90323
+ } catch (error) {
90324
+ const { formatError: formatError2 } = await Promise.resolve().then(() => (init_client2(), exports_client));
90325
+ console.error(source_default.red(`
90326
+ Error: ${formatError2(error)}`));
90327
+ process.exit(1);
90328
+ }
90329
+ });
90829
90330
  var originalEmit = process.emitWarning;
90830
90331
  process.emitWarning = (warning, ...args) => {
90831
90332
  const msg = typeof warning === "string" ? warning : warning.message;