text: window.webshare=function(){let t="https:"==location.protocol&&navigator.share,e={};this.addPlatform=function(t){e[t.name]=t},this.getPlatforms=function(){return Object.keys(e)};let a={};this.on=function(t,e){a[t]||(a[t]=[]),a[t].push(e)};let n=function(t,e){a[t]&&a[t].map(t=>{t.apply(window.webshare,e)})};function o(a,o){let r=e[a];if(!r)throw"Platform unknown.";if(!function(e){return!(e.requiresNativeSupport&&!t)})throw"Platform is not supported.";console.log(o),o=Object.assign(Object.assign({url:document.querySelector("link[rel='canonical']")?document.querySelector("link[rel='canonical']").href:document.location.href,title:document.querySelector("meta[name='og:title']")?document.querySelector("meta[name='og:title']").content:document.title,text:""},o,o.social?o.social[a]:{})),r.handler(o,{ok:()=>{n("success",[a,o,...arguments])},error:()=>{n("error",[a,o,...arguments])}})}return this.render=function(a,n){(n=Object.assign({className:"webshare",platforms:"all",nativePlatforms:["native"],args:{}},n)).platforms="all"==n.platforms?this.getPlatforms():n.platforms,n.nativePlatforms="all"==n.nativePlatforms?this.getPlatforms():n.nativePlatforms;let r=document.createElement("div");r.className=n.className,(t?n.nativePlatforms:n.platforms).map(t=>{let a=e[t],l=document.createElement("a");l.href="#",l.onclick=function(){return o(t,n.args),!1},l.innerHTML=a.icon,l.className=n.className+"-platform "+n.className+"-platform-"+t,r.appendChild(l)}),a.appendChild(r)},this}();