1import{H as g,_ as ge,B as be,a1 as Ce,u as ne,T as oe}from"./C2Tw9sIW.js";import{r as Pe,c as Oe}from"./DtZEl1eO.js";import{I as Ne,a4 as U,a1 as D,af as b,s as se,aN as A,ay as h,V as $,M as re,ab as ce,ai as ue}from"./D5Ir9beM.js";import{j as Q,E as Z}from"./C8F4946K.js";let _;const ke=e=>{var u;if(!g)return 0;if(_!==void 0)return _;const t=document.createElement("div");t.className=`${e}-scrollbar__wrap`,t.style.visibility="hidden",t.style.width="100px",t.style.position="absolute",t.style.top="-9999px",document.body.appendChild(t);const s=t.offsetWidth;t.style.overflow="scroll";const o=document.createElement("div");o.style.width="100%",t.appendChild(o);const r=o.offsetWidth;return(u=t.parentNode)==null||u.removeChild(t),_=s-r,_};function Ie(e,t){if(!g)return;if(!t){e.scrollTop=0;return}const s=[];let o=t.offsetParent;for(;o!==null&&e!==o&&e.contains(o);)s.push(o),o=o.offsetParent;const r=t.offsetTop+s.reduce((E,m)=>E+m.offsetTop,0),u=r+t.offsetHeight,l=e.scrollTop,v=l+e.clientHeight;r<l?e.scrollTop=r:u>v&&(e.scrollTop=u-e.clientHeight)}let p=[];const M=e=>{Q(e)===Z.esc&&p.forEach(t=>t(e))},ae=e=>{U(()=>{p.length===0&&document.addEventListener("keydown",M),g&&p.push(e)}),D(()=>{p=p.filter(t=>t!==e),p.length===0&&g&&document.removeEventListener("keydown",M)})},k="focus-trap.focus-after-trapped",I="focus-trap.focus-after-released",ie="focus-trap.focusout-prevented",j={cancelable:!0,bubbles:!1},le={cancelable:!0,bubbles:!1},q="focusAfterTrapped",Y="focusAfterReleased",fe=Symbol("elFocusTrap"),K=b(),C=b(0),x=b(0);let y=0;const ee=e=>{const t=[],s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0||o===document.activeElement?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)t.push(s.currentNode);return t},J=(e,t)=>{for(const s of e)if(!de(s,t))return s},de=(e,t)=>{if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1},ve=e=>{const t=ee(e);return[J(t,e),J(t.reverse(),e)]},pe=e=>e instanceof HTMLInputElement&&"select"in e,d=(e,t)=>{if(e){const s=document.activeElement;ne(e,{preventScroll:!0}),x.value=window.performance.now(),e!==s&&pe(e)&&t&&e.select()}};function X(e,t){const s=[...e],o=e.indexOf(t);return o!==-1&&s.splice(o,1),s}const Ee=()=>{let e=[];return{push:o=>{const r=e[0];r&&o!==r&&r.pause(),e=X(e,o),e.unshift(o)},remove:o=>{var r,u;e=X(e,o),(u=(r=e[0])==null?void 0:r.resume)==null||u.call(r)}}},me=(e,t=!1)=>{const s=document.activeElement;for(const o of e)if(d(o,t),document.activeElement!==s)return},z=Ee(),Te=()=>C.value>x.value,F=()=>{K.value="pointer",C.value=window.performance.now()},G=()=>{K.value="keyboard",C.value=window.performance.now()},we=()=>(U(()=>{y===0&&(document.addEventListener("mousedown",F),document.addEventListener("touchstart",F),document.addEventListener("keydown",G)),y++}),D(()=>{y--,y<=0&&(document.removeEventListener("mousedown",F),document.removeEventListener("touchstart",F),document.removeEventListener("keydown",G))}),{focusReason:K,lastUserFocusTimestamp:C,lastAutomatedFocusTimestamp:x}),S=e=>new CustomEvent(ie,{...le,detail:e});var he=se({name:"ElFocusTrap",inheritAttrs:!1,props:{loop:Boolean,trapped:Boolean,focusTrapEl:Object,focusStartEl:{type:[Object,String],default:"first"}},emits:[q,Y,"focusin","focusout","focusout-prevented","release-requested"],setup(e,{emit:t}){const s=b();let o,r;const{focusReason:u}=we();ae(n=>{e.trapped&&!l.paused&&t("release-requested",n)});const l={paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}},v=n=>{if(!e.loop&&!e.trapped||l.paused)return;const{altKey:c,ctrlKey:i,metaKey:a,currentTarget:T,shiftKey:V}=n,{loop:W}=e,te=Q(n)===Z.tab&&!c&&!i&&!a,w=document.activeElement;if(te&&w){const O=T,[R,N]=ve(O);if(R&&N){if(!V&&w===N){const f=S({focusReason:u.value});t("focusout-prevented",f),f.defaultPrevented||(n.preventDefault(),W&&d(R,!0))}else if(V&&[R,O].includes(w)){const f=S({focusReason:u.value});t("focusout-prevented",f),f.defaultPrevented||(n.preventDefault(),W&&d(N,!0))}}else if(w===O){const f=S({focusReason:u.value});t("focusout-prevented",f),f.defaultPrevented||n.preventDefault()}}};ce(fe,{focusTrapRef:s,onKeydown:v}),A(()=>e.focusTrapEl,n=>{n&&(s.value=n)},{immediate:!0}),A([s],([n],[c])=>{n&&(n.addEventListener("keydown",v),n.addEventListener("focusin",L),n.addEventListener("focusout",P)),c&&(c.removeEventListener("keydown",v),c.removeEventListener("focusin",L),c.removeEventListener("focusout",P))});const E=n=>{t(q,n)},m=n=>t(Y,n),L=n=>{const c=h(s);if(!c)return;const i=n.target,a=n.relatedTarget,T=i&&c.contains(i);e.trapped||a&&c.contains(a)||(o=a),T&&t("focusin",n),!l.paused&&e.trapped&&(T?r=i:d(r,!0))},P=n=>{const c=h(s);if(!(l.paused||!c))if(e.trapped){const i=n.relatedTarget;!oe(i)&&!c.contains(i)&&setTimeout(()=>
1{if(!l.paused&&e.trapped){const a=S({focusReason:u.value});t("focusout-prevented",a),a.defaultPrevented||d(r,!0)}},0)}else{const i=n.target;i&&c.contains(i)||t("focusout",n)}};async function H(){await $();const n=h(s);if(n){z.push(l);const c=n.contains(document.activeElement)?o:document.activeElement;if(o=c,!n.contains(c)){const i=new Event(k,j);n.addEventListener(k,E),n.dispatchEvent(i),i.defaultPrevented||$(()=>{let a=e.focusStartEl;re(a)||(d(a),document.activeElement!==a&&(a="first")),a==="first"&&me(ee(n),!0),(document.activeElement===c||a==="container")&&d(n)})}}}function B(){const n=h(s);if(n){n.removeEventListener(k,E);const c=new CustomEvent(I,{...j,detail:{focusReason:u.value}});n.addEventListener(I,m),n.dispatchEvent(c),!c.defaultPrevented&&(u.value=="keyboard"||!Te()||n.contains(document.activeElement))&&d(o??document.body),n.removeEventListener(I,m),z.remove(l),o=null,r=null}}return U(()=>{e.trapped&&H(),A(()=>e.trapped,n=>{n?H():B()})}),D(()=>{e.trapped&&B(),s.value&&(s.value.removeEventListener("keydown",v),s.value.removeEventListener("focusin",L),s.value.removeEventListener("focusout",P),s.value=void 0),o=null,r=null}),{onKeydown:v}}}),_e=(e,t)=>{const s=e.__vccOpts||e;for(const[o,r]of t)s[o]=r;return s};function ye(e,t,s,o,r,u){return ue(e.$slots,"default",{handleKeydown:e.onKeydown})}var Fe=_e(he,[["render",ye]]),Ue=Fe;export{fe as F,_e as _,Ue as f,ke as g,Ie as s};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.