1var S=Object.defineProperty;var P=(t,e,s)=>e in t?S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var l=(t,e,s)=>P(t,typeof e!="symbol"?e+"":e,s);class c{constructor(e=0,s="Network Error"){this.status=e,this.text=s}}const T=()=>{if(!(typeof localStorage>"u"))return{get:t=>Promise.resolve(localStorage.getItem(t)),set:(t,e)=>Promise.resolve(localStorage.setItem(t,e)),remove:t=>Promise.resolve(localStorage.removeItem(t))}},o={origin:"https://api.emailjs.com",blockHeadless:!1,storageProvider:T()},h=t=>t?typeof t=="string"?{publicKey:t}:t.toString()==="[object Object]"?t:{}:{},R=(t,e="https://api.emailjs.com")=>{if(!t)return;const s=h(t);o.publicKey=s.publicKey,o.blockHeadless=s.blockHeadless,o.storageProvider=s.storageProvider,o.blockList=s.blockList,o.limitRate=s.limitRate,o.origin=s.origin||e},v=async(t,e,s={})=>{const i=await fetch(o.origin+t,{method:"POST",headers:s,body:e}),r=await i.text(),a=new c(i.status,r);if(i.ok)return a;throw a},y=(t,e,s)=>{if(!t||typeof t!="string")throw"The public key is required. Visit https://dashboard.emailjs.com/admin/account";if(!e||typeof e!="string")throw"The service ID is required. Visit https://dashboard.emailjs.com/admin";if(!s||typeof s!="string")throw"The template ID is required. Visit https://dashboard.emailjs.com/admin/templates"},V=t=>{if(t&&t.toString()!=="[object Object]")throw"The template params have to be the object. Visit https://www.emailjs.com/docs/sdk/send/"},w=t=>t.webdriver||!t.languages||t.languages.length===0,E=()=>new c(451,"Unavailable For Headless Browser"),H=(t,e)=>{if(!Array.isArray(t))throw"The BlockList list has to be an array";if(typeof e!="string")throw"The BlockList watchVariable has to be a string"},F=t=>{var e;return!((e=t.list)!=null&&e.length)||!t.watchVariable},C=(t,e)=>t instanceof FormData?t.get(e):t[e],L=(t,e)=>{if(F(t))return!1;H(t.list,t.watchVariable);const s=C(e,t.watchVariable);return typeof s!="string"?!1:t.list.includes(s)},j=()=>new c(403,"Forbidden"),D=(t,e)=>{if(typeof t!="number"||t<0)throw"The LimitRate throttle has to be a positive number";if(e&&typeof e!="string")throw"The LimitRate ID has to be a non-empty string"},x=async(t,e,s)=>{const i=Number(await s.get(t)||0);return e-Date.now()+i},_=async(t,e,s)=>{if(!e.throttle||!s)return!1;D(e.throttle,e.id);const i=e.id||t;return await x(i,e.throttle,s)>0?!0:(await s.set(i,Date.now().toString()),!1)},k=()=>new c(429,"Too Many Requests"),A=async(t,e,s,i)=>{const r=h(i),a=r.publicKey||o.publicKey,m=r.blockHeadless||o.blockHeadless,u=r.storageProvider||o.storageProvider,d={...o.blockList,...r.blockList},g={...o.limitRate,...r.limitRate};return m&&w(navigator)?Promise.reject(E()):(y(a,t,e),V(s),s&&L(d,s)?Promise.reject(j()):await _(location.pathname,g,u)?Promise.reject(k()):v("/api/v1.0/email/send",JSON.stringify({lib_version:"4.4.1",user_id:a,service_id:t,template_id:e,template_params:s}),{"Content-type":"application/json"}))},I=t=>{if(!t||t.nodeName!=="FORM")throw"The 3rd parameter is expected to be the HTML form element or the style selector of the form"},N=t=>typeof t=="string"?document.querySelector(t):t,q=async(t,e,s,i)=>{const r=h(i),a=r.publicKey||o.publicKey,m=r.blockHeadless||o.blockHeadless,u=o.storageProvider||r.storageProvider,d={...o.blockList,...r.blockList},g={...o.limitRate,...r.limitRate};if(m&&w(navigator))return Promise.reject(E());const f=N(s);y(a,t,e),I(f);const n=new FormData(f);return L(d,n)?Promise.reject(j()):await _(location.pathname,g,u)?Promise.reject(k()):(n.append("lib_version","4.4.1"),n.append("service_id",t),n.append("template_id",e),n.append("user_id",a),v("/api/v1.0/email/send-form",n))},p={init:R,send:A,sendForm:q,EmailJSResponseStatus:c};class b{static init(){p.init(this.PUBLIC_KEY),console.log("ð§ EmailJS initialisé - Configuration optimisée")}static async sendContactEmail(e){try{const s=this.validateFormData(e);if(!s.isValid)throw new Error(s.error);console.log("ð§ Envoi via EmailJS...");const i={to_email:"[email protected]",from_name:e.name,from_email:e.email,reply_to:e.email,subject:`[Contact Site] ${e.subject}`,message:this.generateEmailText(e),contact_name:e.name,contact_email:e.email,phone:e.phone||"Non renseigné",company:e.company||"Non renseignée",contact_subject:e.subject,contact_message:e.message,services:e.services.join(", ")||"Aucun service sélectionné",current_date:new Date().toLocaleStr
1ing("fr-FR"),sent_from:"Site web Gamis.ma"};console.log("ð¤ Envoi vers:",i.to_email);const r=await p.send(this.SERVICE_ID,this.TEMPLATE_ID,i);return console.log("â Email envoyé avec succès!",r),{success:!0,message:"Message envoyé avec succès !",id:r.text}}catch(s){console.error("â Erreur EmailJS:",s);let i="Erreur lors de l'envoi du message";return s instanceof Error&&(s.message.includes("network")||s.message.includes("fetch")?i="Problème de connexion. Vérifiez votre internet.":s.message.includes("service")||s.message.includes("400")?i="Service email temporairement indisponible.":i=s.message),{success:!1,message:i}}}static generateEmailText(e){return` 2ð¢ NOUVEAU CONTACT GAMIS - Site Web 3 4ð¤ Nom: ${e.name} 5ð§ Email: ${e.email} 6ð± Téléphone: ${e.phone||"Non renseigné"} 7ð¢ Société: ${e.company||"Non renseignée"} 8ð·ï¸ Sujet: ${e.subject} 9ð¯ Services: ${e.services.join(", ")||"Aucun service sélectionné"} 10 11ð¬ Message: 12${e.message} 13 14--- 15ð Envoyé le: ${new Date().toLocaleString("fr-FR")} 16ð Depuis: Site web Gamis.ma 17 `.trim()}static async sendConfirmationEmail(e){return console.log("â¹ï¸ Email de confirmation désactivé"),{success:!0,message:"Confirmation désactivée"}}static validateFormData(e){var s,i,r,a;return(s=e.name)!=null&&s.trim()?(i=e.email)!=null&&i.trim()?this.isValidEmail(e.email)?(r=e.subject)!=null&&r.trim()?(a=e.message)!=null&&a.trim()?{isValid:!0}:{isValid:!1,error:"Le message est requis"}:{isValid:!1,error:"Le sujet est requis"}:{isValid:!1,error:"Adresse email invalide"}:{isValid:!1,error:"L'email est requis"}:{isValid:!1,error:"Le nom est requis"}}static isValidEmail(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim())}}l(b,"PUBLIC_KEY","BRpRI5UGnAv3OLRvq"),l(b,"SERVICE_ID","service_ziysxps"),l(b,"TEMPLATE_ID","template_2ocrdg7");export{b as EmailService};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.