@fiddle-digital/string-tune 0.0.65 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var H=class{constructor(){this.stringOffsetStart="0%";this.stringOffsetEnd="0%";this.stringEnterEl="top";this.stringExitEl="bottom";this.stringEnterVp="bottom";this.stringExitVp="top";this.stringInviewTop="0%";this.stringInviewBottom="0%";this.stringKey="--progress";this.stringStrength=.3;this.stringRadius=150;this.stringLerp=.2;this.stringParallaxBias=0;this.stringParallax=.2}};var R=class{parseSingle(t,e,r,i){let n=t.startsWith("-");n&&(t=t.slice(1));let s;return t==="selfHeight"?s=e.offsetHeight:t.endsWith("px")?s=parseFloat(t):t.endsWith("%")?s=parseFloat(t)*r/100:t.endsWith("rem")&&(s=parseFloat(t)*i),n?-s:s}};var m=class{constructor(t,e=null){this.settings=null;this.parser=new R;this.defaultSettings=new H;this.objectsMap=new Map;this.objects=new Array;this.htmlKey="";this._type=1;this.data=t.data,this.lerp=t.lerp,this.attribute=t.attribute,this.boundingClientRect=t.boundingClientRect,this.position=t.position,this.virtualCursor=t.virtualCursor,this.events=t.events,this.loop=t.loop,this.settings=e,this.defaultSettings=t.defaultSettings,this.parser=t.parser}get type(){return this._type}initObject(t,e,r,i){}onScrollStart(){}onScrollStop(){}onChangeDirection(){}destructor(){this.objects=new Array,this.objectsMap=new Map}onChangeScrollParams(){}tryConnect(t){return t.keys.includes(this.htmlKey)}connect(t){t.connect(this),this.onConnect(t)}enterObject(t,e){this.objectsMap.has(t)||(this.objectsMap.set(t,e),this.objects.push(e))}leaveObject(t){let e=this.objectsMap.get(t);if(e){this.objectsMap.delete(t);let r=this.objects.indexOf(e);r!==-1&&this.objects.splice(r,1)}}onStart(){}onUpdate(t){}onResize(){}onConnect(t){}onRebuild(){}onScroll(t){}onMouseMove(t){}onWheel(t){}onChangeDevice(){}onChangeScrollDirection(){}onMutationObserver(t,e){}};var f=class extends m{constructor(e,r=null){super(e,r);this.oldLerp=0}initObject(e,r,i,n){}};var et=class extends f{constructor(e){super(e);this.isStartLoaded=!1;this.imageLoadingCount=0;this.htmlKey="lazy"}onStart(){document.querySelectorAll("img[string-lazy]").forEach(r=>{this.load(r)}),this.isStartLoaded=!0}onConnect(e){if(this.imageLoadingCount++,this.isStartLoaded){let r=e.el;this.load(r)}}load(e){this.getImageSize(e,e.getAttribute("string-lazy")),e.classList.add("lazyLoad"),e.src=e.getAttribute("string-lazy");let r=()=>{e.classList.add("-loaded"),e.removeEventListener("load",r)};e.addEventListener("load",r)}getImageSize(e,r){return new Promise((i,n)=>{let s=new XMLHttpRequest;s.open("GET",r,!0),s.responseType="arraybuffer",s.onload=()=>{if(s.status===206||s.status===200){let a=s.response,o=new Blob([a]),h=new Image;h.onload=()=>{e.style.aspectRatio=`${h.width} / ${h.height}`,i({width:h.width,height:h.height}),URL.revokeObjectURL(h.src),this.imageLoadingCount--,this.imageLoadingCount<=0&&(this.events.emit("all-image-loaded",null),this.imageLoadingCount=0)},h.onerror=()=>{URL.revokeObjectURL(h.src),this.imageLoadingCount--,n(new Error("Failed to load image"))},h.src=URL.createObjectURL(o)}else n(new Error("Failed to load image"))},s.onerror=()=>{n(new Error("Network error"))},s.setRequestHeader("Range","bytes=0-"),s.send()})}};var rt=class extends m{constructor(e,r=null){super(e);this.loadingTimeout=0;this._type=2,r!=null&&r.timeout!=null&&(this.loadingTimeout=r.timeout)}onStart(){setTimeout(()=>{document.documentElement.classList.add("-loaded")},this.loadingTimeout)}};var v=class v extends m{constructor(t){super(t),this.htmlKey="autoplay"}initObject(t,e,r,i){super.initObject(t,e,r,i),e.setProperty("high-quality",this.attribute.process(r,"string-high-src",this.attribute.process(r,"string-src",""))),e.setProperty("medium-quality",this.attribute.process(r,"string-medium-src",e.getProperty("high-quality"))),e.setProperty("low-quality",this.attribute.process(r,"string-low-src",e.getProperty("high-quality")))}onStart(){v.isInternetSpeedCheckStarted||this.startGlobalSpeedCheck()}async onConnect(t){let e=t.el,r=this.attribute.process(e,"string-started",null)!==null;if(e.tagName.toLowerCase()==="video"&&!r){e.setAttribute("string-started",""),e.muted=!0,e.setAttribute("muted","muted"),e.setAttribute("playsinline",""),e.setAttribute("loop",""),e.setAttribute("autoplay",""),v.internetSpeed===null&&(v.internetSpeed=await this.testInternetSpeed(t));let i=this.selectQuality(t);e.src=i,e.dataset.qualityLevel=this.getQualityLevel(t,i).toString(),e.load(),e.addEventListener("canplay",()=>this.tryPlay(e))}}selectQuality(t){var r;let e=(r=v.internetSpeed)!=null?r:0;return e>1.5?t.getProperty("high-quality"):e>.3?t.getProperty("medium-quality"):t.getProperty("low-quality")}getQualityLevel(t,e){return e===t.getProperty("high-quality")?3:e===t.getProperty("medium-quality")?2:1}async testInternetSpeed(t){if(t==null)return 0;let e=t.getProperty("low-quality");try{let r=performance.now(),i=await fetch(e,{method:"GET",headers:{Range:"bytes=0-100000"}});if(!i.ok)throw new Error(`Fetch failed: ${i.statusText}`);return .1/((performance.now()-r)/1e3)}catch(r){return console.error("[StringVideoAutoplay] Error testing internet speed:",r),0}}startGlobalSpeedCheck(){if(v.isInternetSpeedCheckStarted)return;v.isInternetSpeedCheckStarted=!0;let t=async()=>{if(this.objects.length===0&&v.intervalId!==null){clearInterval(v.intervalId),v.intervalId=null;return}let e=await this.testInternetSpeed(this.objects[0]);v.internetSpeed=e,this.objects.forEach(async r=>{let i=r.el,n=this.selectQuality(r),s=this.getQualityLevel(r,n),a=parseInt(i.dataset.qualityLevel||"0");if(!(s<a&&i.currentTime>0)&&s!==r.getProperty("quality")&&i.dataset.qualityLevel===s.toString()){r.setProperty("quality",s);let o=r.getProperty("abort-controller");o&&o.abort();let h=new AbortController;r.setProperty("abort-controller",h);let p=await fetch(n,{signal:h.signal});if(!p.ok)throw new Error(`Fetch error: ${p.statusText}`);let d=await p.blob(),u=URL.createObjectURL(d),g=r.getProperty("currentBlobUrl");g&&URL.revokeObjectURL(g),r.setProperty("currentBlobUrl",u);let y=i.currentTime,b=!i.paused;i.src=u,i.load(),i.currentTime=y,b&&i.play().catch(console.warn),i.dataset.qualityLevel=s.toString()}})};t(),v.intervalId=window.setInterval(t,2e3)}tryPlay(t){t.play().catch(e=>console.warn("[StringVideoAutoplay] Autoplay failed:",e))}};v.isInternetSpeedCheckStarted=!1,v.internetSpeed=null,v.intervalId=null;var it=v;var L="top",D="bottom",T="left",O="right",A=class extends f{constructor(t){super(t),this.htmlKey="progress"}initObject(t,e,r,i){var h,p,d,u;super.initObject(t,e,r,i);let n=(h=i["string-enter-el"])!=null?h:this.defaultSettings.stringEnterEl,s=(p=i["string-enter-vp"])!=null?p:this.defaultSettings.stringEnterVp,a=(d=i["string-exit-el"])!=null?d:this.defaultSettings.stringExitEl,o=(u=i["string-exit-vp"])!=null?u:this.defaultSettings.stringExitVp;e.setProperty("start-element",n),e.setProperty("start-source",s),e.setProperty("end-element",a),e.setProperty("end-source",o),this.calculatePositions(e,this.data.wS)}onScroll(t){super.onScroll(t),this.objects.forEach(e=>{this.setUpObject(e)})}onConnect(t){super.onConnect(t),t.onEnter=()=>{this.setUpObject(t)}}setUpObject(t){let e=Math.min(1,Math.max(0,(this.data.c-t.getProperty("start-position"))/t.getProperty("difference-position")));t.getProperty("progress")!==e&&(t.setProperty("progress",e),this.applyProgress(t,e))}applyProgress(t,e){let r=e.toString();this.events.emit(`progress_${t.id}`,e),t.el.style.setProperty(t.key,r),t.connects.length>0&&t.connects.forEach(i=>{i.style.setProperty(t.key,r)})}calculatePositions(t,e){t.getProperty("start-element")===L&&t.getProperty("start-source")===L||t.getProperty("start-element")===T&&t.getProperty("start-source")===T?t.setProperty("start-position",t.getProperty("start")-t.getProperty("offset-start")):t.getProperty("start-element")===L&&t.getProperty("start-source")===D||t.getProperty("start-element")===T&&t.getProperty("start-source")===O?t.setProperty("start-position",t.getProperty("start")-e-t.getProperty("offset-start")):t.getProperty("start-element")===D&&t.getProperty("start-source")===L||t.getProperty("start-element")===O&&t.getProperty("start-source")===T?t.setProperty("start-position",t.getProperty("start")+t.getProperty("size")-t.getProperty("offset-start")):(t.getProperty("start-element")===D&&t.getProperty("start-source")===D||t.getProperty("start-element")===O&&t.getProperty("start-source")===O)&&t.setProperty("start-position",t.getProperty("start")-e-t.getProperty("offset-start")+t.getProperty("size")),t.getProperty("end-element")===L&&t.getProperty("end-source")===L||t.getProperty("end-element")===T&&t.getProperty("end-source")===T?t.setProperty("end-position",t.getProperty("start")+t.getProperty("offset-end")):t.getProperty("end-element")===L&&t.getProperty("end-source")===D||t.getProperty("end-element")===T&&t.getProperty("end-source")===O?t.setProperty("end-position",t.getProperty("start")-e+t.getProperty("offset-end")):t.getProperty("end-element")===D&&t.getProperty("end-source")===L||t.getProperty("end-element")===O&&t.getProperty("end-source")===T?t.setProperty("end-position",t.getProperty("start")+t.getProperty("size")+t.getProperty("offset-end")):(t.getProperty("end-element")===D&&t.getProperty("end-source")===D||t.getProperty("end-element")===O&&t.getProperty("end-source")===O)&&t.setProperty("end-position",t.getProperty("start")-e+t.getProperty("size")+t.getProperty("offset-end")),t.setProperty("difference-position",t.getProperty("end-position")-t.getProperty("start-position"))}};var st=class extends A{constructor(t){super(t),this.htmlKey="svg-morph"}async initObject(t,e,r,i){var b;let n=i["string-svg-start"],s=i["string-svg-end"],[a,o]=await Promise.all([this.loadSVG(n),this.loadSVG(s)]),h=a.querySelector("path"),p=o.querySelector("path"),d=h.getAttribute("d")||"",u=p.getAttribute("d")||"";e.setProperty("points-start",d),e.setProperty("points-end",u);let g=document.createElementNS("http://www.w3.org/2000/svg","path");g.setAttribute("d",d),g.setAttribute("fill",(b=i["string-fill"])!=null?b:"black");let y=document.createElementNS("http://www.w3.org/2000/svg","svg");y.setAttribute("viewBox",a.getAttribute("viewBox")||"0 0 100 100"),y.appendChild(g),r.innerHTML="",r.appendChild(y),e.setProperty("svg-path",g),super.initObject(t,e,r,i)}onScroll(t){super.onScroll(t),this.objects.forEach(e=>{this.morphPath(e,e.getProperty("progress"))})}async loadSVG(t){try{let r=await(await fetch(t)).text();return new DOMParser().parseFromString(r,"image/svg+xml").querySelector("svg")}catch(e){return console.error(`StringSVG: \u043F\u043E\u043C\u0438\u043B\u043A\u0430 \u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F ${t}`,e),null}}morphPath(t,e){let r=this.interpolatePaths(t.getProperty("points-start"),t.getProperty("points-end"),e);t.getProperty("svg-path").setAttribute("d",r)}interpolatePaths(t,e,r){let i=this.parsePathCommands(t),n=this.parsePathCommands(e);if(i.length!==n.length)return console.warn("StringSVG: \u041A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C \u043A\u043E\u043C\u0430\u043D\u0434 \u0432 \u0448\u043B\u044F\u0445\u0430\u0445 \u0440\u0456\u0437\u043D\u0430, \u0432\u0456\u0434\u043E\u0431\u0440\u0430\u0436\u0430\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u0438\u043D \u0456\u0437 \u0448\u043B\u044F\u0445\u0456\u0432 \u0431\u0435\u0437 \u0456\u043D\u0442\u0435\u0440\u043F\u043E\u043B\u044F\u0446\u0456\u0457."),r<.5?t:e;let s="";for(let a=0;a<i.length;a++){let o=i[a].match(/([a-zA-Z])|(-?\d*\.?\d+)/g)||[],h=n[a].match(/([a-zA-Z])|(-?\d*\.?\d+)/g)||[];if(o.length!==h.length){console.warn(`StringSVG: \u0420\u0456\u0437\u043D\u0430 \u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C \u0430\u0440\u0433\u0443\u043C\u0435\u043D\u0442\u0456\u0432 \u0443 \u043A\u043E\u043C\u0430\u043D\u0434\u0456 ${o[0]}, \u043F\u0440\u043E\u043F\u0443\u0441\u043A\u0430\u0454\u043C\u043E.`),s+=(r<.5?i[a]:n[a])+" ";continue}s+=o[0];for(let p=1;p<o.length;p++){let d=parseFloat(o[p]),u=parseFloat(h[p]);if(isNaN(d)||isNaN(u))s+=` ${o[p]}`;else{let g=d+(u-d)*r;s+=` ${g.toFixed(3)}`}}}return s}parsePathCommands(t){return t.match(/[a-df-z][^a-df-z]*/gi)||[]}};function nt(l,t=.1,e=1,r=.05,i=.65){if(l<t)return 1;if(l>1&&(l=1),l<=e){let n=(l-t)/(e-t);return i-n*(i-r)}return r}var at=class extends f{constructor(e,r=null){super(e,r);this.oldX=0;this.oldY=0;this.enterObjectsMap=new Map;this.enterObjects=new Array;this.overCount=0;this.htmlKey="cursor",this.cursor=document.querySelector("[string-cursor]"),this.cursorContent=document.querySelector("[string-cursor-content]")}onStart(){this.settings!=null?this.settings["string-lerp-cursor"]!=null&&(this.virtualCursor.mouseLerp=nt(this.settings["string-lerp-cursor"])):this.virtualCursor.mouseLerp=nt(.5)}initObject(e,r,i,n){var o;super.initObject(e,r,i,n);let s=this.attribute.process(i,"string-lerp",.5);this.settings!=null&&this.settings["string-lerp-target"]!=null&&(s=this.attribute.process(i,"string-lerp",this.settings["string-lerp-target"])),r.setProperty("alignment",(o=n["string-alignment"])!=null?o:"center"),r.setProperty("mouse-x",0),r.setProperty("mouse-y",0),r.setProperty("mouse-pixel-x",0),r.setProperty("mouse-pixel-y",0),r.setProperty("is-mouse-over",!1),r.setProperty("is-mouse-move",!1),r.setProperty("lerp",nt(s)),r.setProperty("cursor-target-disable",n["string-cursor-target-disable"]!==void 0),r.setProperty("cursor-target-style-disable",n["string-cursor-target-style-disable"]!==void 0);let a=n["string-cursor-class"];r.setProperty("cursor-target-class",""),a&&r.setProperty("cursor-target-class",a)}onUpdate(e){requestAnimationFrame(()=>{if(this.objects.forEach(r=>{if(r.getProperty("is-mouse-over")&&!r.getProperty("cursor-target-disable")){let i=r.el.getBoundingClientRect(),n=this.virtualCursor.x-i.left,s=this.virtualCursor.y-i.top,a=r.getProperty("mouse-pixel-x")-n,o=r.getProperty("mouse-pixel-y")-s;if(a*a+o*o>1e-4){r.getProperty("is-mouse-move")==!1&&(r.setProperty("is-mouse-move",!0),r.setProperty("mouse-pixel-x",n),r.setProperty("mouse-pixel-y",s),this.events.emit(`mousemove_start_${r.id}`,null));let p=this.lerp.process(r.getProperty("mouse-pixel-x"),n,r.getProperty("lerp")),d=this.lerp.process(r.getProperty("mouse-pixel-y"),s,r.getProperty("lerp"));r.setProperty("mouse-pixel-x",r.getProperty("mouse-pixel-x")+p),r.setProperty("mouse-pixel-y",r.getProperty("mouse-pixel-y")+d);let u=this.calculateOffset(r.getProperty("alignment"),r.getProperty("mouse-pixel-x"),i.width),g=this.calculateOffset(r.getProperty("alignment"),r.getProperty("mouse-pixel-y"),i.height);r.setProperty("mouse-x",u),r.setProperty("mouse-y",g),this.setMouseCoordinates(r,r.getProperty("mouse-x"),r.getProperty("mouse-y")),this.events.emit(`mousemove_${r.id}`,{x:r.getProperty("mouse-x"),y:r.getProperty("mouse-y")}),this.events.emit(`mousemove_pixel_${r.id}`,{x:r.getProperty("mouse-pixel-x"),y:r.getProperty("mouse-pixel-y")})}else r.setProperty("mouse-pixel-x",n),r.setProperty("mouse-pixel-y",s),this.events.emit(`mousemove_end_${r.id}`,null)}else if(r.getProperty("mouse-x")!=0||r.getProperty("mouse-y")!=0){r.setProperty("is-mouse-move",!1);let i=r.el.getBoundingClientRect(),n=this.calculateOffset("center",r.getProperty("half-width"),i.width),s=this.calculateOffset("center",r.getProperty("half-height"),i.height);r.setProperty("mouse-x",r.getProperty("mouse-x")+this.lerp.process(r.getProperty("mouse-x"),n,r.getProperty("lerp"))),r.setProperty("mouse-y",r.getProperty("mouse-y")+this.lerp.process(r.getProperty("mouse-y"),s,r.getProperty("lerp"))),Math.abs(r.getProperty("mouse-x"))<.001&&Math.abs(r.getProperty("mouse-y"))<.001&&(r.setProperty("mouse-x",0),r.setProperty("mouse-y",0),r.setProperty("mouse-pixel-x",0),r.setProperty("mouse-pixel-y",0)),this.setMouseCoordinates(r,r.getProperty("mouse-x"),r.getProperty("mouse-y"))}}),this.virtualCursor.lerpX!=0||this.virtualCursor.lerpY!=0){let r={lerpX:this.virtualCursor.lerpX,lerpY:this.virtualCursor.lerpY,x:this.virtualCursor.smoothX,y:this.virtualCursor.smoothY};this.events.emit("cursor",r),this.oldX=this.virtualCursor.smoothX,this.oldY=this.virtualCursor.smoothY,this.cursor.style.setProperty("--x",this.virtualCursor.smoothX),this.cursor.style.setProperty("--y",this.virtualCursor.smoothY),this.cursor.style.setProperty("--x-lerp",this.virtualCursor.lerpX),this.cursor.style.setProperty("--y-lerp",this.virtualCursor.lerpY)}})}onConnect(e){let r=e.el,i=null,n=()=>{this.overCount++,r.addEventListener("mouseleave",s),e.setProperty("is-mouse-over",!0),e.getProperty("cursor-target-class")!=null&&e.getProperty("cursor-target-class").length>0&&this.cursor.classList.add(e.getProperty("cursor-target-class")),this.cursor.classList.add("-showing"),i=setTimeout(()=>{this.cursor.classList.remove("-showing"),this.cursor.classList.add("-show")},1200)},s=()=>{this.overCount--,i!=null&&clearTimeout(i),r.removeEventListener("mouseleave",s),e.setProperty("is-mouse-over",!1),e.getProperty("cursor-target-class")!=null&&e.getProperty("cursor-target-class").length>0&&this.cursor.classList.remove(e.getProperty("cursor-target-class")),this.cursor.classList.remove("-showing"),this.cursor.classList.remove("-show")};e.onEnter=()=>{r.addEventListener("mouseenter",n)},e.onLeave=()=>{r.removeEventListener("mouseenter",n),r.removeEventListener("mouseleave",s)}}setMouseCoordinates(e,r,i){e.getProperty("cursor-target-style-disable")||(e.getProperty("self-disable")==!1&&(e.el.style.setProperty("--x",r.toFixed(2)),e.el.style.setProperty("--y",i.toFixed(2))),e.connects.forEach(n=>{n.style.setProperty("--x",r.toFixed(2)),n.style.setProperty("--y",i.toFixed(2))}))}calculateOffset(e,r,i){switch(e){case"start":return r/i;case"end":return(r-i)/i;case"center":default:return(r-i/2)/(i/2)}}};var ot=class extends f{constructor(t){super(t),this.htmlKey="magnetic"}initObject(t,e,r,i){var n,s;super.initObject(t,e,r,i),e.setProperty("is-magneting",!1),e.setProperty("magnetic-target-x",0),e.setProperty("magnetic-target-y",0),e.setProperty("magnetic-x",0),e.setProperty("magnetic-y",0),e.setProperty("strength",(n=i["string-strength"])!=null?n:this.defaultSettings.stringStrength),e.setProperty("radius",(s=i["string-radius"])!=null?s:this.defaultSettings.stringRadius),e.setProperty("lerp",.1)}onConnect(t){let e=t.el;this.settings!=null&&(this.settings["string-strength"]!=null&&t.setProperty("strength",this.settings["string-strength"]),this.settings["string-radius"]!=null&&t.setProperty("radius",this.settings["string-radius"]),this.settings["string-lerp"]!=null&&t.setProperty("lerp",this.settings["string-lerp"]))}onMouseMove(t){this.objects.forEach(e=>{let i=e.el.getBoundingClientRect(),n=i.left+e.getProperty("half-width"),s=i.top+e.getProperty("half-height"),a=t.clientX-n,o=t.clientY-s,h=Math.sqrt(a**2+o**2),p=e.getProperty("radius"),d=e.getProperty("strength");h<p?(e.setProperty("magnetic-target-x",a*d*((p-h)/p)),e.setProperty("magnetic-target-y",o*d*((p-h)/p)),e.setProperty("is-magneting",!0)):(e.setProperty("magnetic-target-x",0),e.setProperty("magnetic-target-y",0))})}onUpdate(t){this.objects.forEach(e=>{if(e.getProperty("is-magneting")){let r=e.getProperty("magnetic-x"),i=e.getProperty("magnetic-y"),n=this.lerp.process(r,e.getProperty("magnetic-target-x"),e.getProperty("lerp")),s=this.lerp.process(i,e.getProperty("magnetic-target-y"),e.getProperty("lerp"));n>-.01&&n<.01&&(n=0,e.setProperty("magnetic-x",e.getProperty("magnetic-target-x"))),s>-.01&&s<.01&&(s=0,e.setProperty("magnetic-y",e.getProperty("magnetic-target-y"))),r+=n,i+=s,e.setProperty("magnetic-x",r),e.setProperty("magnetic-y",i),e.el.style.setProperty("--magnetic-x",r.toString()),e.el.style.setProperty("--magnetic-y",i.toString()),(e.getProperty("magnetic-target-x")==r||e.getProperty("magnetic-target-y")==i)&&e.setProperty("is-magneting",!1)}})}};var B=class{process(t,e,r){return(e-t)*r}};var z=class{constructor(t=.1){this._lF=.1;this.lerp=new B;this._x=0;this._y=0;this._lerpX=0;this._lerpY=0;this.targetX=0;this.targetY=0;this._lF=t}get x(){return this.targetX}get y(){return this.targetY}get smoothX(){return this._x}get smoothY(){return this._y}get lerpX(){return this._lerpX}get lerpY(){return this._lerpY}set mouseLerp(t){this._lF=t}onMouseMove(t){this.targetX=t.clientX,this.targetY=t.clientY}onUpdate(){this._lerpX=this.lerp.process(this._x,this.targetX,this._lF),this._lerpY=this.lerp.process(this._y,this.targetY,this._lF),Math.sqrt(Math.pow(this._lerpX,2)+Math.pow(this._lerpY,2))<.1?(this._lerpX=0,this._lerpY=0,this._x=this.targetX,this._y=this.targetY):(this._x=this._x+this._lerpX,this._y=this._y+this._lerpY)}};var U=class{constructor(t){this.id="";this.key="--progress";this.keys="";this.connects=new Array;this.properties=new Map;this.modules=new Array;this.onEnter=()=>{};this.onLeave=()=>{};this.el=t}setProperty(t,e){this.properties.set(t,e)}getProperty(t){var e;return(e=this.properties.get(t))!=null?e:null}enter(){this.setProperty("active",!0)}leave(){this.setProperty("active",!1)}show(){this.onEnter(),this.el.classList.add("-inview"),this.modules.forEach(t=>{t.enterObject(this.id,this)})}hide(){this.onLeave(),this.getProperty("repeat")&&this.el.classList.remove("-inview"),this.modules.forEach(t=>{t.leaveObject(this.id)})}connect(t){this.modules.includes(t)||this.modules.push(t)}};var k=class{constructor(t){this.min=void 0;this.max=void 0;this.enable=!0;var e;this.min=t==null?void 0:t.min,this.max=t==null?void 0:t.max,this.enable=(e=t==null?void 0:t.enable)!=null?e:!0}setEnable(t=!0){this.enable=t}setRange(t,e){this.min=t!=null?t:void 0,this.max=e!=null?e:void 0}get mediaQuery(){let t="screen";return this.min&&(t+=` and (min-width: ${this.min}px)`),this.max&&(t+=` and (max-width: ${this.max}px)`),t}},lt=class extends m{constructor(e,r){super(e,r);this.queries={0:new k({max:359}),1:new k({min:360,max:1079}),2:new k({min:1080,max:1365}),3:new k({min:1366})};this.matchMedias={0:window.matchMedia(this.queries[0].mediaQuery),1:window.matchMedia(this.queries[1].mediaQuery),2:window.matchMedia(this.queries[2].mediaQuery),3:window.matchMedia(this.queries[3].mediaQuery)};this._type=2}onConnect(){}onStart(){var e,r,i,n;if(this.settings!=null&&this.settings.settings!=null){let s=this.settings.settings;s.mobile?(this.queries[0].enable=!0,this.queries[0].setRange(s.mobile.min==null?null:s.mobile.min,(e=s.mobile.max)!=null?e:null),this.matchMedias[0]=window.matchMedia(this.queries[0].mediaQuery)):this.queries[0].enable=!1,s.tablet?(this.queries[1].enable=!0,this.queries[1].setRange(s.mobile.min==null?null:s.mobile.min,(r=s.mobile.max)!=null?r:null),this.matchMedias[1]=window.matchMedia(this.queries[0].mediaQuery)):this.queries[1].enable=!1,s.laptop?(this.queries[2].enable=!0,this.queries[2].setRange(s.mobile.min==null?null:s.mobile.min,(i=s.mobile.max)!=null?i:null),this.matchMedias[2]=window.matchMedia(this.queries[0].mediaQuery)):this.queries[2].enable=!1,s.desktop?(this.queries[3].enable=!0,this.queries[3].setRange(s.mobile.min==null?null:s.mobile.min,(n=s.mobile.max)!=null?n:null),this.matchMedias[3]=window.matchMedia(this.queries[0].mediaQuery)):this.queries[3].enable=!1}this.updateElements()}onResize(){this.updateElements()}updateElements(){let e=this.matchMedias[0].matches&&this.queries[0].enable,r=this.matchMedias[1].matches&&this.queries[1].enable,i=this.matchMedias[2].matches&&this.queries[2].enable,n=this.matchMedias[3].matches&&this.queries[3].enable;document.querySelectorAll("[string-mobile], [string-tablet], [string-laptop], [string-desktop]").forEach(a=>{let o=!1;a.hasAttribute("string-mobile")&&e&&(o=!0),a.hasAttribute("string-tablet")&&r&&(o=!0),a.hasAttribute("string-laptop")&&i&&(o=!0),a.hasAttribute("string-desktop")&&n&&(o=!0),o?a.style.display=null:a.style.display="none"})}};var V=class{constructor(t,e,r){this.isDragging=!1;this.startY=0;this.startScrollPosition=0;this.data=t,this.scrollbar=e,this.thumb=r}onResize(){let t=this.data.psH,e=this.data.wS,r=e/t*e;this.thumb.style.setProperty("--size",r+"px"),t<=e?this.scrollbar.classList.add("-hide"):this.scrollbar.classList.remove("-hide")}updateThumb(){let t=this.data.psH,e=this.data.wS;this.thumb.style.setProperty("--position",`${this.data.c/t*e+"px"}`)}mouseDownEvent(t){this.startY=t.clientY,this.startScrollPosition=this.data.c}mouseMoveEvent(t){let e=t.clientY-this.startY,r=this.startScrollPosition+e/this.data.wS*this.data.psH;this.data.c=r,this.data.t=r,window.scrollTo(0,r),this.updateThumb()}};var F=class{constructor(t,e,r){this.isDragging=!1;this.startCoordinate=0;this.startScrollPosition=0;this.data=t,this.scrollbar=e,this.thumb=r}onResize(){let t=this.data.psW,e=this.data.wS,r=e/t*e;this.thumb.style.setProperty("--size",r+"px"),t<=e?this.scrollbar.classList.add("-hide"):this.scrollbar.classList.remove("-hide")}updateThumb(){let t=this.data.psW,e=this.data.wS;this.thumb.style.setProperty("--position",`${this.data.c/t*e+"px"}`)}mouseDownEvent(t){this.startCoordinate=t.clientX,this.startScrollPosition=this.data.c}mouseMoveEvent(t){let e=t.clientX-this.startCoordinate,r=this.startScrollPosition+e/this.data.wS*this.data.psW;this.data.c=r,this.data.t=r,window.scrollTo(0,r),this.updateThumb()}};var ht=class extends m{constructor(e){super(e);this.isDragging=!1;this.scrollMode="smooth";this.mouseUpEventBind=this.mouseUpEvent.bind(this),this.mouseDownEventBind=this.mouseDownEvent.bind(this),this.mouseMoveEventBind=this.mouseMoveEvent.bind(this)}destructor(){document.removeEventListener("mouseup",this.mouseUpEventBind),this.thumb.removeEventListener("mousedown",this.mouseDownEventBind),document.removeEventListener("mousemove",this.mouseMoveEventBind)}onStart(){this.createScrollbar(),this.updateThumb(),this.addCustomStyles(),document.addEventListener("mouseup",this.mouseUpEventBind),this.thumb.addEventListener("mousedown",this.mouseDownEventBind),document.addEventListener("mousemove",this.mouseMoveEventBind),document.documentElement.classList.add("-no-scrollbar")}onScroll(e){this.updateThumb(),this.showScrollbar(),this.hideScrollbar()}onResize(){this.scrollbarState.onResize()}onChangeScrollParams(){this.data.sM=="disable"&&this.scrollMode!="disable"&&this.scrollbar.classList.add("-hide"),(this.data.sM=="smooth"&&this.scrollMode=="disable"||this.data.sM=="default"&&this.scrollMode=="disable")&&this.scrollbar.classList.remove("-hide"),this.scrollMode=this.data.sM}onChangeScrollDirection(){this.data.sD=="horizontal"?this.scrollbarState=this.scrollbarStateVertical:this.scrollbarState=this.scrollbarStateHorizontal,this.scrollbarState.onResize()}addCustomStyles(){let e=document.createElement("style");e.textContent=`
1
+ var U=class{constructor(t=.1,e){this.SETTLE_THRESHOLD=.1;this.smoothingFactor=t,this.context=e,this.onSettingsChange()}onMouseMove(t){this.context.data.cursor.targetX=t.clientX,this.context.data.cursor.targetY=t.clientY}onFrame(){let{targetX:t,targetY:e,smoothedX:r,smoothedY:i}=this.context.data.cursor,o=this.context.tools.lerp.process({from:r,to:t,progress:this.smoothingFactor}),s=this.context.tools.lerp.process({from:i,to:e,progress:this.smoothingFactor}),n=this.getStepDistance(o,s);this.isSettled(n)?this.snapToTarget():this.applyStep(o,s)}onSettingsChange(){let t=Number(this.context.settings.lerp);this.setLerpFactor(t)}setLerpFactor(t){this.smoothingFactor=this.context.tools.adaptiveLerp.process({value:t,inMin:.1,inMax:1,outMin:.05,outMax:.65})}getStepDistance(t,e){return Math.hypot(t,e)}isSettled(t){return t<this.SETTLE_THRESHOLD}snapToTarget(){this.context.data.cursor.smoothedX=this.context.data.cursor.targetX,this.context.data.cursor.smoothedY=this.context.data.cursor.targetY,this.context.data.cursor.stepX=0,this.context.data.cursor.stepY=0}applyStep(t,e){this.context.data.cursor.smoothedX+=t,this.context.data.cursor.smoothedY+=e,this.context.data.cursor.stepX=t,this.context.data.cursor.stepY=e}};var w=class{constructor(){this.listeners={}}on(t,e,r){let i=r?`${t}_${r}`:t;this.listeners[i]||(this.listeners[i]=new Set),this.listeners[i].add(e)}off(t,e,r){let i=r?`${t}_${r}`:t;this.listeners[i]&&this.listeners[i].delete(e)}emit(t,e){let r=this.listeners[t];if(r)for(let i of r)i(e)}onProgress(t,e){this.on(`progress:${t}`,e)}emitProgress(t,e){this.emit(`progress:${t}`,e)}onInview(t,e){this.on(`object:inview:${t}`,e)}emitInview(t,e){this.emit(`object:inview${t}`,e)}onScroll(t){this.on("scroll",t)}emitScroll(t){this.emit("scroll",t)}onUpdate(t){this.on("update",t)}emitUpdate(){this.emit("update")}clear(t){delete this.listeners[t]}clearAll(){this.listeners={}}};var X=class{constructor(t){this.data=t;this.modules=[];this.uiModules=[]}register(t){t.type===1&&this.modules.push(t),t.type===2&&this.uiModules.push(t)}find(t){return this.modules.find(e=>e instanceof t)}onInit(){[...this.modules,...this.uiModules].forEach(t=>t.onInit())}onFrame(){[...this.modules,...this.uiModules].forEach(t=>t.onFrame(this.data))}onScroll(){[...this.modules,...this.uiModules].forEach(t=>t.onScroll(this.data))}onResize(){[...this.modules,...this.uiModules].forEach(t=>t.onResize())}onMouseMove(t){[...this.modules,...this.uiModules].forEach(e=>e.onMouseMove(t))}onWheel(t){[...this.modules,...this.uiModules].forEach(e=>e.onWheel(t))}onDirectionChange(){[...this.modules,...this.uiModules].forEach(t=>t.onDirectionChange())}onScrollStart(){[...this.modules,...this.uiModules].forEach(t=>t.onScrollStart())}onScrollStop(){[...this.modules,...this.uiModules].forEach(t=>t.onScrollStop())}onAxisChange(){[...this.modules,...this.uiModules].forEach(t=>t.onAxisChange())}onDeviceChange(){[...this.modules,...this.uiModules].forEach(t=>t.onDeviceChange())}onScrollConfigChange(){[...this.modules,...this.uiModules].forEach(t=>t.onScrollConfigChange())}onSettingsChange(){[...this.modules,...this.uiModules].forEach(t=>t.onSettingsChange())}onDOMMutate(t,e){[...this.modules,...this.uiModules].forEach(r=>r.onDOMMutate(t,e))}destroy(){[...this.modules,...this.uiModules].forEach(t=>t.destroy()),this.modules=[],this.uiModules=[]}get all(){return[...this.modules,...this.uiModules]}get core(){return this.modules}get ui(){return this.uiModules}};var P=class{constructor(t,e){this.id="";this.keys=[];this.connects=[];this.properties=new Map;this.modules=[];this.events=new w;this.htmlElement=e,this.id=t}setProperty(t,e){this.properties.set(t,e)}getProperty(t){return this.properties.get(t)??null}enter(){this.events.emit("enter",this),this.setProperty("active",!0),this.modules.forEach(t=>{t.enterObject(this.id,this)})}leave(){this.events.emit("leave",this),this.setProperty("active",!1),this.modules.forEach(t=>{t.exitObject(this.id)})}show(){this.htmlElement.classList.add("-inview")}hide(){this.getProperty("repeat")&&this.htmlElement.classList.remove("-inview")}connect(t){this.modules.includes(t)||this.modules.push(t)}};var _=class{constructor(t,e,r){this.data=t;this.modules=e;this.events=r;this.objects=new Map;this.connectQueue=[];this.globalId=1}get all(){return this.objects}add(t){let e=t.getAttribute("string-id")??`string-${this.globalId++}`,r=e&&this.objects.has(e)?this.objects.get(e):new P(e,t);t.setAttribute("string-id",r.id);let i=t.getAttribute("string")??t.getAttribute("data-string");i&&(r.keys=(i??"").split("|")),t.setAttribute("string-inited",""),this.objects.set(r.id,r);let o=this.getAllAttributes(t);this.modules.core.forEach(n=>{"setupCoreProperties"in n&&typeof n.setupCoreProperties=="function"&&n.setupCoreProperties(r,t,o)}),this.modules.core.forEach(n=>{n.canConnect(r)&&(n.initializeObject(this.globalId,r,t,o),n.calculatePositions(r,this.data.viewport.windowHeight),n.connectObject(r))}),this.connectQueue.filter(n=>n.id===r.id).forEach(n=>r.connects.push(n.element)),this.connectQueue=this.connectQueue.filter(n=>n.id!==r.id),this.initObservers(r,t)}remove(t){let e=this.objects.get(t);e&&(e.events.clearAll(),e.getProperty("observer-progress")?.disconnect(),e.getProperty("observer-inview")?.disconnect(),e.htmlElement.removeAttribute("string-inited"),e.leave(),this.objects.delete(t))}enqueueConnection(t,e){this.connectQueue.push({id:t,element:e})}getAllAttributes(t){let e={};return Array.from(t.attributes).forEach(r=>{e[r.name]=r.value}),e}initObservers(t,e){let r=t.getProperty("offset-top")??0,i=t.getProperty("offset-bottom")??0,o=t.getProperty("inview-top")??0,s=t.getProperty("inview-bottom")??0;t.getProperty("observer-progress")?.disconnect(),t.getProperty("observer-inview")?.disconnect();let n=m=>{m.forEach(l=>{this.events.emit(`object:activate:${t.id}`,l.isIntersecting),l.isIntersecting?t.enter():t.leave()})},a=m=>{m.forEach(l=>{this.events.emit(`object:inview:${t.id}`,l.isIntersecting),l.isIntersecting?t.show():t.hide()})},p=new IntersectionObserver(n,{root:null,rootMargin:`${i+this.data.viewport.windowHeight}px 0px ${r+this.data.viewport.windowHeight}px 0px`,threshold:.001}),d=new IntersectionObserver(a,{root:null,rootMargin:`${i+o}px 0px ${r+s}px 0px`,threshold:.001});p.observe(e),d.observe(e),t.setProperty("observer-progress",p),t.setProperty("observer-inview",d)}observeDOM(){new MutationObserver(e=>{e.forEach(r=>{r.type==="childList"&&(r.removedNodes.forEach(i=>{if(i.nodeType!==Node.ELEMENT_NODE)return;let o=i;this.isFixed(o)||(o.hasAttribute("string")&&this.handleRemoved(o),o.querySelectorAll("[string],[data-string]").forEach(s=>{this.isFixed(s)||this.handleRemoved(s)}))}),r.addedNodes.forEach(i=>{if(i.nodeType!==Node.ELEMENT_NODE)return;let o=i;if(this.isFixed(o))return;o.hasAttribute("string")&&!o.hasAttribute("string-inited")&&this.add(o),o.querySelectorAll("[string]:not([string-inited]),[data-string]:not([string-inited])").forEach(n=>this.add(n));let s=o.getAttribute("string-copy-from")??o.getAttribute("data-string-copy-from");s&&(this.objects.has(s)?this.objects.get(s).connects.push(o):this.enqueueConnection(s,o))}),this.modules.all.forEach(i=>i.onDOMRebuild()))})}).observe(document.body,{childList:!0,subtree:!0})}handleRemoved(t){let e=t.getAttribute("string-id");if(!e)return;let r=t.getAttribute("string-copy-from")??t.getAttribute("data-string-copy-from");r&&(this.connectQueue=this.connectQueue.filter(i=>i.id!==r)),this.remove(e)}onSettingsChange(){this.objects.forEach(t=>{this.modules.core.forEach(e=>{if(e.canConnect(t)){let r=this.getAllAttributes(t.htmlElement);e.initializeObject(this.globalId,t,t.htmlElement,r),e.calculatePositions(t,this.data.viewport.windowHeight),e.connectObject(t)}})})}isFixed(t){return t.hasAttribute("string-fixed")}};var M=class{constructor(t){this.name="";this.isProg=!1;this.isParallaxEnabled=!1;this._scrollDirection="vertical";this.onChangeDirection=()=>{};this.onScrollStart=()=>{};this.onScrollStop=()=>{};this.onCalcUpdate=()=>{this.context.data.scroll.scrollContainer?.scrollTo(0,this.context.data.scroll.current)};this.document=document,this.context=t}set scrollDirection(t){this._scrollDirection=t,this._scrollDirection==="vertical"?this.onCalcUpdate=()=>{this.context.data.scroll.scrollContainer?.scrollTo(0,this.context.data.scroll.current)}:this._scrollDirection==="horizontal"&&(this.onCalcUpdate=()=>{this.context.data.scroll.scrollContainer?.scrollTo(this.context.data.scroll.current,0)})}onFrame(){}onWheel(t){}onScroll(t){}disableScrollEvents(){}enableScrollEvents(){}};var K=class extends M{constructor(e){super(e);this.name="default"}onFrame(){if(this.context.data.scroll.delta!==0){let e=this.context.data.scroll.delta*this.context.data.scroll.speedAccelerate;this.context.data.scroll.delta-=e,this.context.data.scroll.lerped=e,Math.abs(this.context.data.scroll.lerped)<.1&&(this.context.data.scroll.delta=0,this.context.data.scroll.lerped=0,this.onScrollStop())}}onScroll(e){let r=this.context.data.scroll.elementContainer.scrollTop;this.context.data.scroll.current=r,this.context.data.scroll.target=r,this.context.data.scroll.transformedCurrent=r}onWheel(e){if(e.deltaY!==0){this.context.data.scroll.delta===0&&this.onScrollStart();let r=e.deltaY;this.context.data.scroll.target===0&&(this.context.data.scroll.delta+=Math.max(0,e.deltaY)),this.context.data.scroll.delta+=r}}};var Q=class extends M{constructor(e){super(e);this.name="disable";this.preventScroll=e=>{e.preventDefault()};this.preventKeyScroll=e=>{["ArrowUp","ArrowDown","PageUp","PageDown"," ","Home","End"].includes(e.key)&&e.preventDefault()};this.onPreventScroll=this.preventScroll.bind(this);this.onPreventKeyScroll=this.preventKeyScroll.bind(this)}disableScrollEvents(){window.addEventListener("touchmove",this.onPreventScroll,{passive:!1}),window.addEventListener("keydown",this.onPreventKeyScroll)}enableScrollEvents(){window.removeEventListener("touchmove",this.onPreventScroll),window.removeEventListener("keydown",this.onPreventKeyScroll)}onFrame(){}onWheel(e){e.preventDefault()}onScroll(e){e.preventDefault()}};var j={SCROLL_FORWARD:"-scroll-forward",SCROLL_BACK:"-scroll-back"},G=class extends M{constructor(e){super(e);this.name="smooth";this.isScrollbarManipulation=!1;this.scrollForce=0;this.wheelImpulse=0;this.previousCurrent=0;this.isBottomScrollDirection=null;this.velocityThreshold=.1}updateScrollDirection(e){if(this.isBottomScrollDirection===null){this.isBottomScrollDirection=e;return}this.context.data.scroll.isScrollingDown=e,this.onChangeDirection(),document.documentElement.classList.toggle(j.SCROLL_FORWARD,e),document.documentElement.classList.toggle(j.SCROLL_BACK,!e)}stopScroll(){this.context.data.scroll.lerped=0,this.context.data.scroll.delta=0,this.context.data.scroll.target=this.context.data.scroll.current,this.isProg=!1,this.onCalcUpdate(),document.documentElement.classList.remove(j.SCROLL_BACK,j.SCROLL_FORWARD),this.isBottomScrollDirection=null}onFrame(){if(this.isScrollbarManipulation){this.isScrollbarManipulation=!1,this.context.data.scroll.current=this.context.data.scroll.elementContainer.scrollTop,this.context.data.scroll.target=this.context.data.scroll.elementContainer.scrollTop,this.context.data.scroll.transformedCurrent=this.context.data.scroll.current*this.context.data.viewport.transformScale;return}if(this.context.data.scroll.delta!==0){this.scrollForce=this.context.data.scroll.delta*this.context.data.scroll.speedAccelerate,this.context.data.scroll.target=Math.min(Math.max(0,this.context.data.scroll.target+this.scrollForce),this.context.data.scroll.bottomPosition),this.context.data.scroll.delta-=this.scrollForce,this.context.data.scroll.lerped=(this.context.data.scroll.target-this.context.data.scroll.current)*this.context.data.scroll.speed;let e=Math.abs(this.context.data.scroll.lerped);this.context.data.scroll.lerped>0?this.context.data.scroll.current=Math.ceil(this.context.data.scroll.current+this.context.data.scroll.lerped):this.context.data.scroll.current=Math.floor(this.context.data.scroll.current+this.context.data.scroll.lerped),this.context.data.scroll.transformedCurrent=this.context.data.scroll.current*this.context.data.viewport.transformScale,this.updateScrollDirection(this.context.data.scroll.lerped>0),e<this.velocityThreshold?(this.stopScroll(),this.onScrollStop()):(this.isProg=!0,this.previousCurrent!==this.context.data.scroll.current&&(this.previousCurrent=this.context.data.scroll.current,this.onCalcUpdate()))}}onWheel(e){if(e.deltaY!==0&&e.preventDefault(),this.wheelImpulse=e.deltaY,this.wheelImpulse===0)return;this.context.data.scroll.delta===0&&this.onScrollStart();let r=Math.sign(this.wheelImpulse),i=this.context.data.scroll.target===0&&r<0,o=this.context.data.scroll.target===this.context.data.scroll.bottomPosition&&r>0;i||o||(this.context.data.scroll.delta+=this.wheelImpulse)}onScroll(e){this.isProg||(this.isScrollbarManipulation=!0)}};var J=class{constructor(t){this.context=t;this.modes=new Map;this.modes.set("smooth",new G(t)),this.modes.set("default",new K(t)),this.modes.set("disable",new Q(t)),this.updateResponsiveMode()}setMobileMode(t){this.context.data.scroll.modeMobile=t,this.updateResponsiveMode()}setDesktopMode(t){this.context.data.scroll.modeDesktop=t,this.updateResponsiveMode()}updateResponsiveMode(){let e=window.innerWidth<1080?this.context.data.scroll.modeMobile:this.context.data.scroll.modeDesktop;this.setMode(e)}updatePosition(){this.modes.forEach(t=>{t.onCalcUpdate()})}setMode(t){if(!this.modes.has(t)){console.warn(`[ScrollManager] Unknown scroll mode: ${t}`);return}this.get().enableScrollEvents(),this.context.data.scroll.mode=t,this.get().disableScrollEvents()}get(){return this.modes.get(this.context.data.scroll.mode)}getEngines(){return this.modes}onFrame(){this.get().onFrame()}onScroll(t){this.get().onScroll(t)}onWheel(t){this.get().onWheel(t)}bindEvents(t){this.modes.forEach(e=>{e.onScrollStart=t.onScrollStart,e.onScrollStop=t.onScrollStop,e.onChangeDirection=t.onDirectionChange})}};var Z=class{constructor(){this.targetX=0;this.targetY=0;this.smoothedX=0;this.smoothedY=0;this.stepX=0;this.stepY=0}};var tt=class{constructor(){this.threeInstance=null}};var et=class{constructor(){this.target=0;this.current=0;this.transformedCurrent=0;this.delta=0;this.lerped=0;this.displacement=0;this.isScrollingDown=!1;this.topPosition=0;this.bottomPosition=0;this.direction="vertical";this.elementContainer=document.documentElement;this.scrollContainer=window;this.container=document.body;this.mode="smooth";this.modeMobile="smooth";this.modeDesktop="smooth";this.speed=.1;this.speedAccelerate=.25}};var rt=class{constructor(){this.now=0;this.previous=0;this.delta=0;this.elapsed=0}};var it=class{constructor(){this.windowWidth=0;this.windowHeight=0;this.contentWidth=0;this.contentHeight=0;this.scaleWidth=1;this.scaleHeight=1;this.transformScale=1;this.baseRem=16}};var ot=class{constructor(){this.scroll=new et;this.viewport=new it;this.cursor=new Z;this.render=new tt;this.time=new rt}};var h=class{constructor(t){this.objectMap=new Map;this.objects=[];this.htmlKey="";this._type=1;this.tools=t.tools,this.data=t.data,this.settings=t.settings,this.events=t.events,this.attributesToMap=[{key:"active",type:"boolean",fallback:this.settings.active},{key:"fixed",type:"boolean",fallback:this.settings.fixed},{key:"repeat",type:"boolean",fallback:this.settings.repeat},{key:"self-disable",type:"boolean",fallback:this.settings["self-disable"]},{key:"abs",type:"boolean",fallback:this.settings.abs},{key:"key",type:"string",fallback:this.settings.key},{key:"offset-top",type:"dimension",fallback:this.settings["offset-top"]},{key:"offset-bottom",type:"dimension",fallback:this.settings["offset-bottom"]},{key:"inview-top",type:"dimension",fallback:this.settings["inview-top"]},{key:"inview-bottom",type:"dimension",fallback:this.settings["inview-bottom"]},{key:"start",type:"number",fallback:(e,r,i)=>{let o=i.top;return Math.floor(o)+this.data.scroll.container.scrollTop*this.data.viewport.transformScale}},{key:"end",type:"number",fallback:(e,r,i)=>{let o=i.top,s=i.height;return o+s-this.data.scroll.transformedCurrent}},{key:"size",type:"number",fallback:(e,r,i)=>i.height},{key:"half-width",type:"number",fallback:(e,r,i)=>i.width/2},{key:"half-height",type:"number",fallback:(e,r,i)=>i.height/2}]}get type(){return this._type}initializeObject(t,e,r,i){let o=this.tools.boundingClientRect.process({element:r});for(let{key:s,type:n,fallback:a,transform:p}of this.attributesToMap){let d=typeof a=="function"?a(r,e,o):a,m=this.tools.domAttribute.process({element:r,key:s,fallback:i[s]??this.settings[s]??d}),l=this.parseAttribute(m,n,{element:r,viewportHeight:this.data.viewport.windowHeight,baseRem:this.data.viewport.baseRem});p&&(l=p(l)),e.setProperty(s,l)}}calculatePositions(t,e){}parseAttribute(t,e,r={}){if(t==null)return null;if(typeof e=="object"&&e.type==="enum")return e.values.includes(t)?t:e.values[0];switch(e){case"number":return parseFloat(t);case"boolean":return t===""||t==="true";case"json":try{return JSON.parse(t)}catch{return null}case"tuple":return t.trim().split(/\s+/);case"easing":return this.tools.easingFunction.process({easing:t});case"color":return this.tools.colorParser.process({value:t});case"dimension":return t=="0"?0:r.element!=null&&r.viewportHeight!=null&&r.baseRem!=null?this.tools.unitParser.process({value:t,element:r.element,viewportHeight:r.viewportHeight,baseRem:r.baseRem}):0;default:return t}}canConnect(t){return t.keys.includes(this.htmlKey)}connectObject(t){t.connect(this),this.onObjectConnected(t)}enterObject(t,e){this.objectMap.has(t)||(this.objectMap.set(t,e),this.objects.push(e))}exitObject(t){let e=this.objectMap.get(t);if(!e)return;this.objectMap.delete(t);let r=this.objects.indexOf(e);r!==-1&&this.objects.splice(r,1)}onObjectConnected(t){}applyToElementAndConnects(t,e){e(t.htmlElement),t.connects.forEach(e)}destroy(){this.objects=[],this.objectMap=new Map}onInit(){}onFrame(t){}onResize(){}onScroll(t){}onDirectionChange(){}onScrollStart(){}onScrollStop(){}onScrollDirectionChange(){}onAxisChange(){}onDeviceChange(){}onScrollConfigChange(){}onSettingsChange(){}onDOMRebuild(){}onMouseMove(t){}onWheel(t){}onDOMMutate(t,e){}};var I=class{process({element:t}){return t.getBoundingClientRect()}};var L=class{process({element:t,key:e,fallback:r=null}){return t.getAttribute(`string-${e}`)??t.getAttribute(`data-string-${e}`)??r}};var O=class{process({record:t,name:e,fallback:r=null}){return t[e]??t[`data-${e}`]??r}};var E=class{process({element:t}){let e=t.getBoundingClientRect(),i=getComputedStyle(t).transform.match(/-?[\d.]+/g)?.map(parseFloat)??[];if(i.length===6){let[o,s,n,a,p,d]=i,m=o*a-s*n;return{width:e.width/(o||1),height:e.height/(a||1),left:(e.left*a-e.top*n+n*d-p*a)/m,top:(-e.left*s+e.top*o+p*s-o*d)/m}}return e}};var D=class{constructor(t=new E){this.transformTool=t}process({element:t,container:e=document.body}){let r;try{r=e.getBoundingClientRect()}catch{r=document.body.getBoundingClientRect()}let i=this.transformTool.process({element:t});return{top:i.top-r.top,left:i.left-r.left}}};var k=class{process({from:t,to:e,progress:r}){return(e-t)*r}};var R=class{process({value:t,element:e,viewportHeight:r,baseRem:i}){let o=t.startsWith("-");o&&(t=t.slice(1));let s=0;return t==="selfHeight"?s=e.offsetHeight:t.endsWith("px")?s=parseFloat(t):t.endsWith("%")?s=parseFloat(t)/100*r:t.endsWith("rem")&&(s=parseFloat(t)*i),o?-s:s}};var A=class{process({value:t,inMin:e=.1,inMax:r=1,outMin:i=.05,outMax:o=.65}){if(t<e)return o;if(t>1&&(t=1),t<=r){let s=(t-e)/(r-e);return o-s*(o-i)}return i}};var H=class{process({value:t}){let e=t.trim();if(e.startsWith("random(")&&e.endsWith(")")){let r=e.slice(7,-1).split(",").map(o=>o.trim()).filter(Boolean),i=Math.floor(Math.random()*r.length);return r[i]}return e}};var F=class{process({value:t}){let e=t.trim().toLowerCase();if(e.startsWith("#")){let o=e.slice(1);o.length===3&&(o=o.split("").map(d=>d+d).join(""));let s=parseInt(o.slice(0,2),16),n=parseInt(o.slice(2,4),16),a=parseInt(o.slice(4,6),16),p=o.length===8?parseInt(o.slice(6,8),16)/255:1;return{r:s,g:n,b:a,a:p}}let r=e.match(/rgba?\(([^)]+)\)/);if(r){let[o,s,n,a=1]=r[1].split(",").map(p=>parseFloat(p.trim()));return{r:o,g:s,b:n,a}}let i=e.match(/hsla?\(([^)]+)\)/);if(i){let[o,s,n,a="1"]=i[1].split(",").map(l=>l.trim()),[p,d,m]=this.hslToRgb(parseFloat(o),parseFloat(s),parseFloat(n));return{r:p,g:d,b:m,a:parseFloat(a)}}return{r:0,g:0,b:0,a:0}}hslToRgb(t,e,r){t=t/360,e=parseFloat(e.toString())/100,r=parseFloat(r.toString())/100;let i=(d,m,l)=>(l<0&&(l+=1),l>1&&(l-=1),l<1/6?d+(m-d)*6*l:l<1/2?m:l<2/3?d+(m-d)*(2/3-l)*6:d),o=r<.5?r*(1+e):r+e-r*e,s=2*r-o,n=Math.round(i(s,o,t+1/3)*255),a=Math.round(i(s,o,t)*255),p=Math.round(i(s,o,t-1/3)*255);return[n,a,p]}};var W=class{process({value:t,rules:e,messages:r={}}){for(let i of e){let o=null;if(i==="required"&&t.trim()===""?o="required":i==="email"&&!/^\S+@\S+\.\S+$/.test(t)?o="invalid-email":typeof i=="object"&&(i.type==="minLength"&&t.length<i.value&&(o="too-short"),i.type==="maxLength"&&t.length>i.value&&(o="too-long")),o){let s=r[o],n=typeof s=="function"?s({value:t,rule:i}):s??this.defaultMessage(o,i);return{valid:!1,error:o,message:n}}}return{valid:!0,error:null,message:null}}defaultMessage(t,e){switch(t){case"required":return"This field is required.";case"invalid-email":return"Please enter a valid email.";case"too-short":return`Too short${typeof e=="object"&&"value"in e?` (min ${e.value})`:""}.`;case"too-long":return`Too long${typeof e=="object"&&"value"in e?` (max ${e.value})`:""}.`}}};var V=class{constructor(){this.namedCurves={linear:[0,0,1,1],ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]}}process({easing:t}){let e=t.trim();if(this.namedCurves[e])return this.cubicBezier(...this.namedCurves[e]);let r=e.match(/^cubic-bezier\s*\(\s*([-+]?\d*\.?\d+)\s*,\s*([-+]?\d*\.?\d+)\s*,\s*([-+]?\d*\.?\d+)\s*,\s*([-+]?\d*\.?\d+)\s*\)$/);if(r){let[i,o,s,n]=r.slice(1).map(Number);return this.cubicBezier(i,o,s,n)}return i=>i}cubicBezier(t,e,r,i){let o=3*t,s=3*(r-t)-o,n=1-o-s,a=3*e,p=3*(i-e)-a,d=1-a-p;function m(u){return((n*u+s)*u+o)*u}function l(u){return((d*u+p)*u+a)*u}function g(u){return(3*n*u+2*s)*u+o}function b(u,S=1e-5){let y,f,v=u,x,Y,T;for(T=0;T<8;T++){if(x=m(v)-u,Math.abs(x)<S)return v;if(Y=g(v),Math.abs(Y)<1e-6)break;v=v-x/Y}for(y=0,f=1,v=u;y<f;){if(x=m(v)-u,Math.abs(x)<S)return v;x>0?f=v:y=v,v=(f+y)/2}return v}return function(u){return l(b(u))}}};var z=class{process({distance:t,radius:e,strength:r}){if(t>=e)return 0;let i=(e-t)/e;return r*i}};var B=class{process({from:t,to:e,progress:r}){return{r:t.r+(e.r-t.r)*r,g:t.g+(e.g-t.g)*r,b:t.b+(e.b-t.b)*r,a:t.a+(e.a-t.a)*r}}};var q=class{process({from:t,to:e,progress:r}){return{x:(e.x-t.x)*r,y:(e.y-t.y)*r}}};var N=class{process({value:t}){let r=t?.trim();if(!r||r==="none")return 1;try{if(r.startsWith("matrix(")){let i=r.match(/matrix\(([^)]+)\)/);if(i&&i[1]){let o=i[1].split(",").map(s=>parseFloat(s.trim()));if(o.length>=1&&!isNaN(o[0]))return o[0]}}if(r.startsWith("scale(")){let i=r.match(/scale\(([^)]+)\)/);if(i&&i[1]){let o=i[1].split(",").map(s=>parseFloat(s.trim()));if(o.length>=1&&!isNaN(o[0]))return o[0]}}if(r.startsWith("scaleX(")){let i=r.match(/scaleX\(([^)]+)\)/);if(i&&i[1]){let o=parseFloat(i[1].trim());if(!isNaN(o))return o}}if(r.startsWith("scale3d(")){let i=r.match(/scale3d\(([^)]+)\)/);if(i&&i[1]){let o=i[1].split(",").map(s=>parseFloat(s.trim()));if(o.length>=1&&!isNaN(o[0]))return o[0]}}if(r.startsWith("matrix3d(")){let i=r.match(/matrix3d\(([^)]+)\)/);if(i&&i[1]){let o=i[1].split(",").map(s=>parseFloat(s.trim()));if(o.length>=1&&!isNaN(o[0]))return o[0]}}}catch(i){return console.error(`Error parsing transform string "${r}":`,i),1}return 1}};var nt=class{process({processedWords:t,lines:e,options:r,totalChars:i}){let o=[],s=0,n=new Map;e.forEach((d,m)=>{let l=d.words.reduce((g,b)=>g+b.text.length,0);n.set(m,l)});let a=0,p=-1;return t.forEach(d=>{let m=d.text,l=d.lineIndex,g=m.length,b=n.get(l)||0;l!==p&&(a=0,p=l),Array.from(m).forEach((S,y)=>{let f=[];r.char&&r.char.forEach(v=>{let x=this.calculateIndex(v,s,y,i);f.push({value:x,type:"char",align:v.align})}),r.charLine&&r.charLine.forEach(v=>{let x=this.calculateIndex(v,a,y,b);f.push({value:x,type:"charLine",align:v.align})}),r.charWord&&r.charWord.forEach(v=>{let x=this.calculateIndex(v,y,y,g);f.push({value:x,type:"charWord",align:v.align})}),o.push({text:S,globalCharIndex:s,lineCharIndex:a,wordCharIndex:y,parentGlobalWordIndex:d.globalIndex,parentLineIndex:d.lineIndex,parentWordIndexInLine:d.wordIndexInLine,calculatedValues:f}),s++,a++})}),o}calculateIndex(t,e,r,i){let o=e;if(t.align==="random"){let s=t.random?.min??0,n=t.random?.max??(i>0?i-1:0),a=Math.min(s,n),p=Math.max(s,n);o=Math.floor(Math.random()*(p-a+1))+a}else t.align==="end"?o=(i>0?i-1:0)-e:t.align==="center"&&(o=e-Math.floor(i/2));return t.abs&&(o=Math.abs(o)),o}};var st=class{process({text:t,targetElement:e}){if(!t||!e||e.offsetWidth<=0)return console.warn("LayoutLineSplitterTool: Invalid input or target element has zero width."),[];let i=this.decodeHtmlEntity(t).trim().split(/\s+/).filter(l=>l.length>0);if(i.length===0)return[];let o=document.createElement("span"),s=window.getComputedStyle(e);o.style.fontFamily=s.fontFamily,o.style.fontSize=s.fontSize,o.style.fontWeight=s.fontWeight,o.style.letterSpacing=s.letterSpacing,o.style.textTransform=s.textTransform,o.style.wordSpacing=s.wordSpacing,o.style.whiteSpace="nowrap",o.style.visibility="hidden",o.style.position="absolute",o.style.top="-9999px",o.style.left="-9999px",document.body.appendChild(o);let n=[],a=[],p=0,d=this.measureWidth(" ",o),m=e.offsetWidth;try{i.forEach(l=>{let g=this.measureWidth(l,o),b=p+(a.length>0?d:0)+g;a.length>0&&b>m?(n.push({text:a.join(" "),words:a.map(u=>({text:u}))}),a=[l],p=g):(a.push(l),p=a.length===1?g:b)}),a.length>0&&n.push({text:a.join(" "),words:a.map(l=>({text:l}))})}finally{o.parentNode===document.body&&document.body.removeChild(o)}return n}measureWidth(t,e){return e.textContent=t,e.offsetWidth}decodeHtmlEntity(t){return t.replace(/&amp;/g,"&")}};var at=class{process({lines:t,words:e,chars:r,options:i}){let o=document.createElement("div"),s=0,n=0,a=this.hasLineOptions(i),p=this.hasCharOptions(i);return t.forEach(d=>{let m=a?document.createElement("span"):o;a&&(m.classList.add("-s-line"),o.appendChild(m));let l=e.slice(s,s+d.words.length);s+=d.words.length,l.forEach((g,b)=>{let u=document.createElement("span");u.classList.add("-s-word");let S=r.slice(n,n+g.text.length);p&&g.text.length>0?(S.forEach(y=>{let f=document.createElement("span");f.classList.add("-s-char"),f.textContent=y.text,this.applyStyles(f,y.calculatedValues),u.appendChild(f)}),n+=g.text.length):(u.textContent=g.text,n+=g.text.length),this.applyStyles(u,g.calculatedValues),m.appendChild(u),b<l.length-1&&m.appendChild(document.createTextNode("\xA0"))})}),o.innerHTML}hasLineOptions(t){return(t.line?.length??0)>0||(t.wordLine?.length??0)>0||(t.charLine?.length??0)>0}hasCharOptions(t){return(t.char?.length??0)>0||(t.charLine?.length??0)>0||(t.charWord?.length??0)>0}applyStyles(t,e){e&&e.forEach(r=>{let i=this.generateVariableName(r.type,r.align);t.style.setProperty(i,String(r.value))})}generateVariableName(t,e){return`--${t}-${e}`}};var lt=class{process({lines:t,options:e}){let r=[],i=0,o=t.reduce((s,n)=>s+n.words.length,0);return t.forEach((s,n)=>{let a=s.words,p=a.length;a.forEach((d,m)=>{let l=[];e.word&&e.word.forEach(g=>{let b=this.calculateIndex(g,i,m,o);l.push({value:b,type:"word",align:g.align})}),e.wordLine&&e.wordLine.forEach(g=>{let b=this.calculateIndex(g,m,m,p);l.push({value:b,type:"wordLine",align:g.align})}),r.push({text:d.text,globalIndex:i,lineIndex:n,wordIndexInLine:m,calculatedValues:l}),i++})}),r}calculateIndex(t,e,r,i){let o=e;if(t.align==="random"){let s=t.random?.min??0,n=t.random?.max??(i>0?i-1:0),a=Math.min(s,n),p=Math.max(s,n);o=Math.floor(Math.random()*(p-a+1))+a}else t.align==="end"?o=(i>0?i-1:0)-e:t.align==="center"&&(o=e-Math.floor(i/2));return t.abs&&(o=Math.abs(o)),o}};var ct=class{process({attributeValue:t}){let e={line:[],word:[],char:[],charLine:[],charWord:[],wordLine:[]};return t&&t.split("|").forEach(i=>{let o=i.trim();if(!o)return;let s=o.match(/^(\w+-)?(\w+)(\[(.*?)\])?$/);if(s){let n=s[1]||"",a=s[2],p=n+a,m=(s[4]||"").split(";").map(g=>g.trim()).filter(g=>g.length>0),l=this.parseParamsArray(m);switch(p){case"line":e.line.push(l);break;case"word":e.word.push(l);break;case"char":e.char.push(l);break;case"charLine":e.charLine.push(l);break;case"charWord":e.charWord.push(l);break;case"wordLine":e.wordLine.push(l);break;default:console.warn(`SplitOptionsParserTool: Unrecognized option type "${p}" in part "${o}"`);break}}else console.warn(`SplitOptionsParserTool: Could not parse part format "${o}"`)}),e}parseParamsArray(t){let e={align:"start"};return t.forEach(r=>{if(r==="abs")e.abs=!0;else if(r.startsWith("random")){e.align="random";let i=r.match(/random\(\s*(\d+)\s*,\s*(\d+)\s*\)/);i&&(e.random={min:parseInt(i[1],10),max:parseInt(i[2],10)})}else["start","center","end"].includes(r)&&(e.align=r)}),e}};var pt=class{constructor(){this.domAttribute=new L;this.recordAttribute=new O;this.transformNullify=new E;this.boundingClientRect=new I;this.relativePosition=new D(this.transformNullify);this.unitParser=new R;this.lerp=new k;this.adaptiveLerp=new A;this.originParser=new H;this.colorParser=new F;this.validation=new W;this.easingFunction=new V;this.magneticPull=new z;this.lerpColor=new B;this.lerpVector=new q;this.transformScaleParser=new N;this.layoutSplitter=new st;this.wordIndexer=new lt;this.charIndexer=new nt;this.domBuilder=new at;this.optionsParser=new ct}};var yt=class extends h{constructor(e){super(e);this.enterObjectsMap=new Map;this.enterObjects=new Array;this.overCount=0;this.htmlKey="cursor",this.cursor=document.querySelector("[string-cursor],[data-string-cursor]"),this.cursorContent=document.querySelector("[string-cursor-content],[data-string-cursor-content]"),this.attributesToMap=[...this.attributesToMap,{key:"target-disable",type:"boolean",fallback:this.settings["target-disable"]},{key:"target-style-disable",type:"boolean",fallback:this.settings["target-style-disable"]},{key:"target-class",type:"string",fallback:this.settings["target-class"]},{key:"cursor-class",type:"string",fallback:this.settings["cursor-class"]},{key:"alignment",type:{type:"enum",values:["start","center","end"]},fallback:this.settings.alignment},{key:"lerp",type:"number",fallback:this.settings.lerp,transform:r=>this.tools.adaptiveLerp.process({value:r,inMin:.1,inMax:1,outMin:.05,outMax:.65})}]}initializeObject(e,r,i,o){super.initializeObject(e,r,i,o),r.setProperty("mouse-x",0),r.setProperty("mouse-y",0),r.setProperty("mouse-pixel-x",0),r.setProperty("mouse-pixel-y",0),r.setProperty("is-mouse-over",!1),r.setProperty("is-mouse-move",!1)}onFrame(e){requestAnimationFrame(()=>{this.objects.forEach(n=>{let a=n.getProperty("is-mouse-over"),p=n.getProperty("cursor-target-disable"),d=n.getProperty("lerp")??.15;if(a&&!p){let m=n.htmlElement.getBoundingClientRect(),l=this.data.cursor.targetX,g=this.data.cursor.targetY,b=l-m.left,u=g-m.top,S=n.getProperty("mouse-pixel-x")??0,y=n.getProperty("mouse-pixel-y")??0,f=S-b,v=y-u;if(f*f+v*v>1e-4){(n.getProperty("is-mouse-move")??!1)||(n.setProperty("is-mouse-move",!0),n.setProperty("mouse-pixel-x",b),n.setProperty("mouse-pixel-y",u),n.setProperty("mouse-x",b),n.setProperty("mouse-y",u),S=b,y=u,this.events.emit(`cursor:start:${n.id}`,null));let T=this.tools.lerp.process({from:S,to:b,progress:d}),zt=this.tools.lerp.process({from:y,to:u,progress:d}),gt=S+T,vt=y+zt;n.setProperty("mouse-pixel-x",gt),n.setProperty("mouse-pixel-y",vt);let Ht=n.getProperty("alignment")??"center",bt=this.calculateOffset(Ht,gt,m.width),ft=this.calculateOffset(Ht,vt,m.height);n.setProperty("mouse-x",bt),n.setProperty("mouse-y",ft),this.setMouseCoordinates(n,bt,ft),this.events.emit(`cursor:move:${n.id}`,{x:bt,y:ft}),this.events.emit(`cursor:pixel:${n.id}`,{x:gt,y:vt})}else n.setProperty("mouse-pixel-x",b),n.setProperty("mouse-pixel-y",u),this.events.emit(`cursor:end:${n.id}`,null)}else{let m=n.getProperty("mouse-x")??0,l=n.getProperty("mouse-y")??0;if(m!==0||l!==0){n.setProperty("is-mouse-move",!1);let g=n.htmlElement.getBoundingClientRect(),b=n.getProperty("half-width")??g.width/2,u=n.getProperty("half-height")??g.height/2,S=this.calculateOffset("center",b,g.width),y=this.calculateOffset("center",u,g.height),f=m+this.tools.lerp.process({from:m,to:S,progress:d}),v=l+this.tools.lerp.process({from:l,to:y,progress:d});n.setProperty("mouse-x",f),n.setProperty("mouse-y",v),Math.abs(f)<.001&&Math.abs(v)<.001&&(n.setProperty("mouse-x",0),n.setProperty("mouse-y",0),n.setProperty("mouse-pixel-x",0),n.setProperty("mouse-pixel-y",0)),this.setMouseCoordinates(n,f,v)}}});let{stepX:r,stepY:i,smoothedX:o,smoothedY:s}=this.data.cursor;(r!==0||i!==0)&&(this.events.emit("cursor",{stepX:r,stepY:i,x:o,y:s}),this.cursor.style.setProperty("--x",o.toString()),this.cursor.style.setProperty("--y",s.toString()),this.cursor.style.setProperty("--x-lerp",r.toString()),this.cursor.style.setProperty("--y-lerp",i.toString()))})}onObjectConnected(e){let r=e.htmlElement;e.setProperty("timeoutId",null),e.setProperty("mouseleave",()=>{this.onMouseLeave(e)}),e.setProperty("mouseenter",()=>{this.onMouseEnter(e)}),e.setProperty("onEnterEvent",this.onEnterObject.bind(this)),e.events.on("enter",e.getProperty("onEnterEvent")),e.setProperty("onLeaveEvent",this.onLeaveObject.bind(this)),e.events.on("leave",e.getProperty("onLeaveEvent"))}getCursorClass(e){let r=e.getProperty("cursor-class");return r!=null&&r.length>0?r:null}onMouseEnter(e){this.overCount++,e.setProperty("is-mouse-over",!0);let r=this.getCursorClass(e);r&&this.cursor.classList.add(r),this.cursor.classList.add("-showing"),e.setProperty("timeoutId",setTimeout(()=>{this.cursor.classList.remove("-showing"),this.cursor.classList.add("-show")},1200)),e.htmlElement.addEventListener("mouseleave",e.getProperty("mouseleave"))}onMouseLeave(e){this.overCount--,e.setProperty("is-mouse-over",!1),e.getProperty("timeoutId")&&(clearTimeout(e.getProperty("timeoutId")),e.setProperty("timeoutId",null));let r=this.getCursorClass(e);r&&this.cursor.classList.remove(r),this.cursor.classList.remove("-showing"),this.cursor.classList.remove("-show"),e.htmlElement.removeEventListener("mouseleave",e.getProperty("mouseleave"))}onEnterObject(e){e.htmlElement.addEventListener("mouseenter",e.getProperty("mouseenter"))}onLeaveObject(e){e.htmlElement.removeEventListener("mouseenter",e.getProperty("mouseenter")),e.htmlElement.removeEventListener("mouseleave",e.getProperty("mouseleave"))}setMouseCoordinates(e,r,i){e.getProperty("cursor-target-style-disable")||this.applyToElementAndConnects(e,o=>{o.style.setProperty("--x",r.toFixed(2)),o.style.setProperty("--y",i.toFixed(2))})}calculateOffset(e,r,i){switch(e){case"start":return r/i;case"end":return(r-i)/i;case"center":default:return(r-i/2)/(i/2)}}};var St=class extends h{constructor(t){super(t),this.htmlKey="magnetic",this.attributesToMap=[...this.attributesToMap,{key:"strength",type:"number",fallback:this.settings.strength},{key:"radius",type:"number",fallback:this.settings.radius}]}initializeObject(t,e,r,i){super.initializeObject(t,e,r,i),e.setProperty("is-magneting",!1),e.setProperty("magnetic-target-x",0),e.setProperty("magnetic-target-y",0),e.setProperty("magnetic-x",0),e.setProperty("magnetic-y",0),e.setProperty("lerp",.1)}onMouseMove(t){this.objects.forEach(e=>{let i=e.htmlElement.getBoundingClientRect(),o=i.left+(e.getProperty("half-width")??0),s=i.top+(e.getProperty("half-height")??0),n=t.clientX-o,a=t.clientY-s,p=Math.sqrt(n**2+a**2),d=e.getProperty("radius")??0,m=e.getProperty("strength")??0,l=this.tools.magneticPull.process({distance:p,radius:d,strength:m});e.setProperty("magnetic-target-x",n*l),e.setProperty("magnetic-target-y",a*l),l>0&&e.setProperty("is-magneting",!0)})}onFrame(t){this.objects.forEach(e=>{if(e.getProperty("is-magneting")){let r=e.getProperty("magnetic-x")??0,i=e.getProperty("magnetic-y")??0,o=e.getProperty("lerp")??0,s=e.getProperty("magnetic-target-x")??0,n=e.getProperty("magnetic-target-y")??0,a=this.tools.lerp.process({from:r,to:s,progress:o}),p=this.tools.lerp.process({from:i,to:n,progress:o});a>-.01&&a<.01&&(a=0,e.setProperty("magnetic-x",e.getProperty("magnetic-target-x"))),p>-.01&&p<.01&&(p=0,e.setProperty("magnetic-y",e.getProperty("magnetic-target-y"))),r+=a,i+=p,e.setProperty("magnetic-x",r),e.setProperty("magnetic-y",i),this.events.emit(`magnetic:move:${e.id}`,{x:r,y:i}),this.applyToElementAndConnects(e,d=>{d.style.setProperty("--magnetic-x",r.toString()),d.style.setProperty("--magnetic-y",i.toString())}),(e.getProperty("magnetic-target-x")==r||e.getProperty("magnetic-target-y")==i)&&e.setProperty("is-magneting",!1)}})}};var xt=class extends h{constructor(e){super(e);this.isStartLoaded=!1;this.loadingCount=0;this.htmlKey="lazy"}onInit(){document.querySelectorAll("img[string-lazy], img[data-string-lazy]").forEach(r=>this.loadImage(r)),this.isStartLoaded=!0}onObjectConnected(e){if(this.loadingCount++,this.isStartLoaded){let r=e.htmlElement;this.loadImage(r)}}async loadImage(e){let r=this.tools.domAttribute.process({element:e,key:this.htmlKey,fallback:""});if(r)try{e.classList.add("lazyLoad"),e.src=r,e.addEventListener("load",()=>{e.classList.add("-loaded")}),await this.setAspectRatio(e,r)}catch{console.warn("Failed to load image:",r)}}setAspectRatio(e,r){return new Promise((i,o)=>{let s=new XMLHttpRequest;s.open("GET",r,!0),s.responseType="arraybuffer",s.setRequestHeader("Range","bytes=0-"),s.onload=()=>{if(s.status===200||s.status===206){let n=new Blob([s.response]),a=new Image;a.onload=()=>{e.style.aspectRatio=`${a.width} / ${a.height}`,URL.revokeObjectURL(a.src),this.loadingCount--,this.loadingCount<=0&&(this.events.emit("image:load:all",null),this.loadingCount=0),i()},a.onerror=()=>{URL.revokeObjectURL(a.src),this.loadingCount--,o(new Error("Image failed to decode"))},a.src=URL.createObjectURL(n)}else o(new Error("Image request failed"))},s.onerror=()=>o(new Error("XHR error")),s.send()})}};var Mt=class extends h{constructor(e){super(e);this.loadingTimeout=0;this._type=2,this.loadingTimeout=this.settings.timeout}onInit(){setTimeout(()=>{document.documentElement.classList.add("-loaded")},this.loadingTimeout)}};var dt=class extends h{constructor(t){super(t),this.htmlKey=""}canConnect(t){return t.keys[0]==null}};var C=class{constructor(t){this.min=void 0;this.max=void 0;this.enable=!0;this.min=t?.min,this.max=t?.max,this.enable=t?.enable??!0}setEnable(t=!0){this.enable=t}setRange(t,e){this.min=t??void 0,this.max=e??void 0}get mediaQuery(){let t="screen";return this.min&&(t+=` and (min-width: ${this.min}px)`),this.max&&(t+=` and (max-width: ${this.max}px)`),t}},Et=class extends h{constructor(e){super(e);this.queries={0:new C({max:359}),1:new C({min:360,max:1079}),2:new C({min:1080,max:1365}),3:new C({min:1366})};this.matchMedias={0:window.matchMedia(this.queries[0].mediaQuery),1:window.matchMedia(this.queries[1].mediaQuery),2:window.matchMedia(this.queries[2].mediaQuery),3:window.matchMedia(this.queries[3].mediaQuery)};this._type=2}onConnect(){}onInit(){if(this.settings!=null&&this.settings.settings!=null){let e=this.settings.settings;e.mobile?(this.queries[0].enable=!0,this.queries[0].setRange(e.mobile.min==null?null:e.mobile.min,e.mobile.max??null),this.matchMedias[0]=window.matchMedia(this.queries[0].mediaQuery)):this.queries[0].enable=!1,e.tablet?(this.queries[1].enable=!0,this.queries[1].setRange(e.mobile.min==null?null:e.mobile.min,e.mobile.max??null),this.matchMedias[1]=window.matchMedia(this.queries[0].mediaQuery)):this.queries[1].enable=!1,e.laptop?(this.queries[2].enable=!0,this.queries[2].setRange(e.mobile.min==null?null:e.mobile.min,e.mobile.max??null),this.matchMedias[2]=window.matchMedia(this.queries[0].mediaQuery)):this.queries[2].enable=!1,e.desktop?(this.queries[3].enable=!0,this.queries[3].setRange(e.mobile.min==null?null:e.mobile.min,e.mobile.max??null),this.matchMedias[3]=window.matchMedia(this.queries[0].mediaQuery)):this.queries[3].enable=!1}this.updateElements()}onResize(){this.updateElements()}updateElements(){let e=this.matchMedias[0].matches&&this.queries[0].enable,r=this.matchMedias[1].matches&&this.queries[1].enable,i=this.matchMedias[2].matches&&this.queries[2].enable,o=this.matchMedias[3].matches&&this.queries[3].enable;document.querySelectorAll("[string-mobile], [string-tablet], [string-laptop], [string-desktop]").forEach(n=>{let a=!1;n.hasAttribute("string-mobile")&&e&&(a=!0,this.events.emit("screen:mobile",e)),n.hasAttribute("string-tablet")&&r&&(a=!0,this.events.emit("screen:tablet",r)),n.hasAttribute("string-laptop")&&i&&(a=!0,this.events.emit("screen:laptop",i)),n.hasAttribute("string-desktop")&&o&&(a=!0,this.events.emit("screen:desktop",o)),a?n.style.display=null:n.style.display="none"})}};var wt=class extends h{constructor(t){super(t),this.htmlKey="anchor",this.attributesToMap=[...this.attributesToMap,{key:"anchor",type:"tuple",fallback:this.settings.anchor,transform:e=>{let[r,i]=e,o=this.tools.originParser.process({value:r}),s=this.tools.originParser.process({value:i});return{x:o,y:s}}}]}onObjectConnected(t){super.onObjectConnected(t);let e=t.getProperty("anchor");e&&this.applyToElementAndConnects(t,r=>{r.style.transformOrigin=`${e.x} ${e.y}`})}};var Bt=.05,qt=.01,Ft=1,Nt=-1,$t=1,Ct=class extends h{constructor(e){super(e);this.previousLerp=0;this.displacement=0;this.acceleration=0;this.velocityMultiplier=.00125;this.isInitialScroll=!0;this.baseVelocityMultiplier=.00125;this.reducedVelocityMultiplier=this.baseVelocityMultiplier/20;this.negativeVelocityMultiplier=-1e-4;this.maxDisplacementValue=0;this.setupItem=e=>{let r=e.getProperty("glide")??0,i=-this.data.scroll.displacement*this.maxDisplacementValue*r;this.events.emit(`glide:${e.id}`,i);let o=`translate3d(0, ${i}px, 0)`;e.htmlElement.style.transform=o};this.onUpdateDesktopEvent=()=>{for(let e=0;e<this.objects.length;e++){let r=this.objects[e];this.setupItem(r)}};this.onUpdateMobileEvent=()=>{};this.onUpdateEvent=this.onUpdateDesktopEvent;this.htmlKey="glide",this.baseVelocityMultiplier=this.settings["glide-base-velocity"]??this.baseVelocityMultiplier,this.reducedVelocityMultiplier=this.settings["glide-reduce-velocity"]??this.reducedVelocityMultiplier,this.negativeVelocityMultiplier=this.settings["glide-negative-velocity"]??this.negativeVelocityMultiplier,this.attributesToMap=[...this.attributesToMap,{key:"glide",type:"number",fallback:this.settings.glide}]}calcExpanderFactor(e){let r=e?this.data.scroll.lerped<this.previousLerp:this.data.scroll.lerped>this.previousLerp;this.velocityMultiplier=r?this.isInitialScroll?this.baseVelocityMultiplier:this.reducedVelocityMultiplier:this.negativeVelocityMultiplier,r||(this.isInitialScroll=!1)}onStart(){this.maxDisplacementValue=this.data.viewport.windowHeight*.1}onResize(){window.innerWidth>1080?(this.maxDisplacementValue=this.data.viewport.windowHeight*.1,this.onUpdateEvent=this.onUpdateDesktopEvent):(this.onUpdateEvent=this.onUpdateMobileEvent,this.resetState(),this.objects.forEach(e=>{this.setupItem(e)}))}resetState(){this.displacement=0,this.acceleration=0,this.isInitialScroll=!0,this.velocityMultiplier=this.baseVelocityMultiplier}onScrollStart(){this.resetState()}onScrollStop(){this.resetState(),this.previousLerp=0;for(let e=0;e<this.objects.length;e++){let r=this.objects[e],i="translate3d(0, 0px, 0)";r.htmlElement.style.transform=i,r.htmlElement.style.setProperty("--glide",this.data.scroll.displacement.toString())}}onFrame(e){this.calcExpanderFactor(this.data.scroll.isScrollingDown===!1),this.acceleration=Math.min(Ft,this.acceleration+Bt),this.displacement=Math.max(qt,Math.min(Ft,this.displacement+this.velocityMultiplier)),this.data.scroll.displacement=Math.min($t,Math.max(Nt,this.data.scroll.lerped*this.displacement*this.acceleration)),this.objects.forEach(r=>{this.applyToElementAndConnects(r,i=>{i.style.setProperty("--glide",this.data.scroll.displacement.toString())})}),this.previousLerp=this.data.scroll.lerped,this.onUpdateEvent()}};var Tt=class extends h{constructor(t){super(t),this.htmlKey="lerp"}onScrollStop(){this.objects.forEach(t=>{this.setLerpValue(t,0)})}onFrame(t){let e=t.scroll.lerped;this.objects.forEach(r=>{this.setLerpValue(r,e)})}setLerpValue(t,e){this.events.emit(`lerp:${t.id}`,e),t.htmlElement.style.setProperty("--lerp",e.toString())}};var $=class extends h{constructor(t){super(t),this.htmlKey="progress",this.attributesToMap=[...this.attributesToMap,{key:"enter-el",type:"string",fallback:this.settings["enter-el"]},{key:"enter-vp",type:"string",fallback:this.settings["enter-vp"]},{key:"exit-el",type:"string",fallback:this.settings["exit-el"]},{key:"exit-vp",type:"string",fallback:this.settings["exit-vp"]},{key:"easing",type:"easing",fallback:this.settings.easing}]}initializeObject(t,e,r,i){super.initializeObject(t,e,r,i)}onScroll(t){super.onScroll(t),this.objects.forEach(e=>{this.setUpObject(e)})}onObjectConnected(t){super.onObjectConnected(t),t.setProperty("setUpObject",this.setUpObject.bind(this)),t.events.on("enter",t.getProperty("setUpObject"))}setUpObject(t){let e=t.getProperty("start-position"),r=t.getProperty("difference-position"),i=t.getProperty("key"),o=t.getProperty("easing")(Math.min(1,Math.max(0,(this.data.scroll.transformedCurrent-e)/r)));if(t.getProperty("progress")!==o){this.events.emit(`progress:${t.id}`,o),t.setProperty("progress",o);let s=o.toString();this.applyToElementAndConnects(t,n=>{n.style.setProperty(i,s)})}}calculatePositions(t,e){let r=t.getProperty("start"),i=t.getProperty("size"),o=t.getProperty("offset-bottom"),s=t.getProperty("offset-top"),n=t.getProperty("enter-el"),a=t.getProperty("enter-vp"),p=t.getProperty("exit-el"),d=t.getProperty("exit-vp"),m=0,l=0;n==="top"&&a==="top"||n==="left"&&a==="left"?m=r-o:n==="top"&&a==="bottom"||n==="left"&&a==="right"?m=r-e-o:n==="bottom"&&a==="top"||n==="right"&&a==="left"?m=r+i-o:(n==="bottom"&&a==="bottom"||n==="right"&&a==="right")&&(m=r-e+i-o),p==="top"&&d==="top"||p==="left"&&d==="left"?l=r+s:p==="top"&&d==="bottom"||p==="left"&&d==="right"?l=r-e+s:p==="bottom"&&d==="top"||p==="right"&&d==="left"?l=r+i+s:(p==="bottom"&&d==="bottom"||p==="right"&&d==="right")&&(l=r-e+i+s),t.setProperty("start-position",m-this.data.scroll.topPosition),t.setProperty("end-position",l),t.setProperty("difference-position",l-m)}};var Pt=class extends ${constructor(e){super(e);this.handleScrollDesktop=()=>{this.objects.forEach(e=>{let r=e.getProperty("progress")??0,i=e.getProperty("parallax")??0,o=e.getProperty("parallax-position-start")??0,s=e.getProperty("parallax-position-end")??1,n=this.data.viewport.windowHeight,a=i*n*o+r*i*n*s;this.events.emit(`parallax:${e.id}`,a);let p=`translate3d(0, ${a}px, 0)`;this.applyToElementAndConnects(e,d=>{d.style.transform=p})})};this.handleScrollMobile=()=>{};this.scrollHandler=this.handleScrollDesktop;this.htmlKey="parallax",this.attributesToMap=[...this.attributesToMap,{key:"parallax",type:"number",fallback:this.settings.parallax},{key:"parallax-bias",type:"number",fallback:this.settings["parallax-bias"]}]}initializeObject(e,r,i,o){super.initializeObject(e,r,i,o);let s=r.getProperty("parallax-bias")??0,n=r.getProperty("parallax")??.2;r.setProperty("parallax-position-start",-.5+.5*s),r.setProperty("parallax-position-end",.5+.5*(1-s));let a=this.data.viewport.windowHeight;r.setProperty("offset-top",n*a),r.setProperty("offset-bottom",n*a)}onScroll(e){super.onScroll(e),this.scrollHandler()}onResize(){let e=window.innerWidth>1080;this.scrollHandler=e?this.handleScrollDesktop:this.handleScrollMobile,e||this.handleScrollDesktop()}};var mt=class{constructor(t,e,r){this.isDragging=!1;this.startY=0;this.startScrollPosition=0;this.data=t,this.scrollbar=e,this.thumb=r}onResize(){let t=this.data.viewport.contentWidth,e=this.data.viewport.windowWidth,r=e/t*e;this.thumb.style.setProperty("--size",r+"px"),t<=e?this.scrollbar.classList.add("-hide"):this.scrollbar.classList.remove("-hide")}updateThumb(){let t=this.data.viewport.contentWidth,e=this.data.viewport.windowWidth;this.thumb.style.setProperty("--position",`${this.data.scroll.current/t*e+"px"}`)}mouseDownEvent(t){this.startY=t.clientY,this.startScrollPosition=this.data.scroll.current}mouseMoveEvent(t){let e=t.clientY-this.startY,r=this.startScrollPosition+e/this.data.viewport.windowWidth*this.data.viewport.contentWidth;this.data.scroll.current=r,this.data.scroll.target=r,window.scrollTo(0,r),this.updateThumb()}};var ut=class{constructor(t,e,r){this.isDragging=!1;this.startCoordinate=0;this.startScrollPosition=0;this.data=t,this.scrollbar=e,this.thumb=r}onResize(){let t=this.data.viewport.contentHeight,e=this.data.viewport.windowHeight,r=e/t*e;this.thumb.style.setProperty("--height",r+"px"),t<=e?this.scrollbar.classList.add("-hide"):this.scrollbar.classList.remove("-hide")}updateThumb(){let t=this.data.viewport.contentHeight,e=this.data.viewport.windowHeight;this.thumb.style.setProperty("--position",`${this.data.scroll.current/t*e+"px"}`)}mouseDownEvent(t){this.startCoordinate=t.clientY,this.startScrollPosition=this.data.scroll.current}mouseMoveEvent(t){let e=t.clientY-this.startCoordinate,r=this.startScrollPosition+e/this.data.viewport.windowHeight*this.data.viewport.contentHeight,i=this.data.scroll.bottomPosition,o=Math.max(0,Math.min(r,i));this.data.scroll.current=o,this.data.scroll.target=o,window.scrollTo(0,o),this.updateThumb()}};var It=class extends h{constructor(e){super(e);this.isDragging=!1;this.scrollMode="smooth";this.mouseUpEventBind=this.mouseUpEvent.bind(this),this.mouseDownEventBind=this.mouseDownEvent.bind(this),this.mouseMoveEventBind=this.mouseMoveEvent.bind(this)}destructor(){document.removeEventListener("mouseup",this.mouseUpEventBind),this.thumb.removeEventListener("mousedown",this.mouseDownEventBind),document.removeEventListener("mousemove",this.mouseMoveEventBind)}onInit(){this.createScrollbar(),this.updateThumb(),this.addCustomStyles(),document.addEventListener("mouseup",this.mouseUpEventBind),this.thumb.addEventListener("mousedown",this.mouseDownEventBind),document.addEventListener("mousemove",this.mouseMoveEventBind),document.documentElement.classList.add("-no-scrollbar")}onScroll(e){this.updateThumb(),this.showScrollbar(),this.hideScrollbar()}onResize(){this.scrollbarState.onResize()}addCustomStyles(){let e=document.createElement("style");e.textContent=`
2
2
  ::-webkit-scrollbar {
3
3
  display: none;
4
4
  width: 0;
@@ -16,25 +16,9 @@ var H=class{constructor(){this.stringOffsetStart="0%";this.stringOffsetEnd="0%";
16
16
  -ms-overflow-style: none; /* IE and Edge */
17
17
  scrollbar-width: none; /* Firefox */
18
18
  }
19
- `,document.head.appendChild(e)}createScrollbar(){this.scrollbar=document.createElement("div"),this.scrollbar.classList.add("scrollbar"),this.thumb=document.createElement("div"),this.thumb.classList.add("thumb"),this.scrollbar.appendChild(this.thumb),document.body.appendChild(this.scrollbar),this.scrollbarStateHorizontal=new V(this.data,this.scrollbar,this.thumb),this.scrollbarStateVertical=new F(this.data,this.scrollbar,this.thumb),this.scrollbarState=this.scrollbarStateHorizontal}updateThumb(){this.scrollbarState.updateThumb()}mouseDownEvent(e){this.isDragging=!0,this.scrollbarState.mouseDownEvent(e),document.body.style.userSelect="none",this.scrollbar.classList.add("-touch")}mouseMoveEvent(e){this.isDragging&&this.scrollbarState.mouseMoveEvent(e)}mouseUpEvent(){this.isDragging=!1,document.body.style.userSelect="",this.hideScrollbar(),this.scrollbar.classList.remove("-touch")}showScrollbar(){this.scrollbar.classList.add("-scroll")}hideScrollbar(){this.scrollTimeout&&clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout(()=>{this.scrollbar.classList.remove("-scroll")},1e3)}};var pt=class extends f{constructor(t){super(t),this.htmlKey="anchor"}initObject(t,e,r,i){super.initObject(t,e,r,i),e.setProperty("anchor",this.attribute.process(r,"string-anchor","center center"))}onConnect(t){super.onConnect(t),(t.getProperty("anchor")==null||t.getProperty("anchor")=="")&&t.setProperty("anchor","center center");let e=t.getProperty("anchor").split(" "),r=this.parseOrig(e[0]),i=this.parseOrig(e[1]||e[0]);t.el.style.transformOrigin=`${r} ${i}`}parseOrig(t){if(t=t.trim(),t.startsWith("random")){let e=t.slice(7,-1).split(",").map(i=>i.trim()),r=Math.floor(Math.random()*e.length);return e[r]}else return t}};var dt=class extends f{constructor(e,r=null){super(e);this.previousLerp=0;this.displacement=0;this.acceleration=0;this.velocityMultiplier=.00125;this.isInitialScroll=!0;this.baseVelocityMultiplier=.00125;this.reducedVelocityMultiplier=this.baseVelocityMultiplier/20;this.negativeVelocityMultiplier=-1e-4;this.ACCELERATION_STEP=.05;this.MIN_DISPLACEMENT=.01;this.MAX_DISPLACEMENT=1;this.MIN_VELOCITY=-1;this.MAX_VELOCITY=1;this.maxDisplacementValue=0;this.setupItem=e=>{let r=`translate3d(0, ${-this.data.dV*this.maxDisplacementValue*e.getProperty("glide")}px, 0)`;e.el.style.transform=r};this.onUpdateDesktopEvent=()=>{for(let e=0;e<this.objects.length;e++){let r=this.objects[e];this.setupItem(r)}};this.onUpdateMobileEvent=()=>{};this.onUpdateEvent=this.onUpdateDesktopEvent;if(this.htmlKey="glide",r){let{baseVelocityMultiplier:i,reducedVelocityMultiplier:n,negativeVelocityMultiplier:s}=r;this.baseVelocityMultiplier=i!=null?i:this.baseVelocityMultiplier,this.reducedVelocityMultiplier=n!=null?n:this.reducedVelocityMultiplier,this.negativeVelocityMultiplier=s!=null?s:this.negativeVelocityMultiplier}}initObject(e,r,i,n){var s;super.initObject(e,r,i,n),r.setProperty("glide",parseFloat((s=n["string-glide"])!=null?s:"1"))}calcExpanderFactor(e){let r=e?this.data.v<this.previousLerp:this.data.v>this.previousLerp;this.velocityMultiplier=r?this.isInitialScroll?this.baseVelocityMultiplier:this.reducedVelocityMultiplier:this.negativeVelocityMultiplier,r||(this.isInitialScroll=!1)}onStart(){this.maxDisplacementValue=this.data.wS*.1}onResize(){window.innerWidth>1080?(this.maxDisplacementValue=this.data.wS*.1,this.onUpdateEvent=this.onUpdateDesktopEvent):(this.onUpdateEvent=this.onUpdateMobileEvent,this.resetState(),this.objects.forEach(e=>{this.setupItem(e)}))}resetState(){this.displacement=0,this.acceleration=0,this.isInitialScroll=!0,this.velocityMultiplier=this.baseVelocityMultiplier}onScrollStart(){this.resetState()}onScrollStop(){this.resetState(),this.previousLerp=0;for(let e=0;e<this.objects.length;e++){let r=this.objects[e],i="translate3d(0, 0px, 0)";r.el.style.transform=i,r.el.style.setProperty("--glide",this.data.dV.toString())}}onUpdate(e){this.calcExpanderFactor(this.data.sDB===!1),this.acceleration=Math.min(this.MAX_DISPLACEMENT,this.acceleration+this.ACCELERATION_STEP),this.displacement=Math.max(this.MIN_DISPLACEMENT,Math.min(this.MAX_DISPLACEMENT,this.displacement+this.velocityMultiplier)),this.data.dV=Math.min(this.MAX_VELOCITY,Math.max(this.MIN_VELOCITY,this.data.v*this.displacement*this.acceleration)),this.objects.forEach(r=>{r.el.style.setProperty("--glide",this.data.dV.toString())}),this.previousLerp=this.data.v,this.onUpdateEvent()}};var ut=class extends f{constructor(t){super(t),this.htmlKey="lerp"}onScrollStop(){this.objects.forEach(t=>{t.el.style.setProperty("--lerp","0")})}onScroll(t){this.objects.forEach(e=>{e.el.style.setProperty("--lerp",this.data.v.toString())})}};var ct=class extends A{constructor(e){super(e);this.setupParallax=(e,r)=>{let i=`translate3d(0, ${e.getProperty("parallax-factor")*this.data.wS*e.getProperty("parallax-position-start")+r*e.getProperty("parallax-factor")*this.data.wS*e.getProperty("parallax-position-end")}px, 0)`;e.el.style.transform=i,e.connects.forEach(n=>{n.style.transform=i})};this.onScrollDesktopEvent=()=>{this.objects.forEach(e=>{this.setupParallax(e,e.getProperty("progress"))})};this.onScrollMobileEvent=()=>{};this.onScrollEvent=this.onScrollDesktopEvent;this.htmlKey="parallax"}initObject(e,r,i,n){var a,o;let s=parseFloat((a=n["string-parallax-bias"])!=null?a:this.defaultSettings.stringParallaxBias);r.setProperty("parallax-position-start",-.5+.5*s),r.setProperty("parallax-position-end",.5+.5*(1-s)),r.setProperty("parallax-factor",parseFloat((o=n["string-parallax"])!=null?o:this.defaultSettings.stringParallax)),r.setProperty("offset-start",r.getProperty("parallax-factor")*this.data.wS),r.setProperty("offset-end",r.getProperty("parallax-factor")*this.data.wS),super.initObject(e,r,i,n)}onScroll(e){super.onScroll(e),this.onScrollEvent()}onResize(){window.innerWidth>1080?this.onScrollEvent=this.onScrollDesktopEvent:(this.onScrollEvent=this.onScrollMobileEvent,this.objects.forEach(e=>{this.setupParallax(e,.5)}))}};var I=class{constructor(t,e,r){this.isProg=!1;this.isParallaxEnabled=!1;this.name="";this.v=0;this.vT=0;this.onScrollStart=()=>{};this.onScrollStop=()=>{};this.onChangeDirection=()=>{};this.onCalcUpdate=()=>{this.scrollContainer.scrollTo(0,this.data.c)};this._scrollDirection="vertical";this.d=t,this.settings=e,this.data=r,this.scrollContainer=window}onUpdate(){}onWheel(t){}onScroll(t){}set scrollDirection(t){this._scrollDirection=t,this._scrollDirection=="vertical"?this.onCalcUpdate=()=>{this.scrollContainer.scrollTo(0,this.data.c)}:this._scrollDirection=="horizontal"&&(this.onCalcUpdate=()=>{this.scrollContainer.scrollTo(this.data.c,0)})}};var Y=class extends I{constructor(t,e,r){super(t,e,r),this.name="mobile"}onUpdate(){if(this.data.d!=0){let t=this.data.d*this.settings.speedAccelerate;this.data.d-=t,this.data.v=t,Math.abs(this.data.v)<.1&&(this.data.d=0,this.data.v=0,this.onScrollStop())}}onScroll(t){this.data.c=this.d.documentElement.scrollTop,this.data.t=this.d.documentElement.scrollTop}onWheel(t){if(t.deltaY!=0){this.data.d==0&&this.onScrollStart();let e=t.deltaY;this.data.t==0&&(this.data.d+=Math.max(0,t.deltaY)),this.data.d+=e}}};var X=class extends I{constructor(t,e,r){super(t,e,r),this.name="disable"}onUpdate(){}onWheel(t){t.preventDefault()}onScroll(t){t.preventDefault()}};var N={SCROLL_FORWARD:"-scroll-forward",SCROLL_BACK:"-scroll-back"},$=class extends I{constructor(e,r,i){super(e,r,i);this.name="desktop";this.isScrollbarManipulation=!1;this.isBottomScrollDirection=!1;this.velocityThreshold=.1;this.plusDelta=0;this.previousCurrent=0;this.delta=0}updateScrollDirection(e){if(this.isBottomScrollDirection===null){this.isBottomScrollDirection=e;return}this.data.sDB=e,this.onChangeDirection(),document.documentElement.classList.toggle(N.SCROLL_FORWARD,e),document.documentElement.classList.toggle(N.SCROLL_BACK,!e)}stopScroll(){this.data.v=0,this.data.d=0,this.data.t=this.data.c,this.isProg=!1,this.onCalcUpdate(),document.documentElement.classList.remove(N.SCROLL_BACK,N.SCROLL_FORWARD),this.isBottomScrollDirection=null}onUpdate(){var e,r;if(this.isScrollbarManipulation){this.isScrollbarManipulation=!1,this.data.t=(r=(e=this.scrollContainer)==null?void 0:e.scrollTop)!=null?r:document.documentElement.scrollTop,this.data.c=this.data.t;return}if(this.data.d!=0){this.delta=this.data.d*this.settings.speedAccelerate,this.data.t=Math.min(Math.max(0,this.data.t+this.delta),this.data.bS),this.data.d-=this.delta,this.data.v=(this.data.t-this.data.c)*this.settings.speed;let i=Math.abs(this.data.v);this.data.v>0?this.data.c=Math.ceil(this.data.c+this.data.v):this.data.c=Math.floor(this.data.c+this.data.v),this.updateScrollDirection(this.data.v>0),i<this.velocityThreshold?(this.stopScroll(),this.onScrollStop()):(this.isProg=!0,this.previousCurrent!=this.data.c&&(this.previousCurrent=this.data.c,this.onCalcUpdate()))}}onWheel(e){if(e.deltaY!=0&&e.preventDefault(),this.plusDelta=e.deltaY,this.plusDelta===0)return;this.data.d===0&&this.onScrollStart();let r=Math.sign(this.plusDelta);this.data.t===0&&r<0||this.data.t===this.data.bS&&r>0||(this.data.d+=this.plusDelta)}onScroll(e){this.isProg||(this.isScrollbarManipulation=!0)}};var Q=class{constructor(){this.sC=.1;this.sA=.25}get speed(){return this.sC}get speedAccelerate(){return this.sA}set speedAccelerate(t){this.sA=t}set speed(t){this.sC=t}};var mt=class extends f{constructor(t){super(t),this.htmlKey="split"}onStart(){}onResize(){document.querySelectorAll('[string="split"].-splited').forEach(t=>{let e=this.parseSplitOptions(t.getAttribute("string-split"));t.innerHTML!=this.split(e,t).html&&(t.innerHTML=this.split(e,t).html)})}onConnect(t){let e=t.el;if(!e.classList.contains("-splited")){e.classList.add("-splited"),e.setAttribute("string-split-original",e.innerHTML);let r=this.parseSplitOptions(e.getAttribute("string-split"));e.innerHTML!=this.split(r,e).html&&(e.innerHTML=this.split(r,e).html)}}parseSplitOptions(t){let e={line:[],word:[],char:[],charLine:[],charWord:[],wordLine:[]};return t&&t.split("|").forEach(i=>{let n=i.match(/^(\w+-)?(\w+)(\[(.*?)\])?$/);if(n){let s=n[1]||"",a=n[2],o=n[4]?n[4].split(","):[];switch(s+a){case"char-line":e.charLine.push(this.parseParam(o));break;case"char-word":e.charWord.push(this.parseParam(o));break;case"word-line":e.wordLine.push(this.parseParam(o));break;case"line":e.line.push(this.parseParam(o));break;case"word":e.word.push(this.parseParam(o));break;case"char":e.char.push(this.parseParam(o));break}}}),e}parseParam(t){let e={align:"start"};return t.forEach(r=>{if(r==="abs")e.abs=!0;else if(r.startsWith("random")){let i=r.match(/random\((\d+),(\d+)\)/);i&&(e.random={min:parseInt(i[1]),max:parseInt(i[2])}),e.align="random"}else["start","center","end"].includes(r)?e.align=r:e.align="start"}),e}split(t,e){let r=e.getAttribute("string-split-original");if(r.length===0)return"";r=this.decodeHtmlEntity(r);let i=document.createElement("span"),n=r.split(/\s+/),s=0,a=0,o=r.replace(/\s/g,"").length,h=document.createElement("span"),p=window.getComputedStyle(e);h.style.fontFamily=p.fontFamily,h.style.fontSize=p.fontSize,h.style.letterSpacing=p.letterSpacing,h.style.lineHeight=p.lineHeight,h.style.fontWeight=p.fontWeight,h.classList.add("-s-char"),document.body.appendChild(h);let d=[],u=[],g=0;n.forEach((c,w)=>{h.textContent=c,c.length>0&&(h.textContent+="\xA0");let E=h.offsetWidth,S={text:c,width:E,chars:new Array};Array.from(c).forEach((x,W)=>{let M={text:x};S.chars.push(M)}),g+E>e.offsetWidth&&(d.push(u),u=[],g=0,s+=u.length),u.push(S),g+=E}),d.push(u);let y=!1;t.line!=null&&t.line.length>0&&(y=!0),t.wordLine!=null&&t.wordLine.length>0&&(y=!0),t.charLine!=null&&t.charLine.length>0&&(y=!0);let b=0;if(y)for(let c=0;c<d.length;c++)this.appendVirtualLineToDOM(c,d.length,n.length,i,d[c],t,s,o,b),b+=d[c].length;else for(let c=0;c<d.length;c++)d[c].forEach((w,E)=>{var S,_;if(w.chars.length>0){let x=document.createElement("span");x.classList.add("-s-word"),t.char!=null&&((S=t.char)==null?void 0:S.length)>0||t.charWord!=null&&((_=t.charWord)==null?void 0:_.length)>0?w.chars.forEach((W,M)=>{let C=document.createElement("span");C.classList.add("-s-char"),C.textContent=W.text,this.applyOptions(C,t.char,s,"char",M,o),this.applyOptions(C,t.charWord,M,"char-word",M,w.text.length),x.appendChild(C),s++}):x.textContent=w.text,this.applyOptions(x,t.word,a,"word",E,n.length),w.chars.length>0&&(x.innerHTML+="\xA0"),i.appendChild(x),a++}});return document.body.removeChild(h),{html:i.innerHTML}}appendVirtualLineToDOM(t,e,r,i,n,s,a,o,h){let p=document.createElement("span");p.classList.add("-s-line"),this.applyOptions(p,s.line,t,"line",0,e);let d=0,u=0,g=0;n.forEach((y,b)=>{g+=y.text.length}),n.forEach((y,b)=>{if(y.chars.length>0){let c=document.createElement("span");c.classList.add("-s-word"),y.chars.forEach((w,E)=>{let S=document.createElement("span");S.classList.add("-s-char"),S.textContent=w.text,this.applyOptions(S,s.char,a,"char",E,o),this.applyOptions(S,s.charLine,d,"char-line",E,g),this.applyOptions(S,s.charWord,E,"char-word",E,y.text.length),c.appendChild(S),a++,d++}),this.applyOptions(c,s.word,h+u,"word",h+u,r-1),this.applyOptions(c,s.wordLine,b,"word-line",b,n.length),b<n.length-1&&(c.innerHTML+="\xA0"),p.appendChild(c),u++}}),i.appendChild(p)}applyOptions(t,e,r,i,n,s){e&&e.forEach((a,o)=>{let h=this.calculateIndex(a,r,n,s),p=this.generateVariableName(i,a,o);t.style.setProperty(p,String(h))})}createSpaceSpan(){let t=document.createElement("span");return t.innerHTML="\xA0",t}decodeHtmlEntity(t){return t.replace(/&amp;/g,"&")}calculateIndex(t,e,r,i){let n=e;if(t.align==="random"){t.random===void 0&&(t.random={min:0,max:i});let s=t.random.min||0,a=t.random.max||i;n=Math.floor(Math.random()*(a-s+1))+s}return t.align==="end"?n=i-n-1:t.align==="center"&&(n=n-Math.floor(i/2)),t.abs&&(n=Math.abs(n)),n}generateVariableName(t,e,r){let i=`--${t}`;return e.align&&(i+=`-${e.align}`),i}};var K=class{constructor(){this.isAnimationStarted=!1;this.fpsInterval=0;this.then=0;this.requestAnimationId=0;this.onFrameCallback=()=>{};this.animate=()=>{}}start(t){this.isAnimationStarted||(this.fpsInterval=1e3/t,this.then=performance.now(),this.isAnimationStarted=!0,t==0?this.animate=()=>{this.requestAnimationId=requestAnimationFrame(()=>this.animate()),this.onFrameCallback()}:this.animate=()=>{let e=performance.now(),r=e-this.then;r>this.fpsInterval&&(this.then=e-r%this.fpsInterval,this.onFrameCallback()),this.requestAnimationId=requestAnimationFrame(()=>this.animate())},this.animate())}stop(){this.isAnimationStarted&&(cancelAnimationFrame(this.requestAnimationId),this.requestAnimationId=0,this.isAnimationStarted=!1)}setOnFrame(t){this.onFrameCallback=t}};var gt=class extends m{constructor(e){super(e);this.canvasHeight=0;this._type=2}onStart(){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.canvas.width=window.innerWidth*.5,this.canvas.height=window.innerHeight/15-20,this.canvasHeight=window.innerHeight/15-20,this.canvas.style.position="fixed",this.canvas.style.bottom=`${window.innerHeight/20+10}px`,this.canvas.style.left="50%",this.canvas.style.transform="translateX(-50%)",this.canvas.style.backgroundColor="#000000",this.canvas.style.border="1px solid rgba(255, 255, 255, 0.2)",this.canvas.style.zIndex="1000",document.body.appendChild(this.canvas),this.positionHistory=[],this.maxHistory=this.canvas.width,this.currentPosition=0,this.targetPosition=0}onScroll(e){this.currentPosition=Math.abs(this.data.dV),this.positionHistory.push(this.currentPosition),this.positionHistory.length>this.maxHistory&&this.positionHistory.shift(),this.drawGraph()}drawGraph(){let e=this.context;e.clearRect(0,0,this.canvas.width,this.canvas.height),e.strokeStyle="#e0e0e0",e.lineWidth=1,e.strokeStyle="red",e.lineWidth=2,e.beginPath(),this.positionHistory.forEach((r,i)=>{let n=i,s=this.canvas.height-r*this.canvasHeight;i===0?e.moveTo(n,s):e.lineTo(n,s)}),e.stroke()}setTargetPosition(e){this.targetPosition=e}};var yt=class extends m{constructor(e){super(e);this.callCount=0;this._type=2}createDisplayElement(){this.displayElement=document.createElement("div"),this.displayElement.style.position="fixed",this.displayElement.style.bottom="10px",this.displayElement.style.right="10px",this.displayElement.style.backgroundColor="#000000",this.displayElement.style.border="1px solid rgba(255, 255, 255, 0.2)",this.displayElement.style.zIndex="9999",this.displayElement.setAttribute("data-fps","0"),document.body.appendChild(this.displayElement);let e=document.createElement("style");e.innerHTML=`
20
- [data-fps]::after {
21
- content: 'FPS: ' attr(fps);
22
- position: relative;
23
- display: block;
24
- color: #ffffff;
25
- padding: 5px 8px;
26
- font-family: Arial, sans-serif;
27
- font-size: 12px;
19
+ `,document.head.appendChild(e)}createScrollbar(){this.scrollbar=document.createElement("div"),this.scrollbar.classList.add("scrollbar"),this.thumb=document.createElement("div"),this.thumb.classList.add("thumb"),this.scrollbar.appendChild(this.thumb),document.body.appendChild(this.scrollbar),this.scrollbarStateHorizontal=new mt(this.data,this.scrollbar,this.thumb),this.scrollbarStateVertical=new ut(this.data,this.scrollbar,this.thumb),this.scrollbarState=this.scrollbarStateVertical}updateThumb(){this.scrollbarState.updateThumb()}mouseDownEvent(e){this.isDragging=!0,this.scrollbarState.mouseDownEvent(e),document.body.style.userSelect="none",this.scrollbar.classList.add("-touch")}mouseMoveEvent(e){this.isDragging&&this.scrollbarState.mouseMoveEvent(e)}mouseUpEvent(){this.isDragging=!1,document.body.style.userSelect="",this.hideScrollbar(),this.scrollbar.classList.remove("-touch")}showScrollbar(){this.scrollbar.classList.add("-scroll")}hideScrollbar(){this.scrollTimeout&&clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout(()=>{this.scrollbar.classList.remove("-scroll")},1e3)}};var Lt=class extends h{constructor(t){super(t),this.htmlKey="split"}onInit(){document.querySelectorAll(`[string="${this.htmlKey}"]`).forEach(t=>{t instanceof HTMLElement&&this.processElement(t)})}onResize(){document.querySelectorAll(`[string="${this.htmlKey}"].-splited`).forEach(t=>{t instanceof HTMLElement&&this.processElement(t)})}onObjectConnected(t){this.processElement(t.htmlElement)}processElement(t){if(!t)return;let e=t.classList.contains("-splited"),r=t.getAttribute("string-split-original");if((!e||r===null)&&(r=t.innerHTML,t.setAttribute("string-split-original",r),t.classList.add("-splited")),!r||r.trim()===""){t.innerHTML!==""&&(t.innerHTML="");return}try{let i=t.getAttribute("string-split"),o=this.tools.optionsParser.process({attributeValue:i}),n=this.tools.layoutSplitter.decodeHtmlEntity(r).replace(/\s+/g,"").length,a=this.tools.layoutSplitter.process({text:r,targetElement:t});if(a.length===0&&r.trim()!==""){console.warn("StringSplit: Layout calculation resulted in no lines for element:",t);return}let p=this.tools.wordIndexer.process({lines:a,options:{word:o.word,wordLine:o.wordLine}}),d=this.tools.charIndexer.process({processedWords:p,lines:a,options:{char:o.char,charLine:o.charLine,charWord:o.charWord},totalChars:n}),m=this.tools.domBuilder.process({lines:a,words:p,chars:d,options:o});t.innerHTML!==m&&(t.innerHTML=m)}catch(i){if(console.error("StringSplit: Error processing element:",t,i),r!==null)try{t.innerHTML!==r&&(t.innerHTML=r)}catch(o){console.error("StringSplit: Error reverting element to original HTML:",t,o),t.innerHTML=""}else t.innerHTML="";t.classList.remove("-splited")}}};var Ot=class extends h{constructor(e){super(e);this.history=[];this.maxPoints=0;this.height=0;this.value=0;this.target=0;this._type=2}onInit(){this.initCanvas(),this.maxPoints=this.canvas.width}onScroll(e){let r=Math.abs(e.scroll.displacement);this.value=r,this.history.push(r),this.history.length>this.maxPoints&&this.history.shift(),this.draw()}draw(){let e=this.context,r=this.canvas.width,i=this.canvas.height;e.clearRect(0,0,r,i),e.strokeStyle="red",e.lineWidth=2,e.beginPath(),this.history.forEach((o,s)=>{let n=s,a=i-o*this.height;s===0?e.moveTo(n,a):e.lineTo(n,a)}),e.stroke()}initCanvas(){let e=document.createElement("canvas"),r=window.innerWidth*.5;this.height=window.innerHeight/15-20,e.width=r,e.height=this.height,Object.assign(e.style,{position:"fixed",bottom:`${window.innerHeight/20+10}px`,left:"50%",transform:"translateX(-50%)",backgroundColor:"#000000",border:"1px solid rgba(255, 255, 255, 0.2)",zIndex:"1000",pointerEvents:"none"}),this.canvas=e,this.context=e.getContext("2d"),document.body.appendChild(e)}setTarget(e){this.target=e}clear(){this.canvas.remove(),this.history=[]}};var Dt=class extends h{constructor(e){super(e);this.frameCount=0;this._type=2}onInit(){this.createDisplayElement(),this.intervalId=window.setInterval(()=>{this.displayElement.textContent=`FPS: ${this.frameCount}`,this.frameCount=0},1e3)}onFrame(e){this.frameCount++}destroy(){clearInterval(this.intervalId),this.displayElement.remove()}createDisplayElement(){let e=document.createElement("div");Object.assign(e.style,{position:"fixed",bottom:"10px",right:"10px",backgroundColor:"#000",color:"#fff",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",border:"1px solid rgba(255,255,255,0.2)",zIndex:"1000",pointerEvents:"none"}),e.textContent="FPS: 0",document.body.appendChild(e),this.displayElement=e}};var kt=class extends h{constructor(e){super(e);this.history=[];this.maxPoints=0;this.canvasHeight=0;this.currentValue=0;this.targetValue=0;this._type=2}onInit(){this.initCanvas(),this.maxPoints=this.canvas.width}onScroll(e){let r=Math.abs(e.scroll.displacement);this.currentValue=r,this.history.push(r),this.history.length>this.maxPoints&&this.history.shift(),this.draw()}draw(){let e=this.context,r=this.canvas.width,i=this.canvas.height;e.clearRect(0,0,r,i),e.strokeStyle="#007bff",e.lineWidth=2,e.beginPath(),this.history.forEach((o,s)=>{let n=s,a=i-o/2;s===0?e.moveTo(n,a):e.lineTo(n,a)}),e.stroke()}initCanvas(){this.canvas=document.createElement("canvas"),this.canvasHeight=window.innerHeight/15-20,this.canvas.width=window.innerWidth*.5,this.canvas.height=this.canvasHeight,Object.assign(this.canvas.style,{position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",backgroundColor:"#000",border:"1px solid rgba(255,255,255,0.2)",zIndex:"1000",pointerEvents:"none"}),this.context=this.canvas.getContext("2d"),document.body.appendChild(this.canvas)}setTarget(e){this.targetValue=e}clear(){this.canvas.remove(),this.history=[]}};var Rt=class extends h{constructor(t){super(t),this._type=2}onInit(){this.createDisplayElement()}onScroll(t){let e=t.scroll.current,r=t.scroll.target,i=e<r?"\u2193":e>r?"\u2191":"-";this.displayElement.setAttribute("data-dir",i),this.displayElement.setAttribute("data-val",`${Math.round(e)}`)}destroy(){this.displayElement.remove()}createDisplayElement(){let t=document.createElement("div");Object.assign(t.style,{position:"fixed",bottom:"10px",left:"10px",backgroundColor:"#000",color:"#fff",border:"1px solid rgba(255,255,255,0.2)",padding:"5px 8px",fontSize:"12px",fontFamily:"monospace",zIndex:"1000",pointerEvents:"none"}),t.setAttribute("data-dir","-"),t.setAttribute("data-val","0"),document.body.appendChild(t);let e=document.createElement("style");e.innerHTML=`
20
+ div[data-dir][data-val]::before {
21
+ content: attr(data-dir) ' Top: ' attr(data-val) 'px';
28
22
  }
29
- `,document.head.appendChild(e)}onStart(){this.createDisplayElement(),this.intervalId=setInterval(()=>{this.displayElement.setAttribute("fps",`${this.callCount}`),this.callCount=0},1e3)}onUpdate(e){this.callCount++}destructor(){clearInterval(this.intervalId),document.body.removeChild(this.displayElement)}};var ft=class extends m{constructor(t){super(t),this._type=2}onStart(){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.canvas.width=window.innerWidth*.5,this.canvas.height=window.innerHeight/15-20,this.canvas.style.position="fixed",this.canvas.style.bottom="10px",this.canvas.style.left="50%",this.canvas.style.transform="translateX(-50%)",this.canvas.style.backgroundColor="#000000",this.canvas.style.border="1px solid rgba(255, 255, 255, 0.2)",this.canvas.style.zIndex="1000",document.body.appendChild(this.canvas),this.positionHistory=[],this.maxHistory=this.canvas.width,this.currentPosition=0,this.targetPosition=0}onScroll(t){this.currentPosition=Math.abs(this.data.v),this.positionHistory.push(this.currentPosition),this.positionHistory.length>this.maxHistory&&this.positionHistory.shift(),this.drawGraph()}drawGraph(){let t=this.context;t.clearRect(0,0,this.canvas.width,this.canvas.height),t.strokeStyle="#e0e0e0",t.lineWidth=1,t.strokeStyle="#007bff",t.lineWidth=2,t.beginPath(),this.positionHistory.forEach((e,r)=>{let i=r,n=this.canvas.height-e/2;r===0?t.moveTo(i,n):t.lineTo(i,n)}),t.stroke()}setTargetPosition(t){this.targetPosition=t}};var vt=class extends m{constructor(e){super(e);this.callCount=0;this._type=2}createDisplayElement(){this.displayElement=document.createElement("div"),this.displayElement.style.position="fixed",this.displayElement.style.bottom="10px",this.displayElement.style.left="10px",this.displayElement.style.backgroundColor="#000000",this.displayElement.style.border="1px solid rgba(255, 255, 255, 0.2)",this.displayElement.style.zIndex="9999",this.displayElement.setAttribute("data-position","0"),document.body.appendChild(this.displayElement);let e=document.createElement("style");e.innerHTML=`
30
- [data-position]::after {
31
- content: attr(direction) 'Top: ' attr(value) 'px';
32
- position: relative;
33
- display: block;
34
- color: #ffffff;
35
- padding: 5px 8px;
36
- font-family: Arial, sans-serif;
37
- font-size: 12px;
38
- }
39
- `,document.head.appendChild(e)}onStart(){this.createDisplayElement()}onScroll(e){let r="";e.c<e.t&&(r="\u2193"),e.c>e.t&&(r="\u2191"),this.displayElement.setAttribute("direction",r),this.displayElement.setAttribute("value",`${this.data.c}`)}onUpdate(e){this.callCount++}destructor(){document.body.removeChild(this.displayElement)}};var G=class{process(t,e,r=null){return t.getAttribute(e)==null?t.getAttribute(`data-${e}`)==null?r:t.getAttribute(`data-${e}`):t.getAttribute(e)}};var Z=class{process(t){return t.getBoundingClientRect()}};var J=class{constructor(){this.three=null;this.t=0;this.c=0;this.d=0;this.v=0;this.dV=0;this.sDB=!1;this.bS=0;this.cF=1;this.wS=0;this.hnwS=0;this.psW=0;this.psH=0;this.cL={x:0,y:0};this.scsW=1;this.scsH=1;this.sD="vertical";this.sM="smooth"}};var q=class{constructor(){this.eventsByKey=new Map;this.events=new Array}on(t,e){var r;this.eventsByKey.has(t)==!1&&this.eventsByKey.set(t,[]),(r=this.eventsByKey.get(t))==null||r.push(e),this.updateAllEvents()}has(t){return this.eventsByKey.has(t)}emit(t,e){var r;this.eventsByKey.has(t)&&((r=this.eventsByKey.get(t))==null||r.forEach(i=>{i(e)}))}off(t,e){let r=this.eventsByKey.get(t);r!=null&&this.eventsByKey.set(t,r.filter(i=>i!==e)),this.updateAllEvents()}all(t){this.events.forEach(e=>{e(t)})}updateAllEvents(){this.events=[],Array.from(this.eventsByKey.values()).forEach(t=>{t.forEach(e=>{this.events.push(e)})})}};function Mt(l){let{top:t,left:e,width:r,height:i}=l.getBoundingClientRect(),n=a(l);if(n.length==6){var s=n;let o=s[0]*s[3]-s[1]*s[2];return{width:r/s[0]==0?1:s[0],height:i/s[3]==0?1:s[3],left:(e*s[3]-t*s[2]+s[2]*s[5]-s[4]*s[3])/o,top:(-e*s[1]+t*s[0]+s[4]*s[1]-s[0]*s[5])/o}}else return{top:t,left:e,width:r,height:i};function a(o){return window.getComputedStyle(o).transform.split(/\(|,|\)/).slice(1,-1).map(function(p){return parseFloat(p)})}}var j=class{process(t,e=document.body){let r;try{r=e.getBoundingClientRect()}catch(a){r=document.body.getBoundingClientRect()}let i=Mt(t),n=i.top-r.top,s=i.left-r.left;return{top:n,left:s}}};function wt(){return"ontouchstart"in window||navigator.maxTouchPoints>0}var xt=class l{constructor(){this.modules=new Array;this.modulesUI=new Array;this.events=new q;this.loop=new K;this.wW=0;this.wH=0;this._virtualCursor=new z;this._lerp=new B;this._attribute=new G;this._boundingClientRect=new Z;this._position=new j;this._defaultSettings=new H;this.objects=new Map;this.connectQueue=new Array;this.globalId=1;this._parser=new R;this.isStarted=!1;this.fps=0;this.scrollMode="smooth";this.mMode="default";this.dMode="smooth";this.eventMap={scroll:"scroll",progress:"progress_",lerp:"lerp",inview:"inview_",cursor:"cursor","lazy-loaded":"all-image-loaded",update:"update",start:"start","mousemove-pixel":"mousemove_pixel_","mousemove-start":"mousemove_start_","mousemove-end":"mousemove_end_"};this.root=document.body,this.window=window,this.settings=new Q,this.data=new J,this.sEnSmooth=new $(document,this.settings,this.data),this.sEnDefault=new Y(document,this.settings,this.data),this.sEnDisable=new X(document,this.settings,this.data),this.sEnSmooth.onScrollStop=this.onScrollStop.bind(this),this.sEnDefault.onScrollStop=this.onScrollStop.bind(this),this.sEnDisable.onScrollStop=this.onScrollStop.bind(this),this.sEnSmooth.onChangeDirection=this.onChangeDirection.bind(this),this.sEnDefault.onChangeDirection=this.onChangeDirection.bind(this),this.sEnDisable.onChangeDirection=this.onChangeDirection.bind(this),this.sEnSmooth.onScrollStart=this.onScrollStart.bind(this),this.sEnDefault.onScrollStart=this.onScrollStart.bind(this),this.sEnDisable.onScrollStart=this.onScrollStart.bind(this),this.sEn=this.sEnSmooth,this.scrollContainer=window,this.data.sC=this.window,this.data.sD="vertical",document.documentElement.classList.add("-vertical"),this.onWheelBind=this.onWheelEvent.bind(this),this.onScrollBind=this.onScrollEvent.bind(this),this.onResizeBind=this.onResize.bind(this),this.onMouseMoveBind=this.onMouseMoveEvent.bind(this),new ResizeObserver(()=>{Array.from(this.objects.values()).forEach(e=>{this.setupObject(e.el,e)}),this.onResize()}).observe(document.documentElement),this.loop.setOnFrame(()=>{this.onUpdateEvent()}),this.rebuild(),this.on("lazy-loaded",()=>{this.rebuild()}),document.addEventListener("visibilitychange",()=>{document.hidden?this.loop.stop():this.loop.start(this.fps)})}get scrollDirection(){return this.data.sD}set scrollDirection(t){this.data.sD=t,this.sEn.scrollDirection=t,this.sEnSmooth.scrollDirection=t,this.sEnDefault.scrollDirection=t,this.sEnDisable.scrollDirection=t,t=="horizontal"?(document.documentElement.classList.add("-horizontal"),document.documentElement.classList.remove("-vertical")):(document.documentElement.classList.add("-vertical"),document.documentElement.classList.remove("-horizontal")),this.rebuild(),this.initObjects(),this.modules.forEach(e=>{e.onChangeScrollDirection()})}get speedAccelerate(){return this.settings.speedAccelerate}set speedAccelerate(t){this.settings.speedAccelerate=.1+(.5-.1)*t}get speed(){return this.settings.speed}set speed(t){this.settings.speed=t}get scrollPosition(){return this.data.c}set scrollPosition(t){this.data.c=t,this.data.t=t,window.scrollTo(0,this.data.c);for(let e=0;e<this.modules.length;e++)this.modules[e].onScroll(this.data)}set scrollContainer(t){let e=this.data.sC!=null;e&&(this.data.sC.removeEventListener("scroll",this.onScrollBind),this.data.sC.removeEventListener("resize",this.onResizeBind)),this.sEn.scrollContainer=t,this.sEnSmooth.scrollContainer=t,this.sEnDefault.scrollContainer=t,this.sEnDisable.scrollContainer=t,this.data.sC=t,e&&(this.data.sC.addEventListener("scroll",this.onScrollBind),this.data.sC.addEventListener("resize",this.onResizeBind)),this.rebuild(),this.initObjects()}set scrollMobileMode(t){this.mMode=t,this.updateModeParams()}set scrollDesktopMode(t){this.dMode=t,this.updateModeParams()}updateModeParams(){switch(this.window.innerWidth<1024||wt()?this.scrollMode=this.mMode:this.scrollMode=this.dMode,this.scrollMode){case"disable":this.data.sM="disable",this.sEn=this.sEnDisable,this.onChangeScrollParams(),document.documentElement.style.overflow="hidden";break;case"default":this.data.sM="default",this.sEn=this.sEnDefault,this.onChangeScrollParams(),document.documentElement.style.overflow="auto";break;case"smooth":this.data.sM="smooth",this.sEn=this.sEnSmooth,this.onChangeScrollParams(),document.documentElement.style.overflow="auto";break;default:this.data.sM="smooth",this.sEn=this.sEnSmooth,this.onChangeScrollParams(),document.documentElement.style.overflow="auto";break}}static getInstance(){return l.i||(l.i=new l),l.i}reuse(t){return this.modules.find(r=>r instanceof t)}use(t,e=null){let r=new t({data:this.data,lerp:this._lerp,attribute:this._attribute,boundingClientRect:this._boundingClientRect,position:this._position,virtualCursor:this._virtualCursor,events:this.events,loop:this.loop,defaultSettings:this._defaultSettings,parser:this._parser},e);r.type==1&&this.modules.push(r),r.type==2&&this.modulesUI.push(r)}start(t){this.fps=t,this.data.sC.addEventListener("scroll",this.onScrollBind),this.data.sC.addEventListener("resize",this.onResizeBind),this.root.addEventListener("wheel",this.onWheelBind,{passive:!1}),this.root.addEventListener("mousemove",this.onMouseMoveBind),this.loop.start(t),document.documentElement.classList.add("-string");for(let e=0;e<this.modules.length;e++)this.modules[e].onStart();for(let e=0;e<this.modulesUI.length;e++)this.modulesUI[e].onStart();this.initObjects(),this.initMutationObserver(),this.isStarted=!0,this.events.emit("start",null)}onChangeScrollParams(){for(let t=0;t<this.modules.length;t++)this.modules[t].onChangeScrollParams();for(let t=0;t<this.modulesUI.length;t++)this.modulesUI[t].onChangeScrollParams()}initObjects(){document.querySelectorAll("[string]").forEach(t=>{this.addObject(t)}),document.querySelectorAll("[string-copy-from]").forEach(t=>{let e=this._attribute.process(t,"string-copy-from");if(e!=null&&this.objects.has(e)){let r=this.objects.get(e);r!=null&&r.connects.push(t)}}),this.modules.forEach(t=>{t.onResize(),t.onScroll(this.data),t.onUpdate(this.data)})}destroy(){this.window.removeEventListener("scroll",this.onScrollBind),this.root.removeEventListener("wheel",this.onScrollBind),this.window.removeEventListener("resize",this.onResizeBind),this.root.removeEventListener("mousemove",this.onMouseMoveBind),this.loop.stop(),this.modules.forEach(t=>{t.destructor()}),this.modulesUI.forEach(t=>{t.destructor()}),this.modules=new Array,this.modulesUI=new Array,this.events=new q}on(t,e,r=""){let i=this.eventMap[t]+r;t==="start"&&this.isStarted&&e(),this.events.on(i,e)}off(t,e,r=""){let i=this.eventMap[t]+r;this.events.off(i,e)}setupSettings(t){t["string-offset-bottom"]!=null&&(this._defaultSettings.stringOffsetStart=t["string-offset-bottom"]),t["string-offset-top"]!=null&&(this._defaultSettings.stringOffsetEnd=t["string-offset-top"]),t["string-offset-right"]!=null&&(this._defaultSettings.stringOffsetStart=t["string-offset-right"]),t["string-offset-left"]!=null&&(this._defaultSettings.stringOffsetEnd=t["string-offset-left"]),t["string-inview-top"]!=null&&(this._defaultSettings.stringInviewTop=t["string-inview-top"]),t["string-inview-left"]!=null&&(this._defaultSettings.stringInviewTop=t["string-inview-left"]),t["string-inview-bottom"]!=null&&(this._defaultSettings.stringInviewBottom=t["string-inview-bottom"]),t["string-inview-right"]!=null&&(this._defaultSettings.stringInviewBottom=t["string-inview-right"]),t["string-enter-el"]!=null&&(this._defaultSettings.stringEnterEl=t["string-enter-el"]),t["string-enter-vp"]!=null&&(this._defaultSettings.stringEnterVp=t["string-enter-vp"]),t["string-exit-el"]!=null&&(this._defaultSettings.stringExitEl=t["string-exit-el"]),t["string-exit-vp"]!=null&&(this._defaultSettings.stringExitVp=t["string-exit-vp"]),t["string-key"]!=null&&(this._defaultSettings.stringKey=t["string-key"]),t["string-strength"]!=null&&(this._defaultSettings.stringStrength=t["string-strength"]),t["string-radius"]!=null&&(this._defaultSettings.stringRadius=t["string-radius"]),t["string-lerp"]!=null&&(this._defaultSettings.stringLerp=t["string-lerp"]),t["string-parallax-bias"]!=null&&(this._defaultSettings.stringParallaxBias=t["string-parallax-bias"]),t["string-parallax"]!=null&&(this._defaultSettings.stringParallax=t["string-parallax"])}setupObject(t,e){var w,E,S,_,x,W,M,C,bt,St,Et,Pt;let r=this.getAllAttributes(t);(e==null?void 0:e.getProperty("observer-progress"))!=null&&(e==null||e.getProperty("observer-progress").disconnect()),(e==null?void 0:e.getProperty("observer-inview"))!=null&&(e==null||e.getProperty("observer-inview").disconnect()),e.id=(w=r["string-id"])!=null?w:`string-${this.globalId}`,e.keys=((E=r.string)!=null?E:"").split("|"),e.key=(S=r["string-key"])!=null?S:this._defaultSettings.stringKey,t.setAttribute("string-id",e.id);let i=this._boundingClientRect.process(t),n=i.width/this.data.scsW,s=i.height/this.data.scsH;e.setProperty("active",!0),e.setProperty("offset-end",this._parser.parseSingle((x=(_=r["string-offset-top"])!=null?_:r["string-offset-right"])!=null?x:this._defaultSettings.stringOffsetStart,t,this.data.wS,16)),e.setProperty("offset-start",this._parser.parseSingle((M=(W=r["string-offset-bottom"])!=null?W:r["string-offset-left"])!=null?M:this._defaultSettings.stringOffsetEnd,t,this.data.wS,16)),e.setProperty("inview-top",this._parser.parseSingle((bt=(C=r["string-inview-top"])!=null?C:r["string-inview-left"])!=null?bt:this._defaultSettings.stringInviewTop,t,this.data.sD=="vertical"?s:n,16)*-1),e.setProperty("inview-bottom",this._parser.parseSingle((Pt=(Et=(St=r["string-inview"])!=null?St:r["string-inview-bottom"])!=null?Et:r["string-inview-right"])!=null?Pt:this._defaultSettings.stringInviewBottom,t,this.data.sD=="vertical"?s:n,16)*-1);let a=this.data.sD=="vertical"?this._position.process(t,this.data.sC).top/this.data.scsH:this._position.process(t,this.data.sC).left/this.data.scsW;e.setProperty("start",a),e.setProperty("end",a+(this.data.sD=="vertical"?s:n)),e.setProperty("size",this.data.sD=="vertical"?s:n),e.setProperty("repeat",r["string-repeat"]!==void 0),e.setProperty("self-disable",r["string-self-disable"]!==void 0),e.setProperty("abs",r["string-abs"]!==void 0),e.setProperty("half-width",n/2),e.setProperty("half-height",s/2);let o=this.connectQueue.filter(P=>P.id==e.id);this.connectQueue=this.connectQueue.filter(P=>P.id!=e.id),o.forEach(P=>e.connects.push(P.element)),this.modules.forEach(P=>{P.tryConnect(e)&&(P.initObject(this.globalId,e,t,r),P.connect(e))});let h=e.getProperty("offset-start"),p=e.getProperty("offset-end"),d=P=>{P.forEach(tt=>{tt.isIntersecting?(this.events.emit(`activate_object_${e.id}`,!0),e.enter()):(this.events.emit(`activate_object_${e.id}`,!1),e.leave())})},u=P=>{P.forEach(tt=>{tt.isIntersecting?(this.events.emit(`inview_${e.id}`,!0),e.show()):(this.events.emit(`inview_${e.id}`,!1),e.hide())})},g={root:null,rootMargin:`${p+this.data.wS}px 0px ${h+this.data.wS}px 0px`,threshold:.001},y={root:null,rootMargin:`${p+e.getProperty("inview-top")}px 0px ${h+e.getProperty("inview-bottom")}px 0px`,threshold:.001},b=new IntersectionObserver(d,g),c=new IntersectionObserver(u,y);b.observe(t),c.observe(t),e.setProperty("observer-progress",b),e.setProperty("observer-inview",c)}getAllAttributes(t){let e={};return Array.from(t.attributes).forEach(r=>{e[r.name]=r.value}),e}addObject(t){let e=this._attribute.process(t,"string-inited"),r;e==null?r=new U(t):this.objects.has(this._attribute.process(t,"string-id"))?r=this.objects.get(this._attribute.process(t,"string-id")):r=new U(t),t.setAttribute("string-inited",""),this.setupObject(t,r),this.objects.set(r.id,r),this.globalId++}removeObject(t){let e=this.objects.get(t);(e==null?void 0:e.getProperty("observer-progress"))!=null&&(e==null||e.getProperty("observer-progress").disconnect()),(e==null?void 0:e.getProperty("observer-inview"))!=null&&(e==null||e.getProperty("observer-inview").disconnect()),this.objects.delete(t),e==null||e.el.removeAttribute("string-inited"),e==null||e.leave(),e=void 0}onMouseMoveEvent(t){this._virtualCursor.onMouseMove(t);for(let e=0;e<this.modules.length;e++)this.modules[e].onMouseMove(t);for(let e=0;e<this.modulesUI.length;e++)this.modulesUI[e].onMouseMove(t)}onWheelEvent(t){this.sEn.onWheel(t);for(let e=0;e<this.modules.length;e++)this.modules[e].onWheel(t);for(let e=0;e<this.modulesUI.length;e++)this.modulesUI[e].onWheel(t)}onScrollStart(){for(let t=0;t<this.modules.length;t++)this.modules[t].onScrollStart();for(let t=0;t<this.modulesUI.length;t++)this.modulesUI[t].onScrollStart()}onScrollStop(){for(let t=0;t<this.modules.length;t++)this.modules[t].onScrollStop();for(let t=0;t<this.modulesUI.length;t++)this.modulesUI[t].onScrollStop()}onChangeDirection(){for(let t=0;t<this.modules.length;t++)this.modules[t].onChangeDirection();for(let t=0;t<this.modulesUI.length;t++)this.modulesUI[t].onChangeDirection()}onScrollEvent(t){t.preventDefault(),this.sEn.onScroll(t);for(let e=0;e<this.modules.length;e++)this.modules[e].onScroll(this.data);for(let e=0;e<this.modulesUI.length;e++)this.modulesUI[e].onScroll(this.data);return this.events.emit("lerp",this.data.v),this.events.emit("scroll",this.data.c),!1}onUpdateEvent(){this._virtualCursor.onUpdate(),this.sEn.onUpdate();for(let t=0;t<this.modules.length;t++)this.modules[t].onUpdate(this.data);for(let t=0;t<this.modulesUI.length;t++)this.modulesUI[t].onUpdate(this.data);this.events.emit("update",null)}onResize(){let t=0,e=0;try{let r=this.sEn.scrollContainer.getBoundingClientRect();t=r.width,e=r.height}catch(r){t=this.sEn.scrollContainer.innerWidth,e=this.sEn.scrollContainer.innerHeight}this.data.sD=="vertical"?(this.data.bS=this.data.psH-e,this.data.wS=e):(this.data.bS=this.data.psW-t,this.data.wS=t),(this.wW!=t||this.window.innerWidth>1024)&&(this.rebuild(),this.modules.forEach(r=>{r.onResize()}),this.modulesUI.forEach(r=>{r.onResize()})),this.wW=t,this.wH=e}initMutationObserver(){let t=n=>{if(this._attribute.process(n,"string-fixed")!=null)return;let s=n.getAttribute("string-id"),a=this._attribute.process(n,"string-copy-from");a!=null&&(this.connectQueue=this.connectQueue.filter(o=>o.id!=a)),s!=null&&this.removeObject(s)},e=n=>{if(this._attribute.process(n,"string-fixed")!=null)return;this.addObject(n);let s=this._attribute.process(n,"string-copy-from");if(s!=null)if(this.objects.has(s)){let a=this.objects.get(s);a!=null&&a.connects.push(n)}else this.connectQueue.push({id:s,element:n})},r=new MutationObserver(n=>{n.forEach(s=>{s.type==="childList"&&(s.removedNodes.length>0&&s.removedNodes.forEach(a=>{if(a.nodeType===Node.ELEMENT_NODE){let o=a;o.hasAttribute("string")&&t(o),o.querySelectorAll("[string]").forEach(h=>{t(h)})}}),s.addedNodes.length>0&&s.addedNodes.forEach(a=>{if(a.nodeType===Node.ELEMENT_NODE){let o=a;o.hasAttribute("string")&&!o.hasAttribute("string-inited")&&e(o),o.querySelectorAll("[string]:not([string-inited])").forEach(h=>{e(h)})}}),(s.addedNodes.length>0||s.removedNodes.length>0)&&this.modules.forEach(a=>{a.onRebuild()}))})}),i={attributes:!1,childList:!0,subtree:!0};r.observe(document.body,i)}rebuild(){function t(i){return window.getComputedStyle(i).transform.split(/\(|,|\)/).slice(1,-1).map(function(s){return parseFloat(s)})}try{let i=t(this.data.sC);this.data.scsW=i[0],this.data.scsH=i[3]}catch(i){this.data.scsW=1,this.data.scsH=1}try{let i=this.data.sC.getBoundingClientRect();this.wW=i.width/this.data.scsW,this.wH=i.height/this.data.scsH}catch(i){this.wW=this.data.sC.innerWidth,this.wH=this.data.sC.innerHeight}this.wW<1024||wt()?this.scrollMode=this.mMode:this.scrollMode=this.dMode;let e=document.body,r=document.documentElement;this.data.psW=this.data.sC.scrollWidth,this.data.psH=this.data.sC.scrollHeight,this.data.psW==null&&(this.data.psW=Math.max(e.scrollWidth,e.offsetWidth,r.clientWidth,r.scrollWidth,r.offsetWidth)),this.data.psH==null&&(this.data.psH=Math.max(e.scrollHeight,e.offsetHeight,r.clientHeight,r.scrollHeight,r.offsetHeight)),this.data.sD=="vertical"?(this.data.bS=this.data.psH-this.wH,this.data.wS=this.wH):(this.data.bS=this.data.psW-this.wW,this.data.wS=this.wW),this.data.hnwS=this.data.wS*-.5,this.updateModeParams()}};export{pt as StringAnchor,at as StringCursor,J as StringData,gt as StringDelayLerpTracker,yt as StringFPSTracker,dt as StringGlide,et as StringLazy,ut as StringLerp,ft as StringLerpTracker,rt as StringLoading,ot as StringMagnetic,m as StringModule,U as StringObject,ct as StringParallax,vt as StringPositionTracker,A as StringProgress,lt as StringResponsive,st as StringSVG,ht as StringScrollbar,mt as StringSplit,xt as StringTune,it as StringVideoAutoplay,xt as default};
23
+ `,document.head.appendChild(e),this.displayElement=t}};function Wt(c,t){let e=null;return function(...r){let i=this;e&&clearTimeout(e),e=setTimeout(()=>{c.apply(i,r),e=null},t)}}var ht=class{constructor(){this.fps=0;this.isAnimationStarted=!1;this.fpsInterval=0;this.then=0;this.requestAnimationId=0;this.onFrameCallback=t=>{};this.animate=()=>{};this.onVisibilityChangeBind=this.onVisibilityChange.bind(this)}onVisibilityChange(){document.hidden?(this.stop(),this.isAnimationStarted=!1):this.start(this.fps)}start(t){this.fps=t,!this.isAnimationStarted&&(this.fpsInterval=1e3/t,this.then=performance.now(),this.isAnimationStarted=!0,t===0?this.animate=()=>{let e=performance.now();this.requestAnimationId=requestAnimationFrame(()=>this.animate()),this.onFrameCallback(e)}:this.animate=()=>{let e=performance.now(),r=e-this.then;r>this.fpsInterval&&(this.then=e-r%this.fpsInterval,this.onFrameCallback(e)),this.requestAnimationId=requestAnimationFrame(()=>this.animate())},this.animate())}stop(){this.isAnimationStarted&&(cancelAnimationFrame(this.requestAnimationId),this.requestAnimationId=0,this.isAnimationStarted=!1)}setOnFrame(t){this.onFrameCallback=t}destructor(){this.stop()}};var At=class extends h{constructor(t){super(t),this.htmlKey="autoplay",this.attributesToMap=[...this.attributesToMap,{key:"src",type:"string",fallback:""}]}onObjectConnected(t){t.setProperty("onEnterEvent",this.onEnterObject.bind(this)),t.events.on("enter",t.getProperty("onEnterEvent")),t.setProperty("onLeaveEvent",this.onLeaveObject.bind(this)),t.events.on("leave",t.getProperty("onLeaveEvent"));let e=t.htmlElement,r=this.tools.domAttribute.process({element:e,key:"string-started",fallback:null})!==null;e.tagName.toLowerCase()==="video"&&!r&&(e.setAttribute("string-started",""),e.muted=!0,e.setAttribute("muted","muted"),e.setAttribute("playsinline",""),e.setAttribute("loop",""),e.setAttribute("autoplay",""),e.src=t.getProperty("src"),e.load(),e.addEventListener("canplay",()=>{}))}onEnterObject(t){let e=t.htmlElement;this.tryPlay(e)}onLeaveObject(t){t.htmlElement.pause()}tryPlay(t){t.play().catch(e=>console.warn("[StringVideoAutoplay] Autoplay failed:",e))}};var Vt=class c{constructor(){this.prevWidth=0;this.prevHeight=0;this.loop=new ht;this.debouncedResize=Wt(this.onResize,30);this.root=document.body,this.window=window,this.tools=new pt,this.data=new ot,this.eventManager=new w,this.moduleManager=new X(this.data),this.objectManager=new _(this.data,this.moduleManager,this.eventManager),this.context={events:this.eventManager,data:this.data,tools:this.tools,settings:{}},this.cursorController=new U(1,this.context),this.scrollManager=new J(this.context),this.setupSettings({"offset-top":"0%","offset-bottom":"0%",key:"--progress","inview-top":"0%","inview-bottom":"0%","enter-el":"top","enter-vp":"bottom","exit-el":"bottom","exit-vp":"top","parallax-bias":"0.0",parallax:"0.2",lerp:"0.2",radius:"150",strength:"0.3",glide:"1",anchor:"center center",timeout:900,alignment:"center","target-disable":"false","target-style-disable":"false","target-class":"",active:"false",fixed:"false",repeat:"false","self-disable":"false",abs:"false",easing:"cubic-bezier(0.25, 0.25, 0.25, 0.25)","glide-base-velocity":.00125,"glide-reduce-velocity":625e-7,"glide-negative-velocity":-1e-4}),this.onWheelBind=this.onWheelEvent.bind(this),this.onScrollBind=this.onScrollEvent.bind(this),this.onResizeBind=this.onResize.bind(this),this.onMouseMoveBind=this.onMouseMoveEvent.bind(this),this.onScrollStartBind=this.onScrollStart.bind(this),this.onScrollStopBind=this.onScrollStop.bind(this),this.onDirectionChangeBind=this.onDirectionChange.bind(this),this.scrollManager.bindEvents({onScrollStart:this.onScrollStartBind,onScrollStop:this.onScrollStopBind,onDirectionChange:this.onDirectionChangeBind}),this.loop.setOnFrame(t=>{this.data.time.delta=t-this.data.time.now,this.data.time.previous=this.data.time.now,this.data.time.now=t,this.data.time.elapsed+=this.data.time.delta,this.onUpdateEvent()}),this.on("image:load:all",()=>{this.onResize()}),this.scrollContainer=window}set scrollPosition(t){this.data.scroll.current=t,this.data.scroll.target=t,this.data.scroll.delta=0,this.data.scroll.lerped=0,this.scrollManager.updatePosition()}set scrollContainer(t){t instanceof Window?(this.data.scroll.container=document.body,this.data.scroll.elementContainer=document.documentElement,this.data.scroll.scrollContainer=t):t instanceof HTMLElement?(this.data.scroll.container=t,this.data.scroll.elementContainer=t,this.data.scroll.scrollContainer=t):(this.data.scroll.container=document.body,this.data.scroll.elementContainer=document.documentElement,this.data.scroll.scrollContainer=t),this.debouncedResize()}get speed(){return this.data.scroll.current}set speed(t){this.data.scroll.speed=t}set speedAccelerate(t){this.data.scroll.speedAccelerate=.1+(.5-.1)*t}set scrollDesktopMode(t){this.scrollManager.setDesktopMode(t)}set scrollMobileMode(t){this.scrollManager.setMobileMode(t)}static getInstance(){return c.i||(c.i=new c),c.i}reuse(t){return this.moduleManager.find(t)}use(t,e=null){let r={...this.context.settings,...e},i=new t({events:this.eventManager,data:this.data,tools:this.tools,settings:r});this.moduleManager.register(i)}on(t,e,r=""){this.eventManager.on(t,e,r)}off(t,e,r=""){this.eventManager.off(t,e,r)}start(t){this.data.scroll.scrollContainer?.addEventListener("scroll",this.onScrollBind),this.data.scroll.container?.addEventListener("wheel",this.onWheelBind,{passive:!1}),window.addEventListener("resize",this.onResizeBind),this.root.addEventListener("mousemove",this.onMouseMoveBind),new ResizeObserver(()=>{this.debouncedResize()}).observe(this.context.data.scroll.container);let r=new MutationObserver((n,a)=>{for(let p of n)p.type==="attributes"&&(p.attributeName==="style"||p.attributeName==="class")&&this.onResize()}),i={attributes:!0,attributeFilter:["style","class"]};r.observe(this.context.data.scroll.container,i),this.use(dt);let o=window.getComputedStyle(document.documentElement).fontSize,s=parseFloat(o);this.context.data.viewport.baseRem=s,document.documentElement.classList.add("-string"),this.moduleManager.onInit(),this.onResize(),this.initObjects(),this.objectManager.observeDOM(),this.loop.start(t),this.eventManager.emit("start",null)}initObjects(){document.querySelectorAll("[string],[data-string]").forEach(t=>{this.objectManager.add(t)}),document.querySelectorAll("[string-copy-from],[data-string-copy-from]").forEach(t=>{let e=this.tools.domAttribute.process({element:t,key:"copy-from",fallback:""});e&&e.length>0&&this.objectManager.enqueueConnection(e,t)}),this.moduleManager.onResize(),this.moduleManager.onScroll(),this.moduleManager.onFrame()}setupSettings(t){this.context.settings={...this.context.settings,...t},this.onSettingsChange()}onMouseMoveEvent(t){this.cursorController.onMouseMove(t),this.moduleManager.onMouseMove(t)}onWheelEvent(t){this.scrollManager.get().onWheel(t),this.moduleManager.onWheel(t)}onScrollStart(){this.moduleManager.onScrollStart()}onScrollStop(){this.moduleManager.onScrollStop()}onDirectionChange(){this.moduleManager.onDirectionChange()}onSettingsChange(){this.cursorController.onSettingsChange(),this.objectManager.onSettingsChange(),this.moduleManager.onSettingsChange()}onScrollEvent(t){return t.preventDefault(),this.scrollManager.get().onScroll(t),this.moduleManager.onScroll(),this.eventManager.emit("lerp",this.data.scroll.lerped),this.eventManager.emit("scroll",this.data.scroll.current),!1}onUpdateEvent(){this.cursorController.onFrame(),this.scrollManager.get().onFrame(),this.moduleManager.onFrame(),this.eventManager.emit("update",null)}onResize(){let t=this.data.scroll.container,e=this.context.data.scroll,r=0,i=0;var o,s=0;let n=t.getBoundingClientRect();t.tagName=="BODY"?(r=window.innerWidth,i=window.innerHeight):(r=n.width,i=n.height),s=n.top,o=e.container.scrollHeight;let a=this.tools.transformScaleParser.process({value:window.getComputedStyle(t).transform});this.context.data.viewport.transformScale=a;let p=r>1080,d=this.prevWidth!==r,m=this.prevHeight!==i,l=this.context.data.viewport.contentHeight!==o,g=d||p&&m||l;this.context.data.scroll.topPosition=s,this.context.data.viewport.contentWidth=r,this.context.data.viewport.contentHeight=o,this.prevWidth=r,this.prevHeight=i,this.context.data.viewport.windowWidth=r,this.context.data.viewport.windowHeight=i;let b=window.getComputedStyle(document.documentElement).fontSize,u=parseFloat(b);this.context.data.viewport.baseRem=u*a,e.bottomPosition=this.context.data.viewport.contentHeight-i,g&&(this.context.data.scroll.current=this.context.data.scroll.container.scrollTop,this.context.data.scroll.target=this.context.data.scroll.container.scrollTop,this.context.data.scroll.transformedCurrent=this.context.data.scroll.current*this.context.data.viewport.transformScale,this.scrollManager.updateResponsiveMode(),this.moduleManager.onResize(),this.onSettingsChange(),this.moduleManager.onScroll(),this.moduleManager.onFrame())}destroy(){this.data.scroll.scrollContainer?.removeEventListener("scroll",this.onScrollBind),this.data.scroll.container?.removeEventListener("wheel",this.onScrollBind),this.window.removeEventListener("resize",this.onResizeBind),this.root.removeEventListener("mousemove",this.onMouseMoveBind),this.loop.stop(),this.moduleManager.destroy(),this.eventManager.clearAll()}};export{wt as StringAnchor,yt as StringCursor,ot as StringData,Ot as StringDelayLerpTracker,Dt as StringFPSTracker,Ct as StringGlide,xt as StringLazy,Tt as StringLerp,kt as StringLerpTracker,Mt as StringLoading,St as StringMagnetic,h as StringModule,P as StringObject,Pt as StringParallax,Rt as StringPositionTracker,$ as StringProgress,Et as StringResponsive,It as StringScrollbar,Lt as StringSplit,Vt as StringTune,At as StringVideoAutoplay,Vt as default};
40
24
  //# sourceMappingURL=index.mjs.map