nolo-cli 0.33.0-alpha.9 → 0.34.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/{_executeModel-2WR4RTZZ.js → _executeModel-TMUXL7J5.js} +64 -65
  2. package/{action-OQWPNKAH.js → action-KMBZ3LCZ.js} +12 -12
  3. package/{addContentAction-YVINZQTF.js → addContentAction-KQ44UT2U.js} +10 -10
  4. package/{addDialogAgentAction-6IOCIEPI.js → addDialogAgentAction-ILSDCMYL.js} +9 -9
  5. package/{agentDeleteCommand-H22WRYC6.js → agentDeleteCommand-KA2IQAPG.js} +40 -39
  6. package/{agentEmailCommands-DGJVCMCG.js → agentEmailCommands-UIYBGCZW.js} +74 -75
  7. package/{agentListCommands-6NWMLIMQ.js → agentListCommands-L6JNUOLH.js} +47 -37
  8. package/{agentMachineCommands-5MUO6RDI.js → agentMachineCommands-5CQW5NZR.js} +37 -36
  9. package/agentProviderCommands-65ZC2WB4.js +122 -0
  10. package/{agentPullCommand-YH5GEBK4.js → agentPullCommand-TSWAJPS2.js} +1 -1
  11. package/agentRecordCommands-VUDJQIZH.js +112 -0
  12. package/agentRunCommand-EJWYF3BL.js +132 -0
  13. package/{agentRunControl-SCIVRZWX.js → agentRunControl-7MUPSYDQ.js} +7 -1
  14. package/{agentRuntimeLocal-PRAR3NCW.js → agentRuntimeLocal-XXBMDMBU.js} +33 -33
  15. package/{agentSlice-AMDSTXP5.js → agentSlice-HTIEYKIU.js} +12 -12
  16. package/agentSuperviseCommands-MKWW3ICX.js +640 -0
  17. package/{appDeleteCommands-L5PKC42V.js → appDeleteCommands-OUBL6VHB.js} +35 -34
  18. package/{appDeployCommands-3J7Z4XWV.js → appDeployCommands-BZSS2MX4.js} +35 -34
  19. package/{appDeployStatusCommands-YTRPXE72.js → appDeployStatusCommands-P2ZQOY5X.js} +35 -34
  20. package/{appGetCommands-JVXV5WXD.js → appGetCommands-WCFWQZZM.js} +35 -34
  21. package/{appListCommands-7KDEOJSO.js → appListCommands-FVJ3QNL7.js} +35 -34
  22. package/{authCommand-6Y5LTMZB.js → authCommand-B2XRHNJH.js} +19 -19
  23. package/{authCommands-EAPFGNHN.js → authCommands-GWABTFMR.js} +6 -6
  24. package/{chatQueueReduxAdapter-ZKSS6XRV.js → chatQueueReduxAdapter-ZP2ZS63U.js} +28 -28
  25. package/{chunk-UM4H3URE.js → chunk-23KKIMD5.js} +7 -7
  26. package/chunk-2BWU4ORW.js +2574 -0
  27. package/{chunk-2UECQ7RE.js → chunk-3AOLVADY.js} +1 -1
  28. package/{chunk-M2YMQOLC.js → chunk-4APLX2RT.js} +75 -10
  29. package/{chunk-ZHYK3N56.js → chunk-4AWH4LQA.js} +3 -1
  30. package/{chunk-3GZXL6FM.js → chunk-4DMPISV6.js} +7 -3
  31. package/{chunk-BQ3OHLR5.js → chunk-5GQ6XCJY.js} +1217 -691
  32. package/{chunk-GOIDVXK5.js → chunk-5LDKQUOT.js} +21 -8
  33. package/{chunk-OIQPORYI.js → chunk-64KIQZA2.js} +175 -2
  34. package/{chunk-6XIE5ZGI.js → chunk-6HIGYUBQ.js} +1 -1
  35. package/chunk-6XG52ZQ6.js +146 -0
  36. package/{chunk-FMEVI5TG.js → chunk-7CH6U3FL.js} +1 -1
  37. package/chunk-AA2YUJNV.js +54 -0
  38. package/{chunk-7INB7NXF.js → chunk-AE5GVFMG.js} +294 -54
  39. package/{chunk-UNOTBWZZ.js → chunk-B6H5XCT2.js} +8 -8
  40. package/{chunk-NNWHHCVP.js → chunk-BMB563Y6.js} +10 -4
  41. package/{chunk-DFUPZE6V.js → chunk-C6ELZQ7H.js} +249 -34
  42. package/{chunk-7KNERA53.js → chunk-E2OQ5N2F.js} +87 -13
  43. package/{chunk-6HYVJV7B.js → chunk-ESHYE7WU.js} +2 -1
  44. package/{chunk-KHCLMKZZ.js → chunk-EY7V7REW.js} +280 -6
  45. package/{chunk-JZPBVBIY.js → chunk-FD36SCCD.js} +19 -8
  46. package/{chunk-DKMOY3QI.js → chunk-FGLKRJDI.js} +54 -3
  47. package/{chunk-MQWVAOIU.js → chunk-FT4XBCK4.js} +33 -158
  48. package/{chunk-2QTEYCR7.js → chunk-FTM4KUOZ.js} +17 -17
  49. package/{chunk-U4TRT5V4.js → chunk-GEPHJJW4.js} +1 -1
  50. package/{chunk-7YYHKBJP.js → chunk-GKHV4UH5.js} +1 -1
  51. package/{chunk-2IVEXF7P.js → chunk-GUYMR3JL.js} +6 -33
  52. package/{chunk-YDTYDA5W.js → chunk-GZRMWK5R.js} +6 -4
  53. package/{chunk-X664KVEV.js → chunk-HHBXCRJS.js} +204 -123
  54. package/{chunk-AN7DGYMW.js → chunk-I7VDDN45.js} +4579 -3131
  55. package/{chunk-DSBGWT2C.js → chunk-IEEEWIVO.js} +10 -10
  56. package/{chunk-75U775RZ.js → chunk-IFS5CUEH.js} +1 -1
  57. package/{chunk-WLH5BAKX.js → chunk-IIOHYLIG.js} +9 -4
  58. package/{chunk-UEAUAXYS.js → chunk-ILZY5B4U.js} +2063 -214
  59. package/chunk-IMHO5LC6.js +370 -0
  60. package/{chunk-ADLYMQB6.js → chunk-IZCHPD7T.js} +52 -3
  61. package/{chunk-ITIA6OAQ.js → chunk-IZNJDUJ4.js} +5 -5
  62. package/{chunk-X2DAEZ3X.js → chunk-J5NMOM35.js} +1 -1
  63. package/{chunk-RPRRIFXV.js → chunk-JI2TIPLP.js} +1 -1
  64. package/{chunk-EGRJC4ZN.js → chunk-JIADXJYU.js} +1 -1
  65. package/{chunk-IHEC7VBF.js → chunk-K4KIFRIN.js} +1 -1
  66. package/{chunk-WJSW43QZ.js → chunk-L3JWI7WX.js} +0 -1
  67. package/{chunk-3RUW3ONU.js → chunk-LD6Y6RJY.js} +4 -4
  68. package/chunk-M3JQWYBC.js +387 -0
  69. package/{chunk-GM6PU7B6.js → chunk-MEYIRKDN.js} +0 -1
  70. package/{chunk-6YXDOOSH.js → chunk-MGIHZ5CJ.js} +4 -4
  71. package/{chunk-4F5M2MW5.js → chunk-MJWX4JQO.js} +2 -2
  72. package/{chunk-Q5ITEGIN.js → chunk-N4XRDM26.js} +1 -1
  73. package/{chunk-5CS33IBL.js → chunk-NQ4N4IGO.js} +11 -12
  74. package/{chunk-ZZ2MH7LE.js → chunk-O6OSWFZQ.js} +0 -1
  75. package/{chunk-RJKIB55Y.js → chunk-OSCSEJJR.js} +15 -8
  76. package/{chunk-HUCT7HID.js → chunk-P2I7ELDC.js} +3 -3
  77. package/{chunk-BXPBZVRE.js → chunk-PILJX4DH.js} +285 -251
  78. package/{chunk-SCUETSRP.js → chunk-PV734VZX.js} +1 -1
  79. package/{chunk-XLLTJXAD.js → chunk-QI3CHZUT.js} +39 -2672
  80. package/{chunk-WNHST4IE.js → chunk-RKRXAL3V.js} +5451 -5013
  81. package/{chunk-7E72JMBB.js → chunk-SMPAUSX5.js} +46 -5
  82. package/{chunk-5X4GQ53C.js → chunk-TLBZMLLJ.js} +7 -7
  83. package/{chunk-ASDXPOJH.js → chunk-U6QQLXWI.js} +1 -1
  84. package/{chunk-NUO3QFWD.js → chunk-UNHKVD2N.js} +1 -1
  85. package/{chunk-GE6IWA5N.js → chunk-UNZDCI3O.js} +126 -1
  86. package/{chunk-CPYYM4RJ.js → chunk-V5GA74HI.js} +19 -5
  87. package/{chunk-FXFGNOT2.js → chunk-VFVCYIRQ.js} +1 -1
  88. package/{chunk-G7E4NWFE.js → chunk-W445DPVT.js} +1 -1
  89. package/{chunk-EMW55KKX.js → chunk-WBZE7C6S.js} +1 -1
  90. package/{chunk-3UG2IIZ3.js → chunk-WN5AJG5I.js} +1 -1
  91. package/{chunk-KSRFVP36.js → chunk-WRN7L5CS.js} +1 -1
  92. package/{chunk-GJXRIOLS.js → chunk-WRP5TTM6.js} +4 -84
  93. package/chunk-X2K2JSO4.js +163 -0
  94. package/{chunk-OR2HNLVO.js → chunk-X6EN3KJX.js} +279 -477
  95. package/{chunk-VWY2CZD2.js → chunk-XMFDQYWA.js} +3 -3
  96. package/{chunk-IKWTTKWG.js → chunk-XQES6LXQ.js} +2 -2
  97. package/{chunk-IR6W62Q6.js → chunk-XT73C4VH.js} +18 -21
  98. package/{chunk-7L5CQQIT.js → chunk-Y5W623XU.js} +15 -15
  99. package/{chunk-RY57GLGW.js → chunk-YPREESF4.js} +42 -5
  100. package/{chunk-BQXOGBFN.js → chunk-YZ2WE6CW.js} +2 -2
  101. package/{chunk-DNQK7M7K.js → chunk-Z7COG62J.js} +4 -4
  102. package/{chunk-3WXRAHCG.js → chunk-ZBB3MZR3.js} +3 -3
  103. package/{cliExecutor-DW3PHGEL.js → cliExecutor-BBUVQU4L.js} +2 -2
  104. package/{clipboardy-MMBYVRLF.js → clipboardy-PRUHGPGC.js} +4 -3
  105. package/{codingSkills-DY5MINPG.js → codingSkills-6F4EQFCM.js} +4 -5
  106. package/cooldownCommands-C2SZLEEO.js +90 -0
  107. package/{createAgentAutomationAction-GVSJL2CI.js → createAgentAutomationAction-TGUXUZCY.js} +28 -30
  108. package/createDialogAction-FD5AEOUF.js +58 -0
  109. package/{createPageAction-M2VDKBYS.js → createPageAction-NPC3LYNK.js} +31 -34
  110. package/{dbSlice-UI2VCBLG.js → dbSlice-PIQGICNM.js} +9 -9
  111. package/{deleteFile-XQXPBFFB.js → deleteFile-NPZ64DFN.js} +4 -4
  112. package/{dialogCommands-26DBYNBT.js → dialogCommands-ZF2RSNCG.js} +37 -36
  113. package/{dialogSlice-FFGLRCBL.js → dialogSlice-6BINHWQT.js} +27 -27
  114. package/dist-VODFSGNG.js +7442 -0
  115. package/{docCreateCommands-F2ASWG6B.js → docCreateCommands-4VQ5MOHP.js} +36 -36
  116. package/{docDeleteCommands-A4URDZPI.js → docDeleteCommands-M7WLNVPB.js} +37 -37
  117. package/{docReadCommands-DO6VHDZD.js → docReadCommands-6LU6P2WT.js} +36 -36
  118. package/{docStore-EDAE7RNT.js → docStore-SIUFLABN.js} +29 -31
  119. package/{docUpdateCommands-ZTXZ3RTP.js → docUpdateCommands-S2LX4ENL.js} +39 -39
  120. package/{fetchMessages-7QRCCRYK.js → fetchMessages-CUEFN4GQ.js} +4 -4
  121. package/{getPricing-L2ENXWHV.js → getPricing-P3E2WRIH.js} +5 -5
  122. package/{handleSendMessageAction-CIRLGHOC.js → handleSendMessageAction-QVG5YNZY.js} +29 -29
  123. package/index.js +92 -77
  124. package/{localDialogRead-SLMPV5SK.js → localDialogRead-P7CHFMIC.js} +1 -1
  125. package/{localRuntimeAuthority-E3R24J4T.js → localRuntimeAuthority-S77B5QVB.js} +6 -2
  126. package/{localRuntimeDb-DDZCJFQZ.js → localRuntimeDb-N3H3HQ7G.js} +1 -1
  127. package/{machineCommands-NIQNCYJV.js → machineCommands-OSEBN7BZ.js} +76 -77
  128. package/{machineInfo-M6KB6HZN.js → machineInfo-66ZFUMLE.js} +1 -1
  129. package/{machineWsRunDispatch-EMTSQGAR.js → machineWsRunDispatch-NTJQCIIF.js} +68 -69
  130. package/{models-OX2S5C6Q.js → models-L7S2EKPM.js} +2 -2
  131. package/package.json +1 -1
  132. package/{read-2VHEHCAN.js → read-6C2XD3YZ.js} +5 -5
  133. package/{readDocTool-CSWD6NPC.js → readDocTool-Y7AB365O.js} +1 -1
  134. package/{readlineWorkspace-A2JBJWLI.js → readlineWorkspace-JPME5S7A.js} +4860 -3476
  135. package/{removeDialogAgentAction-2T7BPM3T.js → removeDialogAgentAction-KG5WMJRZ.js} +13 -13
  136. package/{runAgentClientLoop-BV4736ED.js → runAgentClientLoop-SOKEXCUF.js} +61 -61
  137. package/{runtimeDoctorCommands-KIKM6BIO.js → runtimeDoctorCommands-HT4O2PXL.js} +6 -6
  138. package/{setDialogExtraReferencesAction-GPT37HTW.js → setDialogExtraReferencesAction-O2NLXMSM.js} +10 -10
  139. package/{setPrimaryDialogAgentAction-3746P7IW.js → setPrimaryDialogAgentAction-FYYUY7PB.js} +13 -13
  140. package/{settingSlice-FIFOQ6OR.js → settingSlice-GPLI6E3M.js} +11 -11
  141. package/{skillDiscovery-KLLKXPUO.js → skillDiscovery-GPUDHDTZ.js} +3 -4
  142. package/{slateUtils-VO2FU36K.js → slateUtils-RIZES3PV.js} +1 -1
  143. package/{spaceCommands-AYZQHDB3.js → spaceCommands-Z5JLMFFJ.js} +223 -37
  144. package/{spaceSlice-43BNF22B.js → spaceSlice-Z3BGCLGX.js} +28 -30
  145. package/{streamAgentChatTurn-OLLRSITV.js → streamAgentChatTurn-INF5RGK4.js} +115 -129
  146. package/{switchDialogAgentAction-MQTUTQHL.js → switchDialogAgentAction-GH5P6Q3Z.js} +9 -9
  147. package/{chunk-IDAU4UFS.js → syncMapping-N6RGXGBW.js} +11 -11
  148. package/{tableCommands-QE47K72R.js → tableCommands-PQUJ55AS.js} +3 -3
  149. package/{tools-2SI3FXLL.js → tools-ZELMSJZ3.js} +45 -47
  150. package/{tuiSummaryLlmCaller-EAWQ3IZX.js → tuiSummaryLlmCaller-LH7F2SP7.js} +18 -18
  151. package/{updateCommands-AK2RDOFR.js → updateCommands-MNDUIKN7.js} +2 -2
  152. package/{updateDialogTitleAction-YJEQFYOA.js → updateDialogTitleAction-EDUCIB7G.js} +31 -33
  153. package/agentRecordCommands-YMGKT2WF.js +0 -113
  154. package/agentRunCommand-LYEMVQJH.js +0 -131
  155. package/chunk-AETZ7AD6.js +0 -274
  156. package/chunk-D5JI6VDM.js +0 -1800
  157. package/chunk-M3JEW6N6.js +0 -193
  158. package/chunk-ZURFOV5J.js +0 -105
  159. package/chunk-ZWS6DUHX.js +0 -480
  160. package/createDialogAction-VVR46Q2A.js +0 -61
  161. package/syncMapping-RK2MANUX.js +0 -43
  162. package/{chunk-KMSZPTM6.js → chunk-2WKUUY2E.js} +3 -3
  163. package/{chunk-CWMSB67P.js → chunk-AGGIDPCZ.js} +0 -0
  164. package/{chunk-SAQQLJZ5.js → chunk-JDSUTNYY.js} +3 -3
