Build 589089stable
Module 458265
2,857 characters · in 29609.b896f2d9d6398168.jsDependencies
Source Raw
function(e,t,n){"use strict";n.d(t,{BN:()=>h,ER:()=>p,Ej:()=>v,RK:()=>y,UU:()=>m,cY:()=>d,jD:()=>g,we:()=>f});var r=n(38339),o=n(582128),i=n(333007),a="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 s(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function l(e,t){let n=s(e);return Math.round(t*n)/n}function c(e){let t=o.useRef(e);return a(()=>{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:m=!0,whileElementsMounted:v,open:y}=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,k]=o.useState(null),[E,x]=o.useState(null),C=o.useCallback(e=>{e!==B.current&&(B.current=e,k(e))},[]),S=o.useCallback(e=>{e!==T.current&&(T.current=e,x(e))},[]),A=h||D,O=p||E,B=o.useRef(null),T=o.useRef(null),F=o.useRef(g),P=null!=v,z=c(v),R=c(d),M=c(y),N=o.useCallback(()=>{if(!B.current||!T.current)return;let e={placement:t,strategy:n,middleware:w};R.current&&(e.platform=R.current),(0,r.rD)(B.current,T.current,e).then(e=>{let t={...e,isPositioned:!1!==M.current};j.current&&!u(F.current,t)&&(F.current=t,i.flushSync(()=>{b(t)}))})},[w,t,n,R,M]);a(()=>{!1===y&&F.current.isPositioned&&(F.current.isPositioned=!1,b(e=>({...e,isPositioned:!1})))},[y]);let j=o.useRef(!1);a(()=>(j.current=!0,()=>{j.current=!1}),[]),a(()=>{if(A&&(B.current=A),O&&(T.current=O),A&&O){if(z.current)return z.current(A,O,N);N()}},[A,O,N,z,P]);let L=o.useMemo(()=>({reference:B,floating:T,setReference:C,setFloating:S}),[C,S]),I=o.useMemo(()=>({reference:A,floating:O}),[A,O]),U=o.useMemo(()=>{let e={position:n,left:0,top:0};if(!I.floating)return e;let t=l(I.floating,g.x),r=l(I.floating,g.y);return m?{...e,transform:"translate("+t+"px, "+r+"px)",...s(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,m,I.floating,g.x,g.y]);return o.useMemo(()=>({...g,update:N,refs:L,elements:I,floatingStyles:U}),[g,N,L,I,U])}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]}),m=(e,t)=>({...(0,r.UU)(e),options:[e,t]}),v=(e,t)=>({...(0,r.Ej)(e),options:[e,t]}),y=(e,t)=>({...(0,r.RK)(e),options:[e,t]}),g=(e,t)=>({...(0,r.jD)(e),options:[e,t]})}