!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("jotai/react"),require("jotai/vanilla/utils"),require("jotai/vanilla")):"function"==typeof define&&define.amd?define(["exports","react","jotai/react","jotai/vanilla/utils","jotai/vanilla"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jotaiReactUtils={},t.React,t.jotaiReact,t.jotaiVanillaUtils,t.jotaiVanilla)}(this,function(t,e,r,n,a){"use strict";function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u=new WeakMap;var l=function(t){var e=u.get(t);return e||(e=new WeakSet,u.set(t,e)),e};t.useAtomCallback=function(t,n){var o=e.useMemo(function(){return a.atom(null,function(e,r){for(var n=arguments.length,a=new Array(n>2?n-2:0),o=2;o