Build 576754stable
Module 879821
2,856 characters · in 25536.0ec29f5a59959fec.jsDependencies
Source Raw
function(e,t,n){"use strict";n.d(t,{BN:()=>h,ER:()=>p,Ej:()=>y,RK:()=>m,UU:()=>v,cY:()=>d,jD:()=>g,we:()=>f});var r=n(38339),o=n(64700),a=n(340287),i="u">typeof document?o.useLayoutEffect:function(){};function u(e,t){let n,r,o;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!u(e[r],t[r]))return!1;return!0}if((n=(o=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!({}).hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){let n=o[r];if(("_owner"!==n||!e.$$typeof)&&!u(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function l(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function s(e,t){let n=l(e);return Math.round(t*n)/n}function c(e){let t=o.useRef(e);return i(()=>{t.current=e}),t}function f(e){void 0===e&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:f=[],platform:d,elements:{reference:h,floating:p}={},transform:v=!0,whileElementsMounted:y,open:m}=e,[g,b]=o.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[w,_]=o.useState(f);u(w,f)||_(f);let[D,x]=o.useState(null),[k,E]=o.useState(null),C=o.useCallback(e=>{e!==B.current&&(B.current=e,x(e))},[]),A=o.useCallback(e=>{e!==F.current&&(F.current=e,E(e))},[]),S=h||D,O=p||k,B=o.useRef(null),F=o.useRef(null),T=o.useRef(g),P=null!=y,j=c(y),R=c(d),M=c(m),N=o.useCallback(()=>{if(!B.current||!F.current)return;let e={placement:t,strategy:n,middleware:w};R.current&&(e.platform=R.current),(0,r.rD)(B.current,F.current,e).then(e=>{let t={...e,isPositioned:!1!==M.current};L.current&&!u(T.current,t)&&(T.current=t,a.flushSync(()=>{b(t)}))})},[w,t,n,R,M]);i(()=>{!1===m&&T.current.isPositioned&&(T.current.isPositioned=!1,b(e=>({...e,isPositioned:!1})))},[m]);let L=o.useRef(!1);i(()=>(L.current=!0,()=>{L.current=!1}),[]),i(()=>{if(S&&(B.current=S),O&&(F.current=O),S&&O){if(j.current)return j.current(S,O,N);N()}},[S,O,N,j,P]);let z=o.useMemo(()=>({reference:B,floating:F,setReference:C,setFloating:A}),[C,A]),U=o.useMemo(()=>({reference:S,floating:O}),[S,O]),I=o.useMemo(()=>{let e={position:n,left:0,top:0};if(!U.floating)return e;let t=s(U.floating,g.x),r=s(U.floating,g.y);return v?{...e,transform:"translate("+t+"px, "+r+"px)",...l(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,v,U.floating,g.x,g.y]);return o.useMemo(()=>({...g,update:N,refs:z,elements:U,floatingStyles:I}),[g,N,z,U,I])}let d=(e,t)=>({...(0,r.cY)(e),options:[e,t]}),h=(e,t)=>({...(0,r.BN)(e),options:[e,t]}),p=(e,t)=>({...(0,r.ER)(e),options:[e,t]}),v=(e,t)=>({...(0,r.UU)(e),options:[e,t]}),y=(e,t)=>({...(0,r.Ej)(e),options:[e,t]}),m=(e,t)=>({...(0,r.RK)(e),options:[e,t]}),g=(e,t)=>({...(0,r.jD)(e),options:[e,t]})}