1import{aQ as M,aR as q,b1 as ee,W as te,ba as ae,U as ce,as as ue,$ as ie}from"./CGKYsAdb.js";import{H as R,a8 as k,b as _,d as ne,Q as N,w as C,u as T,n as j,C as de,p as fe,Y as le,P as ve,ax as pe}from"./CnWaw5kY.js";const Ee='a[href],button:not([disabled]),button:not([hidden]),:not([tabindex="-1"]),input:not([disabled]),input:not([type="hidden"]),select:not([disabled]),textarea:not([disabled])',be=e=>getComputedStyle(e).position==="fixed"?!1:e.offsetParent!==null,Ke=e=>Array.from(e.querySelectorAll(Ee)).filter(t=>se(t)&&be(t)),se=e=>{if(e.tabIndex>0||e.tabIndex===0&&e.getAttribute("tabIndex")!==null)return!0;if(e.tabIndex<0||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true")return!1;switch(e.nodeName){case"A":return!!e.href&&e.rel!=="ignore";case"INPUT":return!(e.type==="hidden"||e.type==="file");case"BUTTON":case"SELECT":case"TEXTAREA":return!0;default:return!1}};const Te=e=>!e.getAttribute("aria-owns"),$e=(e,t,s)=>{const{parentNode:o}=e;if(!o)return null;const a=o.querySelectorAll(s),c=Array.prototype.indexOf.call(a,e);return a[c+t]||null},Be=e=>{e&&(e.focus(),!Te(e)&&e.click())},w="focus-trap.focus-after-trapped",O="focus-trap.focus-after-released",me="focus-trap.focusout-prevented",W={cancelable:!0,bubbles:!1},Fe={cancelable:!0,bubbles:!1},Q="focusAfterTrapped",Y="focusAfterReleased",ye=Symbol("elFocusTrap"),I=_(),S=_(0),U=_(0);let m=0;const oe=e=>{const t=[],s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const a=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||a?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(!_e(s,t))return s},_e=(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},Se=e=>{const t=oe(e),s=J(t,e),o=J(t.reverse(),e);return[s,o]},Le=e=>e instanceof HTMLInputElement&&"select"in e,l=(e,t)=>{if(e&&e.focus){const s=document.activeElement;let o=!1;M(e)&&!se(e)&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","-1"),o=!0),e.focus({preventScroll:!0}),U.value=window.performance.now(),e!==s&&Le(e)&&t&&e.select(),M(e)&&o&&e.removeAttribute("tabindex")}};function X(e,t){const s=[...e],o=e.indexOf(t);return o!==-1&&s.splice(o,1),s}const Pe=()=>{let e=[];return{push:o=>{const a=e[0];a&&o!==a&&a.pause(),e=X(e,o),e.unshift(o)},remove:o=>{var a,c;e=X(e,o),(c=(a=e[0])==null?void 0:a.resume)==null||c.call(a)}}},ge=(e,t=!1)=>{const s=document.activeElement;for(const o of e)if(l(o,t),document.activeElement!==s)return},z=Pe(),he=()=>S.value>U.value,F=()=>{I.value="pointer",S.value=window.performance.now()},G=()=>{I.value="keyboard",S.value=window.performance.now()},Ae=()=>(R(()=>{m===0&&(document.addEventListener("mousedown",F),document.addEventListener("touchstart",F),document.addEventListener("keydown",G)),m++}),k(()=>{m--,m<=0&&(document.removeEventListener("mousedown",F),document.removeEventListener("touchstart",F),document.removeEventListener("keydown",G))}),{focusReason:I,lastUserFocusTimestamp:S,lastAutomatedFocusTimestamp:U}),y=e=>new CustomEvent(me,{...Fe,detail:e});let p=[];const Z=e=>{e.code===ee.esc&&p.forEach(t=>t(e))},Ce=e=>{R(()=>{p.length===0&&document.addEventListener("keydown",Z),q&&p.push(e)}),k(()=>{p=p.filter(t=>t!==e),p.length===0&&q&&document.removeEventListener("keydown",Z)})},we=ne({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=_();let o,a;const{focusReason:c}=Ae();Ce(n=>{e.trapped&&!v.paused&&t("release-requested",n)});const v={paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}},E=n=>{if(!e.loop&&!e.trapped||v.paused)return;const{code:r,altKey:u,ctrlKey:i,metaKey:d,currentTarget:D,shiftKey:H}=n,{loop:V}=e,re=r===ee.tab&&!u&&!i&&!d,b=document.activeElement;if(re&&b){const g=D,[h,A]=Se(g);if(h&&A){if(!H&&b===A){const f=y({focusReason:c.value});t("focusout-prevented",f),f.defaultPrevented||(n.preventDefault(),V&&l(h,!0))}else if(H&&[h,g].includes(b)){const f=y({focusReason:c.value});t("focusout-prevented",f),f.defaultPrevented||(n.preventDefault(),V&&l(A,!0))}}else if(b===g){const f=y({focusReason:c.value});t("focusout-prevented",f),f.defaultPrevented||n.preventDefault()}}};fe(ye,{focusTrapRef:s,onKeydown:E}),C(()=>e.focusTrapEl,n=>{n&&(s.value=n)},{immediate:!0}),C([s],([n],[r])=>{n&&(n.addEventListener("keydown",E),n.addEventListener("focusin",L),n.addEventListener("focusout",P)),r&&(r.removeEventListener("keydown",E),r.removeEventListener("focusin",L),r.removeEventListener("focusout",P))});const x=n=>{t(Q,n)},K=n=>t(Y,n),L=n=>{const r=T(s);if(!r)return;const u=n.target,i=n.relatedTarget,d=u&&r.contains(u);e.trapped||i&&r.contains(i)||(o=i),d&&t("focusin",n),!v.paused&&e.trapped&&(d?a=u:l(a,!0))},P=n=>{const r=T(s);if(!(v.paused||!r))if(e.trapped){const u=n.relatedTarget;!ae(u)&&!r.contains(u)&&setTimeout(()=>
1{if(!v.paused&&e.trapped){const i=y({focusReason:c.value});t("focusout-prevented",i),i.defaultPrevented||l(a,!0)}},0)}else{const u=n.target;u&&r.contains(u)||t("focusout",n)}};async function $(){await j();const n=T(s);if(n){z.push(v);const r=n.contains(document.activeElement)?o:document.activeElement;if(o=r,!n.contains(r)){const i=new Event(w,W);n.addEventListener(w,x),n.dispatchEvent(i),i.defaultPrevented||j(()=>{let d=e.focusStartEl;de(d)||(l(d),document.activeElement!==d&&(d="first")),d==="first"&&ge(oe(n),!0),(document.activeElement===r||d==="container")&&l(n)})}}}function B(){const n=T(s);if(n){n.removeEventListener(w,x);const r=new CustomEvent(O,{...W,detail:{focusReason:c.value}});n.addEventListener(O,K),n.dispatchEvent(r),!r.defaultPrevented&&(c.value=="keyboard"||!he()||n.contains(document.activeElement))&&l(o??document.body),n.removeEventListener(O,K),z.remove(v)}}return R(()=>{e.trapped&&$(),C(()=>e.trapped,n=>{n?$():B()})}),k(()=>{e.trapped&&B(),s.value&&(s.value.removeEventListener("keydown",E),s.value.removeEventListener("focusin",L),s.value.removeEventListener("focusout",P),s.value=void 0)}),{onKeydown:E}}});function Oe(e,t,s,o,a,c){return N(e.$slots,"default",{handleKeydown:e.onKeydown})}var De=te(we,[["render",Oe],["__file","focus-trap.vue"]]);const Ne=ce({to:{type:ue([String,Object]),required:!0},disabled:Boolean}),Re=ne({__name:"teleport",props:Ne,setup(e){return(t,s)=>t.disabled?N(t.$slots,"default",{key:0}):(ve(),le(pe,{key:1,to:t.to},[N(t.$slots,"default")],8,["to"]))}});var ke=te(Re,[["__file","teleport.vue"]]);const He=ie(ke);export{De as E,ye as F,He as a,l as b,Te as c,Be as f,$e as g,se as i,Ke as o,Ne as t};
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.