import{__decorate as e}from"tslib";import{html as t}from"lit";import{property as i,customElement as s}from"lit/decorators.js";import{s as r}from"./nile-grid-cell-item.css.esm.js";import{N as l}from"../../internal/nile-element.esm.js";import{i as o,c as a,a as n}from"./nile-grid-cell-item.utils.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 c=class extends l{constructor(){super(...arguments),this.colspan=1,this.rowspan=1,this.resizable=!1,this.onHandlePointerDown=e=>{const t=this,i={value:0},s={value:0},r=o(t,e,i,s);if(!r)return;const{target:l,col:c}=r,m=e=>a(t,c,s.value,i.value,e),p=()=>n(t,c,e,l,m);l.addEventListener("pointermove",m),l.addEventListener("pointerup",p,{once:!0}),l.addEventListener("pointercancel",p,{once:!0})}}static get styles(){return[r]}connectedCallback(){super.connectedCallback(),this.setAttribute("role","cell")}render(){return t`
      <div class="cell-item-base" part="grid-cell-item-base">
        <slot></slot>
        ${this.resizable?t`
              <div
                aria-hidden="false"
                class="resize-handle"
                @pointerdown=${this.onHandlePointerDown}
              ></div>
            `:null}
      </div>
    `}};e([i({type:Number,reflect:!0,attribute:!0})],c.prototype,"colspan",void 0),e([i({type:Number,reflect:!0,attribute:!0})],c.prototype,"rowspan",void 0),e([i({type:Boolean,reflect:!0,attribute:!0})],c.prototype,"resizable",void 0),c=e([s("nile-grid-cell-item")],c);export{c as N};
