import{__decorate as t}from"tslib";import{html as i}from"lit";import{property as e,state as s,query as o,customElement as n}from"lit/decorators.js";import{s as r}from"./nile-inline-sidebar-item-body.css.esm.js";import{N as l}from"../internal/nile-element.esm.js";import"../internal/accessibility/a11y.state.enum.esm.js";import"../internal/accessibility/a11y.property.enum.esm.js";import"../internal/accessibility/role.enum.esm.js";let a=class extends l{constructor(){super(...arguments),this.lines=2,this.content="",this.showTooltip=!1,this.isTruncated=!1,this.disabled=!1,this.active=!1}static get styles(){return[r]}firstUpdated(){this.checkTruncation(),this.bodyContentEl&&(this.resizeObserver=new ResizeObserver((()=>this.checkTruncation())),this.resizeObserver.observe(this.bodyContentEl))}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect()}checkTruncation(){if(this.bodyContentEl){const t=this.bodyContentEl.scrollHeight>this.bodyContentEl.clientHeight;t!==this.isTruncated&&(this.isTruncated=t)}}get contentTemplate(){const t=i`<div class="body-text" part="body-text">${this.content}</div>`;return this.isTruncated&&this.showTooltip?i`<nile-lite-tooltip content=${this.content} hoist>${t}</nile-lite-tooltip>`:t}render(){return i`
		<div class="item-body" part="item-body">
		<div class="prefix-content" part="prefix-content">
			<slot name="prefix"></slot>
		</div>
		<div class="body-content" part="body-content" style="--line-clamp: ${this.lines?this.lines:2}">
			${this.content?this.contentTemplate:i`<div class="body-text" part="body-text"><slot></slot></div>`}
		</div>
		<div class="suffix-content" part="suffix-content">
			<slot name="suffix"></slot>
		</div>
		</div>
			`}};t([e({type:Number,reflect:!0})],a.prototype,"lines",void 0),t([e({type:String,reflect:!0})],a.prototype,"content",void 0),t([e({type:Boolean,reflect:!0})],a.prototype,"showTooltip",void 0),t([s()],a.prototype,"isTruncated",void 0),t([o(".body-content")],a.prototype,"bodyContentEl",void 0),t([e({type:Boolean,reflect:!0,attribute:!0})],a.prototype,"disabled",void 0),t([e({type:Boolean,reflect:!0,attribute:!0})],a.prototype,"active",void 0),a=t([n("nile-inline-sidebar-item-body")],a);export{a as N};
