import * as i0 from '@angular/core';
import { EventEmitter, Component, Input, Output, ViewChild, NgModule } from '@angular/core';
import * as i1 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i2 from '@angular/material/menu';
import { MatMenuModule } from '@angular/material/menu';
import * as i3 from '@angular/material/button-toggle';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { createCustomElement } from '@angular/elements';
import * as i3$1 from '@angular/material/tooltip';
import { MatTooltipModule } from '@angular/material/tooltip';

// Copyright (c) Laserfiche.
// Licensed under the MIT License. See LICENSE in the project root for license information.
var FieldType;
(function (FieldType) {
    FieldType["DateTime"] = "DateTime";
    FieldType["Blob"] = "Blob";
    FieldType["Date"] = "Date";
    FieldType["ShortInteger"] = "ShortInteger";
    FieldType["LongInteger"] = "LongInteger";
    FieldType["List"] = "List";
    FieldType["Number"] = "Number";
    FieldType["String"] = "String";
    FieldType["Time"] = "Time";
})(FieldType || (FieldType = {}));
/** FieldFormat copied from Web Access */
var FieldFormat;
(function (FieldFormat) {
    FieldFormat["None"] = "None";
    FieldFormat["ShortDate"] = "ShortDate";
    FieldFormat["LongDate"] = "LongDate";
    FieldFormat["ShortDateTime"] = "ShortDateTime";
    FieldFormat["LongDateTime"] = "LongDateTime";
    FieldFormat["ShortTime"] = "ShortTime";
    FieldFormat["LongTime"] = "LongTime";
    FieldFormat["GeneralNumber"] = "GeneralNumber";
    FieldFormat["Currency"] = "Currency";
    FieldFormat["Percent"] = "Percent";
    FieldFormat["Scientific"] = "Scientific";
    FieldFormat["Custom"] = "Custom";
})(FieldFormat || (FieldFormat = {}));
var RedirectBehavior;
(function (RedirectBehavior) {
    RedirectBehavior["Replace"] = "Replace";
    RedirectBehavior["Popup"] = "Popup";
    RedirectBehavior["None"] = "None";
})(RedirectBehavior || (RedirectBehavior = {}));
var LoginState;
(function (LoginState) {
    LoginState["LoggingIn"] = "LoggingIn";
    LoginState["LoggedIn"] = "LoggedIn";
    LoginState["LoggingOut"] = "LoggingOut";
    LoginState["LoggedOut"] = "LoggedOut"; // don't have tokens, previous state: LoggingOut, LoggingIn
})(LoginState || (LoginState = {}));
var LoginMode;
(function (LoginMode) {
    LoginMode["Button"] = "Button";
    LoginMode["Menu"] = "Menu";
})(LoginMode || (LoginMode = {}));
var LoginType;
(function (LoginType) {
    LoginType["Cloud"] = "Cloud";
    LoginType["SelfHosted"] = "Self-Hosted";
})(LoginType || (LoginType = {}));

// Copyright (c) Laserfiche.
// Licensed under the MIT License. See LICENSE in the project root for license information.

