/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
import{ref as e,watch as a,computed as l,onMounted as n,onBeforeUnmount as t,openBlock as u,createElementBlock as r,normalizeStyle as o,normalizeClass as i,unref as v,createElementVNode as s,createCommentVNode as d,renderSlot as p,Fragment as c,renderList as m}from"vue";import{useNamespace as f}from"../../hooks/useNamespace.js";import './index2.css';import './index.css';/* empty css          *//* empty css          */import y from"../../_virtual/_plugin-vue_export-helper.js";import O from"../../node_modules/lodash-es/isFinite.js";const g={key:1,"aria-hidden":!0,class:"marquee"},h=/* @__PURE__ */y(/* @__PURE__ */Object.assign({name:"GscMarquee"},{__name:"index",props:{vertical:{type:Boolean,default:!1},direction:{type:String,default:"normal"},duration:{type:Number,default:28},delay:{type:Number,default:1},loop:{type:Number,default:0},clone:{type:Boolean,default:!1},gradient:{type:Boolean,default:!1},gradientColor:{type:Array,default:()=>[255,255,255]},gradientLength:{type:String},pauseOnHover:{type:Boolean,default:!0},pauseOnClick:{type:Boolean,default:!1},pause:{type:Boolean,default:!1},animateOnOverflowOnly:{type:Boolean,default:!1}},emits:["complete","loop-complete","pause","resume","overflow-detected","overflow-cleared"],setup(y,{emit:h}){const $=y,w=h,{prefixCls:C}=f("marquee"),k=e(0),H=e("100%"),_=e("100%"),q=e(0),x=e(!1),B=e(!0),M=e(0),b=e(0),j=e(0),I=e(0),N=e(!1),W=e(!1),z=e(0),L=e(null),S=e("200px"),A=e(!1),F=e(null),G=e(null),T=async()=>{await(async()=>{$.vertical&&(x.value=!0),setInterval(()=>{if(H.value="0%",_.value="0%",null!==F.value&&null!==G.value&&F.value&&G.value){if($.vertical&&"clientHeight"in F.value&&"clientHeight"in G.value){I.value=F.value.clientHeight,j.value=G.value.clientHeight;const e=Math.ceil(j.value/I.value);return k.value=O(e)?e:0,x.value=!1,k.value}if(!$.vertical&&"clientWidth"in F.value&&"clientWidth"in G.value){if(b.value=F.value.clientWidth,M.value=G.value.clientWidth,$.animateOnOverflowOnly)return b.value<M.value?(B.value=!0,w("overflow-detected")):(B.value=!1,w("overflow-cleared")),0;const e=Math.ceil(M.value/b.value);return k.value=O(e)?e:0,k.value}return H.value="100%",_.value="100%",0}return H.value="100%",_.value="100%",0},100)})(),q.value++};a(b,async()=>{$.clone&&T()}),a(M,async()=>{($.clone||$.animateOnOverflowOnly)&&T()}),a(()=>$.pause,(e,a)=>{e!==a&&w(e?"resume":"pause")});const X=()=>{$.pauseOnHover&&(w("pause"),N.value=!0)},Y=()=>{$.pauseOnHover&&(w("resume"),N.value=!1)},D=()=>{$.pauseOnClick&&(w("pause"),W.value=!0)},E=()=>{$.pauseOnClick&&(w("resume"),W.value=!1)},J=l(()=>$.pause||$.vertical&&x.value||$.animateOnOverflowOnly&&B.value?"paused":"running"),K=l(()=>$.pauseOnHover&&(N.value||W.value)||!$.pauseOnHover&&"paused"===J.value?"paused":"running"),P=l(()=>$.pauseOnHover&&N.value||$.pauseOnClick&&W.value||!$.pauseOnHover&&"paused"===J.value?"paused":"running"),Q=l(()=>{const e={"--duration":`${$.duration}s`,"--delay":`${$.delay}s`,"--direction":`${$.direction}`,"--pause-on-hover":`${K.value}`,"--pause-on-click":`${P.value}`,"--pause-animation":`${J.value}`,"--loops":`${0===$.loop?"infinite":$.loop}`,"--gradient-color":`rgba(${$.gradientColor[0]}, ${$.gradientColor[1]}, ${$.gradientColor[2]}, 1), rgba(${$.gradientColor[0]}, ${$.gradientColor[1]}, ${$.gradientColor[2]}, 0)`,"--gradient-length":`${S.value}`,"--min-width":`${H.value}`,"--min-height":`${_.value}`},a={"--orientation":"scrollX",orientation:"horizontal"};$.vertical&&(a["--orientation"]="scrollY");return{...e,...a}}),R=l(()=>!!$.gradient);return n(async()=>{$.gradient&&$.gradientLength&&(S.value=$.gradientLength),$.vertical&&$.animateOnOverflowOnly&&console.warn("The `animateOnOverflowOnly` prop is not supported for vertical marquees."),A.value=!0,L.value=setInterval(()=>{z.value++,0!==$.loop&&z.value===$.loop&&(w("complete"),clearInterval(L.value)),w("loop-complete")},1e3*$.duration)}),t(()=>{clearInterval(L.value)}),(e,a)=>A.value?(u(),r("div",{key:q.value,class:i([v(C),{vertical:y.vertical,horizontal:!y.vertical}]),style:o(Q.value),onMouseenter:X,onMouseleave:Y,onMousedown:D,onMouseup:E},[s("div",{ref_key:"marqueeOverlayContainer",ref:G,class:"transparent-overlay","aria-hidden":!0},null,512),R.value?(u(),r("div",{key:0,"aria-hidden":!0,class:i(["overlay",{vertical:y.vertical,horizontal:!y.vertical}])},null,2)):d("",!0),s("div",{ref_key:"marqueeContent",ref:F,class:"marquee"},[p(e.$slots,"default",{},void 0,!0)],512),!y.animateOnOverflowOnly||y.animateOnOverflowOnly&&!B.value?(u(),r("div",g,[p(e.$slots,"default",{},void 0,!0)])):d("",!0),(u(!0),r(c,null,m(k.value,a=>(u(),r("div",{key:a,"aria-hidden":!0,class:"marquee cloned"},[p(e.$slots,"default",{},void 0,!0)]))),128))],38)):d("",!0)}}),[["__scopeId","data-v-f1f0ed6e"]]);export{h as default};