import{r as e,h as t,H as s,e as i}from"./p-ee1e0eb4.js";import{E as l}from"./p-b226f54d.js";import"./p-2f569553.js";const o=class{constructor(t){e(this,t)}componentDidLoad(){this.postText=this.textValue}setText(e){this.postText=e}isAuthenticated(){try{var e=l.getInstance().get("sparkle");if(e&&e.auth&&e.auth.getToken())return!0}catch(e){return!1}}submitPost(){this.errorMessage="",this.successMessage="",this.el.getElementsByClassName("PostExternalUrl"),this.el.getElementsByClassName("IsPublic")}uploadImage(e){}selectFile(){document.getElementById("fileInput").click()}renderUserInfo(){var e={Token:null,ProfileImageUrl:null};return null!=e&&e.Token?t("ion-avatar",{class:"header-avatar",slot:"end"},t("img",{src:"/assets/img/avatar.png"})):t("ion-button",{slot:"end",href:"/login"},"Login to Post")}render(){const e=this.renderUserInfo();return t(s,null,t("slot",null),t("ion-card",null,t("ion-item",{class:"header"},t("ion-card-title",null,"Community Wall"),e),t("ion-card-content",null,t("form",null,t("ion-list",null,t("ion-item",{lines:"none"},t("ion-label",null,"Public"),t("ion-toggle",{class:"IsPublic",slot:"end",color:"primary",name:"IsPublic"})),t("ion-item",{class:"padding"},t("ion-textarea",{class:"PostText",required:!0,placeholder:"Post Text",name:"PostText",value:this.postText})),t("ion-item",{class:"padding"},t("ion-input",{class:"PostExternalUrl",required:!0,type:"text",placeholder:"URL",name:"ExternalResourceUrl",value:this.externalResourceUrl})),this.uploadedImage?t("ion-item",{class:"padding"},t("img",{class:"uploaded-image",src:this.uploadedImage})):"",t("ion-item",{lines:"none"},t("input",{type:"file",id:"fileInput",onChange:e=>this.uploadImage(e),style:{display:"none"},accept:"image/*"}),this.uploadImageLoading?t("ion-spinner",{color:"primary"}):"",t("ion-button",{slot:"start",onClick:()=>this.selectFile()},t("ion-icon",{name:"add"}),"Upload Image")),t("ion-item",{class:"post-footer",lines:"none"},t("div",null,t("div",{class:"error"},this.errorMessage),t("div",{class:"success"},this.successMessage)),t("ion-button",{slot:"end",size:"default",onClick:()=>this.submitPost(),disabled:!this.isAuthenticated()},"Post")))))))}get el(){return i(this)}};o.style=":host{display:block}.post-footer{display:flex;justify-content:space-between}.error{color:red}.success{color:green}.uploaded-image{display:block;max-height:140px;width:auto !important}";export{o as sparkle_feed_post}