Build 586984stable
Module 922016
3,408 characters · in no known chunkDependencies
Required by (149)
959615510822232993433735241380554873661230673197092680683860999306794160104731105225133839138617143657163512166005174530187360191711206778217424220995227780231643232457238017244083249264251632269587270045272244287706304047308334315246315790319993320080321210324269333369340851342296342952352018352043354948370997376352403546416528417454425663436405442444444550450740465558475467477156481477492385496879501335517905525788533978540177543274554601559260570314573355579153582306583617588857589158590388593284599882601007623280625864639288645136650588655098655758657113657977664708671884671897672957682557699609703966710637728365734195742424742788744940749638764451768463776568779545782274783384786826789543822775825596831688839979843282846966862611868456869362876622882362908742928078930101938483939940950075950989956123960538961998982484983495984545984624986687987482995142999751
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";n.d(t,{Q:()=>N,Y:()=>S});var i,r,a=n(477900),s=n(582128),l=n(289873),o=n(964486),d=n(453903),c=n(503698),u=n.n(c),_=n(844222),E=n(451988),A=n(751777),h=((i=h||{})[i.TRANSLATE=1]="TRANSLATE",i[i.SCALE=2]="SCALE",i[i.FADE=3]="FADE",i);let I=Object.freeze({1:A.Tl,2:A.hs,3:A.Rv}),f=Object.freeze({top:A.ZR,bottom:A.XI,left:A.Hn,right:A.sS,center:A.pm,window_center:A.pm});function p(e){let{position:t,type:n,children:i}=e,{reducedMotion:r}=s.useContext(_.C),l=r.enabled?3:n,[o,d]=s.useState(null!=t),[c]=s.useState(()=>new E.Ep),[h,p]=s.useState(!0),T=s.useRef(null);return s.useLayoutEffect(()=>{T.current?.addEventListener("transitionend",()=>{p(!1)}),setTimeout(()=>{p(!1)},200)},[]),s.useEffect(()=>()=>c.stop(),[c]),s.useEffect(()=>{null!=t&&c.start(10,()=>d(!0))},[t,c]),(0,a.jsx)("div",{"data-popout-animating":h,className:u()(null!=t?f[t]:null,{[I[l]]:null!=t,[A.Wr]:o}),children:i})}p.Types=h;var T=n(501043),m=((r=m||{}).NONE="1",r.TRANSLATE="2",r.SCALE="3",r.FADE="4",r);let g=Object.freeze({2:p.Types.TRANSLATE,3:p.Types.SCALE,4:p.Types.FADE});class S extends s.Component{static Animation=m;ref=s.createRef();render(){let{children:e,shouldShow:t,onRequestOpen:n,onRequestClose:i,align:r,fixed:s,useRawTargetDimensions:l,onShiftClick:o,positionKey:c,popoutKey:u,preload:_,loadingComponent:E,disablePointerEvents:A,ignoreModalClicks:h,scrollBehavior:I,useMouseEnter:f,renderPopout:p,layerContext:T,position:m="right",autoInvert:g=!0,nudgeAlignIntoViewport:S=!0,avoidancePadding:N,spacing:C=8,clickTrap:O=!1}=this.props;return(0,a.jsx)(d.$,{ref:this.ref,targetElementRef:this.props.targetElementRef,preload:_,loadingComponent:E,position:m,align:null!=r?r:function(e){switch(e){case"top":case"bottom":return"left";case"left":case"right":return"top";case"center":case"window_center":return"center"}throw Error(`Unexpected position: ${e}`)}(m),autoInvert:g,fixed:s,nudgeAlignIntoViewport:S,avoidancePadding:N,useRawTargetDimensions:l,renderPopout:this.renderPopout,spacing:C,shouldShow:null!=p&&t,onRequestOpen:n,onRequestClose:i,onShiftClick:o,positionKey:c,popoutKey:u,disablePointerEvents:A,ignoreModalClicks:h,scrollBehavior:I,useMouseEnter:f,layerContext:T,clickTrap:O,children:e})}renderPopout=e=>{let{renderPopout:t,animation:n="2",animationPosition:i}=this.props;switch(null!=i&&null!=e.position&&(e.position=i),n){case"2":case"3":case"4":return(0,a.jsx)(p,{position:e.position,type:g[n],children:t(e)});case"1":return t(e)}throw Error(`Unsupported animation config: ${JSON.stringify(n)}`)}}function N(e){let{renderPopout:t,...n}=e,i=s.useRef(null),[r,d]=s.useState(0);function c(){return _(),(0,a.jsx)(a.Fragment,{})}s.useLayoutEffect(()=>{r>0&&i.current?.ref?.current?.layerRef?.current?.updatePosition()},[r]),(0,o.Ay)(()=>{let e=setTimeout(t,20+20*Math.random());return()=>clearTimeout(e)});let u=s.useRef(!1);async function _(){if(!u.current){u.current=!0;let e=setTimeout(()=>{h(()=>E),d(e=>e+1)},300),n=await t();h(()=>n),d(e=>e+1),clearTimeout(e)}}function E(){let e=i.current?.ref?.current?.domElementRef?.current,t=Math.max(100,null==e?100:e.offsetWidth-20);return(0,a.jsx)("div",{className:T.w,style:{width:t},children:(0,a.jsx)(l.y,{})})}let[A,h]=s.useState(()=>c),I=s.useRef(c);return s.useEffect(()=>{I.current=c}),s.useEffect(()=>{u.current?t().then(e=>{h(()=>e),d(e=>e+1)}):h(()=>I.current)},[t]),(0,a.jsx)(S,{ref:i,...n,renderPopout:A})}N.Animation=m}