Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1/*!2* tabbable 6.4.03* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE4*/5(function (global, factory) {6 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :7 typeof define === 'function' && define.amd ? define(['exports'], factory) :8 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (function () {9 var current = global.tabbable;10 var exports = global.tabbable = {};11 factory(exports);12 exports.noConflict = function () { global.tabbable = current; return exports; };13 })());14})(this, (function (exports) { 'use strict';15 16 // NOTE: separate `:not()` selectors has broader browser support than the newer17 // `:not([inert], [inert] *)` (Feb 2023)18 var candidateSelectors = ['input:not([inert]):not([inert] *)', 'select:not([inert]):not([inert] *)', 'textarea:not([inert]):not([inert] *)', 'a[href]:not([inert]):not([inert] *)', 'button:not([inert]):not([inert] *)', '[tabindex]:not(slot):not([inert]):not([inert] *)', 'audio[controls]:not([inert]):not([inert] *)', 'video[controls]:not([inert]):not([inert] *)', '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', 'details>summary:first-of-type:not([inert]):not([inert] *)', 'details:not([inert]):not([inert] *)'];19 var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');20 var NoElement = typeof Element === 'undefined';21 var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;22 var getRootNode = !NoElement && Element.prototype.getRootNode ? function (element) {23 var _element$getRootNode;24 return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element);25 } : function (element) {26 return element === null || element === void 0 ? void 0 : element.ownerDocument;27 };28 29 /**30 * Determines if a node is inert or in an inert ancestor.31 * @param {Node} [node]32 * @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to33 * see if any of them are inert. If false, only `node` itself is considered.34 * @returns {boolean} True if inert itself or by way of being in an inert ancestor.35 * False if `node` is falsy.36 */37 var _isInert = function isInert(node, lookUp) {38 var _node$getAttribute;39 if (lookUp === void 0) {40 lookUp = true;41 }42 // CAREFUL: JSDom does not support inert at all, so we can't use the `HTMLElement.inert`43 // JS API property; we have to check the attribute, which can either be empty or 'true';44 // if it's `null` (not specified) or 'false', it's an active element45 var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, 'inert');46 var inert = inertAtt === '' || inertAtt === 'true';47 48 // NOTE: this could also be handled with `node.matches('[inert], :is([inert] *)')`49 // if it weren't for `matches()` not being a function on shadow roots; the following50 // code works for any kind of node51 var result = inert || lookUp && node && (52 // closest does not exist on shadow roots, so we fall back to a manual53 // lookup upward, in case it is not defined.54 typeof node.closest === 'function' ? node.closest('[inert]') : _isInert(node.parentNode));55 return result;56 };57 58 /**59 * Determines if a node's content is editable.60 * @param {Element} [node]61 * @returns True if it's content-editable; false if it's not or `node` is falsy.62 */63 var isContentEditable = function isContentEditable(node) {64 var _node$getAttribute2;65 // CAREFUL: JSDom does not support the `HTMLElement.isContentEditable` API so we have66 // to use the attribute directly to check for this, which can either be empty or 'true';67 // if it's `null` (not specified) or 'false', it's a non-editable element68 var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, 'contenteditable');69 return attValue === '' || attValue === 'true';70 };71 72 /**73 * @param {Element} el container to check in74 * @param {boolean} includeContainer add container to check75 * @param {(node: Element) => boolean} filter filter candidates76 * @returns {Element[]}77 */78 var getCandidates = function getCandidates(el, includeContainer, filter) {79 // even if `includeContainer=false`, we still have to check it for inertness because80 // if it's inert (either by itself or via its parent), then all its children are inert81 if (_isInert(el)) {82 return [];83 }84 var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));85 if (includeContainer && matches.call(el, candidateSelector)) {86 candidates.unshift(el);87 }88 candidates = candidates.filter(filter);89 return candidates;90 };91 92 /**93 * @callback GetShadowRoot94 * @param {Element} element to check for shadow root95 * @returns {ShadowRoot|boolean} ShadowRoot if available or boolean indicating if a shadowRoot is attached but not available.96 */97 98 /**99 * @callback ShadowRootFilter100 * @param {Element} shadowHostNode the element which contains shadow content101 * @returns {boolean} true if a shadow root could potentially contain valid candidates.102 */103 104 /**105 * @typedef {Object} CandidateScope106 * @property {Element} scopeParent contains inner candidates107 * @property {Element[]} candidates list of candidates found in the scope parent108 */109 110 /**111 * @typedef {Object} IterativeOptions112 * @property {GetShadowRoot|boolean} getShadowRoot true if shadow support is enabled; falsy if not;113 * if a function, implies shadow support is enabled and either returns the shadow root of an element114 * or a boolean stating if it has an undisclosed shadow root115 * @property {(node: Element) => boolean} filter filter candidates116 * @property {boolean} flatten if true then result will flatten any CandidateScope into the returned list117 * @property {ShadowRootFilter} shadowRootFilter filter shadow roots;118 */119 120 /**121 * @param {Element[]} elements list of element containers to match candidates from122 * @param {boolean} includeContainer add container list to check123 * @param {IterativeOptions} options124 * @returns {Array.<Element|CandidateScope>}125 */126 var _getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {127 var candidates = [];128 var elementsToCheck = Array.from(elements);129 while (elementsToCheck.length) {130 var element = elementsToCheck.shift();131 if (_isInert(element, false)) {132 // no need to look up since we're drilling down133 // anything inside this container will also be inert134 continue;135 }136 if (element.tagName === 'SLOT') {137 // add shadow dom slot scope (slot itself cannot be focusable)138 var assigned = element.assignedElements();139 var content = assigned.length ? assigned : element.children;140 var nestedCandidates = _getCandidatesIteratively(content, true, options);141 if (options.flatten) {142 candidates.push.apply(candidates, nestedCandidates);143 } else {144 candidates.push({145 scopeParent: element,146 candidates: nestedCandidates147 });148 }149 } else {150 // check candidate element151 var validCandidate = matches.call(element, candidateSelector);152 if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {153 candidates.push(element);154 }155 156 // iterate over shadow content if possible157 var shadowRoot = element.shadowRoot ||158 // check for an undisclosed shadow159 typeof options.getShadowRoot === 'function' && options.getShadowRoot(element);160 161 // no inert look up because we're already drilling down and checking for inertness162 // on the way down, so all containers to this root node should have already been163 // vetted as non-inert164 var validShadowRoot = !_isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));165 if (shadowRoot && validShadowRoot) {166 // add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed167 // shadow exists, so look at light dom children as fallback BUT create a scope for any168 // child candidates found because they're likely slotted elements (elements that are169 // children of the web component element (which has the shadow), in the light dom, but170 // slotted somewhere _inside_ the undisclosed shadow) -- the scope is created below,171 // _after_ we return from this recursive call172 var _nestedCandidates = _getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);173 if (options.flatten) {174 candidates.push.apply(candidates, _nestedCandidates);175 } else {176 candidates.push({177 scopeParent: element,178 candidates: _nestedCandidates179 });180 }181 } else {182 // there's not shadow so just dig into the element's (light dom) children183 // __without__ giving the element special scope treatment184 elementsToCheck.unshift.apply(elementsToCheck, element.children);185 }186 }187 }188 return candidates;189 };190 191 /**192 * @private193 * Determines if the node has an explicitly specified `tabindex` attribute.194 * @param {HTMLElement} node195 * @returns {boolean} True if so; false if not.196 */197 var hasTabIndex = function hasTabIndex(node) {198 return !isNaN(parseInt(node.getAttribute('tabindex'), 10));199 };200 201 /**202 * Determine the tab index of a given node.203 * @param {HTMLElement} node204 * @returns {number} Tab order (negative, 0, or positive number).205 * @throws {Error} If `node` is falsy.206 */207 var getTabIndex = function getTabIndex(node) {208 if (!node) {209 throw new Error('No node provided');210 }211 if (node.tabIndex < 0) {212 // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default213 // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,214 // yet they are still part of the regular tab order; in FF, they get a default215 // `tabIndex` of 0; since Chrome still puts those elements in the regular tab216 // order, consider their tab index to be 0.217 // Also browsers do not return `tabIndex` correctly for contentEditable nodes;218 // so if they don't have a tabindex attribute specifically set, assume it's 0.219 if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) {220 return 0;221 }222 }223 return node.tabIndex;224 };225 226 /**227 * Determine the tab index of a given node __for sort order purposes__.228 * @param {HTMLElement} node229 * @param {boolean} [isScope] True for a custom element with shadow root or slot that, by default,230 * has tabIndex -1, but needs to be sorted by document order in order for its content to be231 * inserted into the correct sort position.232 * @returns {number} Tab order (negative, 0, or positive number).233 */234 var getSortOrderTabIndex = function getSortOrderTabIndex(node, isScope) {235 var tabIndex = getTabIndex(node);236 if (tabIndex < 0 && isScope && !hasTabIndex(node)) {237 return 0;238 }239 return tabIndex;240 };241 var sortOrderedTabbables = function sortOrderedTabbables(a, b) {242 return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;243 };244 var isInput = function isInput(node) {245 return node.tagName === 'INPUT';246 };247 var isHiddenInput = function isHiddenInput(node) {248 return isInput(node) && node.type === 'hidden';249 };250 var isDetailsWithSummary = function isDetailsWithSummary(node) {251 var r = node.tagName === 'DETAILS' && Array.prototype.slice.apply(node.children).some(function (child) {252 return child.tagName === 'SUMMARY';253 });254 return r;255 };256 var getCheckedRadio = function getCheckedRadio(nodes, form) {257 for (var i = 0; i < nodes.length; i++) {258 if (nodes[i].checked && nodes[i].form === form) {259 return nodes[i];260 }261 }262 };263 var isTabbableRadio = function isTabbableRadio(node) {264 if (!node.name) {265 return true;266 }267 var radioScope = node.form || getRootNode(node);268 var queryRadios = function queryRadios(name) {269 return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');270 };271 var radioSet;272 if (typeof window !== 'undefined' && typeof window.CSS !== 'undefined' && typeof window.CSS.escape === 'function') {273 radioSet = queryRadios(window.CSS.escape(node.name));274 } else {275 try {276 radioSet = queryRadios(node.name);277 } catch (err) {278 // eslint-disable-next-line no-console279 console.error('Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s', err.message);280 return false;281 }282 }283 var checked = getCheckedRadio(radioSet, node.form);284 return !checked || checked === node;285 };286 var isRadio = function isRadio(node) {287 return isInput(node) && node.type === 'radio';288 };289 var isNonTabbableRadio = function isNonTabbableRadio(node) {290 return isRadio(node) && !isTabbableRadio(node);291 };292 293 // determines if a node is ultimately attached to the window's document294 var isNodeAttached = function isNodeAttached(node) {295 var _nodeRoot;296 // The root node is the shadow root if the node is in a shadow DOM; some document otherwise297 // (but NOT _the_ document; see second 'If' comment below for more).298 // If rootNode is shadow root, it'll have a host, which is the element to which the shadow299 // is attached, and the one we need to check if it's in the document or not (because the300 // shadow, and all nodes it contains, is never considered in the document since shadows301 // behave like self-contained DOMs; but if the shadow's HOST, which is part of the document,302 // is hidden, or is not in the document itself but is detached, it will affect the shadow's303 // visibility, including all the nodes it contains). The host could be any normal node,304 // or a custom element (i.e. web component). Either way, that's the one that is considered305 // part of the document, not the shadow root, nor any of its children (i.e. the node being306 // tested).307 // To further complicate things, we have to look all the way up until we find a shadow HOST308 // that is attached (or find none) because the node might be in nested shadows...309 // If rootNode is not a shadow root, it won't have a host, and so rootNode should be the310 // document (per the docs) and while it's a Document-type object, that document does not311 // appear to be the same as the node's `ownerDocument` for some reason, so it's safer312 // to ignore the rootNode at this point, and use `node.ownerDocument`. Otherwise,313 // using `rootNode.contains(node)` will _always_ be true we'll get false-positives when314 // node is actually detached.315 // NOTE: If `nodeRootHost` or `node` happens to be the `document` itself (which is possible316 // if a tabbable/focusable node was quickly added to the DOM, focused, and then removed317 // from the DOM as in https://github.com/focus-trap/focus-trap-react/issues/905), then318 // `ownerDocument` will be `null`, hence the optional chaining on it.319 var nodeRoot = node && getRootNode(node);320 var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host;321 322 // in some cases, a detached node will return itself as the root instead of a document or323 // shadow root object, in which case, we shouldn't try to look further up the host chain324 var attached = false;325 if (nodeRoot && nodeRoot !== node) {326 var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument;327 attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node));328 while (!attached && nodeRootHost) {329 var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD;330 // since it's not attached and we have a root host, the node MUST be in a nested shadow DOM,331 // which means we need to get the host's host and check if that parent host is contained332 // in (i.e. attached to) the document333 nodeRoot = getRootNode(nodeRootHost);334 nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host;335 attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost));336 }337 }338 return attached;339 };340 var isZeroArea = function isZeroArea(node) {341 var _node$getBoundingClie = node.getBoundingClientRect(),342 width = _node$getBoundingClie.width,343 height = _node$getBoundingClie.height;344 return width === 0 && height === 0;345 };346 var isHidden = function isHidden(node, _ref) {347 var displayCheck = _ref.displayCheck,348 getShadowRoot = _ref.getShadowRoot;349 if (displayCheck === 'full-native') {350 if ('checkVisibility' in node) {351 // Chrome >= 105, Edge >= 105, Firefox >= 106, Safari >= 17.4352 // @see https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility#browser_compatibility353 var visible = node.checkVisibility({354 // Checking opacity might be desirable for some use cases, but natively,355 // opacity zero elements _are_ focusable and tabbable.356 checkOpacity: false,357 opacityProperty: false,358 contentVisibilityAuto: true,359 visibilityProperty: true,360 // This is an alias for `visibilityProperty`. Contemporary browsers361 // support both. However, this alias has wider browser support (Chrome362 // >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so363 // we include it anyway.364 checkVisibilityCSS: true365 });366 return !visible;367 }368 // Fall through to manual visibility checks369 }370 371 // NOTE: visibility will be `undefined` if node is detached from the document372 // (see notes about this further down), which means we will consider it visible373 // (this is legacy behavior from a very long way back)374 // NOTE: we check this regardless of `displayCheck="none"` because this is a375 // _visibility_ check, not a _display_ check376 if (getComputedStyle(node).visibility === 'hidden') {377 return true;378 }379 var isDirectSummary = matches.call(node, 'details>summary:first-of-type');380 var nodeUnderDetails = isDirectSummary ? node.parentElement : node;381 if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {382 return true;383 }384 if (!displayCheck || displayCheck === 'full' ||385 // full-native can run this branch when it falls through in case386 // Element#checkVisibility is unsupported387 displayCheck === 'full-native' || displayCheck === 'legacy-full') {388 if (typeof getShadowRoot === 'function') {389 // figure out if we should consider the node to be in an undisclosed shadow and use the390 // 'non-zero-area' fallback391 var originalNode = node;392 while (node) {393 var parentElement = node.parentElement;394 var rootNode = getRootNode(node);395 if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true // check if there's an undisclosed shadow396 ) {397 // node has an undisclosed shadow which means we can only treat it as a black box, so we398 // fall back to a non-zero-area test399 return isZeroArea(node);400 } else if (node.assignedSlot) {401 // iterate up slot402 node = node.assignedSlot;403 } else if (!parentElement && rootNode !== node.ownerDocument) {404 // cross shadow boundary405 node = rootNode.host;406 } else {407 // iterate up normal dom408 node = parentElement;409 }410 }411 node = originalNode;412 }413 // else, `getShadowRoot` might be true, but all that does is enable shadow DOM support414 // (i.e. it does not also presume that all nodes might have undisclosed shadows); or415 // it might be a falsy value, which means shadow DOM support is disabled416 417 // Since we didn't find it sitting in an undisclosed shadow (or shadows are disabled)418 // now we can just test to see if it would normally be visible or not, provided it's419 // attached to the main document.420 // NOTE: We must consider case where node is inside a shadow DOM and given directly to421 // `isTabbable()` or `isFocusable()` -- regardless of `getShadowRoot` option setting.422 423 if (isNodeAttached(node)) {424 // this works wherever the node is: if there's at least one client rect, it's425 // somehow displayed; it also covers the CSS 'display: contents' case where the426 // node itself is hidden in place of its contents; and there's no need to search427 // up the hierarchy either428 return !node.getClientRects().length;429 }430 431 // Else, the node isn't attached to the document, which means the `getClientRects()`432 // API will __always__ return zero rects (this can happen, for example, if React433 // is used to render nodes onto a detached tree, as confirmed in this thread:434 // https://github.com/facebook/react/issues/9117#issuecomment-284228870)435 //436 // It also means that even window.getComputedStyle(node).display will return `undefined`437 // because styles are only computed for nodes that are in the document.438 //439 // NOTE: THIS HAS BEEN THE CASE FOR YEARS. It is not new, nor is it caused by tabbable440 // somehow. Though it was never stated officially, anyone who has ever used tabbable441 // APIs on nodes in detached containers has actually implicitly used tabbable in what442 // was later (as of v5.2.0 on Apr 9, 2021) called `displayCheck="none"` mode -- essentially443 // considering __everything__ to be visible because of the innability to determine styles.444 //445 // v6.0.0: As of this major release, the default 'full' option __no longer treats detached446 // nodes as visible with the 'none' fallback.__447 if (displayCheck !== 'legacy-full') {448 return true; // hidden449 }450 // else, fallback to 'none' mode and consider the node visible451 } else if (displayCheck === 'non-zero-area') {452 // NOTE: Even though this tests that the node's client rect is non-zero to determine453 // whether it's displayed, and that a detached node will __always__ have a zero-area454 // client rect, we don't special-case for whether the node is attached or not. In455 // this mode, we do want to consider nodes that have a zero area to be hidden at all456 // times, and that includes attached or not.457 return isZeroArea(node);458 }459 460 // visible, as far as we can tell, or per current `displayCheck=none` mode, we assume461 // it's visible462 return false;463 };464 465 // form fields (nested) inside a disabled fieldset are not focusable/tabbable466 // unless they are in the _first_ <legend> element of the top-most disabled467 // fieldset468 var isDisabledFromFieldset = function isDisabledFromFieldset(node) {469 if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {470 var parentNode = node.parentElement;471 // check if `node` is contained in a disabled <fieldset>472 while (parentNode) {473 if (parentNode.tagName === 'FIELDSET' && parentNode.disabled) {474 // look for the first <legend> among the children of the disabled <fieldset>475 for (var i = 0; i < parentNode.children.length; i++) {476 var child = parentNode.children.item(i);477 // when the first <legend> (in document order) is found478 if (child.tagName === 'LEGEND') {479 // if its parent <fieldset> is not nested in another disabled <fieldset>,480 // return whether `node` is a descendant of its first <legend>481 return matches.call(parentNode, 'fieldset[disabled] *') ? true : !child.contains(node);482 }483 }484 // the disabled <fieldset> containing `node` has no <legend>485 return true;486 }487 parentNode = parentNode.parentElement;488 }489 }490 491 // else, node's tabbable/focusable state should not be affected by a fieldset's492 // enabled/disabled state493 return false;494 };495 var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {496 if (node.disabled || isHiddenInput(node) || isHidden(node, options) ||497 // For a details element with a summary, the summary element gets the focus498 isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {499 return false;500 }501 return true;502 };503 var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {504 if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {505 return false;506 }507 return true;508 };509 var isShadowRootTabbable = function isShadowRootTabbable(shadowHostNode) {510 var tabIndex = parseInt(shadowHostNode.getAttribute('tabindex'), 10);511 if (isNaN(tabIndex) || tabIndex >= 0) {512 return true;513 }514 // If a custom element has an explicit negative tabindex,515 // browsers will not allow tab targeting said element's children.516 return false;517 };518 519 /**520 * @param {Array.<Element|CandidateScope>} candidates521 * @returns Element[]522 */523 var _sortByOrder = function sortByOrder(candidates) {524 var regularTabbables = [];525 var orderedTabbables = [];526 candidates.forEach(function (item, i) {527 var isScope = !!item.scopeParent;528 var element = isScope ? item.scopeParent : item;529 var candidateTabindex = getSortOrderTabIndex(element, isScope);530 var elements = isScope ? _sortByOrder(item.candidates) : element;531 if (candidateTabindex === 0) {532 isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);533 } else {534 orderedTabbables.push({535 documentOrder: i,536 tabIndex: candidateTabindex,537 item: item,538 isScope: isScope,539 content: elements540 });541 }542 });543 return orderedTabbables.sort(sortOrderedTabbables).reduce(function (acc, sortable) {544 sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);545 return acc;546 }, []).concat(regularTabbables);547 };548 var tabbable = function tabbable(container, options) {549 options = options || {};550 var candidates;551 if (options.getShadowRoot) {552 candidates = _getCandidatesIteratively([container], options.includeContainer, {553 filter: isNodeMatchingSelectorTabbable.bind(null, options),554 flatten: false,555 getShadowRoot: options.getShadowRoot,556 shadowRootFilter: isShadowRootTabbable557 });558 } else {559 candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));560 }561 return _sortByOrder(candidates);562 };563 var focusable = function focusable(container, options) {564 options = options || {};565 var candidates;566 if (options.getShadowRoot) {567 candidates = _getCandidatesIteratively([container], options.includeContainer, {568 filter: isNodeMatchingSelectorFocusable.bind(null, options),569 flatten: true,570 getShadowRoot: options.getShadowRoot571 });572 } else {573 candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));574 }575 return candidates;576 };577 var isTabbable = function isTabbable(node, options) {578 options = options || {};579 if (!node) {580 throw new Error('No node provided');581 }582 if (matches.call(node, candidateSelector) === false) {583 return false;584 }585 return isNodeMatchingSelectorTabbable(options, node);586 };587 var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe:not([inert]):not([inert] *)').join(',');588 var isFocusable = function isFocusable(node, options) {589 options = options || {};590 if (!node) {591 throw new Error('No node provided');592 }593 if (matches.call(node, focusableCandidateSelector) === false) {594 return false;595 }596 return isNodeMatchingSelectorFocusable(options, node);597 };598 599 exports.focusable = focusable;600 exports.getTabIndex = getTabIndex;601 exports.isFocusable = isFocusable;602 exports.isTabbable = isTabbable;603 exports.tabbable = tabbable;604 605}));606//# sourceMappingURL=index.umd.js.map607 