// #region Imports
import { CssLength } from '@breadstone/mosaik-themes';
import { html } from '../../../../Dom/Html';
import { RendererServiceLocator } from '../../../../Dom/Renderer';
import { styleMap, when } from '../../../Directives/Directives';
// #endregion
/**
 * The template of the {@link ProgressRingElement}.
 *
 * @public
 */
export function progressRingElementTemplate(e) {
    return html `
        ${when(e.label.trim(), () => html `
        <slot name="label">
            <mosaik-text part="label"
                         .truncate="${true}"
                         .text="${e.label.trim()}"></mosaik-text>
        </slot>
        `)}
        ${when(e.isIndeterminate, () => html `
        <svg part="root" class="circle indeterminate"
             viewBox="0 0 ${e.diameter} ${e.diameter}"
             style="${styleMap({ width: `${e.diameter}px`, height: `${e.diameter}px` })}">
            <circle fill="none"
                    cx="${e.radius}"
                    cy="${e.radius}"
                    r="${CssLength.toNumber(e.radius) - (CssLength.toNumber(e.thickness) / 2)}"
                    stroke-width="${e.thickness}" />
        </svg>
        `, () => html `
        <svg part="root"
             viewBox="0 0 ${e.diameter} ${e.diameter}"
             style="${styleMap({ width: `${e.diameter}px`, height: `${e.diameter}px` })}">
            <circle part="bar"
                    fill="none"
                    cx="${e.radius}"
                    cy="${e.radius}"
                    r="${CssLength.toNumber(e.radius) - (CssLength.toNumber(e.thickness) / 2)}"
                    stroke-width="${e.thickness}" />
            <circle part="fill"
                    class="circle-path"
                    fill="none"
                    cx="${e.radius}"
                    cy="${e.radius}"
                    r="${CssLength.toNumber(e.radius) - (CssLength.toNumber(e.thickness) / 2)}"
                    stroke-linecap="'round'"
                    stroke-width="${e.thickness}"
                    stroke-dasharray="${`${e.getCircumference()}, ${e.getCircumference()}`}"
                    stroke-dashoffset="${e.getOffset()}" />
        </svg>
        `)}
        <div part="hint">
            <slot name="hint"
                  @slotchange="${(x) => x.target.assignedElements().map((y, i) => RendererServiceLocator.current.setStyle(y, 'order', i))}"></slot>
        </div>
    `;
}
//# sourceMappingURL=ProgressRingElementTemplate.js.map