import{r as a,h as i,n as s,H as l,q as d,t as c,w as h}from"./index-BeCeuELg.js";import{t as r}from"./i18n-43b7aa72-DSS4ELtF.js";import{K as p}from"./Alert-733b0883-Df5pVzCu.js";import"./tslib.es6-1173d062-BGVaTf34.js";import"./clsx-09a06a12-B-dksMZM.js";const u=(t,n)=>{h(t,"errorList",e=>Array.isArray(e)&&e.find(o=>!(typeof o=="string"||typeof o=="function"))===void 0,new Set(["string","function"]),n)},f=`@layer kol-component {
  :host {
    display: block;
  }
}
@layer kol-component {
  .kol-tooltip-wc {
    display: contents;
  }
  .kol-tooltip-wc .tooltip-floating {
    opacity: 0;
    display: none;
    position: fixed;
    /* Avoid layout interference - see https://floating-ui.com/docs/computePosition */
    top: 0;
    left: 0;
    /* Can be used to specify the tooltip-width from the outside. Unset by default. */
    width: var(--kol-tooltip-width, unset);
    max-width: 90vw;
    max-height: 90vh;
    animation-direction: normal;
    /* Can be used to specify the animation duration from the outside. 250ms by default. */
    animation-duration: var(--kolibri-tooltip-animation-duration, 250ms);
    animation-fill-mode: forwards;
    animation-iteration-count: 1;
    animation-timing-function: ease-in;
  }
  .kol-tooltip-wc .tooltip-floating.hide {
    animation-name: hideTooltip;
  }
  .kol-tooltip-wc .tooltip-floating.show {
    animation-name: showTooltip;
  }
  /* Shared between content and arrow */
  .kol-tooltip-wc .tooltip-area {
    color: #000;
    background-color: #fff;
  }
  .kol-tooltip-wc .tooltip-arrow {
    transform: rotate(45deg);
    position: absolute;
    z-index: 999;
    width: calc(10rem / var(--kolibri-root-font-size, 16));
    height: calc(10rem / var(--kolibri-root-font-size, 16));
  }
  .kol-tooltip-wc .tooltip-content {
    position: relative;
    z-index: 1000;
  }
  @keyframes hideTooltip {
    0% {
      opacity: 1;
    }
    100% {
      opacity: 0;
      display: none;
    }
  }
  @keyframes showTooltip {
    0% {
      opacity: 0;
    }
    100% {
      opacity: 1;
    }
  }
}
/*
 * This file contains all rules for accessibility.
 */
@layer kol-a11y {
  :host {
    /*
     * Minimum size of interactive elements.
     */
    --a11y-min-size: calc(44rem / var(--kolibri-root-font-size, 16));
    color: black;
    /*
     * No element should be used without a background and font color whose contrast ratio has
     * not been checked. By initially setting the background color to white and the font color
     * to black, the contrast ratio is ensured and explicit adjustment is forced.
     */
    background-color: white;
    /*
     * Verdana is an accessible font that can be used without requiring additional loading time.
     */
    font-family: Verdana;
    /*
     * Letter spacing is required for all texts.
     */
    letter-spacing: inherit;
    /*
     * Word spacing is required for all texts.
     */
    word-spacing: inherit;
  }
  * {
    /*
     * This rule enables the word dividing for all texts. That is important for high zoom levels.
     */
    hyphens: auto;
    /*
     * This rule enables the word dividing for all texts. That is important for high zoom levels.
     */
    word-break: break-word;
  }
  /*
   * All interactive elements should have a minimum size of rem(44).
   */
  /* input:not([type='checkbox'], [type='radio'], [type='range']), */
  /* option, */
  /* select, */
  /* textarea, */
  button,
  .kol-input .input {
    min-width: var(--a11y-min-size);
    min-height: var(--a11y-min-size);
  }
  /*
   * Some interactive elements should not inherit the font-family and font-size.
   */
  a,
  button,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  input,
  option,
  select,
  textarea {
    /*
     * All elements should inherit the font family from his parent element.
     */
    font-family: inherit;
    /*
     * All elements should inherit the font size from his parent element.
     */
    font-size: inherit;
    /*
     * Letter spacing is required for all texts.
     */
    letter-spacing: inherit;
    /*
     * Word spacing is required for all texts.
     */
    word-spacing: inherit;
  }
  /**
  * Sometimes we need the semantic element for accessibility reasons,
  * but we don't want to show it.
  *
  * - https://www.a11yproject.com/posts/how-to-hide-content/
  */
  .visually-hidden {
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
  }
}
@layer kol-global {
  /*
   * Dieses CSS stellt sicher, dass der Standard-Style
   * von A und Button resettet werden.
   */
  :is(a, button) {
    background-color: transparent;
    width: 100%; /* 100% needed for custom width from outside */
    margin: 0;
    padding: 0;
    border: none;
  }
  /*
   * Ensure elements with hidden attribute to be actually not visible
   * @see https://meowni.ca/hidden.is.a.lie.html
   */
  [hidden] {
    display: none !important;
  }
}
@layer kol-global {
  :host {
    /*
     * The max-width is needed to prevent the table from overflowing the
     * parent node, if the table is wider than the parent node.
     */
    max-width: 100%;
    font-size: calc(16rem / var(--kolibri-root-font-size, 16));
  }
  * {
    /*
     * We prefer to box-sizing: border-box for all elements.
     */
    box-sizing: border-box;
  }
  /* KolSpan is a layout component with icons in all directions and a label text in the middle. */
  .kol-span-wc {
    display: grid;
    place-items: center;
  }
  /* The sub span in KolSpan is the horizontal span with icon left and right and the label text in the middle. */
  .kol-span-wc > span {
    display: flex;
    place-items: center;
  }
  a,
  button {
    cursor: pointer;
  }
  /* This is the text label. */
  .hide-label > .kol-span-wc > span > span {
    display: none;
  }
  /* Reset browser agent style. */
  button:disabled {
    color: unset;
  }
  .disabled label,
  .disabled:focus-within label,
  [aria-disabled=true],
  [aria-disabled=true]:focus,
  [disabled],
  [disabled]:focus {
    opacity: 0.5;
    outline: none;
    cursor: not-allowed;
  }
  [aria-disabled=true]:focus .kol-span-wc,
  [disabled]:focus .kol-span-wc {
    outline: none !important;
  }
  .badge-text-hint {
    color: black;
    background-color: lightgray;
  }
}
@layer kol-component {
  :host {
    display: inline-block;
  }
  :is(a, button) {
    display: inline-flex;
    max-width: fit-content;
    align-items: baseline;
    place-items: center;
    text-align: left;
    text-decoration-line: none;
  }
  :is(a, button) .kol-span-wc .span-label {
    text-decoration-line: underline;
  }
  a:is(:focus, :hover):not([aria-disabled]) .kol-span-wc .span-label,
  button:is(:focus, :hover):not([disabled]) .kol-span-wc .span-label {
    text-decoration-thickness: 0.2em;
  }
  .skip {
    position: absolute;
    left: calc(-99999rem / var(--kolibri-root-font-size, 16));
    z-index: 9999999;
    line-height: 1;
  }
  .skip:focus {
    background-color: #fff;
    position: unset;
    left: unset;
    padding: 1em;
  }
  .kol-icon.external-link-icon {
    display: inline-flex;
    margin-left: calc(8rem / var(--kolibri-root-font-size, 16));
  }
}
@layer kol-component {
  .kol-alert-wc {
    display: grid;
  }
  .kol-alert-wc .heading {
    display: flex;
    place-items: center;
  }
  .kol-alert-wc .heading > div {
    flex-grow: 1;
  }
  .close {
    /* Visible with forced colors */
    outline: transparent solid calc(1rem / var(--kolibri-root-font-size, 16));
  }
}`,m=f,b=class{constructor(t){a(this,t),this.onSubmit=n=>{var e,o;n.preventDefault(),n.stopPropagation(),typeof((e=this.state._on)===null||e===void 0?void 0:e.onSubmit)=="function"&&((o=this.state._on)===null||o===void 0||o.onSubmit(n))},this.onReset=n=>{var e,o;n.preventDefault(),n.stopPropagation(),typeof((e=this.state._on)===null||e===void 0?void 0:e.onReset)=="function"&&((o=this.state._on)===null||o===void 0||o.onReset(n))},this.handleLinkClick=n=>{const e=document.querySelector(n);e&&typeof e.focus=="function"&&(e.scrollIntoView({behavior:"smooth"}),e.focus())},this.setBlockElement=n=>this.errorListBlock=n,this.setFirstLinkElement=n=>this.errorListFirstLink=n,this._on=void 0,this._requiredText=!0,this._errorList=void 0,this.state={}}renderErrorList(t){return i(p,{ref:this.setBlockElement,type:"error",variant:"card",label:r("kol-error-list-message")},i("nav",{"aria-label":r("kol-error-list")},i("ul",null,t?.map((n,e)=>i("li",{key:e},i(s,{_href:"",_label:n.message,_on:{onClick:typeof n.selector=="string"?()=>this.handleLinkClick(String(n.selector)):n.selector},ref:e===0?this.setFirstLinkElement:void 0}))))))}renderFormElement(){return i("form",{autoComplete:"off",method:"post",onSubmit:this.onSubmit,onReset:this.onReset,noValidate:!0},this.state._requiredText===!0?i("p",null,i("div",{class:"mandatory-fields-hint"},r("kol-form-description"))):typeof this.state._requiredText=="string"&&this.state._requiredText.length>0?i("p",null,i("div",{class:"mandatory-fields-hint"},this.state._requiredText)):null,i("slot",null))}render(){const t=Array.isArray(this._errorList)&&this._errorList.length>0;return i(l,{key:"ecbb858c0be612da4ba131b0a764ccb9f7837df3",class:"kol-form"},t&&this.renderErrorList(this._errorList),this.renderFormElement())}scrollToErrorList(){var t;(t=this.errorListBlock)===null||t===void 0||t.scrollIntoView({behavior:"smooth",block:"start"}),setTimeout(()=>{var n,e;(e=(n=this.errorListFirstLink)===null||n===void 0?void 0:n.querySelector("a"))===null||e===void 0||e.focus()},250)}async focusErrorList(){return this.scrollToErrorList(),Promise.resolve()}validateOn(t){typeof t=="object"&&t!==null&&(this.state=Object.assign(Object.assign({},this.state),{_on:t}))}validateRequiredText(t){typeof t=="boolean"?d(this,"_requiredText",t):c(this,"_requiredText",t)}validateErrorList(t){u(this,t)}componentWillLoad(){this.validateOn(this._on),this.validateRequiredText(this._requiredText),this.validateErrorList(this._errorList)}static get watchers(){return{_on:["validateOn"],_requiredText:["validateRequiredText"],_errorList:["validateErrorList"]}}};b.style={default:m};export{b as kol_form};
//# sourceMappingURL=kol-form.entry-AIRVirbt.js.map