@@ -2,16 +2,16 @@ import {
2
2
  getAllServers,
3
3
  getIsDesktopApp,
4
4
  isAbortError
5
- } from "./chunk-WJSW43QZ.js";
5
+ } from "./chunk-L3JWI7WX.js";
6
+ import {
7
+ isRecord
8
+ } from "./chunk-KUG52IAP.js";
6
9
  import {
7
10
  asTrimmedString
8
11
  } from "./chunk-3EUW3WEO.js";
9
12
  import {
10
13
  asOptionalPositiveFiniteNumber
11
14
  } from "./chunk-U6VC4MU4.js";
12
- import {
13
- isRecord
14
- } from "./chunk-KUG52IAP.js";
15
15
  import {
16
16
  API_ENDPOINTS,
17
17
  SERVERS,
@@ -28,104 +28,27 @@ import {
28
28
  } from "./chunk-G3SUCT4W.js";
29
29
 
30
30
  // node_modules/reselect/dist/reselect.mjs
31
- var runIdentityFunctionCheck = (resultFunc, inputSelectorsResults, outputSelectorResult) => {
32
- if (inputSelectorsResults.length === 1 && inputSelectorsResults[0] === outputSelectorResult) {
33
- let isInputSameAsOutput = false;
34
- try {
35
- const emptyObject = {};
36
- if (resultFunc(emptyObject) === emptyObject) isInputSameAsOutput = true;
37
- } catch {
38
- }
39
- if (isInputSameAsOutput) {
40
- let stack = void 0;
41
- try {
42
- throw new Error();
43
- } catch (e) {
44
- ;
45
- ({ stack } = e);
46
- }
47
- console.warn(
48
- "The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.",
49
- { stack }
50
- );
51
- }
52
- }
53
- };
54
- var runInputStabilityCheck = (inputSelectorResultsObject, options, inputSelectorArgs) => {
55
- const { memoize, memoizeOptions } = options;
56
- const { inputSelectorResults, inputSelectorResultsCopy } = inputSelectorResultsObject;
57
- const createAnEmptyObject = memoize(() => ({}), ...memoizeOptions);
58
- const areInputSelectorResultsEqual = createAnEmptyObject.apply(null, inputSelectorResults) === createAnEmptyObject.apply(null, inputSelectorResultsCopy);
59
- if (!areInputSelectorResultsEqual) {
60
- let stack = void 0;
61
- try {
62
- throw new Error();
63
- } catch (e) {
64
- ;
65
- ({ stack } = e);
66
- }
67
- console.warn(
68
- "An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`",
69
- {
70
- arguments: inputSelectorArgs,
71
- firstInputs: inputSelectorResults,
72
- secondInputs: inputSelectorResultsCopy,
73
- stack
74
- }
75
- );
76
- }
31
+ var CACHE_SIZE_CHECK_THRESHOLD = 1e3;
32
+ var runCacheSizeCheck = (cacheSize, funcName) => {
33
+ let stack = void 0;
34
+ try {
35
+ throw new Error();
36
+ } catch (e) {
37
+ ;
38
+ ({ stack } = e);
39
+ }
40
+ console.warn(
41
+ `A function memoized with weakMapMemoize${funcName ? ` (\`${funcName}\`)` : ""} has seen over ${cacheSize} distinct values for the same primitive argument position.
42
+ Results keyed by primitive arguments are held strongly and are only released by \`clearCache()\`, so this cache will keep growing for as long as the function keeps seeing new values.
43
+ If it is called with ever-changing primitives (ids, offsets, timestamps), pass the \`maxSize\` option to bound the cache, switch to \`lruMemoize\`, or call \`.clearCache()\` at a suitable point.
44
+ See https://reselect.js.org/api/development-only-checks#cachesizecheck for details.`,
45
+ { stack }
46
+ );
77
47
  };
78
48
  var globalDevModeChecks = {
79
49
  inputStabilityCheck: "once",
80
- identityFunctionCheck: "once"
81
- };
82
- function assertIsFunction(func, errorMessage = `expected a function, instead received ${typeof func}`) {
83
- if (typeof func !== "function") {
84
- throw new TypeError(errorMessage);
85
- }
86
- }
87
- function assertIsArrayOfFunctions(array, errorMessage = `expected all items to be functions, instead received the following types: `) {
88
- if (!array.every((item) => typeof item === "function")) {
89
- const itemTypes = array.map(
90
- (item) => typeof item === "function" ? `function ${item.name || "unnamed"}()` : typeof item
91
- ).join(", ");
92
- throw new TypeError(`${errorMessage}[${itemTypes}]`);
93
- }
94
- }
95
- var ensureIsArray = (item) => {
96
- return Array.isArray(item) ? item : [item];
97
- };
98
- function getDependencies(createSelectorArgs) {
99
- const dependencies = Array.isArray(createSelectorArgs[0]) ? createSelectorArgs[0] : createSelectorArgs;
100
- assertIsArrayOfFunctions(
101
- dependencies,
102
- `createSelector expects all input-selectors to be functions, but received the following types: `
103
- );
104
- return dependencies;
105
- }
106
- function collectInputSelectorResults(dependencies, inputSelectorArgs) {
107
- const inputSelectorResults = [];
108
- const { length } = dependencies;
109
- for (let i = 0; i < length; i++) {
110
- inputSelectorResults.push(dependencies[i].apply(null, inputSelectorArgs));
111
- }
112
- return inputSelectorResults;
113
- }
114
- var getDevModeChecksExecutionInfo = (firstRun, devModeChecks) => {
115
- const { identityFunctionCheck, inputStabilityCheck } = {
116
- ...globalDevModeChecks,
117
- ...devModeChecks
118
- };
119
- return {
120
- identityFunctionCheck: {
121
- shouldRun: identityFunctionCheck === "always" || identityFunctionCheck === "once" && firstRun,
122
- run: runIdentityFunctionCheck
123
- },
124
- inputStabilityCheck: {
125
- shouldRun: inputStabilityCheck === "always" || inputStabilityCheck === "once" && firstRun,
126
- run: runInputStabilityCheck
127
- }
128
- };
50
+ identityFunctionCheck: "once",
51
+ cacheSizeCheck: "once"
129
52
  };
130
53
  var StrongRef = class {
131
54
  constructor(value) {
@@ -155,9 +78,25 @@ function maybeDeref(r) {
155
78
  }
156
79
  function weakMapMemoize(func, options = {}) {
157
80
  let fnNode = createCacheNode();
158
- const { resultEqualityCheck } = options;
81
+ const { resultEqualityCheck, maxSize } = options;
82
+ const useGenerations = maxSize !== void 0;
83
+ if (useGenerations && (!Number.isInteger(maxSize) || maxSize < 1)) {
84
+ throw new TypeError(
85
+ `maxSize must be a positive integer, received: ${maxSize}`
86
+ );
87
+ }
88
+ let prevNode = null;
89
+ let insertionCount = 0;
159
90
  let lastResult;
160
91
  let resultsCount = 0;
92
+ let hasWarnedAboutCacheSize = false;
93
+ function maybeFlipGenerations() {
94
+ if (insertionCount >= maxSize) {
95
+ prevNode = fnNode;
96
+ fnNode = createCacheNode();
97
+ insertionCount = 0;
98
+ }
99
+ }
161
100
  function memoized() {
162
101
  let cacheNode = fnNode;
163
102
  const { length } = arguments;
@@ -184,35 +123,77 @@ function weakMapMemoize(func, options = {}) {
184
123
  if (primitiveNode === void 0) {
185
124
  cacheNode = createCacheNode();
186
125
  primitiveCache.set(arg, cacheNode);
126
+ insertionCount++;
127
+ if (process.env.NODE_ENV !== "production") {
128
+ if (primitiveCache.size > CACHE_SIZE_CHECK_THRESHOLD) {
129
+ const { cacheSizeCheck } = globalDevModeChecks;
130
+ if (cacheSizeCheck === "always" || cacheSizeCheck === "once" && !hasWarnedAboutCacheSize) {
131
+ hasWarnedAboutCacheSize = true;
132
+ runCacheSizeCheck(primitiveCache.size, func.name);
133
+ }
134
+ }
135
+ }
187
136
  } else {
188
137
  cacheNode = primitiveNode;
189
138
  }
190
139
  }
191
140
  }
192
- const terminatedNode = cacheNode;
193
- let result;
194
141
  if (cacheNode.s === TERMINATED) {
195
- result = cacheNode.v;
196
- } else {
197
- result = func.apply(null, arguments);
198
- resultsCount++;
199
- if (resultEqualityCheck) {
200
- const lastResultValue = maybeDeref(lastResult);
201
- if (lastResultValue != null && resultEqualityCheck(lastResultValue, result)) {
202
- result = lastResultValue;
203
- resultsCount !== 0 && resultsCount--;
142
+ return cacheNode.v;
143
+ }
144
+ if (prevNode !== null) {
145
+ let prevCacheNode = prevNode;
146
+ for (let i = 0, l = length; i < l; i++) {
147
+ const arg = arguments[i];
148
+ let next;
149
+ if (typeof arg === "function" || typeof arg === "object" && arg !== null) {
150
+ const prevObjectCache = prevCacheNode.o;
151
+ next = prevObjectCache !== null ? prevObjectCache.get(arg) : void 0;
152
+ } else {
153
+ const prevPrimitiveCache = prevCacheNode.p;
154
+ next = prevPrimitiveCache !== null ? prevPrimitiveCache.get(arg) : void 0;
155
+ }
156
+ if (next === void 0) {
157
+ prevCacheNode = null;
158
+ break;
204
159
  }
205
- const needsWeakRef = typeof result === "object" && result !== null || typeof result === "function";
206
- lastResult = needsWeakRef ? /* @__PURE__ */ new Ref(result) : result;
160
+ prevCacheNode = next;
161
+ }
162
+ if (prevCacheNode !== null && prevCacheNode.s === TERMINATED) {
163
+ const promotedNode = cacheNode;
164
+ promotedNode.s = TERMINATED;
165
+ promotedNode.v = prevCacheNode.v;
166
+ maybeFlipGenerations();
167
+ return prevCacheNode.v;
207
168
  }
208
169
  }
170
+ const terminatedNode = cacheNode;
171
+ let result = func.apply(null, arguments);
172
+ resultsCount++;
173
+ if (resultEqualityCheck) {
174
+ const lastResultValue = maybeDeref(lastResult);
175
+ if (lastResultValue != null && resultEqualityCheck(lastResultValue, result)) {
176
+ result = lastResultValue;
177
+ resultsCount !== 0 && resultsCount--;
178
+ }
179
+ const needsWeakRef = typeof result === "object" && result !== null || typeof result === "function";
180
+ lastResult = needsWeakRef ? /* @__PURE__ */ new Ref(result) : result;
181
+ }
209
182
  terminatedNode.s = TERMINATED;
210
183
  terminatedNode.v = result;
184
+ if (useGenerations) {
185
+ maybeFlipGenerations();
186
+ }
211
187
  return result;
212
188
  }
213
189
  memoized.clearCache = () => {
214
190
  fnNode = createCacheNode();
191
+ prevNode = null;
192
+ insertionCount = 0;
215
193
  memoized.resetResultsCount();
194
+ if (process.env.NODE_ENV !== "production") {
195
+ hasWarnedAboutCacheSize = false;
196
+ }
216
197
  };
217
198
  memoized.resultsCount = () => resultsCount;
218
199
  memoized.resetResultsCount = () => {
@@ -220,6 +201,98 @@ function weakMapMemoize(func, options = {}) {
220
201
  };
221
202
  return memoized;
222
203
  }
204
+ var runIdentityFunctionCheck = (resultFunc, inputSelectorsResults, outputSelectorResult) => {
205
+ if (inputSelectorsResults.length === 1 && inputSelectorsResults[0] === outputSelectorResult) {
206
+ let isInputSameAsOutput = false;
207
+ try {
208
+ const emptyObject = {};
209
+ if (resultFunc(emptyObject) === emptyObject) isInputSameAsOutput = true;
210
+ } catch {
211
+ }
212
+ if (isInputSameAsOutput) {
213
+ let stack = void 0;
214
+ try {
215
+ throw new Error();
216
+ } catch (e) {
217
+ ;
218
+ ({ stack } = e);
219
+ }
220
+ console.warn(
221
+ "The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.",
222
+ { stack }
223
+ );
224
+ }
225
+ }
226
+ };
227
+ var withoutResultEqualityCheck = (option) => {
228
+ if (option === null || typeof option !== "object" || !("resultEqualityCheck" in option)) {
229
+ return option;
230
+ }
231
+ const optionCopy = { ...option };
232
+ delete optionCopy.resultEqualityCheck;
233
+ return optionCopy;
234
+ };
235
+ var runInputStabilityCheck = (inputSelectorResultsObject, options, inputSelectorArgs) => {
236
+ const { memoize, memoizeOptions } = options;
237
+ const { inputSelectorResults, inputSelectorResultsCopy } = inputSelectorResultsObject;
238
+ const probeMemoizeOptions = [];
239
+ const { length } = memoizeOptions;
240
+ for (let i = 0; i < length; i++) {
241
+ probeMemoizeOptions.push(withoutResultEqualityCheck(memoizeOptions[i]));
242
+ }
243
+ const createAnEmptyObject = memoize(() => ({}), ...probeMemoizeOptions);
244
+ const areInputSelectorResultsEqual = createAnEmptyObject.apply(null, inputSelectorResults) === createAnEmptyObject.apply(null, inputSelectorResultsCopy);
245
+ if (!areInputSelectorResultsEqual) {
246
+ let stack = void 0;
247
+ try {
248
+ throw new Error();
249
+ } catch (e) {
250
+ ;
251
+ ({ stack } = e);
252
+ }
253
+ console.warn(
254
+ "An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`",
255
+ {
256
+ arguments: inputSelectorArgs,
257
+ firstInputs: inputSelectorResults,
258
+ secondInputs: inputSelectorResultsCopy,
259
+ stack
260
+ }
261
+ );
262
+ }
263
+ };
264
+ function assertIsFunction(func, errorMessage = `expected a function, instead received ${typeof func}`) {
265
+ if (typeof func !== "function") {
266
+ throw new TypeError(errorMessage);
267
+ }
268
+ }
269
+ function assertIsArrayOfFunctions(array, errorMessage = `expected all items to be functions, instead received the following types: `) {
270
+ if (!array.every((item) => typeof item === "function")) {
271
+ const itemTypes = array.map(
272
+ (item) => typeof item === "function" ? `function ${item.name || "unnamed"}()` : typeof item
273
+ ).join(", ");
274
+ throw new TypeError(`${errorMessage}[${itemTypes}]`);
275
+ }
276
+ }
277
+ var ensureIsArray = (item) => {
278
+ return Array.isArray(item) ? item : [item];
279
+ };
280
+ function getDependencies(createSelectorArgs) {
281
+ const dependencies = Array.isArray(createSelectorArgs[0]) ? createSelectorArgs[0] : createSelectorArgs;
282
+ assertIsArrayOfFunctions(
283
+ dependencies,
284
+ `createSelector expects all input-selectors to be functions, but received the following types: `
285
+ );
286
+ return dependencies;
287
+ }
288
+ function collectInputSelectorResults(dependencies, inputSelectorArgs) {
289
+ const inputSelectorResults = [];
290
+ const { length } = dependencies;
291
+ for (let i = 0; i < length; i++) {
292
+ inputSelectorResults.push(dependencies[i].apply(null, inputSelectorArgs));
293
+ }
294
+ return inputSelectorResults;
295
+ }
223
296
  function createSelectorCreator(memoizeOrOptions, ...memoizeOptionsFromArgs) {
224
297
  const createSelectorCreatorOptions = typeof memoizeOrOptions === "function" ? {
225
298
  memoize: memoizeOrOptions,
@@ -262,27 +335,35 @@ function createSelectorCreator(memoizeOrOptions, ...memoizeOptionsFromArgs) {
262
335
  let firstRun = true;
263
336
  const selector = argsMemoize(function dependenciesChecker() {
264
337
  dependencyRecomputations++;
265
- const inputSelectorResults = collectInputSelectorResults(
266
- dependencies,
267
- arguments
268
- );
338
+ const { length } = dependencies;
339
+ const inputSelectorResults = new Array(length);
340
+ for (let i = 0; i < length; i++) {
341
+ inputSelectorResults[i] = dependencies[i].apply(null, arguments);
342
+ }
269
343
  lastResult = memoizedResultFunc.apply(null, inputSelectorResults);
270
344
  if (process.env.NODE_ENV !== "production") {
271
- const { devModeChecks = {} } = combinedOptions;
272
- const { identityFunctionCheck, inputStabilityCheck } = getDevModeChecksExecutionInfo(firstRun, devModeChecks);
273
- if (identityFunctionCheck.shouldRun) {
274
- identityFunctionCheck.run(
345
+ const { devModeChecks } = combinedOptions;
346
+ const identityFunctionCheck = devModeChecks !== void 0 && Object.prototype.hasOwnProperty.call(
347
+ devModeChecks,
348
+ "identityFunctionCheck"
349
+ ) ? devModeChecks.identityFunctionCheck : globalDevModeChecks.identityFunctionCheck;
350
+ const inputStabilityCheck = devModeChecks !== void 0 && Object.prototype.hasOwnProperty.call(
351
+ devModeChecks,
352
+ "inputStabilityCheck"
353
+ ) ? devModeChecks.inputStabilityCheck : globalDevModeChecks.inputStabilityCheck;
354
+ if (identityFunctionCheck === "always" || identityFunctionCheck === "once" && firstRun) {
355
+ runIdentityFunctionCheck(
275
356
  resultFunc,
276
357
  inputSelectorResults,
277
358
  lastResult
278
359
  );
279
360
  }
280
- if (inputStabilityCheck.shouldRun) {
361
+ if (inputStabilityCheck === "always" || inputStabilityCheck === "once" && firstRun) {
281
362
  const inputSelectorResultsCopy = collectInputSelectorResults(
282
363
  dependencies,
283
364
  arguments
284
365
  );
285
- inputStabilityCheck.run(
366
+ runInputStabilityCheck(
286
367
  { inputSelectorResults, inputSelectorResultsCopy },
287
368
  { memoize, memoizeOptions: finalMemoizeOptions },
288
369
  arguments