PageSourceSearch

https://splendidstar-splendid.hf.space/static/js/useFocusRing.DHkb3Ano.js

js splendidstar-splendid.hf.space collected 2026-10-04 17:25:03 UTC 9,807 bytes, 1 lines download raw bytes

1import{o as e}from"./rolldown-runtime.C0FnF6B9.js";import{r as t}from"./emotion-is-prop-valid.esm.CuYlOKOk.js";import{A as n,D as r,F as i,G as a,H as o,O as s,R as c,U as l,X as u,Z as d,j as f,k as p,mt as m,pt as h,q as g,y as _}from"./Tooltip.bbzhtE2V.js";function v(e){return e.pointerType===``&&e.isTrusted?!0:n()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function y(e){return!n()&&e.width===0&&e.height===0||n()&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`}var b=e(t(),1),x=(0,b.createContext)({isNative:!0,open:ne,useHref:e=>e});function S(){return(0,b.useContext)(x)}function ee(e,t){let n=e.getAttribute(`target`);return(!n||n===`_self`)&&e.origin===location.origin&&!e.hasAttribute(`download`)&&!t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.shiftKey}function C(e,t,n=!0){let{metaKey:i,ctrlKey:a,altKey:c,shiftKey:l}=t;!r()&&f()&&window.event?.type?.startsWith(`key`)&&e.target===`_blank`&&(p()?i=!0:a=!0);let u=r()&&p()&&!s()?new KeyboardEvent(`keydown`,{keyIdentifier:`Enter`,metaKey:i,ctrlKey:a,altKey:c,shiftKey:l}):new MouseEvent(`click`,{metaKey:i,ctrlKey:a,altKey:c,shiftKey:l,detail:1,bubbles:!0,cancelable:!0});C.isOpening=n,o(e),e.dispatchEvent(u),C.isOpening=!1}C.isOpening=!1;function te(e,t){if(e instanceof HTMLAnchorElement)t(e);else if(e.hasAttribute(`data-href`)){let n=document.createElement(`a`);n.href=e.getAttribute(`data-href`),e.hasAttribute(`data-target`)&&(n.target=e.getAttribute(`data-target`)),e.hasAttribute(`data-rel`)&&(n.rel=e.getAttribute(`data-rel`)),e.hasAttribute(`data-download`)&&(n.download=e.getAttribute(`data-download`)),e.hasAttribute(`data-ping`)&&(n.ping=e.getAttribute(`data-ping`)),e.hasAttribute(`data-referrer-policy`)&&(n.referrerPolicy=e.getAttribute(`data-referrer-policy`)),e.appendChild(n),t(n),e.removeChild(n)}}function ne(e,t){te(e,e=>C(e,t))}function w(e){let t=S().useHref(e?.href??``),n={};if(e)for(let r of[`href`,`target`,`rel`,`download`,`ping`,`referrerPolicy`])r in e&&e[r]!==void 0&&(n[r]=r===`href`?t:e[r]);return n}function T(e,t,n,r){!t.isNative&&e.currentTarget instanceof HTMLAnchorElement&&e.currentTarget.href&&!e.isDefaultPrevented()&&ee(e.currentTarget,e)&&n&&(e.preventDefault(),t.open(e.currentTarget,e,n,r))}var E=null,D=new Set,O=new Map,k=!1,A=!1,j={Tab:!0,Escape:!0};function M(e,t){for(let n of D)n(e,t)}function re(e){return!(e.metaKey||!p()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function N(e){k=!0,!C.isOpening&&re(e)&&(E=`keyboard`,M(`keyboard`,e))}function P(e){E=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(k=!0,M(`pointer`,e))}function F(e){!C.isOpening&&v(e)&&(k=!0,E=`virtual`)}function I(e){let t=d(g(e)),n=u(g(e));g(e)===t||g(e)===n||c||!e.isTrusted||(!k&&!A&&(E=`virtual`,M(`virtual`,e)),k=!1,A=!1)}function L(){c||(k=!1,A=!0)}function R(e){if(typeof window>`u`||typeof document>`u`)return;let t=d(e),n=u(e);if(O.get(t))return;let r=t.HTMLElement.prototype.focus;Reflect.defineProperty(t.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(){k=!0,r.apply(this,arguments)}}),n.addEventListener(`keydown`,N,!0),n.addEventListener(`keyup`,N,!0),n.addEventListener(`click`,F,!0),t.addEventListener(`focus`,I,!0),t.addEventListener(`blur`,L,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,P,!0),n.addEventListener(`pointermove`,P,!0),n.addEventListener(`pointerup`,P,!0)),t.addEventListener(`beforeunload`,()=>{z(e)},{once:!0}),O.set(t,{focus:r})}var z=(e,t)=>{let n=d(e),r=u(e);t&&r.removeEventListener(`DOMContentLoaded`,t),O.has(n)&&(Reflect.defineProperty(n.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:O.get(n).focus}),r.removeEventListener(`keydown`,N,!0),r.removeEventListener(`keyup`,N,!0),r.removeEventListener(`click`,F,!0),n.removeEventListener(`focus`,I,!0),n.removeEventListener(`blur`,L,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,P,!0),r.removeEventListener(`pointermove`,P,!0),r.removeEventListener(`pointerup`,P,!0)),O.delete(n))};function ie(e){let t=u(e),n;return t.readyState===`loading`?(n=()=>{R(e)},t.addEventListener(`DOMContentLoaded`,n)):R(e),()=>z(e,n)}typeof document<`u`&&ie();function B(){return E!==`pointer`}function V(){return E}function H(e){E=e,M(e,null)}var U=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function W(e,t,n){let r=n?g(n):void 0,i=u(r),o=d(r),s=o===void 0?HTMLInputElement:o.HTMLInputElement,c=o===void 0?HTMLTextAreaElement:o.HTMLTextAreaElement,l=o===void 0?HTMLElement:o.HTMLElement,f=o===void 0?KeyboardEvent:o.KeyboardEvent,p=a(i);return e=e||p instanceof s&&!U.has(p.type)||p instanceof c||p instanceof l&&p.isContentEditable,!(e&&t===`keyboard`&&n instanceof f&&!j[n.key])}function G(e,t,n){R(),(0,b.useEffect)(()=>
1{if(n?.enabled===!1)return;let t=(t,r)=>{W(!!n?.isTextInput,t,r)&&e(B())};return D.add(t),()=>{D.delete(t)}},t)}var K=new Map,q=new Set;function J(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{let r=g(t);if(!e(t)||!r)return;let i=K.get(r);i||(i=new Set,K.set(r,i),r.addEventListener(`transitioncancel`,n,{once:!0})),i.add(t.propertyName)},n=t=>{let r=g(t);if(!e(t)||!r)return;let i=K.get(r);if(i&&(i.delete(t.propertyName),i.size===0&&(r.removeEventListener(`transitioncancel`,n),K.delete(r)),K.size===0)){for(let e of q)e();q.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,J):J());function ae(){for(let[e]of K)`isConnected`in e&&!e.isConnected&&K.delete(e)}function Y(e){requestAnimationFrame(()=>{ae(),K.size===0?e():q.add(e)})}function oe(e){if(!e.isConnected)return;let t=u(e);if(V()===`virtual`){let n=a(t);Y(()=>{let r=a(t);(r===n||r===t.body)&&e.isConnected&&o(e)})}else o(e)}function X(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e,s=(0,b.useCallback)(e=>{if(g(e)===e.currentTarget)return r&&r(e),o&&o(!1),!0},[r,o]),c=i(s),l=(0,b.useCallback)(e=>{let t=g(e),r=u(t),i=r?a(r):a();t===e.currentTarget&&t===i&&(n&&n(e),o&&o(!0),c(e))},[o,n,c]);return{focusProps:{onFocus:!t&&(n||o||r)?l:void 0,onBlur:!t&&(r||o)?s:void 0}}}function Z(e){if(e)return t=>{let n=!0;e({...t,preventDefault(){t.preventDefault()},isDefaultPrevented(){return t.isDefaultPrevented()},stopPropagation(){n=!0},continuePropagation(){n=!1,typeof t.continuePropagation==`function`&&t.continuePropagation()},isPropagationStopped(){return n}}),n&&!(typeof t.isPropagationStopped==`function`&&t.isPropagationStopped())&&t.stopPropagation()}}var se=new Set([`shift`,`alt`,`control`,`meta`,`mod`]),ce=[`Alt`,`Control`,`Meta`,`Shift`];function le(e){let t=new Set;return e.alt&&t.add(`Alt`),e.shift&&t.add(`Shift`),e.ctrl&&t.add(`Control`),e.meta&&t.add(`Meta`),e.mod&&t.add(p()?`Meta`:`Control`),t}function ue(e){let t=new Set;return e.altKey&&t.add(`Alt`),e.ctrlKey&&t.add(`Control`),e.metaKey&&t.add(`Meta`),e.shiftKey&&t.add(`Shift`),t}function Q(e){return ce.filter(t=>e.has(t))}function de(e){let t=e.split(`+`).reduce((e,t)=>{let n=t.toLowerCase();return se.has(n)?n===`shift`?e.shift=!0:n===`alt`?e.alt=!0:n===`control`?e.ctrl=!0:n===`meta`?e.meta=!0:n===`mod`&&(e.mod=!0):e.key=t,e},{shift:!1,alt:!1,ctrl:!1,meta:!1,mod:!1,key:``});if(t.key===``)throw Error(`Invalid keyboard shortcut: "${e}". Must include exactly one non-modifier key (e.g. "a", "Enter", "ArrowDown"). Combine any of Shift, Alt, Ctrl, Meta, and Mod.`);return t}function $(e){return e.toLowerCase()}var fe={space:` `,esc:`escape`,del:`delete`,ins:`insert`,left:`arrowleft`,right:`arrowright`,up:`arrowup`,down:`arrowdown`,pageup:`pageup`,pagedown:`pagedown`};function pe(e){let t=$(e);return fe[t]??t}function me(e){let t=Q(le(e)),n=pe(e.key);return t.length>0?`${t.join(`+`)}+${n}`:n}function he(e){let t=Q(ue(e)),n=$(e.key);return(t.length>0?`${t.join(`+`)}+`:``)+n}function ge(e){let t=new Map;for(let[n,r]of Object.entries(e)){let e=de(n);t.set(me(e),r)}return e=>{let n=he(e),r=t.get(n),i=r?.(e);i===void 0&&r!==void 0?i={shouldContinuePropagation:!1,shouldPreventDefault:!0}:typeof i==`boolean`&&(i={shouldContinuePropagation:!i,shouldPreventDefault:i}),i?.shouldPreventDefault&&e.preventDefault(),(!r||i?.shouldContinuePropagation)&&e.continuePropagation()}}function _e(e){let{shortcuts:t,allowRepeats:n=!1,allowComposing:r=!1}=e,i,a;if(t){let o=ge(t),s=Z(e=>{if(!l(e.currentTarget,g(e))){e.continuePropagation();return}if(e.nativeEvent?.repeat&&!n||e.nativeEvent?.isComposing&&!r){e.continuePropagation();return}o(e)}),c=Z(e=>{if(!l(e.currentTarget,g(e))){e.continuePropagation();return}if(e.nativeEvent?.repeat&&!n||e.nativeEvent?.isComposing&&!r){e.continuePropagation();return}e.continuePropagation()});i=e.onKeyDown?m(e.onKeyDown,s):s,a=e.onKeyUp?m(e.onKeyUp,c):c}else i=Z(e.onKeyDown),a=Z(e.onKeyUp);return{keyboardProps:e.isDisabled?{}:{onKeyDown:i,onKeyUp:a}}}function ve(e,t){h(()=>
vendor: 819 bytes, line 1
1{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function ye(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,i=(0,b.useRef)({isFocused:!1,isFocusVisible:t||B()}),[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(()=>i.current.isFocused&&i.current.isFocusVisible),l=(0,b.useCallback)(()=>c(i.current.isFocused&&i.current.isFocusVisible),[]),u=(0,b.useCallback)(e=>{i.current.isFocused=e,i.current.isFocusVisible=B(),o(e),l()},[l]);G(e=>{i.current.isFocusVisible=e,l()},[n,a],{enabled:a,isTextInput:n});let{focusProps:d}=X({isDisabled:r,onFocusChange:u}),{focusWithinProps:f}=_({isDisabled:!r,onFocusWithinChange:u});return{isFocused:a,isFocusVisible:s,focusProps:r?f:d}}export{oe as a,H as c,w as d,C as f,v as h,X as i,B as l,y as m,ve as n,Y as o,S as p,_e as r,V as s,ye as t,T as u};

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.