import { __exports as d } from "../../../../../../../_virtual/with-selector.development.js";
import M from "react";
import { __require as b } from "../../shim/index.js";
/**
 * @license React
 * use-sync-external-store-shim/with-selector.development.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var s;
function H() {
  return s ? d : (s = 1, process.env.NODE_ENV !== "production" && (function() {
    function A(r, u) {
      return r === u && (r !== 0 || 1 / r === 1 / u) || r !== r && u !== u;
    }
    typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
    var i = M, R = b(), T = typeof Object.is == "function" ? Object.is : A, V = R.useSyncExternalStore, D = i.useRef, S = i.useEffect, p = i.useMemo, G = i.useDebugValue;
    d.useSyncExternalStoreWithSelector = function(r, u, a, c, f) {
      var _ = D(null);
      if (_.current === null) {
        var t = { hasValue: !1, value: null };
        _.current = t;
      } else t = _.current;
      _ = p(
        function() {
          function m(e) {
            if (!v) {
              if (v = !0, l = e, e = c(e), f !== void 0 && t.hasValue) {
                var o = t.value;
                if (f(o, e))
                  return O = o;
              }
              return O = e;
            }
            if (o = O, T(l, e))
              return o;
            var E = c(e);
            return f !== void 0 && f(o, E) ? (l = e, o) : (l = e, O = E);
          }
          var v = !1, l, O, L = a === void 0 ? null : a;
          return [
            function() {
              return m(u());
            },
            L === null ? void 0 : function() {
              return m(L());
            }
          ];
        },
        [u, a, c, f]
      );
      var n = V(r, _[0], _[1]);
      return S(
        function() {
          t.hasValue = !0, t.value = n;
        },
        [n]
      ), G(n), n;
    }, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
  })(), d);
}
export {
  H as __require
};
