import{r as o,d as i,B as t,h as n}from"./p-f8363b1b.js";import{r as e,u as l,a as s,g as a}from"./p-b64c06dc.js";import{t as d}from"./p-510e3bc9.js";import{s as r}from"./p-c78d1e1b.js";import"./p-af2a8ecd.js";import"./p-d2ac57a0.js";import"./p-f44f0a67.js";import"./p-3775d1fc.js";import"./p-80de33dc.js";import"./p-c2fbed0d.js";import"./p-5717491f.js";import"./p-de14d315.js";const u=class{constructor(t){o(this,t),this.floodteamCloseModal=i(this,"floodteamCloseModal",7),this.fireenjinFetch=i(this,"fireenjinFetch",7),this.fireenjinUpload=i(this,"fireenjinUpload",7),this.heading="Get Help",this.ticket={},this.ticketInput={}}async onEditorChange(){var o;(null===(o=this.editorEl)||void 0===o?void 0:o.exportHTML)&&(this.previewHTML=await this.editorEl.exportHTML(),this.editor=await(await this.editorEl.getInstance()).save())}async onChange(o){var i,t;"tags"===(null===(i=null==o?void 0:o.target)||void 0===i?void 0:i.name)&&(this.ticketInput.tags=(null===(t=null==o?void 0:o.target)||void 0===t?void 0:t.value)?o.target.value:[])}onReset(o){var i;if("addSupport"===(null===(i=o.detail)||void 0===i?void 0:i.endpoint)){const o=document.querySelector("ion-modal.modal-support");(null==o?void 0:o.dismiss)&&o.dismiss()}}async onSuccess(o){var i;if("addSupport"===(null===(i=o.detail)||void 0===i?void 0:i.endpoint)){const o=document.querySelector("ion-modal.modal-support");(null==o?void 0:o.dismiss)&&(await o.dismiss(),this.presentToast())}}async presentToast(){(await d.create({message:"Feedback has been sent successfully!",duration:2e3})).present()}getExtension(o){var i=o.split(/[\\/]/).pop(),t=i.lastIndexOf(".");return""===i||t<1?"":i.slice(t+1)}async onPhotoUpload(o){var i;const t=e(this.storage,`${(new Date).toISOString()}.${this.getExtension(null===(i=null==o?void 0:o.file)||void 0===i?void 0:i.name)}`),n=await l(t,o.file);return{success:!0,file:{url:await s(n.ref)}}}componentDidLoad(){(null==t?void 0:t.isBrowser)&&(this.storage=a())}render(){var o,i,t,e,l;return[n("ion-header",null,n("ion-toolbar",null,n("ion-title",null,this.heading),n("ion-buttons",{slot:"end"},n("ion-button",{onClick:()=>{var o,i;return null===(i=null===(o=this.formEl)||void 0===o?void 0:o.submit)||void 0===i?void 0:i.call(o)},color:"primary",fill:"solid"},"Send"),n("ion-button",{onClick:()=>this.floodteamCloseModal.emit()},n("ion-icon",{slot:"icon-only",name:"close-circle-outline"}))))),n("ion-content",null,n("ion-grid",null,n("ion-row",null,n("ion-col",{class:"ion-padding"},n("ion-text",{color:"medium"},"Select the type of support you require and then give us a brief summary of your issue and someone will follow up with you."))),n("ion-row",null,n("ion-col",{class:"ion-padding"},n("ion-card",{style:{overflow:"visible"}},n("fireenjin-form",{name:"support",endpoint:"addSupport",beforeSubmit:o=>({...this.ticketInput,...o,userId:this.userId,html:this.previewHTML,editor:this.editor}),ref:o=>this.formEl=o,submitButton:"Submit",resetButton:"Cancel",resetButtonColor:"medium",hideControls:!0,disableLoader:!0,disableEnterButton:!0},n("ion-item",{lines:"inset"},n("fireenjin-avatar",{slot:"start",style:{display:"inline-block",position:"relative",borderRadius:"4px",padding:"0 !important",overflow:"hidden"},initials:`${(null===(o=null==r?void 0:r.profile)||void 0===o?void 0:o.firstName)?null===(i=null==r?void 0:r.profile)||void 0===i?void 0:i.firstName.charAt(0):""}${(null===(t=null==r?void 0:r.profile)||void 0===t?void 0:t.lastName)?null===(e=null==r?void 0:r.profile)||void 0===e?void 0:e.lastName.charAt(0):""}`,src:null===(l=null==r?void 0:r.profile)||void 0===l?void 0:l.photo}),n("fireenjin-select",{name:"type",label:"Type",labelPosition:"stacked",options:[{label:"Bug",value:"Bug 🐞"},{label:"Feedback",value:"Task ✅"}],value:"Task ✅"})),n("fireenjin-editor",{style:{minHeight:"50px"},autofocus:!0,ref:o=>this.editorEl=o,uploadCallback:o=>this.onPhotoUpload(o)})))))))]}};u.style="modal-support fireenjin-editor{width:calc(100% - 75px);margin:0 0 0 60px}modal-support fireenjin-editor .codex-editor__redactor{padding-bottom:0 !important}@media only screen and (max-width: 800px){.modal-support{--width:100%;--max-width:auto}}";export{u as modal_support}