1import{z as q,f as _,y as g,w as L,o as I,as as K,C as a,a2 as l,a3 as s,a7 as f,a8 as M,aa as x,ab as N,a9 as d,a4 as w,ac as U,ak as W,ad as G,av as J}from"./vendor-841ae9e1.js";import{_ as n}from"./SvgIcon-3a8dabd4.js";import{l as F}from"./index-ba7a78b3.js";const P={key:0,class:"share__body"},Q=["title"],R=["data-index"],X=["title"],Y=["onClick"],Z=["title"],re=q({__name:"Share",props:{afterSocialClick:{type:Function,default:null},customIcons:{type:Object,default:()=>({})},customLinks:{type:Object,default:()=>({})},direction:{type:String,default:"right"},forceColor:{type:String,default:null},url:{type:String,required:!0},withTrigger:{type:Boolean,default:!0},withBrandColors:{type:Boolean,default:!1},withHover:{type:Boolean,default:!1},sharedToken:{type:String,default:null},withCopyLink:{type:Boolean,default:!1},withSubscription:{type:Boolean,default:!1},videoId:{type:String,default:null}},emits:["icon-click"],setup(k,{emit:z}){const e=k,c=_(!1),u=_(!1),y=_(),C=z,V=g(()=>{const o="share",i=`${o}--${e.direction}`,t=c.value&&`${o}--opened`,r=e.withTrigger&&`${o}--with-trigger`,h=e.withHover&&`${o}--with-hover`;return[o,i,t,r,h]}),b=g(()=>Object.entries(e.customIcons).map(([o,i])=>{const{icon:t,onClick:r}=i;return{...i,name:o,icon:t,onClick:()=>(C("icon-click",o),r?r():null)}})),O=g(()=>e.withSubscription&&!e.sharedToken),A=g(()=>{switch(e.direction){case"left":return"share-left";case"right":return"share-right";case"up":return"share-up";case"down":return"share-down";default:return"fade"}}),p=_(),v=()=>{const{vk:o,telegram:i}=e.customLinks||{},t=[{key:"vk",url:o||"http://vk.com/share.php?url=",title:"ÐоделиÑÑÑÑ Ð² VK",className:"",style:{borderColor:"",color:""}},{key:"telegram",url:i||"http://telegram.me/share/url?url=",title:"ÐоделиÑÑÑÑ Ð² Telegram",className:"",style:{borderColor:"",color:""}}];p.value=t.map(r=>{const h={borderColor:e.forceColor,color:e.forceColor},m=e.videoId&&e.sharedToken?`?video=${e.videoId}&shared_token=${e.sharedToken}`:e.videoId?`?video=${e.videoId}`:e.sharedToken?`?shared_token=${e.sharedToken}`:"";return r.className="share__icon",r.className+=e.withBrandColors?` share__icon--${r.key}`:"",r.url+=`${e.url}${m}`,r.style=e.forceColor?h:{borderColor:"",color:""},r})},j=()=>{e.withTrigger&&(c.value=!c.value)},T=({target:o})=>{const i=b.value.filter(t=>t.tooltip);if(!y.value.contains(o)){for(const t of i)t.tooltip.isVisible&&C("icon-click",t.name);e.withTrigger&&(c.value=!1)}},D=async o=>{var m,S,$,B;o.preventDefault();const i={height:screen.height,width:screen.width},t={height:i.height/2,width:i.width/2},r=i.height/2-t.height/2,h=i.width/2-t.width/2;try{e.sharedToken||await((m=e.afterSocialClick)==null?void 0:m.call(null)),await J(),window.open((B=($=p.value)==null?void 0:$[(S=o.target.dataset)==null?void 0:S.index])==null?void 0:B.url,"blank",` 2 top=${r}, 3 left=${h}, 4 width=${t.width}, 5 height=${t.height}, 6 toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, 7 `)}catch(E){F("Share","afterSocialClick",E.message||E)}},H=async()=>{try{await navigator.clipboard.writeText(`https://${e.url}`),u.value=!0,setTimeout(()=>{u.value=!1},5e3)}catch(o){F("Share","navigator.clipboard.writeText [copy link]",o)}};return c.value=!e.withTrigger,L(()=>e.url,o=>{o&&v()},{immediate:!0}),L(()=>e.sharedToken,o=>{v()},{immediate:!0}),I(()=>{document.addEventListener("click",T),v()}),K(()=>{document.removeEventListener("click",T)}),(o,i)=>(a(),l("div",{ref_key:"root",ref:y,class:d(V.value)},[k.withTrigger?(a(),l("div",{key:0,class:"share__toggle",onClick:j},[s(n,{name:"share",color:"currentColor",width:"30",height:"30"})])):f("",!0),s(G,{name:A.value},{default:M(()=>[!k.withTrigger||c.value?(a(),l("div",P,[(a(!0),l(x,null,N(p.value,(t,r)=>(a(),l("div",{key:t.key,class:d(t.className),title:t.title||""},[w("div",{class:d(["share__icon-link",{"--disabled":O.value}]),"data-index":r,style:U(t.style),onClick:D},[s(n,{name:"circle",width:"30",height:"30",color:"currentColor",class:"share__icon-circle"}),s(n,{name:t.key,width:"30",height:"30",color:"currentColor",class:"share__icon-item"},null,8,["name"])],14,R)],10,Q))),128)),(a(!0),l(x,null,N(b.value,t=>(a(),l("div",{key:t.name,title:t.title||"",class:"share__icon"},[w("div",{class:"share__icon-link",onClick:t.onClick},[s(n,{name:"circle",width:"30",height:"30",color:"currentColor",class:"share__icon-circle"}),s(n,{name:t.icon,width:"30",height:"30",color:"currentColor",class:"share__icon-item"},null,8,["name"])],8,Y),t.tooltip?(a(),l("div",{key:0,class:d(["share__icon-tooltip",t.tooltip.isVisible&&"share__icon-tooltip--visible"])},[W(o.$slots,`tooltip.${t.name}`)],2)):f("",!0)],8,X))),128)),k.withCopyLink?(a(),l("div",{key:0,class:"share__icon",title:u.value?"СÑÑлка ÑкопиÑована":"СкопиÑоваÑÑ ÑÑÑлкÑ"},[w("div",{class:d(["share__icon-link",{"--copied":u.value}]),onClick:H},[s(n,{name:"circle",width:"30",height:"30",color:u.value?"#b1aca9":"currentColor",class:"share__icon-circle"},null,8,["color"]),s(n,{name:"copy-link",width:"30",height:"30",color:u.value?"#b1aca9":"currentColor",class:"share__icon-item"},null,8,["color"])],2)],8,Z)):f("",!0)])):f("",!0)]),_:3},8,["name"])],2))}});
7export{re as _};
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.