// Copyright (c) Laserfiche.
// Licensed under the MIT License. See LICENSE in the project root for license information.
class LfBreadcrumbsComponent {
    /** @internal */
    constructor() {
        this.breadcrumbs = [];
        this.breadcrumbSelected = new EventEmitter();
        this.breadcrumbClicked = new EventEmitter();
    }
    /** @internal */
    onBreadcrumbSelected(node) {
        this.breadcrumbSelected.emit(node);
        let crumbId = -1;
        for (let idx = 0; idx < this.breadcrumbs.length; idx++) {
            if (this.breadcrumbs[idx].id === node.id) {
                crumbId = idx;
                break;
            }
        }
        if (crumbId === -1) {
            return;
        }
        const newBreadcrumbs = this.breadcrumbs.slice(crumbId);
        this.breadcrumbClicked.emit({ breadcrumbs: newBreadcrumbs, selected: node });
    }
    /** @internal */
    onDropdownMenuSelected() {
        setTimeout(() => this.dropdownMenuButton.nativeElement.focus());
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LfBreadcrumbsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: LfBreadcrumbsComponent, selector: "lf-breadcrumbs-component", inputs: { breadcrumbs: "breadcrumbs" }, outputs: { breadcrumbSelected: "breadcrumbSelected", breadcrumbClicked: "breadcrumbClicked" }, viewQueries: [{ propertyName: "dropdownMenuButton", first: true, predicate: ["dropdownMenuButton"], descendants: true }], ngImport: i0, template: "<!--Copyright (c) Laserfiche.\r\nLicensed under the MIT License. See LICENSE in the project root for license information.-->\r\n\r\n<div class=\"lf-breadcrumbs-container\">\r\n  <div *ngIf=\"breadcrumbs?.length > 1\" class=\"breadcrumbs-dropdown-container\">\r\n      <mat-button-toggle-group class=\"breadcrumb-split-button-group\" hideSingleSelectionIndicator>\r\n          <mat-button-toggle class=\"breadcrumb-clickable-parent lf-button primary-button breadcrumb-split-button\"\r\n              [ngClass]=\"{'single-selectable': breadcrumbs.length===2}\"\r\n              (click)=\"onBreadcrumbSelected(breadcrumbs[1])\"\r\n              (keydown.enter)=\"onBreadcrumbSelected(breadcrumbs[1])\"\r\n              (keydown.space)=\"onBreadcrumbSelected(breadcrumbs[1])\"\r\n              [title]=\"breadcrumbs[1]?.name\">\r\n              {{breadcrumbs[1]?.name}}\r\n          </mat-button-toggle>\r\n          <mat-button-toggle class=\"breadcrumb-select breadcrumb-split-button\" *ngIf=\"breadcrumbs?.length > 2\"\r\n              value=\"breadcrumbDropdownMenu\" (change)=\"onDropdownMenuSelected()\" tabindex=\"-1\">\r\n              <button #dropdownMenuButton mat-icon-button [matMenuTriggerFor]=\"breadcrumbDropdownMenu\"\r\n                (click)=\"$event.stopPropagation()\" tabindex=\"0\">\r\n                <span class=\"material-icons breadcrumb-split-button-icon\">\r\n                  arrow_drop_down\r\n                </span>\r\n              </button>\r\n          </mat-button-toggle>\r\n      </mat-button-toggle-group>\r\n\r\n      <mat-menu #breadcrumbDropdownMenu=\"matMenu\" xPosition=\"before\">\r\n          <button class=\"lf-menu-item folder-dropdown\" mat-menu-item *ngFor=\"let breadcrumbOption of breadcrumbs.slice(1)\"\r\n              title=\"{{breadcrumbOption?.name}}\" (click)=\"onBreadcrumbSelected(breadcrumbOption)\">\r\n              {{breadcrumbOption?.name}}</button>\r\n      </mat-menu>\r\n  </div>\r\n  <span *ngIf=\"breadcrumbs?.length > 1\" class=\"material-icons breadcrumb-arrow_right\" id=\"arrow-right\">\r\n      keyboard_arrow_right\r\n    </span>\r\n  <span *ngIf=\"breadcrumbs?.length > 0\" class=\"breadcrumb-parent\" title=\"{{breadcrumbs[0]?.name}}\">\r\n      {{breadcrumbs[0]?.name}}\r\n  </span>\r\n</div>\r\n", styles: [".lf-breadcrumbs-container{display:flex;height:34px}.lf-breadcrumbs-container .mat-button-toggle-button,.lf-breadcrumbs-container .mat-button-toggle,.lf-breadcrumbs-container{font-family:Open Sans}.breadcrumb-parent{padding-left:10px;color:var(--lf-label-text-color, #605e5c);align-self:center;cursor:default;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:14px}.breadcrumb-arrow_right{cursor:default;align-self:center;font-size:12px;font-weight:bolder}::ng-deep .breadcrumb-split-button.breadcrumb-select.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{color:var(--lf-label-text-color, #605e5c)}::ng-deep .breadcrumb-split-button.breadcrumb-clickable-parent.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{color:var(--lf-link-color, #605e5c)}::ng-deep .breadcrumb-split-button.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{font-weight:600;font-size:14px;line-height:25px;padding:0 0 0 10px;text-align:left}::ng-deep .breadcrumb-split-button.mat-button-toggle-appearance-standard .mat-button-toggle-label-content:hover{color:#000}::ng-deep .breadcrumb-clickable-parent.breadcrumb-split-button.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{min-width:75px;max-width:125px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;padding:0 0 0 10px;height:25px}::ng-deep .single-selectable.breadcrumb-clickable-parent.breadcrumb-split-button.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{min-width:90px;max-width:125px}::ng-deep .breadcrumb-split-button-group.mat-button-toggle-group-appearance-standard{border:none;border-radius:2px;padding-top:5px}::ng-deep .breadcrumb-split-button .breadcrumb-select{color:var(--lf-label-text-color, #605e5c)}::ng-deep .breadcrumb-split-button.mat-button-toggle-appearance-standard.breadcrumb-select .mat-button-toggle-label-content{padding-left:5px;padding-right:5px;height:25px}.breadcrumb-split-button-icon{padding-bottom:5px}::ng-deep .breadcrumb-split-button .breadcrumb-select:hover{padding-left:0;color:#000}::ng-deep .breadcrumb-split-button.mat-button-toggle-checked{background-color:transparent!important}::ng-deep .breadcrumb-split-button.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay,::ng-deep .breadcrumb-split-button.mat-button-toggle-appearance-standard,::ng-deep .breadcrumb-split-button .mat-button-toggle-button,::ng-deep .breadcrumb-split-button .mat-button-toggle-button button{height:25px;width:100%}::ng-deep .breadcrumb-split-button .mat-button-toggle-button button{border:unset;background-color:unset;padding:0}::ng-deep .breadcrumb-split-button.mat-button-toggle-appearance-standard{height:25px}::ng-deep .mat-mdc-menu-item.lf-menu-item{font-size:14px}::ng-deep .mat-mdc-menu-content>.mat-mdc-menu-item.folder-dropdown>.mat-mdc-menu-item-text{font-size:inherit;white-space:nowrap}::ng-deep .mat-button-toggle-button button{outline:none}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i2.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i2.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "directive", type: i3.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled", "disabledInteractive", "hideSingleSelectionIndicator", "hideMultipleSelectionIndicator"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: i3.MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled", "disabledInteractive"], outputs: ["change"], exportAs: ["matButtonToggle"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LfBreadcrumbsComponent, decorators: [{
            type: Component,
            args: [{ selector: 'lf-breadcrumbs-component', template: "<!--Copyright (c) Laserfiche.\r\nLicensed under the MIT License. See LICENSE in the project root for license information.-->\r\n\r\n<div class=\"lf-breadcrumbs-container\">\r\n  <div *ngIf=\"breadcrumbs?.length > 1\" class=\"breadcrumbs-dropdown-container\">\r\n      <mat-button-toggle-group class=\"breadcrumb-split-button-group\" hideSingleSelectionIndicator>\r\n          <mat-button-toggle class=\"breadcrumb-clickable-parent lf-button primary-button breadcrumb-split-button\"\r\n              [ngClass]=\"{'single-selectable': breadcrumbs.length===2}\"\r\n              (click)=\"onBreadcrumbSelected(breadcrumbs[1])\"\r\n              (keydown.enter)=\"onBreadcrumbSelected(breadcrumbs[1])\"\r\n              (keydown.space)=\"onBreadcrumbSelected(breadcrumbs[1])\"\r\n              [title]=\"breadcrumbs[1]?.name\">\r\n              {{breadcrumbs[1]?.name}}\r\n          </mat-button-toggle>\r\n          <mat-button-toggle class=\"breadcrumb-select breadcrumb-split-button\" *ngIf=\"breadcrumbs?.length > 2\"\r\n              value=\"breadcrumbDropdownMenu\" (change)=\"onDropdownMenuSelected()\" tabindex=\"-1\">\r\n              <button #dropdownMenuButton mat-icon-button [matMenuTriggerFor]=\"breadcrumbDropdownMenu\"\r\n                (click)=\"$event.stopPropagation()\" tabindex=\"0\">\r\n                <span class=\"material-icons breadcrumb-split-button-icon\">\r\n                  arrow_drop_down\r\n                </span>\r\n              </button>\r\n          </mat-button-toggle>\r\n      </mat-button-toggle-group>\r\n\r\n      <mat-menu #breadcrumbDropdownMenu=\"matMenu\" xPosition=\"before\">\r\n          <button class=\"lf-menu-item folder-dropdown\" mat-menu-item *ngFor=\"let breadcrumbOption of breadcrumbs.slice(1)\"\r\n              title=\"{{breadcrumbOption?.name}}\" (click)=\"onBreadcrumbSelected(breadcrumbOption)\">\r\n              {{breadcrumbOption?.name}}</button>\r\n      </mat-menu>\r\n  </div>\r\n  <span *ngIf=\"breadcrumbs?.length > 1\" class=\"material-icons breadcrumb-arrow_right\" id=\"arrow-right\">\r\n      keyboard_arrow_right\r\n    </span>\r\n  <span *ngIf=\"breadcrumbs?.length > 0\" class=\"breadcrumb-parent\" title=\"{{breadcrumbs[0]?.name}}\">\r\n      {{breadcrumbs[0]?.name}}\r\n  </span>\r\n</div>\r\n", styles: [".lf-breadcrumbs-container{display:flex;height:34px}.lf-breadcrumbs-container .mat-button-toggle-button,.lf-breadcrumbs-container .mat-button-toggle,.lf-breadcrumbs-container{font-family:Open Sans}.breadcrumb-parent{padding-left:10px;color:var(--lf-label-text-color, #605e5c);align-self:center;cursor:default;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:14px}.breadcrumb-arrow_right{cursor:default;align-self:center;font-size:12px;font-weight:bolder}::ng-deep .breadcrumb-split-button.breadcrumb-select.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{color:var(--lf-label-text-color, #605e5c)}::ng-deep .breadcrumb-split-button.breadcrumb-clickable-parent.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{color:var(--lf-link-color, #605e5c)}::ng-deep .breadcrumb-split-button.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{font-weight:600;font-size:14px;line-height:25px;padding:0 0 0 10px;text-align:left}::ng-deep .breadcrumb-split-button.mat-button-toggle-appearance-standard .mat-button-toggle-label-content:hover{color:#000}::ng-deep .breadcrumb-clickable-parent.breadcrumb-split-button.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{min-width:75px;max-width:125px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;padding:0 0 0 10px;height:25px}::ng-deep .single-selectable.breadcrumb-clickable-parent.breadcrumb-split-button.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{min-width:90px;max-width:125px}::ng-deep .breadcrumb-split-button-group.mat-button-toggle-group-appearance-standard{border:none;border-radius:2px;padding-top:5px}::ng-deep .breadcrumb-split-button .breadcrumb-select{color:var(--lf-label-text-color, #605e5c)}::ng-deep .breadcrumb-split-button.mat-button-toggle-appearance-standard.breadcrumb-select .mat-button-toggle-label-content{padding-left:5px;padding-right:5px;height:25px}.breadcrumb-split-button-icon{padding-bottom:5px}::ng-deep .breadcrumb-split-button .breadcrumb-select:hover{padding-left:0;color:#000}::ng-deep .breadcrumb-split-button.mat-button-toggle-checked{background-color:transparent!important}::ng-deep .breadcrumb-split-button.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay,::ng-deep .breadcrumb-split-button.mat-button-toggle-appearance-standard,::ng-deep .breadcrumb-split-button .mat-button-toggle-button,::ng-deep .breadcrumb-split-button .mat-button-toggle-button button{height:25px;width:100%}::ng-deep .breadcrumb-split-button .mat-button-toggle-button button{border:unset;background-color:unset;padding:0}::ng-deep .breadcrumb-split-button.mat-button-toggle-appearance-standard{height:25px}::ng-deep .mat-mdc-menu-item.lf-menu-item{font-size:14px}::ng-deep .mat-mdc-menu-content>.mat-mdc-menu-item.folder-dropdown>.mat-mdc-menu-item-text{font-size:inherit;white-space:nowrap}::ng-deep .mat-button-toggle-button button{outline:none}\n"] }]
        }], ctorParameters: () => [], propDecorators: { breadcrumbs: [{
                type: Input
            }], breadcrumbSelected: [{
                type: Output
            }], breadcrumbClicked: [{
                type: Output
            }], dropdownMenuButton: [{
                type: ViewChild,
                args: ['dropdownMenuButton']
            }] } });

