/**
 * 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.
 */
'use strict';var b=require("react"),h=require("react-dom"),m="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?b.useLayoutEffect:b.useEffect;
function n(a,d){let [f,k]=b.useState(()=>a.getDecorators());m(()=>a.registerDecoratorListener(e=>{h.flushSync(()=>{k(e)})}),[a]);b.useEffect(()=>{k(a.getDecorators())},[a]);return b.useMemo(()=>{let e=[],l=Object.keys(f);for(let g=0;g<l.length;g++){var c=l[g];let q=b.createElement(d,{onError:p=>a._onError(p)},b.createElement(b.Suspense,{fallback:null},f[c]));c=a.getElementByKey(c);null!==c&&e.push(h.createPortal(q,c))}return e},[d,f,a])}exports.useLexicalDecorators=function(a,d){return n(a,d)}
