forked from bytedance/Elkeid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
307b7d.1.min.js
1 lines (1 loc) · 12.4 KB
/
307b7d.1.min.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{619:function(e,n,t){"use strict";var r=t(31),o=t(15),u=t(0),a=t.n(u);t(55);function i(e,n){return t=n,r=function(n){return e.forEach((function(e){return function(e,n){return"function"==typeof e?e(n):e&&(e.current=n),e}(e,n)}))},(o=Object(u.useState)((function(){return{value:t,callback:r,facade:{get current(){return o.value},set current(e){var n=o.value;n!==e&&(o.value=e,o.callback(e,n))}}}}))[0]).callback=r,o.facade;var t,r,o}var c={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},d=function(e){var n=e.children;return u.createElement(u.Fragment,null,u.createElement("div",{key:"guard-first","data-focus-guard":!0,"data-focus-auto-guard":!0,style:c}),n,n&&u.createElement("div",{key:"guard-last","data-focus-guard":!0,"data-focus-auto-guard":!0,style:c}))};d.propTypes={},d.defaultProps={children:null};var f=function(){return(f=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function s(e){return e}function l(e,n){void 0===n&&(n=s);var t=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return t.length?t[t.length-1]:e},useMedium:function(e){var o=n(e,r);return t.push(o),function(){t=t.filter((function(e){return e!==o}))}},assignSyncMedium:function(e){for(r=!0;t.length;){var n=t;t=[],n.forEach(e)}t={push:function(n){return e(n)},filter:function(){return t}}},assignMedium:function(e){r=!0;var n=[];if(t.length){var o=t;t=[],o.forEach(e),n=t}var u=function(){var t=n;n=[],t.forEach(e)},a=function(){return Promise.resolve().then(u)};a(),t={push:function(e){n.push(e),a()},filter:function(e){return n=n.filter(e),t}}}}}function v(e,n){return void 0===n&&(n=s),l(e,n)}var m=v({},(function(e){return{target:e.target,currentTarget:e.currentTarget}})),p=v(),h=v(),b=function(e){void 0===e&&(e={});var n=l(null);return n.options=f({async:!0,ssr:!1},e),n}({async:!0}),g=[],y=u.forwardRef((function(e,n){var t,r=u.useState(),a=r[0],d=r[1],f=u.useRef(),s=u.useRef(!1),l=u.useRef(null),v=e.children,h=e.disabled,y=e.noFocusGuards,E=e.persistentFocus,N=e.crossFrame,x=e.autoFocus,O=(e.allowTextSelection,e.group),w=e.className,k=e.whiteList,T=e.shards,F=void 0===T?g:T,I=e.as,S=void 0===I?"div":I,M=e.lockProps,C=void 0===M?{}:M,A=e.sideCar,P=e.returnFocus,D=e.onActivation,j=e.onDeactivation,B=u.useState({})[0],L=u.useCallback((function(){l.current=l.current||document&&document.activeElement,f.current&&D&&D(f.current),s.current=!0}),[D]),U=u.useCallback((function(){s.current=!1,j&&j(f.current)}),[j]),_=u.useCallback((function(e){var n=l.current;if(Boolean(P)&&n&&n.focus){var t="object"==typeof P?P:void 0;l.current=null,e?Promise.resolve().then((function(){return n.focus(t)})):n.focus(t)}}),[P]),G=u.useCallback((function(e){s.current&&m.useMedium(e)}),[]),q=p.useMedium,R=u.useCallback((function(e){f.current!==e&&(f.current=e,d(e))}),[]);var W=Object(o.a)(((t={})["data-focus-lock-disabled"]=h&&"disabled",t["data-focus-lock"]=O,t),C),V=!0!==y,J=V&&"tail"!==y,K=i([n,R]);return u.createElement(u.Fragment,null,V&&[u.createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:h?-1:0,style:c}),u.createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:h?-1:1,style:c})],!h&&u.createElement(A,{id:B,sideCar:b,observed:a,disabled:h,persistentFocus:E,crossFrame:N,autoFocus:x,whiteList:k,shards:F,onActivation:L,onDeactivation:U,returnFocus:_}),u.createElement(S,Object(o.a)({ref:K},W,{className:w,onBlur:q,onFocus:G}),v),J&&u.createElement("div",{"data-focus-guard":!0,tabIndex:h?-1:0,style:c}))}));y.propTypes={},y.defaultProps={children:void 0,disabled:!1,returnFocus:!1,noFocusGuards:!1,autoFocus:!0,persistentFocus:!1,crossFrame:!0,allowTextSelection:void 0,group:void 0,className:void 0,whiteList:void 0,shards:void 0,as:"div",lockProps:{},onActivation:void 0,onDeactivation:void 0};var E=y,N=t(18);var x=function(e,n){return function(t){var r,o=[];function i(){r=e(o.map((function(e){return e.props}))),n(r)}var c,d,f,s=function(e){function n(){return e.apply(this,arguments)||this}Object(N.a)(n,e),n.peek=function(){return r};var u=n.prototype;return u.componentDidMount=function(){o.push(this),i()},u.componentDidUpdate=function(){i()},u.componentWillUnmount=function(){var e=o.indexOf(this);o.splice(e,1),i()},u.render=function(){return a.a.createElement(t,this.props)},n}(u.PureComponent);return c=s,d="displayName",f="SideEffect("+function(e){return e.displayName||e.name||"Component"}(t)+")",d in c?Object.defineProperty(c,d,{value:f,enumerable:!0,configurable:!0,writable:!0}):c[d]=f,s}},O=function(e){for(var n=Array(e.length),t=0;t<e.length;++t)n[t]=e[t];return n},w=function(e){return Array.isArray(e)?e:[e]},k=function(e){return e.parentNode?k(e.parentNode):e},T=function(e){return w(e).filter(Boolean).reduce((function(e,n){var t=n.getAttribute("data-focus-lock");return e.push.apply(e,t?function(e){for(var n=new Set,t=e.length,r=0;r<t;r+=1)for(var o=r+1;o<t;o+=1){var u=e[r].compareDocumentPosition(e[o]);(u&Node.DOCUMENT_POSITION_CONTAINED_BY)>0&&n.add(o),(u&Node.DOCUMENT_POSITION_CONTAINS)>0&&n.add(r)}return e.filter((function(e,t){return!n.has(t)}))}(O(k(n).querySelectorAll('[data-focus-lock="'+t+'"]:not([data-focus-lock-disabled="disabled"])'))):[n]),e}),[])},F=function(e){return Boolean(O(e.querySelectorAll("iframe")).some((function(e){return e===document.activeElement})))},I=function(e){var n=document&&document.activeElement;return!(!n||n.dataset&&n.dataset.focusGuard)&&T(e).reduce((function(e,t){return e||t.contains(n)||F(t)}),!1)},S=function(e){return"INPUT"===e.tagName&&"radio"===e.type},M=function(e,n){return S(e)&&e.name?function(e,n){return n.filter(S).filter((function(n){return n.name===e.name})).filter((function(e){return e.checked}))[0]||e}(e,n):e},C=function(e){return e[0]&&e.length>1?M(e[0],e):e[0]},A=function(e,n){return e.length>1?e.indexOf(M(e[n],e)):n},P=function(e,n){return!e||e===document||e&&e.nodeType===Node.DOCUMENT_NODE||!function(e){if(e.nodeType!==Node.ELEMENT_NODE)return!1;var n=window.getComputedStyle(e,null);return!(!n||!n.getPropertyValue)&&("none"===n.getPropertyValue("display")||"hidden"===n.getPropertyValue("visibility"))}(e)&&n(e.parentNode&&e.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e.parentNode.host:e.parentNode)},D=function(e,n){var t=e.get(n);if(void 0!==t)return t;var r=P(n,D.bind(void 0,e));return e.set(n,r),r},j=function(e){return Boolean(e&&e.dataset&&e.dataset.focusGuard)},B=function(e){return!j(e)},L=function(e){return Boolean(e)},U=function(e,n,t,r){var o=e.length,u=e[0],a=e[o-1],i=j(t);if(!(e.indexOf(t)>=0)){var c,d,f=n.indexOf(t),s=r?n.indexOf(r):f,l=r?e.indexOf(r):-1,v=f-s,m=n.indexOf(u),p=n.indexOf(a),h=(c=n,d=new Set,c.forEach((function(e){return d.add(M(e,c))})),c.filter((function(e){return d.has(e)}))),b=h.indexOf(t)-(r?h.indexOf(r):f),g=A(e,0),y=A(e,o-1);return-1===f||-1===l?"NEW_FOCUS":!v&&l>=0?l:f<=m&&i&&Math.abs(v)>1?y:f>=p&&i&&Math.abs(v)>1?g:v&&Math.abs(b)>1?l:f<=m?y:f>p?g:v?Math.abs(v)>1?l:(o+l+v)%o:void 0}},_=function(e,n){var t=e.tabIndex-n.tabIndex,r=e.index-n.index;if(t){if(!e.tabIndex)return 1;if(!n.tabIndex)return-1}return t||r},G=function(e,n,t){return O(e).map((function(e,n){return{node:e,index:n,tabIndex:t&&-1===e.tabIndex?(e.dataset||{}).focusGuard?0:-1:e.tabIndex}})).filter((function(e){return!n||e.tabIndex>=0})).sort(_)},q=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"].join(","),R=q+", [data-focus-guard]",W=function(e,n){return e.reduce((function(e,t){return e.concat(O(t.querySelectorAll(n?R:q)),t.parentNode?O(t.parentNode.querySelectorAll(q)).filter((function(e){return e===t})):[])}),[])},V=function(e,n){return O(e).filter((function(e){return D(n,e)})).filter((function(e){return function(e){return!(("INPUT"===e.tagName||"BUTTON"===e.tagName)&&("hidden"===e.type||e.disabled))}(e)}))},J=function(e,n,t){return G(V(W(e,t),n),!0,t)},K=function(e,n){return G(V(W(e),n),!1)},Y=function(e,n){return V((t=e.querySelectorAll("[data-autofocus-inside]"),O(t).map((function(e){return W([e])})).reduce((function(e,n){return e.concat(n)}),[])),n);var t},z=function(e,n){return void 0===n&&(n=[]),n.push(e),e.parentNode&&z(e.parentNode,n),n},H=function(e,n){for(var t=z(e),r=z(n),o=0;o<t.length;o+=1){var u=t[o];if(r.indexOf(u)>=0)return u}return!1},Q=function(e,n,t){var r=w(e),o=w(n),u=r[0],a=!1;return o.filter(Boolean).forEach((function(e){a=H(a||e,e)||a,t.filter(Boolean).forEach((function(e){var n=H(u,e);n&&(a=!a||n.contains(a)?n:H(n,a))}))})),a},X=function(e,n){var t=document&&document.activeElement,r=T(e).filter(B),o=Q(t||e,e,r),u=new Map,a=K(r,u),i=J(r,u).filter((function(e){var n=e.node;return B(n)}));if(i[0]||(i=a)[0]){var c,d,f,s,l=K([o],u).map((function(e){return e.node})),v=(c=l,d=i,f=new Map,d.forEach((function(e){return f.set(e.node,e)})),c.map((function(e){return f.get(e)})).filter(L)),m=v.map((function(e){return e.node})),p=U(m,l,t,n);if("NEW_FOCUS"===p){var h=a.map((function(e){return e.node})).filter((s=function(e,n){return e.reduce((function(e,t){return e.concat(Y(t,n))}),[])}(r,u),function(e){return e.autofocus||e.dataset&&!!e.dataset.autofocus||s.indexOf(e)>=0}));return{node:h&&h.length?C(h):C(m)}}return void 0===p?p:v[p]}},Z=0,$=!1,ee=function(e,n){var t,r=X(e,n);if(!$&&r){if(Z>2)return console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),$=!0,void setTimeout((function(){$=!1}),1);Z++,(t=r.node).focus(),"contentWindow"in t&&t.contentWindow&&t.contentWindow.focus(),Z--}};function ne(e){var n=window.setImmediate;void 0!==n?n(e):setTimeout(e,1)}var te=function(){return document&&document.activeElement===document.body||document&&O(document.querySelectorAll("[data-no-focus-lock]")).some((function(e){return e.contains(document.activeElement)}))},re=null,oe=null,ue=null,ae=!1,ie=function(){return!0};function ce(e,n,t,r){var o=null,u=e;do{var a=r[u];if(a.guard)a.node.dataset.focusAutoGuard&&(o=a);else{if(!a.lockItem)break;if(u!==e)return;o=null}}while((u+=t)!==n);o&&(o.node.tabIndex=0)}var de=function(e){return e&&"current"in e?e.current:e},fe=function(){var e,n,t,r,o,u,a,i=!1;if(re){var c=re,d=c.observed,f=c.persistentFocus,s=c.autoFocus,l=c.shards,v=c.crossFrame,m=d||ue&&ue.portaledElement,p=document&&document.activeElement;if(m){var h=[m].concat(l.map(de).filter(Boolean));if(p&&!function(e){return(re.whiteList||ie)(e)}(p)||(f||(v?Boolean(ae):"meanwhile"===ae)||!te()||!oe&&s)&&(!m||I(h)||(a=p,ue&&ue.portaledElement===a)||(document&&!oe&&p&&!s?(p.blur&&p.blur(),document.body.focus()):(i=ee(h,oe),ue={})),ae=!1,oe=document&&document.activeElement),document){var b=document&&document.activeElement,g=(n=T(e=h).filter(B),t=Q(e,e,n),r=new Map,o=J([t],r,!0),u=J(n,r).filter((function(e){var n=e.node;return B(n)})).map((function(e){return e.node})),o.map((function(e){var n=e.node;return{node:n,index:e.index,lockItem:u.indexOf(n)>=0,guard:j(n)}}))),y=g.map((function(e){return e.node})).indexOf(b);y>-1&&(g.filter((function(e){var n=e.guard,t=e.node;return n&&t.dataset.focusAutoGuard})).forEach((function(e){return e.node.removeAttribute("tabIndex")})),ce(y,g.length,1,g),ce(y,-1,-1,g))}}}return i},se=function(e){fe()&&e&&(e.stopPropagation(),e.preventDefault())},le=function(){return ne(fe)},ve=function(e){var n=e.target,t=e.currentTarget;t.contains(n)||(ue={observerNode:t,portaledElement:n})},me=function(){ae="just",setTimeout((function(){ae="meanwhile"}),0)};m.assignSyncMedium(ve),p.assignMedium(le),h.assignMedium((function(e){return e({moveFocusInside:ee,focusInside:I})}));var pe=x((function(e){return e.filter((function(e){return!e.disabled}))}),(function(e){var n=e.slice(-1)[0];n&&!re&&(document.addEventListener("focusin",se,!0),document.addEventListener("focusout",le),window.addEventListener("blur",me));var t=re,r=t&&n&&n.id===t.id;re=n,t&&!r&&(t.onDeactivation(),e.filter((function(e){return e.id===t.id})).length||t.returnFocus(!n)),n?(oe=null,r&&t.observed===n.observed||n.onActivation(),fe(),ne(fe)):(document.removeEventListener("focusin",se,!0),document.removeEventListener("focusout",le),window.removeEventListener("blur",me),oe=null)}))((function(){return null})),he=u.forwardRef((function(e,n){return u.createElement(E,Object(o.a)({sideCar:pe,ref:n},e))})),be=E.propTypes||{};be.sideCar,Object(r.a)(be,["sideCar"]);he.propTypes={};var ge=he;n.a=ge}}]);