// Copyright (c) Laserfiche.
// Licensed under the MIT License. See LICENSE in the project root for license information.
class LfBreadcrumbsModule {
    /** @internal */
    constructor(/** @internal */ injector) {
        const breadcrumbsElementName = 'lf-breadcrumbs';
        if (window.customElements && !customElements.get(breadcrumbsElementName)) {
            const breadcrumbsElement = createCustomElement(LfBreadcrumbsComponent, { injector });
            customElements.define(breadcrumbsElementName, breadcrumbsElement);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LfBreadcrumbsModule, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: LfBreadcrumbsModule, declarations: [LfBreadcrumbsComponent], imports: [CommonModule,
            MatMenuModule,
            MatButtonToggleModule], exports: [LfBreadcrumbsComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LfBreadcrumbsModule, imports: [CommonModule,
            MatMenuModule,
            MatButtonToggleModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LfBreadcrumbsModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        LfBreadcrumbsComponent
                    ],
                    imports: [
                        CommonModule,
                        MatMenuModule,
                        MatButtonToggleModule
                    ],
                    exports: [
                        LfBreadcrumbsComponent
                    ]
                }]
        }], ctorParameters: () => [{ type: i0.Injector }] });

// Copyright (c) Laserfiche.
// Licensed under the MIT License. See LICENSE in the project root for license information.

