import{p as t,H as e,c as s,h as r,d as a,t as i}from"./p-yZBlG3YQ.js";import{VerdocsEndpoint as n,toggleTemplateStar as o}from"@verdocs/js-sdk";const l=()=>`verdocs-template-star{display:-ms-flexbox;display:flex;-ms-flex:0 0 60px;flex:0 0 60px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;font-family:"Inter", "Barlow", sans-serif}verdocs-template-star .star{line-height:10px}verdocs-template-star .star.updating{-webkit-animation:spinningStar 2s infinite linear;animation:spinningStar 2s infinite linear}verdocs-template-star .star svg{width:24px;height:24px}verdocs-template-star .count{color:#595c5d;font-size:14px;margin-left:10px}@-webkit-keyframes spinningStar{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes spinningStar{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}`;const c=`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z" /></svg>`;const d=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z" clip-rule="evenodd" /></svg>`;const f=t(class t extends e{constructor(t){super();if(t!==false){this.__registerHost()}this.starChange=s(this,"starChange");this.sdkError=s(this,"sdkError");this.endpoint=n.getDefault();this.updating=false}async componentWillLoad(){this.endpoint.loadSession();if(!this.endpoint.session){console.log("[TEMPLATES] Must be authenticated");return}}toggle(t){t.stopPropagation();this.updating=true;o(n.getDefault(),this.template.id).then((t=>{this.updating=false;this.template.star_counter=t.star_counter;this.starChange.emit({templateId:this.template.id,starred:t.star_counter>0,count:t.star_counter})})).catch((t=>{this.updating=false;console.log("[STAR] Error toggling template star",t.message);this.sdkError.emit(t)}))}render(){return r(a,{key:"11f23b3f7dc779128e3ce967619491255d2f46e5"},r("div",{key:"a8b0281d77522a51cc5ed57e752327b79749986d",class:`star ${this.updating?"updating":""}`,innerHTML:this.template.star_counter?d:c,onClick:t=>this.toggle(t)}),r("div",{key:"ca4e6ed0e494f0255cce552150ac17008f76ae3e",class:"count"},this.template.star_counter||"--"))}static get style(){return l()}},[0,"verdocs-template-star",{endpoint:[16],template:[1040],updating:[32]}]);function m(){if(typeof customElements==="undefined"){return}const t=["verdocs-template-star"];t.forEach((t=>{switch(t){case"verdocs-template-star":if(!customElements.get(i(t))){customElements.define(i(t),f)}break}}))}export{f as V,m as d};
//# sourceMappingURL=p-tub_01MP.js.map