From b0a51ad9975a74a14c38efa95faa93de78be0b9d Mon Sep 17 00:00:00 2001 From: Udo Schnurpfeil Date: Tue, 17 Dec 2024 10:10:32 +0100 Subject: [PATCH] feat: Reimplement paginator for sheet (#5824) progress... issue: TOBAGO-2243 --- .../myfaces/tobago/component/Pageable.java | 60 ----- .../myfaces/tobago/event/PageActionEvent.java | 13 +- .../component/AbstractUIPaginator.java | 11 +- .../internal/component/AbstractUISheet.java | 9 +- .../renderer/PaginatorListRenderer.java | 39 +-- .../renderer/PaginatorPageRenderer.java | 34 +-- .../renderkit/renderer/PaginatorRenderer.java | 52 ++-- .../renderer/PaginatorRowRenderer.java | 25 +- .../renderkit/renderer/SheetRenderer.java | 173 ++++-------- .../taglib/component/SheetTagDeclaration.java | 2 +- .../tobago/internal/util/JsonUtils.java | 36 +++ .../tobago/renderkit/html/DataAttributes.java | 2 + .../internal/util/JsonUtilsUnitTest.java | 19 ++ .../renderer/sheet/sheet-paginatorList.html | 11 +- .../renderer/sheet/sheet-paging.html | 47 ++-- .../080-sheet/10-sort/Sheet_Sorting.test.js | 250 +++++++++++++----- .../080-sheet/15-paginator/Paginator.xhtml | 6 +- .../Sheet_Selectionchange.test.js | 5 +- .../Sheet_Margin_Bottom.test.js | 2 +- .../Column_Selector.test.js | 28 +- .../3000-sheet/40-paginator/Paginator.xhtml | 3 +- .../3000-sheet/80-lazy-sort/Lazy_Sort.test.js | 2 +- .../src/main/js/tobago.js | 6 +- .../src/main/js/tobago.js.map | 2 +- .../src/main/ts/tobago-init.ts | 1 + .../src/main/ts/tobago-paginator-list.ts | 32 +++ .../src/main/ts/tobago-paginator.ts | 70 +++-- .../resources/tobago/test/tobago-test-tool.js | 21 +- 28 files changed, 564 insertions(+), 397 deletions(-) delete mode 100644 tobago-core/src/main/java/org/apache/myfaces/tobago/component/Pageable.java create mode 100644 tobago-theme/tobago-theme-standard/src/main/ts/tobago-paginator-list.ts diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Pageable.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Pageable.java deleted file mode 100644 index d77fda9f62..0000000000 --- a/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Pageable.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.myfaces.tobago.component; - -import org.apache.myfaces.tobago.internal.component.AbstractUILink; -import org.apache.myfaces.tobago.internal.component.AbstractUISheet; -import org.apache.myfaces.tobago.util.ComponentUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import jakarta.faces.component.UIComponent; -import jakarta.faces.component.behavior.AjaxBehavior; -import jakarta.faces.context.FacesContext; -import java.lang.invoke.MethodHandles; -import java.util.Map; - -public interface Pageable { - - Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - String SUFFIX_PAGE_ACTION = "pageAction"; // XXX may be renamed - - default AbstractUILink ensurePagingCommand( - final FacesContext facesContext, final AbstractUISheet sheet, final String facet, final String id, - final boolean disabled) { - - final Map facets = sheet.getFacets(); - AbstractUILink command = (AbstractUILink) facets.get(facet); - if (command == null) { - command = (AbstractUILink) ComponentUtils.createComponent(facesContext, Tags.link.componentType(), - RendererTypes.Link, SUFFIX_PAGE_ACTION + id); - command.setRendered(true); - command.setDisabled(disabled); - command.setTransient(true); - facets.put(facet, command); - - // add AjaxBehavior - final AjaxBehavior behavior = sheet.createReloadBehavior(sheet); - command.addClientBehavior("click", behavior); - } - return command; - } -} diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageActionEvent.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageActionEvent.java index b682b402af..311d45c32b 100644 --- a/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageActionEvent.java +++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageActionEvent.java @@ -19,6 +19,8 @@ package org.apache.myfaces.tobago.event; +import org.apache.myfaces.tobago.internal.util.JsonUtils; + import jakarta.faces.event.ActionEvent; import jakarta.faces.component.UIComponent; @@ -26,7 +28,7 @@ public class PageActionEvent extends ActionEvent { private static final long serialVersionUID = 3364193750247386220L; - private SheetAction action; + private final SheetAction action; private int value; public PageActionEvent(final UIComponent component, final SheetAction action) { @@ -34,6 +36,15 @@ public PageActionEvent(final UIComponent component, final SheetAction action) { this.action = action; } + public PageActionEvent(final UIComponent component, final JsonUtils.SheetActionRecord sheetActionRecord) { + super(component); + this.action = sheetActionRecord.action(); + final Integer target = sheetActionRecord.target(); + if (target != null) { + this.value = target; + } + } + /** * Returns the action type ({@link SheetAction}). */ diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPaginator.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPaginator.java index d20ce65608..95f56824cc 100644 --- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPaginator.java +++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPaginator.java @@ -19,19 +19,21 @@ package org.apache.myfaces.tobago.internal.component; +import org.apache.myfaces.tobago.component.SupportFieldId; import org.apache.myfaces.tobago.component.Visual; import org.apache.myfaces.tobago.util.ComponentUtils; import jakarta.faces.component.UIComponent; import jakarta.faces.component.UIOutput; +import jakarta.faces.context.FacesContext; -public abstract class AbstractUIPaginator extends UIOutput implements Visual { +public abstract class AbstractUIPaginator extends UIOutput implements Visual, SupportFieldId { public abstract String getFor(); public abstract boolean isAlwaysVisible(); - // todo: might be an interface instead of AbstractUISheet + // todo: might be an interface instead of AbstractUISheet public AbstractUISheet getPageable() { final String forId = getFor(); if (forId != null) { @@ -42,4 +44,9 @@ public AbstractUISheet getPageable() { } return ComponentUtils.findAncestor(this, AbstractUISheet.class); } + + @Override + public String getFieldId(final FacesContext facesContext) { + return getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "field"; + } } diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java index faa029ea09..2cc6dc2665 100644 --- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java +++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java @@ -20,7 +20,6 @@ package org.apache.myfaces.tobago.internal.component; import org.apache.myfaces.tobago.component.Attributes; -import org.apache.myfaces.tobago.component.Pageable; import org.apache.myfaces.tobago.component.Visual; import org.apache.myfaces.tobago.event.PageActionEvent; import org.apache.myfaces.tobago.event.SheetAction; @@ -81,8 +80,7 @@ */ @ListenerFor(systemEventClass = PreRenderComponentEvent.class) public abstract class AbstractUISheet extends AbstractUIData - implements SheetStateChangeSource, SortActionSource, ClientBehaviorHolder, Visual, Pageable, - ComponentSystemEventListener { + implements SheetStateChangeSource, SortActionSource, ClientBehaviorHolder, Visual, ComponentSystemEventListener { private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -698,12 +696,13 @@ public boolean isLazyUpdate(FacesContext facesContext) { final String clientId = getClientId(facesContext); final String sheetClientIdWithAction = - clientId + UINamingContainer.getSeparatorChar(facesContext) + Pageable.SUFFIX_PAGE_ACTION + SheetAction.lazy; + clientId + UINamingContainer.getSeparatorChar(facesContext) + "pageAction" + SheetAction.lazy; +// TODO: please use something like this: +// final String sheetClientIdWithAction = clientId + ComponentUtils.SUB_SEPARATOR + SheetAction.lazy; return sheetClientIdWithAction.equals(sourceId); } - public void init(final FacesContext facesContext) { sort(facesContext, null); layoutHeader(); diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PaginatorListRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PaginatorListRenderer.java index d2e6c0c610..b0f11ff038 100644 --- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PaginatorListRenderer.java +++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PaginatorListRenderer.java @@ -26,7 +26,9 @@ import org.apache.myfaces.tobago.layout.Arrows; import org.apache.myfaces.tobago.renderkit.css.BootstrapClass; import org.apache.myfaces.tobago.renderkit.css.Icons; +import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes; import org.apache.myfaces.tobago.renderkit.html.HtmlElements; +import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes; import org.apache.myfaces.tobago.util.ComponentUtils; import org.apache.myfaces.tobago.webapp.TobagoResponseWriter; import org.slf4j.Logger; @@ -41,10 +43,6 @@ public class PaginatorListRenderer extends Pa private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - @Override - public void decodeInternal(final FacesContext facesContext, final T paginator) { - } - @Override public void encodeBeginInternal(final FacesContext facesContext, final T paginator) throws IOException { @@ -58,6 +56,13 @@ public void encodeBeginInternal(final FacesContext facesContext, final T paginat writer.writeClassAttribute( visible ? null : BootstrapClass.D_NONE, paginator.getCustomClass()); + + writer.startElement(HtmlElements.INPUT); + writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN); + writer.writeIdAttribute(paginator.getFieldId(facesContext)); + writer.writeNameAttribute(clientId); + writer.endElement(HtmlElements.INPUT); + if (sheet != null) { writer.startElement(HtmlElements.UL); writer.writeClassAttribute(BootstrapClass.PAGINATION); @@ -104,44 +109,42 @@ public void encodeBeginInternal(final FacesContext facesContext, final T paginat final Arrows arrows = paginator.getArrows(); if (arrows == Arrows.show || arrows == Arrows.auto) { final boolean disabled = sheet.isAtBeginning(); - encodeLink( - facesContext, sheet, disabled, SheetAction.first, null, Icons.SKIP_START, null); - encodeLink(facesContext, sheet, disabled, SheetAction.prev, null, Icons.CARET_LEFT, null); + encodeLink(facesContext, disabled, SheetAction.first, null, Icons.SKIP_START, null); + encodeLink(facesContext, disabled, SheetAction.prev, null, Icons.CARET_LEFT, null); } - int skip = prevs.size() > 0 ? prevs.get(0) : 1; + int skip = !prevs.isEmpty() ? prevs.get(0) : 1; if (!(arrows == Arrows.show || arrows == Arrows.auto) && skip > 1) { skip -= linkCount - (linkCount / 2); skip--; if (skip < 1) { skip = 1; } - encodeLink(facesContext, sheet, false, SheetAction.toPage, skip, Icons.THREE_DOTS, null); + encodeLink(facesContext, false, SheetAction.toPage, skip, Icons.THREE_DOTS, null); } for (final Integer prev : prevs) { - encodeLink(facesContext, sheet, false, SheetAction.toPage, prev, null, null); + encodeLink(facesContext, false, SheetAction.toPage, prev, null, null); } - encodeLink(facesContext, sheet, false, SheetAction.toPage, - sheet.getCurrentPage() + 1, null, BootstrapClass.ACTIVE); + encodeLink(facesContext, false, SheetAction.toPage, sheet.getCurrentPage() + 1, null, BootstrapClass.ACTIVE); for (final Integer next : nexts) { - encodeLink(facesContext, sheet, false, SheetAction.toPage, next, null, null); + encodeLink(facesContext, false, SheetAction.toPage, next, null, null); } - skip = nexts.size() > 0 ? nexts.get(nexts.size() - 1) : pages; + skip = !nexts.isEmpty() ? nexts.get(nexts.size() - 1) : pages; if (!(arrows == Arrows.show || arrows == Arrows.auto) && skip < pages) { skip += linkCount / 2; skip++; if (skip > pages) { skip = pages; } - encodeLink(facesContext, sheet, false, SheetAction.toPage, skip, Icons.THREE_DOTS, null); + encodeLink(facesContext, false, SheetAction.toPage, skip, Icons.THREE_DOTS, null); } if (arrows == Arrows.show || arrows == Arrows.auto) { final boolean disabled = sheet.isAtEnd(); - encodeLink(facesContext, sheet, disabled, SheetAction.next, null, Icons.CARET_RIGHT, null); - encodeLink(facesContext, sheet, disabled || !sheet.hasRowCount(), SheetAction.last, null, - Icons.SKIP_END, null); + final boolean disabledEnd = disabled || !sheet.hasRowCount(); + encodeLink(facesContext, disabled, SheetAction.next, null, Icons.CARET_RIGHT, null); + encodeLink(facesContext, disabledEnd, SheetAction.last, null, Icons.SKIP_END, null); } writer.endElement(HtmlElements.UL); } else { diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PaginatorPageRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PaginatorPageRenderer.java index 46ebcdfef7..02775e8a65 100644 --- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PaginatorPageRenderer.java +++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PaginatorPageRenderer.java @@ -21,7 +21,6 @@ import org.apache.myfaces.tobago.component.Facets; import org.apache.myfaces.tobago.event.SheetAction; -import org.apache.myfaces.tobago.internal.component.AbstractUILink; import org.apache.myfaces.tobago.internal.component.AbstractUIPaginatorPage; import org.apache.myfaces.tobago.internal.component.AbstractUISheet; import org.apache.myfaces.tobago.renderkit.css.BootstrapClass; @@ -33,23 +32,14 @@ import org.apache.myfaces.tobago.util.ComponentUtils; import org.apache.myfaces.tobago.util.ResourceUtils; import org.apache.myfaces.tobago.webapp.TobagoResponseWriter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import jakarta.faces.context.FacesContext; import java.io.IOException; -import java.lang.invoke.MethodHandles; import java.text.MessageFormat; import java.util.Locale; public class PaginatorPageRenderer extends PaginatorRenderer { - private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - @Override - public void decodeInternal(final FacesContext facesContext, final T component) { - } - @Override public void encodeBeginInternal(final FacesContext facesContext, final T paginator) throws IOException { @@ -58,21 +48,20 @@ public void encodeBeginInternal(final FacesContext facesContext, final T paginat final boolean visible = paginator.isAlwaysVisible() || sheet.needMoreThanOnePage(); writer.startElement(HtmlElements.TOBAGO_PAGINATOR_PAGE); - writer.writeIdAttribute(paginator.getClientId(facesContext)); + final String clientId = paginator.getClientId(facesContext); + writer.writeIdAttribute(clientId); writer.writeClassAttribute( visible ? null : BootstrapClass.D_NONE, - BootstrapClass.PAGINATION, paginator.getCustomClass()); - final AbstractUILink command - = sheet.ensurePagingCommand(facesContext, sheet, Facets.pagerPage.name(), SheetAction.toPage.name(), false); - final String pagerCommandId = command.getClientId(facesContext); + writer.startElement(HtmlElements.UL); + writer.writeClassAttribute(BootstrapClass.PAGINATION); if (sheet.isShowPageRangeArrows()) { final boolean disabled = sheet.isAtBeginning(); encodeLink( - facesContext, sheet, disabled, SheetAction.first, null, Icons.SKIP_START, null); - encodeLink(facesContext, sheet, disabled, SheetAction.prev, null, Icons.CARET_LEFT, null); + facesContext, disabled, SheetAction.first, null, Icons.SKIP_START, null); + encodeLink(facesContext, disabled, SheetAction.prev, null, Icons.CARET_LEFT, null); } writer.startElement(HtmlElements.LI); writer.writeClassAttribute(BootstrapClass.PAGE_ITEM); @@ -105,8 +94,8 @@ public void encodeBeginInternal(final FacesContext facesContext, final T paginat writer.writeText(Integer.toString(first)); writer.endElement(HtmlElements.SPAN); writer.startElement(HtmlElements.INPUT); - writer.writeIdAttribute(pagerCommandId); - writer.writeNameAttribute(pagerCommandId); + writer.writeIdAttribute(paginator.getFieldId(facesContext)); + writer.writeNameAttribute(clientId); writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.TEXT); writer.writeAttribute(HtmlAttributes.VALUE, first); if (!unknown) { @@ -123,10 +112,11 @@ public void encodeBeginInternal(final FacesContext facesContext, final T paginat writer.endElement(HtmlElements.LI); if (sheet.isShowPageRangeArrows()) { final boolean disabled = sheet.isAtEnd(); - encodeLink(facesContext, sheet, disabled, SheetAction.next, null, Icons.CARET_RIGHT, null); - encodeLink(facesContext, sheet, disabled || !sheet.hasRowCount(), SheetAction.last, null, - Icons.SKIP_END, null); + encodeLink(facesContext, disabled, SheetAction.next, null, Icons.CARET_RIGHT, null); + encodeLink(facesContext, disabled || !sheet.hasRowCount(), SheetAction.last, null, Icons.SKIP_END, null); } + + writer.endElement(HtmlElements.UL); } @Override diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PaginatorRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PaginatorRenderer.java index 5c7ccced0d..1312a4e968 100644 --- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PaginatorRenderer.java +++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PaginatorRenderer.java @@ -18,42 +18,64 @@ */ package org.apache.myfaces.tobago.internal.renderkit.renderer; -import org.apache.myfaces.tobago.component.Attributes; +import org.apache.myfaces.tobago.event.PageActionEvent; import org.apache.myfaces.tobago.event.SheetAction; -import org.apache.myfaces.tobago.internal.component.AbstractUILink; import org.apache.myfaces.tobago.internal.component.AbstractUIPaginator; import org.apache.myfaces.tobago.internal.component.AbstractUISheet; +import org.apache.myfaces.tobago.internal.util.JsonUtils; import org.apache.myfaces.tobago.renderkit.RendererBase; import org.apache.myfaces.tobago.renderkit.css.BootstrapClass; import org.apache.myfaces.tobago.renderkit.css.CssItem; import org.apache.myfaces.tobago.renderkit.css.Icons; +import org.apache.myfaces.tobago.renderkit.html.DataAttributes; import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes; import org.apache.myfaces.tobago.renderkit.html.HtmlButtonTypes; import org.apache.myfaces.tobago.renderkit.html.HtmlElements; -import org.apache.myfaces.tobago.util.ComponentUtils; import org.apache.myfaces.tobago.util.ResourceUtils; import org.apache.myfaces.tobago.webapp.TobagoResponseWriter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import jakarta.faces.context.FacesContext; import java.io.IOException; +import java.lang.invoke.MethodHandles; import java.text.MessageFormat; import java.util.Locale; +import java.util.Map; public abstract class PaginatorRenderer extends RendererBase { + private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + @Override + public void decodeInternal(final FacesContext facesContext, final T paginator) { + final Map requestParameterMap = facesContext.getExternalContext().getRequestParameterMap(); + final String sourceId = requestParameterMap.get("jakarta.faces.source"); + final String clientId = paginator.getClientId(facesContext); + if (LOG.isDebugEnabled()) { + LOG.debug("clientId {}", clientId); + LOG.debug("jakarta.faces.source {}", sourceId); + } + if (clientId.equals(sourceId)) { + final String value = requestParameterMap.get(clientId); + if (value != null) { + final AbstractUISheet sheet = paginator.getPageable(); + if (sheet != null) { + final JsonUtils.SheetActionRecord sheetActionRecord = JsonUtils.decodeSheetAction(value); + LOG.debug("record='{}'", sheetActionRecord); + sheet.queueEvent(new PageActionEvent(sheet, sheetActionRecord)); + } else { + LOG.warn("No sheet found for paginator {}", clientId); + } + } + } + } + protected void encodeLink( - final FacesContext facesContext, final AbstractUISheet data, + final FacesContext facesContext, final boolean disabled, final SheetAction action, final Integer target, final Icons icon, final CssItem liClass) throws IOException { - final String facet = action == SheetAction.toPage || action == SheetAction.toRow - ? action.name() + "-" + target - : action.name(); - final AbstractUILink command = data.ensurePagingCommand(facesContext, data, facet, facet, disabled); - if (target != null) { - ComponentUtils.setAttribute(command, Attributes.pagingTarget, target); - } - final Locale locale = facesContext.getViewRoot().getLocale(); final String message = ResourceUtils.getString(facesContext, action.getBundleKey()); final String tip = new MessageFormat(message, locale).format(new Integer[]{target}); // needed fot ToPage @@ -64,9 +86,9 @@ protected void encodeLink( writer.startElement(HtmlElements.BUTTON); writer.writeAttribute(HtmlAttributes.TYPE, HtmlButtonTypes.BUTTON); writer.writeClassAttribute(BootstrapClass.PAGE_LINK); - writer.writeIdAttribute(command.getClientId(facesContext)); writer.writeAttribute(HtmlAttributes.TITLE, tip, true); writer.writeAttribute(HtmlAttributes.DISABLED, disabled); + writer.writeAttribute(DataAttributes.ACTION, JsonUtils.encode(action, target), false); if (icon != null) { writer.startElement(HtmlElements.I); writer.writeClassAttribute(icon); @@ -74,10 +96,6 @@ protected void encodeLink( } else { writer.writeText(String.valueOf(target)); } - if (!disabled) { - encodeBehavior(writer, facesContext, command); - } - data.getFacets().remove(facet); writer.endElement(HtmlElements.BUTTON); writer.endElement(HtmlElements.LI); } diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PaginatorRowRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PaginatorRowRenderer.java index 8a15796cb6..a9f4460575 100644 --- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PaginatorRowRenderer.java +++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PaginatorRowRenderer.java @@ -19,9 +19,6 @@ package org.apache.myfaces.tobago.internal.renderkit.renderer; -import org.apache.myfaces.tobago.component.Facets; -import org.apache.myfaces.tobago.event.SheetAction; -import org.apache.myfaces.tobago.internal.component.AbstractUILink; import org.apache.myfaces.tobago.internal.component.AbstractUIPaginatorRow; import org.apache.myfaces.tobago.internal.component.AbstractUISheet; import org.apache.myfaces.tobago.internal.util.StringUtils; @@ -29,26 +26,16 @@ import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes; import org.apache.myfaces.tobago.renderkit.html.HtmlElements; import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes; -import org.apache.myfaces.tobago.util.ComponentUtils; import org.apache.myfaces.tobago.util.ResourceUtils; import org.apache.myfaces.tobago.webapp.TobagoResponseWriter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import jakarta.faces.context.FacesContext; import java.io.IOException; -import java.lang.invoke.MethodHandles; import java.text.MessageFormat; import java.util.Locale; public class PaginatorRowRenderer extends PaginatorRenderer { - private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - @Override - public void decodeInternal(final FacesContext facesContext, final T component) { - } - @Override public void encodeBeginInternal(final FacesContext facesContext, final T paginator) throws IOException { @@ -57,7 +44,8 @@ public void encodeBeginInternal(final FacesContext facesContext, final T paginat final boolean visible = paginator.isAlwaysVisible() || sheet.needMoreThanOnePage(); writer.startElement(HtmlElements.TOBAGO_PAGINATOR_ROW); - writer.writeIdAttribute(paginator.getClientId(facesContext)); + final String clientId = paginator.getClientId(facesContext); + writer.writeIdAttribute(clientId); writer.writeClassAttribute( visible ? null : BootstrapClass.D_NONE, BootstrapClass.PAGINATION, @@ -71,10 +59,6 @@ public void encodeBeginInternal(final FacesContext facesContext, final T paginat BootstrapClass.PAGE_LINK, BootstrapClass.TEXT_NOWRAP); - final AbstractUILink command - = sheet.ensurePagingCommand(facesContext, sheet, Facets.pagerRow.name(), SheetAction.toRow.name(), false); - final String pagerCommandId = command.getClientId(facesContext); - if (sheet.getRowCount() != 0) { final Locale locale = facesContext.getViewRoot().getLocale(); final int first = sheet.getFirst() + 1; @@ -99,8 +83,8 @@ public void encodeBeginInternal(final FacesContext facesContext, final T paginat writer.writeText(Integer.toString(first)); writer.endElement(HtmlElements.SPAN); writer.startElement(HtmlElements.INPUT); - writer.writeIdAttribute(pagerCommandId); - writer.writeNameAttribute(pagerCommandId); + writer.writeIdAttribute(paginator.getFieldId(facesContext)); + writer.writeNameAttribute(clientId); writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.TEXT); writer.writeAttribute(HtmlAttributes.VALUE, first); final int maxLength = Integer.toString(sheet.getRowCount()).length(); @@ -114,7 +98,6 @@ public void encodeBeginInternal(final FacesContext facesContext, final T paginat writer.writeText(formatted); } } - ComponentUtils.removeFacet(sheet, Facets.pagerRow); writer.endElement(HtmlElements.SPAN); writer.endElement(HtmlElements.SPAN); } diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java index a3839ccd92..fe86f94939 100644 --- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java +++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java @@ -22,7 +22,6 @@ import org.apache.myfaces.tobago.component.Attributes; import org.apache.myfaces.tobago.component.Facets; import org.apache.myfaces.tobago.component.LabelLayout; -import org.apache.myfaces.tobago.component.Pageable; import org.apache.myfaces.tobago.component.RendererTypes; import org.apache.myfaces.tobago.component.Tags; import org.apache.myfaces.tobago.component.UIOut; @@ -30,8 +29,6 @@ import org.apache.myfaces.tobago.component.UIPaginatorPage; import org.apache.myfaces.tobago.component.UIPaginatorRow; import org.apache.myfaces.tobago.context.Markup; -import org.apache.myfaces.tobago.event.PageActionEvent; -import org.apache.myfaces.tobago.event.SheetAction; import org.apache.myfaces.tobago.event.SortActionEvent; import org.apache.myfaces.tobago.internal.component.AbstractUIColumn; import org.apache.myfaces.tobago.internal.component.AbstractUIColumnBase; @@ -77,12 +74,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import jakarta.faces.application.Application; import jakarta.faces.component.NamingContainer; import jakarta.faces.component.UIColumn; import jakarta.faces.component.UIComponent; import jakarta.faces.component.UIData; -import jakarta.faces.component.UINamingContainer; import jakarta.faces.component.behavior.AjaxBehavior; import jakarta.faces.context.FacesContext; import java.io.IOException; @@ -158,7 +153,6 @@ public void decodeInternal(final FacesContext facesContext, final T component) { } RenderUtils.decodedStateOfTreeData(facesContext, component); - decodeSheetAction(facesContext, component); decodeColumnAction(facesContext, columns); /* this will be done by the jakarta.faces.component.UIData.processDecodes() because these are facets. for (UIComponent facet : sheet.getFacets().values()) { @@ -183,62 +177,6 @@ private void decodeColumnAction(final FacesContext facesContext, final List map = facesContext.getExternalContext().getRequestParameterMap(); - value = map.get(sourceId); - } else { - value = actionString.substring(index + 1); - } - try { - target = Integer.parseInt(value); - } catch (final NumberFormatException e) { - LOG.error("Can't parse integer value for action " + action.name() + ": " + value); - break; - } - event.setValue(target); - break; - default: - } - if (event != null) { - component.queueEvent(event); - } - } - } - @Override public void encodeBeginInternal(final FacesContext facesContext, final T component) throws IOException { @@ -247,76 +185,81 @@ public void encodeBeginInternal(final FacesContext facesContext, final T compone final TobagoResponseWriter writer = getResponseWriter(facesContext); final PaginatorMode paginator = component.getPaginator(); - LOG.info("paginator={}", paginator); + LOG.debug("paginator={}", paginator); switch (paginator) { case list, auto -> { - final UIPaginatorList paginatorList = (UIPaginatorList) ComponentUtils.createComponent( - facesContext, Tags.paginatorList.componentType(), RendererTypes.PaginatorList, "_paginator_list"); - paginatorList.setTransient(true); - final UIComponent after = ensureAfterFacetPaginator(facesContext, component); - after.getChildren().add(paginatorList); + if (after.getChildCount() == 0) { + final UIPaginatorList paginatorList = (UIPaginatorList) ComponentUtils.createComponent( + facesContext, Tags.paginatorList.componentType(), RendererTypes.PaginatorList, "_paginator_list"); + after.getChildren().add(paginatorList); + } } case page -> { - final UIPaginatorPage paginatorPage = (UIPaginatorPage) ComponentUtils.createComponent( - facesContext, Tags.paginatorPage.componentType(), RendererTypes.PaginatorPage, "_paginator_page"); - paginatorPage.setTransient(true); - final UIComponent after = ensureAfterFacetPaginator(facesContext, component); - after.getChildren().add(paginatorPage); + if (after.getChildCount() == 0) { + final UIPaginatorPage paginatorPage = (UIPaginatorPage) ComponentUtils.createComponent( + facesContext, Tags.paginatorPage.componentType(), RendererTypes.PaginatorPage, "_paginator_page"); + after.getChildren().add(paginatorPage); + } } case row -> { - final UIPaginatorRow paginatorRow = (UIPaginatorRow) ComponentUtils.createComponent( - facesContext, Tags.paginatorRow.componentType(), RendererTypes.PaginatorRow, "_paginator_row"); - paginatorRow.setTransient(true); - final UIComponent after = ensureAfterFacetPaginator(facesContext, component); - after.getChildren().add(paginatorRow); - } - case useShowAttributes -> { - final Map paginatorMap = new HashMap<>(); - - if (!ShowPosition.none.equals(component.getShowRowRange()) && component.isPagingVisible()) { + if (after.getChildCount() == 0) { final UIPaginatorRow paginatorRow = (UIPaginatorRow) ComponentUtils.createComponent( facesContext, Tags.paginatorRow.componentType(), RendererTypes.PaginatorRow, "_paginator_row"); - paginatorRow.setAlwaysVisible(component.isShowPagingAlways()); - paginatorRow.setTransient(true); - paginatorMap.put(component.getShowRowRange(), paginatorRow); + after.getChildren().add(paginatorRow); } + } + case useShowAttributes -> { + boolean initialized = component.getAttributes().get("useShowAttributesInitialized") != null; - if (!ShowPosition.none.equals(component.getShowDirectLinks()) && component.isPagingVisible()) { - final UIPaginatorList paginatorList = (UIPaginatorList) ComponentUtils.createComponent( - facesContext, Tags.paginatorList.componentType(), RendererTypes.PaginatorList, "_paginator_list"); - paginatorList.setAlwaysVisible(component.isShowPagingAlways()); - paginatorList.setArrows(component.isShowDirectLinksArrows()? Arrows.show : Arrows.hide); - paginatorList.setMax(component.getDirectLinkCount()); - paginatorList.setTransient(true); - paginatorMap.put(component.getShowDirectLinks(), paginatorList); - } + if (!initialized) { + final Map paginatorMap = new HashMap<>(); - if (!ShowPosition.none.equals(component.getShowPageRange()) && component.isPagingVisible()) { - final UIPaginatorPage paginatorPage = (UIPaginatorPage) ComponentUtils.createComponent( - facesContext, Tags.paginatorPage.componentType(), RendererTypes.PaginatorPage, "_paginator_page"); - paginatorPage.setAlwaysVisible(component.isShowPagingAlways()); - paginatorPage.setTransient(true); - paginatorMap.put(component.getShowPageRange(), paginatorPage); - } + final ShowPosition rangePosition = component.getShowRowRange(); + if (!ShowPosition.none.equals(rangePosition) && component.isPagingVisible()) { + final UIPaginatorRow paginatorRow = (UIPaginatorRow) ComponentUtils.createComponent( + facesContext, Tags.paginatorRow.componentType(), RendererTypes.PaginatorRow, "_paginator_row"); + paginatorRow.setAlwaysVisible(component.isShowPagingAlways()); + paginatorMap.put(rangePosition, paginatorRow); + } + + final ShowPosition listPosition = component.getShowDirectLinks(); + if (!ShowPosition.none.equals(listPosition) && component.isPagingVisible()) { + final UIPaginatorList paginatorList = (UIPaginatorList) ComponentUtils.createComponent( + facesContext, Tags.paginatorList.componentType(), RendererTypes.PaginatorList, "_paginator_list"); + paginatorList.setAlwaysVisible(component.isShowPagingAlways()); + paginatorList.setArrows(component.isShowDirectLinksArrows() ? Arrows.show : Arrows.hide); + paginatorList.setMax(component.getDirectLinkCount()); + paginatorMap.put(listPosition, paginatorList); + } - if (!paginatorMap.isEmpty()) { - final UIComponent after = ensureAfterFacetPaginator(facesContext, component); + final ShowPosition pagePosition = component.getShowPageRange(); + if (!ShowPosition.none.equals(pagePosition) && component.isPagingVisible()) { + final UIPaginatorPage paginatorPage = (UIPaginatorPage) ComponentUtils.createComponent( + facesContext, Tags.paginatorPage.componentType(), RendererTypes.PaginatorPage, "_paginator_page"); + paginatorPage.setAlwaysVisible(component.isShowPagingAlways()); + paginatorMap.put(pagePosition, paginatorPage); + } - final ShowPosition[] order = {ShowPosition.left, ShowPosition.center, ShowPosition.right}; - for (ShowPosition showPosition : order) { - if (paginatorMap.containsKey(showPosition)) { - after.getChildren().add(paginatorMap.get(showPosition)); - } else { - final UIOut space = (UIOut) ComponentUtils.createComponent( - facesContext, Tags.out.componentType(), RendererTypes.Out, "_space_" + showPosition.name()); - space.setTransient(true); - after.getChildren().add(space); + if (!paginatorMap.isEmpty()) { + final UIComponent after = ensureAfterFacetPaginator(facesContext, component); + + final ShowPosition[] order = {ShowPosition.left, ShowPosition.center, ShowPosition.right}; + for (ShowPosition showPosition : order) { + if (paginatorMap.containsKey(showPosition)) { + after.getChildren().add(paginatorMap.get(showPosition)); + } else { + final UIOut space = (UIOut) ComponentUtils.createComponent( + facesContext, Tags.out.componentType(), RendererTypes.Out, "_space_" + showPosition.name()); + after.getChildren().add(space); + } } } + + component.getAttributes().put("useShowAttributesInitialized", Boolean.TRUE); } } case custom -> { @@ -406,7 +349,6 @@ public void encodeEndInternal(final FacesContext facesContext, final T component final String sheetId = component.getClientId(facesContext); final Selectable selectable = component.getSelectable(); - final Application application = facesContext.getApplication(); final SheetState state = component.getSheetState(facesContext); final List columnWidths = component.getState().getColumnWidths(); final boolean definedColumnWidths = component.getState().isDefinedColumnWidths(); @@ -912,8 +854,7 @@ private void encodeHeaderRows( writer.writeAttribute(HtmlAttributes.TITLE, tip, true); encodeBehavior(writer, behaviorCommands); - if (column instanceof AbstractUIColumnSelector) { - final AbstractUIColumnSelector selector = (AbstractUIColumnSelector) column; + if (column instanceof AbstractUIColumnSelector selector) { Selectable currentSelectable = getSelectionMode(selectable, selector); writer.startElement(HtmlElements.INPUT); if (currentSelectable.isMulti()) { diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java index 0e8529bc1a..8832f0166a 100644 --- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java +++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java @@ -198,7 +198,7 @@ public interface SheetTagDeclaration void setShowDirectLinks(String showDirectLinks); /** - * Flag indicating whether and where the range pages should + * Flag indicating whether and where the range pages should be * rendered in the sheet's footer. Rendering this range also offers the * capability to enter the index displayed page directly. * diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/JsonUtils.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/JsonUtils.java index 3064ac2335..3f80ea2977 100644 --- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/JsonUtils.java +++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/JsonUtils.java @@ -21,6 +21,7 @@ import org.apache.myfaces.tobago.component.ClientBehaviors; import org.apache.myfaces.tobago.context.Markup; +import org.apache.myfaces.tobago.event.SheetAction; import org.apache.myfaces.tobago.internal.renderkit.Collapse; import org.apache.myfaces.tobago.internal.renderkit.Command; import org.apache.myfaces.tobago.internal.renderkit.CommandMap; @@ -355,7 +356,42 @@ public static String encode(final MeasureList measures, final String name) { return builder.toString(); } + public static String encode(final SheetAction sheetAction, final Integer target) { + final StringBuilder builder = new StringBuilder(); + builder.append("{"); + encode(builder, "action", sheetAction.name()); + if (target != null) { + encode(builder, "target", target); + } + builder.deleteCharAt(builder.length() - 1); // remove last comma + builder.append("}"); + return builder.toString(); + } + + public static SheetActionRecord decodeSheetAction(final String json) { + if (json == null) { + return null; + } + SheetAction action = null; + Integer target = null; + final String[] split = json.replaceAll("[^a-zA-Z0-9]", " ").split("\\s+"); + for (int i = 0; i < split.length - 1; i++) { + if (split[i].equals("action")) { + i++; + action = SheetAction.valueOf(split[i]); + } + if (split[i].equals("target")) { + i++; + target = Integer.parseInt(split[i]); + } + } + return new SheetActionRecord(action, target); + } + public static String encodeEmptyArray() { return "[]"; } + + // todo: rename - find a better name + public record SheetActionRecord(SheetAction action, Integer target) {} } diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java index ad5aa76b75..625fcd6dc6 100644 --- a/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java +++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java @@ -26,6 +26,8 @@ */ public enum DataAttributes implements MarkupLanguageAttributes { + ACTION("data-tobago-action"), + BS_CONTENT("data-bs-content"), BS_DISMISS("data-bs-dismiss"), BS_TOGGLE("data-bs-toggle"), diff --git a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/JsonUtilsUnitTest.java b/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/JsonUtilsUnitTest.java index d3fcb74f8a..5fcb3a0367 100644 --- a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/JsonUtilsUnitTest.java +++ b/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/JsonUtilsUnitTest.java @@ -24,6 +24,7 @@ import org.apache.myfaces.tobago.component.RendererTypes; import org.apache.myfaces.tobago.component.Tags; import org.apache.myfaces.tobago.context.Markup; +import org.apache.myfaces.tobago.event.SheetAction; import org.apache.myfaces.tobago.internal.component.AbstractUICommand; import org.apache.myfaces.tobago.internal.config.AbstractTobagoTestBase; import org.apache.myfaces.tobago.internal.renderkit.Collapse; @@ -235,6 +236,24 @@ public void encodeIntegerList() { Assertions.assertEquals("[]", JsonUtils.encode(new ArrayList<>())); } + @Test + public void encodeSheetAction() { + final SheetAction action = SheetAction.last; + final Integer target = 42; + + Assertions.assertEquals("{\"action\":\"last\",\"target\":42}", JsonUtils.encode(action, target)); + Assertions.assertEquals("{\"action\":\"last\"}", JsonUtils.encode(action, null)); + } + + @Test + public void decodeSheetAction() { + JsonUtils.SheetActionRecord last = new JsonUtils.SheetActionRecord(SheetAction.last, null); + Assertions.assertEquals(last, JsonUtils.decodeSheetAction("{\"action\":\"last\"}")); + + JsonUtils.SheetActionRecord toPage = new JsonUtils.SheetActionRecord(SheetAction.toPage, 42); + Assertions.assertEquals(toPage, JsonUtils.decodeSheetAction("{\"action\":\"toPage\",\"target\":42}")); + } + @Test public void encodeEmptyArray() { Assertions.assertEquals("[]", JsonUtils.encodeEmptyArray()); diff --git a/tobago-core/src/test/resources/renderer/sheet/sheet-paginatorList.html b/tobago-core/src/test/resources/renderer/sheet/sheet-paginatorList.html index d90f1b3215..b1b18b8e28 100644 --- a/tobago-core/src/test/resources/renderer/sheet/sheet-paginatorList.html +++ b/tobago-core/src/test/resources/renderer/sheet/sheet-paginatorList.html @@ -49,21 +49,22 @@ +
  • - +
  • - +
  • - +
  • - +
  • - +
diff --git a/tobago-core/src/test/resources/renderer/sheet/sheet-paging.html b/tobago-core/src/test/resources/renderer/sheet/sheet-paging.html index bc71bf407d..7650f9a5b6 100644 --- a/tobago-core/src/test/resources/renderer/sheet/sheet-paging.html +++ b/tobago-core/src/test/resources/renderer/sheet/sheet-paging.html @@ -49,43 +49,46 @@ - Rows 1 to 2 of 10 + Rows 1 to 2 of 10 +
  • - +
  • - +
  • - +
  • - +
  • - +
- -
  • - -
  • -
  • - -
  • -
  • - Page 1 of 5 -
  • -
  • - -
  • -
  • - -
  • + +
      +
    • + +
    • +
    • + +
    • +
    • + Page 1 of 5 +
    • +
    • + +
    • +
    • + +
    • +
    diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/080-sheet/10-sort/Sheet_Sorting.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/080-sheet/10-sort/Sheet_Sorting.test.js index 078fae8b60..3f99a8acb9 100644 --- a/tobago-example/tobago-example-demo/src/main/webapp/content/080-sheet/10-sort/Sheet_Sorting.test.js +++ b/tobago-example/tobago-example-demo/src/main/webapp/content/080-sheet/10-sort/Sheet_Sorting.test.js @@ -21,9 +21,18 @@ import {JasmineTestTool} from "/tobago/test/tobago-test-tool.js"; it("Basics: Name", function (done) { let colNameFn = elementByIdFn("page:mainForm:s1:columnName_sorter"); let rowsFn = querySelectorAllFn("#page\\:mainForm\\:s1 .tobago-body tbody tr"); - let leftPagingFn = elementByIdFn("page:mainForm:s1:pageActiontoRow"); + let leftPagingFn = elementByIdFn("page:mainForm:s1:_paginator_row::field"); let test = new JasmineTestTool(done); + if (colNameFn() === null) { + test.fail("colName sorter not found!"); + } + if (rowsFn().length !== 4) { + test.fail("Not 4 rows!"); + } + if (leftPagingFn() === null) { + test.fail("leftPaging button not found!"); + } test.setup( () => colNameFn().classList.contains("tobago-ascending"), null, "click", colNameFn); @@ -60,9 +69,18 @@ it("Basics: Name", function (done) { it("Basics: Period", function (done) { let colPeriodFn = querySelectorFn("#page\\:mainForm\\:s1\\:columnPeriod_sorter"); let rowsFn = querySelectorAllFn("#page\\:mainForm\\:s1 .tobago-body tbody tr"); - let leftPagingFn = elementByIdFn("page:mainForm:s1:pageActiontoRow"); + let leftPagingFn = elementByIdFn("page:mainForm:s1:_paginator_row::field"); let test = new JasmineTestTool(done); + if (colPeriodFn() === null) { + test.fail("colPeriod sorter not found!"); + } + if (rowsFn().length !== 4) { + test.fail("Not 4 rows!"); + } + if (leftPagingFn() === null) { + test.fail("leftPaging button not found!"); + } test.setup( () => colPeriodFn().classList.contains("tobago-ascending"), null, "click", colPeriodFn); @@ -99,9 +117,18 @@ it("Basics: Period", function (done) { it("Basics: Year", function (done) { let colYearFn = querySelectorFn("#page\\:mainForm\\:s1\\:columnDiscoverYear_sorter"); let rowsFn = querySelectorAllFn("#page\\:mainForm\\:s1 .tobago-body tbody tr"); - let leftPagingFn = elementByIdFn("page:mainForm:s1:pageActiontoRow"); + let leftPagingFn = elementByIdFn("page:mainForm:s1:_paginator_row::field"); let test = new JasmineTestTool(done); + if (colYearFn() === null) { + test.fail("colYear sorter not found!"); + } + if (rowsFn().length !== 4) { + test.fail("Not 4 rows!"); + } + if (leftPagingFn() === null) { + test.fail("leftPaging button not found!"); + } test.setup( () => colYearFn().classList.contains("tobago-ascending"), null, "click", colYearFn); @@ -127,16 +154,24 @@ it("Basics: Year", function (done) { test.start(); }); -/** - * 1. goto line 8 - * 2. goto line 9 - */ + // 1. goto line 8 + // 2. goto line 9 + it("Basics: left paging", function (done) { let colNameFn = elementByIdFn("page:mainForm:s1:columnName_sorter"); let rowsFn = querySelectorAllFn("#page\\:mainForm\\:s1 .tobago-body tbody tr"); - let leftPagingFn = elementByIdFn("page:mainForm:s1:pageActiontoRow"); + let leftPagingFn = elementByIdFn("page:mainForm:s1:_paginator_row::field"); let test = new JasmineTestTool(done); + if (colNameFn() === null) { + test.fail("colName sorter not found!"); + } + if (rowsFn().length !== 4) { + test.fail("Not 4 rows!"); + } + if (leftPagingFn() === null) { + test.fail("leftPaging button not found!"); + } test.setup( () => colNameFn().classList.contains("tobago-ascending"), null, "click", colNameFn); @@ -172,20 +207,28 @@ it("Basics: left paging", function (done) { test.start(); }); -/** - * 1. goto page 7 - * 2. goto page 16 - * 3. goto page 13 - */ + // 1. goto page 7 + // 2. goto page 16 + // 3. goto page 13 + it("Basics: center paging", function (done) { let colNameFn = elementByIdFn("page:mainForm:s1:columnName_sorter"); let rowsFn = querySelectorAllFn("#page\\:mainForm\\:s1 .tobago-body tbody tr"); - let leftPagingFn = elementByIdFn("page:mainForm:s1:pageActiontoRow"); - let centerPaging7Fn = elementByIdFn("page:mainForm:s1:pageActiontoPage-7"); - let centerPaging14Fn = elementByIdFn("page:mainForm:s1:pageActiontoPage-14"); - let centerPaging16Fn = elementByIdFn("page:mainForm:s1:pageActiontoPage-16"); + let leftPagingFn = elementByIdFn("page:mainForm:s1:_paginator_row::field"); + let centerPaging7Fn = querySelectorFn("#page\\:mainForm\\:s1 [data-tobago-action*='\\:7\\}']"); + let centerPaging14Fn = querySelectorFn("#page\\:mainForm\\:s1 [data-tobago-action*='\\:14\\}']"); + let centerPaging16Fn = querySelectorFn("#page\\:mainForm\\:s1 [data-tobago-action*='\\:16\\}']"); let test = new JasmineTestTool(done); + if (colNameFn() === null) { + test.fail("colNameFn sorter not found!"); + } + if (rowsFn().length !== 4) { + test.fail("Not 4 rows!"); + } + if (leftPagingFn() === null) { + test.fail("leftPaging button not found!"); + } test.setup( () => colNameFn().classList.contains("tobago-ascending"), null, "click", colNameFn); @@ -229,24 +272,44 @@ it("Basics: center paging", function (done) { test.start(); }); -/** - * 1. goto first page - * 2. goto page 2 by pressing arrow-right - * 3. goto last page - * 4. goto page 21 by pressing arrow-left - * 5. goto page 14 - */ + // 1. goto first page + // 2. goto page 2 by pressing arrow-right + // 3. goto last page + // 4. goto page 21 by pressing arrow-left + // 5. goto page 14 + it("Basics: right paging", function (done) { let colNameFn = elementByIdFn("page:mainForm:s1:columnName_sorter"); let rowsFn = querySelectorAllFn("#page\\:mainForm\\:s1 .tobago-body tbody tr"); - let leftPagingFn = elementByIdFn("page:mainForm:s1:pageActiontoRow"); - let rightPagingFirstFn = elementByIdFn("page:mainForm:s1:pageActionfirst"); - let rightPagingPrevFn = elementByIdFn("page:mainForm:s1:pageActionprev"); - let rightPagingNextFn = elementByIdFn("page:mainForm:s1:pageActionnext"); - let rightPagingLastFn = elementByIdFn("page:mainForm:s1:pageActionlast"); - let jumpToPageFn = elementByIdFn("page:mainForm:s1:pageActiontoPage"); + let leftPagingFn = elementByIdFn("page:mainForm:s1:_paginator_row::field"); + let rightPagingFirstFn = querySelectorFn("#page\\:mainForm\\:s1 [data-tobago-action*='first']"); + let rightPagingPrevFn = querySelectorFn("#page\\:mainForm\\:s1 [data-tobago-action*='prev']"); + let rightPagingNextFn = querySelectorFn("#page\\:mainForm\\:s1 [data-tobago-action*='next']"); + let rightPagingLastFn = querySelectorFn("#page\\:mainForm\\:s1 [data-tobago-action*='last']"); + let jumpToPageFn = elementByIdFn("page:mainForm:s1:_paginator_page::field"); let test = new JasmineTestTool(done); + if (colNameFn() === null) { + test.fail("colNameFn sorter not found!"); + } + if (rowsFn().length !== 4) { + test.fail("Not 4 rows!"); + } + if (leftPagingFn() === null) { + test.fail("leftPaging button not found!"); + } + if (rightPagingFirstFn() === null) { + test.fail("rightPagingFirst button not found!"); + } + if (rightPagingPrevFn() === null) { + test.fail("rightPagingPrev button not found!"); + } + if (rightPagingNextFn() === null) { + test.fail("rightPagingNext button not found!"); + } + if (rightPagingLastFn() === null) { + test.fail("rightPagingLast button not found!"); + } test.setup( () => colNameFn().classList.contains("tobago-ascending"), null, "click", colNameFn); @@ -310,12 +373,22 @@ it("Basics: right paging", function (done) { "Ophelia", "0.38", "1986")); test.start(); }); + it("Custom Sorting: Name", function (done) { let colNameFn = elementByIdFn("page:mainForm:s2:customColumnName_sorter"); let rowsFn = querySelectorAllFn("#page\\:mainForm\\:s2 .tobago-body tbody tr"); - let leftPagingFn = elementByIdFn("page:mainForm:s2:pageActiontoRow"); + let leftPagingFn = elementByIdFn("page:mainForm:s2:_paginator_row::field"); let test = new JasmineTestTool(done); + if (colNameFn() === null) { + test.fail("colName sorter not found!"); + } + if (rowsFn().length !== 4) { + test.fail("Not 4 rows!"); + } + if (leftPagingFn() === null) { + test.fail("leftPaging button not found!"); + } test.setup( () => colNameFn().classList.contains("tobago-ascending"), null, "click", colNameFn); @@ -352,9 +425,18 @@ it("Custom Sorting: Name", function (done) { it("Custom Sorting: Period", function (done) { let colPeriodFn = querySelectorFn("#page\\:mainForm\\:s2\\:customColumnPeriod_sorter"); let rowsFn = querySelectorAllFn("#page\\:mainForm\\:s2 .tobago-body tbody tr"); - let leftPagingFn = elementByIdFn("page:mainForm:s2:pageActiontoRow"); + let leftPagingFn = elementByIdFn("page:mainForm:s2:_paginator_row::field"); let test = new JasmineTestTool(done); + if (colPeriodFn() === null) { + test.fail("colPeriod sorter not found!"); + } + if (rowsFn().length !== 4) { + test.fail("Not 4 rows!"); + } + if (leftPagingFn() === null) { + test.fail("leftPaging button not found!"); + } test.setup( () => colPeriodFn().classList.contains("tobago-ascending"), null, "click", colPeriodFn); @@ -391,9 +473,18 @@ it("Custom Sorting: Period", function (done) { it("Custom Sorting: Year", function (done) { let colYearFn = querySelectorFn("#page\\:mainForm\\:s2\\:customColumnYear_sorter"); let rowsFn = querySelectorAllFn("#page\\:mainForm\\:s2 .tobago-body tbody tr"); - let leftPagingFn = elementByIdFn("page:mainForm:s2:pageActiontoRow"); + let leftPagingFn = elementByIdFn("page:mainForm:s2:_paginator_row::field"); let test = new JasmineTestTool(done); + if (colYearFn() === null) { + test.fail("colYear sorter not found!"); + } + if (rowsFn().length !== 4) { + test.fail("Not 4 rows!"); + } + if (leftPagingFn() === null) { + test.fail("leftPaging button not found!"); + } test.setup( () => colYearFn().classList.contains("tobago-ascending"), null, "click", colYearFn); @@ -419,16 +510,24 @@ it("Custom Sorting: Year", function (done) { test.start(); }); -/** - * 1. goto line 8 - * 2. goto line 9 - */ + // 1. goto line 8 + // 2. goto line 9 + it("Custom Sorting: left paging", function (done) { let colNameFn = elementByIdFn("page:mainForm:s2:customColumnName_sorter"); let rowsFn = querySelectorAllFn("#page\\:mainForm\\:s2 .tobago-body tbody tr"); - let leftPagingFn = elementByIdFn("page:mainForm:s2:pageActiontoRow"); + let leftPagingFn = elementByIdFn("page:mainForm:s2:_paginator_row::field"); let test = new JasmineTestTool(done); + if (colNameFn() === null) { + test.fail("colName sorter not found!"); + } + if (rowsFn().length !== 4) { + test.fail("Not 4 rows!"); + } + if (leftPagingFn() === null) { + test.fail("leftPaging button not found!"); + } test.setup( () => colNameFn().classList.contains("tobago-ascending"), null, "click", colNameFn); @@ -464,20 +563,28 @@ it("Custom Sorting: left paging", function (done) { test.start(); }); -/** - * 1. goto page 7 - * 2. goto page 16 - * 3. goto page 13 - */ + // 1. goto page 7 + // 2. goto page 16 + // 3. goto page 13 + it("Custom Sorting: center paging", function (done) { let colNameFn = elementByIdFn("page:mainForm:s2:customColumnName_sorter"); let rowsFn = querySelectorAllFn("#page\\:mainForm\\:s2 .tobago-body tbody tr"); - let leftPagingFn = elementByIdFn("page:mainForm:s2:pageActiontoRow"); - let centerPaging7Fn = elementByIdFn("page:mainForm:s2:pageActiontoPage-7"); - let centerPaging14Fn = elementByIdFn("page:mainForm:s2:pageActiontoPage-14"); - let centerPaging16Fn = elementByIdFn("page:mainForm:s2:pageActiontoPage-16"); + let leftPagingFn = elementByIdFn("page:mainForm:s2:_paginator_row::field"); + let centerPaging7Fn = querySelectorFn("#page\\:mainForm\\:s2 [data-tobago-action*='\\:7\\}']"); + let centerPaging14Fn = querySelectorFn("#page\\:mainForm\\:s2 [data-tobago-action*='\\:14\\}']"); + let centerPaging16Fn = querySelectorFn("#page\\:mainForm\\:s2 [data-tobago-action*='\\:16\\}']"); let test = new JasmineTestTool(done); + if (colNameFn() === null) { + test.fail("colName sorter not found!"); + } + if (rowsFn().length !== 4) { + test.fail("Not 4 rows!"); + } + if (leftPagingFn() === null) { + test.fail("leftPaging button not found!"); + } test.setup( () => colNameFn().classList.contains("tobago-ascending"), null, "click", colNameFn); @@ -521,24 +628,47 @@ it("Custom Sorting: center paging", function (done) { test.start(); }); -/** - * 1. goto first page - * 2. goto page 2 by pressing arrow-right - * 3. goto last page - * 4. goto page 21 by pressing arrow-left - * 5. goto page 14 - */ + // 1. goto first page + // 2. goto page 2 by pressing arrow-right + // 3. goto last page + // 4. goto page 21 by pressing arrow-left + // 5. goto page 14 + it("Custom Sorting: right paging", function (done) { let colNameFn = elementByIdFn("page:mainForm:s2:customColumnName_sorter"); let rowsFn = querySelectorAllFn("#page\\:mainForm\\:s2 .tobago-body tbody tr"); - let leftPagingFn = elementByIdFn("page:mainForm:s2:pageActiontoRow"); - let rightPagingFirstFn = elementByIdFn("page:mainForm:s2:pageActionfirst"); - let rightPagingPrevFn = elementByIdFn("page:mainForm:s2:pageActionprev"); - let rightPagingNextFn = elementByIdFn("page:mainForm:s2:pageActionnext"); - let rightPagingLastFn = elementByIdFn("page:mainForm:s2:pageActionlast"); - let rightPagingToPageFn = elementByIdFn("page:mainForm:s2:pageActiontoPage"); + let leftPagingFn = elementByIdFn("page:mainForm:s2:_paginator_row::field"); + let rightPagingFirstFn = querySelectorFn("#page\\:mainForm\\:s2 [data-tobago-action*='first']"); + let rightPagingPrevFn = querySelectorFn("#page\\:mainForm\\:s2 [data-tobago-action*='prev']"); + let rightPagingNextFn = querySelectorFn("#page\\:mainForm\\:s2 [data-tobago-action*='next']"); + let rightPagingLastFn = querySelectorFn("#page\\:mainForm\\:s2 [data-tobago-action*='last']"); + let rightPagingToPageFn = elementByIdFn("page:mainForm:s2:_paginator_page::field"); let test = new JasmineTestTool(done); + if (colNameFn() === null) { + test.fail("colName sorter not found!"); + } + if (rowsFn().length !== 4) { + test.fail("Not 4 rows!"); + } + if (leftPagingFn() === null) { + test.fail("leftPaging button not found!"); + } + if (rightPagingFirstFn() === null) { + test.fail("rightPagingFirst button not found!"); + } + if (rightPagingPrevFn() === null) { + test.fail("rightPagingPrev button not found!"); + } + if (rightPagingNextFn() === null) { + test.fail("rightPagingNext button not found!"); + } + if (rightPagingLastFn() === null) { + test.fail("rightPagingLast button not found!"); + } + if (rightPagingToPageFn() === null) { + test.fail("rightPagingToPage input not found!"); + } test.setup( () => colNameFn().classList.contains("tobago-ascending"), null, "click", colNameFn); diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/080-sheet/15-paginator/Paginator.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/080-sheet/15-paginator/Paginator.xhtml index edc800cba1..78e63dd71a 100644 --- a/tobago-example/tobago-example-demo/src/main/webapp/content/080-sheet/15-paginator/Paginator.xhtml +++ b/tobago-example/tobago-example-demo/src/main/webapp/content/080-sheet/15-paginator/Paginator.xhtml @@ -38,11 +38,12 @@ - Todo: Check if 2 or more of the same controls will work on same page! + An alternative way to define the paginator is to use the new tags tc:paginatorPanel, + and inside of it tc:paginatorRow, tc:paginatorList and tc:paginatorPage. + This way is much more flexible, because you can define the paginators and combinations of it in any way you like. - diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/080-sheet/25-selection/Sheet_Selectionchange.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/080-sheet/25-selection/Sheet_Selectionchange.test.js index 1b400a32a5..0bba82c3d9 100644 --- a/tobago-example/tobago-example-demo/src/main/webapp/content/080-sheet/25-selection/Sheet_Selectionchange.test.js +++ b/tobago-example/tobago-example-demo/src/main/webapp/content/080-sheet/25-selection/Sheet_Selectionchange.test.js @@ -27,9 +27,12 @@ it("select 'Sun', select 'Venus', select all, deselect 'Mercury'", function (don const mercury = querySelectorFn("tr[row-index='1']"); const venus = querySelectorFn("tr[row-index='2']"); const earth = querySelectorFn("tr[row-index='3']"); - const firstPageButton = elementByIdFn("page:mainForm:sheet:pageActionfirst"); + const firstPageButton = querySelectorFn("#page\\:mainForm\\:sheet [data-tobago-action*='first']"); const test = new JasmineTestTool(done); + if (firstPageButton() === null) { + test.fail("firstPageButton button not found!"); + } test.setup(() => hiddenSelectedField().value === "[]", null, "click", resetSelected); test.setup(() => firstPageButton().disabled, null, "click", firstPageButton); diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/3000-sheet/30-sheet-margin-bottom/Sheet_Margin_Bottom.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/3000-sheet/30-sheet-margin-bottom/Sheet_Margin_Bottom.test.js index b26fbb80b2..ccd4e009b2 100644 --- a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/3000-sheet/30-sheet-margin-bottom/Sheet_Margin_Bottom.test.js +++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/3000-sheet/30-sheet-margin-bottom/Sheet_Margin_Bottom.test.js @@ -19,7 +19,7 @@ import {elementByIdFn, querySelectorFn} from "/script/tobago-test.js"; import {JasmineTestTool} from "/tobago/test/tobago-test-tool.js"; it("Margin from button to sheet/paging must be the same", function (done) { - const sheet1pagingFn = querySelectorFn("#page\\:mainForm\\:sheet1 .ms-auto.pagination"); + const sheet1pagingFn = querySelectorFn("#page\\:mainForm\\:sheet1 .pagination"); const button1Fn = elementByIdFn("page:mainForm:button1"); const sheet2Fn = elementByIdFn("page:mainForm:sheet2"); const button2Fn = elementByIdFn("page:mainForm:button2"); diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/3000-sheet/38-column-selector/Column_Selector.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/3000-sheet/38-column-selector/Column_Selector.test.js index f77e2e6013..f60bd28927 100644 --- a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/3000-sheet/38-column-selector/Column_Selector.test.js +++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/3000-sheet/38-column-selector/Column_Selector.test.js @@ -27,7 +27,7 @@ it("Default sheet: select row 2; select row4", function (done) { const setupDefaultSheet = elementByIdFn("page:mainForm:defaultSheet"); const row2 = querySelectorFn("tr[row-index='2']"); const row4 = querySelectorFn("tr[row-index='4']"); - const firstPageButton = elementByIdFn("page:mainForm:sheet:pageActionfirst"); + const firstPageButton = querySelectorFn("#page\\:mainForm\\:sheet [data-tobago-action*='first']"); const test = new JasmineTestTool(done); test.setup(() => rows().value === "5" && !lazy().checked && sheetSelectable().value === "multi" @@ -65,7 +65,7 @@ it("selectable=none + no column selector: select row 3 cannot happen", function const columnPanelRendered = elementByIdFn("page:mainForm:columnPanelRendered::field"); const setupSelectableNone = elementByIdFn("page:mainForm:selectableNone"); const row3 = querySelectorFn("tr[row-index='3']"); - const firstPageButton = elementByIdFn("page:mainForm:sheet:pageActionfirst"); + const firstPageButton = querySelectorFn("#page\\:mainForm\\:sheet [data-tobago-action*='first']"); const test = new JasmineTestTool(done); test.setup(() => rows().value === "5" && !lazy().checked && sheetSelectable().value === "none" @@ -92,8 +92,8 @@ it("selectable=single: page 1; select row 3; page 4; select row 18; page 1", fun const selectAllCheckbox = querySelectorFn("input[name='page:mainForm:sheet::columnSelector']"); const row3 = querySelectorFn("tr[row-index='3']"); const row18 = querySelectorFn("tr[row-index='18']"); - const page4 = elementByIdFn("page:mainForm:sheet:pageActiontoPage-4"); - const firstPageButton = elementByIdFn("page:mainForm:sheet:pageActionfirst"); + const page4 = querySelectorFn("#page\\:mainForm\\:sheet [data-tobago-action*='\\:4\\}']"); + const firstPageButton = querySelectorFn("#page\\:mainForm\\:sheet [data-tobago-action*='first']"); const test = new JasmineTestTool(done); test.setup(() => rows().value === "5" && !lazy().checked && sheetSelectable().value === "single" @@ -136,8 +136,8 @@ it("selectable=singleOrNone: page 1; select row 3; deselect row 3", function (do const selectAllCheckbox = querySelectorFn("input[name='page:mainForm:sheet::columnSelector']"); const row3 = querySelectorFn("tr[row-index='3']"); const row18 = querySelectorFn("tr[row-index='18']"); - const page4 = elementByIdFn("page:mainForm:sheet:pageActiontoPage-4"); - const firstPageButton = elementByIdFn("page:mainForm:sheet:pageActionfirst"); + const page4 = querySelectorFn("#page\\:mainForm\\:sheet [data-tobago-action*='\\:4\\}']"); + const firstPageButton = querySelectorFn("#page\\:mainForm\\:sheet [data-tobago-action*='first']"); const test = new JasmineTestTool(done); test.setup(() => rows().value === "5" && !lazy().checked && sheetSelectable().value === "singleOrNone" @@ -168,8 +168,8 @@ it("selectable=multi: page 1; select row 4; page 4; select row 17; page 1", func const selectAllCheckbox = querySelectorFn("input[name='page:mainForm:sheet::columnSelector']"); const row4 = querySelectorFn("tr[row-index='4']"); const row17 = querySelectorFn("tr[row-index='17']"); - const page4 = elementByIdFn("page:mainForm:sheet:pageActiontoPage-4"); - const firstPageButton = elementByIdFn("page:mainForm:sheet:pageActionfirst"); + const page4 = querySelectorFn("#page\\:mainForm\\:sheet [data-tobago-action*='\\:4\\}']"); + const firstPageButton = querySelectorFn("#page\\:mainForm\\:sheet [data-tobago-action*='first']"); const test = new JasmineTestTool(done); test.setup(() => rows().value === "5" && !lazy().checked && sheetSelectable().value === "multi" @@ -216,8 +216,8 @@ it("selectable=multi: select all; page 4; select row 17; page 1", function (done const row3 = querySelectorFn("tr[row-index='3']"); const row4 = querySelectorFn("tr[row-index='4']"); const row17 = querySelectorFn("tr[row-index='17']"); - const page4 = elementByIdFn("page:mainForm:sheet:pageActiontoPage-4"); - const firstPageButton = elementByIdFn("page:mainForm:sheet:pageActionfirst"); + const page4 = querySelectorFn("#page\\:mainForm\\:sheet [data-tobago-action*='\\:4\\}']"); + const firstPageButton = querySelectorFn("#page\\:mainForm\\:sheet [data-tobago-action*='first']"); const test = new JasmineTestTool(done); test.setup(() => rows().value === "5" && !lazy().checked && sheetSelectable().value === "multi" @@ -288,7 +288,7 @@ it("selectable=multi: select all; deselect row 3; select row 3", function (done) const row2 = querySelectorFn("tr[row-index='2']"); const row3 = querySelectorFn("tr[row-index='3']"); const row4 = querySelectorFn("tr[row-index='4']"); - const firstPageButton = elementByIdFn("page:mainForm:sheet:pageActionfirst"); + const firstPageButton = querySelectorFn("#page\\:mainForm\\:sheet [data-tobago-action*='first']"); const test = new JasmineTestTool(done); test.setup(() => rows().value === "5" && !lazy().checked && sheetSelectable().value === "multi" @@ -359,7 +359,7 @@ it("disabled column selector", function (done) { const rowSelector = querySelectorFn("input[name='page:mainForm:sheet_data_row_selector_0']"); const row2 = querySelectorFn("tr[row-index='2']"); const row4 = querySelectorFn("tr[row-index='4']"); - const firstPageButton = elementByIdFn("page:mainForm:sheet:pageActionfirst"); + const firstPageButton = querySelectorFn("#page\\:mainForm\\:sheet [data-tobago-action*='first']"); const test = new JasmineTestTool(done); test.setup(() => rows().value === "5" && !lazy().checked && sheetSelectable().value === "multi" @@ -396,8 +396,8 @@ it("column panel: page 1; select row 4; page 4; select row 17; page 1", function const row17 = querySelectorFn("tr[row-index='17']"); const columnPanel4 = querySelectorFn(".tobago-column-panel[name='4']"); const columnPanel17 = querySelectorFn(".tobago-column-panel[name='17']"); - const page4 = elementByIdFn("page:mainForm:sheet:pageActiontoPage-4"); - const firstPageButton = elementByIdFn("page:mainForm:sheet:pageActionfirst"); + const page4 = querySelectorFn("#page\\:mainForm\\:sheet [data-tobago-action*='\\:4\\}']"); + const firstPageButton = querySelectorFn("#page\\:mainForm\\:sheet [data-tobago-action*='first']"); const test = new JasmineTestTool(done); test.setup(() => rows().value === "5" && !lazy().checked && sheetSelectable().value === "multi" diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/3000-sheet/40-paginator/Paginator.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/3000-sheet/40-paginator/Paginator.xhtml index 1ae72af8d4..54cbb19cc8 100644 --- a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/3000-sheet/40-paginator/Paginator.xhtml +++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/3000-sheet/40-paginator/Paginator.xhtml @@ -56,7 +56,7 @@ - + @@ -85,5 +85,4 @@ - diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/3000-sheet/80-lazy-sort/Lazy_Sort.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/3000-sheet/80-lazy-sort/Lazy_Sort.test.js index 4270569070..bb88b7f15c 100644 --- a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/3000-sheet/80-lazy-sort/Lazy_Sort.test.js +++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/3000-sheet/80-lazy-sort/Lazy_Sort.test.js @@ -97,7 +97,7 @@ it("focus row index 1000 and go down", function (done) { test.do(() => expect(isLoaded(1020)).toBeFalse()); test.do(() => focusRowIndex(1001)); - test.wait(() => isLoaded(1001)); + test.wait(() => isLoaded(1020)); test.do(() => expect(isLoaded(999)).toBeFalse()); test.do(() => expect(isLoaded(1000, 1039)).toBeTrue()); test.do(() => expect(isLoaded(1040)).toBeFalse()); diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js index 78ce2d70cf..0739bea2b2 100644 --- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js +++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js @@ -4,16 +4,16 @@ * Copyright 2011-2024 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ -const pt=new Map,gt={set(e,t,s){pt.has(e)||pt.set(e,new Map);const i=pt.get(e);i.has(t)||0===i.size?i.set(t,s):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(i.keys())[0]}.`)},get:(e,t)=>pt.has(e)&&pt.get(e).get(t)||null,remove(e,t){if(!pt.has(e))return;const s=pt.get(e);s.delete(t),0===s.size&&pt.delete(e)}},ft="transitionend",mt=e=>(e&&window.CSS&&window.CSS.escape&&(e=e.replace(/#([^\s"#']+)/g,((e,t)=>`#${CSS.escape(t)}`))),e),bt=e=>{e.dispatchEvent(new Event(ft))},vt=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&(e=e[0]),void 0!==e.nodeType),_t=e=>vt(e)?e.jquery?e[0]:e:"string"==typeof e&&e.length>0?document.querySelector(mt(e)):null,yt=e=>{if(!vt(e)||0===e.getClientRects().length)return!1;const t="visible"===getComputedStyle(e).getPropertyValue("visibility"),s=e.closest("details:not([open])");if(!s)return t;if(s!==e){const t=e.closest("summary");if(t&&t.parentNode!==s)return!1;if(null===t)return!1}return t},wt=e=>!e||e.nodeType!==Node.ELEMENT_NODE||(!!e.classList.contains("disabled")||(void 0!==e.disabled?e.disabled:e.hasAttribute("disabled")&&"false"!==e.getAttribute("disabled"))),Et=e=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof e.getRootNode){const t=e.getRootNode();return t instanceof ShadowRoot?t:null}return e instanceof ShadowRoot?e:e.parentNode?Et(e.parentNode):null},At=()=>{},St=e=>{e.offsetHeight},Lt=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,Ot=[],xt=()=>"rtl"===document.documentElement.dir,Tt=e=>{var t;t=()=>{const t=Lt();if(t){const s=e.NAME,i=t.fn[s];t.fn[s]=e.jQueryInterface,t.fn[s].Constructor=e,t.fn[s].noConflict=()=>(t.fn[s]=i,e.jQueryInterface)}},"loading"===document.readyState?(Ot.length||document.addEventListener("DOMContentLoaded",(()=>{for(const e of Ot)e()})),Ot.push(t)):t()},Ct=(e,t=[],s=e)=>"function"==typeof e?e(...t):s,It=(e,t,s=!0)=>{if(!s)return void Ct(e);const i=(e=>{if(!e)return 0;let{transitionDuration:t,transitionDelay:s}=window.getComputedStyle(e);const i=Number.parseFloat(t),n=Number.parseFloat(s);return i||n?(t=t.split(",")[0],s=s.split(",")[0],1e3*(Number.parseFloat(t)+Number.parseFloat(s))):0})(t)+5;let n=!1;const o=({target:s})=>{s===t&&(n=!0,t.removeEventListener(ft,o),Ct(e))};t.addEventListener(ft,o),setTimeout((()=>{n||bt(t)}),i)},Nt=(e,t,s,i)=>{const n=e.length;let o=e.indexOf(t);return-1===o?!s&&i?e[n-1]:e[0]:(o+=s?1:-1,i&&(o=(o+n)%n),e[Math.max(0,Math.min(o,n-1))])},kt=/[^.]*(?=\..*)\.|.*/,Dt=/\..*/,$t=/::\d+$/,Rt={};let Mt=1;const Pt={mouseenter:"mouseover",mouseleave:"mouseout"},Bt=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function Ht(e,t){return t&&`${t}::${Mt++}`||e.uidEvent||Mt++}function qt(e){const t=Ht(e);return e.uidEvent=t,Rt[t]=Rt[t]||{},Rt[t]}function jt(e,t,s=null){return Object.values(e).find((e=>e.callable===t&&e.delegationSelector===s))}function Ft(e,t,s){const i="string"==typeof t,n=i?s:t||s;let o=Gt(e);return Bt.has(o)||(o=e),[i,n,o]}function Wt(e,t,s,i,n){if("string"!=typeof t||!e)return;let[o,r,a]=Ft(t,s,i);if(t in Pt){const e=e=>function(t){if(!t.relatedTarget||t.relatedTarget!==t.delegateTarget&&!t.delegateTarget.contains(t.relatedTarget))return e.call(this,t)};r=e(r)}const l=qt(e),c=l[a]||(l[a]={}),d=jt(c,r,o?s:null);if(d)return void(d.oneOff=d.oneOff&&n);const u=Ht(r,t.replace(kt,"")),h=o?function(e,t,s){return function i(n){const o=e.querySelectorAll(t);for(let{target:r}=n;r&&r!==this;r=r.parentNode)for(const a of o)if(a===r)return Yt(n,{delegateTarget:r}),i.oneOff&&Vt.off(e,n.type,t,s),s.apply(r,[n])}}(e,s,r):function(e,t){return function s(i){return Yt(i,{delegateTarget:e}),s.oneOff&&Vt.off(e,i.type,t),t.apply(e,[i])}}(e,r);h.delegationSelector=o?s:null,h.callable=r,h.oneOff=n,h.uidEvent=u,c[u]=h,e.addEventListener(a,h,o)}function zt(e,t,s,i,n){const o=jt(t[s],i,n);o&&(e.removeEventListener(s,o,Boolean(n)),delete t[s][o.uidEvent])}function Ut(e,t,s,i){const n=t[s]||{};for(const[o,r]of Object.entries(n))o.includes(i)&&zt(e,t,s,r.callable,r.delegationSelector)}function Gt(e){return e=e.replace(Dt,""),Pt[e]||e}const Vt={on(e,t,s,i){Wt(e,t,s,i,!1)},one(e,t,s,i){Wt(e,t,s,i,!0)},off(e,t,s,i){if("string"!=typeof t||!e)return;const[n,o,r]=Ft(t,s,i),a=r!==t,l=qt(e),c=l[r]||{},d=t.startsWith(".");if(void 0===o){if(d)for(const s of Object.keys(l))Ut(e,l,s,t.slice(1));for(const[s,i]of Object.entries(c)){const n=s.replace($t,"");a&&!t.includes(n)||zt(e,l,r,i.callable,i.delegationSelector)}}else{if(!Object.keys(c).length)return;zt(e,l,r,o,n?s:null)}},trigger(e,t,s){if("string"!=typeof t||!e)return null;const i=Lt();let n=null,o=!0,r=!0,a=!1;t!==Gt(t)&&i&&(n=i.Event(t,s),i(e).trigger(n),o=!n.isPropagationStopped(),r=!n.isImmediatePropagationStopped(),a=n.isDefaultPrevented());const l=Yt(new Event(t,{bubbles:o,cancelable:!0}),s);return a&&l.preventDefault(),r&&e.dispatchEvent(l),l.defaultPrevented&&n&&n.preventDefault(),l}};function Yt(e,t={}){for(const[s,i]of Object.entries(t))try{e[s]=i}catch(t){Object.defineProperty(e,s,{configurable:!0,get:()=>i})}return e}function Xt(e){if("true"===e)return!0;if("false"===e)return!1;if(e===Number(e).toString())return Number(e);if(""===e||"null"===e)return null;if("string"!=typeof e)return e;try{return JSON.parse(decodeURIComponent(e))}catch(t){return e}}function Jt(e){return e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}const Kt={setDataAttribute(e,t,s){e.setAttribute(`data-bs-${Jt(t)}`,s)},removeDataAttribute(e,t){e.removeAttribute(`data-bs-${Jt(t)}`)},getDataAttributes(e){if(!e)return{};const t={},s=Object.keys(e.dataset).filter((e=>e.startsWith("bs")&&!e.startsWith("bsConfig")));for(const i of s){let s=i.replace(/^bs/,"");s=s.charAt(0).toLowerCase()+s.slice(1,s.length),t[s]=Xt(e.dataset[i])}return t},getDataAttribute:(e,t)=>Xt(e.getAttribute(`data-bs-${Jt(t)}`))};class Zt{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(e){return e=this._mergeConfigObj(e),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}_configAfterMerge(e){return e}_mergeConfigObj(e,t){const s=vt(t)?Kt.getDataAttribute(t,"config"):{};return{...this.constructor.Default,..."object"==typeof s?s:{},...vt(t)?Kt.getDataAttributes(t):{},..."object"==typeof e?e:{}}}_typeCheckConfig(e,t=this.constructor.DefaultType){for(const[i,n]of Object.entries(t)){const t=e[i],o=vt(t)?"element":null==(s=t)?`${s}`:Object.prototype.toString.call(s).match(/\s([a-z]+)/i)[1].toLowerCase();if(!new RegExp(n).test(o))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${i}" provided type "${o}" but expected type "${n}".`)}var s}}class Qt extends Zt{constructor(e,t){super(),(e=_t(e))&&(this._element=e,this._config=this._getConfig(t),gt.set(this._element,this.constructor.DATA_KEY,this))}dispose(){gt.remove(this._element,this.constructor.DATA_KEY),Vt.off(this._element,this.constructor.EVENT_KEY);for(const e of Object.getOwnPropertyNames(this))this[e]=null}_queueCallback(e,t,s=!0){It(e,t,s)}_getConfig(e){return e=this._mergeConfigObj(e,this._element),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}static getInstance(e){return gt.get(_t(e),this.DATA_KEY)}static getOrCreateInstance(e,t={}){return this.getInstance(e)||new this(e,"object"==typeof t?t:null)}static get VERSION(){return"5.3.3"}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(e){return`${e}${this.EVENT_KEY}`}}const es=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let s=e.getAttribute("href");if(!s||!s.includes("#")&&!s.startsWith("."))return null;s.includes("#")&&!s.startsWith("#")&&(s=`#${s.split("#")[1]}`),t=s&&"#"!==s?s.trim():null}return t?t.split(",").map((e=>mt(e))).join(","):null},ts={find:(e,t=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(t,e)),findOne:(e,t=document.documentElement)=>Element.prototype.querySelector.call(t,e),children:(e,t)=>[].concat(...e.children).filter((e=>e.matches(t))),parents(e,t){const s=[];let i=e.parentNode.closest(t);for(;i;)s.push(i),i=i.parentNode.closest(t);return s},prev(e,t){let s=e.previousElementSibling;for(;s;){if(s.matches(t))return[s];s=s.previousElementSibling}return[]},next(e,t){let s=e.nextElementSibling;for(;s;){if(s.matches(t))return[s];s=s.nextElementSibling}return[]},focusableChildren(e){const t=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map((e=>`${e}:not([tabindex^="-"])`)).join(",");return this.find(t,e).filter((e=>!wt(e)&&yt(e)))},getSelectorFromElement(e){const t=es(e);return t&&ts.findOne(t)?t:null},getElementFromSelector(e){const t=es(e);return t?ts.findOne(t):null},getMultipleElementsFromSelector(e){const t=es(e);return t?ts.find(t):[]}},ss=(e,t="hide")=>{const s=`click.dismiss${e.EVENT_KEY}`,i=e.NAME;Vt.on(document,s,`[data-bs-dismiss="${i}"]`,(function(s){if(["A","AREA"].includes(this.tagName)&&s.preventDefault(),wt(this))return;const n=ts.getElementFromSelector(this)||this.closest(`.${i}`);e.getOrCreateInstance(n)[t]()}))},is=".bs.alert",ns=`close${is}`,os=`closed${is}`;class rs extends Qt{static get NAME(){return"alert"}close(){if(Vt.trigger(this._element,ns).defaultPrevented)return;this._element.classList.remove("show");const e=this._element.classList.contains("fade");this._queueCallback((()=>this._destroyElement()),this._element,e)}_destroyElement(){this._element.remove(),Vt.trigger(this._element,os),this.dispose()}static jQueryInterface(e){return this.each((function(){const t=rs.getOrCreateInstance(this);if("string"==typeof e){if(void 0===t[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);t[e](this)}}))}}ss(rs,"close"),Tt(rs);const as='[data-bs-toggle="button"]';class ls extends Qt{static get NAME(){return"button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(e){return this.each((function(){const t=ls.getOrCreateInstance(this);"toggle"===e&&t[e]()}))}}Vt.on(document,"click.bs.button.data-api",as,(e=>{e.preventDefault();const t=e.target.closest(as);ls.getOrCreateInstance(t).toggle()})),Tt(ls);const cs=".bs.swipe",ds=`touchstart${cs}`,us=`touchmove${cs}`,hs=`touchend${cs}`,ps=`pointerdown${cs}`,gs=`pointerup${cs}`,fs={endCallback:null,leftCallback:null,rightCallback:null},ms={endCallback:"(function|null)",leftCallback:"(function|null)",rightCallback:"(function|null)"};class bs extends Zt{constructor(e,t){super(),this._element=e,e&&bs.isSupported()&&(this._config=this._getConfig(t),this._deltaX=0,this._supportPointerEvents=Boolean(window.PointerEvent),this._initEvents())}static get Default(){return fs}static get DefaultType(){return ms}static get NAME(){return"swipe"}dispose(){Vt.off(this._element,cs)}_start(e){this._supportPointerEvents?this._eventIsPointerPenTouch(e)&&(this._deltaX=e.clientX):this._deltaX=e.touches[0].clientX}_end(e){this._eventIsPointerPenTouch(e)&&(this._deltaX=e.clientX-this._deltaX),this._handleSwipe(),Ct(this._config.endCallback)}_move(e){this._deltaX=e.touches&&e.touches.length>1?0:e.touches[0].clientX-this._deltaX}_handleSwipe(){const e=Math.abs(this._deltaX);if(e<=40)return;const t=e/this._deltaX;this._deltaX=0,t&&Ct(t>0?this._config.rightCallback:this._config.leftCallback)}_initEvents(){this._supportPointerEvents?(Vt.on(this._element,ps,(e=>this._start(e))),Vt.on(this._element,gs,(e=>this._end(e))),this._element.classList.add("pointer-event")):(Vt.on(this._element,ds,(e=>this._start(e))),Vt.on(this._element,us,(e=>this._move(e))),Vt.on(this._element,hs,(e=>this._end(e))))}_eventIsPointerPenTouch(e){return this._supportPointerEvents&&("pen"===e.pointerType||"touch"===e.pointerType)}static isSupported(){return"ontouchstart"in document.documentElement||navigator.maxTouchPoints>0}}const vs=".bs.carousel",_s=".data-api",ys="next",ws="prev",Es="left",As="right",Ss=`slide${vs}`,Ls=`slid${vs}`,Os=`keydown${vs}`,xs=`mouseenter${vs}`,Ts=`mouseleave${vs}`,Cs=`dragstart${vs}`,Is=`load${vs}${_s}`,Ns=`click${vs}${_s}`,ks="carousel",Ds="active",$s=".active",Rs=".carousel-item",Ms=$s+Rs,Ps={ArrowLeft:As,ArrowRight:Es},Bs={interval:5e3,keyboard:!0,pause:"hover",ride:!1,touch:!0,wrap:!0},Hs={interval:"(number|boolean)",keyboard:"boolean",pause:"(string|boolean)",ride:"(boolean|string)",touch:"boolean",wrap:"boolean"};class qs extends Qt{constructor(e,t){super(e,t),this._interval=null,this._activeElement=null,this._isSliding=!1,this.touchTimeout=null,this._swipeHelper=null,this._indicatorsElement=ts.findOne(".carousel-indicators",this._element),this._addEventListeners(),this._config.ride===ks&&this.cycle()}static get Default(){return Bs}static get DefaultType(){return Hs}static get NAME(){return"carousel"}next(){this._slide(ys)}nextWhenVisible(){!document.hidden&&yt(this._element)&&this.next()}prev(){this._slide(ws)}pause(){this._isSliding&&bt(this._element),this._clearInterval()}cycle(){this._clearInterval(),this._updateInterval(),this._interval=setInterval((()=>this.nextWhenVisible()),this._config.interval)}_maybeEnableCycle(){this._config.ride&&(this._isSliding?Vt.one(this._element,Ls,(()=>this.cycle())):this.cycle())}to(e){const t=this._getItems();if(e>t.length-1||e<0)return;if(this._isSliding)return void Vt.one(this._element,Ls,(()=>this.to(e)));const s=this._getItemIndex(this._getActive());if(s===e)return;const i=e>s?ys:ws;this._slide(i,t[e])}dispose(){this._swipeHelper&&this._swipeHelper.dispose(),super.dispose()}_configAfterMerge(e){return e.defaultInterval=e.interval,e}_addEventListeners(){this._config.keyboard&&Vt.on(this._element,Os,(e=>this._keydown(e))),"hover"===this._config.pause&&(Vt.on(this._element,xs,(()=>this.pause())),Vt.on(this._element,Ts,(()=>this._maybeEnableCycle()))),this._config.touch&&bs.isSupported()&&this._addTouchEventListeners()}_addTouchEventListeners(){for(const e of ts.find(".carousel-item img",this._element))Vt.on(e,Cs,(e=>e.preventDefault()));const e={leftCallback:()=>this._slide(this._directionToOrder(Es)),rightCallback:()=>this._slide(this._directionToOrder(As)),endCallback:()=>{"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout((()=>this._maybeEnableCycle()),500+this._config.interval))}};this._swipeHelper=new bs(this._element,e)}_keydown(e){if(/input|textarea/i.test(e.target.tagName))return;const t=Ps[e.key];t&&(e.preventDefault(),this._slide(this._directionToOrder(t)))}_getItemIndex(e){return this._getItems().indexOf(e)}_setActiveIndicatorElement(e){if(!this._indicatorsElement)return;const t=ts.findOne($s,this._indicatorsElement);t.classList.remove(Ds),t.removeAttribute("aria-current");const s=ts.findOne(`[data-bs-slide-to="${e}"]`,this._indicatorsElement);s&&(s.classList.add(Ds),s.setAttribute("aria-current","true"))}_updateInterval(){const e=this._activeElement||this._getActive();if(!e)return;const t=Number.parseInt(e.getAttribute("data-bs-interval"),10);this._config.interval=t||this._config.defaultInterval}_slide(e,t=null){if(this._isSliding)return;const s=this._getActive(),i=e===ys,n=t||Nt(this._getItems(),s,i,this._config.wrap);if(n===s)return;const o=this._getItemIndex(n),r=t=>Vt.trigger(this._element,t,{relatedTarget:n,direction:this._orderToDirection(e),from:this._getItemIndex(s),to:o});if(r(Ss).defaultPrevented)return;if(!s||!n)return;const a=Boolean(this._interval);this.pause(),this._isSliding=!0,this._setActiveIndicatorElement(o),this._activeElement=n;const l=i?"carousel-item-start":"carousel-item-end",c=i?"carousel-item-next":"carousel-item-prev";n.classList.add(c),St(n),s.classList.add(l),n.classList.add(l);this._queueCallback((()=>{n.classList.remove(l,c),n.classList.add(Ds),s.classList.remove(Ds,c,l),this._isSliding=!1,r(Ls)}),s,this._isAnimated()),a&&this.cycle()}_isAnimated(){return this._element.classList.contains("slide")}_getActive(){return ts.findOne(Ms,this._element)}_getItems(){return ts.find(Rs,this._element)}_clearInterval(){this._interval&&(clearInterval(this._interval),this._interval=null)}_directionToOrder(e){return xt()?e===Es?ws:ys:e===Es?ys:ws}_orderToDirection(e){return xt()?e===ws?Es:As:e===ws?As:Es}static jQueryInterface(e){return this.each((function(){const t=qs.getOrCreateInstance(this,e);if("number"!=typeof e){if("string"==typeof e){if(void 0===t[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);t[e]()}}else t.to(e)}))}}Vt.on(document,Ns,"[data-bs-slide], [data-bs-slide-to]",(function(e){const t=ts.getElementFromSelector(this);if(!t||!t.classList.contains(ks))return;e.preventDefault();const s=qs.getOrCreateInstance(t),i=this.getAttribute("data-bs-slide-to");return i?(s.to(i),void s._maybeEnableCycle()):"next"===Kt.getDataAttribute(this,"slide")?(s.next(),void s._maybeEnableCycle()):(s.prev(),void s._maybeEnableCycle())})),Vt.on(window,Is,(()=>{const e=ts.find('[data-bs-ride="carousel"]');for(const t of e)qs.getOrCreateInstance(t)})),Tt(qs);const js=".bs.collapse",Fs=`show${js}`,Ws=`shown${js}`,zs=`hide${js}`,Us=`hidden${js}`,Gs=`click${js}.data-api`,Vs="show",Ys="collapse",Xs="collapsing",Js=`:scope .${Ys} .${Ys}`,Ks='[data-bs-toggle="collapse"]',Zs={parent:null,toggle:!0},Qs={parent:"(null|element)",toggle:"boolean"};let ei=class e extends Qt{constructor(e,t){super(e,t),this._isTransitioning=!1,this._triggerArray=[];const s=ts.find(Ks);for(const e of s){const t=ts.getSelectorFromElement(e),s=ts.find(t).filter((e=>e===this._element));null!==t&&s.length&&this._triggerArray.push(e)}this._initializeChildren(),this._config.parent||this._addAriaAndCollapsedClass(this._triggerArray,this._isShown()),this._config.toggle&&this.toggle()}static get Default(){return Zs}static get DefaultType(){return Qs}static get NAME(){return"collapse"}toggle(){this._isShown()?this.hide():this.show()}show(){if(this._isTransitioning||this._isShown())return;let t=[];if(this._config.parent&&(t=this._getFirstLevelChildren(".collapse.show, .collapse.collapsing").filter((e=>e!==this._element)).map((t=>e.getOrCreateInstance(t,{toggle:!1})))),t.length&&t[0]._isTransitioning)return;if(Vt.trigger(this._element,Fs).defaultPrevented)return;for(const e of t)e.hide();const s=this._getDimension();this._element.classList.remove(Ys),this._element.classList.add(Xs),this._element.style[s]=0,this._addAriaAndCollapsedClass(this._triggerArray,!0),this._isTransitioning=!0;const i=`scroll${s[0].toUpperCase()+s.slice(1)}`;this._queueCallback((()=>{this._isTransitioning=!1,this._element.classList.remove(Xs),this._element.classList.add(Ys,Vs),this._element.style[s]="",Vt.trigger(this._element,Ws)}),this._element,!0),this._element.style[s]=`${this._element[i]}px`}hide(){if(this._isTransitioning||!this._isShown())return;if(Vt.trigger(this._element,zs).defaultPrevented)return;const e=this._getDimension();this._element.style[e]=`${this._element.getBoundingClientRect()[e]}px`,St(this._element),this._element.classList.add(Xs),this._element.classList.remove(Ys,Vs);for(const e of this._triggerArray){const t=ts.getElementFromSelector(e);t&&!this._isShown(t)&&this._addAriaAndCollapsedClass([e],!1)}this._isTransitioning=!0;this._element.style[e]="",this._queueCallback((()=>{this._isTransitioning=!1,this._element.classList.remove(Xs),this._element.classList.add(Ys),Vt.trigger(this._element,Us)}),this._element,!0)}_isShown(e=this._element){return e.classList.contains(Vs)}_configAfterMerge(e){return e.toggle=Boolean(e.toggle),e.parent=_t(e.parent),e}_getDimension(){return this._element.classList.contains("collapse-horizontal")?"width":"height"}_initializeChildren(){if(!this._config.parent)return;const e=this._getFirstLevelChildren(Ks);for(const t of e){const e=ts.getElementFromSelector(t);e&&this._addAriaAndCollapsedClass([t],this._isShown(e))}}_getFirstLevelChildren(e){const t=ts.find(Js,this._config.parent);return ts.find(e,this._config.parent).filter((e=>!t.includes(e)))}_addAriaAndCollapsedClass(e,t){if(e.length)for(const s of e)s.classList.toggle("collapsed",!t),s.setAttribute("aria-expanded",t)}static jQueryInterface(t){const s={};return"string"==typeof t&&/show|hide/.test(t)&&(s.toggle=!1),this.each((function(){const i=e.getOrCreateInstance(this,s);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t]()}}))}};Vt.on(document,Gs,Ks,(function(e){("A"===e.target.tagName||e.delegateTarget&&"A"===e.delegateTarget.tagName)&&e.preventDefault();for(const e of ts.getMultipleElementsFromSelector(this))ei.getOrCreateInstance(e,{toggle:!1}).toggle()})),Tt(ei);const ti="dropdown",si=".bs.dropdown",ii=".data-api",ni="ArrowUp",oi="ArrowDown",ri=`hide${si}`,ai=`hidden${si}`,li=`show${si}`,ci=`shown${si}`,di=`click${si}${ii}`,ui=`keydown${si}${ii}`,hi=`keyup${si}${ii}`,pi="show",gi='[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)',fi=`${gi}.${pi}`,mi=".dropdown-menu",bi=xt()?"top-end":"top-start",vi=xt()?"top-start":"top-end",_i=xt()?"bottom-end":"bottom-start",yi=xt()?"bottom-start":"bottom-end",wi=xt()?"left-start":"right-start",Ei=xt()?"right-start":"left-start",Ai={autoClose:!0,boundary:"clippingParents",display:"dynamic",offset:[0,2],popperConfig:null,reference:"toggle"},Si={autoClose:"(boolean|string)",boundary:"(string|element)",display:"string",offset:"(array|string|function)",popperConfig:"(null|object|function)",reference:"(string|element|object)"};class Li extends Qt{constructor(e,t){super(e,t),this._popper=null,this._parent=this._element.parentNode,this._menu=ts.next(this._element,mi)[0]||ts.prev(this._element,mi)[0]||ts.findOne(mi,this._parent),this._inNavbar=this._detectNavbar()}static get Default(){return Ai}static get DefaultType(){return Si}static get NAME(){return ti}toggle(){return this._isShown()?this.hide():this.show()}show(){if(wt(this._element)||this._isShown())return;const e={relatedTarget:this._element};if(!Vt.trigger(this._element,li,e).defaultPrevented){if(this._createPopper(),"ontouchstart"in document.documentElement&&!this._parent.closest(".navbar-nav"))for(const e of[].concat(...document.body.children))Vt.on(e,"mouseover",At);this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.add(pi),this._element.classList.add(pi),Vt.trigger(this._element,ci,e)}}hide(){if(wt(this._element)||!this._isShown())return;const e={relatedTarget:this._element};this._completeHide(e)}dispose(){this._popper&&this._popper.destroy(),super.dispose()}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_completeHide(e){if(!Vt.trigger(this._element,ri,e).defaultPrevented){if("ontouchstart"in document.documentElement)for(const e of[].concat(...document.body.children))Vt.off(e,"mouseover",At);this._popper&&this._popper.destroy(),this._menu.classList.remove(pi),this._element.classList.remove(pi),this._element.setAttribute("aria-expanded","false"),Kt.removeDataAttribute(this._menu,"popper"),Vt.trigger(this._element,ai,e)}}_getConfig(e){if("object"==typeof(e=super._getConfig(e)).reference&&!vt(e.reference)&&"function"!=typeof e.reference.getBoundingClientRect)throw new TypeError(`${ti.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);return e}_createPopper(){if(void 0===Be)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");let e=this._element;"parent"===this._config.reference?e=this._parent:vt(this._config.reference)?e=_t(this._config.reference):"object"==typeof this._config.reference&&(e=this._config.reference);const t=this._getPopperConfig();this._popper=Pe(e,this._menu,t)}_isShown(){return this._menu.classList.contains(pi)}_getPlacement(){const e=this._parent;if(e.classList.contains("dropend"))return wi;if(e.classList.contains("dropstart"))return Ei;if(e.classList.contains("dropup-center"))return"top";if(e.classList.contains("dropdown-center"))return"bottom";const t="end"===getComputedStyle(this._menu).getPropertyValue("--bs-position").trim();return e.classList.contains("dropup")?t?vi:bi:t?yi:_i}_detectNavbar(){return null!==this._element.closest(".navbar")}_getOffset(){const{offset:e}=this._config;return"string"==typeof e?e.split(",").map((e=>Number.parseInt(e,10))):"function"==typeof e?t=>e(t,this._element):e}_getPopperConfig(){const e={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return(this._inNavbar||"static"===this._config.display)&&(Kt.setDataAttribute(this._menu,"popper","static"),e.modifiers=[{name:"applyStyles",enabled:!1}]),{...e,...Ct(this._config.popperConfig,[e])}}_selectMenuItem({key:e,target:t}){const s=ts.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",this._menu).filter((e=>yt(e)));s.length&&Nt(s,t,e===oi,!s.includes(t)).focus()}static jQueryInterface(e){return this.each((function(){const t=Li.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e])throw new TypeError(`No method named "${e}"`);t[e]()}}))}static clearMenus(e){if(2===e.button||"keyup"===e.type&&"Tab"!==e.key)return;const t=ts.find(fi);for(const s of t){const t=Li.getInstance(s);if(!t||!1===t._config.autoClose)continue;const i=e.composedPath(),n=i.includes(t._menu);if(i.includes(t._element)||"inside"===t._config.autoClose&&!n||"outside"===t._config.autoClose&&n)continue;if(t._menu.contains(e.target)&&("keyup"===e.type&&"Tab"===e.key||/input|select|option|textarea|form/i.test(e.target.tagName)))continue;const o={relatedTarget:t._element};"click"===e.type&&(o.clickEvent=e),t._completeHide(o)}}static dataApiKeydownHandler(e){const t=/input|textarea/i.test(e.target.tagName),s="Escape"===e.key,i=[ni,oi].includes(e.key);if(!i&&!s)return;if(t&&!s)return;e.preventDefault();const n=this.matches(gi)?this:ts.prev(this,gi)[0]||ts.next(this,gi)[0]||ts.findOne(gi,e.delegateTarget.parentNode),o=Li.getOrCreateInstance(n);if(i)return e.stopPropagation(),o.show(),void o._selectMenuItem(e);o._isShown()&&(e.stopPropagation(),o.hide(),n.focus())}}Vt.on(document,ui,gi,Li.dataApiKeydownHandler),Vt.on(document,ui,mi,Li.dataApiKeydownHandler),Vt.on(document,di,Li.clearMenus),Vt.on(document,hi,Li.clearMenus),Vt.on(document,di,gi,(function(e){e.preventDefault(),Li.getOrCreateInstance(this).toggle()})),Tt(Li);const Oi="backdrop",xi="show",Ti=`mousedown.bs.${Oi}`,Ci={className:"modal-backdrop",clickCallback:null,isAnimated:!1,isVisible:!0,rootElement:"body"},Ii={className:"string",clickCallback:"(function|null)",isAnimated:"boolean",isVisible:"boolean",rootElement:"(element|string)"};class Ni extends Zt{constructor(e){super(),this._config=this._getConfig(e),this._isAppended=!1,this._element=null}static get Default(){return Ci}static get DefaultType(){return Ii}static get NAME(){return Oi}show(e){if(!this._config.isVisible)return void Ct(e);this._append();const t=this._getElement();this._config.isAnimated&&St(t),t.classList.add(xi),this._emulateAnimation((()=>{Ct(e)}))}hide(e){this._config.isVisible?(this._getElement().classList.remove(xi),this._emulateAnimation((()=>{this.dispose(),Ct(e)}))):Ct(e)}dispose(){this._isAppended&&(Vt.off(this._element,Ti),this._element.remove(),this._isAppended=!1)}_getElement(){if(!this._element){const e=document.createElement("div");e.className=this._config.className,this._config.isAnimated&&e.classList.add("fade"),this._element=e}return this._element}_configAfterMerge(e){return e.rootElement=_t(e.rootElement),e}_append(){if(this._isAppended)return;const e=this._getElement();this._config.rootElement.append(e),Vt.on(e,Ti,(()=>{Ct(this._config.clickCallback)})),this._isAppended=!0}_emulateAnimation(e){It(e,this._getElement(),this._config.isAnimated)}}const ki=".bs.focustrap",Di=`focusin${ki}`,$i=`keydown.tab${ki}`,Ri="backward",Mi={autofocus:!0,trapElement:null},Pi={autofocus:"boolean",trapElement:"element"};class Bi extends Zt{constructor(e){super(),this._config=this._getConfig(e),this._isActive=!1,this._lastTabNavDirection=null}static get Default(){return Mi}static get DefaultType(){return Pi}static get NAME(){return"focustrap"}activate(){this._isActive||(this._config.autofocus&&this._config.trapElement.focus(),Vt.off(document,ki),Vt.on(document,Di,(e=>this._handleFocusin(e))),Vt.on(document,$i,(e=>this._handleKeydown(e))),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,Vt.off(document,ki))}_handleFocusin(e){const{trapElement:t}=this._config;if(e.target===document||e.target===t||t.contains(e.target))return;const s=ts.focusableChildren(t);0===s.length?t.focus():this._lastTabNavDirection===Ri?s[s.length-1].focus():s[0].focus()}_handleKeydown(e){"Tab"===e.key&&(this._lastTabNavDirection=e.shiftKey?Ri:"forward")}}const Hi=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",qi=".sticky-top",ji="padding-right",Fi="margin-right";class Wi{constructor(){this._element=document.body}getWidth(){const e=document.documentElement.clientWidth;return Math.abs(window.innerWidth-e)}hide(){const e=this.getWidth();this._disableOverFlow(),this._setElementAttributes(this._element,ji,(t=>t+e)),this._setElementAttributes(Hi,ji,(t=>t+e)),this._setElementAttributes(qi,Fi,(t=>t-e))}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,ji),this._resetElementAttributes(Hi,ji),this._resetElementAttributes(qi,Fi)}isOverflowing(){return this.getWidth()>0}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(e,t,s){const i=this.getWidth();this._applyManipulationCallback(e,(e=>{if(e!==this._element&&window.innerWidth>e.clientWidth+i)return;this._saveInitialAttribute(e,t);const n=window.getComputedStyle(e).getPropertyValue(t);e.style.setProperty(t,`${s(Number.parseFloat(n))}px`)}))}_saveInitialAttribute(e,t){const s=e.style.getPropertyValue(t);s&&Kt.setDataAttribute(e,t,s)}_resetElementAttributes(e,t){this._applyManipulationCallback(e,(e=>{const s=Kt.getDataAttribute(e,t);null!==s?(Kt.removeDataAttribute(e,t),e.style.setProperty(t,s)):e.style.removeProperty(t)}))}_applyManipulationCallback(e,t){if(vt(e))t(e);else for(const s of ts.find(e,this._element))t(s)}}const zi=".bs.modal",Ui=`hide${zi}`,Gi=`hidePrevented${zi}`,Vi=`hidden${zi}`,Yi=`show${zi}`,Xi=`shown${zi}`,Ji=`resize${zi}`,Ki=`click.dismiss${zi}`,Zi=`mousedown.dismiss${zi}`,Qi=`keydown.dismiss${zi}`,en=`click${zi}.data-api`,tn="modal-open",sn="show",nn="modal-static",on={backdrop:!0,focus:!0,keyboard:!0},rn={backdrop:"(boolean|string)",focus:"boolean",keyboard:"boolean"};class an extends Qt{constructor(e,t){super(e,t),this._dialog=ts.findOne(".modal-dialog",this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._isTransitioning=!1,this._scrollBar=new Wi,this._addEventListeners()}static get Default(){return on}static get DefaultType(){return rn}static get NAME(){return"modal"}toggle(e){return this._isShown?this.hide():this.show(e)}show(e){if(this._isShown||this._isTransitioning)return;Vt.trigger(this._element,Yi,{relatedTarget:e}).defaultPrevented||(this._isShown=!0,this._isTransitioning=!0,this._scrollBar.hide(),document.body.classList.add(tn),this._adjustDialog(),this._backdrop.show((()=>this._showElement(e))))}hide(){if(!this._isShown||this._isTransitioning)return;Vt.trigger(this._element,Ui).defaultPrevented||(this._isShown=!1,this._isTransitioning=!0,this._focustrap.deactivate(),this._element.classList.remove(sn),this._queueCallback((()=>this._hideModal()),this._element,this._isAnimated()))}dispose(){Vt.off(window,zi),Vt.off(this._dialog,zi),this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new Ni({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new Bi({trapElement:this._element})}_showElement(e){document.body.contains(this._element)||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0;const t=ts.findOne(".modal-body",this._dialog);t&&(t.scrollTop=0),St(this._element),this._element.classList.add(sn);this._queueCallback((()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,Vt.trigger(this._element,Xi,{relatedTarget:e})}),this._dialog,this._isAnimated())}_addEventListeners(){Vt.on(this._element,Qi,(e=>{"Escape"===e.key&&(this._config.keyboard?this.hide():this._triggerBackdropTransition())})),Vt.on(window,Ji,(()=>{this._isShown&&!this._isTransitioning&&this._adjustDialog()})),Vt.on(this._element,Zi,(e=>{Vt.one(this._element,Ki,(t=>{this._element===e.target&&this._element===t.target&&("static"!==this._config.backdrop?this._config.backdrop&&this.hide():this._triggerBackdropTransition())}))}))}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide((()=>{document.body.classList.remove(tn),this._resetAdjustments(),this._scrollBar.reset(),Vt.trigger(this._element,Vi)}))}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(Vt.trigger(this._element,Gi).defaultPrevented)return;const e=this._element.scrollHeight>document.documentElement.clientHeight,t=this._element.style.overflowY;"hidden"===t||this._element.classList.contains(nn)||(e||(this._element.style.overflowY="hidden"),this._element.classList.add(nn),this._queueCallback((()=>{this._element.classList.remove(nn),this._queueCallback((()=>{this._element.style.overflowY=t}),this._dialog)}),this._dialog),this._element.focus())}_adjustDialog(){const e=this._element.scrollHeight>document.documentElement.clientHeight,t=this._scrollBar.getWidth(),s=t>0;if(s&&!e){const e=xt()?"paddingLeft":"paddingRight";this._element.style[e]=`${t}px`}if(!s&&e){const e=xt()?"paddingRight":"paddingLeft";this._element.style[e]=`${t}px`}}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(e,t){return this.each((function(){const s=an.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===s[e])throw new TypeError(`No method named "${e}"`);s[e](t)}}))}}Vt.on(document,en,'[data-bs-toggle="modal"]',(function(e){const t=ts.getElementFromSelector(this);["A","AREA"].includes(this.tagName)&&e.preventDefault(),Vt.one(t,Yi,(e=>{e.defaultPrevented||Vt.one(t,Vi,(()=>{yt(this)&&this.focus()}))}));const s=ts.findOne(".modal.show");s&&an.getInstance(s).hide();an.getOrCreateInstance(t).toggle(this)})),ss(an),Tt(an);const ln=".bs.offcanvas",cn=".data-api",dn=`load${ln}${cn}`,un="show",hn="showing",pn="hiding",gn=".offcanvas.show",fn=`show${ln}`,mn=`shown${ln}`,bn=`hide${ln}`,vn=`hidePrevented${ln}`,_n=`hidden${ln}`,yn=`resize${ln}`,wn=`click${ln}${cn}`,En=`keydown.dismiss${ln}`,An={backdrop:!0,keyboard:!0,scroll:!1},Sn={backdrop:"(boolean|string)",keyboard:"boolean",scroll:"boolean"};class Ln extends Qt{constructor(e,t){super(e,t),this._isShown=!1,this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._addEventListeners()}static get Default(){return An}static get DefaultType(){return Sn}static get NAME(){return"offcanvas"}toggle(e){return this._isShown?this.hide():this.show(e)}show(e){if(this._isShown)return;if(Vt.trigger(this._element,fn,{relatedTarget:e}).defaultPrevented)return;this._isShown=!0,this._backdrop.show(),this._config.scroll||(new Wi).hide(),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add(hn);this._queueCallback((()=>{this._config.scroll&&!this._config.backdrop||this._focustrap.activate(),this._element.classList.add(un),this._element.classList.remove(hn),Vt.trigger(this._element,mn,{relatedTarget:e})}),this._element,!0)}hide(){if(!this._isShown)return;if(Vt.trigger(this._element,bn).defaultPrevented)return;this._focustrap.deactivate(),this._element.blur(),this._isShown=!1,this._element.classList.add(pn),this._backdrop.hide();this._queueCallback((()=>{this._element.classList.remove(un,pn),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._config.scroll||(new Wi).reset(),Vt.trigger(this._element,_n)}),this._element,!0)}dispose(){this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}_initializeBackDrop(){const e=Boolean(this._config.backdrop);return new Ni({className:"offcanvas-backdrop",isVisible:e,isAnimated:!0,rootElement:this._element.parentNode,clickCallback:e?()=>{"static"!==this._config.backdrop?this.hide():Vt.trigger(this._element,vn)}:null})}_initializeFocusTrap(){return new Bi({trapElement:this._element})}_addEventListeners(){Vt.on(this._element,En,(e=>{"Escape"===e.key&&(this._config.keyboard?this.hide():Vt.trigger(this._element,vn))}))}static jQueryInterface(e){return this.each((function(){const t=Ln.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);t[e](this)}}))}}Vt.on(document,wn,'[data-bs-toggle="offcanvas"]',(function(e){const t=ts.getElementFromSelector(this);if(["A","AREA"].includes(this.tagName)&&e.preventDefault(),wt(this))return;Vt.one(t,_n,(()=>{yt(this)&&this.focus()}));const s=ts.findOne(gn);s&&s!==t&&Ln.getInstance(s).hide();Ln.getOrCreateInstance(t).toggle(this)})),Vt.on(window,dn,(()=>{for(const e of ts.find(gn))Ln.getOrCreateInstance(e).show()})),Vt.on(window,yn,(()=>{for(const e of ts.find("[aria-modal][class*=show][class*=offcanvas-]"))"fixed"!==getComputedStyle(e).position&&Ln.getOrCreateInstance(e).hide()})),ss(Ln),Tt(Ln);const On={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],dd:[],div:[],dl:[],dt:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},xn=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),Tn=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i,Cn=(e,t)=>{const s=e.nodeName.toLowerCase();return t.includes(s)?!xn.has(s)||Boolean(Tn.test(e.nodeValue)):t.filter((e=>e instanceof RegExp)).some((e=>e.test(s)))};const In={allowList:On,content:{},extraClass:"",html:!1,sanitize:!0,sanitizeFn:null,template:"
    "},Nn={allowList:"object",content:"object",extraClass:"(string|function)",html:"boolean",sanitize:"boolean",sanitizeFn:"(null|function)",template:"string"},kn={entry:"(string|element|function|null)",selector:"(string|element)"};class Dn extends Zt{constructor(e){super(),this._config=this._getConfig(e)}static get Default(){return In}static get DefaultType(){return Nn}static get NAME(){return"TemplateFactory"}getContent(){return Object.values(this._config.content).map((e=>this._resolvePossibleFunction(e))).filter(Boolean)}hasContent(){return this.getContent().length>0}changeContent(e){return this._checkContent(e),this._config.content={...this._config.content,...e},this}toHtml(){const e=document.createElement("div");e.innerHTML=this._maybeSanitize(this._config.template);for(const[t,s]of Object.entries(this._config.content))this._setContent(e,s,t);const t=e.children[0],s=this._resolvePossibleFunction(this._config.extraClass);return s&&t.classList.add(...s.split(" ")),t}_typeCheckConfig(e){super._typeCheckConfig(e),this._checkContent(e.content)}_checkContent(e){for(const[t,s]of Object.entries(e))super._typeCheckConfig({selector:t,entry:s},kn)}_setContent(e,t,s){const i=ts.findOne(s,e);i&&((t=this._resolvePossibleFunction(t))?vt(t)?this._putElementInTemplate(_t(t),i):this._config.html?i.innerHTML=this._maybeSanitize(t):i.textContent=t:i.remove())}_maybeSanitize(e){return this._config.sanitize?function(e,t,s){if(!e.length)return e;if(s&&"function"==typeof s)return s(e);const i=(new window.DOMParser).parseFromString(e,"text/html"),n=[].concat(...i.body.querySelectorAll("*"));for(const e of n){const s=e.nodeName.toLowerCase();if(!Object.keys(t).includes(s)){e.remove();continue}const i=[].concat(...e.attributes),n=[].concat(t["*"]||[],t[s]||[]);for(const t of i)Cn(t,n)||e.removeAttribute(t.nodeName)}return i.body.innerHTML}(e,this._config.allowList,this._config.sanitizeFn):e}_resolvePossibleFunction(e){return Ct(e,[this])}_putElementInTemplate(e,t){if(this._config.html)return t.innerHTML="",void t.append(e);t.textContent=e.textContent}}const $n=new Set(["sanitize","allowList","sanitizeFn"]),Rn="fade",Mn="show",Pn=".modal",Bn="hide.bs.modal",Hn="hover",qn="focus",jn={AUTO:"auto",TOP:"top",RIGHT:xt()?"left":"right",BOTTOM:"bottom",LEFT:xt()?"right":"left"},Fn={allowList:On,animation:!0,boundary:"clippingParents",container:!1,customClass:"",delay:0,fallbackPlacements:["top","right","bottom","left"],html:!1,offset:[0,6],placement:"top",popperConfig:null,sanitize:!0,sanitizeFn:null,selector:!1,template:'',title:"",trigger:"hover focus"},Wn={allowList:"object",animation:"boolean",boundary:"(string|element)",container:"(string|element|boolean)",customClass:"(string|function)",delay:"(number|object)",fallbackPlacements:"array",html:"boolean",offset:"(array|string|function)",placement:"(string|function)",popperConfig:"(null|object|function)",sanitize:"boolean",sanitizeFn:"(null|function)",selector:"(string|boolean)",template:"string",title:"(string|element|function)",trigger:"string"};class zn extends Qt{constructor(e,t){if(void 0===Be)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");super(e,t),this._isEnabled=!0,this._timeout=0,this._isHovered=null,this._activeTrigger={},this._popper=null,this._templateFactory=null,this._newContent=null,this.tip=null,this._setListeners(),this._config.selector||this._fixTitle()}static get Default(){return Fn}static get DefaultType(){return Wn}static get NAME(){return"tooltip"}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(){this._isEnabled&&(this._activeTrigger.click=!this._activeTrigger.click,this._isShown()?this._leave():this._enter())}dispose(){clearTimeout(this._timeout),Vt.off(this._element.closest(Pn),Bn,this._hideModalHandler),this._element.getAttribute("data-bs-original-title")&&this._element.setAttribute("title",this._element.getAttribute("data-bs-original-title")),this._disposePopper(),super.dispose()}show(){if("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this._isWithContent()||!this._isEnabled)return;const e=Vt.trigger(this._element,this.constructor.eventName("show")),t=(Et(this._element)||this._element.ownerDocument.documentElement).contains(this._element);if(e.defaultPrevented||!t)return;this._disposePopper();const s=this._getTipElement();this._element.setAttribute("aria-describedby",s.getAttribute("id"));const{container:i}=this._config;if(this._element.ownerDocument.documentElement.contains(this.tip)||(i.append(s),Vt.trigger(this._element,this.constructor.eventName("inserted"))),this._popper=this._createPopper(s),s.classList.add(Mn),"ontouchstart"in document.documentElement)for(const e of[].concat(...document.body.children))Vt.on(e,"mouseover",At);this._queueCallback((()=>{Vt.trigger(this._element,this.constructor.eventName("shown")),!1===this._isHovered&&this._leave(),this._isHovered=!1}),this.tip,this._isAnimated())}hide(){if(!this._isShown())return;if(Vt.trigger(this._element,this.constructor.eventName("hide")).defaultPrevented)return;if(this._getTipElement().classList.remove(Mn),"ontouchstart"in document.documentElement)for(const e of[].concat(...document.body.children))Vt.off(e,"mouseover",At);this._activeTrigger.click=!1,this._activeTrigger[qn]=!1,this._activeTrigger[Hn]=!1,this._isHovered=null;this._queueCallback((()=>{this._isWithActiveTrigger()||(this._isHovered||this._disposePopper(),this._element.removeAttribute("aria-describedby"),Vt.trigger(this._element,this.constructor.eventName("hidden")))}),this.tip,this._isAnimated())}update(){this._popper&&this._popper.update()}_isWithContent(){return Boolean(this._getTitle())}_getTipElement(){return this.tip||(this.tip=this._createTipElement(this._newContent||this._getContentForTemplate())),this.tip}_createTipElement(e){const t=this._getTemplateFactory(e).toHtml();if(!t)return null;t.classList.remove(Rn,Mn),t.classList.add(`bs-${this.constructor.NAME}-auto`);const s=(e=>{do{e+=Math.floor(1e6*Math.random())}while(document.getElementById(e));return e})(this.constructor.NAME).toString();return t.setAttribute("id",s),this._isAnimated()&&t.classList.add(Rn),t}setContent(e){this._newContent=e,this._isShown()&&(this._disposePopper(),this.show())}_getTemplateFactory(e){return this._templateFactory?this._templateFactory.changeContent(e):this._templateFactory=new Dn({...this._config,content:e,extraClass:this._resolvePossibleFunction(this._config.customClass)}),this._templateFactory}_getContentForTemplate(){return{".tooltip-inner":this._getTitle()}}_getTitle(){return this._resolvePossibleFunction(this._config.title)||this._element.getAttribute("data-bs-original-title")}_initializeOnDelegatedTarget(e){return this.constructor.getOrCreateInstance(e.delegateTarget,this._getDelegateConfig())}_isAnimated(){return this._config.animation||this.tip&&this.tip.classList.contains(Rn)}_isShown(){return this.tip&&this.tip.classList.contains(Mn)}_createPopper(e){const t=Ct(this._config.placement,[this,e,this._element]),s=jn[t.toUpperCase()];return Pe(this._element,e,this._getPopperConfig(s))}_getOffset(){const{offset:e}=this._config;return"string"==typeof e?e.split(",").map((e=>Number.parseInt(e,10))):"function"==typeof e?t=>e(t,this._element):e}_resolvePossibleFunction(e){return Ct(e,[this._element])}_getPopperConfig(e){const t={placement:e,modifiers:[{name:"flip",options:{fallbackPlacements:this._config.fallbackPlacements}},{name:"offset",options:{offset:this._getOffset()}},{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"arrow",options:{element:`.${this.constructor.NAME}-arrow`}},{name:"preSetPlacement",enabled:!0,phase:"beforeMain",fn:e=>{this._getTipElement().setAttribute("data-popper-placement",e.state.placement)}}]};return{...t,...Ct(this._config.popperConfig,[t])}}_setListeners(){const e=this._config.trigger.split(" ");for(const t of e)if("click"===t)Vt.on(this._element,this.constructor.eventName("click"),this._config.selector,(e=>{this._initializeOnDelegatedTarget(e).toggle()}));else if("manual"!==t){const e=t===Hn?this.constructor.eventName("mouseenter"):this.constructor.eventName("focusin"),s=t===Hn?this.constructor.eventName("mouseleave"):this.constructor.eventName("focusout");Vt.on(this._element,e,this._config.selector,(e=>{const t=this._initializeOnDelegatedTarget(e);t._activeTrigger["focusin"===e.type?qn:Hn]=!0,t._enter()})),Vt.on(this._element,s,this._config.selector,(e=>{const t=this._initializeOnDelegatedTarget(e);t._activeTrigger["focusout"===e.type?qn:Hn]=t._element.contains(e.relatedTarget),t._leave()}))}this._hideModalHandler=()=>{this._element&&this.hide()},Vt.on(this._element.closest(Pn),Bn,this._hideModalHandler)}_fixTitle(){const e=this._element.getAttribute("title");e&&(this._element.getAttribute("aria-label")||this._element.textContent.trim()||this._element.setAttribute("aria-label",e),this._element.setAttribute("data-bs-original-title",e),this._element.removeAttribute("title"))}_enter(){this._isShown()||this._isHovered?this._isHovered=!0:(this._isHovered=!0,this._setTimeout((()=>{this._isHovered&&this.show()}),this._config.delay.show))}_leave(){this._isWithActiveTrigger()||(this._isHovered=!1,this._setTimeout((()=>{this._isHovered||this.hide()}),this._config.delay.hide))}_setTimeout(e,t){clearTimeout(this._timeout),this._timeout=setTimeout(e,t)}_isWithActiveTrigger(){return Object.values(this._activeTrigger).includes(!0)}_getConfig(e){const t=Kt.getDataAttributes(this._element);for(const e of Object.keys(t))$n.has(e)&&delete t[e];return e={...t,..."object"==typeof e&&e?e:{}},e=this._mergeConfigObj(e),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}_configAfterMerge(e){return e.container=!1===e.container?document.body:_t(e.container),"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),"number"==typeof e.title&&(e.title=e.title.toString()),"number"==typeof e.content&&(e.content=e.content.toString()),e}_getDelegateConfig(){const e={};for(const[t,s]of Object.entries(this._config))this.constructor.Default[t]!==s&&(e[t]=s);return e.selector=!1,e.trigger="manual",e}_disposePopper(){this._popper&&(this._popper.destroy(),this._popper=null),this.tip&&(this.tip.remove(),this.tip=null)}static jQueryInterface(e){return this.each((function(){const t=zn.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e])throw new TypeError(`No method named "${e}"`);t[e]()}}))}}Tt(zn);const Un={...zn.Default,content:"",offset:[0,8],placement:"right",template:'',trigger:"click"},Gn={...zn.DefaultType,content:"(null|string|element|function)"};class Vn extends zn{static get Default(){return Un}static get DefaultType(){return Gn}static get NAME(){return"popover"}_isWithContent(){return this._getTitle()||this._getContent()}_getContentForTemplate(){return{".popover-header":this._getTitle(),".popover-body":this._getContent()}}_getContent(){return this._resolvePossibleFunction(this._config.content)}static jQueryInterface(e){return this.each((function(){const t=Vn.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e])throw new TypeError(`No method named "${e}"`);t[e]()}}))}}Tt(Vn);const Yn=".bs.scrollspy",Xn=`activate${Yn}`,Jn=`click${Yn}`,Kn=`load${Yn}.data-api`,Zn="active",Qn="[href]",eo=".nav-link",to=`${eo}, .nav-item > ${eo}, .list-group-item`,so={offset:null,rootMargin:"0px 0px -25%",smoothScroll:!1,target:null,threshold:[.1,.5,1]},io={offset:"(number|null)",rootMargin:"string",smoothScroll:"boolean",target:"element",threshold:"array"};class no extends Qt{constructor(e,t){super(e,t),this._targetLinks=new Map,this._observableSections=new Map,this._rootElement="visible"===getComputedStyle(this._element).overflowY?null:this._element,this._activeTarget=null,this._observer=null,this._previousScrollData={visibleEntryTop:0,parentScrollTop:0},this.refresh()}static get Default(){return so}static get DefaultType(){return io}static get NAME(){return"scrollspy"}refresh(){this._initializeTargetsAndObservables(),this._maybeEnableSmoothScroll(),this._observer?this._observer.disconnect():this._observer=this._getNewObserver();for(const e of this._observableSections.values())this._observer.observe(e)}dispose(){this._observer.disconnect(),super.dispose()}_configAfterMerge(e){return e.target=_t(e.target)||document.body,e.rootMargin=e.offset?`${e.offset}px 0px -30%`:e.rootMargin,"string"==typeof e.threshold&&(e.threshold=e.threshold.split(",").map((e=>Number.parseFloat(e)))),e}_maybeEnableSmoothScroll(){this._config.smoothScroll&&(Vt.off(this._config.target,Jn),Vt.on(this._config.target,Jn,Qn,(e=>{const t=this._observableSections.get(e.target.hash);if(t){e.preventDefault();const s=this._rootElement||window,i=t.offsetTop-this._element.offsetTop;if(s.scrollTo)return void s.scrollTo({top:i,behavior:"smooth"});s.scrollTop=i}})))}_getNewObserver(){const e={root:this._rootElement,threshold:this._config.threshold,rootMargin:this._config.rootMargin};return new IntersectionObserver((e=>this._observerCallback(e)),e)}_observerCallback(e){const t=e=>this._targetLinks.get(`#${e.target.id}`),s=e=>{this._previousScrollData.visibleEntryTop=e.target.offsetTop,this._process(t(e))},i=(this._rootElement||document.documentElement).scrollTop,n=i>=this._previousScrollData.parentScrollTop;this._previousScrollData.parentScrollTop=i;for(const o of e){if(!o.isIntersecting){this._activeTarget=null,this._clearActiveClass(t(o));continue}const e=o.target.offsetTop>=this._previousScrollData.visibleEntryTop;if(n&&e){if(s(o),!i)return}else n||e||s(o)}}_initializeTargetsAndObservables(){this._targetLinks=new Map,this._observableSections=new Map;const e=ts.find(Qn,this._config.target);for(const t of e){if(!t.hash||wt(t))continue;const e=ts.findOne(decodeURI(t.hash),this._element);yt(e)&&(this._targetLinks.set(decodeURI(t.hash),t),this._observableSections.set(t.hash,e))}}_process(e){this._activeTarget!==e&&(this._clearActiveClass(this._config.target),this._activeTarget=e,e.classList.add(Zn),this._activateParents(e),Vt.trigger(this._element,Xn,{relatedTarget:e}))}_activateParents(e){if(e.classList.contains("dropdown-item"))ts.findOne(".dropdown-toggle",e.closest(".dropdown")).classList.add(Zn);else for(const t of ts.parents(e,".nav, .list-group"))for(const e of ts.prev(t,to))e.classList.add(Zn)}_clearActiveClass(e){e.classList.remove(Zn);const t=ts.find(`${Qn}.${Zn}`,e);for(const e of t)e.classList.remove(Zn)}static jQueryInterface(e){return this.each((function(){const t=no.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);t[e]()}}))}}Vt.on(window,Kn,(()=>{for(const e of ts.find('[data-bs-spy="scroll"]'))no.getOrCreateInstance(e)})),Tt(no);const oo=".bs.tab",ro=`hide${oo}`,ao=`hidden${oo}`,lo=`show${oo}`,co=`shown${oo}`,uo=`click${oo}`,ho=`keydown${oo}`,po=`load${oo}`,go="ArrowLeft",fo="ArrowRight",mo="ArrowUp",bo="ArrowDown",vo="Home",_o="End",yo="active",wo="fade",Eo="show",Ao=".dropdown-toggle",So=`:not(${Ao})`,Lo='[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]',Oo=`${`.nav-link${So}, .list-group-item${So}, [role="tab"]${So}`}, ${Lo}`,xo=`.${yo}[data-bs-toggle="tab"], .${yo}[data-bs-toggle="pill"], .${yo}[data-bs-toggle="list"]`;let To=class e extends Qt{constructor(e){super(e),this._parent=this._element.closest('.list-group, .nav, [role="tablist"]'),this._parent&&(this._setInitialAttributes(this._parent,this._getChildren()),Vt.on(this._element,ho,(e=>this._keydown(e))))}static get NAME(){return"tab"}show(){const e=this._element;if(this._elemIsActive(e))return;const t=this._getActiveElem(),s=t?Vt.trigger(t,ro,{relatedTarget:e}):null;Vt.trigger(e,lo,{relatedTarget:t}).defaultPrevented||s&&s.defaultPrevented||(this._deactivate(t,e),this._activate(e,t))}_activate(e,t){if(!e)return;e.classList.add(yo),this._activate(ts.getElementFromSelector(e));this._queueCallback((()=>{"tab"===e.getAttribute("role")?(e.removeAttribute("tabindex"),e.setAttribute("aria-selected",!0),this._toggleDropDown(e,!0),Vt.trigger(e,co,{relatedTarget:t})):e.classList.add(Eo)}),e,e.classList.contains(wo))}_deactivate(e,t){if(!e)return;e.classList.remove(yo),e.blur(),this._deactivate(ts.getElementFromSelector(e));this._queueCallback((()=>{"tab"===e.getAttribute("role")?(e.setAttribute("aria-selected",!1),e.setAttribute("tabindex","-1"),this._toggleDropDown(e,!1),Vt.trigger(e,ao,{relatedTarget:t})):e.classList.remove(Eo)}),e,e.classList.contains(wo))}_keydown(t){if(![go,fo,mo,bo,vo,_o].includes(t.key))return;t.stopPropagation(),t.preventDefault();const s=this._getChildren().filter((e=>!wt(e)));let i;if([vo,_o].includes(t.key))i=s[t.key===vo?0:s.length-1];else{const e=[fo,bo].includes(t.key);i=Nt(s,t.target,e,!0)}i&&(i.focus({preventScroll:!0}),e.getOrCreateInstance(i).show())}_getChildren(){return ts.find(Oo,this._parent)}_getActiveElem(){return this._getChildren().find((e=>this._elemIsActive(e)))||null}_setInitialAttributes(e,t){this._setAttributeIfNotExists(e,"role","tablist");for(const e of t)this._setInitialAttributesOnChild(e)}_setInitialAttributesOnChild(e){e=this._getInnerElement(e);const t=this._elemIsActive(e),s=this._getOuterElement(e);e.setAttribute("aria-selected",t),s!==e&&this._setAttributeIfNotExists(s,"role","presentation"),t||e.setAttribute("tabindex","-1"),this._setAttributeIfNotExists(e,"role","tab"),this._setInitialAttributesOnTargetPanel(e)}_setInitialAttributesOnTargetPanel(e){const t=ts.getElementFromSelector(e);t&&(this._setAttributeIfNotExists(t,"role","tabpanel"),e.id&&this._setAttributeIfNotExists(t,"aria-labelledby",`${e.id}`))}_toggleDropDown(e,t){const s=this._getOuterElement(e);if(!s.classList.contains("dropdown"))return;const i=(e,i)=>{const n=ts.findOne(e,s);n&&n.classList.toggle(i,t)};i(Ao,yo),i(".dropdown-menu",Eo),s.setAttribute("aria-expanded",t)}_setAttributeIfNotExists(e,t,s){e.hasAttribute(t)||e.setAttribute(t,s)}_elemIsActive(e){return e.classList.contains(yo)}_getInnerElement(e){return e.matches(Oo)?e:ts.findOne(Oo,e)}_getOuterElement(e){return e.closest(".nav-item, .list-group-item")||e}static jQueryInterface(t){return this.each((function(){const s=e.getOrCreateInstance(this);if("string"==typeof t){if(void 0===s[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);s[t]()}}))}};Vt.on(document,uo,Lo,(function(e){["A","AREA"].includes(this.tagName)&&e.preventDefault(),wt(this)||To.getOrCreateInstance(this).show()})),Vt.on(window,po,(()=>{for(const e of ts.find(xo))To.getOrCreateInstance(e)})),Tt(To);const Co=".bs.toast",Io=`mouseover${Co}`,No=`mouseout${Co}`,ko=`focusin${Co}`,Do=`focusout${Co}`,$o=`hide${Co}`,Ro=`hidden${Co}`,Mo=`show${Co}`,Po=`shown${Co}`,Bo="hide",Ho="show",qo="showing",jo={animation:"boolean",autohide:"boolean",delay:"number"},Fo={animation:!0,autohide:!0,delay:5e3};class Wo extends Qt{constructor(e,t){super(e,t),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get Default(){return Fo}static get DefaultType(){return jo}static get NAME(){return"toast"}show(){if(Vt.trigger(this._element,Mo).defaultPrevented)return;this._clearTimeout(),this._config.animation&&this._element.classList.add("fade");this._element.classList.remove(Bo),St(this._element),this._element.classList.add(Ho,qo),this._queueCallback((()=>{this._element.classList.remove(qo),Vt.trigger(this._element,Po),this._maybeScheduleHide()}),this._element,this._config.animation)}hide(){if(!this.isShown())return;if(Vt.trigger(this._element,$o).defaultPrevented)return;this._element.classList.add(qo),this._queueCallback((()=>{this._element.classList.add(Bo),this._element.classList.remove(qo,Ho),Vt.trigger(this._element,Ro)}),this._element,this._config.animation)}dispose(){this._clearTimeout(),this.isShown()&&this._element.classList.remove(Ho),super.dispose()}isShown(){return this._element.classList.contains(Ho)}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout((()=>{this.hide()}),this._config.delay)))}_onInteraction(e,t){switch(e.type){case"mouseover":case"mouseout":this._hasMouseInteraction=t;break;case"focusin":case"focusout":this._hasKeyboardInteraction=t}if(t)return void this._clearTimeout();const s=e.relatedTarget;this._element===s||this._element.contains(s)||this._maybeScheduleHide()}_setListeners(){Vt.on(this._element,Io,(e=>this._onInteraction(e,!0))),Vt.on(this._element,No,(e=>this._onInteraction(e,!1))),Vt.on(this._element,ko,(e=>this._onInteraction(e,!0))),Vt.on(this._element,Do,(e=>this._onInteraction(e,!1)))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(e){return this.each((function(){const t=Wo.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e])throw new TypeError(`No method named "${e}"`);t[e](this)}}))}}ss(Wo),Tt(Wo);class zo extends HTMLElement{constructor(){super()}get alerts(){return this.querySelectorAll(".alert")}connectedCallback(){for(const e of this.alerts)new rs(e)}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-messages")&&window.customElements.define("tobago-messages",zo)}));class Uo extends HTMLElement{constructor(){super()}get text(){return this.querySelector("span.page-link")}get output(){return this.querySelector(".page-link span")}get input(){return this.querySelector(".page-link input")}get sheet(){const e=this.closest("tobago-sheet");return null!=e?e:(window.alert("todo: implement find, wenn this is not a child"),document.querySelector("tobago-sheet"))}connectedCallback(){console.warn("register -------------- click on paging",this.tagName),this.text.addEventListener("click",this.clickOnPaging.bind(this));const e=this.input;console.warn("register -------------- blur on paging",this.tagName),e.addEventListener("blur",this.blurPaging.bind(this)),console.warn("register -------------- keydown on paging",this.tagName),e.addEventListener("keydown",function(e){e.key===t.ENTER&&(e.stopPropagation(),e.preventDefault(),e.currentTarget.dispatchEvent(new Event("blur")))}.bind(this))}clickOnPaging(e){this.output.style.display="none",console.warn("execute -------------- click on paging",this.tagName);const t=this.input;t.style.display="initial",t.focus(),t.select()}blurPaging(e){console.warn("execute -------------- blur on paging",this.tagName);const t=e.currentTarget,s=this.output,i=Number.parseInt(t.value);i>0&&i.toString()!==s.innerHTML?(console.debug("Reloading sheet '%s' old value='%s' new value='%s'",this.id,s.innerHTML,i),s.innerHTML=i.toString(),faces.ajax.request(t.id,null,{params:{"javax.faces.behavior.event":"reload"},execute:this.sheet.id,render:this.sheet.id})):(console.info("no update needed"),t.value=s.innerHTML,t.style.display="none",s.style.display="initial")}}class Go extends Uo{constructor(){super()}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-paginator-page")&&window.customElements.define("tobago-paginator-page",Go)}));class Vo extends Uo{constructor(){super()}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-paginator-row")&&window.customElements.define("tobago-paginator-row",Vo)}));class Yo extends HTMLElement{}var Xo,Jo,Ko;document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-panel")&&window.customElements.define("tobago-panel",Yo)})),function(e){e[e.auto=0]="auto",e[e.never=1]="never"}(Xo||(Xo={}));class Zo extends HTMLElement{constructor(){super()}connectedCallback(){this.instance=new Vn(this.baseElement,{container:this.popoverStore,customClass:this.customClass,title:this.label,content:this.value,html:!this.escape,sanitize:this.sanitize===Xo.auto,trigger:"focus"})}get baseElement(){var e,t;return"A"===(null===(e=this.parentElement)||void 0===e?void 0:e.tagName)||"BUTTON"===(null===(t=this.parentElement)||void 0===t?void 0:t.tagName)?this.parentElement:this}get popoverStore(){return document.getRootNode().querySelector(".tobago-page-popoverStore")}get customClass(){const e=this.getAttribute("custom-class");return e||""}get label(){const e=this.getAttribute("label");return e||""}get value(){return this.getAttribute("value")}get escape(){return"false"!==this.getAttribute("escape")}get sanitize(){return Xo[this.getAttribute("sanitize")]}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-popover")&&window.customElements.define("tobago-popover",Zo)})),function(e){e[e.none=0]="none",e[e.client=1]="client",e[e.ajax=2]="ajax",e[e.full=3]="full"}(Jo||(Jo={})),function(e){e[e.none=0]="none",e[e.show=1]="show",e[e.hide=2]="hide",e[e.toggle=3]="toggle"}(Ko||(Ko={}));class Qo{static findHidden(e){return e.getRootNode().getElementById(e.id+"::collapse")}static fireEvent(e,t){const s="tobago."+e.tagName.substring(7).toLowerCase()+"."+t;e.dispatchEvent(new CustomEvent(s,{bubbles:!0}))}}Qo.execute=function(t,s,i){const n=Qo.findHidden(s);let o;switch(t){case Ko.hide:o=!0;break;case Ko.show:o=!1;break;default:console.error("unknown operation: '%s'",t)}o?(Qo.fireEvent(s,"hide"),s instanceof tr?s.clientBehaviorHide(i):s.classList.add(e.TOBAGO_COLLAPSED),Qo.fireEvent(s,"hidden")):(Qo.fireEvent(s,"show"),s instanceof tr?s.clientBehaviorShow(i):s.classList.remove(e.TOBAGO_COLLAPSED),Qo.fireEvent(s,"shown")),n.value=o};const er="hidden.bs.modal";class tr extends HTMLElement{constructor(){super()}connectedCallback(){this.modal=new an(this,{}),this.collapsed||this.clientBehaviorShow(),this.addEventListener(er,(()=>{this.connected&&(this.collapsed=!0)}))}disconnectedCallback(){this.clientBehaviorHide()}clientBehaviorShow(e){console.debug("show - behaviorMode:",e),null!=e&&e!=Jo.client||this.modal.show()}clientBehaviorHide(e){console.debug("hide - behaviorMode:",e),null!=e&&e!=Jo.client||this.modal.hide()}get collapsed(){return JSON.parse(Qo.findHidden(this).value)}set collapsed(e){Qo.findHidden(this).value=String(e)}get connected(){return null!=this.parentElement}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-popup")&&window.customElements.define("tobago-popup",tr)}));class sr extends HTMLElement{constructor(){super()}connectedCallback(){this.range.addEventListener("input",this.updateTooltip.bind(this)),this.range.addEventListener("focus",this.updateTooltip.bind(this))}get range(){return this.querySelector("input[type=range]")}get tooltip(){return this.querySelector(".tobago-tooltip")}updateTooltip(){this.tooltip.textContent=this.range.value,this.tooltip.style.top=String(this.range.offsetTop-this.tooltip.offsetHeight)+"px",this.tooltip.style.left=String(this.range.offsetLeft+this.range.offsetWidth/2-this.tooltip.offsetWidth/2)+"px",this.tooltip.classList.add(e.SHOW),clearTimeout(this.timer),this.timer=setTimeout((()=>{this.tooltip.classList.remove(e.SHOW)}),1e3)}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-range")&&window.customElements.define("tobago-range",sr)}));class ir extends HTMLElement{constructor(){super()}connectedCallback(){this.schedule(this.id,this.component.id,this.frequency)}schedule(e,t,s){if(s>0){const i=ir.timeoutMap.get(t);i&&(console.debug("clear reload timeout '%s' for #'%s'",i,t),window.clearTimeout(i),ir.timeoutMap.delete(t));const n=window.setTimeout((function(){console.debug("reloading #'%s'",t),faces.ajax.request(e,null,{params:{"jakarta.faces.behavior.event":"reload"},execute:`${e} ${t}`,render:`${e} ${t}`})}),s);console.debug("adding reload timeout '%s' for #'%s'",n,t),ir.timeoutMap.set(t,n)}}get component(){return this.parentElement}get frequency(){const e=this.getAttribute("frequency");return e?Number.parseFloat(e):0}}ir.timeoutMap=new Map,document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-reload")&&window.customElements.define("tobago-reload",ir)}));class nr extends HTMLElement{constructor(){super()}connectedCallback(){const e=this.hiddenElement.value,t=JSON.parse(e);2===t.length?(this.parentElement.scrollLeft=t[0],this.parentElement.scrollTop=t[1]):console.warn("Syntax error for scroll position: ",e),this.parentElement.addEventListener("scroll",this.storeScrollPosition.bind(this))}storeScrollPosition(e){const t=e.currentTarget,s=t.scrollLeft,i=t.scrollTop;this.hiddenElement.value=JSON.stringify([s,i])}get hiddenElement(){return this.querySelector("input")}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-scroll")&&window.customElements.define("tobago-scroll",nr)}));class or extends HTMLElement{constructor(){super()}connectedCallback(){this.field.addEventListener("focus",Ze.setLastFocusId),this.field.readOnly&&this.field.addEventListener("click",(function(e){e.preventDefault()}))}get field(){return this.getRootNode().getElementById(this.id+"::field")}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-boolean-checkbox")&&window.customElements.define("tobago-select-boolean-checkbox",or)}));class rr extends or{}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-boolean-toggle")&&window.customElements.define("tobago-select-boolean-toggle",rr)}));class ar extends HTMLElement{constructor(){super()}connectedCallback(){for(const e of this.inputs)e.addEventListener("focus",Ze.setLastFocusId),e.readOnly&&e.addEventListener("click",(e=>{e.preventDefault()}))}get inputs(){return this.querySelectorAll(`input[name='${this.id}']`)}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-many-checkbox")&&window.customElements.define("tobago-select-many-checkbox",ar)}));class lr{static set(e,t){this.map.set(e,t)}static get(e){const t=this.map.get(e);return t||(console.warn("TobagoFilterRegistry.get("+e+") = undefined"),null)}static localeContains(e,t,s){e=e.normalize();const i=(t=t.normalize()).length,n=s?0:e.length-i;for(let s=0;s<=n;s++){if(0===e.substring(s,s+i).localeCompare(t,window.navigator.language,{sensitivity:"base"}))return!0}return!1}}lr.map=new Map,lr.set("contains",((e,t)=>lr.localeContains(e,t,!1))),lr.set("startsWith",((e,t)=>lr.localeContains(e,t,!0))),lr.set("containsExact",((e,t)=>e.indexOf(t)>=0)),lr.set("startsWithExact",((e,t)=>0==e.indexOf(t)));class cr extends HTMLElement{get disabled(){return this.classList.contains(e.TOBAGO_DISABLED)}get focused(){return this.classList.contains(e.TOBAGO_FOCUS)}set focused(t){t&&!this.focused?(this.classList.add(e.TOBAGO_FOCUS),this.hiddenSelect.dispatchEvent(new Event("focus",{bubbles:!0}))):!t&&this.focused&&(this.classList.remove(e.TOBAGO_FOCUS),this.hiddenSelect.dispatchEvent(new Event("blur",{bubbles:!0})))}get filter(){return this.getAttribute("filter")}get hiddenSelect(){return this.querySelector("select")}get hiddenOptions(){return this.hiddenSelect.querySelectorAll("option")}get selectField(){return this.querySelector(".tobago-select-field")}get filterInput(){return this.querySelector(".tobago-filter")}get dropdownMenu(){return this.getRootNode().querySelector(`.${e.TOBAGO_DROPDOWN_MENU}[name='${this.id}']`)}get options(){return this.getRootNode().querySelector(`.tobago-options[name='${this.id}'] table`)}get tbody(){return this.options.querySelector("tbody")}get rows(){return this.tbody.querySelectorAll("tr")}get enabledRows(){return this.tbody.querySelectorAll("tr:not(."+e.D_NONE+"):not(."+e.DISABLED)}get preselectedRow(){return this.tbody.querySelector("."+e.TOBAGO_PRESELECT)}get localMenu(){return this.hasAttribute("local-menu")}connectedCallback(){this.dropdownMenu&&(this.popper=Pe(this.selectField,this.dropdownMenu,{}),window.addEventListener("resize",(()=>this.updateDropdownMenuWidth()))),document.addEventListener("click",this.globalClickEvent.bind(this)),this.hiddenSelect.addEventListener("click",this.labelClickEvent.bind(this)),this.selectField.addEventListener("keydown",this.keydownEventBase.bind(this)),this.filterInput.addEventListener("focus",this.focusEvent.bind(this)),this.filterInput.addEventListener("blur",this.blurEvent.bind(this)),this.options.addEventListener("keydown",this.keydownEventBase.bind(this)),this.rows.forEach((e=>e.addEventListener("blur",this.blurEvent.bind(this)))),this.filter&&this.filterInput.addEventListener("input",this.filterEvent.bind(this)),this.tbody.addEventListener("click",this.tbodyClickEvent.bind(this)),document.activeElement.id===this.filterInput.id&&this.focusEvent(),this.selectField.addEventListener("click",(()=>this.hiddenSelect.dispatchEvent(new Event("click")))),this.options.addEventListener("click",(()=>this.hiddenSelect.dispatchEvent(new Event("click")))),this.selectField.addEventListener("dblclick",(()=>this.hiddenSelect.dispatchEvent(new Event("dblclick")))),this.options.addEventListener("dblclick",(()=>this.hiddenSelect.dispatchEvent(new Event("dblclick"))))}disconnectedCallback(){var e;null===(e=this.dropdownMenu)||void 0===e||e.remove()}keydownEventBase(s){switch(s.key){case t.ESCAPE:this.hideDropdown(),this.removePreselection(),this.filterInput.focus({preventScroll:!0});break;case t.ARROW_DOWN:s.preventDefault(),this.showDropdown(),this.preselectNextRow();break;case t.ARROW_UP:s.preventDefault(),this.showDropdown(),this.preselectPreviousRow();break;case t.ENTER:case t.SPACE:if(this.preselectedRow){s.preventDefault();const t=this.tbody.querySelector("."+e.TOBAGO_PRESELECT);this.select(t)}else document.activeElement.id===this.filterInput.id&&this.showDropdown();break;case t.TAB:this.removePreselection(),this.filterInput.focus({preventScroll:!0});break;default:this.filterInput.focus({preventScroll:!0})}}focusEvent(){this.disabled||(this.focused=!0)}blurEvent(e){null!==e.relatedTarget&&(this.isPartOfSelectField(e.relatedTarget)||this.isPartOfTobagoOptions(e.relatedTarget)||this.leaveComponent())}filterEvent(t){const s=t.currentTarget.value;this.showDropdown();const i=lr.get(this.filter);let n=0;null!=i&&this.rows.forEach((t=>{const o=t.cells.item(0).textContent;i(o,s)?(t.classList.remove(e.D_NONE),n++):(t.classList.add(e.D_NONE),t.classList.remove(e.TOBAGO_PRESELECT))}));const o=this.options.querySelector("."+e.TOBAGO_NO_ENTRIES);0===n?o.classList.remove(e.D_NONE):o.classList.add(e.D_NONE)}tbodyClickEvent(e){const t=e.target.closest("tr");this.select(t)}preselectNextRow(){const t=this.enabledRows,s=this.preselectIndex(t);s>=0?s+10&&this.preselect(t.item(0))}preselectPreviousRow(){const t=this.enabledRows,s=this.preselectIndex(t);s>=0?s-1>=0?(t.item(s).classList.remove(e.TOBAGO_PRESELECT),this.preselect(t.item(s-1))):(t.item(0).classList.remove(e.TOBAGO_PRESELECT),this.preselect(t.item(t.length-1))):t.length>0&&this.preselect(t.item(t.length-1))}preselectIndex(t){for(let s=0;spt.has(e)&&pt.get(e).get(t)||null,remove(e,t){if(!pt.has(e))return;const s=pt.get(e);s.delete(t),0===s.size&&pt.delete(e)}},ft="transitionend",mt=e=>(e&&window.CSS&&window.CSS.escape&&(e=e.replace(/#([^\s"#']+)/g,((e,t)=>`#${CSS.escape(t)}`))),e),bt=e=>{e.dispatchEvent(new Event(ft))},vt=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&(e=e[0]),void 0!==e.nodeType),_t=e=>vt(e)?e.jquery?e[0]:e:"string"==typeof e&&e.length>0?document.querySelector(mt(e)):null,yt=e=>{if(!vt(e)||0===e.getClientRects().length)return!1;const t="visible"===getComputedStyle(e).getPropertyValue("visibility"),s=e.closest("details:not([open])");if(!s)return t;if(s!==e){const t=e.closest("summary");if(t&&t.parentNode!==s)return!1;if(null===t)return!1}return t},wt=e=>!e||e.nodeType!==Node.ELEMENT_NODE||(!!e.classList.contains("disabled")||(void 0!==e.disabled?e.disabled:e.hasAttribute("disabled")&&"false"!==e.getAttribute("disabled"))),Et=e=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof e.getRootNode){const t=e.getRootNode();return t instanceof ShadowRoot?t:null}return e instanceof ShadowRoot?e:e.parentNode?Et(e.parentNode):null},At=()=>{},St=e=>{e.offsetHeight},Lt=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,Ot=[],xt=()=>"rtl"===document.documentElement.dir,Tt=e=>{var t;t=()=>{const t=Lt();if(t){const s=e.NAME,i=t.fn[s];t.fn[s]=e.jQueryInterface,t.fn[s].Constructor=e,t.fn[s].noConflict=()=>(t.fn[s]=i,e.jQueryInterface)}},"loading"===document.readyState?(Ot.length||document.addEventListener("DOMContentLoaded",(()=>{for(const e of Ot)e()})),Ot.push(t)):t()},Ct=(e,t=[],s=e)=>"function"==typeof e?e(...t):s,It=(e,t,s=!0)=>{if(!s)return void Ct(e);const i=(e=>{if(!e)return 0;let{transitionDuration:t,transitionDelay:s}=window.getComputedStyle(e);const i=Number.parseFloat(t),n=Number.parseFloat(s);return i||n?(t=t.split(",")[0],s=s.split(",")[0],1e3*(Number.parseFloat(t)+Number.parseFloat(s))):0})(t)+5;let n=!1;const o=({target:s})=>{s===t&&(n=!0,t.removeEventListener(ft,o),Ct(e))};t.addEventListener(ft,o),setTimeout((()=>{n||bt(t)}),i)},Nt=(e,t,s,i)=>{const n=e.length;let o=e.indexOf(t);return-1===o?!s&&i?e[n-1]:e[0]:(o+=s?1:-1,i&&(o=(o+n)%n),e[Math.max(0,Math.min(o,n-1))])},kt=/[^.]*(?=\..*)\.|.*/,Dt=/\..*/,$t=/::\d+$/,Rt={};let Mt=1;const Pt={mouseenter:"mouseover",mouseleave:"mouseout"},Bt=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function Ht(e,t){return t&&`${t}::${Mt++}`||e.uidEvent||Mt++}function qt(e){const t=Ht(e);return e.uidEvent=t,Rt[t]=Rt[t]||{},Rt[t]}function jt(e,t,s=null){return Object.values(e).find((e=>e.callable===t&&e.delegationSelector===s))}function Ft(e,t,s){const i="string"==typeof t,n=i?s:t||s;let o=Gt(e);return Bt.has(o)||(o=e),[i,n,o]}function Wt(e,t,s,i,n){if("string"!=typeof t||!e)return;let[o,r,a]=Ft(t,s,i);if(t in Pt){const e=e=>function(t){if(!t.relatedTarget||t.relatedTarget!==t.delegateTarget&&!t.delegateTarget.contains(t.relatedTarget))return e.call(this,t)};r=e(r)}const l=qt(e),c=l[a]||(l[a]={}),d=jt(c,r,o?s:null);if(d)return void(d.oneOff=d.oneOff&&n);const u=Ht(r,t.replace(kt,"")),h=o?function(e,t,s){return function i(n){const o=e.querySelectorAll(t);for(let{target:r}=n;r&&r!==this;r=r.parentNode)for(const a of o)if(a===r)return Yt(n,{delegateTarget:r}),i.oneOff&&Vt.off(e,n.type,t,s),s.apply(r,[n])}}(e,s,r):function(e,t){return function s(i){return Yt(i,{delegateTarget:e}),s.oneOff&&Vt.off(e,i.type,t),t.apply(e,[i])}}(e,r);h.delegationSelector=o?s:null,h.callable=r,h.oneOff=n,h.uidEvent=u,c[u]=h,e.addEventListener(a,h,o)}function zt(e,t,s,i,n){const o=jt(t[s],i,n);o&&(e.removeEventListener(s,o,Boolean(n)),delete t[s][o.uidEvent])}function Ut(e,t,s,i){const n=t[s]||{};for(const[o,r]of Object.entries(n))o.includes(i)&&zt(e,t,s,r.callable,r.delegationSelector)}function Gt(e){return e=e.replace(Dt,""),Pt[e]||e}const Vt={on(e,t,s,i){Wt(e,t,s,i,!1)},one(e,t,s,i){Wt(e,t,s,i,!0)},off(e,t,s,i){if("string"!=typeof t||!e)return;const[n,o,r]=Ft(t,s,i),a=r!==t,l=qt(e),c=l[r]||{},d=t.startsWith(".");if(void 0===o){if(d)for(const s of Object.keys(l))Ut(e,l,s,t.slice(1));for(const[s,i]of Object.entries(c)){const n=s.replace($t,"");a&&!t.includes(n)||zt(e,l,r,i.callable,i.delegationSelector)}}else{if(!Object.keys(c).length)return;zt(e,l,r,o,n?s:null)}},trigger(e,t,s){if("string"!=typeof t||!e)return null;const i=Lt();let n=null,o=!0,r=!0,a=!1;t!==Gt(t)&&i&&(n=i.Event(t,s),i(e).trigger(n),o=!n.isPropagationStopped(),r=!n.isImmediatePropagationStopped(),a=n.isDefaultPrevented());const l=Yt(new Event(t,{bubbles:o,cancelable:!0}),s);return a&&l.preventDefault(),r&&e.dispatchEvent(l),l.defaultPrevented&&n&&n.preventDefault(),l}};function Yt(e,t={}){for(const[s,i]of Object.entries(t))try{e[s]=i}catch(t){Object.defineProperty(e,s,{configurable:!0,get:()=>i})}return e}function Xt(e){if("true"===e)return!0;if("false"===e)return!1;if(e===Number(e).toString())return Number(e);if(""===e||"null"===e)return null;if("string"!=typeof e)return e;try{return JSON.parse(decodeURIComponent(e))}catch(t){return e}}function Jt(e){return e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}const Kt={setDataAttribute(e,t,s){e.setAttribute(`data-bs-${Jt(t)}`,s)},removeDataAttribute(e,t){e.removeAttribute(`data-bs-${Jt(t)}`)},getDataAttributes(e){if(!e)return{};const t={},s=Object.keys(e.dataset).filter((e=>e.startsWith("bs")&&!e.startsWith("bsConfig")));for(const i of s){let s=i.replace(/^bs/,"");s=s.charAt(0).toLowerCase()+s.slice(1,s.length),t[s]=Xt(e.dataset[i])}return t},getDataAttribute:(e,t)=>Xt(e.getAttribute(`data-bs-${Jt(t)}`))};class Zt{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(e){return e=this._mergeConfigObj(e),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}_configAfterMerge(e){return e}_mergeConfigObj(e,t){const s=vt(t)?Kt.getDataAttribute(t,"config"):{};return{...this.constructor.Default,..."object"==typeof s?s:{},...vt(t)?Kt.getDataAttributes(t):{},..."object"==typeof e?e:{}}}_typeCheckConfig(e,t=this.constructor.DefaultType){for(const[i,n]of Object.entries(t)){const t=e[i],o=vt(t)?"element":null==(s=t)?`${s}`:Object.prototype.toString.call(s).match(/\s([a-z]+)/i)[1].toLowerCase();if(!new RegExp(n).test(o))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${i}" provided type "${o}" but expected type "${n}".`)}var s}}class Qt extends Zt{constructor(e,t){super(),(e=_t(e))&&(this._element=e,this._config=this._getConfig(t),gt.set(this._element,this.constructor.DATA_KEY,this))}dispose(){gt.remove(this._element,this.constructor.DATA_KEY),Vt.off(this._element,this.constructor.EVENT_KEY);for(const e of Object.getOwnPropertyNames(this))this[e]=null}_queueCallback(e,t,s=!0){It(e,t,s)}_getConfig(e){return e=this._mergeConfigObj(e,this._element),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}static getInstance(e){return gt.get(_t(e),this.DATA_KEY)}static getOrCreateInstance(e,t={}){return this.getInstance(e)||new this(e,"object"==typeof t?t:null)}static get VERSION(){return"5.3.3"}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(e){return`${e}${this.EVENT_KEY}`}}const es=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let s=e.getAttribute("href");if(!s||!s.includes("#")&&!s.startsWith("."))return null;s.includes("#")&&!s.startsWith("#")&&(s=`#${s.split("#")[1]}`),t=s&&"#"!==s?s.trim():null}return t?t.split(",").map((e=>mt(e))).join(","):null},ts={find:(e,t=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(t,e)),findOne:(e,t=document.documentElement)=>Element.prototype.querySelector.call(t,e),children:(e,t)=>[].concat(...e.children).filter((e=>e.matches(t))),parents(e,t){const s=[];let i=e.parentNode.closest(t);for(;i;)s.push(i),i=i.parentNode.closest(t);return s},prev(e,t){let s=e.previousElementSibling;for(;s;){if(s.matches(t))return[s];s=s.previousElementSibling}return[]},next(e,t){let s=e.nextElementSibling;for(;s;){if(s.matches(t))return[s];s=s.nextElementSibling}return[]},focusableChildren(e){const t=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map((e=>`${e}:not([tabindex^="-"])`)).join(",");return this.find(t,e).filter((e=>!wt(e)&&yt(e)))},getSelectorFromElement(e){const t=es(e);return t&&ts.findOne(t)?t:null},getElementFromSelector(e){const t=es(e);return t?ts.findOne(t):null},getMultipleElementsFromSelector(e){const t=es(e);return t?ts.find(t):[]}},ss=(e,t="hide")=>{const s=`click.dismiss${e.EVENT_KEY}`,i=e.NAME;Vt.on(document,s,`[data-bs-dismiss="${i}"]`,(function(s){if(["A","AREA"].includes(this.tagName)&&s.preventDefault(),wt(this))return;const n=ts.getElementFromSelector(this)||this.closest(`.${i}`);e.getOrCreateInstance(n)[t]()}))},is=".bs.alert",ns=`close${is}`,os=`closed${is}`;class rs extends Qt{static get NAME(){return"alert"}close(){if(Vt.trigger(this._element,ns).defaultPrevented)return;this._element.classList.remove("show");const e=this._element.classList.contains("fade");this._queueCallback((()=>this._destroyElement()),this._element,e)}_destroyElement(){this._element.remove(),Vt.trigger(this._element,os),this.dispose()}static jQueryInterface(e){return this.each((function(){const t=rs.getOrCreateInstance(this);if("string"==typeof e){if(void 0===t[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);t[e](this)}}))}}ss(rs,"close"),Tt(rs);const as='[data-bs-toggle="button"]';class ls extends Qt{static get NAME(){return"button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(e){return this.each((function(){const t=ls.getOrCreateInstance(this);"toggle"===e&&t[e]()}))}}Vt.on(document,"click.bs.button.data-api",as,(e=>{e.preventDefault();const t=e.target.closest(as);ls.getOrCreateInstance(t).toggle()})),Tt(ls);const cs=".bs.swipe",ds=`touchstart${cs}`,us=`touchmove${cs}`,hs=`touchend${cs}`,ps=`pointerdown${cs}`,gs=`pointerup${cs}`,fs={endCallback:null,leftCallback:null,rightCallback:null},ms={endCallback:"(function|null)",leftCallback:"(function|null)",rightCallback:"(function|null)"};class bs extends Zt{constructor(e,t){super(),this._element=e,e&&bs.isSupported()&&(this._config=this._getConfig(t),this._deltaX=0,this._supportPointerEvents=Boolean(window.PointerEvent),this._initEvents())}static get Default(){return fs}static get DefaultType(){return ms}static get NAME(){return"swipe"}dispose(){Vt.off(this._element,cs)}_start(e){this._supportPointerEvents?this._eventIsPointerPenTouch(e)&&(this._deltaX=e.clientX):this._deltaX=e.touches[0].clientX}_end(e){this._eventIsPointerPenTouch(e)&&(this._deltaX=e.clientX-this._deltaX),this._handleSwipe(),Ct(this._config.endCallback)}_move(e){this._deltaX=e.touches&&e.touches.length>1?0:e.touches[0].clientX-this._deltaX}_handleSwipe(){const e=Math.abs(this._deltaX);if(e<=40)return;const t=e/this._deltaX;this._deltaX=0,t&&Ct(t>0?this._config.rightCallback:this._config.leftCallback)}_initEvents(){this._supportPointerEvents?(Vt.on(this._element,ps,(e=>this._start(e))),Vt.on(this._element,gs,(e=>this._end(e))),this._element.classList.add("pointer-event")):(Vt.on(this._element,ds,(e=>this._start(e))),Vt.on(this._element,us,(e=>this._move(e))),Vt.on(this._element,hs,(e=>this._end(e))))}_eventIsPointerPenTouch(e){return this._supportPointerEvents&&("pen"===e.pointerType||"touch"===e.pointerType)}static isSupported(){return"ontouchstart"in document.documentElement||navigator.maxTouchPoints>0}}const vs=".bs.carousel",_s=".data-api",ys="next",ws="prev",Es="left",As="right",Ss=`slide${vs}`,Ls=`slid${vs}`,Os=`keydown${vs}`,xs=`mouseenter${vs}`,Ts=`mouseleave${vs}`,Cs=`dragstart${vs}`,Is=`load${vs}${_s}`,Ns=`click${vs}${_s}`,ks="carousel",Ds="active",$s=".active",Rs=".carousel-item",Ms=$s+Rs,Ps={ArrowLeft:As,ArrowRight:Es},Bs={interval:5e3,keyboard:!0,pause:"hover",ride:!1,touch:!0,wrap:!0},Hs={interval:"(number|boolean)",keyboard:"boolean",pause:"(string|boolean)",ride:"(boolean|string)",touch:"boolean",wrap:"boolean"};class qs extends Qt{constructor(e,t){super(e,t),this._interval=null,this._activeElement=null,this._isSliding=!1,this.touchTimeout=null,this._swipeHelper=null,this._indicatorsElement=ts.findOne(".carousel-indicators",this._element),this._addEventListeners(),this._config.ride===ks&&this.cycle()}static get Default(){return Bs}static get DefaultType(){return Hs}static get NAME(){return"carousel"}next(){this._slide(ys)}nextWhenVisible(){!document.hidden&&yt(this._element)&&this.next()}prev(){this._slide(ws)}pause(){this._isSliding&&bt(this._element),this._clearInterval()}cycle(){this._clearInterval(),this._updateInterval(),this._interval=setInterval((()=>this.nextWhenVisible()),this._config.interval)}_maybeEnableCycle(){this._config.ride&&(this._isSliding?Vt.one(this._element,Ls,(()=>this.cycle())):this.cycle())}to(e){const t=this._getItems();if(e>t.length-1||e<0)return;if(this._isSliding)return void Vt.one(this._element,Ls,(()=>this.to(e)));const s=this._getItemIndex(this._getActive());if(s===e)return;const i=e>s?ys:ws;this._slide(i,t[e])}dispose(){this._swipeHelper&&this._swipeHelper.dispose(),super.dispose()}_configAfterMerge(e){return e.defaultInterval=e.interval,e}_addEventListeners(){this._config.keyboard&&Vt.on(this._element,Os,(e=>this._keydown(e))),"hover"===this._config.pause&&(Vt.on(this._element,xs,(()=>this.pause())),Vt.on(this._element,Ts,(()=>this._maybeEnableCycle()))),this._config.touch&&bs.isSupported()&&this._addTouchEventListeners()}_addTouchEventListeners(){for(const e of ts.find(".carousel-item img",this._element))Vt.on(e,Cs,(e=>e.preventDefault()));const e={leftCallback:()=>this._slide(this._directionToOrder(Es)),rightCallback:()=>this._slide(this._directionToOrder(As)),endCallback:()=>{"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout((()=>this._maybeEnableCycle()),500+this._config.interval))}};this._swipeHelper=new bs(this._element,e)}_keydown(e){if(/input|textarea/i.test(e.target.tagName))return;const t=Ps[e.key];t&&(e.preventDefault(),this._slide(this._directionToOrder(t)))}_getItemIndex(e){return this._getItems().indexOf(e)}_setActiveIndicatorElement(e){if(!this._indicatorsElement)return;const t=ts.findOne($s,this._indicatorsElement);t.classList.remove(Ds),t.removeAttribute("aria-current");const s=ts.findOne(`[data-bs-slide-to="${e}"]`,this._indicatorsElement);s&&(s.classList.add(Ds),s.setAttribute("aria-current","true"))}_updateInterval(){const e=this._activeElement||this._getActive();if(!e)return;const t=Number.parseInt(e.getAttribute("data-bs-interval"),10);this._config.interval=t||this._config.defaultInterval}_slide(e,t=null){if(this._isSliding)return;const s=this._getActive(),i=e===ys,n=t||Nt(this._getItems(),s,i,this._config.wrap);if(n===s)return;const o=this._getItemIndex(n),r=t=>Vt.trigger(this._element,t,{relatedTarget:n,direction:this._orderToDirection(e),from:this._getItemIndex(s),to:o});if(r(Ss).defaultPrevented)return;if(!s||!n)return;const a=Boolean(this._interval);this.pause(),this._isSliding=!0,this._setActiveIndicatorElement(o),this._activeElement=n;const l=i?"carousel-item-start":"carousel-item-end",c=i?"carousel-item-next":"carousel-item-prev";n.classList.add(c),St(n),s.classList.add(l),n.classList.add(l);this._queueCallback((()=>{n.classList.remove(l,c),n.classList.add(Ds),s.classList.remove(Ds,c,l),this._isSliding=!1,r(Ls)}),s,this._isAnimated()),a&&this.cycle()}_isAnimated(){return this._element.classList.contains("slide")}_getActive(){return ts.findOne(Ms,this._element)}_getItems(){return ts.find(Rs,this._element)}_clearInterval(){this._interval&&(clearInterval(this._interval),this._interval=null)}_directionToOrder(e){return xt()?e===Es?ws:ys:e===Es?ys:ws}_orderToDirection(e){return xt()?e===ws?Es:As:e===ws?As:Es}static jQueryInterface(e){return this.each((function(){const t=qs.getOrCreateInstance(this,e);if("number"!=typeof e){if("string"==typeof e){if(void 0===t[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);t[e]()}}else t.to(e)}))}}Vt.on(document,Ns,"[data-bs-slide], [data-bs-slide-to]",(function(e){const t=ts.getElementFromSelector(this);if(!t||!t.classList.contains(ks))return;e.preventDefault();const s=qs.getOrCreateInstance(t),i=this.getAttribute("data-bs-slide-to");return i?(s.to(i),void s._maybeEnableCycle()):"next"===Kt.getDataAttribute(this,"slide")?(s.next(),void s._maybeEnableCycle()):(s.prev(),void s._maybeEnableCycle())})),Vt.on(window,Is,(()=>{const e=ts.find('[data-bs-ride="carousel"]');for(const t of e)qs.getOrCreateInstance(t)})),Tt(qs);const js=".bs.collapse",Fs=`show${js}`,Ws=`shown${js}`,zs=`hide${js}`,Us=`hidden${js}`,Gs=`click${js}.data-api`,Vs="show",Ys="collapse",Xs="collapsing",Js=`:scope .${Ys} .${Ys}`,Ks='[data-bs-toggle="collapse"]',Zs={parent:null,toggle:!0},Qs={parent:"(null|element)",toggle:"boolean"};let ei=class e extends Qt{constructor(e,t){super(e,t),this._isTransitioning=!1,this._triggerArray=[];const s=ts.find(Ks);for(const e of s){const t=ts.getSelectorFromElement(e),s=ts.find(t).filter((e=>e===this._element));null!==t&&s.length&&this._triggerArray.push(e)}this._initializeChildren(),this._config.parent||this._addAriaAndCollapsedClass(this._triggerArray,this._isShown()),this._config.toggle&&this.toggle()}static get Default(){return Zs}static get DefaultType(){return Qs}static get NAME(){return"collapse"}toggle(){this._isShown()?this.hide():this.show()}show(){if(this._isTransitioning||this._isShown())return;let t=[];if(this._config.parent&&(t=this._getFirstLevelChildren(".collapse.show, .collapse.collapsing").filter((e=>e!==this._element)).map((t=>e.getOrCreateInstance(t,{toggle:!1})))),t.length&&t[0]._isTransitioning)return;if(Vt.trigger(this._element,Fs).defaultPrevented)return;for(const e of t)e.hide();const s=this._getDimension();this._element.classList.remove(Ys),this._element.classList.add(Xs),this._element.style[s]=0,this._addAriaAndCollapsedClass(this._triggerArray,!0),this._isTransitioning=!0;const i=`scroll${s[0].toUpperCase()+s.slice(1)}`;this._queueCallback((()=>{this._isTransitioning=!1,this._element.classList.remove(Xs),this._element.classList.add(Ys,Vs),this._element.style[s]="",Vt.trigger(this._element,Ws)}),this._element,!0),this._element.style[s]=`${this._element[i]}px`}hide(){if(this._isTransitioning||!this._isShown())return;if(Vt.trigger(this._element,zs).defaultPrevented)return;const e=this._getDimension();this._element.style[e]=`${this._element.getBoundingClientRect()[e]}px`,St(this._element),this._element.classList.add(Xs),this._element.classList.remove(Ys,Vs);for(const e of this._triggerArray){const t=ts.getElementFromSelector(e);t&&!this._isShown(t)&&this._addAriaAndCollapsedClass([e],!1)}this._isTransitioning=!0;this._element.style[e]="",this._queueCallback((()=>{this._isTransitioning=!1,this._element.classList.remove(Xs),this._element.classList.add(Ys),Vt.trigger(this._element,Us)}),this._element,!0)}_isShown(e=this._element){return e.classList.contains(Vs)}_configAfterMerge(e){return e.toggle=Boolean(e.toggle),e.parent=_t(e.parent),e}_getDimension(){return this._element.classList.contains("collapse-horizontal")?"width":"height"}_initializeChildren(){if(!this._config.parent)return;const e=this._getFirstLevelChildren(Ks);for(const t of e){const e=ts.getElementFromSelector(t);e&&this._addAriaAndCollapsedClass([t],this._isShown(e))}}_getFirstLevelChildren(e){const t=ts.find(Js,this._config.parent);return ts.find(e,this._config.parent).filter((e=>!t.includes(e)))}_addAriaAndCollapsedClass(e,t){if(e.length)for(const s of e)s.classList.toggle("collapsed",!t),s.setAttribute("aria-expanded",t)}static jQueryInterface(t){const s={};return"string"==typeof t&&/show|hide/.test(t)&&(s.toggle=!1),this.each((function(){const i=e.getOrCreateInstance(this,s);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t]()}}))}};Vt.on(document,Gs,Ks,(function(e){("A"===e.target.tagName||e.delegateTarget&&"A"===e.delegateTarget.tagName)&&e.preventDefault();for(const e of ts.getMultipleElementsFromSelector(this))ei.getOrCreateInstance(e,{toggle:!1}).toggle()})),Tt(ei);const ti="dropdown",si=".bs.dropdown",ii=".data-api",ni="ArrowUp",oi="ArrowDown",ri=`hide${si}`,ai=`hidden${si}`,li=`show${si}`,ci=`shown${si}`,di=`click${si}${ii}`,ui=`keydown${si}${ii}`,hi=`keyup${si}${ii}`,pi="show",gi='[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)',fi=`${gi}.${pi}`,mi=".dropdown-menu",bi=xt()?"top-end":"top-start",vi=xt()?"top-start":"top-end",_i=xt()?"bottom-end":"bottom-start",yi=xt()?"bottom-start":"bottom-end",wi=xt()?"left-start":"right-start",Ei=xt()?"right-start":"left-start",Ai={autoClose:!0,boundary:"clippingParents",display:"dynamic",offset:[0,2],popperConfig:null,reference:"toggle"},Si={autoClose:"(boolean|string)",boundary:"(string|element)",display:"string",offset:"(array|string|function)",popperConfig:"(null|object|function)",reference:"(string|element|object)"};class Li extends Qt{constructor(e,t){super(e,t),this._popper=null,this._parent=this._element.parentNode,this._menu=ts.next(this._element,mi)[0]||ts.prev(this._element,mi)[0]||ts.findOne(mi,this._parent),this._inNavbar=this._detectNavbar()}static get Default(){return Ai}static get DefaultType(){return Si}static get NAME(){return ti}toggle(){return this._isShown()?this.hide():this.show()}show(){if(wt(this._element)||this._isShown())return;const e={relatedTarget:this._element};if(!Vt.trigger(this._element,li,e).defaultPrevented){if(this._createPopper(),"ontouchstart"in document.documentElement&&!this._parent.closest(".navbar-nav"))for(const e of[].concat(...document.body.children))Vt.on(e,"mouseover",At);this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.add(pi),this._element.classList.add(pi),Vt.trigger(this._element,ci,e)}}hide(){if(wt(this._element)||!this._isShown())return;const e={relatedTarget:this._element};this._completeHide(e)}dispose(){this._popper&&this._popper.destroy(),super.dispose()}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_completeHide(e){if(!Vt.trigger(this._element,ri,e).defaultPrevented){if("ontouchstart"in document.documentElement)for(const e of[].concat(...document.body.children))Vt.off(e,"mouseover",At);this._popper&&this._popper.destroy(),this._menu.classList.remove(pi),this._element.classList.remove(pi),this._element.setAttribute("aria-expanded","false"),Kt.removeDataAttribute(this._menu,"popper"),Vt.trigger(this._element,ai,e)}}_getConfig(e){if("object"==typeof(e=super._getConfig(e)).reference&&!vt(e.reference)&&"function"!=typeof e.reference.getBoundingClientRect)throw new TypeError(`${ti.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);return e}_createPopper(){if(void 0===Be)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");let e=this._element;"parent"===this._config.reference?e=this._parent:vt(this._config.reference)?e=_t(this._config.reference):"object"==typeof this._config.reference&&(e=this._config.reference);const t=this._getPopperConfig();this._popper=Pe(e,this._menu,t)}_isShown(){return this._menu.classList.contains(pi)}_getPlacement(){const e=this._parent;if(e.classList.contains("dropend"))return wi;if(e.classList.contains("dropstart"))return Ei;if(e.classList.contains("dropup-center"))return"top";if(e.classList.contains("dropdown-center"))return"bottom";const t="end"===getComputedStyle(this._menu).getPropertyValue("--bs-position").trim();return e.classList.contains("dropup")?t?vi:bi:t?yi:_i}_detectNavbar(){return null!==this._element.closest(".navbar")}_getOffset(){const{offset:e}=this._config;return"string"==typeof e?e.split(",").map((e=>Number.parseInt(e,10))):"function"==typeof e?t=>e(t,this._element):e}_getPopperConfig(){const e={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return(this._inNavbar||"static"===this._config.display)&&(Kt.setDataAttribute(this._menu,"popper","static"),e.modifiers=[{name:"applyStyles",enabled:!1}]),{...e,...Ct(this._config.popperConfig,[e])}}_selectMenuItem({key:e,target:t}){const s=ts.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",this._menu).filter((e=>yt(e)));s.length&&Nt(s,t,e===oi,!s.includes(t)).focus()}static jQueryInterface(e){return this.each((function(){const t=Li.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e])throw new TypeError(`No method named "${e}"`);t[e]()}}))}static clearMenus(e){if(2===e.button||"keyup"===e.type&&"Tab"!==e.key)return;const t=ts.find(fi);for(const s of t){const t=Li.getInstance(s);if(!t||!1===t._config.autoClose)continue;const i=e.composedPath(),n=i.includes(t._menu);if(i.includes(t._element)||"inside"===t._config.autoClose&&!n||"outside"===t._config.autoClose&&n)continue;if(t._menu.contains(e.target)&&("keyup"===e.type&&"Tab"===e.key||/input|select|option|textarea|form/i.test(e.target.tagName)))continue;const o={relatedTarget:t._element};"click"===e.type&&(o.clickEvent=e),t._completeHide(o)}}static dataApiKeydownHandler(e){const t=/input|textarea/i.test(e.target.tagName),s="Escape"===e.key,i=[ni,oi].includes(e.key);if(!i&&!s)return;if(t&&!s)return;e.preventDefault();const n=this.matches(gi)?this:ts.prev(this,gi)[0]||ts.next(this,gi)[0]||ts.findOne(gi,e.delegateTarget.parentNode),o=Li.getOrCreateInstance(n);if(i)return e.stopPropagation(),o.show(),void o._selectMenuItem(e);o._isShown()&&(e.stopPropagation(),o.hide(),n.focus())}}Vt.on(document,ui,gi,Li.dataApiKeydownHandler),Vt.on(document,ui,mi,Li.dataApiKeydownHandler),Vt.on(document,di,Li.clearMenus),Vt.on(document,hi,Li.clearMenus),Vt.on(document,di,gi,(function(e){e.preventDefault(),Li.getOrCreateInstance(this).toggle()})),Tt(Li);const Oi="backdrop",xi="show",Ti=`mousedown.bs.${Oi}`,Ci={className:"modal-backdrop",clickCallback:null,isAnimated:!1,isVisible:!0,rootElement:"body"},Ii={className:"string",clickCallback:"(function|null)",isAnimated:"boolean",isVisible:"boolean",rootElement:"(element|string)"};class Ni extends Zt{constructor(e){super(),this._config=this._getConfig(e),this._isAppended=!1,this._element=null}static get Default(){return Ci}static get DefaultType(){return Ii}static get NAME(){return Oi}show(e){if(!this._config.isVisible)return void Ct(e);this._append();const t=this._getElement();this._config.isAnimated&&St(t),t.classList.add(xi),this._emulateAnimation((()=>{Ct(e)}))}hide(e){this._config.isVisible?(this._getElement().classList.remove(xi),this._emulateAnimation((()=>{this.dispose(),Ct(e)}))):Ct(e)}dispose(){this._isAppended&&(Vt.off(this._element,Ti),this._element.remove(),this._isAppended=!1)}_getElement(){if(!this._element){const e=document.createElement("div");e.className=this._config.className,this._config.isAnimated&&e.classList.add("fade"),this._element=e}return this._element}_configAfterMerge(e){return e.rootElement=_t(e.rootElement),e}_append(){if(this._isAppended)return;const e=this._getElement();this._config.rootElement.append(e),Vt.on(e,Ti,(()=>{Ct(this._config.clickCallback)})),this._isAppended=!0}_emulateAnimation(e){It(e,this._getElement(),this._config.isAnimated)}}const ki=".bs.focustrap",Di=`focusin${ki}`,$i=`keydown.tab${ki}`,Ri="backward",Mi={autofocus:!0,trapElement:null},Pi={autofocus:"boolean",trapElement:"element"};class Bi extends Zt{constructor(e){super(),this._config=this._getConfig(e),this._isActive=!1,this._lastTabNavDirection=null}static get Default(){return Mi}static get DefaultType(){return Pi}static get NAME(){return"focustrap"}activate(){this._isActive||(this._config.autofocus&&this._config.trapElement.focus(),Vt.off(document,ki),Vt.on(document,Di,(e=>this._handleFocusin(e))),Vt.on(document,$i,(e=>this._handleKeydown(e))),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,Vt.off(document,ki))}_handleFocusin(e){const{trapElement:t}=this._config;if(e.target===document||e.target===t||t.contains(e.target))return;const s=ts.focusableChildren(t);0===s.length?t.focus():this._lastTabNavDirection===Ri?s[s.length-1].focus():s[0].focus()}_handleKeydown(e){"Tab"===e.key&&(this._lastTabNavDirection=e.shiftKey?Ri:"forward")}}const Hi=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",qi=".sticky-top",ji="padding-right",Fi="margin-right";class Wi{constructor(){this._element=document.body}getWidth(){const e=document.documentElement.clientWidth;return Math.abs(window.innerWidth-e)}hide(){const e=this.getWidth();this._disableOverFlow(),this._setElementAttributes(this._element,ji,(t=>t+e)),this._setElementAttributes(Hi,ji,(t=>t+e)),this._setElementAttributes(qi,Fi,(t=>t-e))}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,ji),this._resetElementAttributes(Hi,ji),this._resetElementAttributes(qi,Fi)}isOverflowing(){return this.getWidth()>0}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(e,t,s){const i=this.getWidth();this._applyManipulationCallback(e,(e=>{if(e!==this._element&&window.innerWidth>e.clientWidth+i)return;this._saveInitialAttribute(e,t);const n=window.getComputedStyle(e).getPropertyValue(t);e.style.setProperty(t,`${s(Number.parseFloat(n))}px`)}))}_saveInitialAttribute(e,t){const s=e.style.getPropertyValue(t);s&&Kt.setDataAttribute(e,t,s)}_resetElementAttributes(e,t){this._applyManipulationCallback(e,(e=>{const s=Kt.getDataAttribute(e,t);null!==s?(Kt.removeDataAttribute(e,t),e.style.setProperty(t,s)):e.style.removeProperty(t)}))}_applyManipulationCallback(e,t){if(vt(e))t(e);else for(const s of ts.find(e,this._element))t(s)}}const zi=".bs.modal",Ui=`hide${zi}`,Gi=`hidePrevented${zi}`,Vi=`hidden${zi}`,Yi=`show${zi}`,Xi=`shown${zi}`,Ji=`resize${zi}`,Ki=`click.dismiss${zi}`,Zi=`mousedown.dismiss${zi}`,Qi=`keydown.dismiss${zi}`,en=`click${zi}.data-api`,tn="modal-open",sn="show",nn="modal-static",on={backdrop:!0,focus:!0,keyboard:!0},rn={backdrop:"(boolean|string)",focus:"boolean",keyboard:"boolean"};class an extends Qt{constructor(e,t){super(e,t),this._dialog=ts.findOne(".modal-dialog",this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._isTransitioning=!1,this._scrollBar=new Wi,this._addEventListeners()}static get Default(){return on}static get DefaultType(){return rn}static get NAME(){return"modal"}toggle(e){return this._isShown?this.hide():this.show(e)}show(e){if(this._isShown||this._isTransitioning)return;Vt.trigger(this._element,Yi,{relatedTarget:e}).defaultPrevented||(this._isShown=!0,this._isTransitioning=!0,this._scrollBar.hide(),document.body.classList.add(tn),this._adjustDialog(),this._backdrop.show((()=>this._showElement(e))))}hide(){if(!this._isShown||this._isTransitioning)return;Vt.trigger(this._element,Ui).defaultPrevented||(this._isShown=!1,this._isTransitioning=!0,this._focustrap.deactivate(),this._element.classList.remove(sn),this._queueCallback((()=>this._hideModal()),this._element,this._isAnimated()))}dispose(){Vt.off(window,zi),Vt.off(this._dialog,zi),this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new Ni({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new Bi({trapElement:this._element})}_showElement(e){document.body.contains(this._element)||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0;const t=ts.findOne(".modal-body",this._dialog);t&&(t.scrollTop=0),St(this._element),this._element.classList.add(sn);this._queueCallback((()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,Vt.trigger(this._element,Xi,{relatedTarget:e})}),this._dialog,this._isAnimated())}_addEventListeners(){Vt.on(this._element,Qi,(e=>{"Escape"===e.key&&(this._config.keyboard?this.hide():this._triggerBackdropTransition())})),Vt.on(window,Ji,(()=>{this._isShown&&!this._isTransitioning&&this._adjustDialog()})),Vt.on(this._element,Zi,(e=>{Vt.one(this._element,Ki,(t=>{this._element===e.target&&this._element===t.target&&("static"!==this._config.backdrop?this._config.backdrop&&this.hide():this._triggerBackdropTransition())}))}))}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide((()=>{document.body.classList.remove(tn),this._resetAdjustments(),this._scrollBar.reset(),Vt.trigger(this._element,Vi)}))}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(Vt.trigger(this._element,Gi).defaultPrevented)return;const e=this._element.scrollHeight>document.documentElement.clientHeight,t=this._element.style.overflowY;"hidden"===t||this._element.classList.contains(nn)||(e||(this._element.style.overflowY="hidden"),this._element.classList.add(nn),this._queueCallback((()=>{this._element.classList.remove(nn),this._queueCallback((()=>{this._element.style.overflowY=t}),this._dialog)}),this._dialog),this._element.focus())}_adjustDialog(){const e=this._element.scrollHeight>document.documentElement.clientHeight,t=this._scrollBar.getWidth(),s=t>0;if(s&&!e){const e=xt()?"paddingLeft":"paddingRight";this._element.style[e]=`${t}px`}if(!s&&e){const e=xt()?"paddingRight":"paddingLeft";this._element.style[e]=`${t}px`}}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(e,t){return this.each((function(){const s=an.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===s[e])throw new TypeError(`No method named "${e}"`);s[e](t)}}))}}Vt.on(document,en,'[data-bs-toggle="modal"]',(function(e){const t=ts.getElementFromSelector(this);["A","AREA"].includes(this.tagName)&&e.preventDefault(),Vt.one(t,Yi,(e=>{e.defaultPrevented||Vt.one(t,Vi,(()=>{yt(this)&&this.focus()}))}));const s=ts.findOne(".modal.show");s&&an.getInstance(s).hide();an.getOrCreateInstance(t).toggle(this)})),ss(an),Tt(an);const ln=".bs.offcanvas",cn=".data-api",dn=`load${ln}${cn}`,un="show",hn="showing",pn="hiding",gn=".offcanvas.show",fn=`show${ln}`,mn=`shown${ln}`,bn=`hide${ln}`,vn=`hidePrevented${ln}`,_n=`hidden${ln}`,yn=`resize${ln}`,wn=`click${ln}${cn}`,En=`keydown.dismiss${ln}`,An={backdrop:!0,keyboard:!0,scroll:!1},Sn={backdrop:"(boolean|string)",keyboard:"boolean",scroll:"boolean"};class Ln extends Qt{constructor(e,t){super(e,t),this._isShown=!1,this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._addEventListeners()}static get Default(){return An}static get DefaultType(){return Sn}static get NAME(){return"offcanvas"}toggle(e){return this._isShown?this.hide():this.show(e)}show(e){if(this._isShown)return;if(Vt.trigger(this._element,fn,{relatedTarget:e}).defaultPrevented)return;this._isShown=!0,this._backdrop.show(),this._config.scroll||(new Wi).hide(),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add(hn);this._queueCallback((()=>{this._config.scroll&&!this._config.backdrop||this._focustrap.activate(),this._element.classList.add(un),this._element.classList.remove(hn),Vt.trigger(this._element,mn,{relatedTarget:e})}),this._element,!0)}hide(){if(!this._isShown)return;if(Vt.trigger(this._element,bn).defaultPrevented)return;this._focustrap.deactivate(),this._element.blur(),this._isShown=!1,this._element.classList.add(pn),this._backdrop.hide();this._queueCallback((()=>{this._element.classList.remove(un,pn),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._config.scroll||(new Wi).reset(),Vt.trigger(this._element,_n)}),this._element,!0)}dispose(){this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}_initializeBackDrop(){const e=Boolean(this._config.backdrop);return new Ni({className:"offcanvas-backdrop",isVisible:e,isAnimated:!0,rootElement:this._element.parentNode,clickCallback:e?()=>{"static"!==this._config.backdrop?this.hide():Vt.trigger(this._element,vn)}:null})}_initializeFocusTrap(){return new Bi({trapElement:this._element})}_addEventListeners(){Vt.on(this._element,En,(e=>{"Escape"===e.key&&(this._config.keyboard?this.hide():Vt.trigger(this._element,vn))}))}static jQueryInterface(e){return this.each((function(){const t=Ln.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);t[e](this)}}))}}Vt.on(document,wn,'[data-bs-toggle="offcanvas"]',(function(e){const t=ts.getElementFromSelector(this);if(["A","AREA"].includes(this.tagName)&&e.preventDefault(),wt(this))return;Vt.one(t,_n,(()=>{yt(this)&&this.focus()}));const s=ts.findOne(gn);s&&s!==t&&Ln.getInstance(s).hide();Ln.getOrCreateInstance(t).toggle(this)})),Vt.on(window,dn,(()=>{for(const e of ts.find(gn))Ln.getOrCreateInstance(e).show()})),Vt.on(window,yn,(()=>{for(const e of ts.find("[aria-modal][class*=show][class*=offcanvas-]"))"fixed"!==getComputedStyle(e).position&&Ln.getOrCreateInstance(e).hide()})),ss(Ln),Tt(Ln);const On={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],dd:[],div:[],dl:[],dt:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},xn=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),Tn=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i,Cn=(e,t)=>{const s=e.nodeName.toLowerCase();return t.includes(s)?!xn.has(s)||Boolean(Tn.test(e.nodeValue)):t.filter((e=>e instanceof RegExp)).some((e=>e.test(s)))};const In={allowList:On,content:{},extraClass:"",html:!1,sanitize:!0,sanitizeFn:null,template:"
    "},Nn={allowList:"object",content:"object",extraClass:"(string|function)",html:"boolean",sanitize:"boolean",sanitizeFn:"(null|function)",template:"string"},kn={entry:"(string|element|function|null)",selector:"(string|element)"};class Dn extends Zt{constructor(e){super(),this._config=this._getConfig(e)}static get Default(){return In}static get DefaultType(){return Nn}static get NAME(){return"TemplateFactory"}getContent(){return Object.values(this._config.content).map((e=>this._resolvePossibleFunction(e))).filter(Boolean)}hasContent(){return this.getContent().length>0}changeContent(e){return this._checkContent(e),this._config.content={...this._config.content,...e},this}toHtml(){const e=document.createElement("div");e.innerHTML=this._maybeSanitize(this._config.template);for(const[t,s]of Object.entries(this._config.content))this._setContent(e,s,t);const t=e.children[0],s=this._resolvePossibleFunction(this._config.extraClass);return s&&t.classList.add(...s.split(" ")),t}_typeCheckConfig(e){super._typeCheckConfig(e),this._checkContent(e.content)}_checkContent(e){for(const[t,s]of Object.entries(e))super._typeCheckConfig({selector:t,entry:s},kn)}_setContent(e,t,s){const i=ts.findOne(s,e);i&&((t=this._resolvePossibleFunction(t))?vt(t)?this._putElementInTemplate(_t(t),i):this._config.html?i.innerHTML=this._maybeSanitize(t):i.textContent=t:i.remove())}_maybeSanitize(e){return this._config.sanitize?function(e,t,s){if(!e.length)return e;if(s&&"function"==typeof s)return s(e);const i=(new window.DOMParser).parseFromString(e,"text/html"),n=[].concat(...i.body.querySelectorAll("*"));for(const e of n){const s=e.nodeName.toLowerCase();if(!Object.keys(t).includes(s)){e.remove();continue}const i=[].concat(...e.attributes),n=[].concat(t["*"]||[],t[s]||[]);for(const t of i)Cn(t,n)||e.removeAttribute(t.nodeName)}return i.body.innerHTML}(e,this._config.allowList,this._config.sanitizeFn):e}_resolvePossibleFunction(e){return Ct(e,[this])}_putElementInTemplate(e,t){if(this._config.html)return t.innerHTML="",void t.append(e);t.textContent=e.textContent}}const $n=new Set(["sanitize","allowList","sanitizeFn"]),Rn="fade",Mn="show",Pn=".modal",Bn="hide.bs.modal",Hn="hover",qn="focus",jn={AUTO:"auto",TOP:"top",RIGHT:xt()?"left":"right",BOTTOM:"bottom",LEFT:xt()?"right":"left"},Fn={allowList:On,animation:!0,boundary:"clippingParents",container:!1,customClass:"",delay:0,fallbackPlacements:["top","right","bottom","left"],html:!1,offset:[0,6],placement:"top",popperConfig:null,sanitize:!0,sanitizeFn:null,selector:!1,template:'',title:"",trigger:"hover focus"},Wn={allowList:"object",animation:"boolean",boundary:"(string|element)",container:"(string|element|boolean)",customClass:"(string|function)",delay:"(number|object)",fallbackPlacements:"array",html:"boolean",offset:"(array|string|function)",placement:"(string|function)",popperConfig:"(null|object|function)",sanitize:"boolean",sanitizeFn:"(null|function)",selector:"(string|boolean)",template:"string",title:"(string|element|function)",trigger:"string"};class zn extends Qt{constructor(e,t){if(void 0===Be)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");super(e,t),this._isEnabled=!0,this._timeout=0,this._isHovered=null,this._activeTrigger={},this._popper=null,this._templateFactory=null,this._newContent=null,this.tip=null,this._setListeners(),this._config.selector||this._fixTitle()}static get Default(){return Fn}static get DefaultType(){return Wn}static get NAME(){return"tooltip"}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(){this._isEnabled&&(this._activeTrigger.click=!this._activeTrigger.click,this._isShown()?this._leave():this._enter())}dispose(){clearTimeout(this._timeout),Vt.off(this._element.closest(Pn),Bn,this._hideModalHandler),this._element.getAttribute("data-bs-original-title")&&this._element.setAttribute("title",this._element.getAttribute("data-bs-original-title")),this._disposePopper(),super.dispose()}show(){if("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this._isWithContent()||!this._isEnabled)return;const e=Vt.trigger(this._element,this.constructor.eventName("show")),t=(Et(this._element)||this._element.ownerDocument.documentElement).contains(this._element);if(e.defaultPrevented||!t)return;this._disposePopper();const s=this._getTipElement();this._element.setAttribute("aria-describedby",s.getAttribute("id"));const{container:i}=this._config;if(this._element.ownerDocument.documentElement.contains(this.tip)||(i.append(s),Vt.trigger(this._element,this.constructor.eventName("inserted"))),this._popper=this._createPopper(s),s.classList.add(Mn),"ontouchstart"in document.documentElement)for(const e of[].concat(...document.body.children))Vt.on(e,"mouseover",At);this._queueCallback((()=>{Vt.trigger(this._element,this.constructor.eventName("shown")),!1===this._isHovered&&this._leave(),this._isHovered=!1}),this.tip,this._isAnimated())}hide(){if(!this._isShown())return;if(Vt.trigger(this._element,this.constructor.eventName("hide")).defaultPrevented)return;if(this._getTipElement().classList.remove(Mn),"ontouchstart"in document.documentElement)for(const e of[].concat(...document.body.children))Vt.off(e,"mouseover",At);this._activeTrigger.click=!1,this._activeTrigger[qn]=!1,this._activeTrigger[Hn]=!1,this._isHovered=null;this._queueCallback((()=>{this._isWithActiveTrigger()||(this._isHovered||this._disposePopper(),this._element.removeAttribute("aria-describedby"),Vt.trigger(this._element,this.constructor.eventName("hidden")))}),this.tip,this._isAnimated())}update(){this._popper&&this._popper.update()}_isWithContent(){return Boolean(this._getTitle())}_getTipElement(){return this.tip||(this.tip=this._createTipElement(this._newContent||this._getContentForTemplate())),this.tip}_createTipElement(e){const t=this._getTemplateFactory(e).toHtml();if(!t)return null;t.classList.remove(Rn,Mn),t.classList.add(`bs-${this.constructor.NAME}-auto`);const s=(e=>{do{e+=Math.floor(1e6*Math.random())}while(document.getElementById(e));return e})(this.constructor.NAME).toString();return t.setAttribute("id",s),this._isAnimated()&&t.classList.add(Rn),t}setContent(e){this._newContent=e,this._isShown()&&(this._disposePopper(),this.show())}_getTemplateFactory(e){return this._templateFactory?this._templateFactory.changeContent(e):this._templateFactory=new Dn({...this._config,content:e,extraClass:this._resolvePossibleFunction(this._config.customClass)}),this._templateFactory}_getContentForTemplate(){return{".tooltip-inner":this._getTitle()}}_getTitle(){return this._resolvePossibleFunction(this._config.title)||this._element.getAttribute("data-bs-original-title")}_initializeOnDelegatedTarget(e){return this.constructor.getOrCreateInstance(e.delegateTarget,this._getDelegateConfig())}_isAnimated(){return this._config.animation||this.tip&&this.tip.classList.contains(Rn)}_isShown(){return this.tip&&this.tip.classList.contains(Mn)}_createPopper(e){const t=Ct(this._config.placement,[this,e,this._element]),s=jn[t.toUpperCase()];return Pe(this._element,e,this._getPopperConfig(s))}_getOffset(){const{offset:e}=this._config;return"string"==typeof e?e.split(",").map((e=>Number.parseInt(e,10))):"function"==typeof e?t=>e(t,this._element):e}_resolvePossibleFunction(e){return Ct(e,[this._element])}_getPopperConfig(e){const t={placement:e,modifiers:[{name:"flip",options:{fallbackPlacements:this._config.fallbackPlacements}},{name:"offset",options:{offset:this._getOffset()}},{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"arrow",options:{element:`.${this.constructor.NAME}-arrow`}},{name:"preSetPlacement",enabled:!0,phase:"beforeMain",fn:e=>{this._getTipElement().setAttribute("data-popper-placement",e.state.placement)}}]};return{...t,...Ct(this._config.popperConfig,[t])}}_setListeners(){const e=this._config.trigger.split(" ");for(const t of e)if("click"===t)Vt.on(this._element,this.constructor.eventName("click"),this._config.selector,(e=>{this._initializeOnDelegatedTarget(e).toggle()}));else if("manual"!==t){const e=t===Hn?this.constructor.eventName("mouseenter"):this.constructor.eventName("focusin"),s=t===Hn?this.constructor.eventName("mouseleave"):this.constructor.eventName("focusout");Vt.on(this._element,e,this._config.selector,(e=>{const t=this._initializeOnDelegatedTarget(e);t._activeTrigger["focusin"===e.type?qn:Hn]=!0,t._enter()})),Vt.on(this._element,s,this._config.selector,(e=>{const t=this._initializeOnDelegatedTarget(e);t._activeTrigger["focusout"===e.type?qn:Hn]=t._element.contains(e.relatedTarget),t._leave()}))}this._hideModalHandler=()=>{this._element&&this.hide()},Vt.on(this._element.closest(Pn),Bn,this._hideModalHandler)}_fixTitle(){const e=this._element.getAttribute("title");e&&(this._element.getAttribute("aria-label")||this._element.textContent.trim()||this._element.setAttribute("aria-label",e),this._element.setAttribute("data-bs-original-title",e),this._element.removeAttribute("title"))}_enter(){this._isShown()||this._isHovered?this._isHovered=!0:(this._isHovered=!0,this._setTimeout((()=>{this._isHovered&&this.show()}),this._config.delay.show))}_leave(){this._isWithActiveTrigger()||(this._isHovered=!1,this._setTimeout((()=>{this._isHovered||this.hide()}),this._config.delay.hide))}_setTimeout(e,t){clearTimeout(this._timeout),this._timeout=setTimeout(e,t)}_isWithActiveTrigger(){return Object.values(this._activeTrigger).includes(!0)}_getConfig(e){const t=Kt.getDataAttributes(this._element);for(const e of Object.keys(t))$n.has(e)&&delete t[e];return e={...t,..."object"==typeof e&&e?e:{}},e=this._mergeConfigObj(e),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}_configAfterMerge(e){return e.container=!1===e.container?document.body:_t(e.container),"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),"number"==typeof e.title&&(e.title=e.title.toString()),"number"==typeof e.content&&(e.content=e.content.toString()),e}_getDelegateConfig(){const e={};for(const[t,s]of Object.entries(this._config))this.constructor.Default[t]!==s&&(e[t]=s);return e.selector=!1,e.trigger="manual",e}_disposePopper(){this._popper&&(this._popper.destroy(),this._popper=null),this.tip&&(this.tip.remove(),this.tip=null)}static jQueryInterface(e){return this.each((function(){const t=zn.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e])throw new TypeError(`No method named "${e}"`);t[e]()}}))}}Tt(zn);const Un={...zn.Default,content:"",offset:[0,8],placement:"right",template:'',trigger:"click"},Gn={...zn.DefaultType,content:"(null|string|element|function)"};class Vn extends zn{static get Default(){return Un}static get DefaultType(){return Gn}static get NAME(){return"popover"}_isWithContent(){return this._getTitle()||this._getContent()}_getContentForTemplate(){return{".popover-header":this._getTitle(),".popover-body":this._getContent()}}_getContent(){return this._resolvePossibleFunction(this._config.content)}static jQueryInterface(e){return this.each((function(){const t=Vn.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e])throw new TypeError(`No method named "${e}"`);t[e]()}}))}}Tt(Vn);const Yn=".bs.scrollspy",Xn=`activate${Yn}`,Jn=`click${Yn}`,Kn=`load${Yn}.data-api`,Zn="active",Qn="[href]",eo=".nav-link",to=`${eo}, .nav-item > ${eo}, .list-group-item`,so={offset:null,rootMargin:"0px 0px -25%",smoothScroll:!1,target:null,threshold:[.1,.5,1]},io={offset:"(number|null)",rootMargin:"string",smoothScroll:"boolean",target:"element",threshold:"array"};class no extends Qt{constructor(e,t){super(e,t),this._targetLinks=new Map,this._observableSections=new Map,this._rootElement="visible"===getComputedStyle(this._element).overflowY?null:this._element,this._activeTarget=null,this._observer=null,this._previousScrollData={visibleEntryTop:0,parentScrollTop:0},this.refresh()}static get Default(){return so}static get DefaultType(){return io}static get NAME(){return"scrollspy"}refresh(){this._initializeTargetsAndObservables(),this._maybeEnableSmoothScroll(),this._observer?this._observer.disconnect():this._observer=this._getNewObserver();for(const e of this._observableSections.values())this._observer.observe(e)}dispose(){this._observer.disconnect(),super.dispose()}_configAfterMerge(e){return e.target=_t(e.target)||document.body,e.rootMargin=e.offset?`${e.offset}px 0px -30%`:e.rootMargin,"string"==typeof e.threshold&&(e.threshold=e.threshold.split(",").map((e=>Number.parseFloat(e)))),e}_maybeEnableSmoothScroll(){this._config.smoothScroll&&(Vt.off(this._config.target,Jn),Vt.on(this._config.target,Jn,Qn,(e=>{const t=this._observableSections.get(e.target.hash);if(t){e.preventDefault();const s=this._rootElement||window,i=t.offsetTop-this._element.offsetTop;if(s.scrollTo)return void s.scrollTo({top:i,behavior:"smooth"});s.scrollTop=i}})))}_getNewObserver(){const e={root:this._rootElement,threshold:this._config.threshold,rootMargin:this._config.rootMargin};return new IntersectionObserver((e=>this._observerCallback(e)),e)}_observerCallback(e){const t=e=>this._targetLinks.get(`#${e.target.id}`),s=e=>{this._previousScrollData.visibleEntryTop=e.target.offsetTop,this._process(t(e))},i=(this._rootElement||document.documentElement).scrollTop,n=i>=this._previousScrollData.parentScrollTop;this._previousScrollData.parentScrollTop=i;for(const o of e){if(!o.isIntersecting){this._activeTarget=null,this._clearActiveClass(t(o));continue}const e=o.target.offsetTop>=this._previousScrollData.visibleEntryTop;if(n&&e){if(s(o),!i)return}else n||e||s(o)}}_initializeTargetsAndObservables(){this._targetLinks=new Map,this._observableSections=new Map;const e=ts.find(Qn,this._config.target);for(const t of e){if(!t.hash||wt(t))continue;const e=ts.findOne(decodeURI(t.hash),this._element);yt(e)&&(this._targetLinks.set(decodeURI(t.hash),t),this._observableSections.set(t.hash,e))}}_process(e){this._activeTarget!==e&&(this._clearActiveClass(this._config.target),this._activeTarget=e,e.classList.add(Zn),this._activateParents(e),Vt.trigger(this._element,Xn,{relatedTarget:e}))}_activateParents(e){if(e.classList.contains("dropdown-item"))ts.findOne(".dropdown-toggle",e.closest(".dropdown")).classList.add(Zn);else for(const t of ts.parents(e,".nav, .list-group"))for(const e of ts.prev(t,to))e.classList.add(Zn)}_clearActiveClass(e){e.classList.remove(Zn);const t=ts.find(`${Qn}.${Zn}`,e);for(const e of t)e.classList.remove(Zn)}static jQueryInterface(e){return this.each((function(){const t=no.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);t[e]()}}))}}Vt.on(window,Kn,(()=>{for(const e of ts.find('[data-bs-spy="scroll"]'))no.getOrCreateInstance(e)})),Tt(no);const oo=".bs.tab",ro=`hide${oo}`,ao=`hidden${oo}`,lo=`show${oo}`,co=`shown${oo}`,uo=`click${oo}`,ho=`keydown${oo}`,po=`load${oo}`,go="ArrowLeft",fo="ArrowRight",mo="ArrowUp",bo="ArrowDown",vo="Home",_o="End",yo="active",wo="fade",Eo="show",Ao=".dropdown-toggle",So=`:not(${Ao})`,Lo='[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]',Oo=`${`.nav-link${So}, .list-group-item${So}, [role="tab"]${So}`}, ${Lo}`,xo=`.${yo}[data-bs-toggle="tab"], .${yo}[data-bs-toggle="pill"], .${yo}[data-bs-toggle="list"]`;let To=class e extends Qt{constructor(e){super(e),this._parent=this._element.closest('.list-group, .nav, [role="tablist"]'),this._parent&&(this._setInitialAttributes(this._parent,this._getChildren()),Vt.on(this._element,ho,(e=>this._keydown(e))))}static get NAME(){return"tab"}show(){const e=this._element;if(this._elemIsActive(e))return;const t=this._getActiveElem(),s=t?Vt.trigger(t,ro,{relatedTarget:e}):null;Vt.trigger(e,lo,{relatedTarget:t}).defaultPrevented||s&&s.defaultPrevented||(this._deactivate(t,e),this._activate(e,t))}_activate(e,t){if(!e)return;e.classList.add(yo),this._activate(ts.getElementFromSelector(e));this._queueCallback((()=>{"tab"===e.getAttribute("role")?(e.removeAttribute("tabindex"),e.setAttribute("aria-selected",!0),this._toggleDropDown(e,!0),Vt.trigger(e,co,{relatedTarget:t})):e.classList.add(Eo)}),e,e.classList.contains(wo))}_deactivate(e,t){if(!e)return;e.classList.remove(yo),e.blur(),this._deactivate(ts.getElementFromSelector(e));this._queueCallback((()=>{"tab"===e.getAttribute("role")?(e.setAttribute("aria-selected",!1),e.setAttribute("tabindex","-1"),this._toggleDropDown(e,!1),Vt.trigger(e,ao,{relatedTarget:t})):e.classList.remove(Eo)}),e,e.classList.contains(wo))}_keydown(t){if(![go,fo,mo,bo,vo,_o].includes(t.key))return;t.stopPropagation(),t.preventDefault();const s=this._getChildren().filter((e=>!wt(e)));let i;if([vo,_o].includes(t.key))i=s[t.key===vo?0:s.length-1];else{const e=[fo,bo].includes(t.key);i=Nt(s,t.target,e,!0)}i&&(i.focus({preventScroll:!0}),e.getOrCreateInstance(i).show())}_getChildren(){return ts.find(Oo,this._parent)}_getActiveElem(){return this._getChildren().find((e=>this._elemIsActive(e)))||null}_setInitialAttributes(e,t){this._setAttributeIfNotExists(e,"role","tablist");for(const e of t)this._setInitialAttributesOnChild(e)}_setInitialAttributesOnChild(e){e=this._getInnerElement(e);const t=this._elemIsActive(e),s=this._getOuterElement(e);e.setAttribute("aria-selected",t),s!==e&&this._setAttributeIfNotExists(s,"role","presentation"),t||e.setAttribute("tabindex","-1"),this._setAttributeIfNotExists(e,"role","tab"),this._setInitialAttributesOnTargetPanel(e)}_setInitialAttributesOnTargetPanel(e){const t=ts.getElementFromSelector(e);t&&(this._setAttributeIfNotExists(t,"role","tabpanel"),e.id&&this._setAttributeIfNotExists(t,"aria-labelledby",`${e.id}`))}_toggleDropDown(e,t){const s=this._getOuterElement(e);if(!s.classList.contains("dropdown"))return;const i=(e,i)=>{const n=ts.findOne(e,s);n&&n.classList.toggle(i,t)};i(Ao,yo),i(".dropdown-menu",Eo),s.setAttribute("aria-expanded",t)}_setAttributeIfNotExists(e,t,s){e.hasAttribute(t)||e.setAttribute(t,s)}_elemIsActive(e){return e.classList.contains(yo)}_getInnerElement(e){return e.matches(Oo)?e:ts.findOne(Oo,e)}_getOuterElement(e){return e.closest(".nav-item, .list-group-item")||e}static jQueryInterface(t){return this.each((function(){const s=e.getOrCreateInstance(this);if("string"==typeof t){if(void 0===s[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);s[t]()}}))}};Vt.on(document,uo,Lo,(function(e){["A","AREA"].includes(this.tagName)&&e.preventDefault(),wt(this)||To.getOrCreateInstance(this).show()})),Vt.on(window,po,(()=>{for(const e of ts.find(xo))To.getOrCreateInstance(e)})),Tt(To);const Co=".bs.toast",Io=`mouseover${Co}`,No=`mouseout${Co}`,ko=`focusin${Co}`,Do=`focusout${Co}`,$o=`hide${Co}`,Ro=`hidden${Co}`,Mo=`show${Co}`,Po=`shown${Co}`,Bo="hide",Ho="show",qo="showing",jo={animation:"boolean",autohide:"boolean",delay:"number"},Fo={animation:!0,autohide:!0,delay:5e3};class Wo extends Qt{constructor(e,t){super(e,t),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get Default(){return Fo}static get DefaultType(){return jo}static get NAME(){return"toast"}show(){if(Vt.trigger(this._element,Mo).defaultPrevented)return;this._clearTimeout(),this._config.animation&&this._element.classList.add("fade");this._element.classList.remove(Bo),St(this._element),this._element.classList.add(Ho,qo),this._queueCallback((()=>{this._element.classList.remove(qo),Vt.trigger(this._element,Po),this._maybeScheduleHide()}),this._element,this._config.animation)}hide(){if(!this.isShown())return;if(Vt.trigger(this._element,$o).defaultPrevented)return;this._element.classList.add(qo),this._queueCallback((()=>{this._element.classList.add(Bo),this._element.classList.remove(qo,Ho),Vt.trigger(this._element,Ro)}),this._element,this._config.animation)}dispose(){this._clearTimeout(),this.isShown()&&this._element.classList.remove(Ho),super.dispose()}isShown(){return this._element.classList.contains(Ho)}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout((()=>{this.hide()}),this._config.delay)))}_onInteraction(e,t){switch(e.type){case"mouseover":case"mouseout":this._hasMouseInteraction=t;break;case"focusin":case"focusout":this._hasKeyboardInteraction=t}if(t)return void this._clearTimeout();const s=e.relatedTarget;this._element===s||this._element.contains(s)||this._maybeScheduleHide()}_setListeners(){Vt.on(this._element,Io,(e=>this._onInteraction(e,!0))),Vt.on(this._element,No,(e=>this._onInteraction(e,!1))),Vt.on(this._element,ko,(e=>this._onInteraction(e,!0))),Vt.on(this._element,Do,(e=>this._onInteraction(e,!1)))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(e){return this.each((function(){const t=Wo.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e])throw new TypeError(`No method named "${e}"`);t[e](this)}}))}}ss(Wo),Tt(Wo);class zo extends HTMLElement{constructor(){super()}get alerts(){return this.querySelectorAll(".alert")}connectedCallback(){for(const e of this.alerts)new rs(e)}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-messages")&&window.customElements.define("tobago-messages",zo)}));class Uo extends HTMLElement{constructor(){super()}get text(){return this.querySelector("span.page-link")}get output(){return this.querySelector(".page-link span")}get input(){return this.querySelector("input")}get sheet(){const e=this.closest("tobago-sheet");return null!=e?e:(window.alert("todo: implement find, wenn this is not a child"),document.querySelector("tobago-sheet"))}get buttons(){return this.querySelectorAll("li.page-item:not(.disabled)>button")}get action(){return this.querySelector("input[type=hidden]")}connectedCallback(){const e=this.text;e&&e.addEventListener("click",this.clickOnPaging.bind(this));const s=this.input;s&&(s.addEventListener("blur",this.blurPaging.bind(this)),s.addEventListener("keydown",function(e){e.key===t.ENTER&&(e.stopPropagation(),e.preventDefault(),e.currentTarget.dispatchEvent(new Event("blur")))}.bind(this)));const i=this.buttons;i&&i.forEach((e=>e.addEventListener("click",this.clickOnButton.bind(this))))}clickOnPaging(e){this.output.style.display="none";const t=this.input;t.style.display="initial",t.focus(),t.select()}blurPaging(e){const t=e.currentTarget,s=this.output,i=Number.parseInt(t.value);if(i>0&&i.toString()!==s.innerHTML){console.debug("Reloading sheet '%s' old value='%s' new value='%s'",this.id,s.innerHTML,i),s.innerHTML=i.toString();const e="TOBAGO-PAGINATOR-ROW"==this.tagName?"toRow":"toPage";t.value=`{"action":"${e}","target":${i}}`,faces.ajax.request(this.id,null,{params:{"javax.faces.behavior.event":"reload"},execute:this.sheet.id,render:this.sheet.id})}else console.info("no update needed");t.style.display="none",s.style.display="initial"}clickOnButton(e){const t=e.currentTarget;this.input.value=t.dataset.tobagoAction,faces.ajax.request(this.id,null,{params:{"javax.faces.behavior.event":"reload"},execute:this.sheet.id,render:this.sheet.id})}}class Go extends Uo{constructor(){super()}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-paginator-list")&&window.customElements.define("tobago-paginator-list",Go)}));class Vo extends Uo{constructor(){super()}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-paginator-page")&&window.customElements.define("tobago-paginator-page",Vo)}));class Yo extends Uo{constructor(){super()}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-paginator-row")&&window.customElements.define("tobago-paginator-row",Yo)}));class Xo extends HTMLElement{}var Jo,Ko,Zo;document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-panel")&&window.customElements.define("tobago-panel",Xo)})),function(e){e[e.auto=0]="auto",e[e.never=1]="never"}(Jo||(Jo={}));class Qo extends HTMLElement{constructor(){super()}connectedCallback(){this.instance=new Vn(this.baseElement,{container:this.popoverStore,customClass:this.customClass,title:this.label,content:this.value,html:!this.escape,sanitize:this.sanitize===Jo.auto,trigger:"focus"})}get baseElement(){var e,t;return"A"===(null===(e=this.parentElement)||void 0===e?void 0:e.tagName)||"BUTTON"===(null===(t=this.parentElement)||void 0===t?void 0:t.tagName)?this.parentElement:this}get popoverStore(){return document.getRootNode().querySelector(".tobago-page-popoverStore")}get customClass(){const e=this.getAttribute("custom-class");return e||""}get label(){const e=this.getAttribute("label");return e||""}get value(){return this.getAttribute("value")}get escape(){return"false"!==this.getAttribute("escape")}get sanitize(){return Jo[this.getAttribute("sanitize")]}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-popover")&&window.customElements.define("tobago-popover",Qo)})),function(e){e[e.none=0]="none",e[e.client=1]="client",e[e.ajax=2]="ajax",e[e.full=3]="full"}(Ko||(Ko={})),function(e){e[e.none=0]="none",e[e.show=1]="show",e[e.hide=2]="hide",e[e.toggle=3]="toggle"}(Zo||(Zo={}));class er{static findHidden(e){return e.getRootNode().getElementById(e.id+"::collapse")}static fireEvent(e,t){const s="tobago."+e.tagName.substring(7).toLowerCase()+"."+t;e.dispatchEvent(new CustomEvent(s,{bubbles:!0}))}}er.execute=function(t,s,i){const n=er.findHidden(s);let o;switch(t){case Zo.hide:o=!0;break;case Zo.show:o=!1;break;default:console.error("unknown operation: '%s'",t)}o?(er.fireEvent(s,"hide"),s instanceof sr?s.clientBehaviorHide(i):s.classList.add(e.TOBAGO_COLLAPSED),er.fireEvent(s,"hidden")):(er.fireEvent(s,"show"),s instanceof sr?s.clientBehaviorShow(i):s.classList.remove(e.TOBAGO_COLLAPSED),er.fireEvent(s,"shown")),n.value=o};const tr="hidden.bs.modal";class sr extends HTMLElement{constructor(){super()}connectedCallback(){this.modal=new an(this,{}),this.collapsed||this.clientBehaviorShow(),this.addEventListener(tr,(()=>{this.connected&&(this.collapsed=!0)}))}disconnectedCallback(){this.clientBehaviorHide()}clientBehaviorShow(e){console.debug("show - behaviorMode:",e),null!=e&&e!=Ko.client||this.modal.show()}clientBehaviorHide(e){console.debug("hide - behaviorMode:",e),null!=e&&e!=Ko.client||this.modal.hide()}get collapsed(){return JSON.parse(er.findHidden(this).value)}set collapsed(e){er.findHidden(this).value=String(e)}get connected(){return null!=this.parentElement}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-popup")&&window.customElements.define("tobago-popup",sr)}));class ir extends HTMLElement{constructor(){super()}connectedCallback(){this.range.addEventListener("input",this.updateTooltip.bind(this)),this.range.addEventListener("focus",this.updateTooltip.bind(this))}get range(){return this.querySelector("input[type=range]")}get tooltip(){return this.querySelector(".tobago-tooltip")}updateTooltip(){this.tooltip.textContent=this.range.value,this.tooltip.style.top=String(this.range.offsetTop-this.tooltip.offsetHeight)+"px",this.tooltip.style.left=String(this.range.offsetLeft+this.range.offsetWidth/2-this.tooltip.offsetWidth/2)+"px",this.tooltip.classList.add(e.SHOW),clearTimeout(this.timer),this.timer=setTimeout((()=>{this.tooltip.classList.remove(e.SHOW)}),1e3)}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-range")&&window.customElements.define("tobago-range",ir)}));class nr extends HTMLElement{constructor(){super()}connectedCallback(){this.schedule(this.id,this.component.id,this.frequency)}schedule(e,t,s){if(s>0){const i=nr.timeoutMap.get(t);i&&(console.debug("clear reload timeout '%s' for #'%s'",i,t),window.clearTimeout(i),nr.timeoutMap.delete(t));const n=window.setTimeout((function(){console.debug("reloading #'%s'",t),faces.ajax.request(e,null,{params:{"jakarta.faces.behavior.event":"reload"},execute:`${e} ${t}`,render:`${e} ${t}`})}),s);console.debug("adding reload timeout '%s' for #'%s'",n,t),nr.timeoutMap.set(t,n)}}get component(){return this.parentElement}get frequency(){const e=this.getAttribute("frequency");return e?Number.parseFloat(e):0}}nr.timeoutMap=new Map,document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-reload")&&window.customElements.define("tobago-reload",nr)}));class or extends HTMLElement{constructor(){super()}connectedCallback(){const e=this.hiddenElement.value,t=JSON.parse(e);2===t.length?(this.parentElement.scrollLeft=t[0],this.parentElement.scrollTop=t[1]):console.warn("Syntax error for scroll position: ",e),this.parentElement.addEventListener("scroll",this.storeScrollPosition.bind(this))}storeScrollPosition(e){const t=e.currentTarget,s=t.scrollLeft,i=t.scrollTop;this.hiddenElement.value=JSON.stringify([s,i])}get hiddenElement(){return this.querySelector("input")}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-scroll")&&window.customElements.define("tobago-scroll",or)}));class rr extends HTMLElement{constructor(){super()}connectedCallback(){this.field.addEventListener("focus",Ze.setLastFocusId),this.field.readOnly&&this.field.addEventListener("click",(function(e){e.preventDefault()}))}get field(){return this.getRootNode().getElementById(this.id+"::field")}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-boolean-checkbox")&&window.customElements.define("tobago-select-boolean-checkbox",rr)}));class ar extends rr{}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-boolean-toggle")&&window.customElements.define("tobago-select-boolean-toggle",ar)}));class lr extends HTMLElement{constructor(){super()}connectedCallback(){for(const e of this.inputs)e.addEventListener("focus",Ze.setLastFocusId),e.readOnly&&e.addEventListener("click",(e=>{e.preventDefault()}))}get inputs(){return this.querySelectorAll(`input[name='${this.id}']`)}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-many-checkbox")&&window.customElements.define("tobago-select-many-checkbox",lr)}));class cr{static set(e,t){this.map.set(e,t)}static get(e){const t=this.map.get(e);return t||(console.warn("TobagoFilterRegistry.get("+e+") = undefined"),null)}static localeContains(e,t,s){e=e.normalize();const i=(t=t.normalize()).length,n=s?0:e.length-i;for(let s=0;s<=n;s++){if(0===e.substring(s,s+i).localeCompare(t,window.navigator.language,{sensitivity:"base"}))return!0}return!1}}cr.map=new Map,cr.set("contains",((e,t)=>cr.localeContains(e,t,!1))),cr.set("startsWith",((e,t)=>cr.localeContains(e,t,!0))),cr.set("containsExact",((e,t)=>e.indexOf(t)>=0)),cr.set("startsWithExact",((e,t)=>0==e.indexOf(t)));class dr extends HTMLElement{get disabled(){return this.classList.contains(e.TOBAGO_DISABLED)}get focused(){return this.classList.contains(e.TOBAGO_FOCUS)}set focused(t){t&&!this.focused?(this.classList.add(e.TOBAGO_FOCUS),this.hiddenSelect.dispatchEvent(new Event("focus",{bubbles:!0}))):!t&&this.focused&&(this.classList.remove(e.TOBAGO_FOCUS),this.hiddenSelect.dispatchEvent(new Event("blur",{bubbles:!0})))}get filter(){return this.getAttribute("filter")}get hiddenSelect(){return this.querySelector("select")}get hiddenOptions(){return this.hiddenSelect.querySelectorAll("option")}get selectField(){return this.querySelector(".tobago-select-field")}get filterInput(){return this.querySelector(".tobago-filter")}get dropdownMenu(){return this.getRootNode().querySelector(`.${e.TOBAGO_DROPDOWN_MENU}[name='${this.id}']`)}get options(){return this.getRootNode().querySelector(`.tobago-options[name='${this.id}'] table`)}get tbody(){return this.options.querySelector("tbody")}get rows(){return this.tbody.querySelectorAll("tr")}get enabledRows(){return this.tbody.querySelectorAll("tr:not(."+e.D_NONE+"):not(."+e.DISABLED)}get preselectedRow(){return this.tbody.querySelector("."+e.TOBAGO_PRESELECT)}get localMenu(){return this.hasAttribute("local-menu")}connectedCallback(){this.dropdownMenu&&(this.popper=Pe(this.selectField,this.dropdownMenu,{}),window.addEventListener("resize",(()=>this.updateDropdownMenuWidth()))),document.addEventListener("click",this.globalClickEvent.bind(this)),this.hiddenSelect.addEventListener("click",this.labelClickEvent.bind(this)),this.selectField.addEventListener("keydown",this.keydownEventBase.bind(this)),this.filterInput.addEventListener("focus",this.focusEvent.bind(this)),this.filterInput.addEventListener("blur",this.blurEvent.bind(this)),this.options.addEventListener("keydown",this.keydownEventBase.bind(this)),this.rows.forEach((e=>e.addEventListener("blur",this.blurEvent.bind(this)))),this.filter&&this.filterInput.addEventListener("input",this.filterEvent.bind(this)),this.tbody.addEventListener("click",this.tbodyClickEvent.bind(this)),document.activeElement.id===this.filterInput.id&&this.focusEvent(),this.selectField.addEventListener("click",(()=>this.hiddenSelect.dispatchEvent(new Event("click")))),this.options.addEventListener("click",(()=>this.hiddenSelect.dispatchEvent(new Event("click")))),this.selectField.addEventListener("dblclick",(()=>this.hiddenSelect.dispatchEvent(new Event("dblclick")))),this.options.addEventListener("dblclick",(()=>this.hiddenSelect.dispatchEvent(new Event("dblclick"))))}disconnectedCallback(){var e;null===(e=this.dropdownMenu)||void 0===e||e.remove()}keydownEventBase(s){switch(s.key){case t.ESCAPE:this.hideDropdown(),this.removePreselection(),this.filterInput.focus({preventScroll:!0});break;case t.ARROW_DOWN:s.preventDefault(),this.showDropdown(),this.preselectNextRow();break;case t.ARROW_UP:s.preventDefault(),this.showDropdown(),this.preselectPreviousRow();break;case t.ENTER:case t.SPACE:if(this.preselectedRow){s.preventDefault();const t=this.tbody.querySelector("."+e.TOBAGO_PRESELECT);this.select(t)}else document.activeElement.id===this.filterInput.id&&this.showDropdown();break;case t.TAB:this.removePreselection(),this.filterInput.focus({preventScroll:!0});break;default:this.filterInput.focus({preventScroll:!0})}}focusEvent(){this.disabled||(this.focused=!0)}blurEvent(e){null!==e.relatedTarget&&(this.isPartOfSelectField(e.relatedTarget)||this.isPartOfTobagoOptions(e.relatedTarget)||this.leaveComponent())}filterEvent(t){const s=t.currentTarget.value;this.showDropdown();const i=cr.get(this.filter);let n=0;null!=i&&this.rows.forEach((t=>{const o=t.cells.item(0).textContent;i(o,s)?(t.classList.remove(e.D_NONE),n++):(t.classList.add(e.D_NONE),t.classList.remove(e.TOBAGO_PRESELECT))}));const o=this.options.querySelector("."+e.TOBAGO_NO_ENTRIES);0===n?o.classList.remove(e.D_NONE):o.classList.add(e.D_NONE)}tbodyClickEvent(e){const t=e.target.closest("tr");this.select(t)}preselectNextRow(){const t=this.enabledRows,s=this.preselectIndex(t);s>=0?s+10&&this.preselect(t.item(0))}preselectPreviousRow(){const t=this.enabledRows,s=this.preselectIndex(t);s>=0?s-1>=0?(t.item(s).classList.remove(e.TOBAGO_PRESELECT),this.preselect(t.item(s-1))):(t.item(0).classList.remove(e.TOBAGO_PRESELECT),this.preselect(t.item(t.length-1))):t.length>0&&this.preselect(t.item(t.length-1))}preselectIndex(t){for(let s=0;se}):void 0,pr="$lit$",gr=`lit$${Math.random().toFixed(9).slice(2)}$`,fr="?"+gr,mr=`<${fr}>`,br=document,vr=()=>br.createComment(""),_r=e=>null===e||"object"!=typeof e&&"function"!=typeof e,yr=Array.isArray,wr="[ \t\n\f\r]",Er=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ar=/-->/g,Sr=/>/g,Lr=RegExp(`>|${wr}(?:([^\\s"'>=/]+)(${wr}*=${wr}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Or=/'/g,xr=/"/g,Tr=/^(?:script|style|textarea|title)$/i,Cr=(e=>(t,...s)=>({_$litType$:e,strings:t,values:s}))(1),Ir=Symbol.for("lit-noChange"),Nr=Symbol.for("lit-nothing"),kr=new WeakMap,Dr=br.createTreeWalker(br,129);function $r(e,t){if(!yr(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==hr?hr.createHTML(t):t}const Rr=(e,t)=>{const s=e.length-1,i=[];let n,o=2===t?"":3===t?"":"",r=Er;for(let t=0;t"===l[0]?(r=n??Er,c=-1):void 0===l[1]?c=-2:(c=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?Lr:'"'===l[3]?xr:Or):r===xr||r===Or?r=Lr:r===Ar||r===Sr?r=Er:(r=Lr,n=void 0);const u=r===Lr&&e[t+1].startsWith("/>")?" ":"";o+=r===Er?s+mr:c>=0?(i.push(a),s.slice(0,c)+pr+s.slice(c)+gr+u):s+gr+(-2===c?t:u)}return[$r(e,o+(e[s]||"")+(2===t?"":3===t?"":"")),i]};class Mr{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let n=0,o=0;const r=e.length-1,a=this.parts,[l,c]=Rr(e,t);if(this.el=Mr.createElement(l,s),Dr.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=Dr.nextNode())&&a.length0){i.textContent=ur?ur.emptyScript:"";for(let s=0;syr(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Nr&&_r(this._$AH)?this._$AA.nextSibling.data=e:this.T(br.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i="number"==typeof s?this._$AC(e):(void 0===s.el&&(s.el=Mr.createElement($r(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const e=new Br(i,this),s=e.u(this.options);e.p(t),this.T(s),this._$AH=e}}_$AC(e){let t=kr.get(e.strings);return void 0===t&&kr.set(e.strings,t=new Mr(e)),t}k(e){yr(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const n of e)i===t.length?t.push(s=new Hr(this.O(vr()),this.O(vr()),this,this.options)):s=t[i],s._$AI(n),i++;i2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=Nr}_$AI(e,t=this,s,i){const n=this.strings;let o=!1;if(void 0===n)e=Pr(this,e,t,0),o=!_r(e)||e!==this._$AH&&e!==Ir,o&&(this._$AH=e);else{const i=e;let r,a;for(e=n[0],r=0;rthis.sync(e)))}globalClickEvent(e){this.disabled||this.isDeleted(e.target)||(this.isPartOfSelectField(e.target)||this.isPartOfTobagoOptions(e.target)?(this.filterInput.disabled?this.badgeCloseButtons.length>0&&this.badgeCloseButtons[0].focus():this.filterInput.focus(),this.showDropdown()):this.leaveComponent())}labelClickEvent(e){e.stopPropagation(),this.filterInput.disabled?this.badgeCloseButtons.length>0&&this.badgeCloseButtons[0].focus():this.filterInput.focus()}select(e){const t=e.dataset.tobagoValue,s=this.hiddenSelect.querySelector(`[value="${t}"]`);s.selected=!s.selected,this.sync(s),this.hiddenSelect.dispatchEvent(new Event("change",{bubbles:!0}))}sync(t){const s=t.value,i=this.tbody.querySelector(`[data-tobago-value="${s}"]`);if(t.selected){const n=this.filterInput.tabIndex,o=document.createElement("span");o.className="btn-group",o.role="group",o.dataset.tobagoValue=s,this.badges.insertAdjacentElement("beforeend",o),((e,t,s)=>{const i=t;let n=i._$litPart$;if(void 0===n){const e=null;i._$litPart$=n=new Hr(t.insertBefore(vr(),e),e,void 0,{})}n._$AI(e)})(this.getRowTemplate(i.innerText,t.disabled||this.hiddenSelect.disabled,n),o),i.classList.add(e.TABLE_PRIMARY)}else{this.selectField.querySelector(`[data-tobago-value="${s}"]`).remove(),i.classList.remove(e.TABLE_PRIMARY)}this.disabled||this.filter||(this.badgeCloseButtons.length>0&&this.filterInput.id===document.activeElement.id&&this.badgeCloseButtons.item(this.badgeCloseButtons.length-1).focus(),this.filterInput.disabled=this.badgeCloseButtons.length>0)}getRowTemplate(e,t,s){return console.debug("creating span: ",e,t,s),t?Cr`${e}`:Cr`${e} + */const ur=globalThis,hr=ur.trustedTypes,pr=hr?hr.createPolicy("lit-html",{createHTML:e=>e}):void 0,gr="$lit$",fr=`lit$${Math.random().toFixed(9).slice(2)}$`,mr="?"+fr,br=`<${mr}>`,vr=document,_r=()=>vr.createComment(""),yr=e=>null===e||"object"!=typeof e&&"function"!=typeof e,wr=Array.isArray,Er="[ \t\n\f\r]",Ar=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Sr=/-->/g,Lr=/>/g,Or=RegExp(`>|${Er}(?:([^\\s"'>=/]+)(${Er}*=${Er}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),xr=/'/g,Tr=/"/g,Cr=/^(?:script|style|textarea|title)$/i,Ir=(e=>(t,...s)=>({_$litType$:e,strings:t,values:s}))(1),Nr=Symbol.for("lit-noChange"),kr=Symbol.for("lit-nothing"),Dr=new WeakMap,$r=vr.createTreeWalker(vr,129);function Rr(e,t){if(!wr(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==pr?pr.createHTML(t):t}const Mr=(e,t)=>{const s=e.length-1,i=[];let n,o=2===t?"":3===t?"":"",r=Ar;for(let t=0;t"===l[0]?(r=n??Ar,c=-1):void 0===l[1]?c=-2:(c=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?Or:'"'===l[3]?Tr:xr):r===Tr||r===xr?r=Or:r===Sr||r===Lr?r=Ar:(r=Or,n=void 0);const u=r===Or&&e[t+1].startsWith("/>")?" ":"";o+=r===Ar?s+br:c>=0?(i.push(a),s.slice(0,c)+gr+s.slice(c)+fr+u):s+fr+(-2===c?t:u)}return[Rr(e,o+(e[s]||"")+(2===t?"":3===t?"":"")),i]};class Pr{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let n=0,o=0;const r=e.length-1,a=this.parts,[l,c]=Mr(e,t);if(this.el=Pr.createElement(l,s),$r.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=$r.nextNode())&&a.length0){i.textContent=hr?hr.emptyScript:"";for(let s=0;swr(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==kr&&yr(this._$AH)?this._$AA.nextSibling.data=e:this.T(vr.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i="number"==typeof s?this._$AC(e):(void 0===s.el&&(s.el=Pr.createElement(Rr(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const e=new Hr(i,this),s=e.u(this.options);e.p(t),this.T(s),this._$AH=e}}_$AC(e){let t=Dr.get(e.strings);return void 0===t&&Dr.set(e.strings,t=new Pr(e)),t}k(e){wr(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const n of e)i===t.length?t.push(s=new qr(this.O(_r()),this.O(_r()),this,this.options)):s=t[i],s._$AI(n),i++;i2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=kr}_$AI(e,t=this,s,i){const n=this.strings;let o=!1;if(void 0===n)e=Br(this,e,t,0),o=!yr(e)||e!==this._$AH&&e!==Nr,o&&(this._$AH=e);else{const i=e;let r,a;for(e=n[0],r=0;rthis.sync(e)))}globalClickEvent(e){this.disabled||this.isDeleted(e.target)||(this.isPartOfSelectField(e.target)||this.isPartOfTobagoOptions(e.target)?(this.filterInput.disabled?this.badgeCloseButtons.length>0&&this.badgeCloseButtons[0].focus():this.filterInput.focus(),this.showDropdown()):this.leaveComponent())}labelClickEvent(e){e.stopPropagation(),this.filterInput.disabled?this.badgeCloseButtons.length>0&&this.badgeCloseButtons[0].focus():this.filterInput.focus()}select(e){const t=e.dataset.tobagoValue,s=this.hiddenSelect.querySelector(`[value="${t}"]`);s.selected=!s.selected,this.sync(s),this.hiddenSelect.dispatchEvent(new Event("change",{bubbles:!0}))}sync(t){const s=t.value,i=this.tbody.querySelector(`[data-tobago-value="${s}"]`);if(t.selected){const n=this.filterInput.tabIndex,o=document.createElement("span");o.className="btn-group",o.role="group",o.dataset.tobagoValue=s,this.badges.insertAdjacentElement("beforeend",o),((e,t,s)=>{const i=t;let n=i._$litPart$;if(void 0===n){const e=null;i._$litPart$=n=new qr(t.insertBefore(_r(),e),e,void 0,{})}n._$AI(e)})(this.getRowTemplate(i.innerText,t.disabled||this.hiddenSelect.disabled,n),o),i.classList.add(e.TABLE_PRIMARY)}else{this.selectField.querySelector(`[data-tobago-value="${s}"]`).remove(),i.classList.remove(e.TABLE_PRIMARY)}this.disabled||this.filter||(this.badgeCloseButtons.length>0&&this.filterInput.id===document.activeElement.id&&this.badgeCloseButtons.item(this.badgeCloseButtons.length-1).focus(),this.filterInput.disabled=this.badgeCloseButtons.length>0)}getRowTemplate(e,t,s){return console.debug("creating span: ",e,t,s),t?Ir`${e}`:Ir`${e} `}removeBadge(e){var t;const s=e.target.closest(".btn-group").dataset.tobagoValue,i=this.hiddenSelect.querySelector(`[value="${s}"]`);i.selected=!1;const n=this.badges.querySelector(`[data-tobago-value="${s}"]`),o=n.previousElementSibling,r="SPAN"===(null===(t=n.nextElementSibling)||void 0===t?void 0:t.tagName)?n.nextElementSibling:null;o?o.querySelector("button.btn.badge").focus():r?r.querySelector("button.btn.badge").focus():(this.filterInput.disabled=!1,this.filterInput.focus()),this.sync(i),this.hiddenSelect.dispatchEvent(new Event("change",{bubbles:!0}))}leaveComponent(){this.focused=!1,this.filterInput.value=null,this.filterInput.dispatchEvent(new Event("input")),this.hideDropdown()}isDeleted(e){return null===e.closest("html")}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-many-list")&&window.customElements.define("tobago-select-many-list",Gr)}));class Vr extends HTMLElement{constructor(){super()}connectedCallback(){this.saveSelection(),this.field.addEventListener("click",this.clickSelection.bind(this)),this.field.addEventListener("focus",Ze.setLastFocusId)}clickSelection(e){e.currentTarget.required||this.field.selectedIndex!==this.oldselectedIndex||(this.field.selectedIndex=-1),this.saveSelection()}saveSelection(){this.oldselectedIndex=this.field.selectedIndex}get field(){return this.getRootNode().getElementById(this.id+"::field")}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-one-listbox")&&window.customElements.define("tobago-select-one-listbox",Vr)}));class Yr extends Vr{}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-many-listbox")&&window.customElements.define("tobago-select-many-listbox",Yr)}));class Xr extends HTMLElement{constructor(){super()}connectedCallback(){this.unselectedSelect.onchange=e=>e.stopPropagation(),this.selectedSelect.onchange=e=>e.stopPropagation(),this.unselectedSelect.addEventListener("focus",Ze.setLastFocusId),this.selectedSelect.addEventListener("focus",Ze.setLastFocusId),"readonly"===this.unselectedSelect.getAttribute("readonly")||this.unselectedSelect.disabled||this.unselectedSelect.addEventListener("dblclick",this.addSelectedItems.bind(this)),"readonly"===this.selectedSelect.getAttribute("readonly")||this.selectedSelect.disabled||this.selectedSelect.addEventListener("dblclick",this.removeSelectedItems.bind(this)),this.addAllButton.disabled||this.addAllButton.addEventListener("click",this.addAllItems.bind(this)),this.addButton.disabled||this.addButton.addEventListener("click",this.addSelectedItems.bind(this)),this.removeButton.disabled||this.removeButton.addEventListener("click",this.removeSelectedItems.bind(this)),this.removeAllButton.disabled||this.removeAllButton.addEventListener("click",this.removeAllItems.bind(this))}addAllItems(e){this.addItems(this.unselectedSelect.querySelectorAll("option:not(:disabled)"))}addSelectedItems(e){this.addItems(this.unselectedSelect.querySelectorAll("option:checked"))}removeSelectedItems(e){this.removeItems(this.selectedSelect.querySelectorAll("option:checked"))}removeAllItems(e){this.removeItems(this.selectedSelect.querySelectorAll("option:not(:disabled)"))}addItems(e){for(const t of e)this.selectedSelect.add(t),this.changeHiddenOption(t,!0)}removeItems(e){for(const t of e)this.unselectedSelect.add(t),this.changeHiddenOption(t,!1)}changeHiddenOption(e,t){this.hiddenSelect.querySelector(`option[value='${e.value}']`).selected=t,this.dispatchEvent(new Event("change"))}get unselectedSelect(){return this.querySelector(".tobago-unselected")}get selectedSelect(){return this.querySelector(".tobago-selected")}get hiddenSelect(){return this.querySelector("select.d-none")}get addAllButton(){return this.querySelector(".btn-group-vertical button:nth-child(1)")}get addButton(){return this.querySelector(".btn-group-vertical button:nth-child(2)")}get removeButton(){return this.querySelector(".btn-group-vertical button:nth-child(3)")}get removeAllButton(){return this.querySelector(".btn-group-vertical button:nth-child(4)")}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-many-shuttle")&&window.customElements.define("tobago-select-many-shuttle",Xr)}));class Jr extends HTMLElement{constructor(){super()}connectedCallback(){this.field.addEventListener("focus",Ze.setLastFocusId)}get field(){return this.getRootNode().getElementById(this.id+"::field")}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-one-choice")&&window.customElements.define("tobago-select-one-choice",Jr)}));class Kr extends cr{constructor(){super()}get spanText(){return this.selectField.querySelector("span").textContent}set spanText(e){this.selectField.querySelector("span").textContent=e}get selectedOption(){const e=this.hiddenSelect.value;return this.hiddenSelect.querySelector(`[value="${e}"]`)}connectedCallback(){super.connectedCallback(),this.selectField.addEventListener("keydown",this.keydownEvent.bind(this)),this.filter&&this.filterInput.addEventListener("input",this.clearSpan.bind(this)),this.sync()}globalClickEvent(e){this.disabled||(this.isPartOfSelectField(e.target)?(this.filterInput.disabled||this.filterInput.focus(),this.showDropdown()):this.isPartOfTobagoOptions(e.target)?(this.filterInput.disabled||this.filterInput.focus(),this.hideDropdown()):this.leaveComponent())}labelClickEvent(e){e.stopPropagation(),this.filterInput.disabled||this.filterInput.focus()}keydownEvent(e){switch(e.key){case t.ESCAPE:this.spanText=this.selectedOption.textContent;break;case t.BACKSPACE:0===this.filterInput.value.length&&this.filterInput.dispatchEvent(new Event("input"))}}clearSpan(){this.spanText=null}select(e){const t=e.dataset.tobagoValue;this.hiddenSelect.querySelector(`[value="${t}"]`).selected=!0,this.filterInput.value=null,this.sync(),this.hiddenSelect.dispatchEvent(new Event("change",{bubbles:!0}))}sync(){this.rows.forEach((t=>{t.dataset.tobagoValue===this.hiddenSelect.value?(this.spanText=this.selectedOption.textContent,t.classList.add(e.TABLE_PRIMARY)):t.classList.remove(e.TABLE_PRIMARY)}))}leaveComponent(){this.focused=!1,this.filterInput.value=null,this.filterInput.dispatchEvent(new Event("input")),this.spanText=this.selectedOption.textContent,this.hideDropdown()}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-one-list")&&window.customElements.define("tobago-select-one-list",Kr)}));class Zr extends HTMLElement{constructor(){super(),this.oldCheckedId=""}connectedCallback(){this.saveSelection();for(const e of this.radioGroup)e.addEventListener("focus",Ze.setLastFocusId),e.addEventListener("click",this.clickSelection.bind(this)),e.addEventListener("keydown",this.keySelection.bind(this))}clickSelection(e){const t=e.currentTarget;t.readOnly?this.revertSelection():t.disabled||t.required||t.id!==this.oldCheckedId||(t.checked=!1,this.oldCheckedId=""),this.saveSelection()}keySelection(e){e.key===t.SPACE&&e.preventDefault();const s=e.currentTarget;s.readOnly?this.revertSelection():s.disabled||s.required||" "!==e.key||(s.checked=!s.checked),this.saveSelection()}revertSelection(){for(const e of this.radioGroup)e.checked=e.id===this.oldCheckedId}saveSelection(){for(const e of this.radioGroup)e.checked&&(this.oldCheckedId=e.id)}get radioGroup(){return this.querySelectorAll(`input[type='radio'][name='${this.id}']`)}}var Qr,ea,ta,sa,ia;document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-one-radio")&&window.customElements.define("tobago-select-one-radio",Zr)})),function(e){e.ACTION="action",e.BLUR="blur",e.CHANGE="change",e.CLICK="click",e.COMPLETE="complete",e.DBLCLICK="dblclick",e.FOCUS="focus",e.KEYDOWN="keydown",e.KEYPRESS="keypress",e.KEYUP="keyup",e.INPUT="input",e.LOAD="load",e.MOUSEOVER="mouseover",e.MOUSEOUT="mouseout",e.RELOAD="reload",e.RESIZE="resize",e.SUGGEST="suggest",e.ROW_SELECTION_CHANGE="tobago.sheet.rowSelectionChange",e.TAB_CHANGE="tobago.tabGroup.tabChange"}(Qr||(Qr={})),function(e){e[e.none=0]="none",e[e.multi=1]="multi",e[e.single=2]="single",e[e.singleOrNone=3]="singleOrNone",e[e.multiLeafOnly=4]="multiLeafOnly",e[e.singleLeafOnly=5]="singleLeafOnly",e[e.sibling=6]="sibling",e[e.siblingLeafOnly=7]="siblingLeafOnly",e[e.multiCascade=8]="multiCascade"}(ea||(ea={}));class na{constructor(e){this.sheet=e}get headerElement(){return this.sheet.querySelector("thead input.tobago-selected[name='"+this.sheet.id+"::columnSelector']")}get selectable(){return ea[this.headerElement.dataset.tobagoSelectionMode]}rowElement(e){return e.querySelector("td:first-child > input.tobago-selected")}get disabled(){const e=this.sheet.querySelector("tr[row-index] input[name^='"+this.sheet.id+"_data_row_selector']");return e&&e.disabled}}!function(e){e[e.none=0]="none",e[e.singleMode=1]="singleMode",e[e.ctrlMode_singleOrNone=2]="ctrlMode_singleOrNone",e[e.ctrlMode_multi=3]="ctrlMode_multi",e[e.shiftMode=4]="shiftMode"}(ta||(ta={}));class oa extends HTMLElement{constructor(){super()}static getScrollBarSize(){const e=document.getElementsByTagName("body").item(0),t=document.createElement("div");t.style.visibility="hidden",t.style.width="100px",t.style.overflow="scroll",e.append(t);const s=document.createElement("div");s.style.width="100%",t.append(s);const i=s.offsetWidth;return e.removeChild(t),100-i}static getDummyRowTemplate(e,t){return`\n \n`}connectedCallback(){this.querySelector("thead input.tobago-selected[name='"+this.id+"::columnSelector']")&&(this.columnSelector=new na(this));const e=this.loadColumnWidths();if(console.info("columnWidths: %s",JSON.stringify(e)),e&&0===e.length){let e=JSON.parse(this.dataset.tobagoLayout).columns;const t=this.isColumnRendered(),s=this.getHeaderCols(),i=this.getBodyTable(),n=this.getBodyCols(),o=Number(getComputedStyle(i.querySelector("td:first-child")).borderLeftWidth.slice(0,-2)),r=Number(getComputedStyle(i.querySelector("td:last-child")).borderRightWidth.slice(0,-2)),a=i.offsetWidth-(o+r)/2;for(console.assert(s.length-1===n.length,"header and body column number doesn't match: %d != %d ",s.length-1,n.length);e.length0?c-=t:e[i].measure.lastIndexOf("%")>0&&(c-=a*t/100)}else if("auto"===e[i]){const t=s.item(d).offsetWidth;c-=t,e[i]={measure:`${t}px`}}else console.debug("(layout columns a) auto? token[i]='%s' i=%i",e[i],i);c<0&&(c=0),d=0;for(let i=0;i0?o=t:e[i].measure.lastIndexOf("%")>0&&(o=a*t/100)}else console.debug("(layout columns b) auto? token[i]='%s' i=%i",e[i],i);o>0&&(s.item(d).setAttribute("width",String(o)),n.item(d).setAttribute("width",String(o))),d++}}}this.addHeaderFillerWidth();for(const e of this.querySelectorAll(".tobago-resize"))e.addEventListener("click",(function(){return!1})),e.addEventListener("mousedown",this.mousedown.bind(this));const t=this.getBody();if(!this.lazy){const e=this.scrollPosition;t.scrollLeft=e[0],t.scrollTop=e[1]}if(this.syncScrolling(),t.addEventListener("scroll",this.scrollAction.bind(this)),this.getRowElements().forEach((e=>this.initSelectionListener(e))),this.columnSelector&&"checkbox"===this.columnSelector.headerElement.type&&this.columnSelector.headerElement.addEventListener("click",this.initSelectAllCheckbox.bind(this)),this.addEventListener(Qr.ROW_SELECTION_CHANGE,this.syncSelected.bind(this)),this.syncSelected(null),this.lazy){const e=this.tableBody,t=e.rows[0].cells.length,s=e.rows[0];for(let e=0;ee.has(t)));s&&this.dispatchEvent(new CustomEvent(Qr.ROW_SELECTION_CHANGE,{detail:{selection:e,rowsOnPage:this.rowsOnPage,rowCount:this.rowCount}}))}get hiddenInputSelected(){return this.querySelector("input[id$='::selected']")}get lastClickedRowIndex(){return Number(this.dataset.tobagoLastClickedRowIndex)}set lastClickedRowIndex(e){this.dataset.tobagoLastClickedRowIndex=String(e)}get lazy(){return this.hasAttribute("lazy")}set lazy(e){e?this.setAttribute("lazy",""):this.removeAttribute("lazy")}get lazyScrollPosition(){return JSON.parse(this.hiddenInputLazyScrollPosition.value)}set lazyScrollPosition(e){this.hiddenInputLazyScrollPosition.value=JSON.stringify(e)}get hiddenInputLazyScrollPosition(){return this.querySelector("input[id$='::lazyScrollPosition']")}get lazyUpdate(){return this.hasAttribute("lazy-update")}get lazyRows(){return parseInt(this.getAttribute("lazy-rows"))}get first(){return parseInt(this.dataset.tobagoFirst)}get rows(){return parseInt(this.getAttribute("rows"))}get rowCount(){return parseInt(this.getAttribute("row-count"))}get rowsOnPage(){return this.lazy||0===this.rows||this.rows>=this.rowCount?this.rowCount:Math.min(this.rowCount-this.first,this.rows)}get sheetBody(){return this.querySelector(".tobago-body")}get tableBody(){return this.querySelector(".tobago-body tbody")}get firstVisibleRowIndex(){const e=this.tableBody.rows;let t,s=0,i=e.length;for(;sthis.sheetBody.scrollTop?(t--,i=t):s=t;return this.getRowIndex(e[t])}lazyCheck(e){if(this.lazyActive)return;if(this.lastCheckMillis&&Date.now()-this.lastCheckMillis<100)return;this.lastCheckMillis=Date.now();const t=this.nextLazyLoad();if(null!==t){this.lazyActive=!0;const e=this.getRootNode().getElementById(this.id+":pageActionlazy");e.value=String(t+1),console.debug(`reload sheet with action '${e.id}'`),faces.ajax.request(e.id,null,{params:{"jakarta.faces.behavior.event":"lazy","tobago.sheet.lazyFirstRow":t},execute:this.id,render:this.id,onevent:this.lazyResponse.bind(this),onerror:this.lazyError.bind(this)})}}nextLazyLoad(){const e=this.rows>0?this.rows:this.lazyRows,t=this.firstVisibleRowIndex,s=this.tableBody.querySelector(`tr[row-index='${t}']`),i=t+e-1,n=this.getNextDummyRowIndex(s.nextElementSibling,e-1);if(n&&n<=i)return s.hasAttribute("dummy")?t:n;const o=t-e,r=this.getPreviousDummyRowIndex(s,e);if(r&&r>=o){const t=r-e+1;return t>=0?t:0}return null}getNextDummyRowIndex(t,s){return t&&s>0?t.hasAttribute("dummy")?Number(t.getAttribute("row-index")):t.classList.contains(e.TOBAGO_COLUMN_PANEL)?this.getNextDummyRowIndex(t.nextElementSibling,s):this.getNextDummyRowIndex(t.nextElementSibling,--s):null}getPreviousDummyRowIndex(t,s){return t&&s>0?t.hasAttribute("dummy")?Number(t.getAttribute("row-index")):t.classList.contains(e.TOBAGO_COLUMN_PANEL)?this.getPreviousDummyRowIndex(t.previousElementSibling,s):this.getPreviousDummyRowIndex(t.previousElementSibling,--s):null}lazyResponse(t){var s;const i=null===(s=t.responseXML)||void 0===s?void 0:s.querySelectorAll("update");if(i&&"complete"===t.status)for(const e of i){const t=e.getAttribute("id");this.id===t&&(console.debug(`[tobago-sheet][complete] Update after faces.ajax complete: #${t}`),e.id=e.id+oa.SUFFIX_LAZY_UPDATE,this.sheetLoader=document.createElement("div"),this.sheetLoader.innerHTML=e.textContent)}else if(i&&"success"===t.status){for(const t of i){const s=t.getAttribute("id");if(this.id+oa.SUFFIX_LAZY_UPDATE===s){console.debug(`[tobago-sheet][success] Update after faces.ajax complete: #${s}`);const t=this.sheetLoader.querySelectorAll(".tobago-body tbody>tr");for(const s of t){if(s.hasAttribute("row-index")){const e=Number(s.getAttribute("row-index")),t=this.tableBody.querySelector(`tr[row-index='${e}']`),i=t.previousElementSibling;if(null==i){const e=t.parentElement;t.remove(),e.insertAdjacentElement("afterbegin",s)}else t.remove(),i.insertAdjacentElement("afterend",s)}else if(s.classList.contains(e.TOBAGO_COLUMN_PANEL)){const t=Number(s.getAttribute("name")),i=this.tableBody.querySelector(`tr[name='${t}'].${e.TOBAGO_COLUMN_PANEL}`);if(i){const e=i.previousElementSibling;i.remove(),e.insertAdjacentElement("afterend",s)}else{this.tableBody.querySelector(`tr[row-index='${t}']`).insertAdjacentElement("afterend",s)}}this.initSelectionListener(s)}this.sheetLoader.remove()}}const t=this.lazyScrollPosition,s=this.tableBody.querySelector(`tr[row-index='${t[0]}']`);s&&(this.sheetBody.scrollTop=s.offsetTop+t[1]),this.lazyActive=!1}}getRowIndex(t){return t.hasAttribute("row-index")?Number(t.getAttribute("row-index")):t.classList.contains(e.TOBAGO_COLUMN_PANEL)?Number(t.getAttribute("name")):null}lazyError(e){console.error(`Sheet lazy loading error:\nError Name: ${e.errorName}\nError errorMessage: ${e.errorMessage}\nResponse Code: ${e.responseCode}\nResponse Text: ${e.responseText}\nStatus: ${e.status}\nType: ${e.type}`)}loadColumnWidths(){const e=document.getElementById(this.id+"::widths");return e?JSON.parse(e.getAttribute("value")):void 0}saveColumnWidths(e){const t=document.getElementById(this.id+"::widths");t?t.setAttribute("value",JSON.stringify(e)):console.warn("ignored, should not be called, id='%s'",this.id)}isColumnRendered(){const e=document.getElementById(this.id+"::rendered");return JSON.parse(e.getAttribute("value"))}addHeaderFillerWidth(){const e=document.getElementById(this.id).querySelector("tobago-sheet header table col:last-child");e&&e.setAttribute("width",String(oa.SCROLL_BAR_SIZE))}mousedown(e){Ye.page(this).dataset.SheetMousedownData=this.id,console.debug("down");const t=e.currentTarget,s=parseInt(t.dataset.tobagoColumnIndex),i=this.getHeaderCols().item(s);this.mousemoveData={columnIndex:s,originalClientX:e.clientX,originalHeaderColumnWidth:parseInt(i.getAttribute("width")),mousemoveListener:this.mousemove.bind(this),mouseupListener:this.mouseup.bind(this)},document.addEventListener("mousemove",this.mousemoveData.mousemoveListener),document.addEventListener("mouseup",this.mousemoveData.mouseupListener)}mousemove(e){console.debug("move");let t=e.clientX-this.mousemoveData.originalClientX;t=-Math.min(-t,this.mousemoveData.originalHeaderColumnWidth-10);const s=this.mousemoveData.originalHeaderColumnWidth+t;return this.getHeaderCols().item(this.mousemoveData.columnIndex).setAttribute("width",String(s)),this.getBodyCols().item(this.mousemoveData.columnIndex).setAttribute("width",String(s)),window.getSelection&&window.getSelection().removeAllRanges(),!1}mouseup(e){console.debug("up"),document.removeEventListener("mousemove",this.mousemoveData.mousemoveListener),document.removeEventListener("mouseup",this.mousemoveData.mouseupListener);const t=JSON.parse(this.dataset.tobagoLayout).columns,s=this.isColumnRendered(),i=this.loadColumnWidths(),n=this.getBodyTable(),o=this.getHeaderCols(),r=this.getBodyCols(),a=[];let l=0;for(let e=0;e=e)a[e]=i[e];else if("number"==typeof t[e])a[e]=100;else if("object"==typeof t[e]&&void 0!==t[e].measure){const s=parseInt(t[e].measure);t[e].measure.lastIndexOf("px")>0?a[e]=s:t[e].measure.lastIndexOf("%")>0&&(a[e]=parseInt(n.style.width)/100*s)}return this.saveColumnWidths(a),!1}scrollAction(e){this.syncScrolling();const t=e.currentTarget,s=Math.round(t.scrollLeft);if(this.lazy){const e=this.firstVisibleRowIndex,i=this.tableBody.querySelector(`tr[row-index='${e}']`),n=t.scrollTop-i.offsetTop;this.lazyScrollPosition=[e,Math.round(n),s]}else this.scrollPosition=[s,Math.round(t.scrollTop)]}initSelectionListener(t){let s;if(!this.columnSelector||!this.columnSelector.disabled){if([ea.single,ea.singleOrNone,ea.multi].includes(this.selectable))s=t;else if(this.selectable===ea.none&&this.columnSelector&&[ea.single,ea.singleOrNone,ea.multi].includes(this.columnSelector.selectable)&&!t.classList.contains(e.TOBAGO_COLUMN_PANEL))s=t.querySelector("td:first-child"),s.addEventListener("click",(e=>e.stopPropagation()));else if(this.columnSelector&&this.columnSelector.selectable===ea.none){const e=this.columnSelector.rowElement(t);e&&e.addEventListener("click",(e=>e.preventDefault()))}s&&(s.addEventListener("mousedown",(e=>{this.mousedownOnRowData={x:e.clientX,y:e.clientY}})),s.addEventListener("click",(t=>{const s=t.currentTarget.closest("tr");if(this.mousedownOnRowData&&Math.abs(this.mousedownOnRowData.x-t.clientX)+Math.abs(this.mousedownOnRowData.y-t.clientY)>5)return;const i=this.columnSelector?this.columnSelector.selectable:this.selectable,n=t.ctrlKey||t.metaKey,o=t.shiftKey&&this.lastClickedRowIndex>-1,r=(this.columnSelector||i!==ea.single)&&(this.columnSelector||i!==ea.singleOrNone||n)?!this.columnSelector&&i===ea.singleOrNone&&n?ta.ctrlMode_singleOrNone:this.columnSelector||i!==ea.multi||n||o?!this.columnSelector&&i===ea.multi&&n?ta.ctrlMode_multi:!this.columnSelector&&i===ea.multi&&o?ta.shiftMode:this.columnSelector&&i===ea.single?ta.singleMode:this.columnSelector&&i===ea.singleOrNone?ta.ctrlMode_singleOrNone:this.columnSelector&&i===ea.multi&&!o?ta.ctrlMode_multi:this.columnSelector&&i===ea.multi&&o?ta.shiftMode:ta.none:ta.singleMode:ta.singleMode,a=this.selected,l=Number(s.classList.contains(e.TOBAGO_COLUMN_PANEL)?s.getAttribute("name"):s.getAttribute("row-index"));switch(r){case ta.singleMode:a.clear(),a.add(l);break;case ta.ctrlMode_singleOrNone:a.has(l)?a.delete(l):(a.clear(),a.add(l));break;case ta.ctrlMode_multi:a.has(l)?a.delete(l):a.add(l);break;case ta.shiftMode:for(let e=Math.min(l,this.lastClickedRowIndex);e<=Math.max(l,this.lastClickedRowIndex);e++)a.add(e)}this.lastClickedRowIndex=l,this.selected=a})))}}initSelectAllCheckbox(e){const t=this.selected;if(this.lazy||0===this.rows)if(t.size===this.rowCount)t.clear();else for(let e=0;e{t.hasAttribute("row-index")&&e.push(Number(t.getAttribute("row-index")))}));let s=!0;e.forEach(((e,i,n)=>{t.has(e)||(s=!1,t.add(e))})),s&&e.forEach(((e,s,i)=>{t.delete(e)}))}this.selected=t}syncSelected(t){const s=t?t.detail.selection:this.selected;if(this.getRowElements().forEach((t=>{var i;const n=t.classList.contains(e.TOBAGO_COLUMN_PANEL),o=Number(n?t.getAttribute("name"):t.getAttribute("row-index")),r=n?null:null===(i=this.columnSelector)||void 0===i?void 0:i.rowElement(t);s.has(o)?(t.classList.add(e.TOBAGO_SELECTED),t.classList.add(e.TABLE_INFO),r&&(r.checked=!0)):(t.classList.remove(e.TOBAGO_SELECTED),t.classList.remove(e.TABLE_INFO),r&&(r.checked=!1))})),this.columnSelector&&"checkbox"===this.columnSelector.headerElement.type)if(this.lazy||0===this.rows)this.columnSelector.headerElement.checked=s.size===this.rowCount;else{let e=!0;for(let t=this.first;theader")}getHeaderTable(){return this.querySelector("tobago-sheet>header>table")}getHeaderCols(){return this.querySelectorAll("tobago-sheet>header>table>colgroup>col")}getBody(){return this.querySelector("tobago-sheet>.tobago-body")}getBodyTable(){return this.querySelector("tobago-sheet>.tobago-body>table")}getBodyCols(){return this.querySelectorAll("tobago-sheet>.tobago-body>table>colgroup>col")}getHiddenExpanded(){return this.getRootNode().getElementById(this.id+"::expanded")}getRowElements(){return this.getBodyTable().querySelectorAll(":scope > tbody > tr")}}oa.SCROLL_BAR_SIZE=oa.getScrollBarSize(),oa.SUFFIX_LAZY_UPDATE="::lazy-update",document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-sheet")&&window.customElements.define("tobago-sheet",oa)}));class ra extends HTMLElement{constructor(){super();let e=!0,t=!1;for(const s of this.children){if(t){t=!1;continue}if("none"===getComputedStyle(s).display)continue;if(e){e=!1;continue}const i=document.createElement("div");i.classList.add("horizontal"===this.orientation?"tobago-splitLayout-horizontal":"tobago-splitLayout-vertical"),t=!0,i.addEventListener("mousedown",this.start.bind(this)),s.parentElement.insertBefore(i,s)}}static previousElementSibling(e){let t=e.previousElementSibling;for(;null!=t;){if("STYLE"!==t.tagName)return t;t=t.previousElementSibling}return null}get orientation(){return this.getAttribute("orientation")}set orientation(e){this.setAttribute("orientation",e)}start(e){e.preventDefault();const t=e.target,s=ra.previousElementSibling(t);this.offset="horizontal"===this.orientation?e.pageX-s.offsetWidth:e.pageY-s.offsetHeight;const i=aa.save(e,t);document.addEventListener("mousemove",this.move.bind(this)),document.addEventListener("mouseup",this.stop.bind(this));const n=i.previous;"horizontal"===this.orientation?n.style.width=`${n.offsetWidth}px`:n.style.height=`${n.offsetHeight}px`,n.style.flexGrow="inherit",n.style.flexBasis="auto",console.debug("initial width/height = '%s'","horizontal"===this.orientation?n.style.width:n.style.height)}move(e){e.preventDefault();const t=aa.load().previous;t&&("horizontal"===this.orientation?t.style.width=String(e.pageX-this.offset)+"px":t.style.height=String(e.pageY-this.offset)+"px")}stop(e){document.removeEventListener("mousemove",this.move.bind(this)),document.removeEventListener("mouseup",this.stop.bind(this)),aa.remove()}}class aa{constructor(e){e&&(this.data="string"==typeof e?JSON.parse(e):e)}static save(t,s){const i=s.classList.contains(e.TOBAGO_SPLITLAYOUT_HORIZONTAL);ra.previousElementSibling(s);const n={splitLayoutId:s.parentElement.id,horizontal:i,splitterIndex:this.indexOfSplitter(s,i)};return Ye.page(s).dataset.SplitLayoutMousedownData=JSON.stringify(n),new aa(n)}static load(){const e=document.documentElement;return new aa(Ye.page(e).dataset.SplitLayoutMousedownData)}static remove(){const e=document.documentElement;Ye.page(e).dataset.SplitLayoutMousedownData=null}static indexOfSplitter(e,t){const s=e.parentElement.getElementsByClassName(t?"tobago-splitLayout-horizontal":"tobago-splitLayout-vertical");for(let t=0;t0){const e=100*p/u;n.style.width=`${e}%`,o.style.left=`${e}%`,o.style.width=100-e+"%"}else if(h){n.classList.add(e.TOBAGO_PLACEHOLDER);const t=100*h/u;n.style.width=`${t}%`,o.style.left=`${t}%`,o.style.width=100-t+"%"}if(!l&&!c){let e=!1;a.addEventListener("mousedown",(function(t){e=!0})),a.addEventListener("mouseup",(function(t){e=!1,m()})),a.addEventListener("input",(function(e){f()})),a.addEventListener("touchend",(function(e){a.dispatchEvent(new Event("change"))})),a.addEventListener("change",(function(t){e?f():m()})),a.addEventListener("touchstart",g),a.addEventListener("touchmove",g)}function g(e){const t=e.currentTarget,s=parseInt(t.max)/t.offsetWidth*(e.touches[0].pageX-la.leftOffset(a));s>parseInt(t.max)?a.value=t.max:s0?(i.classList.remove(e.TRASH),i.textContent=(5*parseInt(a.value)/u).toFixed(2),r.classList.add(e.SHOW),r.style.width=100*parseInt(a.value)/u+"%"):(i.textContent="",i.classList.add(e.TRASH),h?(r.classList.add(e.SHOW),r.style.width=100*h/u+"%"):r.classList.remove(e.SHOW))}function m(){if(i.classList.remove(e.SHOW),r.classList.remove(e.SHOW),parseInt(a.value)>0){n.classList.remove(e.TOBAGO_PLACEHOLDER);const s=100*parseInt(a.value)/u;n.style.width=`${s}%`,o.style.left=`${s}%`,o.style.width=100-s+"%",t.value=a.value}else{if(h){n.classList.add(e.TOBAGO_PLACEHOLDER);const t=100*h/u;n.style.width=`${t}%`,o.style.left=`${t}%`,o.style.width=100-t+"%"}else n.classList.remove(e.TOBAGO_PLACEHOLDER),n.style.width="",o.style.left="",o.style.width="";t.value=d?"":a.value}}}}document.addEventListener("DOMContentLoaded",(function(e){window.customElements.define("tobago-stars",la)}));class ca extends HTMLElement{constructor(){super(),this.hiddenInput=this.querySelector(":scope > input[type=hidden]")}get switchType(){return this.getAttribute("switch-type")}get tabs(){return this.querySelectorAll(":scope > .card-header > .card-header-tabs > tobago-tab")}getSelectedTab(){return this.querySelector(`:scope > .card-header > .card-header-tabs > tobago-tab[index='${this.selected}']`)}get selected(){return parseInt(this.hiddenInput.value)}set selected(e){this.hiddenInput.value=String(e)}}class da extends HTMLElement{constructor(){super()}connectedCallback(){const t=this.navLink;t.classList.contains(e.DISABLED)||t.addEventListener("click",this.select.bind(this))}get index(){return parseInt(this.getAttribute("index"))}get navLink(){return this.querySelector(".nav-link")}get tabGroup(){return this.closest("tobago-tab-group")}select(t){const s=this.tabGroup,i=s.getSelectedTab();s.selected=this.index;const n=i.index!=this.index;switch(s.switchType){case"client":i.navLink.classList.remove(e.ACTIVE),this.navLink.classList.add(e.ACTIVE),i.content.classList.remove(e.ACTIVE),this.content.classList.add(e.ACTIVE);break;case"reloadTab":case"reloadPage":n&&this.fireTabChangeEvent(s);break;case"none":console.error("Not implemented yet: %s",s.switchType);break;default:console.error("Unknown switchType='%s'",s.switchType)}}fireTabChangeEvent(e){e.dispatchEvent(new CustomEvent(Qr.TAB_CHANGE,{detail:{index:this.index}}))}get content(){return this.closest("tobago-tab-group").querySelector(`:scope > .card-body.tab-content > .tab-pane[data-index='${this.index}']`)}}document.addEventListener("DOMContentLoaded",(function(e){window.customElements.define("tobago-tab",da),window.customElements.define("tobago-tab-group",ca)}));class ua extends HTMLElement{constructor(){super()}connectedCallback(){this.textarea.addEventListener("focus",Ze.setLastFocusId)}get textarea(){return this.getRootNode().getElementById(`${this.id}::field`)}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-textarea")&&window.customElements.define("tobago-textarea",ua)})),function(e){e[e.topLeft=0]="topLeft",e[e.topCenter=1]="topCenter",e[e.topRight=2]="topRight",e[e.middleLeft=3]="middleLeft",e[e.middleCenter=4]="middleCenter",e[e.middleRight=5]="middleRight",e[e.bottomLeft=6]="bottomLeft",e[e.bottomCenter=7]="bottomCenter",e[e.bottomRight=8]="bottomRight"}(sa||(sa={})),function(e){e.created="created",e.showed="showed",e.closed="closed"}(ia||(ia={}));class ha extends HTMLElement{constructor(){super()}get toastStore(){return document.getRootNode().querySelector(".tobago-page-toastStore")}get localToasts(){return this.querySelectorAll(".toast")}get storeToasts(){return this.toastStore.querySelectorAll(".toast[name^='"+this.id+"::']")}get statesInput(){return this.querySelector("input[name='"+this.id+"::states']")}get states(){return new Map(Object.entries(JSON.parse(this.statesInput.value)))}set states(e){this.statesInput.value=JSON.stringify(Object.fromEntries(e))}connectedCallback(){for(const e of this.storeToasts){this.querySelector(".toast[id='"+e.getAttribute("name")+"']")||this.removeToast(e)}for(const e of this.localToasts){const t=this.toastStore.querySelector(".toast[name='"+e.id+"']");t?this.updateToast(t,e):this.showToast(e)}}removeToast(e){const t=new Wo(e,{autohide:!1,delay:0});this.addHiddenEventListeners(e),t.hide()}updateToast(t,s){s.querySelector("."+e.TOAST_HEADER)?t.replaceChildren(s.querySelector("."+e.TOAST_HEADER),s.querySelector("."+e.TOAST_BODY)):t.replaceChildren(s.querySelector("."+e.TOAST_BODY))}showToast(t){const s=sa[t.dataset.tobagoPlacement],i=Number(t.dataset.tobagoDisposeDelay);t.removeAttribute("id"),this.getToastContainer(s).insertAdjacentElement("beforeend",t),this.addShowEventListeners(t),this.addHideEventListeners(t),this.addHiddenEventListeners(t);const n=new Wo(t,{autohide:i>0,delay:Math.max(i,0)}),o=t.getAttribute("name"),r=this.states.get(o);r.state===ia.created?n.show():r.state===ia.showed&&(t.classList.add(e.SHOW),t.classList.add(e.FADE),i>=0&&setTimeout((()=>{n.hide()}),i))}addShowEventListeners(e){const t=e.getAttribute("name");e.addEventListener("show.bs.toast",(()=>{const e=this.states;e.get(t).state=ia.showed,this.states=e,faces.ajax.request(this.id,null,{params:{"jakarta.faces.behavior.event":"toastShown"},execute:this.id})}))}addHideEventListeners(e){const t=e.getAttribute("name");e.addEventListener("hide.bs.toast",(()=>{const e=this.states;e.get(t).state=ia.closed,this.states=e,faces.ajax.request(this.id,null,{params:{"jakarta.faces.behavior.event":"toastHide"},execute:this.id})}))}addHiddenEventListeners(e){e.addEventListener("hidden.bs.toast",(()=>{e.remove()}))}getToastContainer(e){const t=this.getToastContainerCssClass(e),s=t.join("."),i=this.toastStore.querySelector("."+s);if(i)return i;{const e=document.createElement("div");for(const s of t)e.classList.add(s);return this.toastStore.insertAdjacentElement("beforeend",e)}}getToastContainerCssClass(t){const s=[];switch(s.push(e.TOAST_CONTAINER),s.push(e.POSITION_FIXED),s.push(e.P_3),t){case sa.topLeft:case sa.topCenter:case sa.topRight:s.push(e.TOP_0);break;case sa.middleLeft:case sa.middleCenter:case sa.middleRight:s.push(e.TOP_50);break;case sa.bottomLeft:case sa.bottomCenter:case sa.bottomRight:s.push(e.BOTTOM_0)}switch(t){case sa.topLeft:case sa.middleLeft:case sa.bottomLeft:s.push(e.START_0);break;case sa.topCenter:case sa.middleCenter:case sa.bottomCenter:s.push(e.START_50);break;case sa.topRight:case sa.middleRight:case sa.bottomRight:s.push(e.END_0)}switch(t){case sa.topCenter:case sa.bottomCenter:s.push(e.TRANSLATE_MIDDLE_X);break;case sa.middleLeft:case sa.middleRight:s.push(e.TRANSLATE_MIDDLE_Y);break;case sa.middleCenter:s.push(e.TRANSLATE_MIDDLE)}return s}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-toasts")&&window.customElements.define("tobago-toasts",ha)}));class pa extends HTMLElement{constructor(){super()}clearSelectedNodes(){this.hiddenInputSelected.value="[]"}addSelectedNode(e){const t=new Set(JSON.parse(this.hiddenInputSelected.value));t.add(e),this.hiddenInputSelected.value=JSON.stringify(Array.from(t))}deleteSelectedNode(e){const t=new Set(JSON.parse(this.hiddenInputSelected.value));t.delete(e),this.hiddenInputSelected.value=JSON.stringify(Array.from(t))}getSelectedNodes(){const e=[];for(const t of JSON.parse(this.hiddenInputSelected.value))e.length>0&&e.push(", "),e.push("tobago-tree-node[index='"),e.push(t),e.push("']");return e.length>0?this.querySelectorAll(e.join("")):null}get hiddenInputSelected(){return this.querySelector(":scope > input[type=hidden].tobago-selected")}clearExpandedNodes(){this.hiddenInputExpanded.value="[]"}addExpandedNode(e){const t=new Set(JSON.parse(this.hiddenInputExpanded.value));t.add(e),this.hiddenInputExpanded.value=JSON.stringify(Array.from(t))}deleteExpandedNode(e){const t=new Set(JSON.parse(this.hiddenInputExpanded.value));t.delete(e),this.hiddenInputExpanded.value=JSON.stringify(Array.from(t))}get hiddenInputExpanded(){return this.querySelector(":scope > input[type=hidden].tobago-expanded")}get selectable(){return ea[this.getAttribute("selectable")]}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-tree")&&window.customElements.define("tobago-tree",pa)}));class ga extends HTMLElement{constructor(){super()}connectedCallback(){this.applySelected();for(const e of this.listboxes)e.disabled||e.addEventListener("change",this.select.bind(this))}select(e){const t=e.currentTarget;this.unselectDescendants(t),this.setSelected(),this.applySelected()}unselectDescendants(e){let t=!1;for(const s of this.listboxes)if(t){const e=s.querySelector("option:checked");e&&(e.selected=!1)}else s.id===e.id&&(t=!0)}setSelected(){const e=[];for(const t of this.levelElements){const s=t.querySelector(".tobago-selected:not(.d-none) option:checked");s&&e.push(s.index)}this.hiddenInput.value=JSON.stringify(e)}applySelected(){const e=JSON.parse(this.hiddenInput.value);let t=this.querySelector(".tobago-selected");const s=this.levelElements;for(let i=0;ie.addEventListener("click",this.toggleNode.bind(this))))}toggleNode(t){if(this.expanded){for(const e of this.icons)e.classList.remove(e.dataset.tobagoOpen),e.classList.add(e.dataset.tobagoClosed);for(const e of this.images)e.dataset.tobagoClosed?e.src=e.dataset.tobagoClosed:e.src=e.dataset.tobagoOpen;this.deleteExpandedNode(this.index),this.classList.remove(e.TOBAGO_EXPANDED),this.hideNodes(this.treeChildNodes),this.tree?this.ajax(t,this.tree.id,!1):this.sheet&&this.ajax(t,this.sheet.id,!1)}else{for(const e of this.icons)e.classList.remove(e.dataset.tobagoClosed),e.classList.add(e.dataset.tobagoOpen);for(const e of this.images)e.dataset.tobagoOpen?e.src=e.dataset.tobagoOpen:e.src=e.dataset.tobagoClosed;this.addExpandedNode(this.index),this.classList.add(e.TOBAGO_EXPANDED),this.showNodes(this.treeChildNodes),this.tree?this.ajax(t,this.tree.id,0===this.treeChildNodes.length):this.sheet&&this.ajax(t,this.sheet.id,0===this.treeChildNodes.length)}}ajax(e,t,s){faces.ajax.request(this.id,e,{params:{"jakarta.faces.behavior.event":"change"},execute:t,render:s?t:null})}hideNodes(t){for(const s of t)s.sheet?s.closest("tr").classList.add(e.D_NONE):s.classList.add(e.D_NONE),this.hideNodes(s.treeChildNodes)}showNodes(t){for(const s of t)s.sheet?s.closest("tr").classList.remove(e.D_NONE):s.classList.remove(e.D_NONE),this.showNodes(s.treeChildNodes)}addExpandedNode(e){const t=new Set(JSON.parse(this.hiddenInputExpanded.value));t.add(e),this.hiddenInputExpanded.value=JSON.stringify(Array.from(t))}deleteExpandedNode(e){const t=new Set(JSON.parse(this.hiddenInputExpanded.value));t.delete(e),this.hiddenInputExpanded.value=JSON.stringify(Array.from(t))}get tree(){return this.closest("tobago-tree")}get sheet(){return this.closest("tobago-sheet")}get expandable(){return"expandable"===this.getAttribute("expandable")}get expanded(){for(const e of this.expandedNodes)if(e===this.index)return!0;return!1}get expandedNodes(){return new Set(JSON.parse(this.hiddenInputExpanded.value))}get hiddenInputExpanded(){return this.tree?this.tree.hiddenInputExpanded:this.sheet?this.sheet.getHiddenExpanded():(console.error("Cannot detect 'tobago-tree' or 'tobago-sheet'."),null)}get treeChildNodes(){return this.sheet?this.closest("tbody").querySelectorAll(`tobago-tree-node[parent='${this.id}']`):this.tree?this.parentElement.querySelectorAll(`tobago-tree-node[parent='${this.id}']`):(console.error("Cannot detect 'tobago-tree' or 'tobago-sheet'."),null)}get toggles(){return this.querySelectorAll(".tobago-toggle")}get icons(){return this.querySelectorAll(".tobago-toggle i")}get images(){return this.querySelectorAll(".tobago-toggle img")}get index(){return Number(this.getAttribute("index"))}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-tree-node")&&window.customElements.define("tobago-tree-node",fa)}));class ma extends HTMLElement{constructor(){super()}connectedCallback(){this.input&&this.input.addEventListener("change",this.select.bind(this))}select(e){switch(this.input.type){case"radio":this.tree.clearSelectedNodes(),this.tree.addSelectedNode(this.treeNode.index);break;case"checkbox":if(this.input.checked?this.tree.addSelectedNode(this.treeNode.index):this.tree.deleteSelectedNode(this.treeNode.index),this.tree.selectable===ea.multiCascade){const e=[];this.selectChildren(this.treeSelectChildren,this.input.checked,e)}}}selectChildren(e,t,s){for(const i of e)i.input.checked!==t&&(i.input.checked=t,s.push(i.treeNode.id)),t?this.tree.addSelectedNode(i.treeNode.index):this.tree.deleteSelectedNode(i.treeNode.index),this.selectChildren(i.treeSelectChildren,t,s)}get tree(){return this.treeNode.tree}get treeNode(){return this.closest("tobago-tree-node")}get treeSelectChildren(){const e=this.closest("tobago-tree-node");return e.parentElement.querySelectorAll(`tobago-tree-node[parent='${e.id}'] tobago-tree-select`)}get input(){return this.querySelector("input")}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-tree-select")&&window.customElements.define("tobago-tree-select",ma)}));class ba extends HTMLElement{constructor(){super()}connectedCallback(){switch(this.event){case"load":this.callback();break;case"resize":document.body.addEventListener(this.event,this.callback.bind(this));break;default:{const e=this.eventElement;this.eventListener=this.callback.bind(this),e?e.addEventListener(this.event,this.eventListener):(this.parentElement.addEventListener(this.event,this.eventListener),console.warn("Can't find an element for the event. Use parentElement instead.",this))}}}disconnectedCallback(){const e=this.eventElement;e?e.removeEventListener(this.event,this.eventListener):this.parentElement.removeEventListener(this.event,this.eventListener)}callback(e){if(this.stopPropagation&&e.stopPropagation(),!this.confirmation||window.confirm(this.confirmation)){switch(this.mode){case Jo.ajax:if(!this.validate(this.execute))return void console.warn("Validation failed! No request will be sent.");case Jo.full:}if(e&&e.currentTarget.dispatchEvent(new CustomEvent(this.customEventName,{bubbles:!0})),this.collapseOperation&&this.collapseTarget){const e=this.getRootNode();Qo.execute(this.collapseOperation,e.getElementById(this.collapseTarget),this.mode)}switch(this.mode){case Jo.ajax:if(this.render){const e=this.render.split(" ");for(const t of e){const e=document.getElementById(t);if(e){let t;t="TOBAGO-POPUP"===e.tagName?e.querySelector(".modal-dialog").id:e.id,e.insertAdjacentHTML("beforeend",Je.htmlText(t,Ge.ajax,Ye.page(this).waitOverlayDelayAjax))}else console.warn("No element found by id='%s' for overlay!",t)}}faces.ajax.request(this.actionElement,e,{params:{"jakarta.faces.behavior.event":this.event},execute:this.execute,render:this.render,resetValues:this.resetValues,delay:this.delay,onevent:e=>{console.debug(`Status: ${e.status} - Type: ${e.type}`)},myfaces:{upload:{progress:(e,t)=>{console.debug(`progress: ${t.loaded} of ${t.total}`)},preinit:e=>{console.debug("preinit")},loadstart:(e,t)=>{console.debug(`loadstart: ${t.loaded} of ${t.total}`)},load:(e,t)=>{console.debug(`load: ${t.loaded} of ${t.total}`)},loadend:(e,t)=>{console.debug(`loadend: ${t.loaded} of ${t.total}`)},error:(e,t)=>{console.debug(`error: ${t.loaded} of ${t.total}`)},abort:(e,t)=>{console.debug(`abort: ${t.loaded} of ${t.total}`)},timeout:(e,t)=>{console.debug(`timeout: ${t.loaded} of ${t.total}`)}}}});break;case Jo.full:setTimeout(this.submit.bind(this),this.delay)}}else null==e||e.preventDefault()}submit(){console.info("Execute submit!");const e=Ye.page(this);if(!e.submitActive){e.submitActive=!0;const t=null!=this.fieldId?this.fieldId:this.clientId,s=e.form,i=s.getAttribute("target"),n=document.getElementById("jakarta.faces.source");n.disabled=!1,n.value=t,null!=this.target&&s.setAttribute("target",this.target),e.beforeSubmit(null,this.decoupled||null!=this.target);try{s.submit(),n.disabled=!0,n.value=""}catch(t){console.error("Submit failed!",t);this.closest("body").querySelector(`tobago-overlay[for='${e.id}']`).remove(),e.submitActive=!1,alert("Submit failed!")}this.target&&(i?s.setAttribute("target",i):s.removeAttribute("target")),(this.target||this.decoupled)&&(e.submitActive=!1)}}validate(e){let t=!0;if(e){console.debug("Is all valid? ids=",e);for(const s of e.split(/\s+/)){const e=document.getElementById(s);if(e){const s=e.querySelectorAll("input[type=file]");for(const e of s)e.checkValidity()?console.debug("valid",e.id):(console.debug("invalid",e.id),t=!1)}}return console.debug("Is all valid?",t),t}}get mode(){return this.render||this.execute?Jo.ajax:this.omit?Jo.client:Jo.full}get event(){return this.getAttribute("event")}set event(e){this.setAttribute("event",e)}get clientId(){return this.getAttribute("client-id")}set clientId(e){this.setAttribute("client-id",e)}get fieldId(){return this.getAttribute("field-id")}set fieldId(e){this.setAttribute("field-id",e)}get execute(){return this.getAttribute("execute")}set execute(e){this.setAttribute("execute",e)}get render(){return this.getAttribute("render")}set render(e){this.setAttribute("render",e)}get delay(){return parseInt(this.getAttribute("delay"))||0}set delay(e){this.setAttribute("delay",String(e))}get omit(){return this.hasAttribute("omit")}set omit(e){e?this.setAttribute("omit",""):this.removeAttribute("omit")}get resetValues(){return this.hasAttribute("reset-values")}set resetValues(e){e?this.setAttribute("reset-values",""):this.removeAttribute("reset-values")}get target(){return this.getAttribute("target")}set target(e){this.setAttribute("target",e)}get confirmation(){return this.getAttribute("confirmation")}set confirmation(e){this.setAttribute("confirmation",e)}get collapseOperation(){return Ko[this.getAttribute("collapse-operation")]}set collapseOperation(e){this.setAttribute("collapse-operation",Ko[e])}get collapseTarget(){return this.getAttribute("collapse-target")}set collapseTarget(e){this.setAttribute("collapse-target",e)}get decoupled(){return this.hasAttribute("decoupled")}set decoupled(e){e?this.setAttribute("decoupled",""):this.removeAttribute("decoupled")}get stopPropagation(){return this.hasAttribute("stop-propagation")}get customEventName(){return this.getAttribute("custom-event-name")}get actionElement(){const e=this.getRootNode(),t=this.clientId;return e.getElementById(t)}get eventElement(){const e=this.getRootNode();if(e instanceof Document||e instanceof ShadowRoot){const t=this.fieldId?this.fieldId:this.clientId;let s=e.getElementById(t);return null==s&&"TD"===this.parentElement.tagName&&(s=this.parentElement.parentElement),s}return null}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-behavior")&&window.customElements.define("tobago-behavior",ba)}));try{document.querySelector(":scope")}catch(va){const _a=wa(Element.prototype.querySelector);Element.prototype.querySelector=function(e){return _a.apply(this,arguments)};const ya=wa(Element.prototype.querySelectorAll);if(Element.prototype.querySelectorAll=function(e){return ya.apply(this,arguments)},Element.prototype.matches){const Ea=wa(Element.prototype.matches);Element.prototype.matches=function(e){return Ea.apply(this,arguments)}}if(Element.prototype.closest){const Aa=wa(Element.prototype.closest);Element.prototype.closest=function(e){return Aa.apply(this,arguments)}}function wa(e){const t=/:scope(?![\w-])/gi;return function(s){if(s.toLowerCase().indexOf(":scope")>=0){const i="tobagoScopeAttribute";arguments[0]=s.replace(t,`[${i}]`),this.setAttribute(i,"");const n=e.apply(this,arguments);return this.removeAttribute(i),n}return e.apply(this,arguments)}}}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(e=>{document.dispatchEvent(new CustomEvent("tobago.init"))})):document.dispatchEvent(new CustomEvent("tobago.init"))})); + @blur="${this.blurEvent.bind(this)}">`}removeBadge(e){var t;const s=e.target.closest(".btn-group").dataset.tobagoValue,i=this.hiddenSelect.querySelector(`[value="${s}"]`);i.selected=!1;const n=this.badges.querySelector(`[data-tobago-value="${s}"]`),o=n.previousElementSibling,r="SPAN"===(null===(t=n.nextElementSibling)||void 0===t?void 0:t.tagName)?n.nextElementSibling:null;o?o.querySelector("button.btn.badge").focus():r?r.querySelector("button.btn.badge").focus():(this.filterInput.disabled=!1,this.filterInput.focus()),this.sync(i),this.hiddenSelect.dispatchEvent(new Event("change",{bubbles:!0}))}leaveComponent(){this.focused=!1,this.filterInput.value=null,this.filterInput.dispatchEvent(new Event("input")),this.hideDropdown()}isDeleted(e){return null===e.closest("html")}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-many-list")&&window.customElements.define("tobago-select-many-list",Vr)}));class Yr extends HTMLElement{constructor(){super()}connectedCallback(){this.saveSelection(),this.field.addEventListener("click",this.clickSelection.bind(this)),this.field.addEventListener("focus",Ze.setLastFocusId)}clickSelection(e){e.currentTarget.required||this.field.selectedIndex!==this.oldselectedIndex||(this.field.selectedIndex=-1),this.saveSelection()}saveSelection(){this.oldselectedIndex=this.field.selectedIndex}get field(){return this.getRootNode().getElementById(this.id+"::field")}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-one-listbox")&&window.customElements.define("tobago-select-one-listbox",Yr)}));class Xr extends Yr{}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-many-listbox")&&window.customElements.define("tobago-select-many-listbox",Xr)}));class Jr extends HTMLElement{constructor(){super()}connectedCallback(){this.unselectedSelect.onchange=e=>e.stopPropagation(),this.selectedSelect.onchange=e=>e.stopPropagation(),this.unselectedSelect.addEventListener("focus",Ze.setLastFocusId),this.selectedSelect.addEventListener("focus",Ze.setLastFocusId),"readonly"===this.unselectedSelect.getAttribute("readonly")||this.unselectedSelect.disabled||this.unselectedSelect.addEventListener("dblclick",this.addSelectedItems.bind(this)),"readonly"===this.selectedSelect.getAttribute("readonly")||this.selectedSelect.disabled||this.selectedSelect.addEventListener("dblclick",this.removeSelectedItems.bind(this)),this.addAllButton.disabled||this.addAllButton.addEventListener("click",this.addAllItems.bind(this)),this.addButton.disabled||this.addButton.addEventListener("click",this.addSelectedItems.bind(this)),this.removeButton.disabled||this.removeButton.addEventListener("click",this.removeSelectedItems.bind(this)),this.removeAllButton.disabled||this.removeAllButton.addEventListener("click",this.removeAllItems.bind(this))}addAllItems(e){this.addItems(this.unselectedSelect.querySelectorAll("option:not(:disabled)"))}addSelectedItems(e){this.addItems(this.unselectedSelect.querySelectorAll("option:checked"))}removeSelectedItems(e){this.removeItems(this.selectedSelect.querySelectorAll("option:checked"))}removeAllItems(e){this.removeItems(this.selectedSelect.querySelectorAll("option:not(:disabled)"))}addItems(e){for(const t of e)this.selectedSelect.add(t),this.changeHiddenOption(t,!0)}removeItems(e){for(const t of e)this.unselectedSelect.add(t),this.changeHiddenOption(t,!1)}changeHiddenOption(e,t){this.hiddenSelect.querySelector(`option[value='${e.value}']`).selected=t,this.dispatchEvent(new Event("change"))}get unselectedSelect(){return this.querySelector(".tobago-unselected")}get selectedSelect(){return this.querySelector(".tobago-selected")}get hiddenSelect(){return this.querySelector("select.d-none")}get addAllButton(){return this.querySelector(".btn-group-vertical button:nth-child(1)")}get addButton(){return this.querySelector(".btn-group-vertical button:nth-child(2)")}get removeButton(){return this.querySelector(".btn-group-vertical button:nth-child(3)")}get removeAllButton(){return this.querySelector(".btn-group-vertical button:nth-child(4)")}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-many-shuttle")&&window.customElements.define("tobago-select-many-shuttle",Jr)}));class Kr extends HTMLElement{constructor(){super()}connectedCallback(){this.field.addEventListener("focus",Ze.setLastFocusId)}get field(){return this.getRootNode().getElementById(this.id+"::field")}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-one-choice")&&window.customElements.define("tobago-select-one-choice",Kr)}));class Zr extends dr{constructor(){super()}get spanText(){return this.selectField.querySelector("span").textContent}set spanText(e){this.selectField.querySelector("span").textContent=e}get selectedOption(){const e=this.hiddenSelect.value;return this.hiddenSelect.querySelector(`[value="${e}"]`)}connectedCallback(){super.connectedCallback(),this.selectField.addEventListener("keydown",this.keydownEvent.bind(this)),this.filter&&this.filterInput.addEventListener("input",this.clearSpan.bind(this)),this.sync()}globalClickEvent(e){this.disabled||(this.isPartOfSelectField(e.target)?(this.filterInput.disabled||this.filterInput.focus(),this.showDropdown()):this.isPartOfTobagoOptions(e.target)?(this.filterInput.disabled||this.filterInput.focus(),this.hideDropdown()):this.leaveComponent())}labelClickEvent(e){e.stopPropagation(),this.filterInput.disabled||this.filterInput.focus()}keydownEvent(e){switch(e.key){case t.ESCAPE:this.spanText=this.selectedOption.textContent;break;case t.BACKSPACE:0===this.filterInput.value.length&&this.filterInput.dispatchEvent(new Event("input"))}}clearSpan(){this.spanText=null}select(e){const t=e.dataset.tobagoValue;this.hiddenSelect.querySelector(`[value="${t}"]`).selected=!0,this.filterInput.value=null,this.sync(),this.hiddenSelect.dispatchEvent(new Event("change",{bubbles:!0}))}sync(){this.rows.forEach((t=>{t.dataset.tobagoValue===this.hiddenSelect.value?(this.spanText=this.selectedOption.textContent,t.classList.add(e.TABLE_PRIMARY)):t.classList.remove(e.TABLE_PRIMARY)}))}leaveComponent(){this.focused=!1,this.filterInput.value=null,this.filterInput.dispatchEvent(new Event("input")),this.spanText=this.selectedOption.textContent,this.hideDropdown()}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-one-list")&&window.customElements.define("tobago-select-one-list",Zr)}));class Qr extends HTMLElement{constructor(){super(),this.oldCheckedId=""}connectedCallback(){this.saveSelection();for(const e of this.radioGroup)e.addEventListener("focus",Ze.setLastFocusId),e.addEventListener("click",this.clickSelection.bind(this)),e.addEventListener("keydown",this.keySelection.bind(this))}clickSelection(e){const t=e.currentTarget;t.readOnly?this.revertSelection():t.disabled||t.required||t.id!==this.oldCheckedId||(t.checked=!1,this.oldCheckedId=""),this.saveSelection()}keySelection(e){e.key===t.SPACE&&e.preventDefault();const s=e.currentTarget;s.readOnly?this.revertSelection():s.disabled||s.required||" "!==e.key||(s.checked=!s.checked),this.saveSelection()}revertSelection(){for(const e of this.radioGroup)e.checked=e.id===this.oldCheckedId}saveSelection(){for(const e of this.radioGroup)e.checked&&(this.oldCheckedId=e.id)}get radioGroup(){return this.querySelectorAll(`input[type='radio'][name='${this.id}']`)}}var ea,ta,sa,ia,na;document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-select-one-radio")&&window.customElements.define("tobago-select-one-radio",Qr)})),function(e){e.ACTION="action",e.BLUR="blur",e.CHANGE="change",e.CLICK="click",e.COMPLETE="complete",e.DBLCLICK="dblclick",e.FOCUS="focus",e.KEYDOWN="keydown",e.KEYPRESS="keypress",e.KEYUP="keyup",e.INPUT="input",e.LOAD="load",e.MOUSEOVER="mouseover",e.MOUSEOUT="mouseout",e.RELOAD="reload",e.RESIZE="resize",e.SUGGEST="suggest",e.ROW_SELECTION_CHANGE="tobago.sheet.rowSelectionChange",e.TAB_CHANGE="tobago.tabGroup.tabChange"}(ea||(ea={})),function(e){e[e.none=0]="none",e[e.multi=1]="multi",e[e.single=2]="single",e[e.singleOrNone=3]="singleOrNone",e[e.multiLeafOnly=4]="multiLeafOnly",e[e.singleLeafOnly=5]="singleLeafOnly",e[e.sibling=6]="sibling",e[e.siblingLeafOnly=7]="siblingLeafOnly",e[e.multiCascade=8]="multiCascade"}(ta||(ta={}));class oa{constructor(e){this.sheet=e}get headerElement(){return this.sheet.querySelector("thead input.tobago-selected[name='"+this.sheet.id+"::columnSelector']")}get selectable(){return ta[this.headerElement.dataset.tobagoSelectionMode]}rowElement(e){return e.querySelector("td:first-child > input.tobago-selected")}get disabled(){const e=this.sheet.querySelector("tr[row-index] input[name^='"+this.sheet.id+"_data_row_selector']");return e&&e.disabled}}!function(e){e[e.none=0]="none",e[e.singleMode=1]="singleMode",e[e.ctrlMode_singleOrNone=2]="ctrlMode_singleOrNone",e[e.ctrlMode_multi=3]="ctrlMode_multi",e[e.shiftMode=4]="shiftMode"}(sa||(sa={}));class ra extends HTMLElement{constructor(){super()}static getScrollBarSize(){const e=document.getElementsByTagName("body").item(0),t=document.createElement("div");t.style.visibility="hidden",t.style.width="100px",t.style.overflow="scroll",e.append(t);const s=document.createElement("div");s.style.width="100%",t.append(s);const i=s.offsetWidth;return e.removeChild(t),100-i}static getDummyRowTemplate(e,t){return`\n \n`}connectedCallback(){this.querySelector("thead input.tobago-selected[name='"+this.id+"::columnSelector']")&&(this.columnSelector=new oa(this));const e=this.loadColumnWidths();if(console.info("columnWidths: %s",JSON.stringify(e)),e&&0===e.length){let e=JSON.parse(this.dataset.tobagoLayout).columns;const t=this.isColumnRendered(),s=this.getHeaderCols(),i=this.getBodyTable(),n=this.getBodyCols(),o=Number(getComputedStyle(i.querySelector("td:first-child")).borderLeftWidth.slice(0,-2)),r=Number(getComputedStyle(i.querySelector("td:last-child")).borderRightWidth.slice(0,-2)),a=i.offsetWidth-(o+r)/2;for(console.assert(s.length-1===n.length,"header and body column number doesn't match: %d != %d ",s.length-1,n.length);e.length0?c-=t:e[i].measure.lastIndexOf("%")>0&&(c-=a*t/100)}else if("auto"===e[i]){const t=s.item(d).offsetWidth;c-=t,e[i]={measure:`${t}px`}}else console.debug("(layout columns a) auto? token[i]='%s' i=%i",e[i],i);c<0&&(c=0),d=0;for(let i=0;i0?o=t:e[i].measure.lastIndexOf("%")>0&&(o=a*t/100)}else console.debug("(layout columns b) auto? token[i]='%s' i=%i",e[i],i);o>0&&(s.item(d).setAttribute("width",String(o)),n.item(d).setAttribute("width",String(o))),d++}}}this.addHeaderFillerWidth();for(const e of this.querySelectorAll(".tobago-resize"))e.addEventListener("click",(function(){return!1})),e.addEventListener("mousedown",this.mousedown.bind(this));const t=this.getBody();if(!this.lazy){const e=this.scrollPosition;t.scrollLeft=e[0],t.scrollTop=e[1]}if(this.syncScrolling(),t.addEventListener("scroll",this.scrollAction.bind(this)),this.getRowElements().forEach((e=>this.initSelectionListener(e))),this.columnSelector&&"checkbox"===this.columnSelector.headerElement.type&&this.columnSelector.headerElement.addEventListener("click",this.initSelectAllCheckbox.bind(this)),this.addEventListener(ea.ROW_SELECTION_CHANGE,this.syncSelected.bind(this)),this.syncSelected(null),this.lazy){const e=this.tableBody,t=e.rows[0].cells.length,s=e.rows[0];for(let e=0;ee.has(t)));s&&this.dispatchEvent(new CustomEvent(ea.ROW_SELECTION_CHANGE,{detail:{selection:e,rowsOnPage:this.rowsOnPage,rowCount:this.rowCount}}))}get hiddenInputSelected(){return this.querySelector("input[id$='::selected']")}get lastClickedRowIndex(){return Number(this.dataset.tobagoLastClickedRowIndex)}set lastClickedRowIndex(e){this.dataset.tobagoLastClickedRowIndex=String(e)}get lazy(){return this.hasAttribute("lazy")}set lazy(e){e?this.setAttribute("lazy",""):this.removeAttribute("lazy")}get lazyScrollPosition(){return JSON.parse(this.hiddenInputLazyScrollPosition.value)}set lazyScrollPosition(e){this.hiddenInputLazyScrollPosition.value=JSON.stringify(e)}get hiddenInputLazyScrollPosition(){return this.querySelector("input[id$='::lazyScrollPosition']")}get lazyUpdate(){return this.hasAttribute("lazy-update")}get lazyRows(){return parseInt(this.getAttribute("lazy-rows"))}get first(){return parseInt(this.dataset.tobagoFirst)}get rows(){return parseInt(this.getAttribute("rows"))}get rowCount(){return parseInt(this.getAttribute("row-count"))}get rowsOnPage(){return this.lazy||0===this.rows||this.rows>=this.rowCount?this.rowCount:Math.min(this.rowCount-this.first,this.rows)}get sheetBody(){return this.querySelector(".tobago-body")}get tableBody(){return this.querySelector(".tobago-body tbody")}get firstVisibleRowIndex(){const e=this.tableBody.rows;let t,s=0,i=e.length;for(;sthis.sheetBody.scrollTop?(t--,i=t):s=t;return this.getRowIndex(e[t])}lazyCheck(e){if(this.lazyActive)return;if(this.lastCheckMillis&&Date.now()-this.lastCheckMillis<100)return;this.lastCheckMillis=Date.now();const t=this.nextLazyLoad();if(null!==t){this.lazyActive=!0;const e=this.getRootNode().getElementById(this.id+":pageActionlazy");e.value=String(t+1),console.debug(`reload sheet with action '${e.id}'`),faces.ajax.request(e.id,null,{params:{"jakarta.faces.behavior.event":"lazy","tobago.sheet.lazyFirstRow":t},execute:this.id,render:this.id,onevent:this.lazyResponse.bind(this),onerror:this.lazyError.bind(this)})}}nextLazyLoad(){const e=this.rows>0?this.rows:this.lazyRows,t=this.firstVisibleRowIndex,s=this.tableBody.querySelector(`tr[row-index='${t}']`),i=t+e-1,n=this.getNextDummyRowIndex(s.nextElementSibling,e-1);if(n&&n<=i)return s.hasAttribute("dummy")?t:n;const o=t-e,r=this.getPreviousDummyRowIndex(s,e);if(r&&r>=o){const t=r-e+1;return t>=0?t:0}return null}getNextDummyRowIndex(t,s){return t&&s>0?t.hasAttribute("dummy")?Number(t.getAttribute("row-index")):t.classList.contains(e.TOBAGO_COLUMN_PANEL)?this.getNextDummyRowIndex(t.nextElementSibling,s):this.getNextDummyRowIndex(t.nextElementSibling,--s):null}getPreviousDummyRowIndex(t,s){return t&&s>0?t.hasAttribute("dummy")?Number(t.getAttribute("row-index")):t.classList.contains(e.TOBAGO_COLUMN_PANEL)?this.getPreviousDummyRowIndex(t.previousElementSibling,s):this.getPreviousDummyRowIndex(t.previousElementSibling,--s):null}lazyResponse(t){var s;const i=null===(s=t.responseXML)||void 0===s?void 0:s.querySelectorAll("update");if(i&&"complete"===t.status)for(const e of i){const t=e.getAttribute("id");this.id===t&&(console.debug(`[tobago-sheet][complete] Update after faces.ajax complete: #${t}`),e.id=e.id+ra.SUFFIX_LAZY_UPDATE,this.sheetLoader=document.createElement("div"),this.sheetLoader.innerHTML=e.textContent)}else if(i&&"success"===t.status){for(const t of i){const s=t.getAttribute("id");if(this.id+ra.SUFFIX_LAZY_UPDATE===s){console.debug(`[tobago-sheet][success] Update after faces.ajax complete: #${s}`);const t=this.sheetLoader.querySelectorAll(".tobago-body tbody>tr");for(const s of t){if(s.hasAttribute("row-index")){const e=Number(s.getAttribute("row-index")),t=this.tableBody.querySelector(`tr[row-index='${e}']`),i=t.previousElementSibling;if(null==i){const e=t.parentElement;t.remove(),e.insertAdjacentElement("afterbegin",s)}else t.remove(),i.insertAdjacentElement("afterend",s)}else if(s.classList.contains(e.TOBAGO_COLUMN_PANEL)){const t=Number(s.getAttribute("name")),i=this.tableBody.querySelector(`tr[name='${t}'].${e.TOBAGO_COLUMN_PANEL}`);if(i){const e=i.previousElementSibling;i.remove(),e.insertAdjacentElement("afterend",s)}else{this.tableBody.querySelector(`tr[row-index='${t}']`).insertAdjacentElement("afterend",s)}}this.initSelectionListener(s)}this.sheetLoader.remove()}}const t=this.lazyScrollPosition,s=this.tableBody.querySelector(`tr[row-index='${t[0]}']`);s&&(this.sheetBody.scrollTop=s.offsetTop+t[1]),this.lazyActive=!1}}getRowIndex(t){return t.hasAttribute("row-index")?Number(t.getAttribute("row-index")):t.classList.contains(e.TOBAGO_COLUMN_PANEL)?Number(t.getAttribute("name")):null}lazyError(e){console.error(`Sheet lazy loading error:\nError Name: ${e.errorName}\nError errorMessage: ${e.errorMessage}\nResponse Code: ${e.responseCode}\nResponse Text: ${e.responseText}\nStatus: ${e.status}\nType: ${e.type}`)}loadColumnWidths(){const e=document.getElementById(this.id+"::widths");return e?JSON.parse(e.getAttribute("value")):void 0}saveColumnWidths(e){const t=document.getElementById(this.id+"::widths");t?t.setAttribute("value",JSON.stringify(e)):console.warn("ignored, should not be called, id='%s'",this.id)}isColumnRendered(){const e=document.getElementById(this.id+"::rendered");return JSON.parse(e.getAttribute("value"))}addHeaderFillerWidth(){const e=document.getElementById(this.id).querySelector("tobago-sheet header table col:last-child");e&&e.setAttribute("width",String(ra.SCROLL_BAR_SIZE))}mousedown(e){Ye.page(this).dataset.SheetMousedownData=this.id,console.debug("down");const t=e.currentTarget,s=parseInt(t.dataset.tobagoColumnIndex),i=this.getHeaderCols().item(s);this.mousemoveData={columnIndex:s,originalClientX:e.clientX,originalHeaderColumnWidth:parseInt(i.getAttribute("width")),mousemoveListener:this.mousemove.bind(this),mouseupListener:this.mouseup.bind(this)},document.addEventListener("mousemove",this.mousemoveData.mousemoveListener),document.addEventListener("mouseup",this.mousemoveData.mouseupListener)}mousemove(e){console.debug("move");let t=e.clientX-this.mousemoveData.originalClientX;t=-Math.min(-t,this.mousemoveData.originalHeaderColumnWidth-10);const s=this.mousemoveData.originalHeaderColumnWidth+t;return this.getHeaderCols().item(this.mousemoveData.columnIndex).setAttribute("width",String(s)),this.getBodyCols().item(this.mousemoveData.columnIndex).setAttribute("width",String(s)),window.getSelection&&window.getSelection().removeAllRanges(),!1}mouseup(e){console.debug("up"),document.removeEventListener("mousemove",this.mousemoveData.mousemoveListener),document.removeEventListener("mouseup",this.mousemoveData.mouseupListener);const t=JSON.parse(this.dataset.tobagoLayout).columns,s=this.isColumnRendered(),i=this.loadColumnWidths(),n=this.getBodyTable(),o=this.getHeaderCols(),r=this.getBodyCols(),a=[];let l=0;for(let e=0;e=e)a[e]=i[e];else if("number"==typeof t[e])a[e]=100;else if("object"==typeof t[e]&&void 0!==t[e].measure){const s=parseInt(t[e].measure);t[e].measure.lastIndexOf("px")>0?a[e]=s:t[e].measure.lastIndexOf("%")>0&&(a[e]=parseInt(n.style.width)/100*s)}return this.saveColumnWidths(a),!1}scrollAction(e){this.syncScrolling();const t=e.currentTarget,s=Math.round(t.scrollLeft);if(this.lazy){const e=this.firstVisibleRowIndex,i=this.tableBody.querySelector(`tr[row-index='${e}']`),n=t.scrollTop-i.offsetTop;this.lazyScrollPosition=[e,Math.round(n),s]}else this.scrollPosition=[s,Math.round(t.scrollTop)]}initSelectionListener(t){let s;if(!this.columnSelector||!this.columnSelector.disabled){if([ta.single,ta.singleOrNone,ta.multi].includes(this.selectable))s=t;else if(this.selectable===ta.none&&this.columnSelector&&[ta.single,ta.singleOrNone,ta.multi].includes(this.columnSelector.selectable)&&!t.classList.contains(e.TOBAGO_COLUMN_PANEL))s=t.querySelector("td:first-child"),s.addEventListener("click",(e=>e.stopPropagation()));else if(this.columnSelector&&this.columnSelector.selectable===ta.none){const e=this.columnSelector.rowElement(t);e&&e.addEventListener("click",(e=>e.preventDefault()))}s&&(s.addEventListener("mousedown",(e=>{this.mousedownOnRowData={x:e.clientX,y:e.clientY}})),s.addEventListener("click",(t=>{const s=t.currentTarget.closest("tr");if(this.mousedownOnRowData&&Math.abs(this.mousedownOnRowData.x-t.clientX)+Math.abs(this.mousedownOnRowData.y-t.clientY)>5)return;const i=this.columnSelector?this.columnSelector.selectable:this.selectable,n=t.ctrlKey||t.metaKey,o=t.shiftKey&&this.lastClickedRowIndex>-1,r=(this.columnSelector||i!==ta.single)&&(this.columnSelector||i!==ta.singleOrNone||n)?!this.columnSelector&&i===ta.singleOrNone&&n?sa.ctrlMode_singleOrNone:this.columnSelector||i!==ta.multi||n||o?!this.columnSelector&&i===ta.multi&&n?sa.ctrlMode_multi:!this.columnSelector&&i===ta.multi&&o?sa.shiftMode:this.columnSelector&&i===ta.single?sa.singleMode:this.columnSelector&&i===ta.singleOrNone?sa.ctrlMode_singleOrNone:this.columnSelector&&i===ta.multi&&!o?sa.ctrlMode_multi:this.columnSelector&&i===ta.multi&&o?sa.shiftMode:sa.none:sa.singleMode:sa.singleMode,a=this.selected,l=Number(s.classList.contains(e.TOBAGO_COLUMN_PANEL)?s.getAttribute("name"):s.getAttribute("row-index"));switch(r){case sa.singleMode:a.clear(),a.add(l);break;case sa.ctrlMode_singleOrNone:a.has(l)?a.delete(l):(a.clear(),a.add(l));break;case sa.ctrlMode_multi:a.has(l)?a.delete(l):a.add(l);break;case sa.shiftMode:for(let e=Math.min(l,this.lastClickedRowIndex);e<=Math.max(l,this.lastClickedRowIndex);e++)a.add(e)}this.lastClickedRowIndex=l,this.selected=a})))}}initSelectAllCheckbox(e){const t=this.selected;if(this.lazy||0===this.rows)if(t.size===this.rowCount)t.clear();else for(let e=0;e{t.hasAttribute("row-index")&&e.push(Number(t.getAttribute("row-index")))}));let s=!0;e.forEach(((e,i,n)=>{t.has(e)||(s=!1,t.add(e))})),s&&e.forEach(((e,s,i)=>{t.delete(e)}))}this.selected=t}syncSelected(t){const s=t?t.detail.selection:this.selected;if(this.getRowElements().forEach((t=>{var i;const n=t.classList.contains(e.TOBAGO_COLUMN_PANEL),o=Number(n?t.getAttribute("name"):t.getAttribute("row-index")),r=n?null:null===(i=this.columnSelector)||void 0===i?void 0:i.rowElement(t);s.has(o)?(t.classList.add(e.TOBAGO_SELECTED),t.classList.add(e.TABLE_INFO),r&&(r.checked=!0)):(t.classList.remove(e.TOBAGO_SELECTED),t.classList.remove(e.TABLE_INFO),r&&(r.checked=!1))})),this.columnSelector&&"checkbox"===this.columnSelector.headerElement.type)if(this.lazy||0===this.rows)this.columnSelector.headerElement.checked=s.size===this.rowCount;else{let e=!0;for(let t=this.first;theader")}getHeaderTable(){return this.querySelector("tobago-sheet>header>table")}getHeaderCols(){return this.querySelectorAll("tobago-sheet>header>table>colgroup>col")}getBody(){return this.querySelector("tobago-sheet>.tobago-body")}getBodyTable(){return this.querySelector("tobago-sheet>.tobago-body>table")}getBodyCols(){return this.querySelectorAll("tobago-sheet>.tobago-body>table>colgroup>col")}getHiddenExpanded(){return this.getRootNode().getElementById(this.id+"::expanded")}getRowElements(){return this.getBodyTable().querySelectorAll(":scope > tbody > tr")}}ra.SCROLL_BAR_SIZE=ra.getScrollBarSize(),ra.SUFFIX_LAZY_UPDATE="::lazy-update",document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-sheet")&&window.customElements.define("tobago-sheet",ra)}));class aa extends HTMLElement{constructor(){super();let e=!0,t=!1;for(const s of this.children){if(t){t=!1;continue}if("none"===getComputedStyle(s).display)continue;if(e){e=!1;continue}const i=document.createElement("div");i.classList.add("horizontal"===this.orientation?"tobago-splitLayout-horizontal":"tobago-splitLayout-vertical"),t=!0,i.addEventListener("mousedown",this.start.bind(this)),s.parentElement.insertBefore(i,s)}}static previousElementSibling(e){let t=e.previousElementSibling;for(;null!=t;){if("STYLE"!==t.tagName)return t;t=t.previousElementSibling}return null}get orientation(){return this.getAttribute("orientation")}set orientation(e){this.setAttribute("orientation",e)}start(e){e.preventDefault();const t=e.target,s=aa.previousElementSibling(t);this.offset="horizontal"===this.orientation?e.pageX-s.offsetWidth:e.pageY-s.offsetHeight;const i=la.save(e,t);document.addEventListener("mousemove",this.move.bind(this)),document.addEventListener("mouseup",this.stop.bind(this));const n=i.previous;"horizontal"===this.orientation?n.style.width=`${n.offsetWidth}px`:n.style.height=`${n.offsetHeight}px`,n.style.flexGrow="inherit",n.style.flexBasis="auto",console.debug("initial width/height = '%s'","horizontal"===this.orientation?n.style.width:n.style.height)}move(e){e.preventDefault();const t=la.load().previous;t&&("horizontal"===this.orientation?t.style.width=String(e.pageX-this.offset)+"px":t.style.height=String(e.pageY-this.offset)+"px")}stop(e){document.removeEventListener("mousemove",this.move.bind(this)),document.removeEventListener("mouseup",this.stop.bind(this)),la.remove()}}class la{constructor(e){e&&(this.data="string"==typeof e?JSON.parse(e):e)}static save(t,s){const i=s.classList.contains(e.TOBAGO_SPLITLAYOUT_HORIZONTAL);aa.previousElementSibling(s);const n={splitLayoutId:s.parentElement.id,horizontal:i,splitterIndex:this.indexOfSplitter(s,i)};return Ye.page(s).dataset.SplitLayoutMousedownData=JSON.stringify(n),new la(n)}static load(){const e=document.documentElement;return new la(Ye.page(e).dataset.SplitLayoutMousedownData)}static remove(){const e=document.documentElement;Ye.page(e).dataset.SplitLayoutMousedownData=null}static indexOfSplitter(e,t){const s=e.parentElement.getElementsByClassName(t?"tobago-splitLayout-horizontal":"tobago-splitLayout-vertical");for(let t=0;t0){const e=100*p/u;n.style.width=`${e}%`,o.style.left=`${e}%`,o.style.width=100-e+"%"}else if(h){n.classList.add(e.TOBAGO_PLACEHOLDER);const t=100*h/u;n.style.width=`${t}%`,o.style.left=`${t}%`,o.style.width=100-t+"%"}if(!l&&!c){let e=!1;a.addEventListener("mousedown",(function(t){e=!0})),a.addEventListener("mouseup",(function(t){e=!1,m()})),a.addEventListener("input",(function(e){f()})),a.addEventListener("touchend",(function(e){a.dispatchEvent(new Event("change"))})),a.addEventListener("change",(function(t){e?f():m()})),a.addEventListener("touchstart",g),a.addEventListener("touchmove",g)}function g(e){const t=e.currentTarget,s=parseInt(t.max)/t.offsetWidth*(e.touches[0].pageX-ca.leftOffset(a));s>parseInt(t.max)?a.value=t.max:s0?(i.classList.remove(e.TRASH),i.textContent=(5*parseInt(a.value)/u).toFixed(2),r.classList.add(e.SHOW),r.style.width=100*parseInt(a.value)/u+"%"):(i.textContent="",i.classList.add(e.TRASH),h?(r.classList.add(e.SHOW),r.style.width=100*h/u+"%"):r.classList.remove(e.SHOW))}function m(){if(i.classList.remove(e.SHOW),r.classList.remove(e.SHOW),parseInt(a.value)>0){n.classList.remove(e.TOBAGO_PLACEHOLDER);const s=100*parseInt(a.value)/u;n.style.width=`${s}%`,o.style.left=`${s}%`,o.style.width=100-s+"%",t.value=a.value}else{if(h){n.classList.add(e.TOBAGO_PLACEHOLDER);const t=100*h/u;n.style.width=`${t}%`,o.style.left=`${t}%`,o.style.width=100-t+"%"}else n.classList.remove(e.TOBAGO_PLACEHOLDER),n.style.width="",o.style.left="",o.style.width="";t.value=d?"":a.value}}}}document.addEventListener("DOMContentLoaded",(function(e){window.customElements.define("tobago-stars",ca)}));class da extends HTMLElement{constructor(){super(),this.hiddenInput=this.querySelector(":scope > input[type=hidden]")}get switchType(){return this.getAttribute("switch-type")}get tabs(){return this.querySelectorAll(":scope > .card-header > .card-header-tabs > tobago-tab")}getSelectedTab(){return this.querySelector(`:scope > .card-header > .card-header-tabs > tobago-tab[index='${this.selected}']`)}get selected(){return parseInt(this.hiddenInput.value)}set selected(e){this.hiddenInput.value=String(e)}}class ua extends HTMLElement{constructor(){super()}connectedCallback(){const t=this.navLink;t.classList.contains(e.DISABLED)||t.addEventListener("click",this.select.bind(this))}get index(){return parseInt(this.getAttribute("index"))}get navLink(){return this.querySelector(".nav-link")}get tabGroup(){return this.closest("tobago-tab-group")}select(t){const s=this.tabGroup,i=s.getSelectedTab();s.selected=this.index;const n=i.index!=this.index;switch(s.switchType){case"client":i.navLink.classList.remove(e.ACTIVE),this.navLink.classList.add(e.ACTIVE),i.content.classList.remove(e.ACTIVE),this.content.classList.add(e.ACTIVE);break;case"reloadTab":case"reloadPage":n&&this.fireTabChangeEvent(s);break;case"none":console.error("Not implemented yet: %s",s.switchType);break;default:console.error("Unknown switchType='%s'",s.switchType)}}fireTabChangeEvent(e){e.dispatchEvent(new CustomEvent(ea.TAB_CHANGE,{detail:{index:this.index}}))}get content(){return this.closest("tobago-tab-group").querySelector(`:scope > .card-body.tab-content > .tab-pane[data-index='${this.index}']`)}}document.addEventListener("DOMContentLoaded",(function(e){window.customElements.define("tobago-tab",ua),window.customElements.define("tobago-tab-group",da)}));class ha extends HTMLElement{constructor(){super()}connectedCallback(){this.textarea.addEventListener("focus",Ze.setLastFocusId)}get textarea(){return this.getRootNode().getElementById(`${this.id}::field`)}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-textarea")&&window.customElements.define("tobago-textarea",ha)})),function(e){e[e.topLeft=0]="topLeft",e[e.topCenter=1]="topCenter",e[e.topRight=2]="topRight",e[e.middleLeft=3]="middleLeft",e[e.middleCenter=4]="middleCenter",e[e.middleRight=5]="middleRight",e[e.bottomLeft=6]="bottomLeft",e[e.bottomCenter=7]="bottomCenter",e[e.bottomRight=8]="bottomRight"}(ia||(ia={})),function(e){e.created="created",e.showed="showed",e.closed="closed"}(na||(na={}));class pa extends HTMLElement{constructor(){super()}get toastStore(){return document.getRootNode().querySelector(".tobago-page-toastStore")}get localToasts(){return this.querySelectorAll(".toast")}get storeToasts(){return this.toastStore.querySelectorAll(".toast[name^='"+this.id+"::']")}get statesInput(){return this.querySelector("input[name='"+this.id+"::states']")}get states(){return new Map(Object.entries(JSON.parse(this.statesInput.value)))}set states(e){this.statesInput.value=JSON.stringify(Object.fromEntries(e))}connectedCallback(){for(const e of this.storeToasts){this.querySelector(".toast[id='"+e.getAttribute("name")+"']")||this.removeToast(e)}for(const e of this.localToasts){const t=this.toastStore.querySelector(".toast[name='"+e.id+"']");t?this.updateToast(t,e):this.showToast(e)}}removeToast(e){const t=new Wo(e,{autohide:!1,delay:0});this.addHiddenEventListeners(e),t.hide()}updateToast(t,s){s.querySelector("."+e.TOAST_HEADER)?t.replaceChildren(s.querySelector("."+e.TOAST_HEADER),s.querySelector("."+e.TOAST_BODY)):t.replaceChildren(s.querySelector("."+e.TOAST_BODY))}showToast(t){const s=ia[t.dataset.tobagoPlacement],i=Number(t.dataset.tobagoDisposeDelay);t.removeAttribute("id"),this.getToastContainer(s).insertAdjacentElement("beforeend",t),this.addShowEventListeners(t),this.addHideEventListeners(t),this.addHiddenEventListeners(t);const n=new Wo(t,{autohide:i>0,delay:Math.max(i,0)}),o=t.getAttribute("name"),r=this.states.get(o);r.state===na.created?n.show():r.state===na.showed&&(t.classList.add(e.SHOW),t.classList.add(e.FADE),i>=0&&setTimeout((()=>{n.hide()}),i))}addShowEventListeners(e){const t=e.getAttribute("name");e.addEventListener("show.bs.toast",(()=>{const e=this.states;e.get(t).state=na.showed,this.states=e,faces.ajax.request(this.id,null,{params:{"jakarta.faces.behavior.event":"toastShown"},execute:this.id})}))}addHideEventListeners(e){const t=e.getAttribute("name");e.addEventListener("hide.bs.toast",(()=>{const e=this.states;e.get(t).state=na.closed,this.states=e,faces.ajax.request(this.id,null,{params:{"jakarta.faces.behavior.event":"toastHide"},execute:this.id})}))}addHiddenEventListeners(e){e.addEventListener("hidden.bs.toast",(()=>{e.remove()}))}getToastContainer(e){const t=this.getToastContainerCssClass(e),s=t.join("."),i=this.toastStore.querySelector("."+s);if(i)return i;{const e=document.createElement("div");for(const s of t)e.classList.add(s);return this.toastStore.insertAdjacentElement("beforeend",e)}}getToastContainerCssClass(t){const s=[];switch(s.push(e.TOAST_CONTAINER),s.push(e.POSITION_FIXED),s.push(e.P_3),t){case ia.topLeft:case ia.topCenter:case ia.topRight:s.push(e.TOP_0);break;case ia.middleLeft:case ia.middleCenter:case ia.middleRight:s.push(e.TOP_50);break;case ia.bottomLeft:case ia.bottomCenter:case ia.bottomRight:s.push(e.BOTTOM_0)}switch(t){case ia.topLeft:case ia.middleLeft:case ia.bottomLeft:s.push(e.START_0);break;case ia.topCenter:case ia.middleCenter:case ia.bottomCenter:s.push(e.START_50);break;case ia.topRight:case ia.middleRight:case ia.bottomRight:s.push(e.END_0)}switch(t){case ia.topCenter:case ia.bottomCenter:s.push(e.TRANSLATE_MIDDLE_X);break;case ia.middleLeft:case ia.middleRight:s.push(e.TRANSLATE_MIDDLE_Y);break;case ia.middleCenter:s.push(e.TRANSLATE_MIDDLE)}return s}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-toasts")&&window.customElements.define("tobago-toasts",pa)}));class ga extends HTMLElement{constructor(){super()}clearSelectedNodes(){this.hiddenInputSelected.value="[]"}addSelectedNode(e){const t=new Set(JSON.parse(this.hiddenInputSelected.value));t.add(e),this.hiddenInputSelected.value=JSON.stringify(Array.from(t))}deleteSelectedNode(e){const t=new Set(JSON.parse(this.hiddenInputSelected.value));t.delete(e),this.hiddenInputSelected.value=JSON.stringify(Array.from(t))}getSelectedNodes(){const e=[];for(const t of JSON.parse(this.hiddenInputSelected.value))e.length>0&&e.push(", "),e.push("tobago-tree-node[index='"),e.push(t),e.push("']");return e.length>0?this.querySelectorAll(e.join("")):null}get hiddenInputSelected(){return this.querySelector(":scope > input[type=hidden].tobago-selected")}clearExpandedNodes(){this.hiddenInputExpanded.value="[]"}addExpandedNode(e){const t=new Set(JSON.parse(this.hiddenInputExpanded.value));t.add(e),this.hiddenInputExpanded.value=JSON.stringify(Array.from(t))}deleteExpandedNode(e){const t=new Set(JSON.parse(this.hiddenInputExpanded.value));t.delete(e),this.hiddenInputExpanded.value=JSON.stringify(Array.from(t))}get hiddenInputExpanded(){return this.querySelector(":scope > input[type=hidden].tobago-expanded")}get selectable(){return ta[this.getAttribute("selectable")]}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-tree")&&window.customElements.define("tobago-tree",ga)}));class fa extends HTMLElement{constructor(){super()}connectedCallback(){this.applySelected();for(const e of this.listboxes)e.disabled||e.addEventListener("change",this.select.bind(this))}select(e){const t=e.currentTarget;this.unselectDescendants(t),this.setSelected(),this.applySelected()}unselectDescendants(e){let t=!1;for(const s of this.listboxes)if(t){const e=s.querySelector("option:checked");e&&(e.selected=!1)}else s.id===e.id&&(t=!0)}setSelected(){const e=[];for(const t of this.levelElements){const s=t.querySelector(".tobago-selected:not(.d-none) option:checked");s&&e.push(s.index)}this.hiddenInput.value=JSON.stringify(e)}applySelected(){const e=JSON.parse(this.hiddenInput.value);let t=this.querySelector(".tobago-selected");const s=this.levelElements;for(let i=0;ie.addEventListener("click",this.toggleNode.bind(this))))}toggleNode(t){if(this.expanded){for(const e of this.icons)e.classList.remove(e.dataset.tobagoOpen),e.classList.add(e.dataset.tobagoClosed);for(const e of this.images)e.dataset.tobagoClosed?e.src=e.dataset.tobagoClosed:e.src=e.dataset.tobagoOpen;this.deleteExpandedNode(this.index),this.classList.remove(e.TOBAGO_EXPANDED),this.hideNodes(this.treeChildNodes),this.tree?this.ajax(t,this.tree.id,!1):this.sheet&&this.ajax(t,this.sheet.id,!1)}else{for(const e of this.icons)e.classList.remove(e.dataset.tobagoClosed),e.classList.add(e.dataset.tobagoOpen);for(const e of this.images)e.dataset.tobagoOpen?e.src=e.dataset.tobagoOpen:e.src=e.dataset.tobagoClosed;this.addExpandedNode(this.index),this.classList.add(e.TOBAGO_EXPANDED),this.showNodes(this.treeChildNodes),this.tree?this.ajax(t,this.tree.id,0===this.treeChildNodes.length):this.sheet&&this.ajax(t,this.sheet.id,0===this.treeChildNodes.length)}}ajax(e,t,s){faces.ajax.request(this.id,e,{params:{"jakarta.faces.behavior.event":"change"},execute:t,render:s?t:null})}hideNodes(t){for(const s of t)s.sheet?s.closest("tr").classList.add(e.D_NONE):s.classList.add(e.D_NONE),this.hideNodes(s.treeChildNodes)}showNodes(t){for(const s of t)s.sheet?s.closest("tr").classList.remove(e.D_NONE):s.classList.remove(e.D_NONE),this.showNodes(s.treeChildNodes)}addExpandedNode(e){const t=new Set(JSON.parse(this.hiddenInputExpanded.value));t.add(e),this.hiddenInputExpanded.value=JSON.stringify(Array.from(t))}deleteExpandedNode(e){const t=new Set(JSON.parse(this.hiddenInputExpanded.value));t.delete(e),this.hiddenInputExpanded.value=JSON.stringify(Array.from(t))}get tree(){return this.closest("tobago-tree")}get sheet(){return this.closest("tobago-sheet")}get expandable(){return"expandable"===this.getAttribute("expandable")}get expanded(){for(const e of this.expandedNodes)if(e===this.index)return!0;return!1}get expandedNodes(){return new Set(JSON.parse(this.hiddenInputExpanded.value))}get hiddenInputExpanded(){return this.tree?this.tree.hiddenInputExpanded:this.sheet?this.sheet.getHiddenExpanded():(console.error("Cannot detect 'tobago-tree' or 'tobago-sheet'."),null)}get treeChildNodes(){return this.sheet?this.closest("tbody").querySelectorAll(`tobago-tree-node[parent='${this.id}']`):this.tree?this.parentElement.querySelectorAll(`tobago-tree-node[parent='${this.id}']`):(console.error("Cannot detect 'tobago-tree' or 'tobago-sheet'."),null)}get toggles(){return this.querySelectorAll(".tobago-toggle")}get icons(){return this.querySelectorAll(".tobago-toggle i")}get images(){return this.querySelectorAll(".tobago-toggle img")}get index(){return Number(this.getAttribute("index"))}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-tree-node")&&window.customElements.define("tobago-tree-node",ma)}));class ba extends HTMLElement{constructor(){super()}connectedCallback(){this.input&&this.input.addEventListener("change",this.select.bind(this))}select(e){switch(this.input.type){case"radio":this.tree.clearSelectedNodes(),this.tree.addSelectedNode(this.treeNode.index);break;case"checkbox":if(this.input.checked?this.tree.addSelectedNode(this.treeNode.index):this.tree.deleteSelectedNode(this.treeNode.index),this.tree.selectable===ta.multiCascade){const e=[];this.selectChildren(this.treeSelectChildren,this.input.checked,e)}}}selectChildren(e,t,s){for(const i of e)i.input.checked!==t&&(i.input.checked=t,s.push(i.treeNode.id)),t?this.tree.addSelectedNode(i.treeNode.index):this.tree.deleteSelectedNode(i.treeNode.index),this.selectChildren(i.treeSelectChildren,t,s)}get tree(){return this.treeNode.tree}get treeNode(){return this.closest("tobago-tree-node")}get treeSelectChildren(){const e=this.closest("tobago-tree-node");return e.parentElement.querySelectorAll(`tobago-tree-node[parent='${e.id}'] tobago-tree-select`)}get input(){return this.querySelector("input")}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-tree-select")&&window.customElements.define("tobago-tree-select",ba)}));class va extends HTMLElement{constructor(){super()}connectedCallback(){switch(this.event){case"load":this.callback();break;case"resize":document.body.addEventListener(this.event,this.callback.bind(this));break;default:{const e=this.eventElement;this.eventListener=this.callback.bind(this),e?e.addEventListener(this.event,this.eventListener):(this.parentElement.addEventListener(this.event,this.eventListener),console.warn("Can't find an element for the event. Use parentElement instead.",this))}}}disconnectedCallback(){const e=this.eventElement;e?e.removeEventListener(this.event,this.eventListener):this.parentElement.removeEventListener(this.event,this.eventListener)}callback(e){if(this.stopPropagation&&e.stopPropagation(),!this.confirmation||window.confirm(this.confirmation)){switch(this.mode){case Ko.ajax:if(!this.validate(this.execute))return void console.warn("Validation failed! No request will be sent.");case Ko.full:}if(e&&e.currentTarget.dispatchEvent(new CustomEvent(this.customEventName,{bubbles:!0})),this.collapseOperation&&this.collapseTarget){const e=this.getRootNode();er.execute(this.collapseOperation,e.getElementById(this.collapseTarget),this.mode)}switch(this.mode){case Ko.ajax:if(this.render){const e=this.render.split(" ");for(const t of e){const e=document.getElementById(t);if(e){let t;t="TOBAGO-POPUP"===e.tagName?e.querySelector(".modal-dialog").id:e.id,e.insertAdjacentHTML("beforeend",Je.htmlText(t,Ge.ajax,Ye.page(this).waitOverlayDelayAjax))}else console.warn("No element found by id='%s' for overlay!",t)}}faces.ajax.request(this.actionElement,e,{params:{"jakarta.faces.behavior.event":this.event},execute:this.execute,render:this.render,resetValues:this.resetValues,delay:this.delay,onevent:e=>{console.debug(`Status: ${e.status} - Type: ${e.type}`)},myfaces:{upload:{progress:(e,t)=>{console.debug(`progress: ${t.loaded} of ${t.total}`)},preinit:e=>{console.debug("preinit")},loadstart:(e,t)=>{console.debug(`loadstart: ${t.loaded} of ${t.total}`)},load:(e,t)=>{console.debug(`load: ${t.loaded} of ${t.total}`)},loadend:(e,t)=>{console.debug(`loadend: ${t.loaded} of ${t.total}`)},error:(e,t)=>{console.debug(`error: ${t.loaded} of ${t.total}`)},abort:(e,t)=>{console.debug(`abort: ${t.loaded} of ${t.total}`)},timeout:(e,t)=>{console.debug(`timeout: ${t.loaded} of ${t.total}`)}}}});break;case Ko.full:setTimeout(this.submit.bind(this),this.delay)}}else null==e||e.preventDefault()}submit(){console.info("Execute submit!");const e=Ye.page(this);if(!e.submitActive){e.submitActive=!0;const t=null!=this.fieldId?this.fieldId:this.clientId,s=e.form,i=s.getAttribute("target"),n=document.getElementById("jakarta.faces.source");n.disabled=!1,n.value=t,null!=this.target&&s.setAttribute("target",this.target),e.beforeSubmit(null,this.decoupled||null!=this.target);try{s.submit(),n.disabled=!0,n.value=""}catch(t){console.error("Submit failed!",t);this.closest("body").querySelector(`tobago-overlay[for='${e.id}']`).remove(),e.submitActive=!1,alert("Submit failed!")}this.target&&(i?s.setAttribute("target",i):s.removeAttribute("target")),(this.target||this.decoupled)&&(e.submitActive=!1)}}validate(e){let t=!0;if(e){console.debug("Is all valid? ids=",e);for(const s of e.split(/\s+/)){const e=document.getElementById(s);if(e){const s=e.querySelectorAll("input[type=file]");for(const e of s)e.checkValidity()?console.debug("valid",e.id):(console.debug("invalid",e.id),t=!1)}}return console.debug("Is all valid?",t),t}}get mode(){return this.render||this.execute?Ko.ajax:this.omit?Ko.client:Ko.full}get event(){return this.getAttribute("event")}set event(e){this.setAttribute("event",e)}get clientId(){return this.getAttribute("client-id")}set clientId(e){this.setAttribute("client-id",e)}get fieldId(){return this.getAttribute("field-id")}set fieldId(e){this.setAttribute("field-id",e)}get execute(){return this.getAttribute("execute")}set execute(e){this.setAttribute("execute",e)}get render(){return this.getAttribute("render")}set render(e){this.setAttribute("render",e)}get delay(){return parseInt(this.getAttribute("delay"))||0}set delay(e){this.setAttribute("delay",String(e))}get omit(){return this.hasAttribute("omit")}set omit(e){e?this.setAttribute("omit",""):this.removeAttribute("omit")}get resetValues(){return this.hasAttribute("reset-values")}set resetValues(e){e?this.setAttribute("reset-values",""):this.removeAttribute("reset-values")}get target(){return this.getAttribute("target")}set target(e){this.setAttribute("target",e)}get confirmation(){return this.getAttribute("confirmation")}set confirmation(e){this.setAttribute("confirmation",e)}get collapseOperation(){return Zo[this.getAttribute("collapse-operation")]}set collapseOperation(e){this.setAttribute("collapse-operation",Zo[e])}get collapseTarget(){return this.getAttribute("collapse-target")}set collapseTarget(e){this.setAttribute("collapse-target",e)}get decoupled(){return this.hasAttribute("decoupled")}set decoupled(e){e?this.setAttribute("decoupled",""):this.removeAttribute("decoupled")}get stopPropagation(){return this.hasAttribute("stop-propagation")}get customEventName(){return this.getAttribute("custom-event-name")}get actionElement(){const e=this.getRootNode(),t=this.clientId;return e.getElementById(t)}get eventElement(){const e=this.getRootNode();if(e instanceof Document||e instanceof ShadowRoot){const t=this.fieldId?this.fieldId:this.clientId;let s=e.getElementById(t);return null==s&&"TD"===this.parentElement.tagName&&(s=this.parentElement.parentElement),s}return null}}document.addEventListener("tobago.init",(function(e){null==window.customElements.get("tobago-behavior")&&window.customElements.define("tobago-behavior",va)}));try{document.querySelector(":scope")}catch(_a){const ya=Ea(Element.prototype.querySelector);Element.prototype.querySelector=function(e){return ya.apply(this,arguments)};const wa=Ea(Element.prototype.querySelectorAll);if(Element.prototype.querySelectorAll=function(e){return wa.apply(this,arguments)},Element.prototype.matches){const Aa=Ea(Element.prototype.matches);Element.prototype.matches=function(e){return Aa.apply(this,arguments)}}if(Element.prototype.closest){const Sa=Ea(Element.prototype.closest);Element.prototype.closest=function(e){return Sa.apply(this,arguments)}}function Ea(e){const t=/:scope(?![\w-])/gi;return function(s){if(s.toLowerCase().indexOf(":scope")>=0){const i="tobagoScopeAttribute";arguments[0]=s.replace(t,`[${i}]`),this.setAttribute(i,"");const n=e.apply(this,arguments);return this.removeAttribute(i),n}return e.apply(this,arguments)}}}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(e=>{document.dispatchEvent(new CustomEvent("tobago.init"))})):document.dispatchEvent(new CustomEvent("tobago.init"))})); //# sourceMappingURL=tobago.js.map diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map index 10c7a8020c..43af6bb8be 100644 --- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map +++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map @@ -1 +1 @@ -{"version":3,"file":"tobago.js","sources":["../ts/tobago-css.ts","../ts/tobago-key.ts","../ts/tobago-bar.ts","../ts/tobago-date.ts","../ts/tobago-menu-store.ts","../../../../node_modules/@popperjs/core/lib/enums.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../../../node_modules/@popperjs/core/lib/utils/math.js","../../../../node_modules/@popperjs/core/lib/utils/userAgent.js","../../../../node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","../../../../node_modules/@popperjs/core/lib/dom-utils/contains.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","../../../../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","../../../../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","../../../../node_modules/@popperjs/core/lib/utils/within.js","../../../../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","../../../../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","../../../../node_modules/@popperjs/core/lib/utils/expandToHashMap.js","../../../../node_modules/@popperjs/core/lib/modifiers/arrow.js","../../../../node_modules/@popperjs/core/lib/utils/getVariation.js","../../../../node_modules/@popperjs/core/lib/modifiers/computeStyles.js","../../../../node_modules/@popperjs/core/lib/modifiers/eventListeners.js","../../../../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","../../../../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","../../../../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","../../../../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","../../../../node_modules/@popperjs/core/lib/utils/rectToClientRect.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","../../../../node_modules/@popperjs/core/lib/utils/computeOffsets.js","../../../../node_modules/@popperjs/core/lib/utils/detectOverflow.js","../../../../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","../../../../node_modules/@popperjs/core/lib/modifiers/flip.js","../../../../node_modules/@popperjs/core/lib/modifiers/hide.js","../../../../node_modules/@popperjs/core/lib/modifiers/offset.js","../../../../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","../../../../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","../../../../node_modules/@popperjs/core/lib/utils/getAltAxis.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","../../../../node_modules/@popperjs/core/lib/utils/orderModifiers.js","../../../../node_modules/@popperjs/core/lib/createPopper.js","../../../../node_modules/@popperjs/core/lib/utils/debounce.js","../../../../node_modules/@popperjs/core/lib/utils/mergeByName.js","../../../../node_modules/@popperjs/core/lib/popper-lite.js","../../../../node_modules/@popperjs/core/lib/popper.js","../ts/tobago-dropdown-item-factory.ts","../ts/tobago-dropdown-item.ts","../ts/tobago-dropdown.ts","../ts/tobago-overlay-type.ts","../ts/tobago-page-static.ts","../ts/tobago-page.ts","../ts/tobago-overlay.ts","../ts/tobago-file.ts","../ts/tobago-focus.ts","../ts/tobago-footer.ts","../../../../node_modules/@trevoreyre/autocomplete-js/dist/autocomplete.esm.js","../ts/tobago-suggest-filter.ts","../ts/tobago-suggest.ts","../ts/tobago-in.ts","../../../../node_modules/bootstrap/dist/js/bootstrap.esm.js","../ts/tobago-messages.ts","../ts/tobago-paginator.ts","../ts/tobago-paginator-page.ts","../ts/tobago-paginator-row.ts","../ts/tobago-panel.ts","../ts/tobago-popover.ts","../ts/tobago-behavior-mode.ts","../ts/tobago-collapse-operation.ts","../ts/tobago-collapse.ts","../ts/tobago-popup.ts","../ts/tobago-range.ts","../ts/tobago-reload.ts","../ts/tobago-scroll.ts","../ts/tobago-select-boolean-checkbox.ts","../ts/tobago-select-boolean-toggle.ts","../ts/tobago-select-many-checkbox.ts","../ts/tobago-filter-registry.ts","../ts/tobago-select-list-base.ts","../../../../node_modules/lit-html/lit-html.js","../ts/tobago-select-many-list.ts","../ts/tobago-select-one-listbox.ts","../ts/tobago-select-many-listbox.ts","../ts/tobago-select-many-shuttle.ts","../ts/tobago-select-one-choice.ts","../ts/tobago-select-one-list.ts","../ts/tobago-select-one-radio.ts","../ts/tobago-client-behaviors.ts","../ts/tobago-selectable.ts","../ts/tobago-sheet.ts","../ts/tobago-placement.ts","../ts/tobago-toasts.ts","../ts/tobago-column-selector.ts","../ts/tobago-split-layout.ts","../ts/tobago-stars.ts","../ts/tobago-tab.ts","../ts/tobago-textarea.ts","../ts/tobago-tree.ts","../ts/tobago-tree-listbox.ts","../ts/tobago-tree-node.ts","../ts/tobago-tree-select.ts","../ts/tobago-behavior.ts","../ts/tobago-polyfill.ts","../ts/tobago-init.ts"],"sourcesContent":["/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport enum Css {\n ACTIVE = \"active\",\n AUTOCOMPLETE = \"autocomplete\",\n AUTOCOMPLETE_INPUT = \"autocomplete-input\",\n BOTTOM_0 = \"bottom-0\",\n COLLAPSE = \"collapse\",\n COLLAPSING = \"collapsing\",\n D_NONE = \"d-none\",\n DISABLED = \"disabled\",\n DROPDOWN = \"dropdown\",\n DROPDOWN_ITEM = \"dropdown-item\",\n DROPDOWN_MENU = \"dropdown-menu\",\n DROPDOWN_MENU_END = \"dropdown-menu-end\",\n END_0 = \"end-0\",\n FADE = \"fade\",\n FIXED_BOTTOM = \"fixed-bottom\",\n INPUT_GROUP = \"input-group\",\n P_3 = \"p-3\",\n POSITION_FIXED = \"position-fixed\",\n POSITION_RELATIVE = \"position-relative\",\n SHOW = \"show\",\n START_0 = \"start-0\",\n START_50 = \"start-50\",\n TABLE_ACTIVE = \"table-active\",\n TABLE_INFO = \"table-info\",\n TABLE_PRIMARY = \"table-primary\",\n TOAST_BODY = \"toast-body\",\n TOAST_CONTAINER = \"toast-container\",\n TOAST_HEADER = \"toast-header\",\n TOBAGO_COLLAPSED = \"tobago-collapsed\",\n TOBAGO_COLUMN_PANEL = \"tobago-column-panel\",\n TOBAGO_DISABLED = \"tobago-disabled\",\n TOBAGO_DROP_ZONE = \"tobago-drop-zone\",\n TOBAGO_DROPDOWN_MENU = \"tobago-dropdown-menu\",\n TOBAGO_DROPDOWN_SUBMENU = \"tobago-dropdown-submenu\",\n TOBAGO_EXPANDED = \"tobago-expanded\",\n TOBAGO_FOCUS = \"tobago-focus\",\n TOBAGO_NO_ENTRIES = \"tobago-no-entries\",\n TOBAGO_OPTIONS = \"tobago-options\",\n TOBAGO_PLACEHOLDER = \"tobago-placeholder\",\n TOBAGO_PRESELECT = \"tobago-preselect\",\n TOBAGO_SELECTED = \"tobago-selected\",\n TOBAGO_SHOW = \"tobago-show\",\n TOBAGO_SPLITLAYOUT_HORIZONTAL = \"tobago-splitLayout-horizontal\",\n TOP_0 = \"top-0\",\n TOP_50 = \"top-50\",\n TRANSLATE_MIDDLE = \"translate-middle\",\n TRANSLATE_MIDDLE_X = \"translate-middle-x\",\n TRANSLATE_MIDDLE_Y = \"translate-middle-y\",\n TRASH = \"trash\"\n}\n","/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport enum Key {\n ARROW_DOWN = \"ArrowDown\",\n ARROW_LEFT = \"ArrowLeft\",\n ARROW_RIGHT = \"ArrowRight\",\n ARROW_UP = \"ArrowUp\",\n BACKSPACE = \"Backspace\",\n ENTER = \"Enter\",\n ESCAPE = \"Escape\",\n SPACE = \" \",\n TAB = \"Tab\"\n}\n","/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Css} from \"./tobago-css\";\n\nclass Bar extends HTMLElement {\n private timeout: number;\n private expanded: boolean;\n\n constructor() {\n super();\n this.toggleButton.addEventListener(\"click\", this.toggleCollapse.bind(this));\n }\n\n connectedCallback(): void {\n this.expanded = this.toggleButton.ariaExpanded === \"true\";\n }\n\n private toggleCollapse(event: MouseEvent): void {\n window.clearTimeout(this.timeout);\n\n if (this.expanded) {\n this.expanded = false;\n this.navbarContent.style.height = `${this.navbarContent.scrollHeight}px`;\n this.navbarContent.offsetHeight; //force reflow, to make sure height is set\n this.navbarContent.classList.add(Css.COLLAPSING);\n this.navbarContent.classList.remove(Css.COLLAPSE);\n this.navbarContent.classList.remove(Css.SHOW);\n this.navbarContent.style.height = null;\n\n this.timeout = window.setTimeout(() => {\n this.navbarContent.classList.remove(Css.COLLAPSING);\n this.navbarContent.classList.add(Css.COLLAPSE);\n this.toggleButton.ariaExpanded = \"false\";\n }, this.evaluateTransitionTime());\n } else {\n this.expanded = true;\n this.navbarContent.classList.remove(Css.COLLAPSE);\n this.navbarContent.classList.add(Css.COLLAPSING);\n this.navbarContent.style.height = `${this.navbarContent.scrollHeight}px`;\n\n this.timeout = window.setTimeout(() => {\n this.navbarContent.classList.remove(Css.COLLAPSING);\n this.navbarContent.classList.add(Css.COLLAPSE);\n this.navbarContent.classList.add(Css.SHOW);\n this.navbarContent.style.height = null;\n this.toggleButton.ariaExpanded = \"true\";\n }, this.evaluateTransitionTime());\n }\n }\n\n /**\n * Evaluates the transition time of the content from CSS properties.\n *\n * @return transition time in milliseconds\n */\n private evaluateTransitionTime(): number {\n const style = window.getComputedStyle(this.navbarContent);\n const delay: number = Number.parseFloat(style.transitionDelay);\n const duration: number = Number.parseFloat(style.transitionDuration);\n return (delay + duration) * 1000;\n }\n\n private get toggleButton(): HTMLButtonElement {\n return this.querySelector(\".navbar-toggler\");\n }\n\n private get navbarContent(): HTMLDivElement {\n return this.querySelector(\".navbar-collapse\");\n }\n}\n\ndocument.addEventListener(\"tobago.init\", function (event: Event): void {\n if (window.customElements.get(\"tobago-bar\") == null) {\n window.customElements.define(\"tobago-bar\", Bar);\n }\n});\n","/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nclass InputSupport {\n\n static readonly YEAR_MONTH = `${new Date().toISOString().substr(0, 7)}`;\n\n readonly type: string;\n readonly support: boolean;\n\n constructor(type: string) {\n this.type = type;\n this.support = InputSupport.checkSupport(type);\n }\n\n private static checkSupport(type: string): boolean {\n const input = document.createElement(\"input\");\n input.setAttribute(\"type\", type);\n const INVALID_TEXT = \"this is not a date\";\n input.setAttribute(\"value\", INVALID_TEXT);\n return input.value !== INVALID_TEXT;\n }\n\n example(step: number): string {\n switch (this.type) {\n case \"date\":\n return InputSupport.YEAR_MONTH + \"-20\";\n case \"time\":\n switch (step) {\n case 1:\n return \"20:15:00\";\n case 0.001:\n return \"20:15:00.000\";\n default:\n return \"20:15\";\n }\n case \"datetime-local\":\n switch (step) {\n case 1:\n return InputSupport.YEAR_MONTH + \"-20T20:15:00\";\n case 0.001:\n return InputSupport.YEAR_MONTH + \"-20T20:15:00.000\";\n default:\n return InputSupport.YEAR_MONTH + \"-20T20:15\";\n }\n case \"month\":\n return InputSupport.YEAR_MONTH;\n case \"week\":\n return InputSupport.YEAR_MONTH.substr(0, 4) + \"-W52\";\n default:\n return \"\";\n }\n }\n}\n\nclass TobagoDate extends HTMLElement {\n\n private static readonly SUPPORTS = {\n \"date\": new InputSupport(\"date\"),\n \"time\": new InputSupport(\"time\"),\n \"datetime-local\": new InputSupport(\"datetime-local\"),\n \"month\": new InputSupport(\"month\"),\n \"week\": new InputSupport(\"week\")\n };\n\n constructor() {\n super();\n }\n\n connectedCallback(): void {\n const support: InputSupport = TobagoDate.SUPPORTS[this.type];\n console.debug(\"check input type support\", this.type, support);\n if (!support?.support) {\n this.type = \"text\";\n this.field.placeholder = support.example(this.step) + \" \" + (this.pattern ? this.pattern : \"\");\n }\n const nowButton = this.nowButton;\n if (nowButton) {\n nowButton.addEventListener(\"click\", this.initNowButton.bind(this));\n }\n }\n\n initNowButton(): void {\n this.field.valueAsDate = new Date();\n }\n\n workaround(): void {\n window.alert(\"workaround!\");\n }\n\n get type(): string {\n return this.field?.getAttribute(\"type\");\n }\n\n set type(type: string) {\n this.field?.setAttribute(\"type\", type);\n }\n\n get min(): string {\n return this.field?.getAttribute(\"min\");\n }\n\n get max(): string {\n return this.field?.getAttribute(\"max\");\n }\n\n get step(): number {\n return Number.parseFloat(this.field?.getAttribute(\"step\"));\n }\n\n get pattern(): string {\n return this.getAttribute(\"pattern\");\n }\n\n get field(): HTMLInputElement {\n const rootNode = this.getRootNode() as ShadowRoot | Document;\n return rootNode.getElementById(this.id + \"::field\") as HTMLInputElement;\n }\n\n get nowButton(): HTMLButtonElement {\n return this.querySelector(\".tobago-now\");\n }\n}\n\ndocument.addEventListener(\"tobago.init\", function (event: Event): void {\n if (window.customElements.get(\"tobago-date\") == null) {\n window.customElements.define(\"tobago-date\", TobagoDate);\n }\n});\n","/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport class MenuStore {\n static appendChild(node: T): T {\n return MenuStore.get().appendChild(node);\n }\n\n static get(): HTMLDivElement {\n const root = document.getRootNode() as ShadowRoot | Document;\n return root.querySelector(\".tobago-page-menuStore\");\n }\n}\n","export var top = 'top';\nexport var bottom = 'bottom';\nexport var right = 'right';\nexport var left = 'left';\nexport var auto = 'auto';\nexport var basePlacements = [top, bottom, right, left];\nexport var start = 'start';\nexport var end = 'end';\nexport var clippingParents = 'clippingParents';\nexport var viewport = 'viewport';\nexport var popper = 'popper';\nexport var reference = 'reference';\nexport var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {\n return acc.concat([placement + \"-\" + start, placement + \"-\" + end]);\n}, []);\nexport var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {\n return acc.concat([placement, placement + \"-\" + start, placement + \"-\" + end]);\n}, []); // modifiers that need to read the DOM\n\nexport var beforeRead = 'beforeRead';\nexport var read = 'read';\nexport var afterRead = 'afterRead'; // pure-logic modifiers\n\nexport var beforeMain = 'beforeMain';\nexport var main = 'main';\nexport var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)\n\nexport var beforeWrite = 'beforeWrite';\nexport var write = 'write';\nexport var afterWrite = 'afterWrite';\nexport var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];","export default function getNodeName(element) {\n return element ? (element.nodeName || '').toLowerCase() : null;\n}","export default function getWindow(node) {\n if (node == null) {\n return window;\n }\n\n if (node.toString() !== '[object Window]') {\n var ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView || window : window;\n }\n\n return node;\n}","import getWindow from \"./getWindow.js\";\n\nfunction isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}\n\nfunction isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}\n\nfunction isShadowRoot(node) {\n // IE 11 has no ShadowRoot\n if (typeof ShadowRoot === 'undefined') {\n return false;\n }\n\n var OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}\n\nexport { isElement, isHTMLElement, isShadowRoot };","import getNodeName from \"../dom-utils/getNodeName.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // This modifier takes the styles prepared by the `computeStyles` modifier\n// and applies them to the HTMLElements such as popper and arrow\n\nfunction applyStyles(_ref) {\n var state = _ref.state;\n Object.keys(state.elements).forEach(function (name) {\n var style = state.styles[name] || {};\n var attributes = state.attributes[name] || {};\n var element = state.elements[name]; // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n } // Flow doesn't support to extend this property, but it's the most\n // effective way to apply styles to an HTMLElement\n // $FlowFixMe[cannot-write]\n\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (name) {\n var value = attributes[name];\n\n if (value === false) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value === true ? '' : value);\n }\n });\n });\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state;\n var initialStyles = {\n popper: {\n position: state.options.strategy,\n left: '0',\n top: '0',\n margin: '0'\n },\n arrow: {\n position: 'absolute'\n },\n reference: {}\n };\n Object.assign(state.elements.popper.style, initialStyles.popper);\n state.styles = initialStyles;\n\n if (state.elements.arrow) {\n Object.assign(state.elements.arrow.style, initialStyles.arrow);\n }\n\n return function () {\n Object.keys(state.elements).forEach(function (name) {\n var element = state.elements[name];\n var attributes = state.attributes[name] || {};\n var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them\n\n var style = styleProperties.reduce(function (style, property) {\n style[property] = '';\n return style;\n }, {}); // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n }\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (attribute) {\n element.removeAttribute(attribute);\n });\n });\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'applyStyles',\n enabled: true,\n phase: 'write',\n fn: applyStyles,\n effect: effect,\n requires: ['computeStyles']\n};","import { auto } from \"../enums.js\";\nexport default function getBasePlacement(placement) {\n return placement.split('-')[0];\n}","export var max = Math.max;\nexport var min = Math.min;\nexport var round = Math.round;","export default function getUAString() {\n var uaData = navigator.userAgentData;\n\n if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {\n return uaData.brands.map(function (item) {\n return item.brand + \"/\" + item.version;\n }).join(' ');\n }\n\n return navigator.userAgent;\n}","import getUAString from \"../utils/userAgent.js\";\nexport default function isLayoutViewport() {\n return !/^((?!chrome|android).)*safari/i.test(getUAString());\n}","import { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport { round } from \"../utils/math.js\";\nimport getWindow from \"./getWindow.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getBoundingClientRect(element, includeScale, isFixedStrategy) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n\n var clientRect = element.getBoundingClientRect();\n var scaleX = 1;\n var scaleY = 1;\n\n if (includeScale && isHTMLElement(element)) {\n scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;\n scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;\n }\n\n var _ref = isElement(element) ? getWindow(element) : window,\n visualViewport = _ref.visualViewport;\n\n var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;\n var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;\n var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;\n var width = clientRect.width / scaleX;\n var height = clientRect.height / scaleY;\n return {\n width: width,\n height: height,\n top: y,\n right: x + width,\n bottom: y + height,\n left: x,\n x: x,\n y: y\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\"; // Returns the layout rect of an element relative to its offsetParent. Layout\n// means it doesn't take into account transforms.\n\nexport default function getLayoutRect(element) {\n var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.\n // Fixes https://github.com/popperjs/popper-core/issues/1223\n\n var width = element.offsetWidth;\n var height = element.offsetHeight;\n\n if (Math.abs(clientRect.width - width) <= 1) {\n width = clientRect.width;\n }\n\n if (Math.abs(clientRect.height - height) <= 1) {\n height = clientRect.height;\n }\n\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: width,\n height: height\n };\n}","import { isShadowRoot } from \"./instanceOf.js\";\nexport default function contains(parent, child) {\n var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method\n\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (rootNode && isShadowRoot(rootNode)) {\n var next = child;\n\n do {\n if (next && parent.isSameNode(next)) {\n return true;\n } // $FlowFixMe[prop-missing]: need a better way to handle this...\n\n\n next = next.parentNode || next.host;\n } while (next);\n } // Give up, the result is false\n\n\n return false;\n}","import getWindow from \"./getWindow.js\";\nexport default function getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}","import getNodeName from \"./getNodeName.js\";\nexport default function isTableElement(element) {\n return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;\n}","import { isElement } from \"./instanceOf.js\";\nexport default function getDocumentElement(element) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]\n element.document) || window.document).documentElement;\n}","import getNodeName from \"./getNodeName.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport { isShadowRoot } from \"./instanceOf.js\";\nexport default function getParentNode(element) {\n if (getNodeName(element) === 'html') {\n return element;\n }\n\n return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle\n // $FlowFixMe[incompatible-return]\n // $FlowFixMe[prop-missing]\n element.assignedSlot || // step into the shadow DOM of the parent of a slotted node\n element.parentNode || ( // DOM Element detected\n isShadowRoot(element) ? element.host : null) || // ShadowRoot detected\n // $FlowFixMe[incompatible-call]: HTMLElement is a Node\n getDocumentElement(element) // fallback\n\n );\n}","import getWindow from \"./getWindow.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isHTMLElement, isShadowRoot } from \"./instanceOf.js\";\nimport isTableElement from \"./isTableElement.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getUAString from \"../utils/userAgent.js\";\n\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837\n getComputedStyle(element).position === 'fixed') {\n return null;\n }\n\n return element.offsetParent;\n} // `.offsetParent` reports `null` for fixed elements, while absolute elements\n// return the containing block\n\n\nfunction getContainingBlock(element) {\n var isFirefox = /firefox/i.test(getUAString());\n var isIE = /Trident/i.test(getUAString());\n\n if (isIE && isHTMLElement(element)) {\n // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport\n var elementCss = getComputedStyle(element);\n\n if (elementCss.position === 'fixed') {\n return null;\n }\n }\n\n var currentNode = getParentNode(element);\n\n if (isShadowRoot(currentNode)) {\n currentNode = currentNode.host;\n }\n\n while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {\n var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n\n if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {\n return currentNode;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return null;\n} // Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n\n\nexport default function getOffsetParent(element) {\n var window = getWindow(element);\n var offsetParent = getTrueOffsetParent(element);\n\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n\n if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {\n return window;\n }\n\n return offsetParent || getContainingBlock(element) || window;\n}","export default function getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';\n}","import { max as mathMax, min as mathMin } from \"./math.js\";\nexport function within(min, value, max) {\n return mathMax(min, mathMin(value, max));\n}\nexport function withinMaxClamp(min, value, max) {\n var v = within(min, value, max);\n return v > max ? max : v;\n}","import getFreshSideObject from \"./getFreshSideObject.js\";\nexport default function mergePaddingObject(paddingObject) {\n return Object.assign({}, getFreshSideObject(), paddingObject);\n}","export default function getFreshSideObject() {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n}","export default function expandToHashMap(value, keys) {\n return keys.reduce(function (hashMap, key) {\n hashMap[key] = value;\n return hashMap;\n }, {});\n}","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport contains from \"../dom-utils/contains.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport { within } from \"../utils/within.js\";\nimport mergePaddingObject from \"../utils/mergePaddingObject.js\";\nimport expandToHashMap from \"../utils/expandToHashMap.js\";\nimport { left, right, basePlacements, top, bottom } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar toPaddingObject = function toPaddingObject(padding, state) {\n padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {\n placement: state.placement\n })) : padding;\n return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n};\n\nfunction arrow(_ref) {\n var _state$modifiersData$;\n\n var state = _ref.state,\n name = _ref.name,\n options = _ref.options;\n var arrowElement = state.elements.arrow;\n var popperOffsets = state.modifiersData.popperOffsets;\n var basePlacement = getBasePlacement(state.placement);\n var axis = getMainAxisFromPlacement(basePlacement);\n var isVertical = [left, right].indexOf(basePlacement) >= 0;\n var len = isVertical ? 'height' : 'width';\n\n if (!arrowElement || !popperOffsets) {\n return;\n }\n\n var paddingObject = toPaddingObject(options.padding, state);\n var arrowRect = getLayoutRect(arrowElement);\n var minProp = axis === 'y' ? top : left;\n var maxProp = axis === 'y' ? bottom : right;\n var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];\n var startDiff = popperOffsets[axis] - state.rects.reference[axis];\n var arrowOffsetParent = getOffsetParent(arrowElement);\n var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;\n var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is\n // outside of the popper bounds\n\n var min = paddingObject[minProp];\n var max = clientSize - arrowRect[len] - paddingObject[maxProp];\n var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;\n var offset = within(min, center, max); // Prevents breaking syntax highlighting...\n\n var axisProp = axis;\n state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state,\n options = _ref2.options;\n var _options$element = options.element,\n arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;\n\n if (arrowElement == null) {\n return;\n } // CSS selector\n\n\n if (typeof arrowElement === 'string') {\n arrowElement = state.elements.popper.querySelector(arrowElement);\n\n if (!arrowElement) {\n return;\n }\n }\n\n if (!contains(state.elements.popper, arrowElement)) {\n return;\n }\n\n state.elements.arrow = arrowElement;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'arrow',\n enabled: true,\n phase: 'main',\n fn: arrow,\n effect: effect,\n requires: ['popperOffsets'],\n requiresIfExists: ['preventOverflow']\n};","export default function getVariation(placement) {\n return placement.split('-')[1];\n}","import { top, left, right, bottom, end } from \"../enums.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getWindow from \"../dom-utils/getWindow.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getComputedStyle from \"../dom-utils/getComputedStyle.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport { round } from \"../utils/math.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar unsetSides = {\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n left: 'auto'\n}; // Round the offsets to the nearest suitable subpixel based on the DPR.\n// Zooming can change the DPR, but it seems to report a value that will\n// cleanly divide the values into the appropriate subpixels.\n\nfunction roundOffsetsByDPR(_ref, win) {\n var x = _ref.x,\n y = _ref.y;\n var dpr = win.devicePixelRatio || 1;\n return {\n x: round(x * dpr) / dpr || 0,\n y: round(y * dpr) / dpr || 0\n };\n}\n\nexport function mapToStyles(_ref2) {\n var _Object$assign2;\n\n var popper = _ref2.popper,\n popperRect = _ref2.popperRect,\n placement = _ref2.placement,\n variation = _ref2.variation,\n offsets = _ref2.offsets,\n position = _ref2.position,\n gpuAcceleration = _ref2.gpuAcceleration,\n adaptive = _ref2.adaptive,\n roundOffsets = _ref2.roundOffsets,\n isFixed = _ref2.isFixed;\n var _offsets$x = offsets.x,\n x = _offsets$x === void 0 ? 0 : _offsets$x,\n _offsets$y = offsets.y,\n y = _offsets$y === void 0 ? 0 : _offsets$y;\n\n var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n\n x = _ref3.x;\n y = _ref3.y;\n var hasX = offsets.hasOwnProperty('x');\n var hasY = offsets.hasOwnProperty('y');\n var sideX = left;\n var sideY = top;\n var win = window;\n\n if (adaptive) {\n var offsetParent = getOffsetParent(popper);\n var heightProp = 'clientHeight';\n var widthProp = 'clientWidth';\n\n if (offsetParent === getWindow(popper)) {\n offsetParent = getDocumentElement(popper);\n\n if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {\n heightProp = 'scrollHeight';\n widthProp = 'scrollWidth';\n }\n } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it\n\n\n offsetParent = offsetParent;\n\n if (placement === top || (placement === left || placement === right) && variation === end) {\n sideY = bottom;\n var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]\n offsetParent[heightProp];\n y -= offsetY - popperRect.height;\n y *= gpuAcceleration ? 1 : -1;\n }\n\n if (placement === left || (placement === top || placement === bottom) && variation === end) {\n sideX = right;\n var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]\n offsetParent[widthProp];\n x -= offsetX - popperRect.width;\n x *= gpuAcceleration ? 1 : -1;\n }\n }\n\n var commonStyles = Object.assign({\n position: position\n }, adaptive && unsetSides);\n\n var _ref4 = roundOffsets === true ? roundOffsetsByDPR({\n x: x,\n y: y\n }, getWindow(popper)) : {\n x: x,\n y: y\n };\n\n x = _ref4.x;\n y = _ref4.y;\n\n if (gpuAcceleration) {\n var _Object$assign;\n\n return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? \"translate(\" + x + \"px, \" + y + \"px)\" : \"translate3d(\" + x + \"px, \" + y + \"px, 0)\", _Object$assign));\n }\n\n return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + \"px\" : '', _Object$assign2[sideX] = hasX ? x + \"px\" : '', _Object$assign2.transform = '', _Object$assign2));\n}\n\nfunction computeStyles(_ref5) {\n var state = _ref5.state,\n options = _ref5.options;\n var _options$gpuAccelerat = options.gpuAcceleration,\n gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,\n _options$adaptive = options.adaptive,\n adaptive = _options$adaptive === void 0 ? true : _options$adaptive,\n _options$roundOffsets = options.roundOffsets,\n roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;\n var commonStyles = {\n placement: getBasePlacement(state.placement),\n variation: getVariation(state.placement),\n popper: state.elements.popper,\n popperRect: state.rects.popper,\n gpuAcceleration: gpuAcceleration,\n isFixed: state.options.strategy === 'fixed'\n };\n\n if (state.modifiersData.popperOffsets != null) {\n state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.popperOffsets,\n position: state.options.strategy,\n adaptive: adaptive,\n roundOffsets: roundOffsets\n })));\n }\n\n if (state.modifiersData.arrow != null) {\n state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.arrow,\n position: 'absolute',\n adaptive: false,\n roundOffsets: roundOffsets\n })));\n }\n\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-placement': state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'computeStyles',\n enabled: true,\n phase: 'beforeWrite',\n fn: computeStyles,\n data: {}\n};","import getWindow from \"../dom-utils/getWindow.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar passive = {\n passive: true\n};\n\nfunction effect(_ref) {\n var state = _ref.state,\n instance = _ref.instance,\n options = _ref.options;\n var _options$scroll = options.scroll,\n scroll = _options$scroll === void 0 ? true : _options$scroll,\n _options$resize = options.resize,\n resize = _options$resize === void 0 ? true : _options$resize;\n var window = getWindow(state.elements.popper);\n var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);\n\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.addEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.addEventListener('resize', instance.update, passive);\n }\n\n return function () {\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.removeEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.removeEventListener('resize', instance.update, passive);\n }\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'eventListeners',\n enabled: true,\n phase: 'write',\n fn: function fn() {},\n effect: effect,\n data: {}\n};","var hash = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nexport default function getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, function (matched) {\n return hash[matched];\n });\n}","var hash = {\n start: 'end',\n end: 'start'\n};\nexport default function getOppositeVariationPlacement(placement) {\n return placement.replace(/start|end/g, function (matched) {\n return hash[matched];\n });\n}","import getWindow from \"./getWindow.js\";\nexport default function getWindowScroll(node) {\n var win = getWindow(node);\n var scrollLeft = win.pageXOffset;\n var scrollTop = win.pageYOffset;\n return {\n scrollLeft: scrollLeft,\n scrollTop: scrollTop\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nexport default function getWindowScrollBarX(element) {\n // If has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n // Popper 1 is broken in this case and never had a bug report so let's assume\n // it's not an issue. I don't think anyone ever specifies width on \n // anyway.\n // Browsers where the left scrollbar doesn't cause an issue report `0` for\n // this (e.g. Edge 2019, IE11, Safari)\n return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;\n}","import getComputedStyle from \"./getComputedStyle.js\";\nexport default function isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n var _getComputedStyle = getComputedStyle(element),\n overflow = _getComputedStyle.overflow,\n overflowX = _getComputedStyle.overflowX,\n overflowY = _getComputedStyle.overflowY;\n\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}","import getParentNode from \"./getParentNode.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nexport default function getScrollParent(node) {\n if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return node.ownerDocument.body;\n }\n\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n\n return getScrollParent(getParentNode(node));\n}","import getScrollParent from \"./getScrollParent.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getWindow from \"./getWindow.js\";\nimport isScrollParent from \"./isScrollParent.js\";\n/*\ngiven a DOM element, return the list of all scroll parents, up the list of ancesors\nuntil we get to the top window object. This list is what we attach scroll listeners\nto, because if any of these parent elements scroll, we'll need to re-calculate the\nreference element's position.\n*/\n\nexport default function listScrollParents(element, list) {\n var _element$ownerDocumen;\n\n if (list === void 0) {\n list = [];\n }\n\n var scrollParent = getScrollParent(element);\n var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);\n var win = getWindow(scrollParent);\n var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;\n var updatedList = list.concat(target);\n return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here\n updatedList.concat(listScrollParents(getParentNode(target)));\n}","export default function rectToClientRect(rect) {\n return Object.assign({}, rect, {\n left: rect.x,\n top: rect.y,\n right: rect.x + rect.width,\n bottom: rect.y + rect.height\n });\n}","import { viewport } from \"../enums.js\";\nimport getViewportRect from \"./getViewportRect.js\";\nimport getDocumentRect from \"./getDocumentRect.js\";\nimport listScrollParents from \"./listScrollParents.js\";\nimport getOffsetParent from \"./getOffsetParent.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport contains from \"./contains.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport rectToClientRect from \"../utils/rectToClientRect.js\";\nimport { max, min } from \"../utils/math.js\";\n\nfunction getInnerBoundingClientRect(element, strategy) {\n var rect = getBoundingClientRect(element, false, strategy === 'fixed');\n rect.top = rect.top + element.clientTop;\n rect.left = rect.left + element.clientLeft;\n rect.bottom = rect.top + element.clientHeight;\n rect.right = rect.left + element.clientWidth;\n rect.width = element.clientWidth;\n rect.height = element.clientHeight;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\n\nfunction getClientRectFromMixedType(element, clippingParent, strategy) {\n return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));\n} // A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n\n\nfunction getClippingParents(element) {\n var clippingParents = listScrollParents(getParentNode(element));\n var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;\n var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n\n if (!isElement(clipperElement)) {\n return [];\n } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414\n\n\n return clippingParents.filter(function (clippingParent) {\n return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';\n });\n} // Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n\n\nexport default function getClippingRect(element, boundary, rootBoundary, strategy) {\n var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n var clippingParents = [].concat(mainClippingParents, [rootBoundary]);\n var firstClippingParent = clippingParents[0];\n var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {\n var rect = getClientRectFromMixedType(element, clippingParent, strategy);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromMixedType(element, firstClippingParent, strategy));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}","import getWindow from \"./getWindow.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getViewportRect(element, strategy) {\n var win = getWindow(element);\n var html = getDocumentElement(element);\n var visualViewport = win.visualViewport;\n var width = html.clientWidth;\n var height = html.clientHeight;\n var x = 0;\n var y = 0;\n\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n var layoutViewport = isLayoutViewport();\n\n if (layoutViewport || !layoutViewport && strategy === 'fixed') {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n\n return {\n width: width,\n height: height,\n x: x + getWindowScrollBarX(element),\n y: y\n };\n}","import getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nimport { max } from \"../utils/math.js\"; // Gets the entire size of the scrollable document area, even extending outside\n// of the `` and `` rect bounds if horizontally scrollable\n\nexport default function getDocumentRect(element) {\n var _element$ownerDocumen;\n\n var html = getDocumentElement(element);\n var winScroll = getWindowScroll(element);\n var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;\n var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n var x = -winScroll.scrollLeft + getWindowScrollBarX(element);\n var y = -winScroll.scrollTop;\n\n if (getComputedStyle(body || html).direction === 'rtl') {\n x += max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n\n return {\n width: width,\n height: height,\n x: x,\n y: y\n };\n}","import getBasePlacement from \"./getBasePlacement.js\";\nimport getVariation from \"./getVariation.js\";\nimport getMainAxisFromPlacement from \"./getMainAxisFromPlacement.js\";\nimport { top, right, bottom, left, start, end } from \"../enums.js\";\nexport default function computeOffsets(_ref) {\n var reference = _ref.reference,\n element = _ref.element,\n placement = _ref.placement;\n var basePlacement = placement ? getBasePlacement(placement) : null;\n var variation = placement ? getVariation(placement) : null;\n var commonX = reference.x + reference.width / 2 - element.width / 2;\n var commonY = reference.y + reference.height / 2 - element.height / 2;\n var offsets;\n\n switch (basePlacement) {\n case top:\n offsets = {\n x: commonX,\n y: reference.y - element.height\n };\n break;\n\n case bottom:\n offsets = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n\n case right:\n offsets = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n\n case left:\n offsets = {\n x: reference.x - element.width,\n y: commonY\n };\n break;\n\n default:\n offsets = {\n x: reference.x,\n y: reference.y\n };\n }\n\n var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;\n\n if (mainAxis != null) {\n var len = mainAxis === 'y' ? 'height' : 'width';\n\n switch (variation) {\n case start:\n offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);\n break;\n\n case end:\n offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);\n break;\n\n default:\n }\n }\n\n return offsets;\n}","import getClippingRect from \"../dom-utils/getClippingRect.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getBoundingClientRect from \"../dom-utils/getBoundingClientRect.js\";\nimport computeOffsets from \"./computeOffsets.js\";\nimport rectToClientRect from \"./rectToClientRect.js\";\nimport { clippingParents, reference, popper, bottom, top, right, basePlacements, viewport } from \"../enums.js\";\nimport { isElement } from \"../dom-utils/instanceOf.js\";\nimport mergePaddingObject from \"./mergePaddingObject.js\";\nimport expandToHashMap from \"./expandToHashMap.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport default function detectOverflow(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$placement = _options.placement,\n placement = _options$placement === void 0 ? state.placement : _options$placement,\n _options$strategy = _options.strategy,\n strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,\n _options$boundary = _options.boundary,\n boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,\n _options$rootBoundary = _options.rootBoundary,\n rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,\n _options$elementConte = _options.elementContext,\n elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,\n _options$altBoundary = _options.altBoundary,\n altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,\n _options$padding = _options.padding,\n padding = _options$padding === void 0 ? 0 : _options$padding;\n var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n var altContext = elementContext === popper ? reference : popper;\n var popperRect = state.rects.popper;\n var element = state.elements[altBoundary ? altContext : elementContext];\n var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);\n var referenceClientRect = getBoundingClientRect(state.elements.reference);\n var popperOffsets = computeOffsets({\n reference: referenceClientRect,\n element: popperRect,\n strategy: 'absolute',\n placement: placement\n });\n var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));\n var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n\n var overflowOffsets = {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element\n\n if (elementContext === popper && offsetData) {\n var offset = offsetData[placement];\n Object.keys(overflowOffsets).forEach(function (key) {\n var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;\n var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';\n overflowOffsets[key] += offset[axis] * multiply;\n });\n }\n\n return overflowOffsets;\n}","import getVariation from \"./getVariation.js\";\nimport { variationPlacements, basePlacements, placements as allPlacements } from \"../enums.js\";\nimport detectOverflow from \"./detectOverflow.js\";\nimport getBasePlacement from \"./getBasePlacement.js\";\nexport default function computeAutoPlacement(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n placement = _options.placement,\n boundary = _options.boundary,\n rootBoundary = _options.rootBoundary,\n padding = _options.padding,\n flipVariations = _options.flipVariations,\n _options$allowedAutoP = _options.allowedAutoPlacements,\n allowedAutoPlacements = _options$allowedAutoP === void 0 ? allPlacements : _options$allowedAutoP;\n var variation = getVariation(placement);\n var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {\n return getVariation(placement) === variation;\n }) : basePlacements;\n var allowedPlacements = placements.filter(function (placement) {\n return allowedAutoPlacements.indexOf(placement) >= 0;\n });\n\n if (allowedPlacements.length === 0) {\n allowedPlacements = placements;\n } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...\n\n\n var overflows = allowedPlacements.reduce(function (acc, placement) {\n acc[placement] = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding\n })[getBasePlacement(placement)];\n return acc;\n }, {});\n return Object.keys(overflows).sort(function (a, b) {\n return overflows[a] - overflows[b];\n });\n}","import getOppositePlacement from \"../utils/getOppositePlacement.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getOppositeVariationPlacement from \"../utils/getOppositeVariationPlacement.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport computeAutoPlacement from \"../utils/computeAutoPlacement.js\";\nimport { bottom, top, start, right, left, auto } from \"../enums.js\";\nimport getVariation from \"../utils/getVariation.js\"; // eslint-disable-next-line import/no-unused-modules\n\nfunction getExpandedFallbackPlacements(placement) {\n if (getBasePlacement(placement) === auto) {\n return [];\n }\n\n var oppositePlacement = getOppositePlacement(placement);\n return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];\n}\n\nfunction flip(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n\n if (state.modifiersData[name]._skip) {\n return;\n }\n\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,\n specifiedFallbackPlacements = options.fallbackPlacements,\n padding = options.padding,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n _options$flipVariatio = options.flipVariations,\n flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,\n allowedAutoPlacements = options.allowedAutoPlacements;\n var preferredPlacement = state.options.placement;\n var basePlacement = getBasePlacement(preferredPlacement);\n var isBasePlacement = basePlacement === preferredPlacement;\n var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));\n var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {\n return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n flipVariations: flipVariations,\n allowedAutoPlacements: allowedAutoPlacements\n }) : placement);\n }, []);\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var checksMap = new Map();\n var makeFallbackChecks = true;\n var firstFittingPlacement = placements[0];\n\n for (var i = 0; i < placements.length; i++) {\n var placement = placements[i];\n\n var _basePlacement = getBasePlacement(placement);\n\n var isStartVariation = getVariation(placement) === start;\n var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;\n var len = isVertical ? 'width' : 'height';\n var overflow = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n altBoundary: altBoundary,\n padding: padding\n });\n var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;\n\n if (referenceRect[len] > popperRect[len]) {\n mainVariationSide = getOppositePlacement(mainVariationSide);\n }\n\n var altVariationSide = getOppositePlacement(mainVariationSide);\n var checks = [];\n\n if (checkMainAxis) {\n checks.push(overflow[_basePlacement] <= 0);\n }\n\n if (checkAltAxis) {\n checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);\n }\n\n if (checks.every(function (check) {\n return check;\n })) {\n firstFittingPlacement = placement;\n makeFallbackChecks = false;\n break;\n }\n\n checksMap.set(placement, checks);\n }\n\n if (makeFallbackChecks) {\n // `2` may be desired in some cases – research later\n var numberOfChecks = flipVariations ? 3 : 1;\n\n var _loop = function _loop(_i) {\n var fittingPlacement = placements.find(function (placement) {\n var checks = checksMap.get(placement);\n\n if (checks) {\n return checks.slice(0, _i).every(function (check) {\n return check;\n });\n }\n });\n\n if (fittingPlacement) {\n firstFittingPlacement = fittingPlacement;\n return \"break\";\n }\n };\n\n for (var _i = numberOfChecks; _i > 0; _i--) {\n var _ret = _loop(_i);\n\n if (_ret === \"break\") break;\n }\n }\n\n if (state.placement !== firstFittingPlacement) {\n state.modifiersData[name]._skip = true;\n state.placement = firstFittingPlacement;\n state.reset = true;\n }\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'flip',\n enabled: true,\n phase: 'main',\n fn: flip,\n requiresIfExists: ['offset'],\n data: {\n _skip: false\n }\n};","import { top, bottom, left, right } from \"../enums.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\n\nfunction getSideOffsets(overflow, rect, preventedOffsets) {\n if (preventedOffsets === void 0) {\n preventedOffsets = {\n x: 0,\n y: 0\n };\n }\n\n return {\n top: overflow.top - rect.height - preventedOffsets.y,\n right: overflow.right - rect.width + preventedOffsets.x,\n bottom: overflow.bottom - rect.height + preventedOffsets.y,\n left: overflow.left - rect.width - preventedOffsets.x\n };\n}\n\nfunction isAnySideFullyClipped(overflow) {\n return [top, right, bottom, left].some(function (side) {\n return overflow[side] >= 0;\n });\n}\n\nfunction hide(_ref) {\n var state = _ref.state,\n name = _ref.name;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var preventedOffsets = state.modifiersData.preventOverflow;\n var referenceOverflow = detectOverflow(state, {\n elementContext: 'reference'\n });\n var popperAltOverflow = detectOverflow(state, {\n altBoundary: true\n });\n var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);\n var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);\n var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);\n var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);\n state.modifiersData[name] = {\n referenceClippingOffsets: referenceClippingOffsets,\n popperEscapeOffsets: popperEscapeOffsets,\n isReferenceHidden: isReferenceHidden,\n hasPopperEscaped: hasPopperEscaped\n };\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-reference-hidden': isReferenceHidden,\n 'data-popper-escaped': hasPopperEscaped\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'hide',\n enabled: true,\n phase: 'main',\n requiresIfExists: ['preventOverflow'],\n fn: hide\n};","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport { top, left, right, placements } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport function distanceAndSkiddingToXY(placement, rects, offset) {\n var basePlacement = getBasePlacement(placement);\n var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;\n\n var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {\n placement: placement\n })) : offset,\n skidding = _ref[0],\n distance = _ref[1];\n\n skidding = skidding || 0;\n distance = (distance || 0) * invertDistance;\n return [left, right].indexOf(basePlacement) >= 0 ? {\n x: distance,\n y: skidding\n } : {\n x: skidding,\n y: distance\n };\n}\n\nfunction offset(_ref2) {\n var state = _ref2.state,\n options = _ref2.options,\n name = _ref2.name;\n var _options$offset = options.offset,\n offset = _options$offset === void 0 ? [0, 0] : _options$offset;\n var data = placements.reduce(function (acc, placement) {\n acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);\n return acc;\n }, {});\n var _data$state$placement = data[state.placement],\n x = _data$state$placement.x,\n y = _data$state$placement.y;\n\n if (state.modifiersData.popperOffsets != null) {\n state.modifiersData.popperOffsets.x += x;\n state.modifiersData.popperOffsets.y += y;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'offset',\n enabled: true,\n phase: 'main',\n requires: ['popperOffsets'],\n fn: offset\n};","import computeOffsets from \"../utils/computeOffsets.js\";\n\nfunction popperOffsets(_ref) {\n var state = _ref.state,\n name = _ref.name;\n // Offsets are the actual position the popper needs to have to be\n // properly positioned near its reference element\n // This is the most basic placement, and will be adjusted by\n // the modifiers in the next step\n state.modifiersData[name] = computeOffsets({\n reference: state.rects.reference,\n element: state.rects.popper,\n strategy: 'absolute',\n placement: state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'popperOffsets',\n enabled: true,\n phase: 'read',\n fn: popperOffsets,\n data: {}\n};","import { top, left, right, bottom, start } from \"../enums.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport getAltAxis from \"../utils/getAltAxis.js\";\nimport { within, withinMaxClamp } from \"../utils/within.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport getFreshSideObject from \"../utils/getFreshSideObject.js\";\nimport { min as mathMin, max as mathMax } from \"../utils/math.js\";\n\nfunction preventOverflow(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n padding = options.padding,\n _options$tether = options.tether,\n tether = _options$tether === void 0 ? true : _options$tether,\n _options$tetherOffset = options.tetherOffset,\n tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;\n var overflow = detectOverflow(state, {\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n altBoundary: altBoundary\n });\n var basePlacement = getBasePlacement(state.placement);\n var variation = getVariation(state.placement);\n var isBasePlacement = !variation;\n var mainAxis = getMainAxisFromPlacement(basePlacement);\n var altAxis = getAltAxis(mainAxis);\n var popperOffsets = state.modifiersData.popperOffsets;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {\n placement: state.placement\n })) : tetherOffset;\n var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {\n mainAxis: tetherOffsetValue,\n altAxis: tetherOffsetValue\n } : Object.assign({\n mainAxis: 0,\n altAxis: 0\n }, tetherOffsetValue);\n var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;\n var data = {\n x: 0,\n y: 0\n };\n\n if (!popperOffsets) {\n return;\n }\n\n if (checkMainAxis) {\n var _offsetModifierState$;\n\n var mainSide = mainAxis === 'y' ? top : left;\n var altSide = mainAxis === 'y' ? bottom : right;\n var len = mainAxis === 'y' ? 'height' : 'width';\n var offset = popperOffsets[mainAxis];\n var min = offset + overflow[mainSide];\n var max = offset - overflow[altSide];\n var additive = tether ? -popperRect[len] / 2 : 0;\n var minLen = variation === start ? referenceRect[len] : popperRect[len];\n var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go\n // outside the reference bounds\n\n var arrowElement = state.elements.arrow;\n var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {\n width: 0,\n height: 0\n };\n var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();\n var arrowPaddingMin = arrowPaddingObject[mainSide];\n var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want\n // to include its full size in the calculation. If the reference is small\n // and near the edge of a boundary, the popper can overflow even if the\n // reference is not overflowing as well (e.g. virtual elements with no\n // width or height)\n\n var arrowLen = within(0, referenceRect[len], arrowRect[len]);\n var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;\n var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;\n var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);\n var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;\n var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;\n var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;\n var tetherMax = offset + maxOffset - offsetModifierValue;\n var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max);\n popperOffsets[mainAxis] = preventedOffset;\n data[mainAxis] = preventedOffset - offset;\n }\n\n if (checkAltAxis) {\n var _offsetModifierState$2;\n\n var _mainSide = mainAxis === 'x' ? top : left;\n\n var _altSide = mainAxis === 'x' ? bottom : right;\n\n var _offset = popperOffsets[altAxis];\n\n var _len = altAxis === 'y' ? 'height' : 'width';\n\n var _min = _offset + overflow[_mainSide];\n\n var _max = _offset - overflow[_altSide];\n\n var isOriginSide = [top, left].indexOf(basePlacement) !== -1;\n\n var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;\n\n var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;\n\n var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;\n\n var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);\n\n popperOffsets[altAxis] = _preventedOffset;\n data[altAxis] = _preventedOffset - _offset;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'preventOverflow',\n enabled: true,\n phase: 'main',\n fn: preventOverflow,\n requiresIfExists: ['offset']\n};","export default function getAltAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getNodeScroll from \"./getNodeScroll.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport { round } from \"../utils/math.js\";\n\nfunction isElementScaled(element) {\n var rect = element.getBoundingClientRect();\n var scaleX = round(rect.width) / element.offsetWidth || 1;\n var scaleY = round(rect.height) / element.offsetHeight || 1;\n return scaleX !== 1 || scaleY !== 1;\n} // Returns the composite rect of an element relative to its offsetParent.\n// Composite means it takes into account transforms as well as layout.\n\n\nexport default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n\n var isOffsetParentAnElement = isHTMLElement(offsetParent);\n var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);\n var documentElement = getDocumentElement(offsetParent);\n var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);\n var scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n var offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078\n isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n offsets = getBoundingClientRect(offsetParent, true);\n offsets.x += offsetParent.clientLeft;\n offsets.y += offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}","import getWindowScroll from \"./getWindowScroll.js\";\nimport getWindow from \"./getWindow.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getHTMLElementScroll from \"./getHTMLElementScroll.js\";\nexport default function getNodeScroll(node) {\n if (node === getWindow(node) || !isHTMLElement(node)) {\n return getWindowScroll(node);\n } else {\n return getHTMLElementScroll(node);\n }\n}","export default function getHTMLElementScroll(element) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}","import { modifierPhases } from \"../enums.js\"; // source: https://stackoverflow.com/questions/49875255\n\nfunction order(modifiers) {\n var map = new Map();\n var visited = new Set();\n var result = [];\n modifiers.forEach(function (modifier) {\n map.set(modifier.name, modifier);\n }); // On visiting object, check for its dependencies and visit them recursively\n\n function sort(modifier) {\n visited.add(modifier.name);\n var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);\n requires.forEach(function (dep) {\n if (!visited.has(dep)) {\n var depModifier = map.get(dep);\n\n if (depModifier) {\n sort(depModifier);\n }\n }\n });\n result.push(modifier);\n }\n\n modifiers.forEach(function (modifier) {\n if (!visited.has(modifier.name)) {\n // check for visited object\n sort(modifier);\n }\n });\n return result;\n}\n\nexport default function orderModifiers(modifiers) {\n // order based on dependencies\n var orderedModifiers = order(modifiers); // order based on phase\n\n return modifierPhases.reduce(function (acc, phase) {\n return acc.concat(orderedModifiers.filter(function (modifier) {\n return modifier.phase === phase;\n }));\n }, []);\n}","import getCompositeRect from \"./dom-utils/getCompositeRect.js\";\nimport getLayoutRect from \"./dom-utils/getLayoutRect.js\";\nimport listScrollParents from \"./dom-utils/listScrollParents.js\";\nimport getOffsetParent from \"./dom-utils/getOffsetParent.js\";\nimport orderModifiers from \"./utils/orderModifiers.js\";\nimport debounce from \"./utils/debounce.js\";\nimport mergeByName from \"./utils/mergeByName.js\";\nimport detectOverflow from \"./utils/detectOverflow.js\";\nimport { isElement } from \"./dom-utils/instanceOf.js\";\nvar DEFAULT_OPTIONS = {\n placement: 'bottom',\n modifiers: [],\n strategy: 'absolute'\n};\n\nfunction areValidElements() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return !args.some(function (element) {\n return !(element && typeof element.getBoundingClientRect === 'function');\n });\n}\n\nexport function popperGenerator(generatorOptions) {\n if (generatorOptions === void 0) {\n generatorOptions = {};\n }\n\n var _generatorOptions = generatorOptions,\n _generatorOptions$def = _generatorOptions.defaultModifiers,\n defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,\n _generatorOptions$def2 = _generatorOptions.defaultOptions,\n defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;\n return function createPopper(reference, popper, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n var state = {\n placement: 'bottom',\n orderedModifiers: [],\n options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),\n modifiersData: {},\n elements: {\n reference: reference,\n popper: popper\n },\n attributes: {},\n styles: {}\n };\n var effectCleanupFns = [];\n var isDestroyed = false;\n var instance = {\n state: state,\n setOptions: function setOptions(setOptionsAction) {\n var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;\n cleanupModifierEffects();\n state.options = Object.assign({}, defaultOptions, state.options, options);\n state.scrollParents = {\n reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],\n popper: listScrollParents(popper)\n }; // Orders the modifiers based on their dependencies and `phase`\n // properties\n\n var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers\n\n state.orderedModifiers = orderedModifiers.filter(function (m) {\n return m.enabled;\n });\n runModifierEffects();\n return instance.update();\n },\n // Sync update – it will always be executed, even if not necessary. This\n // is useful for low frequency updates where sync behavior simplifies the\n // logic.\n // For high frequency updates (e.g. `resize` and `scroll` events), always\n // prefer the async Popper#update method\n forceUpdate: function forceUpdate() {\n if (isDestroyed) {\n return;\n }\n\n var _state$elements = state.elements,\n reference = _state$elements.reference,\n popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements\n // anymore\n\n if (!areValidElements(reference, popper)) {\n return;\n } // Store the reference and popper rects to be read by modifiers\n\n\n state.rects = {\n reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),\n popper: getLayoutRect(popper)\n }; // Modifiers have the ability to reset the current update cycle. The\n // most common use case for this is the `flip` modifier changing the\n // placement, which then needs to re-run all the modifiers, because the\n // logic was previously ran for the previous placement and is therefore\n // stale/incorrect\n\n state.reset = false;\n state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier\n // is filled with the initial data specified by the modifier. This means\n // it doesn't persist and is fresh on each update.\n // To ensure persistent data, use `${name}#persistent`\n\n state.orderedModifiers.forEach(function (modifier) {\n return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);\n });\n\n for (var index = 0; index < state.orderedModifiers.length; index++) {\n if (state.reset === true) {\n state.reset = false;\n index = -1;\n continue;\n }\n\n var _state$orderedModifie = state.orderedModifiers[index],\n fn = _state$orderedModifie.fn,\n _state$orderedModifie2 = _state$orderedModifie.options,\n _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,\n name = _state$orderedModifie.name;\n\n if (typeof fn === 'function') {\n state = fn({\n state: state,\n options: _options,\n name: name,\n instance: instance\n }) || state;\n }\n }\n },\n // Async and optimistically optimized update – it will not be executed if\n // not necessary (debounced to run at most once-per-tick)\n update: debounce(function () {\n return new Promise(function (resolve) {\n instance.forceUpdate();\n resolve(state);\n });\n }),\n destroy: function destroy() {\n cleanupModifierEffects();\n isDestroyed = true;\n }\n };\n\n if (!areValidElements(reference, popper)) {\n return instance;\n }\n\n instance.setOptions(options).then(function (state) {\n if (!isDestroyed && options.onFirstUpdate) {\n options.onFirstUpdate(state);\n }\n }); // Modifiers have the ability to execute arbitrary code before the first\n // update cycle runs. They will be executed in the same order as the update\n // cycle. This is useful when a modifier adds some persistent data that\n // other modifiers need to use, but the modifier is run after the dependent\n // one.\n\n function runModifierEffects() {\n state.orderedModifiers.forEach(function (_ref) {\n var name = _ref.name,\n _ref$options = _ref.options,\n options = _ref$options === void 0 ? {} : _ref$options,\n effect = _ref.effect;\n\n if (typeof effect === 'function') {\n var cleanupFn = effect({\n state: state,\n name: name,\n instance: instance,\n options: options\n });\n\n var noopFn = function noopFn() {};\n\n effectCleanupFns.push(cleanupFn || noopFn);\n }\n });\n }\n\n function cleanupModifierEffects() {\n effectCleanupFns.forEach(function (fn) {\n return fn();\n });\n effectCleanupFns = [];\n }\n\n return instance;\n };\n}\nexport var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules\n\nexport { detectOverflow };","export default function debounce(fn) {\n var pending;\n return function () {\n if (!pending) {\n pending = new Promise(function (resolve) {\n Promise.resolve().then(function () {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}","export default function mergeByName(modifiers) {\n var merged = modifiers.reduce(function (merged, current) {\n var existing = merged[current.name];\n merged[current.name] = existing ? Object.assign({}, existing, current, {\n options: Object.assign({}, existing.options, current.options),\n data: Object.assign({}, existing.data, current.data)\n }) : current;\n return merged;\n }, {}); // IE11 does not support Object.values\n\n return Object.keys(merged).map(function (key) {\n return merged[key];\n });\n}","import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow };","import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nimport offset from \"./modifiers/offset.js\";\nimport flip from \"./modifiers/flip.js\";\nimport preventOverflow from \"./modifiers/preventOverflow.js\";\nimport arrow from \"./modifiers/arrow.js\";\nimport hide from \"./modifiers/hide.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles, offset, flip, preventOverflow, arrow, hide];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow }; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper as createPopperLite } from \"./popper-lite.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport * from \"./modifiers/index.js\";","/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {DropdownItem} from \"./tobago-dropdown-item\";\nimport {Css} from \"./tobago-css\";\n\nexport class DropdownItemFactory {\n static create(dropdownMenu: HTMLDivElement): DropdownItem[] {\n if (dropdownMenu.classList.contains(Css.TOBAGO_DROPDOWN_MENU)) {\n const dropdownItems: DropdownItem[] = [];\n dropdownMenu.querySelectorAll(\n \":scope > a.dropdown-item, \"\n + \":scope > button.dropdown-item, \"\n + \":scope > tobago-select-boolean-checkbox.dropdown-item > input, \"\n + \":scope > tobago-select-boolean-toggle.dropdown-item > input, \"\n + \":scope > tobago-select-one-radio > .dropdown-item > input, \"\n + \":scope > tobago-select-many-checkbox > .dropdown-item > input, \"\n + \":scope > tobago-dropdown.tobago-dropdown-submenu > .dropdown-item\").forEach(\n (element) => {\n dropdownItems.push(new DropdownItem(element));\n }\n );\n return dropdownItems;\n } else {\n console.error(\"Given element is no dropdown menu.\");\n }\n }\n}\n","/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {Css} from \"./tobago-css\";\nimport {DropdownItemFactory} from \"./tobago-dropdown-item-factory\";\n\nexport class DropdownItem {\n private _element: HTMLElement;\n\n constructor(element: HTMLElement) {\n this._element = element;\n }\n\n get ancestors(): DropdownItem[] {\n const ancestors: DropdownItem[] = [];\n let dropdownItem: DropdownItem = this as DropdownItem;\n while (dropdownItem != null) {\n ancestors.push(dropdownItem);\n dropdownItem = dropdownItem.parent;\n }\n return ancestors;\n }\n\n get children(): DropdownItem[] {\n const dropdownMenu = this.dropdownMenu;\n if (dropdownMenu) {\n return DropdownItemFactory.create(dropdownMenu);\n }\n }\n\n get element(): HTMLElement {\n return this._element;\n }\n\n get disabled(): boolean {\n const input = this.element.querySelector(\"input\");\n return input ? input.disabled : this.element.getAttribute(\"disabled\") === \"disabled\";\n }\n\n get focused(): boolean {\n const root = this.element.getRootNode() as ShadowRoot | Document;\n return root.activeElement === this.element;\n }\n\n get parent(): DropdownItem {\n const dropdownItemElement: HTMLElement = this.element\n .closest(`.${Css.TOBAGO_DROPDOWN_MENU}`)\n ?.closest(\"tobago-dropdown\")\n ?.querySelector(\":scope.\" + Css.TOBAGO_DROPDOWN_SUBMENU + \" > .\" + Css.DROPDOWN_ITEM);\n return dropdownItemElement ? new DropdownItem(dropdownItemElement) : null;\n }\n\n get siblings(): DropdownItem[] {\n const dropdownMenu: HTMLDivElement = this.element.closest(`.${Css.TOBAGO_DROPDOWN_MENU}`);\n if (dropdownMenu) {\n return DropdownItemFactory.create(dropdownMenu);\n }\n }\n\n private get dropdownMenu(): HTMLDivElement {\n return this.element.parentElement.querySelector(\":scope > .\" + Css.TOBAGO_DROPDOWN_MENU);\n }\n\n focus(options?: FocusOptions): void {\n this.element.focus(options);\n }\n\n showSubMenu(): void {\n if (!this.disabled && this.dropdownMenu) {\n this.element.parentElement.classList.add(Css.TOBAGO_SHOW);\n }\n }\n\n hideSubMenu(): void {\n if (this.dropdownMenu) {\n this.element.parentElement.classList.remove(Css.TOBAGO_SHOW);\n }\n }\n}\n","/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {MenuStore} from \"./tobago-menu-store\";\nimport {Css} from \"./tobago-css\";\nimport {Key} from \"./tobago-key\";\nimport {createPopper, Instance} from \"@popperjs/core\";\nimport {DropdownItem} from \"./tobago-dropdown-item\";\nimport {DropdownItemFactory} from \"./tobago-dropdown-item-factory\";\n\nconst TobagoDropdownEvent = {\n HIDE: \"tobago.dropdown.hide\",\n HIDDEN: \"tobago.dropdown.hidden\",\n SHOW: \"tobago.dropdown.show\",\n SHOWN: \"tobago.dropdown.shown\"\n};\n\n/**\n * The dropdown implementation of Bootstrap does not move the menu to the tobago-page-menuStore. This behavior is\n * implemented in this class.\n */\nclass Dropdown extends HTMLElement {\n\n private popper: Instance;\n private globalClickEventListener: EventListenerOrEventListenerObject;\n\n constructor() {\n super();\n }\n\n connectedCallback(): void {\n if (!this.classList.contains(Css.TOBAGO_DROPDOWN_SUBMENU)) { // ignore submenus\n this.popper = createPopper(this.toggle, this.dropdownMenu, {\n placement: this.dropdownMenu.classList.contains(Css.DROPDOWN_MENU_END) ? \"bottom-end\" : \"bottom-start\",\n });\n this.globalClickEventListener = this.globalClickEvent.bind(this) as EventListenerOrEventListenerObject;\n document.addEventListener(\"click\", this.globalClickEventListener);\n this.addEventListener(\"keydown\", this.keydownEvent.bind(this));\n this.dropdownMenu.addEventListener(\"keydown\", this.keydownEvent.bind(this));\n this.toggle.addEventListener(\"keydown\", this.tabHandling.bind(this));\n this.getAllDropdownItems(this.dropdownItems).forEach((dropdownItem) => {\n dropdownItem.element.addEventListener(\"focus\", this.focusEvent.bind(this));\n if (dropdownItem.children) {\n dropdownItem.element.addEventListener(\"mouseenter\", this.mouseenterEvent.bind(this));\n }\n });\n }\n // the click should not sort the column of a table - XXX not very nice - may look for a better solution\n if (this.closest(\"tr\") != null) {\n this.addEventListener(\"click\", (event) => {\n event.stopPropagation();\n if (this.expanded) {\n this.hideDropdown();\n } else {\n this.showDropdown();\n }\n });\n }\n }\n\n disconnectedCallback(): void {\n document.removeEventListener(\"click\", this.globalClickEventListener);\n MenuStore.get().querySelector(`:scope > .${Css.TOBAGO_DROPDOWN_MENU}[name='${this.id}']`)?.remove();\n }\n\n get toggle(): HTMLButtonElement {\n return this.querySelector(\".dropdown-toggle\");\n }\n\n get expanded(): boolean {\n return this.toggle.ariaExpanded === \"true\";\n }\n\n get dropdownItems(): DropdownItem[] {\n return DropdownItemFactory.create(this.dropdownMenu);\n }\n\n get dropdownMenu(): HTMLDivElement {\n const root = this.getRootNode() as ShadowRoot | Document;\n return root.querySelector(`.${Css.TOBAGO_DROPDOWN_MENU}[name='${this.id}']`);\n }\n\n private globalClickEvent(event: MouseEvent): void {\n if (!this.toggle.disabled) {\n const element = (event.target as Element);\n if (this.isPartOfDropdown(event.target as Element)) {\n if (element.getAttribute(\"for\") !== null || element.tagName === \"INPUT\") {\n /* do nothing if for-label, because click event triggers a second time on input element\n do nothing if input element, because dropdown menu should stay open */\n } else if (element.querySelector(\":scope.dropdown-item > input\") !== null) {\n element.querySelector(\":scope.dropdown-item > input\")?.click();\n } else if (this.getSubMenuToggle(element as HTMLElement) !== null) {\n const subMenuToggle = this.getSubMenuToggle(element as HTMLElement);\n subMenuToggle.click();\n } else if (this.expanded) {\n this.hideDropdown();\n } else {\n this.showDropdown();\n }\n } else {\n this.hideDropdown();\n }\n }\n }\n\n private isPartOfDropdown(element: Element): boolean {\n if (element) {\n if (this.id === element.id || this.id === element.getAttribute(\"name\")) {\n return true;\n } else {\n return element.parentElement ? this.isPartOfDropdown(element.parentElement) : false;\n }\n } else {\n return false;\n }\n }\n\n private getSubMenuToggle(element: HTMLElement): HTMLElement {\n if (element && element.classList.contains(Css.DROPDOWN_ITEM)\n && element.parentElement && element.parentElement.classList.contains(Css.TOBAGO_DROPDOWN_SUBMENU)) {\n return element;\n } else if (element.parentElement) {\n return this.getSubMenuToggle(element.parentElement);\n } else {\n return null;\n }\n }\n\n private keydownEvent(event: KeyboardEvent): void {\n switch (event.key) {\n case Key.ARROW_DOWN:\n event.preventDefault(); //prevent click event if radio button is selected\n this.showDropdown();\n this.getNextDropdownItem()?.focus();\n break;\n case Key.ARROW_UP:\n event.preventDefault(); //prevent click event if radio button is selected\n this.showDropdown();\n this.getPreviousDropdownItem()?.focus();\n break;\n case Key.ARROW_RIGHT:\n event.preventDefault(); //prevent click event if radio button is selected\n this.getSubmenuDropdownItem()?.focus();\n break;\n case Key.ARROW_LEFT:\n event.preventDefault(); //prevent click event if radio button is selected\n this.getParentDropdownItem()?.focus();\n break;\n case Key.ESCAPE:\n this.hideDropdown();\n break;\n default:\n break;\n }\n }\n\n private tabHandling(event: KeyboardEvent): void {\n if (event.key === Key.TAB) {\n if (event.shiftKey) {\n this.hideDropdown();\n } else if (this.dropdownMenu.classList.contains(Css.SHOW)) {\n event.preventDefault(); //avoid selecting second element\n this.getNextDropdownItem()?.focus();\n }\n }\n }\n\n private showDropdown(): void {\n this.dispatchEvent(new CustomEvent(TobagoDropdownEvent.SHOW));\n\n // use Css.SHOW instead of Css.TOBAGO_SHOW for first dropdown menu to use bootstrap CSS\n if (!this.insideNavbar() && !this.dropdownMenu.classList.contains(Css.SHOW)) {\n MenuStore.appendChild(this.dropdownMenu);\n }\n this.toggle.classList.add(Css.SHOW);\n this.toggle.ariaExpanded = \"true\";\n this.dropdownMenu.classList.add(Css.SHOW);\n this.popper.update();\n\n this.dispatchEvent(new CustomEvent(TobagoDropdownEvent.SHOWN));\n }\n\n private hideDropdown(): void {\n this.dispatchEvent(new CustomEvent(TobagoDropdownEvent.HIDE));\n\n // use Css.SHOW instead of Css.TOBAGO_SHOW for first dropdown menu to use bootstrap CSS\n this.toggle.classList.remove(Css.SHOW);\n this.toggle.ariaExpanded = \"false\";\n this.dropdownMenu.classList.remove(Css.SHOW);\n this.getAllDropdownItems(this.dropdownItems).forEach((dropdownItem) => dropdownItem.hideSubMenu());\n if (!this.insideNavbar()) {\n this.appendChild(this.dropdownMenu);\n }\n\n this.dispatchEvent(new CustomEvent(TobagoDropdownEvent.HIDDEN));\n }\n\n private getNextDropdownItem(): DropdownItem {\n const focusedDropdownItem = this.getFocusedDropdownItem(this.dropdownItems);\n if (focusedDropdownItem) {\n const enabledDropdownItems = this.getEnabledDropdownItems(focusedDropdownItem.siblings);\n if (enabledDropdownItems.length > 0) {\n const index = enabledDropdownItems.findIndex((value) => value.element === focusedDropdownItem.element);\n const newIndex = index === -1 ? 0 : index + 1;\n if (newIndex >= 0 && newIndex < enabledDropdownItems.length) {\n return enabledDropdownItems[newIndex];\n } else {\n return enabledDropdownItems[0];\n }\n }\n } else {\n const enabledDropdownItems = this.getEnabledDropdownItems(this.dropdownItems);\n if (enabledDropdownItems.length > 0) {\n return enabledDropdownItems[0];\n }\n }\n }\n\n private getPreviousDropdownItem(): DropdownItem {\n const focusedDropdownItem = this.getFocusedDropdownItem(this.dropdownItems);\n if (focusedDropdownItem) {\n const enabledDropdownItems = this.getEnabledDropdownItems(focusedDropdownItem.siblings);\n if (enabledDropdownItems.length > 0) {\n const index = enabledDropdownItems.findIndex((value) => value.element === focusedDropdownItem.element);\n const newIndex = index === -1 ? 0 : index - 1;\n if (newIndex >= 0 && newIndex < enabledDropdownItems.length) {\n return enabledDropdownItems[newIndex];\n } else {\n return enabledDropdownItems[enabledDropdownItems.length - 1];\n }\n }\n } else {\n const enabledDropdownItems = this.getEnabledDropdownItems(this.dropdownItems);\n if (enabledDropdownItems.length > 0) {\n return enabledDropdownItems[enabledDropdownItems.length - 1];\n }\n }\n }\n\n private getSubmenuDropdownItem(): DropdownItem {\n const focusedDropdownItems = this.getFocusedDropdownItem(this.dropdownItems);\n if (focusedDropdownItems && focusedDropdownItems.children) {\n const enabledDropdownItems = this.getEnabledDropdownItems(focusedDropdownItems.children);\n if (enabledDropdownItems.length > 0) {\n return enabledDropdownItems[0];\n }\n }\n }\n\n private getParentDropdownItem(): DropdownItem {\n const focusedDropdownItems = this.getFocusedDropdownItem(this.dropdownItems);\n if (focusedDropdownItems) {\n return focusedDropdownItems.parent;\n }\n }\n\n private focusEvent(event: FocusEvent): void {\n const dropdownItem = new DropdownItem(event.target as HTMLElement);\n this.handleSubMenuShowState(dropdownItem);\n }\n\n private mouseenterEvent(event: MouseEvent): void {\n const dropdownItem = new DropdownItem(event.target as HTMLElement);\n this.handleSubMenuShowState(dropdownItem);\n }\n\n private handleSubMenuShowState(dropdownItem: DropdownItem) {\n const ancestors: DropdownItem[] = dropdownItem.ancestors;\n const allDropdownItems: DropdownItem[] = this.getAllDropdownItems(this.dropdownItems);\n allDropdownItems.forEach((dropdownItem) => {\n if (ancestors.find((ancestor) => ancestor.element === dropdownItem.element)) {\n dropdownItem.showSubMenu();\n } else {\n dropdownItem.hideSubMenu();\n }\n });\n }\n\n private getFocusedDropdownItem(dropdownItems: DropdownItem[]): DropdownItem {\n if (dropdownItems) {\n for (const dropdownItem of dropdownItems) {\n const focusedDropdownItem = this.getFocusedDropdownItem(dropdownItem.children);\n if (focusedDropdownItem != null) {\n return focusedDropdownItem;\n } else if (dropdownItem.focused) {\n return dropdownItem;\n }\n }\n }\n }\n\n private getEnabledDropdownItems(dropdownItems: DropdownItem[]): DropdownItem[] {\n const enabledDropdownItems: DropdownItem[] = [];\n dropdownItems.forEach((dropdownItem) => {\n if (!dropdownItem.disabled) {\n enabledDropdownItems.push(dropdownItem);\n }\n });\n return enabledDropdownItems;\n }\n\n private getAllDropdownItems(dropdownItems: DropdownItem[]): DropdownItem[] {\n let allDropdownItems: DropdownItem[] = [];\n dropdownItems.forEach((dropdownItem) => {\n allDropdownItems.push(dropdownItem);\n if (dropdownItem.children) {\n allDropdownItems = allDropdownItems.concat(this.getAllDropdownItems(dropdownItem.children));\n }\n });\n return allDropdownItems;\n }\n\n /**\n * The bootstrap dropdown implementation doesn't adjust the position of the dropdown menu if inside a '.navbar'.\n * In this case the dropdown menu should not be appended to the menu store.\n * https://github.com/twbs/bootstrap/blob/0d81d3cbc14dfcdca8a868e3f25189a4f1ab273c/js/src/dropdown.js#L294\n */\n private insideNavbar(): boolean {\n return Boolean(this.closest(\".navbar\"));\n }\n}\n\ndocument.addEventListener(\"tobago.init\", function (event: Event): void {\n if (window.customElements.get(\"tobago-dropdown\") == null) {\n window.customElements.define(\"tobago-dropdown\", Dropdown);\n }\n});\n","/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum OverlayType {\n dropZone = \"drop-zone\",\n error = \"error\",\n submit = \"submit\",\n ajax = \"ajax\"\n}\n","/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport class PageStatic {\n /**\n * \"a:b\" -> \"a\"\n * \"a:b:c\" -> \"a:b\"\n * \"a\" -> null\n * null -> null\n * \"a:b::sub-component\" -> \"a\"\n * \"a::sub-component:b\" -> \"a::sub-component\" // should currently not happen in Tobago\n *\n * @param clientId The clientId of a component.\n * @return The clientId of the naming container.\n */\n static getNamingContainerId(clientId: string): string {\n if (clientId == null || clientId.lastIndexOf(\":\") === -1) {\n return null;\n }\n\n const strings = Array.from(clientId);\n for (let i = strings.length - 2; i > 0; i--) {\n if (strings[i - 1] !== \":\" && strings[i] === \":\" && strings[i + 1] !== \":\") {\n return clientId.substring(0, i);\n }\n }\n return null;\n }\n}\n","/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Overlay} from \"./tobago-overlay\";\nimport {OverlayType} from \"./tobago-overlay-type\";\nimport {Key} from \"./tobago-key\";\nimport {PageStatic} from \"./tobago-page-static\";\n\nexport class Page extends HTMLElement {\n\n submitActive = false;\n\n /**\n * The Tobago root element\n */\n static page(element: HTMLElement): Page {\n const rootNode = element.getRootNode() as ShadowRoot | Document;\n const pages = rootNode.querySelectorAll(\"tobago-page\");\n if (pages.length > 0) {\n if (pages.length >= 2) {\n console.warn(\"Found more than one tobago-page element!\");\n }\n return pages.item(0) as Page;\n }\n console.warn(\"Found no tobago page!\");\n return null;\n }\n\n constructor() {\n super();\n }\n\n connectedCallback(): void {\n\n this.registerAjaxListener();\n\n this.form.addEventListener(\"submit\", this.beforeSubmit.bind(this));\n\n window.addEventListener(\"unload\", this.beforeUnload.bind(this));\n\n window.addEventListener(\"keydown\", (event: KeyboardEvent): boolean => {\n if (event.key === Key.ENTER) {\n const target = event.target as HTMLElement;\n if (target.tagName === \"A\" || target.tagName === \"BUTTON\") {\n return true;\n }\n if (target.tagName === \"TEXTAREA\") {\n if (!event.metaKey && !event.ctrlKey) {\n return true;\n }\n }\n const name = target.getAttribute(\"name\");\n let id = name ? name : target.id;\n while (id != null) {\n const command = document.querySelector(`[data-tobago-default='${id}']`);\n if (command) {\n command.dispatchEvent(new MouseEvent(\"click\"));\n return false;\n }\n id = PageStatic.getNamingContainerId(id);\n }\n document.querySelector(\"[data-tobago-default]\");\n }\n });\n }\n\n beforeSubmit(event: Event, decoupled = false): void {\n this.submitActive = true;\n if (!decoupled) {\n this.body.insertAdjacentHTML(\"beforeend\",\n Overlay.htmlText(this.id, OverlayType.submit, this.waitOverlayDelayFull));\n }\n console.debug(this.body.querySelector(\"tobago-overlay\"));\n }\n\n /**\n * Wrapper function to call application generated onunload function\n */\n beforeUnload(): void {\n console.debug(\"unload\");\n // todo: here me may check, if user will loose its edit state on the page\n }\n\n registerAjaxListener(): void {\n faces.ajax.addOnEvent(this.facesResponse.bind(this));\n }\n\n facesResponse(event: EventData): void {\n console.timeEnd(\"[tobago-faces] faces-ajax\");\n console.time(\"[tobago-faces] faces-ajax\");\n console.debug(\"[tobago-faces] Faces event status: '%s'\", event.status);\n if (event.status === \"success\" && event.responseXML) {\n event.responseXML.querySelectorAll(\"update\").forEach(this.facesResponseSuccess.bind(this));\n } else if (event.status === \"complete\" && event.responseXML) {\n event.responseXML.querySelectorAll(\"update\").forEach(this.facesResponseComplete.bind(this));\n }\n }\n\n facesResponseSuccess(update: Element): void {\n const id = update.id;\n let rootNode = this.getRootNode() as ShadowRoot | Document;\n // XXX in case of \"this\" is tobago-page (e.g. ajax exception handling) rootNode is not set correctly???\n if (!rootNode.getElementById) {\n rootNode = document;\n }\n console.debug(\"[tobago-faces] Update after faces.ajax success: %s\", id);\n }\n\n facesResponseComplete(update: Element): void {\n const id = update.id;\n if (!FacesParameter.isInternalFacesId(id)) {\n console.debug(\"[tobago-faces] Update after faces.ajax complete: #\", id);\n const overlay = this.querySelector(`tobago-overlay[for='${id}']`);\n if (overlay) {\n overlay.remove();\n } else {\n console.warn(\"Didn't found overlay for id\", id);\n }\n }\n }\n\n get form(): HTMLFormElement {\n return this.querySelector(\"form\");\n }\n\n get body(): HTMLBodyElement {\n return this.closest(\"body\");\n }\n\n get locale(): string {\n let locale = this.getAttribute(\"locale\");\n if (!locale) {\n locale = document.documentElement.lang;\n }\n return locale;\n }\n\n get focusOnError(): boolean {\n return this.getAttribute(\"focus-on-error\") === \"true\";\n }\n\n set focusOnError(focusOnError: boolean) {\n this.setAttribute(\"focus-on-error\", String(focusOnError));\n }\n\n get waitOverlayDelayFull(): number {\n return parseInt(this.getAttribute(\"wait-overlay-delay-full\")) || 1000;\n }\n\n set waitOverlayDelayFull(waitOverlayDelayFull: number) {\n this.setAttribute(\"wait-overlay-delay-full\", String(waitOverlayDelayFull));\n }\n\n get waitOverlayDelayAjax(): number {\n return parseInt(this.getAttribute(\"wait-overlay-delay-ajax\")) || 1000;\n }\n\n set waitOverlayDelayAjax(waitOverlayDelayAjax: number) {\n this.setAttribute(\"wait-overlay-delay-ajax\", waitOverlayDelayAjax.toString());\n }\n\n}\n\ndocument.addEventListener(\"tobago.init\", (event: Event): void => {\n if (window.customElements.get(\"tobago-page\") == null) {\n window.customElements.define(\"tobago-page\", Page);\n }\n});\n\nclass FacesParameter {\n\n static VIEW_STATE = \"jakarta.faces.ViewState\";\n static CLIENT_WINDOW = \"jakarta.faces.ClientWindow\";\n static VIEW_ROOT = \"jakarta.faces.ViewRoot\";\n static VIEW_HEAD = \"jakarta.faces.ViewHead\";\n static VIEW_BODY = \"jakarta.faces.ViewBody\";\n static RESOURCE = \"jakarta.faces.Resource\";\n\n static isInternalFacesId(id: string): boolean {\n return id.indexOf(\"jakarta.faces.\") !== -1;\n }\n\n static isFacesBody(id): boolean {\n switch (id) {\n case FacesParameter.VIEW_ROOT:\n case FacesParameter.VIEW_BODY:\n return true;\n default:\n return false;\n }\n }\n}\n","/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Create a overlay barrier and animate it.\n */\n\nimport {Page} from \"./tobago-page\";\nimport {OverlayType} from \"./tobago-overlay-type\";\nimport {Css} from \"./tobago-css\";\n\n// XXX issue: if a ajax call is scheduled on the same element, the animation arrow will stacking and not desapearing.\n// XXX issue: \"error\" is not implemented correctly\n// see http://localhost:8080/demo-5-snapshot/content/140-partial/Partial_Ajax.xhtml to use this feature\n// XXX todo: check full page transitions\n\nexport class Overlay extends HTMLElement {\n static htmlText(id: string, type: OverlayType, delay: number): string {\n return ``;\n }\n\n private timeout;\n\n constructor() {\n super();\n }\n\n connectedCallback(): void {\n this.timeout = setTimeout(this.render.bind(this), this.delay);\n }\n\n disconnectedCallback() {\n clearTimeout(this.timeout);\n const forElement = document.getElementById(this.for);\n if (forElement) {\n forElement.classList.remove(Css.POSITION_RELATIVE);\n }\n this.showScrollbar();\n }\n\n render(): void {\n this.classList.add(Css.SHOW);\n let icon;\n switch (this.type) {\n case OverlayType.error:\n icon = \"\";\n break;\n case OverlayType.dropZone:\n icon = \"\";\n break;\n case OverlayType.submit:\n this.hideScrollbar();\n case OverlayType.ajax:\n icon = \"\";\n break;\n default:\n icon = \"\";\n }\n\n this.insertAdjacentHTML(\"afterbegin\", icon);\n\n const forElement = document.getElementById(this.for);\n if (forElement) {\n forElement.classList.add(Css.POSITION_RELATIVE);\n this.style.position = \"absolute\";\n const boundingClientRect = forElement.getBoundingClientRect();\n this.style.width = `${boundingClientRect.width}px`;\n this.style.height = `${boundingClientRect.height}px`;\n }\n }\n\n private hideScrollbar() {\n document.body.style.overflow = \"hidden\";\n document.body.style.paddingRight = `${this.scrollbarWidth}px`;\n }\n\n private showScrollbar() {\n document.body.style.overflow = null;\n document.body.style.paddingRight = null;\n }\n\n get scrollbarWidth(): number {\n return window.innerWidth - document.documentElement.clientWidth;\n }\n\n get for(): string {\n return this.getAttribute(\"for\");\n }\n\n set for(forString: string) {\n this.setAttribute(\"for\", forString);\n }\n\n /**\n * Examples:\n * wait, error, ajax, drop-zone\n */\n get type(): string {\n const attribute = this.getAttribute(\"type\");\n if (attribute) {\n return attribute;\n } else {\n return \"wait\";\n }\n }\n\n set type(type: string) {\n this.setAttribute(\"type\", type);\n }\n\n /**\n * The delay for the wait overlay. If not set the default delay is read from config.\n */\n get delay(): number {\n if (this.hasAttribute(\"delay\")) {\n return parseInt(this.getAttribute(\"delay\"));\n } else if (this.type === \"ajax\") {\n return Page.page(this).waitOverlayDelayAjax;\n } else {\n return Page.page(this).waitOverlayDelayFull;\n }\n }\n\n set delay(delay: number) {\n this.setAttribute(\"delay\", String(delay));\n }\n}\n\ndocument.addEventListener(\"tobago.init\", function (event: Event): void {\n if (window.customElements.get(\"tobago-overlay\") == null) {\n window.customElements.define(\"tobago-overlay\", Overlay);\n }\n});\n","/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Overlay} from \"./tobago-overlay\";\nimport {OverlayType} from \"./tobago-overlay-type\";\nimport {Css} from \"./tobago-css\";\n\nexport class File extends HTMLElement {\n\n constructor() {\n super();\n }\n\n get input(): HTMLInputElement {\n return this.querySelector(\"input[type=file]\");\n }\n\n get dropZone(): HTMLElement {\n const id = this.getAttribute(\"drop-zone\");\n const rootNode = this.getRootNode() as ShadowRoot | Document;\n const element = rootNode.getElementById(id);\n const dropZone = element ? element : this;\n dropZone.classList.add(Css.TOBAGO_DROP_ZONE);\n return dropZone;\n }\n\n get maxSize(): number {\n const number = Number.parseInt(this.getAttribute(\"max-size\"));\n return Number.isNaN(number) ? 0 : number;\n }\n\n get maxSizeMessage(): string {\n return this.getAttribute(\"max-size-message\");\n }\n\n static isTypeFile(event: DragEvent): boolean {\n if (event.dataTransfer) {\n for (const item of event.dataTransfer.items) {\n if (item.kind === \"file\") {\n return true;\n }\n }\n }\n return false;\n }\n\n connectedCallback(): void {\n this.input.form.enctype = \"multipart/form-data\";\n\n // initialize drag&drop EventListener\n const dropZone = this.dropZone;\n if (dropZone) {\n dropZone.addEventListener(\"dragover\", this.dragover.bind(this));\n dropZone.addEventListener(\"dragleave\", this.dragleave.bind(this));\n dropZone.addEventListener(\"drop\", this.drop.bind(this));\n }\n\n const maxSize = this.maxSize;\n if (maxSize > 0) {\n this.input.addEventListener(\"change\", this.checkFileSize.bind(this));\n }\n }\n\n dragover(event: DragEvent): void {\n if (File.isTypeFile(event)) {\n event.stopPropagation();\n event.preventDefault();\n event.dataTransfer.dropEffect = \"copy\";\n\n const dropZone = this.dropZone;\n if (dropZone) {\n if (dropZone.querySelector(\"tobago-overlay\") == null) {\n console.info(\"DRAGOVER\", event.dataTransfer.items);\n dropZone.insertAdjacentHTML(\"beforeend\", Overlay.htmlText(dropZone.id, OverlayType.dropZone, 0));\n }\n }\n }\n }\n\n dragleave(event: DragEvent): void {\n if (File.isTypeFile(event)) {\n event.stopPropagation();\n event.preventDefault();\n event.dataTransfer.dropEffect = \"none\";\n\n const dropZone = this.dropZone;\n const element = dropZone.querySelector(\"tobago-overlay\");\n if (element) {\n console.info(\"DRAGLEAVE -> REMOVE CHILD\");\n dropZone.removeChild(element);\n }\n }\n }\n\n drop(event: DragEvent): void {\n if (File.isTypeFile(event)) {\n console.debug(event);\n event.stopPropagation();\n event.preventDefault();\n\n this.input.files = event.dataTransfer.files;\n this.input.dispatchEvent(new Event(\"change\"));\n }\n }\n\n checkFileSize(event: InputEvent) {\n const input = event.currentTarget as HTMLInputElement;\n const files = input.files;\n if (files) {\n input.setCustomValidity(\"\");\n let error = false;\n for (const file of files) {\n if (file.size > this.maxSize) {\n input.value = \"\";\n input.setCustomValidity(this.maxSizeMessage);\n input.reportValidity();\n error = true;\n break;\n }\n }\n if (error) {\n // only when error to prevent green checks, because we can't be sure, this is really valid (TBD)\n this.classList.add(\"was-validated\");\n event.preventDefault();\n event.stopPropagation();\n }\n }\n }\n}\n\ndocument.addEventListener(\"tobago.init\", function (event: Event): void {\n if (window.customElements.get(\"tobago-file\") == null) {\n window.customElements.define(\"tobago-file\", File);\n }\n});\n","/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Page} from \"./tobago-page\";\nimport {Config} from \"./tobago-config\";\n\nexport class Focus extends HTMLElement {\n\n constructor() {\n super();\n }\n\n /**\n * The focusListener to set the lastFocusId must be implemented in the appropriate web elements.\n * @param event\n */\n static setLastFocusId(event: FocusEvent): void {\n const target = event.target as HTMLElement;\n const computedStyle = getComputedStyle(target);\n\n if (target.getAttribute(\"type\") !== \"hidden\"\n && target.getAttributeNames().indexOf(\"disabled\") === -1\n && target.getAttribute(\"tabindex\") !== \"-1\"\n && computedStyle.visibility !== \"hidden\"\n && computedStyle.display !== \"none\") {\n const root = target.getRootNode() as ShadowRoot | Document;\n const tobagoFocus = root.getElementById(Page.page(target).id + \"::lastFocusId\");\n tobagoFocus.querySelector(\"input\").value = target.id;\n }\n }\n\n /**\n * Sets the focus to the requested element or to the first possible if\n * no element is explicitly requested.\n *\n * The priority order is:\n * - error (the first error element gets the focus)\n * - auto (the element with the tobago tag attribute focus=\"true\" gets the focus)\n * - last (the element from the last request with same id gets the focus, not AJAX)\n * - first (the first input element (without tabindex=-1) gets the focus, not AJAX)\n */\n connectedCallback(): void {\n if (Page.page(this).focusOnError) {\n const errorElement = this.errorElement;\n if (errorElement) {\n errorElement.focus();\n return;\n }\n }\n\n if (this.autofocusElements.length > 0) {\n // nothing to do, because the browser make the work.\n return;\n }\n\n const lastFocusedElement = this.lastFocusedElement;\n if (lastFocusedElement) {\n lastFocusedElement.focus();\n return;\n }\n\n const focusableElement = this.focusableElement;\n if (focusableElement) {\n focusableElement.focus();\n return;\n }\n }\n\n private get errorElement(): HTMLElement {\n const root = this.getRootNode() as ShadowRoot | Document;\n const elements: NodeListOf = root.querySelectorAll(\n \".tobago-messages-container .is-error:not([disabled]):not([tabindex='-1'])\");\n\n for (const element of elements) {\n const computedStyle = getComputedStyle(element);\n if (computedStyle.display !== \"none\" && computedStyle.visibility !== \"hidden\") {\n return element;\n }\n }\n }\n\n private get autofocusElements(): NodeListOf {\n const root = this.getRootNode() as ShadowRoot | Document;\n return root.querySelectorAll(\"[autofocus]\");\n }\n\n private get lastFocusedElement(): HTMLElement {\n const lastFocusId: string = this.hiddenInput.value;\n if (lastFocusId) {\n const root = this.getRootNode() as ShadowRoot | Document;\n return root.getElementById(lastFocusId);\n } else {\n return null;\n }\n }\n\n private get hiddenInput(): HTMLInputElement {\n return this.querySelector(\"input\");\n }\n\n private get focusableElement(): HTMLElement {\n const root = this.getRootNode() as ShadowRoot | Document;\n const elements: NodeListOf = root.querySelectorAll(\n \"input:not([type='hidden']):not([disabled]):not([tabindex='-1']),\"\n + \"select:not([disabled]):not([tabindex='-1']),textarea:not([disabled]):not([tabindex='-1'])\");\n\n for (const element of elements) {\n if (this.isVisible(element)) {\n return element;\n }\n }\n }\n\n private isVisible(element: HTMLElement): boolean {\n const computedStyle = getComputedStyle(element);\n if (computedStyle.display === \"none\" || computedStyle.visibility === \"hidden\") {\n return false;\n } else if (element.parentElement) {\n return this.isVisible(element.parentElement);\n } else {\n return true;\n }\n }\n}\n\ndocument.addEventListener(\"tobago.init\", function (event: Event): void {\n if (window.customElements.get(\"tobago-focus\") == null) {\n window.customElements.define(\"tobago-focus\", Focus);\n }\n});\n","/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Css} from \"./tobago-css\";\n\nclass Footer extends HTMLElement {\n\n private lastMaxFooterHeight: number;\n\n constructor() {\n super();\n }\n\n get fixed(): boolean {\n return this.classList.contains(Css.FIXED_BOTTOM);\n }\n\n get height(): number {\n const style: CSSStyleDeclaration = getComputedStyle(this);\n return this.offsetHeight + Number.parseInt(style.marginTop) + Number.parseInt(style.marginBottom);\n }\n\n connectedCallback(): void {\n if (this.fixed) {\n this.adjustMargin();\n window.addEventListener(\"resize\", this.adjustMargin.bind(this));\n }\n }\n\n private adjustMargin(event?: Event): void {\n if (this.hasBiggestFixedFooterHeight()) {\n const root = this.getRootNode() as ShadowRoot | Document;\n const body = root.querySelector(\"body\");\n body.style.marginBottom = `${this.height}px`;\n }\n }\n\n private hasBiggestFixedFooterHeight(): boolean {\n const root = this.getRootNode() as ShadowRoot | Document;\n const footers = root.querySelectorAll