// Copyright (c) Laserfiche.
// Licensed under the MIT License. See LICENSE in the project root for license information.
class LfToolbarComponent {
    /** @internal */
    constructor() {
        // TODO: if there is not enough room for displayed options, put everything in dropdown
        this.displayed_options = [];
        this.dropdown_options = [];
        this.optionSelected = new EventEmitter();
    }
    /** @internal */
    onClickButton(option) {
        this.optionSelected.emit(option);
    }
    /** @internal */
    getIcons(option) {
        if (!option.icon) {
            return [];
        }
        if (typeof (option.icon) === 'string') {
            return [option.icon];
        }
        else {
            return option.icon;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LfToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: LfToolbarComponent, selector: "lf-toolbar-component", inputs: { displayed_options: "displayed_options", dropdown_options: "dropdown_options" }, outputs: { optionSelected: "optionSelected" }, ngImport: i0, template: "<!--Copyright (c) Laserfiche.\r\nLicensed under the MIT License. See LICENSE in the project root for license information.-->\r\n\r\n<div class=\"lf-toolbar-container\">\r\n  <span\r\n    [matTooltip]=\"displayedOption.name\"\r\n    matTooltipClass=\"lf-web-client-tooltip\"\r\n    class=\"lf-toolbar-expanded-button-span\"\r\n    *ngFor=\"let displayedOption of displayed_options\"\r\n  >\r\n    <button class=\"lf-toolbar-button\" [disabled]=\"displayedOption.disabled\" (click)=\"onClickButton(displayedOption)\">\r\n      <img\r\n        *ngFor=\"let icon of getIcons(displayedOption)\"\r\n        [src]=\"icon\"\r\n        [alt]=\"displayedOption.name\"\r\n        class=\"lf-toolbar-button-icon\"\r\n      />\r\n    </button>\r\n  </span>\r\n  <button\r\n    *ngIf=\"dropdown_options && dropdown_options.length > 0\"\r\n    class=\"lf-toolbar-button\"\r\n    [matMenuTriggerFor]=\"compactButtonMenu\"\r\n  >\r\n    <span class=\"material-icons lf-toolbar-dropdown-button-icon\"> more_vert </span>\r\n  </button>\r\n  <mat-menu #compactButtonMenu=\"matMenu\" class=\"lf-dropdown-menu\">\r\n    <button\r\n      [disabled]=\"dropdownOption.disabled\"\r\n      class=\"lf-dropdown-menu-option\"\r\n      *ngFor=\"let dropdownOption of dropdown_options\"\r\n      mat-menu-item\r\n      (click)=\"onClickButton(dropdownOption)\"\r\n    >\r\n      {{ dropdownOption.name }}\r\n    </button>\r\n  </mat-menu>\r\n</div>\r\n", styles: [".lf-toolbar-container{display:inline-block;white-space:nowrap}.lf-toolbar-expanded-button-span{display:inline-block;position:relative}.lf-toolbar-button{width:30px;height:28px;margin:0 0 0 4px;padding:4px 5px;line-height:14px;border:1px solid transparent;border-radius:2px;cursor:pointer;vertical-align:middle;text-align:center;background-color:inherit}.lf-toolbar-button:hover:enabled,.lf-toolbar-button:focus{background:none repeat scroll 0 0 #e7e7e7;outline:none}.lf-toolbar-button:disabled{cursor:default;opacity:.33}.lf-toolbar-button-icon{height:18px;width:18px}::ng-deep .mat-mdc-menu-panel.lf-dropdown-menu{list-style:none;background-color:#fff;border:1px solid rgba(0,0,0,.15);border-radius:4px;box-shadow:0 6px 12px #0000002e;min-height:0px}::ng-deep .lf-dropdown-menu-option.mat-mdc-menu-item{position:relative;box-sizing:border-box;display:block;text-align:-webkit-match-parent;color:#202020;padding:3px 24px;margin:2px 0 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.428571429;height:26px;min-height:unset}::ng-deep .mat-mdc-menu-content>.lf-dropdown-menu-option.mat-mdc-menu-item>.mat-mdc-menu-item-text{font-size:14px}.lf-dropdown-menu-option:disabled{color:#999;pointer-events:all;cursor:not-allowed}.lf-dropdown-menu-option:hover:enabled{background-color:#cce9f180}.lf-dropdown-menu-option:focus:enabled{background-color:#cce9f14d}.lf-toolbar-dropdown-button-icon{font-size:18px}::ng-deep .lf-web-client-tooltip{background-color:#000000bf;font-size:12px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i2.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i2.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "directive", type: i3$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LfToolbarComponent, decorators: [{
            type: Component,
            args: [{ selector: 'lf-toolbar-component', template: "<!--Copyright (c) Laserfiche.\r\nLicensed under the MIT License. See LICENSE in the project root for license information.-->\r\n\r\n<div class=\"lf-toolbar-container\">\r\n  <span\r\n    [matTooltip]=\"displayedOption.name\"\r\n    matTooltipClass=\"lf-web-client-tooltip\"\r\n    class=\"lf-toolbar-expanded-button-span\"\r\n    *ngFor=\"let displayedOption of displayed_options\"\r\n  >\r\n    <button class=\"lf-toolbar-button\" [disabled]=\"displayedOption.disabled\" (click)=\"onClickButton(displayedOption)\">\r\n      <img\r\n        *ngFor=\"let icon of getIcons(displayedOption)\"\r\n        [src]=\"icon\"\r\n        [alt]=\"displayedOption.name\"\r\n        class=\"lf-toolbar-button-icon\"\r\n      />\r\n    </button>\r\n  </span>\r\n  <button\r\n    *ngIf=\"dropdown_options && dropdown_options.length > 0\"\r\n    class=\"lf-toolbar-button\"\r\n    [matMenuTriggerFor]=\"compactButtonMenu\"\r\n  >\r\n    <span class=\"material-icons lf-toolbar-dropdown-button-icon\"> more_vert </span>\r\n  </button>\r\n  <mat-menu #compactButtonMenu=\"matMenu\" class=\"lf-dropdown-menu\">\r\n    <button\r\n      [disabled]=\"dropdownOption.disabled\"\r\n      class=\"lf-dropdown-menu-option\"\r\n      *ngFor=\"let dropdownOption of dropdown_options\"\r\n      mat-menu-item\r\n      (click)=\"onClickButton(dropdownOption)\"\r\n    >\r\n      {{ dropdownOption.name }}\r\n    </button>\r\n  </mat-menu>\r\n</div>\r\n", styles: [".lf-toolbar-container{display:inline-block;white-space:nowrap}.lf-toolbar-expanded-button-span{display:inline-block;position:relative}.lf-toolbar-button{width:30px;height:28px;margin:0 0 0 4px;padding:4px 5px;line-height:14px;border:1px solid transparent;border-radius:2px;cursor:pointer;vertical-align:middle;text-align:center;background-color:inherit}.lf-toolbar-button:hover:enabled,.lf-toolbar-button:focus{background:none repeat scroll 0 0 #e7e7e7;outline:none}.lf-toolbar-button:disabled{cursor:default;opacity:.33}.lf-toolbar-button-icon{height:18px;width:18px}::ng-deep .mat-mdc-menu-panel.lf-dropdown-menu{list-style:none;background-color:#fff;border:1px solid rgba(0,0,0,.15);border-radius:4px;box-shadow:0 6px 12px #0000002e;min-height:0px}::ng-deep .lf-dropdown-menu-option.mat-mdc-menu-item{position:relative;box-sizing:border-box;display:block;text-align:-webkit-match-parent;color:#202020;padding:3px 24px;margin:2px 0 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.428571429;height:26px;min-height:unset}::ng-deep .mat-mdc-menu-content>.lf-dropdown-menu-option.mat-mdc-menu-item>.mat-mdc-menu-item-text{font-size:14px}.lf-dropdown-menu-option:disabled{color:#999;pointer-events:all;cursor:not-allowed}.lf-dropdown-menu-option:hover:enabled{background-color:#cce9f180}.lf-dropdown-menu-option:focus:enabled{background-color:#cce9f14d}.lf-toolbar-dropdown-button-icon{font-size:18px}::ng-deep .lf-web-client-tooltip{background-color:#000000bf;font-size:12px}\n"] }]
        }], ctorParameters: () => [], propDecorators: { displayed_options: [{
                type: Input
            }], dropdown_options: [{
                type: Input
            }], optionSelected: [{
                type: Output
            }] } });

