import{g as i,h as p,l as g}from"./vendor.Cge7vpB3.js";import{b as u,r as f}from"./TranslationHelpers.DiNqG0Fa.js";import{g as h}from"./typeHelpers.DyGGaxEg.js";const b=async s=>{try{const e=await g.get(s,{headers:{Accept:"text/html"}});if(e&&(e.status==200||e.statusText.toLowerCase()=="ok"))return e.data;throw`Unexpected [${e.status}]: ${e.statusText}.`}catch(e){console.error(e)}return""},w=s=>{const e=()=>{const n=document.createElement("script");n.setAttribute("id",`jshelpers-${f(4)}`),n.setAttribute("type","text/javascript"),n.textContent=s,document.body.appendChild(n)};if(document.readyState!=="complete"){console.info(`Document.readyState not 'complete' (${document.readyState})`),document.addEventListener("DOMContentLoaded",function(n){console.info("Document.readyState now 'complete' -> Injecting jshelpers template."),e()});return}e()},H=(s,e,n,r)=>{if(!Array.isArray(s)||s.length==0||!e)return"<div></div>";const t=s.filter(m=>m.templateUrl.toLowerCase()==e.toLowerCase());if(t.length!=1)return"<div></div>";const a=new DOMParser().parseFromString(t[0].template,"text/html").getElementById(n);return a===null?"<div></div>":n=="jshelpers"?(w(a.textContent),"<div></div>"):i.compile(a.innerHTML)({...r})},T=(s="default")=>{window.wpo365=window.wpo365||{},window.wpo365.moment=p,window.wpo365[s]=window.wpo365[s]||{},window.wpo365[s].handlebarsSafeString=e=>new i.SafeString(e),window.wpo365[s].registerHandlebarsHelper=(e,n)=>{e in i.helpers||(i.registerHelper(e,n),console.log(`Registered the following Handlebars helper: ${e} [namespace: ${s}]`))},i.registerHelper("iframe",e=>{const r=new DOMParser().parseFromString(e,"text/html"),t=r.head||r.createElement("head"),o=r.createElement("meta");o.setAttribute("charset","UTF-8"),t.prepend(o);const d=r.createElement("style");d.textContent=`
      font { all: unset; color: inherit; font-family: inherit; font-size: inherit; }
      body {
        margin: 0;
        font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
        color: #222;
      }
      p { margin: 0 0 1rem; }`,t.appendChild(d),r.head||r.documentElement.insertBefore(t,r.body);const a=`<!DOCTYPE html>
${r.documentElement.outerHTML}`,c=new Blob([a],{type:"text/html"}),l=URL.createObjectURL(c);return new i.SafeString(`<div class="pintraCalendarBody"><iframe sandbox="allow-same-origin allow-popups" id="pintraBodyIframe" src="${l}" style="width:100%; height:auto; border:none;"></iframe></div>`)}),i.registerHelper("avatar",e=>e?new i.SafeString(`<img class="pintraItemIcon" src="${e}" width="50" height="50" />`):""),i.registerHelper("yavatar",(e,n)=>{const r=n?n.replace("{width}","50").replace("{height}","50"):e||"";return new i.SafeString(`<img class="pintraYammerIcon" src="${r}" width="50" height="50" />`)}),i.registerHelper("profilePic",(e,n)=>n in e&&e[n]?new i.SafeString(`<img class="pintraItemIcon" src="${e[n]}" width="50" height="50" />`):""),i.registerHelper("fabricIcon",e=>new i.SafeString(u({name:e,resultType:void 0}))),i.registerHelper("ifCond",(e,n,r,t)=>{switch(n){case"==":return e==r?t.fn(void 0):t.inverse(void 0);case"===":return e===r?t.fn(void 0):t.inverse(void 0);case"!=":return e!=r?t.fn(void 0):t.inverse(void 0);case"!==":return e!==r?t.fn(void 0):t.inverse(void 0);case"<":return e<r?t.fn(void 0):t.inverse(void 0);case"<=":return e<=r?t.fn(void 0):t.inverse(void 0);case">":return e>r?t.fn(void 0):t.inverse(void 0);case">=":return e>=r?t.fn(void 0):t.inverse(void 0);case"&&":return e&&r?t.fn(void 0):t.inverse(void 0);case"||":return e||r?t.fn(void 0):t.inverse(void 0);default:return t.inverse(void 0)}}),i.registerHelper("uriSegments",(e,n)=>{const r=h(e),t=r?r.protocol+"://"+r.host+(r.port?":"+r.port:""):"";return n.fn({path:r?.path??[],queryString:r?.queryString??"",baseUrl:t})}),i.registerHelper("combineUrl",(e,n,r)=>(r&&n==e.length-1&&(e[e.length-1]=`${e[e.length-1]}?${r}`),e.slice(0,n+1).join("/"))),i.registerHelper("hasProperty",(e,n,r)=>n in e?r.fn(void 0):r.inverse(void 0))};export{H as g,T as r,b as t};
//# sourceMappingURL=HandlebarsHelpers.C5T4lt3V.js.map
