{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "select",
  "type": "registry:ui",
  "title": "<ui-select>",
  "description": "Carbon-style select. Wraps a native `<select>` — the most accessible option, and on touch devices it opens the OS picker. Copied from @purpurabog/ui 2.3.0; the package is the maintained source, this copy is yours to change. Icons from the Carbon Design System (Apache-2.0, © IBM Corp.; see THIRD-PARTY-NOTICES.md in the package).",
  "dependencies": [
    "lit@^3.3.0"
  ],
  "registryDependencies": [
    "@kanok-ui/shared-element",
    "@kanok-ui/shared-field",
    "@kanok-ui/shared-form-control",
    "@kanok-ui/shared-localize",
    "@kanok-ui/shared-skeleton",
    "@kanok-ui/shared-slots",
    "@kanok-ui/tokens"
  ],
  "files": [
    {
      "path": "src/primitives/select/select-skeleton.ts",
      "type": "registry:ui",
      "target": "components/ui/primitives/select/select-skeleton.ts",
      "content": "import { customElement } from 'lit/decorators.js';\nimport { UiFieldSkeleton } from '../shared/skeleton.ts';\n\n/**\n * Carbon `SelectSkeleton` (`cds-select-skeleton`): the shape of a `<ui-select>` while its data loads — a 75×14 label bar, 8px, then\n * the field's bar at its `size` (sm 32 / md 40 / lg 48px). Hidden from assistive tech.\n *\n * @csspart label - The label bar\n * @csspart field - The field bar\n */\n@customElement('ui-select-skeleton')\nexport class UiSelectSkeleton extends UiFieldSkeleton {}\n\ndeclare global {\n    interface HTMLElementTagNameMap {\n        'ui-select-skeleton': UiSelectSkeleton;\n    }\n}\n"
    },
    {
      "path": "src/primitives/select/select.styles.ts",
      "type": "registry:ui",
      "target": "components/ui/primitives/select/select.styles.ts",
      "content": "import { css } from 'lit';\n\n/** Styles of `<ui-select>`. */\nexport const selectStyles = css`\n    :host {\n        display: block;\n        font-family: var(--ui-font-family);\n    }\n\n    .field {\n        position: relative;\n    }\n\n    select {\n        /* Carbon: the native list; a design can open the list in its own menu look (customizable select, below) */\n        appearance: var(--ui-select-appearance, none);\n        box-sizing: border-box;\n        width: 100%;\n        min-height: var(--ui-field-height-lg, 48px);\n        margin: 0;\n        padding: 0 calc(var(--ui-space-md) * 2 + 16px) 0 var(--ui-space-md);\n        /* Carbon: an underline only; --ui-field-border (all sides), --ui-field-radius and --ui-field-background let a design outline the box */\n        border: var(--ui-field-border, none);\n        border-bottom: 1px solid var(--ui-field-underline-color, var(--ui-ink-subtle));\n        border-radius: var(--ui-field-radius, var(--ui-radius-none));\n        background-color: var(--ui-field-background, var(--ui-surface-1));\n        color: var(--ui-ink);\n        font: var(--ui-font-body-sm);\n        font-size: var(--ui-field-font-size, 14px);\n        letter-spacing: var(--ui-tracking-body);\n        cursor: pointer;\n        outline: var(--ui-field-focus-width, 2px) solid transparent; /* the ring's width (Kanok: 1.5px, on the field's own border) */\n        outline-offset: calc(-1 * var(--ui-field-focus-width, 2px));\n        transition: outline-color var(--ui-duration-fast) var(--ui-easing); /* Carbon select-input: the outline only, not the background */\n    }\n\n    select:hover:not(:disabled):not(:focus) {\n        border-color: var(--ui-field-hover-border-color, var(--ui-border-strong-1));\n        border-bottom-color: var(--ui-field-hover-border-color, var(--ui-border-strong-1));\n    }\n\n    :host([size='sm']) select {\n        min-height: var(--ui-field-height-sm, 32px);\n    }\n\n    :host([size='md']) select {\n        min-height: var(--ui-field-height-md, 40px);\n    }\n\n    select:focus {\n        border-color: var(--ui-field-focus-border-color, inherit);\n        border-bottom-color: var(--ui-field-focus-border-color, var(--ui-ink-subtle));\n        outline-color: var(--ui-focus);\n        box-shadow: var(--ui-field-focus-halo, none); /* a design's halo outside the ring (Kanok: none) */\n    }\n\n    .placeholder select {\n        color: var(--ui-ink-muted);\n    }\n\n    option {\n        color: var(--ui-ink);\n    }\n\n    /*\n     * Customizable select (Chrome 135+), when a design sets --ui-select-appearance: base-select (Kanok): the list\n     * opens in the menu look of the dropdowns (--ui-menu-*), the chosen row tinted with a check mark at its end.\n     * Other browsers keep the native list. Each rule stands alone, so a browser that doesn't know a selector\n     * drops only that rule; the rows' rules ask the setting (a style query), so the native list is untouched.\n     */\n    select::picker-icon {\n        display: none; /* the chevron is ours */\n    }\n\n    select::picker(select) {\n        appearance: base-select;\n        box-sizing: border-box;\n        margin-block: 2px;\n        padding: var(--ui-menu-padding, 0);\n        border: var(--ui-menu-border, none);\n        border-radius: var(--ui-menu-radius, 0);\n        background-color: var(--ui-overlay-background, var(--ui-surface-1)); /* a design can raise floating surfaces (--ui-overlay-background) */\n        color: var(--ui-ink);\n        box-shadow: var(--ui-menu-shadow, 0 2px 6px rgb(0 0 0 / 0.3));\n        max-block-size: calc(var(--ui-field-height-md, 40px) * var(--ui-menu-max-rows, 5.5));\n    }\n\n    @container style(--ui-select-appearance: base-select) {\n        /* the chosen option's text, centred in the box as the native select's */\n        select {\n            display: flex;\n            align-items: center;\n        }\n\n        select:open ~ .icons .chevron {\n            transform: rotate(180deg);\n        }\n\n        option {\n            display: flex;\n            align-items: center;\n            gap: var(--ui-space-xs);\n            box-sizing: border-box;\n            min-block-size: var(--ui-field-height-md, 40px);\n            padding: 0 var(--ui-space-md);\n            border-radius: var(--ui-menu-item-radius, 0);\n            color: var(--ui-menu-item-ink, var(--ui-ink-muted));\n            font: var(--ui-font-body-sm);\n            letter-spacing: var(--ui-tracking-body);\n            cursor: pointer;\n            outline: var(--ui-focus-width, 2px) solid transparent;\n            outline-offset: -2px;\n            transition: background-color var(--ui-duration-fast) var(--ui-easing);\n        }\n\n        option:hover,\n        option:focus-visible {\n            background-color: var(--ui-ghost-hover);\n            color: var(--ui-ink);\n        }\n\n        option:focus-visible {\n            outline-color: var(--ui-menu-item-active-outline, var(--ui-focus));\n        }\n\n        option:checked {\n            background-color: var(--ui-menu-item-selected, var(--ui-surface-2));\n            color: var(--ui-ink);\n        }\n\n        option:disabled {\n            background-color: transparent;\n            color: var(--ui-ink-disabled);\n            cursor: not-allowed;\n        }\n\n        /* the placeholder is what the box shows before a choice, not a choice in the list */\n        option[data-placeholder] {\n            display: none;\n        }\n\n        /* the check mark at the end of the chosen row, as the dropdowns */\n        option::checkmark {\n            order: 1;\n            margin-inline-start: auto;\n            color: var(--ui-icon-primary);\n        }\n\n        optgroup {\n            color: var(--ui-ink-helper);\n            font: var(--ui-font-caption);\n            letter-spacing: var(--ui-tracking-caption);\n        }\n\n        optgroup + optgroup {\n            margin-block-start: var(--ui-space-xs);\n        }\n    }\n\n    .invalid select {\n        outline-color: var(--ui-error);\n        box-shadow: var(--ui-field-invalid-halo, none); /* a design's error halo (Kanok: Pixiv's red ring) */\n    }\n\n    .invalid select:focus {\n        outline-color: var(--ui-focus);\n        box-shadow: var(--ui-field-invalid-halo, var(--ui-field-focus-halo, none)); /* an error keeps its halo while focused (Kanok: Pixiv's red) */\n    }\n\n    select:disabled {\n        border-color: var(--ui-field-disabled-border-color, currentColor currentColor transparent);\n        color: var(--ui-ink-disabled);\n        cursor: not-allowed;\n    }\n\n    :host([readonly]) select {\n        background-color: var(--ui-field-readonly-background, transparent);\n        border-color: var(--ui-field-readonly-border-color, currentColor currentColor var(--ui-hairline));\n        cursor: default;\n    }\n\n    :host([inline]) {\n        display: grid;\n        grid-template-columns: auto auto;\n        justify-content: start;\n        align-items: center;\n        column-gap: var(--ui-space-xs);\n    }\n\n    :host([inline]) .label {\n        margin-bottom: 0;\n    }\n\n    :host([inline]) select {\n        width: auto;\n        background-color: transparent;\n        border-color: var(--ui-field-inline-border-color, currentColor currentColor transparent);\n    }\n\n    :host([inline]) select:hover {\n        background-color: var(--ui-ghost-hover);\n    }\n\n    :host([inline]) .helper,\n    :host([inline]) .warn,\n    :host([inline]) .error {\n        grid-column: 1 / -1;\n    }\n\n    :host([readonly]) .chevron {\n        fill: var(--ui-ink-subtle);\n    }\n\n    .icons {\n        position: absolute;\n        inset-block: 0;\n        inset-inline-end: var(--ui-space-md);\n        display: flex;\n        align-items: center;\n        gap: var(--ui-space-xs);\n        pointer-events: none;\n    }\n\n    .chevron {\n        width: 16px;\n        height: 16px;\n        fill: var(--ui-ink);\n    }\n\n    select:disabled ~ .icons .chevron {\n        fill: var(--ui-ink-disabled);\n    }\n\n    .has-status select {\n        padding-inline-end: calc(var(--ui-space-md) * 2 + 40px);\n    }\n\n    @media (forced-colors: active) {\n        select {\n            border: 1px solid FieldText;\n        }\n        select:focus {\n            outline-color: Highlight;\n        }\n        .chevron {\n            fill: FieldText;\n        }\n    }\n`;\n\n/** Styles of `<ui-select>` when fluid (`fluid`, or inside a `<ui-fluid-form>`): the 64px box with the label inside. */\nexport const selectFluidStyles = css`\n    :host([data-fluid]) select,\n    :host([data-fluid]) .has-status select {\n        block-size: 64px;\n        min-height: 64px;\n        padding-block: 32px 13px;\n        padding-inline-end: 32px;\n    }\n\n    /* Carbon fluid select: the arrow 34px down, 12px from the end */\n    :host([data-fluid]) .icons {\n        --ui-fluid-icon-end: 4px;\n        align-items: flex-start;\n        padding-block-start: 34px;\n        inset-inline-end: 12px;\n    }\n`;\n"
    },
    {
      "path": "src/primitives/select/select.ts",
      "type": "registry:ui",
      "target": "components/ui/primitives/select/select.ts",
      "content": "import { LitElement, html, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { fieldTextStyles, messageId, pickMessage, renderMessage, renderStatusIcon, uid, renderLabelText, barWhenDisabled, selectedOptionValue, customErrorMessage, nativeValidationMessage, pickErrorText, syncFluid, fluidFieldStyles, markStatus, type MessageKind } from '../shared/field.ts';\nimport { FormControlController } from '../shared/form-control.ts';\nimport { SlotController } from '../shared/slots.ts';\nimport { LocalizeController } from '../shared/localize.ts';\nimport { UiElement } from '../shared/element.ts';\nimport { selectStyles, selectFluidStyles } from './select.styles.ts';\n\ninterface OptionData {\n    value: string;\n    label: string;\n    disabled: boolean;\n}\n\ninterface GroupData {\n    label: string;\n    disabled: boolean;\n    options: OptionData[];\n}\n\ntype Entry = OptionData | GroupData;\n\nconst isGroup = (entry: Entry): entry is GroupData => 'options' in entry;\n\nconst readOption = (o: HTMLOptionElement): OptionData => ({\n    value: o.value,\n    label: o.label || o.textContent?.trim() || '',\n    disabled: o.disabled,\n});\n\n/**\n * Carbon-style select. Wraps a native `<select>` — the most accessible option, and on\n * touch devices it opens the OS picker.\n *\n * Author `<option>` / `<optgroup>` as children; they are mirrored into the shadow `<select>`\n * and kept in sync with a MutationObserver.\n *\n * `readonly` keeps the value (and submits it) but blocks mouse and keyboard changes;\n * Tab still moves through. `warn` shows a non-blocking warning.\n * `inline` puts the label beside a compact, borderless select (toolbars, pagination).\n *\n * State on the host for app styles: `data-show-error` / `data-show-warn` while the error / warning\n * line shows, `data-placeholder` while the placeholder is the shown choice\n * (e.g. `ui-select[data-show-error]::part(base)`).\n *\n * @cssstate show-error - While its error message shows (also `[data-show-error]`)\n * @cssstate show-warn - While its warning message shows (also `[data-show-warn]`)\n * @cssstate placeholder - While the placeholder is the shown choice (also `[data-placeholder]`)\n * @fires change - When the user picks an option\n * @slot label - Label content with markup; the `label` attribute is the plain-text fallback\n * @slot helper-text - Helper text with markup (links, bold); overrides `helper-text`\n * @slot warn-text - Warning text shown while `warn`; overrides `warn-text`\n * @slot invalid-text - Error text shown while invalid; overrides `invalid-text`\n * @csspart base - The field box\n * @csspart label - The label\n * @csspart input - The native select\n * @csspart chevron - The arrow icon\n * @csspart status-icon - The error / warning icon\n * @csspart helper-text - The helper line\n * @csspart warning-text - The warning line\n * @csspart warn-text - Same line as `warning-text` (named after the `warn-text` attribute / slot)\n * @csspart error-text - The error line\n * @csspart invalid-text - Same line as `error-text` (named after the `invalid-text` attribute / slot)\n * @cssprop --ui-field-border - Border on every side of the box (default none: Carbon's underline only; Kanok: a 1px outline)\n * @cssprop --ui-field-disabled-border-color - Border colour when disabled (default: the underline transparent)\n * @cssprop --ui-field-readonly-border-color - Border colour when read-only (default: a hairline underline)\n * @cssprop --ui-field-inline-border-color - Border colour of the `inline` variant (default: no underline)\n * @cssprop --ui-field-radius - Corner radius of the box (default 0; Kanok: 6px)\n * @cssprop --ui-select-appearance - `base-select` opens the list in the menu look of the dropdowns (`--ui-menu-*`) where the browser supports a customizable select (Chrome 135+); default `none`, the native list (Kanok: base-select)\n * @cssprop --ui-field-background - Fill of the box (default `--ui-surface-1`; Kanok: transparent)\n * @cssprop --ui-label-font - Font of the label (default `--ui-font-caption`; Kanok: 14px semibold)\n * @cssprop --ui-label-color - Colour of the label (default `--ui-ink-muted`; Kanok: `--ui-ink`)\n * @cssprop --ui-field-readonly-background - The box's fill when read-only (default transparent; Kanok: a faint ink tint, so read-only reads as set and never weaker than disabled)\n * @cssprop --ui-fluid-background / --ui-fluid-gap - A fluid box's fill and the space under it (default the layer's fill, 0: boxes that touch; Kanok: transparent, 8px)\n */\n@customElement('ui-select')\nexport class UiSelect extends UiElement {\n    static override hostStates: readonly string[] = ['show-error', 'show-warn', 'placeholder'];\n\n    static readonly formAssociated = true;\n\n    static override readonly shadowRootOptions: ShadowRootInit = {\n        ...LitElement.shadowRootOptions,\n        delegatesFocus: true,\n    };\n\n    static override readonly styles = [\n        fieldTextStyles,\n        selectStyles,\n        fluidFieldStyles,\n        selectFluidStyles,\n    ];\n\n    /** Visible label text; the `label` slot replaces it when markup is needed. */\n    @property() label = '';\n\n    /** Keep the label for screen readers but don't show it. */\n    @property({ type: Boolean, attribute: 'hide-label' }) hideLabel = false;\n\n    /** Helper text under the field, shown while there is no error or warning. */\n    @property({ attribute: 'helper-text' }) helperText = '';\n\n    /** Error text shown while `invalid` or while the field fails validation. */\n    @property({ attribute: 'invalid-text' }) invalidText = '';\n\n    /** Forces the error state, e.g. after server-side validation. */\n    @property({ type: Boolean, reflect: true }) invalid = false;\n\n    /** Non-blocking warning; shown when there is no error. */\n    @property({ type: Boolean, reflect: true }) warn = false;\n\n    /** Text of the warning shown while `warn`. */\n    @property({ attribute: 'warn-text' }) warnText = '';\n\n    /** Shown as an empty first choice; with `required` the user must pick something else. */\n    @property() placeholder = '';\n\n    @property() value = '';\n\n    /** Reflected: form-associated elements submit under the `name` attribute. */\n    @property({ reflect: true }) name = '';\n\n    /** Field height: sm 32px, md 40px, lg 48px (tokens `--ui-field-height-*`). */\n    @property({ type: String, reflect: true }) size: 'sm' | 'md' | 'lg' = 'md'; // Carbon default (40px)\n\n    /** Disables the control; a disabled `<fieldset>` ancestor does the same. */\n    @property({ type: Boolean, reflect: true }) disabled = false;\n\n    /** Blocks form submission while the field is empty. */\n    @property({ type: Boolean, reflect: true }) required = false;\n\n    /** Shows and submits the value but blocks changes. */\n    @property({ type: Boolean, reflect: true }) readonly = false;\n\n    /** Carbon `FluidSelect`: the label inside a 64px box, an error / warning inside it. `<ui-fluid-form>` sets it for every field inside. */\n    @property({ type: Boolean, reflect: true }) fluid = false;\n\n    /** Label beside a compact, borderless select. */\n    @property({ type: Boolean, reflect: true }) inline = false;\n\n    @state() private entries: Entry[] = [];\n\n    @state() private touched = false;\n\n    /** Disabled, reset defaults, validation on submit and the name given from outside (shared by the form fields). */\n    private readonly formControl = new FormControlController(this, { reveal: () => (this.touched = true) });\n\n    @query('select') private readonly select!: HTMLSelectElement;\n\n\n    private readonly localize = new LocalizeController(this);\n\n    /**\n     * Kind of the message line as last rendered. Recorded, not recomputed: render reads the native\n     * select's validity before the new options commit, so recomputing in updated() could disagree.\n     */\n    private shownMessageKind: MessageKind | undefined;\n\n    /** Message from `setCustomValidity()`; '' = none. */\n    private customValidityMessage = '';\n\n    /** Like `<input>.setCustomValidity()`: a non-empty message makes the field invalid (and is shown as its error once touched) until cleared with ''. */\n    setCustomValidity(message: string) {\n        this.customValidityMessage = message;\n        if (!this.hasUpdated) return;\n        this.syncValidity();\n        this.requestUpdate();\n    }\n    private readonly selectId = uid('ui-select');\n    /** Created on connect: there is no MutationObserver when Lit renders on the server. */\n    private observer?: MutationObserver;\n    private defaultValue = '';\n\n    protected override willUpdate() {\n        syncFluid(this, this.fluid);\n    }\n\n    override connectedCallback() {\n        super.connectedCallback();\n        syncFluid(this, this.fluid);\n        // first connection only: moving the element must not change what reset goes back to\n        this.formControl.captureDefaults(() => {\n            // like a native select, `<option selected>` is the initial (and reset) choice unless `value` is set\n            if (!this.value && !this.hasAttribute('value')) this.value = selectedOptionValue(this) ?? '';\n            this.defaultValue = this.value;\n        });\n        this.readOptions();\n        // the options inside changed; not the host's own attributes (its open, error and status marks would read the\n        // options again and render the whole list a second time)\n        this.observer ??= new MutationObserver((records) => {\n            if (records.some((r) => r.type !== 'attributes' || r.target !== this)) this.readOptions();\n        });\n        this.observer.observe(this, { childList: true, subtree: true, characterData: true, attributes: true });\n    }\n\n    override disconnectedCallback() {\n        super.disconnectedCallback();\n        this.observer?.disconnect();\n    }\n\n    get form() {\n        return this.internals.form;\n    }\n\n    get validationMessage() {\n        return this.internals.validationMessage;\n    }\n\n    /** Whether the field takes part in constraint validation (not while disabled), as natively. */\n    get willValidate() {\n        return this.internals.willValidate;\n    }\n\n    /** The `<label>`s that point at this field. */\n    get labels() {\n        return this.internals.labels;\n    }\n\n    reportValidity() {\n        return this.formControl.reportValidity(this.internals);\n    }\n\n    get validity() {\n        return this.internals.validity;\n    }\n\n    checkValidity() {\n        return this.internals.checkValidity();\n    }\n\n    formResetCallback() {\n        this.value = this.defaultValue;\n        this.touched = false;\n    }\n\n    /** Back/forward cache and autofill hand the saved value back here. */\n    formStateRestoreCallback(state: string | File | FormData | null) {\n        if (typeof state === 'string') this.value = state;\n    }\n    /** From an ancestor `<fieldset>`; kept apart so it never overwrites the author's `disabled`. */\n    formDisabledCallback(disabled: boolean) {\n        this.formControl.setFieldsetDisabled(disabled);\n    }\n\n    private get isDisabled() {\n        return this.formControl.disabled;\n    }\n\n    private get interactive() {\n        return !this.isDisabled && !this.readonly;\n    }\n\n    protected override updated() {\n        // Without a placeholder the native select falls back to its first option — mirror that, once there are options:\n        // a value set before its options arrive (an async list) waits for them\n        if (this.entries.length > 0 && this.select.value !== this.value) {\n            this.value = this.select.value;\n            return;\n        }\n        this.syncValidity();\n        this.syncHostState();\n    }\n\n    /** Internal states as presence attributes on the host, so app styles can select them (same conditions as render). */\n    private syncHostState() {\n        this.toggleAttribute('data-show-error', this.shownMessageKind === 'error');\n        this.toggleAttribute('data-show-warn', this.shownMessageKind === 'warn');\n        this.toggleAttribute('data-placeholder', !!this.placeholder && !this.value);\n    }\n\n    private syncValidity() {\n        if (barWhenDisabled(this.internals, this.isDisabled)) return;\n        this.internals.setFormValue(this.value);\n        const customError = customErrorMessage(this.invalid, this.invalidText, this.customValidityMessage);\n        if (customError) {\n            this.internals.setValidity({ customError: true }, customError, this.select);\n        } else if (this.select.validity.valid) {\n            this.internals.setValidity({});\n        } else {\n            this.internals.setValidity(this.select.validity, nativeValidationMessage(this.select, this.localize.t.field.requiredOne), this.select);\n        }\n    }\n\n    private readOptions() {\n        this.entries = [...this.children].flatMap((child): Entry[] => {\n            if (child instanceof HTMLOptionElement) return [readOption(child)];\n            if (child instanceof HTMLOptGroupElement) {\n                return [\n                    {\n                        label: child.label,\n                        disabled: child.disabled,\n                        options: [...child.querySelectorAll('option')].map(readOption),\n                    },\n                ];\n            }\n            return [];\n        });\n    }\n\n    /** Readonly: stop the picker from opening. */\n    private onMouseDown(event: MouseEvent) {\n        if (this.readonly) event.preventDefault();\n    }\n\n    /** Readonly: arrows / letters / Space would change the value — only let Tab through. */\n    private onKeyDown(event: KeyboardEvent) {\n        if (this.readonly && event.key !== 'Tab') event.preventDefault();\n    }\n\n    /** The native `input` reaches the page after this runs, so listeners already read the new `value`. */\n    private onInput() {\n        this.value = this.select.value;\n    }\n\n    private onChange() {\n        this.value = this.select.value;\n        this.touched = true;\n        this.dispatchEvent(new Event('change', { bubbles: true }));\n    }\n\n    private renderOption(o: OptionData) {\n        return html`<option value=${o.value} ?disabled=${o.disabled} ?selected=${o.value === this.value}>\n            ${o.label}\n        </option>`;\n    }\n\n    private readonly slots = new SlotController(this);\n\n    private renderLabel() {\n        // no label of its own: an unseen one with the name given from outside (aria-label, a <label for>), if any\n        const unlabelled = !this.label && !this.slots.has('label');\n        const outside = unlabelled ? this.formControl.fallbackName(this.label, this.internals) : '';\n        if (unlabelled && !outside) return nothing;\n        return html`<label class=${this.hideLabel || unlabelled ? 'sr-only' : 'label'} part=\"label\" for=${this.selectId}>${renderLabelText(this.label, outside)}</label>`;\n    }\n\n    override render() {\n        const showError =\n            this.interactive && (this.invalid || (this.touched && (!!this.customValidityMessage || (!!this.select && !this.select.validity.valid))));\n        const message = pickMessage({\n            showError,\n            errorText: pickErrorText(this.invalid, this.customValidityMessage, this.invalidText || (this.select ? nativeValidationMessage(this.select, this.localize.t.field.requiredOne) : '')),\n            showWarn: this.warn && this.interactive,\n            warnText: this.warnText,\n            helperText: this.helperText,\n            slots: this.slots,\n        });\n        markStatus(this, message);\n        this.shownMessageKind = message?.kind;\n        const describedBy = messageId(this.selectId, message);\n        const classes = [\n            showError ? 'invalid' : '',\n            message && message.kind !== 'helper' ? 'has-status' : '',\n            this.placeholder && !this.value ? 'placeholder' : '',\n        ]\n            .filter(Boolean)\n            .join(' ');\n\n        return html`\n            ${this.renderLabel()}\n            <div class=\"field ${classes}\" part=\"base\">\n                <select\n                    part=\"input\"\n                    id=${this.selectId}\n                    ?disabled=${this.isDisabled}\n                    ?required=${this.required}\n                    aria-readonly=${this.readonly ? 'true' : nothing}\n                    aria-invalid=${showError ? 'true' : 'false'}\n                    aria-describedby=${describedBy ?? nothing}\n                    @mousedown=${this.onMouseDown}\n                    @keydown=${this.onKeyDown}\n                    @input=${this.onInput}\n                    @change=${this.onChange}\n                    @blur=${() => (this.touched = true)}\n                >\n                    ${this.placeholder\n                        ? html`<option value=\"\" data-placeholder ?selected=${!this.value}>${this.placeholder}</option>`\n                        : nothing}\n                    ${this.entries.map((entry) =>\n                        isGroup(entry)\n                            ? html`<optgroup label=${entry.label} ?disabled=${entry.disabled}>\n                                  ${entry.options.map((o) => this.renderOption(o))}\n                              </optgroup>`\n                            : this.renderOption(entry),\n                    )}\n                </select>\n                <span class=\"icons\" aria-hidden=\"true\">\n                    ${renderStatusIcon(message)}\n                    <svg class=\"chevron\" part=\"chevron\" viewBox=\"0 0 16 16\"><path d=\"M8 11 3 6l.7-.7L8 9.6l4.3-4.3.7.7z\" /></svg>\n                </span>\n            </div>\n            ${renderMessage(this.selectId, message)}\n        `;\n    }\n}\n\ndeclare global {\n    interface HTMLElementTagNameMap {\n        'ui-select': UiSelect;\n    }\n}\n"
    }
  ]
}