// Copyright (c) Laserfiche.
// Licensed under the MIT License. See LICENSE in the project root for license information.
class LfToolbarModule {
    /** @internal */
    constructor(
    /** @internal */ injector) {
        const toolbarElementName = 'lf-toolbar';
        if (window.customElements && !customElements.get(toolbarElementName)) {
            const toolbarElement = createCustomElement(LfToolbarComponent, { injector });
            customElements.define(toolbarElementName, toolbarElement);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LfToolbarModule, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: LfToolbarModule, declarations: [LfToolbarComponent], imports: [CommonModule,
            MatMenuModule,
            MatTooltipModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LfToolbarModule, imports: [CommonModule,
            MatMenuModule,
            MatTooltipModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LfToolbarModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        LfToolbarComponent
                    ],
                    imports: [
                        CommonModule,
                        MatMenuModule,
                        MatTooltipModule
                    ]
                }]
        }], ctorParameters: () => [{ type: i0.Injector }] });

// Copyright (c) Laserfiche.
// Licensed under the MIT License. See LICENSE in the project root for license information.

// Copyright (c) Laserfiche.
// Licensed under the MIT License. See LICENSE in the project root for license information.
/**
 * @internal
 */
class Selectable {
    constructor() {
        this.multiSelectable = false;
        this.lastSelectedIndex = 0;
        this.selectedItemsIndices = [];
        this.allSelected = new Map();
    }
    get selectedItems() {
        return [...this.allSelected.values()];
    }
    clearSelectedValues(list, clearCached) {
        this.clearAllSelectedItems(list, clearCached);
    }
    async setSelectedNodesAsync(selected, list, maxFetchIterations, lastCheckedIdx = 0) {
        for (let index = 0; index < list.length; index++) {
            const selectableItem = list[index];
            const wantToSelect = selected.has(selectableItem.value.id) || this.allSelected.has(selectableItem.value.id);
            if (wantToSelect) {
                if (selectableItem.isSelectable) {
                    const findValue = this.selectedItemsIndices.find((value) => value === index + lastCheckedIdx);
                    if (!findValue) {
                        this.selectedItemsIndices.push(index + lastCheckedIdx);
                    }
                    this.allSelected.set(selectableItem.value.id, selectableItem);
                    selectableItem.isSelected = true;
                    selected.delete(selectableItem.value.id);
                }
            }
        }
        lastCheckedIdx += list.length;
        if (selected.size > 0) {
            if (this.callback) {
                if (maxFetchIterations > 0) {
                    --maxFetchIterations;
                    const value = await this.callback();
                    if (!value || value.length === 0) {
                        return;
                    }
                    await this.setSelectedNodesAsync(selected, value, maxFetchIterations, lastCheckedIdx);
                }
                else {
                    console.debug('MaxFetchIterations reached. Not all nodes selected');
                }
            }
        }
        else {
            return;
        }
    }
    onItemClicked(event, item, list, allowMultiple = false, onlyAdd = false) {
        if (!item.isSelectable) {
            if (event.ctrlKey || event.shiftKey) {
                return;
            }
            this.clearAllSelectedItems(list);
            this.lastSelectedIndex = 0;
            return;
        }
        const itemIndex = list.findIndex((selectable) => selectable.value.id === item.value.id);
        if (!this.multiSelectable) {
            this.clearAllSelectedItems(list);
            const itemInList = list[itemIndex];
            if (itemInList.isSelectable) {
                this.addSelectedItem(item, itemIndex);
                this.lastSelectedIndex = itemIndex;
            }
            return;
        }
        if (event?.ctrlKey && event?.shiftKey) {
            onlyAdd = true;
        }
        if ((event?.ctrlKey && !event.shiftKey) || (!event?.ctrlKey && !event?.shiftKey && allowMultiple)) {
            const itemInList = list[itemIndex];
            if (itemInList.isSelected) {
                this.unselectItem(list, itemInList);
            }
            else {
                if (itemInList.isSelectable) {
                    this.addSelectedItem(item, itemIndex);
                    this.lastSelectedIndex = itemIndex;
                }
            }
        }
        else if (event.shiftKey) {
            const lower = this.lastSelectedIndex <= itemIndex ? this.lastSelectedIndex : itemIndex;
            const upper = this.lastSelectedIndex > itemIndex ? this.lastSelectedIndex : itemIndex;
            if (!onlyAdd) {
                this.clearAllSelectedItems(list);
            }
            for (let i = lower; i <= upper; i++) {
                const value = list[i];
                if (value.isSelectable && !value.isSelected) {
                    this.addSelectedItem(value, i);
                }
            }
        }
        else if (!allowMultiple) {
            this.clearAllSelectedItems(list);
            const itemInList = list[itemIndex];
            if (itemInList.isSelectable) {
                this.addSelectedItem(itemInList, itemIndex);
                this.lastSelectedIndex = itemIndex;
            }
        }
    }
    /** @internal */
    unselectItem(list, itemInList) {
        const indexIndex = this.selectedItemsIndices.findIndex((selectable) => list[selectable].value.id === itemInList.value.id);
        this.selectedItemsIndices.splice(indexIndex, 1);
        this.allSelected.delete(itemInList.value.id);
        itemInList.isSelected = false;
    }
    /** @internal */
    clearAllSelectedItems(list, clearAll = true) {
        this.selectedItemsIndices.forEach((val) => {
            if (list[val]) {
                list[val].isSelected = false;
            }
        });
        this.selectedItemsIndices = [];
        if (clearAll) {
            this.allSelected.clear();
        }
    }
    /** @internal */
    addSelectedItem(itemInList, itemIndex) {
        if (!itemInList.isSelectable) {
            return;
        }
        itemInList.isSelected = true;
        this.selectedItemsIndices.push(itemIndex);
        this.allSelected.set(itemInList.value.id, itemInList);
    }
}

// Copyright (c) Laserfiche.
// Licensed under the MIT License. See LICENSE in the project root for license information.

/**
 * Generated bundle index. Do not edit.
 */

export { FieldFormat, FieldType, LfBreadcrumbsComponent, LfBreadcrumbsModule, LfToolbarComponent, LfToolbarModule, LoginMode, LoginState, LoginType, RedirectBehavior, Selectable };
//# sourceMappingURL=laserfiche-lf-ui-components-shared.mjs.map
