import{$ as a}from"./vendor-768bd574.js";function v(){import.meta.url,import("_").catch(()=>1);async function*h(){}}class f{constructor(){this.isMobile=a(window).outerWidth()<=768,this.wavesurfers=[]}headerInit(){console.log("AppGlobal -> headerInit");const s=a("#header");if(s.length){s.find(".open_layer_btn").click(function(){const e=a(this),t=e.data("target"),d=a("#".concat(t));e.toggleClass("cur").siblings(".cur").removeClass("cur"),d.toggleClass("__show").siblings(".__show").removeClass("__show")});const i=document.getElementById("searchForm");i.querySelector(".form-input").addEventListener("keydown",e=>{e.key==="Enter"&&(e.preventDefault(),i.submit())})}}listActionsInit(){const s=a(".listActions");s.length&&s.find(".video_btn").click(function(){const i=a(this),n=i.attr("data-video"),e=i.parent(".item_btns").siblings(".item_source");if(n&&e.length){let t=e.find(".item_video");i.parents(".list_item").siblings(".list_item").map((c,u)=>{const l=a(u).find(".item_video");l.length&&!l[0].paused&&(a(u).find(".video_btn").toggleClass("cur"),l[0].pause(),l.addClass("hidden"))}),t.length||e.append('')),t=e.find(".item_video");const r=t[0].paused;i.toggleClass("cur"),r?(t[0].play(),t.removeClass("hidden")):(t[0].pause(),t.addClass("hidden"))}})}waterfullInit(){const s=a(".com-list-duanshipin");s.length&&s.each(function(i,n){new Masonry(a(n).find(".duanshipin_list")[0],{itemSelector:".list_item",columnWidth:".list_item",percentPosition:!0})})}audioListInit(){if(a(".com-list-audio").length){let i=function(){this.wavesurfers.map((n,e)=>{n.pause(),a(".audio_btn.playing").removeClass("playing")})};a(".com-list-audio .list_item").each((n,e)=>{a(e).find(".waveform").each((d,r)=>{var c=a(r),u=c.data("audio");const l=WaveSurfer.create({container:c[0],waveColor:"#9e9e9e",progressColor:"#4de600",cursorColor:"rgba(0,0,0,0)",normalize:!0,height:44,barAlign:"bottom",url:u});this.wavesurfers.push(l);const o=c.parents(".item_source").find(".audio_btn");o.click(()=>{l.isPlaying()?(l.pause(),o.removeClass("playing")):(i.call(this),l.play(),o.addClass("playing"))}),l.on("click",()=>{i.call(this),l.play(),o.addClass("playing")}),l.on("finish",()=>{l.pause(),o.removeClass("playing")})})})}}audioDetailInit(){const s=t=>{const d=Math.floor(t/60),r=Math.round(t)%60,c="0".concat(r).slice(-2);return"".concat(d,":").concat(c)},i=a(".cg-audio-detail");if(i.length){let g=function(){o.isPlaying()?(o.pause(),t.removeClass("playing"),d.removeClass("xuanz"),r.removeClass("skewing")):(o.play(),t.addClass("playing"),d.addClass("xuanz"),r.addClass("skewing"))};var n=i.find(".waveform"),e=n.data("audio");const t=i.find(".audio_btn"),d=i.find(".guxz"),r=i.find(".gp"),c=i.find(".audio_time"),u=i.find(".audio_duration"),l=i.find(".guangp");console.log("audioUrl",e);const o=WaveSurfer.create({container:n[0],waveColor:"#9e9e9e",progressColor:"#4de600",cursorColor:"rgba(0,0,0,0)",normalize:!0,height:30,url:e});this.wavesurfers.push(o),t.click(()=>{g()}),o.on("decode",m=>{u.text(s(m))}),o.on("timeupdate",m=>{c.text(s(m))}),o.on("finish",()=>{o.pause(),t.removeClass("playing"),d.removeClass("xuanz"),r.removeClass("skewing")}),o.on("click",()=>{o.play(),t.addClass("playing"),d.addClass("xuanz"),r.addClass("skewing")}),l.click(()=>{g()})}}multipathVideoInit(){const s=a(".com-multipath-video");s.length&&s.find(".multipath_nav .nav_btn").click(function(){const i=a(this),n=i.index(),e=s.find(".multipath_list .video_wrap");i.addClass("cur").siblings(".nav_btn").removeClass("cur");var t=e.eq(n).children("iframe").attr("src");e.length&&e.eq(n).addClass("cur").siblings(".video_wrap").removeClass("cur"),n==0?(document.getElementById("my-video").pause(),e.eq(n).children("iframe").attr("src",t).parents(".video_wrap").siblings(".video_wrap").children("iframe").attr("src"," ")):n==1?e.eq(n).siblings(".video_wrap").children("iframe").attr("src"," "):(document.getElementById("my-video").pause(),e.eq(n).children("iframe").attr("src",t).parents(".video_wrap").siblings(".video_wrap").children("iframe").attr("src"," "))})}pauseAllAudios(){this.wavesurfers.forEach(s=>{s.isPlaying()&&s.pause()}),a(".audio_btn.playing").removeClass("playing")}init(){this.headerInit(),this.listActionsInit(),this.waterfullInit(),this.audioListInit(),this.audioDetailInit(),this.multipathVideoInit(),console.log("AppGlobal -> init")}}const p=new f;window.AppGlobal=p;window.onload=function(){p.init(),window.addEventListener("beforeunload",()=>{console.log("beforeunload == 页面离开事件"),p.pauseAllAudios()}),window.addEventListener("visibilitychange",()=>{console.log("visibilitychange == 页面隐藏"),document.visibilityState==="hidden"&&p.pauseAllAudios()}),window.addEventListener("popstate",()=>{console.log("popstate == 页面返回事件"),p.pauseAllAudios()})};export{v as __vite_legacy_guard};